diff --git a/loko/assets/static/assets/inspection_map.js b/loko/assets/static/assets/inspection_map.js index 074efb6..a917837 100644 --- a/loko/assets/static/assets/inspection_map.js +++ b/loko/assets/static/assets/inspection_map.js @@ -1397,6 +1397,19 @@ document.getElementById('insp_object_id').value = objId; let modelName = props.model_name || props.location_type || ''; + const rawModel = String(props.model_name || props.location_type || '').toLowerCase(); + const targetCode = String(props.code || props.target_display || '').toUpperCase(); + const isZoneRwiz = ( + rawModel === 'naturerwiz' || + props.location_type === 'NatureRWIZ' || + targetCode.startsWith('RWIZ') || + Boolean(props.is_location && (props.thematic === 'water' || props.thematic === 'giep' || rawModel === 'naturerwiz')) + ) && (props.model_name !== 'naturerwiasset' && props.asset_type !== 'naturerwiasset' && props.is_location !== false); + + if (typeof window.toggleMissingResultChoice === 'function') { + window.toggleMissingResultChoice(isZoneRwiz); + } + if (modelName === 'NatureRWIZ' || modelName === 'NatureRWIAsset' || modelName === 'naturerwiasset' || props.thematic === 'water' || props.location_type === 'NatureRWIZ') { modelName = 'naturerwiz'; window.currentGiepLocationId = props.location_id || (props.is_location ? objId : null) || objId; diff --git a/loko/assets/templates/assets/components/asset_inspections.html b/loko/assets/templates/assets/components/asset_inspections.html index a440c95..2c5bf1c 100644 --- a/loko/assets/templates/assets/components/asset_inspections.html +++ b/loko/assets/templates/assets/components/asset_inspections.html @@ -15,6 +15,7 @@ data-bs-toggle="modal" data-bs-target="#quickInspectionModal" data-content-type-id="{{ asset_ct_id }}" + data-model-name="{{ asset_ct_model }}" data-object-id="{{ asset_pk }}" data-target-code="{{ asset.code|default:asset.pk }}" data-target-name="{{ asset.name_fr|default:asset.name_nl|default:asset }}" @@ -206,6 +207,13 @@ document.addEventListener('DOMContentLoaded', function() { if (modalTypeName) modalTypeName.textContent = name; if (modalTypeBadge) modalTypeBadge.textContent = type; if (modalStatusBadge) modalStatusBadge.textContent = status; + + const modelName = (this.getAttribute('data-model-name') || '').toLowerCase(); + const codeUpper = (code || '').toUpperCase(); + const isRwiz = (modelName === 'naturerwiz' || codeUpper.startsWith('RWIZ')); + if (typeof window.toggleMissingResultChoice === 'function') { + window.toggleMissingResultChoice(isRwiz); + } }); }); diff --git a/loko/assets/templates/assets/components/inspection_form_modal.html b/loko/assets/templates/assets/components/inspection_form_modal.html index 041287e..3d5c181 100644 --- a/loko/assets/templates/assets/components/inspection_form_modal.html +++ b/loko/assets/templates/assets/components/inspection_form_modal.html @@ -64,9 +64,9 @@ {% translate "Endommagé" %} -
+
-