Feature: Created a tanClick directive which disables button on click while loading
Fix: Could not change the main ledger in payment/receipt edit Fix: Added try/catch to client delete
This commit is contained in:
1 parent
d1a4fc1164
commit
536bf27403
11 files changed
+38
-27
No files matched your search
+27
-1
@@ -173,4 +173,30 @@ overlord_directive.directive('tanSse', ['$parse', function ($parse) {
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
overlord_directive.directive('tanClick', ['$parse', '$timeout', function ($parse, $timeout) {
|
||||
return {
|
||||
compile: function ($element, attr) {
|
||||
var fn = $parse(attr.tanClick);
|
||||
return function (scope, element, attr) {
|
||||
element.on('click', function (event) {
|
||||
scope.$apply(function () {
|
||||
var disabled = attr.ngDisabled ? $parse(attr.ngDisabled) : angular.noop;
|
||||
attr.$set('disabled', true);
|
||||
var v = fn(scope, {$event: event}) || angular.noop;
|
||||
if (v && v.then) {
|
||||
v.finally(function () {
|
||||
attr.$set('disabled', !!disabled(scope) || false);
|
||||
});
|
||||
} else {
|
||||
$timeout(function () {
|
||||
attr.$set('disabled', !!disabled(scope) || false);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -28,7 +28,7 @@ var EmployeeAttendanceCtrl = ['$scope', '$location', '$routeParams', 'dateFilter
|
||||
};
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.info.$save(function (u, putResponseHeaders) {
|
||||
return $scope.info.$save(function (u, putResponseHeaders) {
|
||||
$scope.toasts.push({Type: 'Success', Message: 'Saved!'});
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
||||
|
||||
@@ -7,7 +7,7 @@ var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope,
|
||||
return;
|
||||
}
|
||||
var salary_month = dateFilter($scope.salaryMonth, 'dd-MMM-yyyy');
|
||||
$http.
|
||||
return $http.
|
||||
post('/api/CreditSalary', {Month: salary_month}).
|
||||
success(function (data) {
|
||||
$scope.toasts.push({Type: 'Success', Message: data.message});
|
||||
|
||||
@@ -11,10 +11,10 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
when('/Journal/:id', {templateUrl: '/partial/journal.html', controller: JournalCtrl, resolve: JournalCtrl.resolve}).
|
||||
|
||||
when('/Payment', {templateUrl: '/partial/payment.html', controller: PaymentCtrl, resolve: PaymentCtrl.resolve, reloadOnSearch:false}).
|
||||
when('/Payment/:id', {templateUrl: '/partial/payment.html', controller: PaymentCtrl, resolve: PaymentCtrl.resolve}).
|
||||
when('/Payment/:id', {templateUrl: '/partial/payment.html', controller: PaymentCtrl, resolve: PaymentCtrl.resolve, reloadOnSearch:false}).
|
||||
|
||||
when('/Receipt', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl, resolve: ReceiptCtrl.resolve, reloadOnSearch:false}).
|
||||
when('/Receipt/:id', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl, resolve: ReceiptCtrl.resolve}).
|
||||
when('/Receipt/:id', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl, resolve: ReceiptCtrl.resolve, reloadOnSearch:false}).
|
||||
|
||||
when('/Purchase', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl, resolve: PurchaseCtrl.resolve}).
|
||||
when('/Purchase/:id', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl, resolve: PurchaseCtrl.resolve}).
|
||||
|
||||
@@ -45,7 +45,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'le
|
||||
var j = _.find(journals,{'Debit': -1});
|
||||
j.Amount = amount;
|
||||
if (_.find(oldValue, {'Debit': -1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
||||
$location.path('/Payment').search({a: j.Ledger.LedgerID}).replace();
|
||||
$location.search({a: j.Ledger.LedgerID}).replace();
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
||||
var j = _.find(journals, {'Debit': 1});
|
||||
j.Amount = amount;
|
||||
if (_.find(oldValue, {'Debit': 1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
||||
$location.path('/Receipt').search({a: j.Ledger.LedgerID}).replace();
|
||||
$location.search({a: j.Ledger.LedgerID}).replace();
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user