Files
InventoryTraker-Box/InventoryTraker.Web/js/report/DistributionReportQueryDirective.js
T
2016-09-16 10:34:14 -04:00

33 lines
778 B
JavaScript

(function() {
'use strict';
window.app.directive('distributionReportQuery', distributionReportQuery);
function distributionReportQuery() {
return {
scope: true,
templateUrl: '/report/template/distributionReportQuery.tmpl.cshtml',
controller: controller,
controllerAs: 'vm'
}
}
controller.$inject = ['$scope', 'reportSvc'];
function controller($scope, reportSvc) {
var vm = this;
vm.query = {};
vm.submitting = false;
vm.errorMessages = [];
vm.submit = submit;
function submit() {
vm.submitting = true;
reportSvc.loadDistributionReport(vm.query)
.error(function (data) {
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
})
.finally(function () {
vm.submitting = false;
});
}
}
})();