From e5f8a4f86f0c1cd832d0762d776d79278446cea1 Mon Sep 17 00:00:00 2001 From: Amritanshu <tanshu@gmail.com> Date: Tue, 17 Dec 2013 15:48:22 +0530 Subject: [PATCH] Feature: Added timeout / loading button for vouchers and a few other forms. --- brewman/static/partial/attendance.html | 2 +- brewman/static/partial/employee-functions.html | 2 +- brewman/static/partial/issue.html | 6 +++--- brewman/static/partial/journal.html | 4 ++-- brewman/static/partial/payment.html | 4 ++-- brewman/static/partial/purchase-return.html | 4 ++-- brewman/static/partial/purchase.html | 4 ++-- brewman/static/partial/receipt.html | 4 ++-- brewman/static/scripts/attendance.js | 2 +- brewman/static/scripts/employee-functions.js | 2 +- brewman/static/scripts/issue.js | 7 ++++--- brewman/static/scripts/journal.js | 4 ++-- brewman/static/scripts/payment.js | 4 ++-- brewman/static/scripts/purchase-return.js | 4 ++-- brewman/static/scripts/purchase.js | 4 ++-- brewman/static/scripts/receipt.js | 4 ++-- 16 files changed, 31 insertions(+), 30 deletions(-) diff --git a/brewman/static/partial/attendance.html b/brewman/static/partial/attendance.html index 4329e256..58fd8cbf 100644 --- a/brewman/static/partial/attendance.html +++ b/brewman/static/partial/attendance.html @@ -50,7 +50,7 @@ </table> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> - <button ng-click="save()" ng-disabled="isClean() || frmForm.$invalid" class="btn btn-primary">Save</button> + <button tan-click="save()" ng-disabled="isClean() || frmForm.$invalid" class="btn btn-primary">Save</button> </div> </div> </form> diff --git a/brewman/static/partial/employee-functions.html b/brewman/static/partial/employee-functions.html index c8f5afff..41415a3f 100644 --- a/brewman/static/partial/employee-functions.html +++ b/brewman/static/partial/employee-functions.html @@ -58,7 +58,7 @@ onchange="angular.element(this).scope().setFile(this)"/> <div class="input-group-btn"> - <button class="btn btn-success" ng-click="uploadFingerprints()">Upload <i + <button class="btn btn-success" tan-click="uploadFingerprints()">Upload <i class="glyphicon glyphicon-cloud-upload"></i></button> </div> </div> diff --git a/brewman/static/partial/issue.html b/brewman/static/partial/issue.html index 4f229ec8..ba68c753 100644 --- a/brewman/static/partial/issue.html +++ b/brewman/static/partial/issue.html @@ -103,14 +103,14 @@ </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> - <button class="btn btn-primary" ng-click="save()" + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}} </button> - <button class="btn btn-danger" ng-click="resetVoucher(voucher.VoucherID)" ng-hide="!voucher.VoucherID"> + <button class="btn btn-danger" ng-click="resetVoucher()" ng-hide="!voucher.VoucherID"> New Entry </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" - ng-click="confirm()">Delete + tan-click="confirm()">Delete </button> </div> </div> diff --git a/brewman/static/partial/journal.html b/brewman/static/partial/journal.html index aafea660..0ac74b0d 100644 --- a/brewman/static/partial/journal.html +++ b/brewman/static/partial/journal.html @@ -81,10 +81,10 @@ </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> - <button class="btn btn-primary" ng-click="save()" ng-disabled="preventAlteration(voucher)"> + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)"> {{voucher.VoucherID | save_button}} </button> - <button class="btn btn-inverse" ng-click="post()" ng-hide="!voucher.VoucherID" + <button class="btn btn-inverse" tan-click="post()" ng-hide="!voucher.VoucherID" ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}} </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" diff --git a/brewman/static/partial/payment.html b/brewman/static/partial/payment.html index 78c3ab50..361bdcb7 100644 --- a/brewman/static/partial/payment.html +++ b/brewman/static/partial/payment.html @@ -81,10 +81,10 @@ </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> - <button class="btn btn-primary" ng-click="save()" ng-disabled="preventAlteration(voucher)"> + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)"> {{voucher.VoucherID | save_button}} </button> - <button class="btn btn-inverse" ng-click="post()" ng-hide="!voucher.VoucherID" + <button class="btn btn-inverse" tan-click="post()" ng-hide="!voucher.VoucherID" ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}} </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" diff --git a/brewman/static/partial/purchase-return.html b/brewman/static/partial/purchase-return.html index a482a9b3..ad285876 100644 --- a/brewman/static/partial/purchase-return.html +++ b/brewman/static/partial/purchase-return.html @@ -86,10 +86,10 @@ </div> </div> <div class="form-actions"> - <button class="btn btn-primary" ng-click="save()" + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}} </button> - <button class="btn btn-inverse" ng-click="post()" ng-hide="!voucher.VoucherID" + <button class="btn btn-inverse" tan-click="post()" ng-hide="!voucher.VoucherID" ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}} </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" diff --git a/brewman/static/partial/purchase.html b/brewman/static/partial/purchase.html index 48cc7b7f..db79d3c5 100644 --- a/brewman/static/partial/purchase.html +++ b/brewman/static/partial/purchase.html @@ -92,10 +92,10 @@ </div> </div> <div class="form-actions"> - <button class="btn btn-primary" ng-click="save()" + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}} </button> - <button class="btn btn-inverse" ng-click="post()" ng-hide="!voucher.VoucherID" + <button class="btn btn-inverse" tan-click="post()" ng-hide="!voucher.VoucherID" ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}} </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" diff --git a/brewman/static/partial/receipt.html b/brewman/static/partial/receipt.html index 446c3149..b358d821 100644 --- a/brewman/static/partial/receipt.html +++ b/brewman/static/partial/receipt.html @@ -81,10 +81,10 @@ </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> - <button class="btn btn-primary" ng-click="save()" ng-disabled="preventAlteration(voucher)"> + <button class="btn btn-primary" tan-click="save()" ng-disabled="preventAlteration(voucher)"> {{voucher.VoucherID | save_button}} </button> - <button class="btn btn-inverse" ng-click="post()" ng-hide="!voucher.VoucherID" + <button class="btn btn-inverse" tan-click="post()" ng-hide="!voucher.VoucherID" ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}} </button> <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" diff --git a/brewman/static/scripts/attendance.js b/brewman/static/scripts/attendance.js index bd29541b..f6257750 100644 --- a/brewman/static/scripts/attendance.js +++ b/brewman/static/scripts/attendance.js @@ -13,7 +13,7 @@ var AttendanceCtrl = ['$scope', '$location', 'dateFilter', 'Attendance', 'attend if (angular.isDate($scope.info.Date)) { $scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy'); } - $scope.info.$save(function (u, putResponseHeaders) { + return $scope.info.$save(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: u.Code}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data}); diff --git a/brewman/static/scripts/employee-functions.js b/brewman/static/scripts/employee-functions.js index 9eeb40f5..e1c8d7b7 100644 --- a/brewman/static/scripts/employee-functions.js +++ b/brewman/static/scripts/employee-functions.js @@ -37,7 +37,7 @@ var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope, } var fd = new FormData(); fd.append("uploadedFile", $scope.uploadedFile); - $http + return $http .post('/api/Fingerprint', fd, { headers: { 'Content-Type': undefined diff --git a/brewman/static/scripts/issue.js b/brewman/static/scripts/issue.js index 332ca26d..84c8d9ec 100644 --- a/brewman/static/scripts/issue.js +++ b/brewman/static/scripts/issue.js @@ -111,7 +111,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher', } }, true); - $scope.resetVoucher = function (voucherid) { + $scope.resetVoucher = function () { var date = $scope.voucher.Date; var source = getDebitCredit($scope.voucher.Journals, -1); var destination = getDebitCredit($scope.voucher.Journals, 1); @@ -151,7 +151,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher', }; $scope.delete = function () { - $scope.voucher.$delete(function (u, putResponseHeaders) { + return $scope.voucher.$delete(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); var date = u.Date; var source = getDebitCredit(u.Journals, -1); @@ -219,8 +219,9 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher', }] }); modalInstance.result.then(function () { - $scope.delete(); + return $scope.delete(); }); + return modalInstance; }; $scope.batches = function ($viewValue) { diff --git a/brewman/static/scripts/journal.js b/brewman/static/scripts/journal.js index 2f6e48f4..8588fa70 100644 --- a/brewman/static/scripts/journal.js +++ b/brewman/static/scripts/journal.js @@ -74,7 +74,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Ac if (angular.isDate($scope.voucher.Date)) { $scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); } - $scope.voucher.$save({type: 'Journal'}, function (u, putResponseHeaders) { + return $scope.voucher.$save({type: 'Journal'}, function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); $location.path('/Journal/' + u.VoucherID); }, function (data, status) { @@ -92,7 +92,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Ac }; $scope.post = function () { - $scope.voucher.$post(function (u, putResponseHeaders) { + return $scope.voucher.$post(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data}); diff --git a/brewman/static/scripts/payment.js b/brewman/static/scripts/payment.js index a8ef376e..844e71c5 100644 --- a/brewman/static/scripts/payment.js +++ b/brewman/static/scripts/payment.js @@ -75,7 +75,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'le if (angular.isDate($scope.voucher.Date)) { $scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); } - $scope.voucher.$save({type: 'Payment'}, function (u, putResponseHeaders) { + return $scope.voucher.$save({type: 'Payment'}, function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); $location.path('/Payment/' + u.VoucherID); }, function (data, status) { @@ -93,7 +93,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'le }; $scope.post = function () { - $scope.voucher.$post(function (u, putResponseHeaders) { + return $scope.voucher.$post(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data}); diff --git a/brewman/static/scripts/purchase-return.js b/brewman/static/scripts/purchase-return.js index 597aeb0c..d8d3ce0c 100644 --- a/brewman/static/scripts/purchase-return.js +++ b/brewman/static/scripts/purchase-return.js @@ -84,7 +84,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouche if (angular.isDate($scope.voucher.Date)) { $scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); } - $scope.voucher.$save({type: 'Purchase Return'}, function (u, putResponseHeaders) { + return $scope.voucher.$save({type: 'Purchase Return'}, function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); $location.path('/Return/' + u.VoucherID); }, function (data, status) { @@ -102,7 +102,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouche }; $scope.post = function () { - $scope.voucher.$post(function (u, putResponseHeaders) { + return $scope.voucher.$post(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data}); diff --git a/brewman/static/scripts/purchase.js b/brewman/static/scripts/purchase.js index ac70cffb..5fab85a9 100644 --- a/brewman/static/scripts/purchase.js +++ b/brewman/static/scripts/purchase.js @@ -89,7 +89,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'A if (angular.isDate($scope.voucher.Date)) { $scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); } - $scope.voucher.$save({type: 'Purchase'}, function (u, putResponseHeaders) { + return $scope.voucher.$save({type: 'Purchase'}, function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); $location.path('/Purchase/' + u.VoucherID); }, function (data, status) { @@ -107,7 +107,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'A }; $scope.post = function () { - $scope.voucher.$post(function (u, putResponseHeaders) { + return $scope.voucher.$post(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data}); diff --git a/brewman/static/scripts/receipt.js b/brewman/static/scripts/receipt.js index 3ca8be20..44e938cf 100644 --- a/brewman/static/scripts/receipt.js +++ b/brewman/static/scripts/receipt.js @@ -75,7 +75,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal' if (angular.isDate($scope.voucher.Date)) { $scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); } - $scope.voucher.$save({type: 'Receipt'}, function (u, putResponseHeaders) { + return $scope.voucher.$save({type: 'Receipt'}, function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); $location.path('/Receipt/' + u.VoucherID); }, function (data, status) { @@ -93,7 +93,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal' }; $scope.post = function () { - $scope.voucher.$post(function (u, putResponseHeaders) { + return $scope.voucher.$post(function (u, putResponseHeaders) { $scope.toasts.push({Type: 'Success', Message: ''}); }, function (data, status) { $scope.toasts.push({Type: 'Danger', Message: data.data});