This commit is contained in:
@@ -261,6 +261,7 @@ function renderAppointments() {
|
||||
${item.status === "requested" ? `<button type="button" data-confirm-appointment="${item.id}">Подтвердить</button>` : ""}
|
||||
${["confirmed", "confirmed_by_sto"].includes(item.status) ? `<button type="button" data-create-work-order="${item.id}">Открыть заказ-наряд</button>` : ""}
|
||||
<button type="button" class="ghost-btn" data-reject-appointment="${item.id}">Отклонить</button>
|
||||
${!["converted_to_work_order", "completed"].includes(item.status) ? `<button type="button" class="danger-btn" data-delete-appointment="${item.id}">Удалить</button>` : ""}
|
||||
</div>` : ""}
|
||||
</div>
|
||||
`).join("")
|
||||
@@ -418,6 +419,12 @@ document.body.addEventListener("click", async (event) => {
|
||||
body: JSON.stringify({ comment: "Отклонено в панели СТО" }),
|
||||
}));
|
||||
}
|
||||
if (button.dataset.deleteAppointment) {
|
||||
if (!window.confirm("Удалить бронь из панели СТО?")) return;
|
||||
await runAction(button, () => api(`/sto/appointments/${button.dataset.deleteAppointment}`, {
|
||||
method: "DELETE",
|
||||
}));
|
||||
}
|
||||
if (button.dataset.createWorkOrder) {
|
||||
const odometer = window.prompt("Пробег на приемке, км") || "";
|
||||
await runAction(button, () => api(`/sto/appointments/${button.dataset.createWorkOrder}/create-work-order`, {
|
||||
|
||||
Reference in New Issue
Block a user