Fixed reports
This commit is contained in:
miroman-afk
2023-05-02 15:21:54 +03:00
parent 70120653f7
commit fb46c8e739
78 changed files with 21233 additions and 1892 deletions

View File

@@ -116,12 +116,10 @@
};
$scope.editClient = function (client, group) {
$scope.contextElement = client;
$scope.contextGroup = group;
$('#edit-client').modal('toggle');
console.log(client);
console.log($scope.contextGroup);
};
$scope.updateClient = function (group) {
@@ -135,6 +133,8 @@
address: $scope.contextElement.address,
email: $scope.contextElement.email,
barcode: $scope.contextElement.barcode,
is_special_price: $scope.contextElement.special_price,
is_employee: $scope.contextElement.employee,
task: 'update'
}, function (data) {
if (data.status == 'success') {
@@ -147,12 +147,11 @@
});
};
$scope.removeClient = function () {
$scope.removeClient = function (client) {
$('#client-confirm-delete').modal('toggle');
$('#edit-client').modal('toggle');
smartRequest.post('v1/client', {
id: $scope.contextElement.id,
id: client.id,
task: 'delete'
}, function (data) {
$scope.getGroups();
@@ -166,6 +165,40 @@
});
};
$scope.lockClient = function (client) {
smartRequest.post('v1/client', {
id: client.id,
task: 'lock'
}, function (data) {
//$scope.getGroups();
//$scope.openGroup($scope.currentGroup);
if (data.message) {
Notification.success(data.message);
$scope.openClientInfo(client);
}
if (data.error_message) {
Notification.error(data.error_message);
}
});
};
$scope.unlockClient = function (client) {
smartRequest.post('v1/client', {
id: client.id,
task: 'unlock'
}, function (data) {
//$scope.getGroups();
//$scope.openGroup($scope.currentGroup);
if (data.message) {
Notification.success(data.message);
$scope.openClientInfo(client);
}
if (data.error_message) {
Notification.error(data.error_message);
}
});
};
$scope.pager = function (currentPage) {
smartRequest.get('v1/clients?group_id=' + $scope.currentGroup + '&page=' + $scope.currentPage, function (data) {
$scope.clients = data.clients;
@@ -179,11 +212,17 @@
if ($scope.search.query.length === 0) {
$scope.openGroup({id: $scope.currentGroupId});
} else {
smartRequest.post('client/search', {
smartRequest.post('v1/client', {
task: 'search',
name: $scope.search.query
},
function (data) {
$scope.clients = data.clients;
if (data.clients.length > 0) {
Notification.success(data.message);
} else {
Notification.error(data.message);
}
});
}
};
@@ -229,7 +268,8 @@
address: $scope.newClient.address,
email: $scope.newClient.email,
barcode: $scope.newClient.barcode,
is_special_price: $scope.newClient.special_price
is_special_price: $scope.newClient.special_price,
is_employee: $scope.newClient.employee
}, function (data) {
$scope.pager($scope.currentGroup);
$scope.closeCard();
@@ -256,6 +296,7 @@
};
$scope.openClientInfo = function (client) {
$('#actions_tab').tab('show')
$scope.currentClientId = client.id;
$scope.isCreateNewGroup = false;
$scope.isCreateNewClient = false;