v.2.13
-Add delete reports
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
.module('app')
|
||||
.controller('ReportsCtrl', ReportsCtrl);
|
||||
|
||||
ReportsCtrl.$inject = ['$scope', 'smartRequest'];
|
||||
function ReportsCtrl($scope, smartRequest) {
|
||||
ReportsCtrl.$inject = ['$scope', 'smartRequest', 'Notification'];
|
||||
function ReportsCtrl($scope, smartRequest, Notification) {
|
||||
var date = new Date();
|
||||
|
||||
var formatted = ('0' + date.getDate()).slice(-2) + '.' + ('0' + (date.getMonth() + 1)).slice(-2) + '.' + date.getFullYear();
|
||||
@@ -25,9 +25,33 @@
|
||||
$scope.printers = [];
|
||||
|
||||
$scope.update = function() {
|
||||
smartRequest.get('report/history', function(data) {
|
||||
smartRequest.get('v1/reports', function(data) {
|
||||
$scope.history = data.reports;
|
||||
});
|
||||
smartRequest.get('v1/settings?code=11', function (data) {
|
||||
$scope.delete_shift_value = data.value;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteReport = function (report) {
|
||||
Notification.primary('Дождитесь удаления! Страница обновится автоматически.');
|
||||
smartRequest.post('v1/deletedata', {
|
||||
value: 'delete_report',
|
||||
report_id: report.id
|
||||
}, function (data) {
|
||||
$scope.status = data.status;
|
||||
$scope.message = data.message;
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
setTimeout(function() {
|
||||
//location.reload();
|
||||
$scope.update();
|
||||
}, 1000);
|
||||
}
|
||||
if ($scope.status == 'error') {
|
||||
Notification.error(data.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reportDelete = function() {
|
||||
|
||||
@@ -65,7 +65,9 @@
|
||||
if (data.status == 'success') {
|
||||
Notification.success(data.message);
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
//location.reload();
|
||||
$scope.update();
|
||||
$('#preload-modal').modal('hide');
|
||||
}, 1000);
|
||||
}
|
||||
if ($scope.status == 'error') {
|
||||
|
||||
Reference in New Issue
Block a user