feat(assets): display assets directly in building tree and add collapse/expand all controls
This commit is contained in:
parent
ab1cfb6ab2
commit
10e9f1de50
9 changed files with 222 additions and 71 deletions
Binary file not shown.
|
|
@ -8618,8 +8618,10 @@ msgstr "Drag and drop handles to adjust."
|
||||||
msgid "Copier tracé"
|
msgid "Copier tracé"
|
||||||
msgstr "Copy trace"
|
msgstr "Copy trace"
|
||||||
|
|
||||||
msgid "Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
msgid ""
|
||||||
msgstr "Copy the trace of another cable following the same path (e.g. 48 and tel.)."
|
"Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
||||||
|
msgstr ""
|
||||||
|
"Copy the trace of another cable following the same path (e.g. 48 and tel.)."
|
||||||
|
|
||||||
msgid "Copier tracé…"
|
msgid "Copier tracé…"
|
||||||
msgstr "Copy trace…"
|
msgstr "Copy trace…"
|
||||||
|
|
@ -8630,8 +8632,12 @@ msgstr "Copy another cable's trace"
|
||||||
msgid "Appliquer aux autres câbles…"
|
msgid "Appliquer aux autres câbles…"
|
||||||
msgstr "Apply to other cables…"
|
msgstr "Apply to other cables…"
|
||||||
|
|
||||||
msgid "Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud pour le supprimer • Glisser pour déplacer"
|
msgid ""
|
||||||
msgstr "Double-click a segment to add a node • Double-click a node to delete • Drag to move"
|
"Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud "
|
||||||
|
"pour le supprimer • Glisser pour déplacer"
|
||||||
|
msgstr ""
|
||||||
|
"Double-click a segment to add a node • Double-click a node to delete • Drag "
|
||||||
|
"to move"
|
||||||
|
|
||||||
msgid "Appliquer le tracé à d'autres câbles"
|
msgid "Appliquer le tracé à d'autres câbles"
|
||||||
msgstr "Apply trace to other cables"
|
msgstr "Apply trace to other cables"
|
||||||
|
|
@ -8657,7 +8663,9 @@ msgstr "Trace copied from"
|
||||||
msgid "vers"
|
msgid "vers"
|
||||||
msgstr "to"
|
msgstr "to"
|
||||||
|
|
||||||
msgid "Veuillez d'abord tracer au moins deux points pour ce câble avant de le dupliquer."
|
msgid ""
|
||||||
|
"Veuillez d'abord tracer au moins deux points pour ce câble avant de le "
|
||||||
|
"dupliquer."
|
||||||
msgstr "Please trace at least two points for this cable before duplicating."
|
msgstr "Please trace at least two points for this cable before duplicating."
|
||||||
|
|
||||||
msgid "Aucun autre câble disponible dans ce carrefour."
|
msgid "Aucun autre câble disponible dans ce carrefour."
|
||||||
|
|
@ -8669,6 +8677,22 @@ msgstr "Please select at least one target cable."
|
||||||
msgid "câble(s) mis à jour avec ce tracé !"
|
msgid "câble(s) mis à jour avec ce tracé !"
|
||||||
msgstr "cable(s) updated with this trace!"
|
msgstr "cable(s) updated with this trace!"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout replier"
|
||||||
|
msgstr "Collapse all"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout déplier"
|
||||||
|
msgstr "Expand all"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets physiques rattachés"
|
||||||
|
msgstr "Linked physical assets"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets rattachés directement au bâtiment"
|
||||||
|
msgstr "Assets directly linked to building"
|
||||||
|
|
||||||
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
||||||
#~ msgstr "Missing from Excel file (Will be kept or archived)"
|
#~ msgstr "Missing from Excel file (Will be kept or archived)"
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -8669,8 +8669,10 @@ msgstr "Glisser-déposer les poignées pour ajuster."
|
||||||
msgid "Copier tracé"
|
msgid "Copier tracé"
|
||||||
msgstr "Copier tracé"
|
msgstr "Copier tracé"
|
||||||
|
|
||||||
msgid "Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
msgid ""
|
||||||
msgstr "Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
"Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
||||||
|
msgstr ""
|
||||||
|
"Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
||||||
|
|
||||||
msgid "Copier tracé…"
|
msgid "Copier tracé…"
|
||||||
msgstr "Copier tracé…"
|
msgstr "Copier tracé…"
|
||||||
|
|
@ -8681,8 +8683,12 @@ msgstr "Copier le tracé d'un autre câble"
|
||||||
msgid "Appliquer aux autres câbles…"
|
msgid "Appliquer aux autres câbles…"
|
||||||
msgstr "Appliquer aux autres câbles…"
|
msgstr "Appliquer aux autres câbles…"
|
||||||
|
|
||||||
msgid "Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud pour le supprimer • Glisser pour déplacer"
|
msgid ""
|
||||||
msgstr "Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud pour le supprimer • Glisser pour déplacer"
|
"Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud "
|
||||||
|
"pour le supprimer • Glisser pour déplacer"
|
||||||
|
msgstr ""
|
||||||
|
"Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud "
|
||||||
|
"pour le supprimer • Glisser pour déplacer"
|
||||||
|
|
||||||
msgid "Appliquer le tracé à d'autres câbles"
|
msgid "Appliquer le tracé à d'autres câbles"
|
||||||
msgstr "Appliquer le tracé à d'autres câbles"
|
msgstr "Appliquer le tracé à d'autres câbles"
|
||||||
|
|
@ -8708,8 +8714,12 @@ msgstr "Tracé copié de"
|
||||||
msgid "vers"
|
msgid "vers"
|
||||||
msgstr "vers"
|
msgstr "vers"
|
||||||
|
|
||||||
msgid "Veuillez d'abord tracer au moins deux points pour ce câble avant de le dupliquer."
|
msgid ""
|
||||||
msgstr "Veuillez d'abord tracer au moins deux points pour ce câble avant de le dupliquer."
|
"Veuillez d'abord tracer au moins deux points pour ce câble avant de le "
|
||||||
|
"dupliquer."
|
||||||
|
msgstr ""
|
||||||
|
"Veuillez d'abord tracer au moins deux points pour ce câble avant de le "
|
||||||
|
"dupliquer."
|
||||||
|
|
||||||
msgid "Aucun autre câble disponible dans ce carrefour."
|
msgid "Aucun autre câble disponible dans ce carrefour."
|
||||||
msgstr "Aucun autre câble disponible dans ce carrefour."
|
msgstr "Aucun autre câble disponible dans ce carrefour."
|
||||||
|
|
@ -8720,6 +8730,22 @@ msgstr "Veuillez sélectionner au moins un câble cible."
|
||||||
msgid "câble(s) mis à jour avec ce tracé !"
|
msgid "câble(s) mis à jour avec ce tracé !"
|
||||||
msgstr "câble(s) mis à jour avec ce tracé !"
|
msgstr "câble(s) mis à jour avec ce tracé !"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout replier"
|
||||||
|
msgstr "Tout replier"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout déplier"
|
||||||
|
msgstr "Tout déplier"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets physiques rattachés"
|
||||||
|
msgstr "Assets physiques rattachés"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets rattachés directement au bâtiment"
|
||||||
|
msgstr "Assets rattachés directement au bâtiment"
|
||||||
|
|
||||||
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
||||||
#~ msgstr "Absent du fichier Excel (Sera conservé ou archivé)"
|
#~ msgstr "Absent du fichier Excel (Sera conservé ou archivé)"
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -8617,8 +8617,11 @@ msgstr "Sleep de handgrepen om aan te passen."
|
||||||
msgid "Copier tracé"
|
msgid "Copier tracé"
|
||||||
msgstr "Tracé kopiëren"
|
msgstr "Tracé kopiëren"
|
||||||
|
|
||||||
msgid "Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
msgid ""
|
||||||
msgstr "Kopieer het tracé van een andere kabel die hetzelfde traject volgt (bv. 48 en tel.)."
|
"Copiez le tracé d'un autre câble suivant le même trajet (ex: 48 et tel.)."
|
||||||
|
msgstr ""
|
||||||
|
"Kopieer het tracé van een andere kabel die hetzelfde traject volgt (bv. 48 "
|
||||||
|
"en tel.)."
|
||||||
|
|
||||||
msgid "Copier tracé…"
|
msgid "Copier tracé…"
|
||||||
msgstr "Tracé kopiëren…"
|
msgstr "Tracé kopiëren…"
|
||||||
|
|
@ -8629,8 +8632,12 @@ msgstr "Het tracé van een andere kabel kopiëren"
|
||||||
msgid "Appliquer aux autres câbles…"
|
msgid "Appliquer aux autres câbles…"
|
||||||
msgstr "Toepassen op andere kabels…"
|
msgstr "Toepassen op andere kabels…"
|
||||||
|
|
||||||
msgid "Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud pour le supprimer • Glisser pour déplacer"
|
msgid ""
|
||||||
msgstr "Dubbelklik op een segment om een knooppunt toe te voegen • Dubbelklik op een knooppunt om te verwijderen • Sleep om te verplaatsen"
|
"Double-clic sur un segment pour ajouter un nœud • Double-clic sur un nœud "
|
||||||
|
"pour le supprimer • Glisser pour déplacer"
|
||||||
|
msgstr ""
|
||||||
|
"Dubbelklik op een segment om een knooppunt toe te voegen • Dubbelklik op een"
|
||||||
|
" knooppunt om te verwijderen • Sleep om te verplaatsen"
|
||||||
|
|
||||||
msgid "Appliquer le tracé à d'autres câbles"
|
msgid "Appliquer le tracé à d'autres câbles"
|
||||||
msgstr "Tracé toepassen op andere kabels"
|
msgstr "Tracé toepassen op andere kabels"
|
||||||
|
|
@ -8656,8 +8663,11 @@ msgstr "Tracé gekopieerd van"
|
||||||
msgid "vers"
|
msgid "vers"
|
||||||
msgstr "naar"
|
msgstr "naar"
|
||||||
|
|
||||||
msgid "Veuillez d'abord tracer au moins deux points pour ce câble avant de le dupliquer."
|
msgid ""
|
||||||
msgstr "Teken eerst ten minste twee punten voor deze kabel alvorens te dupliceren."
|
"Veuillez d'abord tracer au moins deux points pour ce câble avant de le "
|
||||||
|
"dupliquer."
|
||||||
|
msgstr ""
|
||||||
|
"Teken eerst ten minste twee punten voor deze kabel alvorens te dupliceren."
|
||||||
|
|
||||||
msgid "Aucun autre câble disponible dans ce carrefour."
|
msgid "Aucun autre câble disponible dans ce carrefour."
|
||||||
msgstr "Geen andere kabel beschikbaar op dit kruispunt."
|
msgstr "Geen andere kabel beschikbaar op dit kruispunt."
|
||||||
|
|
@ -8668,6 +8678,22 @@ msgstr "Selecteer ten minste één doelkabel."
|
||||||
msgid "câble(s) mis à jour avec ce tracé !"
|
msgid "câble(s) mis à jour avec ce tracé !"
|
||||||
msgstr "kabel(s) bijgewerkt met dit tracé!"
|
msgstr "kabel(s) bijgewerkt met dit tracé!"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout replier"
|
||||||
|
msgstr "Alles inklappen"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Tout déplier"
|
||||||
|
msgstr "Alles uitklappen"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets physiques rattachés"
|
||||||
|
msgstr "Gekoppelde fysieke assets"
|
||||||
|
|
||||||
|
#: assets/templates/assets/buildings/publicbuilding_detail.html
|
||||||
|
msgid "Assets rattachés directement au bâtiment"
|
||||||
|
msgstr "Assets direct gekoppeld aan gebouw"
|
||||||
|
|
||||||
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
#~ msgid "Absent du fichier Excel (Sera conservé ou archivé)"
|
||||||
#~ msgstr "Ontbreekt in het Excel-bestand (Wordt bewaard of gearchiveerd)"
|
#~ msgstr "Ontbreekt in het Excel-bestand (Wordt bewaard of gearchiveerd)"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,39 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<ul class="list-group list-group-flush bg-transparent">
|
<ul class="list-group list-group-flush bg-transparent border-0">
|
||||||
{% for asset_node in asset_nodes %}
|
{% for asset_node in asset_nodes %}
|
||||||
<li class="list-group-item bg-transparent border-0 py-1 px-0">
|
<li class="list-group-item bg-transparent border-0 py-1 px-0">
|
||||||
<!-- Row Header -->
|
<!-- Row Header -->
|
||||||
<div class="d-flex align-items-center justify-content-between py-1 px-2">
|
<div class="d-flex align-items-center justify-content-between py-1 px-3">
|
||||||
<!-- Contenu gauche (indenté selon la profondeur) -->
|
<!-- Contenu gauche (indenté selon la profondeur) -->
|
||||||
<div class="d-flex align-items-center gap-2 flex-wrap" style="padding-left: calc(({{ depth|default:1 }} - 1) * 1.25rem);">
|
<div class="d-flex align-items-center gap-2 flex-wrap" style="padding-left: calc(({{ depth|default:1 }} - 1) * 1.25rem);">
|
||||||
{% if asset_node.children %}
|
{% if asset_node.children %}
|
||||||
<button class="btn btn-sm btn-light border p-0 px-1 tree-toggle-btn collapsed"
|
<button class="btn btn-sm btn-light border p-0 px-1 tree-toggle-btn"
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
data-bs-target="#tree-asset-{{ asset_node.asset.id }}"
|
data-bs-target="#tree-asset-{{ asset_node.asset.id }}"
|
||||||
aria-expanded="false">
|
aria-expanded="true">
|
||||||
<i class="bi bi-chevron-right small"></i>
|
<i class="bi bi-chevron-down small"></i>
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="px-1"></span>
|
<span class="d-inline-block text-center text-muted" style="width: 1.35rem;"><i class="bi bi-dash small"></i></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<i class="bi {{ asset_node.asset.get_icon_class }} text-info small"></i>
|
<i class="bi {{ asset_node.asset.get_icon_class|default:'bi-tools' }} text-info" style="font-size: 0.95rem;"></i>
|
||||||
|
|
||||||
<!-- Code en bleu pour indiquer clairement un lien cliquable -->
|
<!-- Code en bleu pour indiquer clairement un lien cliquable -->
|
||||||
<a href="{{ asset_node.asset.get_absolute_url }}" class="fw-bold text-primary text-decoration-underline small">
|
<a href="{{ asset_node.asset.get_absolute_url }}" class="fw-bold text-info-emphasis text-decoration-underline small">
|
||||||
{{ asset_node.asset.code }}
|
{{ asset_node.asset.code }}
|
||||||
</a>
|
</a>
|
||||||
<span class="small">{{ asset_node.asset.get_name }}</span>
|
<span class="small text-dark">{{ asset_node.asset.get_name }}</span>
|
||||||
<span class="badge bg-primary-subtle text-primary border small ms-1">{{ asset_node.asset.get_macro_lot }}</span>
|
<span class="badge bg-secondary-subtle text-secondary border small">{{ asset_node.asset.get_macro_lot }}</span>
|
||||||
<span class="badge bg-info-subtle text-info border small ms-1">{{ asset_node.asset.get_asset_type_display }}</span>
|
<span class="badge bg-info-subtle text-info border small">{{ asset_node.asset.get_asset_type_display }}</span>
|
||||||
|
{% if asset_node.asset.status == 'inactive' %}
|
||||||
|
<span class="badge bg-danger-subtle text-danger border small">{% translate "Inactif" %}</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if asset_node.children %}
|
{% if asset_node.children %}
|
||||||
<div id="tree-asset-{{ asset_node.asset.id }}" class="collapse mt-1">
|
<div id="tree-asset-{{ asset_node.asset.id }}" class="collapse show tree-collapse-node">
|
||||||
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=asset_node.children depth=depth|default:1|add:1 only %}
|
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=asset_node.children depth=depth|default:1|add:1 only %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -180,10 +180,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Card 3: Arborescence Unifiée des Localisations & Assets -->
|
<!-- Card 3: Arborescence Unifiée des Localisations & Assets -->
|
||||||
<div class="card shadow-sm mb-4">
|
<div class="card shadow-sm mb-4" id="card-hierarchy-tree">
|
||||||
<div class="card-header bg-light fw-bold d-flex justify-content-between align-items-center">
|
<div class="card-header bg-light fw-bold d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||||
<span><i class="bi bi-diagram-3 me-2"></i>{% translate "Arborescence Hiérarchique" %}</span>
|
<span><i class="bi bi-diagram-3 me-2"></i>{% translate "Arborescence Hiérarchique" %}</span>
|
||||||
<span class="badge bg-primary-subtle text-primary border">{{ location_tree.children|length }} {% translate "sous-localisation(s)" %}</span>
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
<div class="btn-group btn-group-sm" role="group" id="tree-expand-collapse-group">
|
||||||
|
<button type="button" class="btn btn-outline-secondary py-0 px-2 small" id="btn-tree-collapse-all" title="{% translate 'Tout replier' %}">
|
||||||
|
<i class="bi bi-arrows-collapse me-1"></i>{% translate "Tout replier" %}
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-outline-secondary py-0 px-2 small" id="btn-tree-expand-all" title="{% translate 'Tout déplier' %}">
|
||||||
|
<i class="bi bi-arrows-expand me-1"></i>{% translate "Tout déplier" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span class="badge bg-primary-subtle text-primary border">{{ location_tree.children|length }} {% translate "sous-localisation(s)" %}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-3">
|
<div class="card-body p-3">
|
||||||
|
|
||||||
|
|
@ -211,7 +221,14 @@
|
||||||
<!-- Localisation Courante (Racine de l'affichage) -->
|
<!-- Localisation Courante (Racine de l'affichage) -->
|
||||||
<div class="p-2 border rounded bg-white mb-2">
|
<div class="p-2 border rounded bg-white mb-2">
|
||||||
<div class="d-flex align-items-center justify-content-between">
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
<div class="d-flex align-items-center gap-2">
|
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||||
|
<button class="btn btn-sm btn-light border p-0 px-1 tree-toggle-btn"
|
||||||
|
type="button"
|
||||||
|
data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#tree-root-content"
|
||||||
|
aria-expanded="true">
|
||||||
|
<i class="bi bi-chevron-down small"></i>
|
||||||
|
</button>
|
||||||
<i class="bi {{ building.get_icon_class }} text-primary fs-5"></i>
|
<i class="bi {{ building.get_icon_class }} text-primary fs-5"></i>
|
||||||
<span class="fw-bold fs-6 text-primary">{{ building.code }}</span>
|
<span class="fw-bold fs-6 text-primary">{{ building.code }}</span>
|
||||||
{% if building.room_number %}
|
{% if building.room_number %}
|
||||||
|
|
@ -221,30 +238,25 @@
|
||||||
<span class="badge bg-primary text-white ms-1">{{ building.get_location_type_display }}</span>
|
<span class="badge bg-primary text-white ms-1">{{ building.get_location_type_display }}</span>
|
||||||
|
|
||||||
{% if location_tree.assets %}
|
{% if location_tree.assets %}
|
||||||
<button class="btn btn-sm btn-outline-info py-0 px-2 small ms-2 text-nowrap"
|
<span class="badge bg-info-subtle text-info border small ms-1" title="{% translate 'Assets rattachés directement au bâtiment' %}">
|
||||||
type="button"
|
<i class="bi bi-tools me-1"></i>{{ location_tree.assets|length }} {% translate "asset(s)" %}
|
||||||
data-bs-toggle="collapse"
|
</span>
|
||||||
data-bs-target="#tree-assets-root"
|
|
||||||
aria-expanded="false">
|
|
||||||
<i class="bi bi-tools me-1"></i>Assets ({{ location_tree.assets|length }})
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Collapsible Assets de la localisation courante (NON VISIBLES PAR DÉFAUT) -->
|
<div id="tree-root-content" class="collapse show mt-2">
|
||||||
{% if location_tree.assets %}
|
<!-- Assets rattachés directement au bâtiment racine -->
|
||||||
<div id="tree-assets-root" class="collapse mt-2 ms-4">
|
{% if location_tree.assets %}
|
||||||
<div class="card card-body bg-light border-info-subtle p-2 mb-2">
|
<div class="tree-assets-group">
|
||||||
<div class="fw-bold small text-info mb-1"><i class="bi bi-tools me-1"></i>{% translate "Assets rattachés à" %} {{ building.code }} :</div>
|
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=location_tree.assets depth=2 only %}
|
||||||
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=location_tree.assets only %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- Sous-localisations & leurs assets -->
|
<!-- Sous-localisations & leurs assets -->
|
||||||
<div class="mt-2">
|
<div class="tree-locations-group">
|
||||||
{% include "assets/buildings/publicbuilding_location_tree.html" with node=location_tree depth=1 only %}
|
{% include "assets/buildings/publicbuilding_location_tree.html" with node=location_tree depth=1 only %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -908,6 +920,72 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Gestion du repliage / dépliage global de l'arborescence
|
||||||
|
const treeCard = document.getElementById("card-hierarchy-tree");
|
||||||
|
if (treeCard) {
|
||||||
|
const collapseAllBtn = document.getElementById("btn-tree-collapse-all");
|
||||||
|
const expandAllBtn = document.getElementById("btn-tree-expand-all");
|
||||||
|
|
||||||
|
if (collapseAllBtn) {
|
||||||
|
collapseAllBtn.addEventListener("click", function() {
|
||||||
|
// Replier tous les nœuds enfants de l'arborescence (localisations et assets)
|
||||||
|
treeCard.querySelectorAll(".tree-collapse-node").forEach(function(el) {
|
||||||
|
if (window.bootstrap && bootstrap.Collapse) {
|
||||||
|
const bsCollapse = bootstrap.Collapse.getOrCreateInstance(el, { toggle: false });
|
||||||
|
bsCollapse.hide();
|
||||||
|
} else {
|
||||||
|
el.classList.remove("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Mettre à jour l'état visuel de tous les boutons chevrons
|
||||||
|
treeCard.querySelectorAll(".tree-toggle-btn").forEach(function(btn) {
|
||||||
|
if (btn.getAttribute("data-bs-target") !== "#tree-root-content") {
|
||||||
|
btn.classList.add("collapsed");
|
||||||
|
btn.setAttribute("aria-expanded", "false");
|
||||||
|
const icon = btn.querySelector("i");
|
||||||
|
if (icon) {
|
||||||
|
icon.classList.remove("bi-chevron-down");
|
||||||
|
icon.classList.add("bi-chevron-right");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expandAllBtn) {
|
||||||
|
expandAllBtn.addEventListener("click", function() {
|
||||||
|
// S'assurer que le conteneur racine est bien déplié
|
||||||
|
const rootContent = document.getElementById("tree-root-content");
|
||||||
|
if (rootContent) {
|
||||||
|
if (window.bootstrap && bootstrap.Collapse) {
|
||||||
|
bootstrap.Collapse.getOrCreateInstance(rootContent, { toggle: false }).show();
|
||||||
|
} else {
|
||||||
|
rootContent.classList.add("show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Déplier tous les nœuds enfants (localisations et assets)
|
||||||
|
treeCard.querySelectorAll(".tree-collapse-node").forEach(function(el) {
|
||||||
|
if (window.bootstrap && bootstrap.Collapse) {
|
||||||
|
const bsCollapse = bootstrap.Collapse.getOrCreateInstance(el, { toggle: false });
|
||||||
|
bsCollapse.show();
|
||||||
|
} else {
|
||||||
|
el.classList.add("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Mettre à jour l'état visuel de tous les boutons chevrons
|
||||||
|
treeCard.querySelectorAll(".tree-toggle-btn").forEach(function(btn) {
|
||||||
|
btn.classList.remove("collapsed");
|
||||||
|
btn.setAttribute("aria-expanded", "true");
|
||||||
|
const icon = btn.querySelector("i");
|
||||||
|
if (icon) {
|
||||||
|
icon.classList.remove("bi-chevron-right");
|
||||||
|
icon.classList.add("bi-chevron-down");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock script %}
|
{% endblock script %}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<i class="bi bi-chevron-down small"></i>
|
<i class="bi bi-chevron-down small"></i>
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="px-2"></span>
|
<span class="d-inline-block" style="width: 1.35rem;"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<i class="bi {{ child_node.loc.get_icon_class }} text-primary"></i>
|
<i class="bi {{ child_node.loc.get_icon_class }} text-primary"></i>
|
||||||
|
|
@ -31,31 +31,25 @@
|
||||||
<span class="badge bg-primary-subtle text-primary border small">{{ child_node.loc.get_location_type_display }}</span>
|
<span class="badge bg-primary-subtle text-primary border small">{{ child_node.loc.get_location_type_display }}</span>
|
||||||
|
|
||||||
{% if child_node.assets %}
|
{% if child_node.assets %}
|
||||||
<button class="btn btn-sm btn-outline-info py-0 px-2 small text-nowrap"
|
<span class="badge bg-info-subtle text-info border small" title="{% translate 'Assets physiques rattachés' %}">
|
||||||
type="button"
|
<i class="bi bi-tools me-1"></i>{{ child_node.assets|length }}
|
||||||
data-bs-toggle="collapse"
|
</span>
|
||||||
data-bs-target="#tree-assets-loc-{{ child_node.loc.id }}"
|
|
||||||
aria-expanded="false">
|
|
||||||
<i class="bi bi-tools me-1"></i>Assets ({{ child_node.assets|length }})
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Collapsible Assets for this location (NON VISIBLES PAR DÉFAUT) -->
|
<!-- Collapsible Content (Direct Assets & Child Locations) -->
|
||||||
{% if child_node.assets %}
|
{% if child_node.children or child_node.assets %}
|
||||||
<div id="tree-assets-loc-{{ child_node.loc.id }}" class="collapse mt-2" style="padding-left: calc({{ depth|default:1 }} * 1.25rem);">
|
<div id="tree-loc-{{ child_node.loc.id }}" class="collapse show tree-collapse-node">
|
||||||
<div class="card card-body bg-light border-info-subtle p-2 mb-2 me-3">
|
<!-- 1. Assets directement rattachés à cette localisation -->
|
||||||
<div class="fw-bold small text-info mb-1"><i class="bi bi-tools me-1"></i>{% translate "Assets rattachés à" %} {{ child_node.loc.code }} :</div>
|
{% if child_node.assets %}
|
||||||
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=child_node.assets depth=depth|default:1|add:1 only %}
|
{% include "assets/buildings/publicbuilding_asset_tree.html" with asset_nodes=child_node.assets depth=depth|default:1|add:1 only %}
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- Collapsible Child Locations -->
|
<!-- 2. Sous-localisations -->
|
||||||
{% if child_node.children %}
|
{% if child_node.children %}
|
||||||
<div id="tree-loc-{{ child_node.loc.id }}" class="collapse show">
|
{% include "assets/buildings/publicbuilding_location_tree.html" with node=child_node depth=depth|default:1|add:1 only %}
|
||||||
{% include "assets/buildings/publicbuilding_location_tree.html" with node=child_node depth=depth|default:1|add:1 only %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue