feat: hide standard inspection sections for GIEP-specific inspections
This commit is contained in:
parent
b30e65e0a1
commit
ca8d8187c1
7 changed files with 97 additions and 40 deletions
|
|
@ -1268,7 +1268,7 @@
|
|||
document.getElementById('map-insp-summary').textContent = insp.details_summary || 'Aucun constat spécifique.';
|
||||
const notesEl = document.getElementById('map-insp-notes');
|
||||
if (notesEl) {
|
||||
if (insp.notes) {
|
||||
if (insp.notes && !insp.is_giep) {
|
||||
notesEl.textContent = insp.notes;
|
||||
notesEl.classList.remove('d-none');
|
||||
} else {
|
||||
|
|
@ -1422,6 +1422,23 @@
|
|||
window.currentGiepLocationId = props.location_id || (props.is_location ? objId : null) || objId;
|
||||
}
|
||||
|
||||
const isGiep = (modelName === 'naturerwiz' || isZoneRwiz);
|
||||
const quickNotesSection = document.getElementById('quickInspNotesSection');
|
||||
const quickResultSection = document.getElementById('quickInspResultSection');
|
||||
const quickPhotosSection = document.getElementById('quickInspPhotosSection');
|
||||
if (quickNotesSection) {
|
||||
if (isGiep) quickNotesSection.classList.add('d-none');
|
||||
else quickNotesSection.classList.remove('d-none');
|
||||
}
|
||||
if (quickResultSection) {
|
||||
if (isGiep) quickResultSection.classList.add('d-none');
|
||||
else quickResultSection.classList.remove('d-none');
|
||||
}
|
||||
if (quickPhotosSection) {
|
||||
if (isGiep) quickPhotosSection.classList.add('d-none');
|
||||
else quickPhotosSection.classList.remove('d-none');
|
||||
}
|
||||
|
||||
document.getElementById('insp_target_type').textContent = props.element_type || props.asset_type_display || props.model_name || 'Asset';
|
||||
document.getElementById('insp_target_code').textContent = props.code || props.target_display || (objId ? ('#' + objId) : '-');
|
||||
document.getElementById('insp_target_name').textContent = props.name || props.name_fr || props.target_display || '-';
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<div id="quickInspectionAlert" class="alert alert-danger d-none mb-3"></div>
|
||||
|
||||
<!-- Résultat de contrôle avec boutons colorés -->
|
||||
<div class="mb-3">
|
||||
<div class="mb-3" id="quickInspResultSection">
|
||||
<label class="form-label fw-semibold d-block">{% translate "Résultat du contrôle" %} <span class="text-danger">*</span></label>
|
||||
<div class="d-flex flex-column gap-2" role="group" aria-label="{% translate 'Résultat' %}">
|
||||
<div class="row g-2">
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
|
||||
<!-- Section Photos (Mode continu & Fichiers) -->
|
||||
<div class="card border border-success-subtle mb-3" style="background-color: #e8f6f3;">
|
||||
<div class="card border border-success-subtle mb-3" style="background-color: #e8f6f3;" id="quickInspPhotosSection">
|
||||
<div class="card-header bg-transparent border-0 pb-0 pt-2 px-3">
|
||||
<span class="fw-bold text-dark small"><i class="bi bi-camera me-1 text-teal"></i>{% translate "Photos & Fichiers" %}</span>
|
||||
</div>
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
</div>
|
||||
|
||||
<!-- Remarques -->
|
||||
<div class="mb-3">
|
||||
<div class="mb-3" id="quickInspNotesSection">
|
||||
<label class="form-label fw-semibold mb-1">{% translate "Remarques / Remarques du constat" %}</label>
|
||||
<textarea name="notes" id="insp_notes" class="form-control" rows="2" placeholder="{% translate 'Saisir vos remarques ou détails...' %}"></textarea>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@ window.openInspectionDetailModal = openInspectionDetailModal;
|
|||
const notesCard = document.getElementById('detail-notes-card');
|
||||
const notesText = document.getElementById('detail-notes-text');
|
||||
if (notesCard && notesText) {
|
||||
if (data.notes) {
|
||||
if (data.notes && !data.is_giep) {
|
||||
notesText.textContent = data.notes;
|
||||
notesCard.classList.remove('d-none');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -546,25 +546,22 @@
|
|||
}
|
||||
|
||||
function toggleParentGlobalSections(isGiep) {
|
||||
const sectionsToToggle = [
|
||||
rootModal.querySelector('#quickInspResultSection'),
|
||||
rootModal.querySelector('#editInspResultSection'),
|
||||
rootModal.querySelector('#quickInspPhotosSection'),
|
||||
rootModal.querySelector('#editInspPhotosSection'),
|
||||
rootModal.querySelector('#quickInspNotesSection'),
|
||||
rootModal.querySelector('#editInspNotesSection')
|
||||
const ids = [
|
||||
'quickInspResultSection',
|
||||
'editInspResultSection',
|
||||
'quickInspPhotosSection',
|
||||
'editInspPhotosSection',
|
||||
'quickInspNotesSection',
|
||||
'editInspNotesSection',
|
||||
'editInspectionExistingDocsContainer'
|
||||
];
|
||||
sectionsToToggle.forEach(sec => {
|
||||
if (sec) {
|
||||
if (isGiep) sec.classList.add('d-none');
|
||||
else sec.classList.remove('d-none');
|
||||
ids.forEach(id => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) {
|
||||
if (isGiep) el.classList.add('d-none');
|
||||
else el.classList.remove('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
const editExistingDocs = rootModal.querySelector('#editInspectionExistingDocsContainer');
|
||||
if (editExistingDocs && isGiep) {
|
||||
editExistingDocs.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
function updateSerializedGiepData() {
|
||||
|
|
@ -1605,35 +1602,48 @@
|
|||
</div>
|
||||
|
||||
<!-- Liaison Équipement GIEP / Ouvrage -->
|
||||
<div class="border rounded-3 p-2.5 mb-3 bg-white border-primary-subtle shadow-sm">
|
||||
<div class="d-flex align-items-center justify-content-between mb-1.5">
|
||||
<span class="extra-small fw-bold text-primary text-uppercase">
|
||||
<i class="bi bi-link-45deg me-1"></i>{% translate "Équipement GIEP associé (Optionnel)" %}
|
||||
<div class="border rounded-3 p-3 mb-3 bg-white border-primary-subtle shadow-xs">
|
||||
<div class="d-flex align-items-center justify-content-between mb-2.5 pb-1 border-bottom border-light-subtle">
|
||||
<span class="extra-small fw-bold text-primary text-uppercase tracking-wider">
|
||||
<i class="bi bi-link-45deg me-1 fs-6 align-middle"></i>{% translate "Équipement GIEP associé (Optionnel)" %}
|
||||
</span>
|
||||
${ouv.asset_id ? `<button type="button" class="btn btn-link text-danger p-0 extra-small text-decoration-none clear-asset-btn" data-idx="${idx}"><i class="bi bi-x-circle me-1"></i>{% translate "Délier" %}</button>` : ''}
|
||||
</div>
|
||||
|
||||
${ouv.asset_id ? `
|
||||
<div class="p-2.5 rounded-3 bg-primary-subtle bg-opacity-20 border border-primary-subtle d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<i class="bi bi-geo-alt-fill text-primary fs-5"></i>
|
||||
<div class="p-3 rounded-3 bg-primary-subtle bg-opacity-25 border border-primary-subtle d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<div class="bg-primary text-white rounded-circle d-flex align-items-center justify-content-center shadow-xs" style="width: 38px; height: 38px; min-width: 38px;">
|
||||
<i class="bi bi-geo-alt-fill fs-5"></i>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="small text-primary d-block">${ouv.asset_code}</strong>
|
||||
<span class="extra-small text-muted">${ouv.asset_name || ''}</span>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<strong class="text-primary fs-6">${ouv.asset_code}</strong>
|
||||
<span class="badge bg-primary text-white rounded-pill extra-small px-2 py-0.5"><i class="bi bi-check2 me-1"></i>{% translate "Lié" %}</span>
|
||||
</div>
|
||||
<div class="small text-muted">${ouv.asset_name || ''}</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="badge bg-primary text-white rounded-pill extra-small">{% translate "Lié" %}</span>
|
||||
</div>
|
||||
` : `
|
||||
<div class="position-relative">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text bg-white"><i class="bi bi-search text-muted"></i></span>
|
||||
<input type="text" class="form-control asset-search-input" data-idx="${idx}" placeholder="{% filter escapejs %}{% translate "Rechercher un ouvrage par code ou type..." %}{% endfilter %}" autocomplete="off">
|
||||
<button type="button" class="btn btn-outline-primary open-map-modal-btn" data-idx="${idx}">
|
||||
<i class="bi bi-geo-alt-fill me-1"></i>{% translate "Choisir sur la carte" %}
|
||||
<button type="button" class="btn btn-outline-danger btn-sm px-2.5 py-1 rounded-pill clear-asset-btn d-flex align-items-center gap-1" data-idx="${idx}">
|
||||
<i class="bi bi-x-circle"></i>
|
||||
<span class="extra-small fw-semibold">{% translate "Délier" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="list-group position-absolute w-100 shadow-lg d-none asset-autocomplete-dropdown" data-idx="${idx}" style="z-index: 1050; max-height: 200px; overflow-y: auto; background: white;"></div>
|
||||
` : `
|
||||
<div class="d-flex flex-column flex-sm-row gap-2.5 align-items-stretch">
|
||||
<div class="position-relative flex-grow-1">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text bg-white border-end-0 text-muted ps-3 pe-2">
|
||||
<i class="bi bi-search"></i>
|
||||
</span>
|
||||
<input type="text" class="form-control border-start-0 ps-1 py-2 asset-search-input" data-idx="${idx}" placeholder="{% filter escapejs %}{% translate "Rechercher un ouvrage par code ou type..." %}{% endfilter %}" autocomplete="off">
|
||||
</div>
|
||||
<div class="list-group position-absolute w-100 shadow-lg d-none asset-autocomplete-dropdown" data-idx="${idx}" style="z-index: 1050; max-height: 220px; overflow-y: auto; background: white;"></div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-primary px-3 py-2 d-inline-flex align-items-center justify-content-center gap-2 rounded-2 open-map-modal-btn text-nowrap shadow-xs" data-idx="${idx}">
|
||||
<i class="bi bi-geo-alt-fill"></i>
|
||||
<span class="small fw-semibold">{% translate "Choisir sur la carte" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -764,8 +764,18 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
|
||||
// Affichage et préremplissage des champs spécifiques GIEP (GiepInspection)
|
||||
const giepFieldsContainer = document.getElementById('editGiepSpecificFieldsContainer');
|
||||
const editNotesSection = document.getElementById('editInspNotesSection');
|
||||
const editResultSection = document.getElementById('editInspResultSection');
|
||||
const editPhotosSection = document.getElementById('editInspPhotosSection');
|
||||
const editExistingDocs = document.getElementById('editInspectionExistingDocsContainer');
|
||||
|
||||
if (data.is_giep) {
|
||||
if (giepFieldsContainer) giepFieldsContainer.classList.remove('d-none');
|
||||
if (editNotesSection) editNotesSection.classList.add('d-none');
|
||||
if (editResultSection) editResultSection.classList.add('d-none');
|
||||
if (editPhotosSection) editPhotosSection.classList.add('d-none');
|
||||
if (editExistingDocs) editExistingDocs.classList.add('d-none');
|
||||
|
||||
const editModal = document.getElementById('editInspectionModal');
|
||||
if (editModal && typeof editModal.setGiepFormData === 'function') {
|
||||
editModal.setGiepFormData(data);
|
||||
|
|
@ -774,6 +784,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
} else {
|
||||
if (giepFieldsContainer) giepFieldsContainer.classList.add('d-none');
|
||||
if (editNotesSection) editNotesSection.classList.remove('d-none');
|
||||
if (editResultSection) editResultSection.classList.remove('d-none');
|
||||
if (editPhotosSection) editPhotosSection.classList.remove('d-none');
|
||||
if (editExistingDocs) editExistingDocs.classList.remove('d-none');
|
||||
}
|
||||
|
||||
// Affichage et préremplissage des champs spécifiques Hot Box (HotBoxInspection)
|
||||
|
|
@ -1029,6 +1043,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
if (typeof window.toggleEditMissingResultChoice === 'function') {
|
||||
window.toggleEditMissingResultChoice(false);
|
||||
}
|
||||
const editNotesSection = document.getElementById('editInspNotesSection');
|
||||
if (editNotesSection) editNotesSection.classList.remove('d-none');
|
||||
const editResultSection = document.getElementById('editInspResultSection');
|
||||
if (editResultSection) editResultSection.classList.remove('d-none');
|
||||
const editPhotosSection = document.getElementById('editInspPhotosSection');
|
||||
if (editPhotosSection) editPhotosSection.classList.remove('d-none');
|
||||
const editExistingDocs = document.getElementById('editInspectionExistingDocsContainer');
|
||||
if (editExistingDocs) editExistingDocs.classList.remove('d-none');
|
||||
const giepFieldsContainer = document.getElementById('editGiepSpecificFieldsContainer');
|
||||
if (giepFieldsContainer) giepFieldsContainer.classList.add('d-none');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -216,6 +216,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
if (typeof window.toggleMissingResultChoice === 'function') {
|
||||
window.toggleMissingResultChoice(false);
|
||||
}
|
||||
const notesSection = document.getElementById('quickInspNotesSection');
|
||||
if (notesSection) notesSection.classList.remove('d-none');
|
||||
const resultSection = document.getElementById('quickInspResultSection');
|
||||
if (resultSection) resultSection.classList.remove('d-none');
|
||||
const photosSection = document.getElementById('quickInspPhotosSection');
|
||||
if (photosSection) photosSection.classList.remove('d-none');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
{% if insp.notes %}
|
||||
{% if insp.notes and not insp.is_giep %}
|
||||
<div class="card bg-light border-0 p-3 mb-3">
|
||||
<h6 class="fw-bold text-secondary mb-2"><i class="bi bi-journal-text me-2"></i>{% translate "Remarques" %}</h6>
|
||||
<div class="text-dark small">{{ insp.notes }}</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue