diff --git a/brewman/models/voucher.py b/brewman/models/voucher.py
index e9fd64a9..9e727628 100644
--- a/brewman/models/voucher.py
+++ b/brewman/models/voucher.py
@@ -260,6 +260,7 @@ class Batch(Base):
def suspense(cls):
return uuid.UUID('a955790e-93cf-493c-a816-c7d92b127383')
+
class Attendance(Base):
__tablename__ = 'entities_attendances'
@@ -296,7 +297,7 @@ class Attendance(Base):
def create(self):
old = DBSession.query(Attendance).filter(Attendance.date == self.date) \
.filter(Attendance.employee_id == self.employee_id) \
- .filter(Attendance.is_valid == True).first()
+ .filter(Attendance.is_valid is True).first()
if old is None or old.attendance_type != self.attendance_type:
if old is not None:
old.is_valid = False
diff --git a/brewman/static/partial/employee-attendance.html b/brewman/static/partial/employee-attendance.html
index 6176ccc5..c9f35cd1 100644
--- a/brewman/static/partial/employee-attendance.html
+++ b/brewman/static/partial/employee-attendance.html
@@ -68,7 +68,7 @@
diff --git a/brewman/static/partial/employee-functions.html b/brewman/static/partial/employee-functions.html
index b60b5889..c8f5afff 100644
--- a/brewman/static/partial/employee-functions.html
+++ b/brewman/static/partial/employee-functions.html
@@ -14,7 +14,7 @@
-
diff --git a/brewman/static/scripts/angular_directive.js b/brewman/static/scripts/angular_directive.js
index 82f8a0a8..bdec6b6e 100644
--- a/brewman/static/scripts/angular_directive.js
+++ b/brewman/static/scripts/angular_directive.js
@@ -173,4 +173,30 @@ overlord_directive.directive('tanSse', ['$parse', function ($parse) {
}, false);
}
};
-}]);
\ No newline at end of file
+}]);
+
+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);
+ }
+ });
+ });
+ };
+ }
+ };
+}]);
diff --git a/brewman/static/scripts/employee-attendance.js b/brewman/static/scripts/employee-attendance.js
index 0a6269af..402faa8c 100644
--- a/brewman/static/scripts/employee-attendance.js
+++ b/brewman/static/scripts/employee-attendance.js
@@ -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});
diff --git a/brewman/static/scripts/employee-functions.js b/brewman/static/scripts/employee-functions.js
index cdc008f9..9eeb40f5 100644
--- a/brewman/static/scripts/employee-functions.js
+++ b/brewman/static/scripts/employee-functions.js
@@ -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});
diff --git a/brewman/static/scripts/overlord.js b/brewman/static/scripts/overlord.js
index 6ffee7e3..2a25f022 100644
--- a/brewman/static/scripts/overlord.js
+++ b/brewman/static/scripts/overlord.js
@@ -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}).
diff --git a/brewman/static/scripts/payment.js b/brewman/static/scripts/payment.js
index 4984935f..a8ef376e 100644
--- a/brewman/static/scripts/payment.js
+++ b/brewman/static/scripts/payment.js
@@ -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);
diff --git a/brewman/static/scripts/receipt.js b/brewman/static/scripts/receipt.js
index a560feef..3ca8be20 100644
--- a/brewman/static/scripts/receipt.js
+++ b/brewman/static/scripts/receipt.js
@@ -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);
diff --git a/brewman/templates/angular_base.mako b/brewman/templates/angular_base.mako
index d5c63bb0..8abeb8e9 100644
--- a/brewman/templates/angular_base.mako
+++ b/brewman/templates/angular_base.mako
@@ -15,7 +15,6 @@
##
-