Feature: Added a maintenance mode which locks all other users out
This commit is contained in:
1 parent
cb7e6e89a5
commit
fdcedb262c
6 files changed
+85
-20
No files matched your search
@@ -1,7 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var SettingsController = ['$scope', '$http', 'asDateFilter', '$modal', 'lockInfo', 'Product', function ($scope, $http, asDate, $modal, lockInfo, Product) {
|
||||
var SettingsController = ['$scope', '$http', 'asDateFilter', '$modal', 'lockInfo', 'maintenance', 'Product', function ($scope, $http, asDate, $modal, lockInfo, maintenance, Product) {
|
||||
$scope.lockInfo = lockInfo.data;
|
||||
$scope.maintenance = maintenance.data;
|
||||
$scope.MaintenanceEnabled = function (){
|
||||
return $scope.maintenance.Enabled ? 'Enabled' : 'Disabled';
|
||||
};
|
||||
$scope.rebaseDate = '';
|
||||
$scope.setLockDate = function () {
|
||||
if ($scope.lockInfo.Start.Locked) {
|
||||
@@ -110,7 +114,11 @@ var SettingsController = ['$scope', '$http', 'asDateFilter', '$modal', 'lockInfo
|
||||
var resetDate = asDate($scope.resetDate);
|
||||
var stockDate = asDate($scope.stockDate);
|
||||
var qty = Number($scope.qty);
|
||||
$http({method: 'POST', url: '/api/ResetStock/' + $scope.product.ProductID, params: {StockDate: stockDate, ResetDate: resetDate, Quantity: qty}}).
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: '/api/ResetStock/' + $scope.product.ProductID,
|
||||
params: {StockDate: stockDate, ResetDate: resetDate, Quantity: qty}
|
||||
}).
|
||||
success(function () {
|
||||
$scope.toasts.push({Type: 'Success', Message: 'Data rebased!'});
|
||||
}).
|
||||
@@ -131,6 +139,17 @@ var SettingsController = ['$scope', '$http', 'asDateFilter', '$modal', 'lockInfo
|
||||
$scope.toasts.push({Type: 'Danger', Message: errorMessage});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.setMaintenance = function (status) {
|
||||
return $http.post('/api/Maintenance', {Enabled: status}).
|
||||
success(function (data) {
|
||||
$scope.maintenance = data;
|
||||
$scope.toasts.push({Type: 'Success', Message: ''});
|
||||
}).
|
||||
error(function (errorMessage) {
|
||||
$scope.toasts.push({Type: 'Danger', Message: errorMessage});
|
||||
});
|
||||
};
|
||||
}];
|
||||
|
||||
SettingsController.resolve = {
|
||||
@@ -138,6 +157,11 @@ SettingsController.resolve = {
|
||||
return $http.get('/api/LockInfo', {}).then(function (data) {
|
||||
return data;
|
||||
});
|
||||
}],
|
||||
maintenance: ['$http', function ($http) {
|
||||
return $http.get('/api/Maintenance', {}).then(function (data) {
|
||||
return data;
|
||||
});
|
||||
}]
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user