Fix 404 on maintenance update: use url_for instead of hardcoded path

Hardcoded '/maintenance/{id}/update' ignored the '/itassets/' nginx prefix.
Generate the base URL with url_for and replace the placeholder id in JS.
This commit is contained in:
ske087
2026-07-08 23:29:02 +03:00
parent 38991400f2
commit ca0d48d4b1
@@ -261,8 +261,9 @@ const form = document.getElementById('maintenanceForm');
const titleText = document.getElementById('modalTitleText');
const submitText = document.getElementById('submitBtnText');
const createUrl = "{{ url_for('maintenance.create') }}";
const updateUrl = (id) => `/maintenance/${id}/update`;
const createUrl = "{{ url_for('maintenance.create') }}";
const _updateBase = "{{ url_for('maintenance.update', record_id=0) }}";
const updateUrl = (id) => _updateBase.replace('/0/', `/${id}/`);
// ── Open for EDIT when a table row is clicked ────────────────────────────────
document.querySelectorAll('tr[data-id]').forEach(row => {