This commit is contained in:
2026-04-12 01:35:19 +02:00
parent 91a8b85f38
commit d04e02020c
70 changed files with 8634 additions and 207 deletions

View File

@@ -104,6 +104,39 @@
dropdown.style.left = wrapRect.left + 'px';
}
function refreshTableAndPanel() {
var url = window.location.pathname + window.location.search;
fetch(url, {
method: 'GET',
headers: { 'X-Requested-With': 'XMLHttpRequest' }
})
.then(function (resp) {
if (!resp.ok) return;
return resp.json();
})
.then(function (data) {
if (!data) return;
if (data.tableHtml) {
var tableContainer = document.querySelector('.table-list');
if (tableContainer) {
tableContainer.outerHTML = data.tableHtml;
}
}
if (data.panelHtml) {
var tmp = document.createElement('div');
tmp.innerHTML = data.panelHtml;
var newBody = tmp.querySelector('.order-statuses-side__body');
var currentBody = document.querySelector('.order-statuses-side__body');
if (newBody && currentBody) {
currentBody.innerHTML = newBody.innerHTML;
}
}
})
.catch(function () {
// Status already updated optimistically — silent fail for table refresh
});
}
function changeStatus(wrap, orderId, newStatusCode, allStatuses, statusColorMap, csrfToken) {
var prevHtml = wrap.innerHTML;
var prevStatus = wrap.getAttribute('data-current-status');
@@ -152,7 +185,7 @@
var d = result.data;
wrap.innerHTML = buildBadgeHtml(d.status_code, d.status_label, d.status_color);
wrap.setAttribute('data-current-status', d.status_code);
location.reload();
refreshTableAndPanel();
})
.catch(function () {
wrap.innerHTML = prevHtml;