Client #2

Merged
ParkSuMin merged 5 commits from Client into master 2026-01-03 16:50:31 +01:00
Showing only changes of commit 08ddf65ec1 - Show all commits

View File

@@ -418,7 +418,7 @@ function initializeApp() {
];
if (requiredElements.some((element) => !element)) {
console.error('Missing required elements. Проверьте разметку страницы.');
console.error('Missing required elements.');
return;
}
@@ -510,15 +510,15 @@ function initializeApp() {
} = event.target.dataset;
try {
if (action === 'delete-order') {
switch (action) {
case 'delete-order': {
await fetchJson(`/api/orders/${id}`, {
method: 'DELETE'
});
await refreshData();
return;
}
if (action === 'edit-order') {
case 'edit-order': {
const newName = prompt('Введите новое ФИО заказчика', '');
if (newName === null) {
return;
@@ -541,8 +541,7 @@ function initializeApp() {
await refreshData();
return;
}
if (action === 'save-item') {
case 'save-item': {
const quantityInput = ordersContainer.querySelector(
`[data-action="item-quantity"][data-item-id="${itemId}"]`
);
@@ -563,16 +562,14 @@ function initializeApp() {
await refreshData();
return;
}
if (action === 'delete-item') {
case 'delete-item': {
await fetchJson(`/api/orders/${orderId}/items/${itemId}`, {
method: 'DELETE'
});
await refreshData();
return;
}
if (action === 'move-item') {
case 'move-item': {
const targetSelect = ordersContainer.querySelector(
`[data-action="move-target"][data-item-id="${itemId}"]`
);
@@ -592,6 +589,9 @@ function initializeApp() {
await refreshData();
return;
}
default:
return;
}
} catch (error) {
showNotification(error.message, 'warning');
}