Feature: Added timeout / loading button for vouchers and a few other forms.

This commit is contained in:
Amritanshu 2013-12-17 15:48:22 +05:30
parent 66aca999e2
commit e5f8a4f86f
16 changed files with 31 additions and 30 deletions

@ -50,7 +50,7 @@
</table> </table>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <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>
</div> </div>
</form> </form>

@ -58,7 +58,7 @@
onchange="angular.element(this).scope().setFile(this)"/> onchange="angular.element(this).scope().setFile(this)"/>
<div class="input-group-btn"> <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> class="glyphicon glyphicon-cloud-upload"></i></button>
</div> </div>
</div> </div>

@ -103,14 +103,14 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <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}} ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}}
</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 New Entry
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"
ng-click="confirm()">Delete tan-click="confirm()">Delete
</button> </button>
</div> </div>
</div> </div>

@ -81,10 +81,10 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <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}} {{voucher.VoucherID | save_button}}
</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}} ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}}
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"

@ -81,10 +81,10 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <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}} {{voucher.VoucherID | save_button}}
</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}} ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}}
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"

@ -86,10 +86,10 @@
</div> </div>
</div> </div>
<div class="form-actions"> <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}} ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}}
</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}} ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}}
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"

@ -92,10 +92,10 @@
</div> </div>
</div> </div>
<div class="form-actions"> <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}} ng-disabled="preventAlteration(voucher)">{{voucher.VoucherID | save_button}}
</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}} ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}}
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"

@ -81,10 +81,10 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <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}} {{voucher.VoucherID | save_button}}
</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}} ng-disabled="voucher.Posted || !perms['Post Vouchers']">{{voucher.Posted | posted}}
</button> </button>
<button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)" <button class="btn btn-danger" ng-hide="!voucher.VoucherID" ng-disabled="preventAlteration(voucher)"

@ -13,7 +13,7 @@ var AttendanceCtrl = ['$scope', '$location', 'dateFilter', 'Attendance', 'attend
if (angular.isDate($scope.info.Date)) { if (angular.isDate($scope.info.Date)) {
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy'); $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}); $scope.toasts.push({Type: 'Success', Message: u.Code});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});

@ -37,7 +37,7 @@ var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope,
} }
var fd = new FormData(); var fd = new FormData();
fd.append("uploadedFile", $scope.uploadedFile); fd.append("uploadedFile", $scope.uploadedFile);
$http return $http
.post('/api/Fingerprint', fd, { .post('/api/Fingerprint', fd, {
headers: { headers: {
'Content-Type': undefined 'Content-Type': undefined

@ -111,7 +111,7 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
} }
}, true); }, true);
$scope.resetVoucher = function (voucherid) { $scope.resetVoucher = function () {
var date = $scope.voucher.Date; var date = $scope.voucher.Date;
var source = getDebitCredit($scope.voucher.Journals, -1); var source = getDebitCredit($scope.voucher.Journals, -1);
var destination = 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.delete = function () {
$scope.voucher.$delete(function (u, putResponseHeaders) { return $scope.voucher.$delete(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
var date = u.Date; var date = u.Date;
var source = getDebitCredit(u.Journals, -1); var source = getDebitCredit(u.Journals, -1);
@ -219,8 +219,9 @@ var IssueCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', 'voucher',
}] }]
}); });
modalInstance.result.then(function () { modalInstance.result.then(function () {
$scope.delete(); return $scope.delete();
}); });
return modalInstance;
}; };
$scope.batches = function ($viewValue) { $scope.batches = function ($viewValue) {

@ -74,7 +74,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Ac
if (angular.isDate($scope.voucher.Date)) { if (angular.isDate($scope.voucher.Date)) {
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); $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: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Journal/' + u.VoucherID); $location.path('/Journal/' + u.VoucherID);
}, function (data, status) { }, function (data, status) {
@ -92,7 +92,7 @@ var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Ac
}; };
$scope.post = function () { $scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) { return $scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});

@ -75,7 +75,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'le
if (angular.isDate($scope.voucher.Date)) { if (angular.isDate($scope.voucher.Date)) {
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); $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: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Payment/' + u.VoucherID); $location.path('/Payment/' + u.VoucherID);
}, function (data, status) { }, function (data, status) {
@ -93,7 +93,7 @@ var PaymentCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'le
}; };
$scope.post = function () { $scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) { return $scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});

@ -84,7 +84,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouche
if (angular.isDate($scope.voucher.Date)) { if (angular.isDate($scope.voucher.Date)) {
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); $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: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Return/' + u.VoucherID); $location.path('/Return/' + u.VoucherID);
}, function (data, status) { }, function (data, status) {
@ -102,7 +102,7 @@ var PurchaseReturnCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'vouche
}; };
$scope.post = function () { $scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) { return $scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});

@ -89,7 +89,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'A
if (angular.isDate($scope.voucher.Date)) { if (angular.isDate($scope.voucher.Date)) {
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); $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: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Purchase/' + u.VoucherID); $location.path('/Purchase/' + u.VoucherID);
}, function (data, status) { }, function (data, status) {
@ -107,7 +107,7 @@ var PurchaseCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'A
}; };
$scope.post = function () { $scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) { return $scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});

@ -75,7 +75,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
if (angular.isDate($scope.voucher.Date)) { if (angular.isDate($scope.voucher.Date)) {
$scope.voucher.Date = dateFilter($scope.voucher.Date, 'dd-MMM-yyyy'); $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: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Receipt/' + u.VoucherID); $location.path('/Receipt/' + u.VoucherID);
}, function (data, status) { }, function (data, status) {
@ -93,7 +93,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
}; };
$scope.post = function () { $scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) { return $scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''}); $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) { }, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data}); $scope.toasts.push({Type: 'Danger', Message: data.data});