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:
parent
d1a4fc1164
commit
536bf27403
|
@ -260,6 +260,7 @@ class Batch(Base):
|
||||||
def suspense(cls):
|
def suspense(cls):
|
||||||
return uuid.UUID('a955790e-93cf-493c-a816-c7d92b127383')
|
return uuid.UUID('a955790e-93cf-493c-a816-c7d92b127383')
|
||||||
|
|
||||||
|
|
||||||
class Attendance(Base):
|
class Attendance(Base):
|
||||||
__tablename__ = 'entities_attendances'
|
__tablename__ = 'entities_attendances'
|
||||||
|
|
||||||
|
@ -296,7 +297,7 @@ class Attendance(Base):
|
||||||
def create(self):
|
def create(self):
|
||||||
old = DBSession.query(Attendance).filter(Attendance.date == self.date) \
|
old = DBSession.query(Attendance).filter(Attendance.date == self.date) \
|
||||||
.filter(Attendance.employee_id == self.employee_id) \
|
.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 None or old.attendance_type != self.attendance_type:
|
||||||
if old is not None:
|
if old is not None:
|
||||||
old.is_valid = False
|
old.is_valid = False
|
||||||
|
|
|
@ -68,7 +68,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() || form.$invalid" class="btn btn-primary">Save</button>
|
<button tan-click="save()" ng-disabled="isClean() || form.$invalid" class="btn btn-primary">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<button class="btn btn-block btn-success" ng-click="creditSalary()">Credit <i
|
<button class="btn btn-block btn-success" tan-click="creditSalary()">Credit <i
|
||||||
class="glyphicon glyphicon-screenshot"></i>
|
class="glyphicon glyphicon-screenshot"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -174,3 +174,29 @@ overlord_directive.directive('tanSse', ['$parse', function ($parse) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
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.save = function () {
|
||||||
$scope.info.$save(function (u, putResponseHeaders) {
|
return $scope.info.$save(function (u, putResponseHeaders) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: 'Saved!'});
|
$scope.toasts.push({Type: 'Success', Message: 'Saved!'});
|
||||||
}, function (data, status) {
|
}, function (data, status) {
|
||||||
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
$scope.toasts.push({Type: 'Danger', Message: data.data});
|
||||||
|
|
|
@ -7,7 +7,7 @@ var EmployeeFunctionsCtrl = ['$scope', '$http', 'dateFilter', function ($scope,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var salary_month = dateFilter($scope.salaryMonth, 'dd-MMM-yyyy');
|
var salary_month = dateFilter($scope.salaryMonth, 'dd-MMM-yyyy');
|
||||||
$http.
|
return $http.
|
||||||
post('/api/CreditSalary', {Month: salary_month}).
|
post('/api/CreditSalary', {Month: salary_month}).
|
||||||
success(function (data) {
|
success(function (data) {
|
||||||
$scope.toasts.push({Type: 'Success', Message: data.message});
|
$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('/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', {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', {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', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl, resolve: PurchaseCtrl.resolve}).
|
||||||
when('/Purchase/:id', {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});
|
var j = _.find(journals,{'Debit': -1});
|
||||||
j.Amount = amount;
|
j.Amount = amount;
|
||||||
if (_.find(oldValue, {'Debit': -1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
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);
|
}, true);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ var ReceiptCtrl = ['$scope', '$routeParams', '$location', 'dateFilter', '$modal'
|
||||||
var j = _.find(journals, {'Debit': 1});
|
var j = _.find(journals, {'Debit': 1});
|
||||||
j.Amount = amount;
|
j.Amount = amount;
|
||||||
if (_.find(oldValue, {'Debit': 1}).Ledger.LedgerID !== j.Ledger.LedgerID) {
|
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);
|
}, true);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
## <link rel="stylesheet" type="text/css" media="screen" href="/css/bootstrap-theme.min-3.0.0.css"/>
|
## <link rel="stylesheet" type="text/css" media="screen" href="/css/bootstrap-theme.min-3.0.0.css"/>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/table.css"/>
|
<link rel="stylesheet" type="text/css" media="screen" href="/css/table.css"/>
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/spinner.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/chosen.css"/>
|
<link rel="stylesheet" type="text/css" media="screen" href="/css/chosen.css"/>
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/loading-bar.min.css"/>
|
<link rel="stylesheet" type="text/css" media="screen" href="/css/loading-bar.min.css"/>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -43,11 +42,6 @@
|
||||||
<script src="/js/angular-sanitize.min-1.2.0.js"></script>
|
<script src="/js/angular-sanitize.min-1.2.0.js"></script>
|
||||||
<script src="/js/loading-bar.min.js"></script>
|
<script src="/js/loading-bar.min.js"></script>
|
||||||
|
|
||||||
## <script src="/js/angular-1.0.8.js"></script>
|
|
||||||
## <script src="/js/angular-resource.min-1.0.8.js"></script>
|
|
||||||
## <script src="/js/angular-cookies.min-1.0.8.js"></script>
|
|
||||||
## <script src="/js/angular-sanitize.min-1.0.8.js"></script>
|
|
||||||
|
|
||||||
<script src="/script/overlord.js"></script>
|
<script src="/script/overlord.js"></script>
|
||||||
<script src="/script/angular_directive.js"></script>
|
<script src="/script/angular_directive.js"></script>
|
||||||
<script src="/script/angular_filter.js"></script>
|
<script src="/script/angular_filter.js"></script>
|
||||||
|
@ -216,17 +210,6 @@
|
||||||
to-close="clearToast(toast)">
|
to-close="clearToast(toast)">
|
||||||
<strong>{{toast.Type}}!</strong> {{toast.Message}}
|
<strong>{{toast.Type}}!</strong> {{toast.Message}}
|
||||||
</div>
|
</div>
|
||||||
<div id="spinner" class="row col-md-4 col-md-offset-4">
|
|
||||||
|
|
||||||
<div id="circleG">
|
|
||||||
<div id="circleG_1" class="circleG">
|
|
||||||
</div>
|
|
||||||
<div id="circleG_2" class="circleG">
|
|
||||||
</div>
|
|
||||||
<div id="circleG_3" class="circleG">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ng-view></ng-view>
|
<ng-view></ng-view>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ def update(request):
|
||||||
|
|
||||||
|
|
||||||
@view_config(request_method='DELETE', route_name='api_client_id', renderer='json', permission='Clients')
|
@view_config(request_method='DELETE', route_name='api_client_id', renderer='json', permission='Clients')
|
||||||
|
@TryCatchFunction
|
||||||
def delete(request):
|
def delete(request):
|
||||||
id = request.matchdict.get('id', None)
|
id = request.matchdict.get('id', None)
|
||||||
if id is None:
|
if id is None:
|
||||||
|
|
Loading…
Reference in New Issue