From ca0d48d4b1861e96d9f7e4b445fc408bbd9e7469 Mon Sep 17 00:00:00 2001 From: ske087 Date: Wed, 8 Jul 2026 23:29:02 +0300 Subject: [PATCH] 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. --- IT_asset_management/app/templates/maintenance/index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IT_asset_management/app/templates/maintenance/index.html b/IT_asset_management/app/templates/maintenance/index.html index 0adf3e7..d673dcb 100644 --- a/IT_asset_management/app/templates/maintenance/index.html +++ b/IT_asset_management/app/templates/maintenance/index.html @@ -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 => {