263 lines
14 KiB
HTML
263 lines
14 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
{% load i18n %}
|
|
|
|
|
|
{% block head %}
|
|
<style>
|
|
#projects-table-container {
|
|
position: relative;
|
|
}
|
|
|
|
#filter-dropdown-wrapper {
|
|
position: absolute;
|
|
top: 0.5rem;
|
|
left: 0.5rem;
|
|
z-index: 10;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
/* Styles pour afficher les options de filtre sous forme de badges checkables */
|
|
.filter-options {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem;
|
|
background-color: #f8f9fa;
|
|
border-radius: 0.375rem;
|
|
border: 1px solid #dee2e6;
|
|
}
|
|
|
|
.filter-option {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.filter-option input[type="checkbox"] {
|
|
position: absolute;
|
|
opacity: 0;
|
|
width: 0;
|
|
height: 0;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.filter-option label.badge-label {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
background-color: #e7f1ff;
|
|
color: #0c5cc9;
|
|
border-radius: 1rem;
|
|
padding: 0.4rem 0.6rem;
|
|
font-size: 0.75rem;
|
|
border: 1px solid #b8d4f1;
|
|
transition: all 0.2s ease;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
/* Default badges - checked state */
|
|
.filter-option input[type="checkbox"]:checked + label.badge-label {
|
|
background-color: #0c5cc9;
|
|
color: white;
|
|
border-color: #0c5cc9;
|
|
}
|
|
|
|
/* Default badges - hover */
|
|
.filter-option input[type="checkbox"]:hover + label.badge-label {
|
|
background-color: #cfe2f3;
|
|
}
|
|
</style>
|
|
{% endblock head %}
|
|
|
|
#interventions-table-container {
|
|
position: relative;
|
|
}
|
|
|
|
#filter-dropdown-wrapper {
|
|
position: absolute;
|
|
top: 0.5rem;
|
|
left: 0.5rem;
|
|
z-index: 10;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
|
|
{% block content %}
|
|
<div class="row mt-2" style="height: calc(100vh - 200px);">
|
|
<div id="col-left" class="col-md-6" style="max-height: calc(100vh - 200px); overflow: hidden;">
|
|
<ul class="nav nav-tabs" id="tablesTab" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link active" id="projects-table-tab" data-bs-toggle="tab" data-bs-target="#projects-table-content" type="button" role="tab" aria-controls="projects-table" aria-selected="true">{% translate "Projets" %}</button>
|
|
</li>
|
|
|
|
{% if is_add_project_allowed == True %}
|
|
<div class="">
|
|
<a href="{% url 'projects:projects_add' %}" class="btn btn-light m-1" type="button" aria-expanded="false">
|
|
<i class="bi bi-plus-circle"></i>
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="d-flex ms-auto">
|
|
<button id="expand-col-left" class="btn btn-light m-1" type="button" aria-expanded="false">
|
|
<i class="bi bi-box-arrow-in-right"></i>
|
|
</button>
|
|
</div>
|
|
</ul>
|
|
<div class="tab-content my-2" id="tablesTabContent">
|
|
<div class="tab-pane fade show active" id="projects-table-content" role="tabpanel" aria-labelledby="projects-table-tab">
|
|
|
|
|
|
|
|
<!-- Spinner -->
|
|
<div id="projects-spinner">
|
|
<div class="spinner-border text-primary" role="status">
|
|
<span class="visually-hidden">{% translate "Chargement..." %}</span>
|
|
</div>
|
|
</div>
|
|
<div id="projects-table-container">
|
|
|
|
<!-- Filter form -->
|
|
<div id="filter-dropdown-wrapper" class="float-left">
|
|
<div class="dropdown me-2">
|
|
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
|
|
{% translate "Filtre" %}
|
|
</button>
|
|
<div class="dropdown-menu p-2 bg-light filter-dropdown" id="filter-dropdown">
|
|
<form method="get" id="filter-form" class="row g-3 mb-4">
|
|
<!-- Statut -->
|
|
<div class="col-12">
|
|
<div class="filter-section-header d-flex justify-content-between align-items-center mb-2">
|
|
<label class="form-label mb-0">{% translate "Statut" %}</label>
|
|
<div class="filter-section-buttons">
|
|
<button type="button" class="btn btn-sm btn-outline-secondary select-all-btn py-0 px-2 small" data-field="status" style="font-size: 0.75rem;">{% translate "Tous" %}</button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary deselect-all-btn py-0 px-2 small" data-field="status" style="font-size: 0.75rem;">{% translate "Aucun" %}</button>
|
|
</div>
|
|
</div>
|
|
<div class="filter-options" data-field="status">
|
|
{% for key, value in status_choices %}
|
|
<div class="filter-option">
|
|
<input type="checkbox" name="status" id="status_{{ key }}" value="{{ key }}" {% if key in selected_statuses %}checked{% endif %}>
|
|
<label for="status_{{ key }}" class="badge-label">{{ value }}</label>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Thématiques -->
|
|
<div class="col-12">
|
|
<div class="filter-section-header d-flex justify-content-between align-items-center mb-2">
|
|
<label class="form-label mb-0">{% translate "Thématiques" %}</label>
|
|
<div class="filter-section-buttons">
|
|
<button type="button" class="btn btn-sm btn-outline-secondary select-all-btn py-0 px-2 small" data-field="thematic" style="font-size: 0.75rem;">{% translate "Tous" %}</button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary deselect-all-btn py-0 px-2 small" data-field="thematic" style="font-size: 0.75rem;">{% translate "Aucun" %}</button>
|
|
</div>
|
|
</div>
|
|
<div class="filter-options" data-field="thematic">
|
|
{% for thematic in thematic_choices %}
|
|
<div class="filter-option">
|
|
<input type="checkbox" name="thematic" id="thematic_{{ thematic.code }}" value="{{ thematic.code }}" {% if thematic.code in selected_thematics %}checked{% endif %}>
|
|
<label for="thematic_{{ thematic.code }}" class="badge-label">
|
|
{% if thematic.icon %}<i class="bi {{ thematic.icon }} me-1"></i>{% endif %}{{ thematic.name }}
|
|
</label>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tags -->
|
|
<div class="col-12">
|
|
<div class="filter-section-header d-flex justify-content-between align-items-center mb-2">
|
|
<label class="form-label mb-0">{% translate "Tags" %}</label>
|
|
<div class="filter-section-buttons">
|
|
<button type="button" class="btn btn-sm btn-outline-secondary select-all-btn py-0 px-2 small" data-field="tag" style="font-size: 0.75rem;">{% translate "Tous" %}</button>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary deselect-all-btn py-0 px-2 small" data-field="tag" style="font-size: 0.75rem;">{% translate "Aucun" %}</button>
|
|
</div>
|
|
</div>
|
|
<div class="filter-options" data-field="tag">
|
|
{% for tag in tags %}
|
|
<div class="filter-option">
|
|
<input type="checkbox" name="tag" id="tag_{{ tag.slug }}" value="{{ tag.slug }}" {% if tag.slug in selected_tags %}checked{% endif %}>
|
|
<label for="tag_{{ tag.slug }}" class="badge-label">{{ tag.name }}</label>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="begin_date" class="form-label">{% translate "Date de Début" %}</label>
|
|
<input type="date" name="begin_date" id="begin_date" class="form-control" value="{{ begin_date }}">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="end_date" class="form-label">{% translate "Date de Fin" %}</label>
|
|
<input type="date" name="end_date" id="end_date" class="form-control" value="{{ end_date }}">
|
|
</div>
|
|
<div class="col-12">
|
|
<button type="button" id="apply-filters" class="btn btn-primary">{% translate "Filtrer" %}</button>
|
|
<button type="button" id="reset-filters" class="btn btn-secondary">{% translate "Réinitialiser" %}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<table id="projects-table" class="table"
|
|
data-height="550"
|
|
data-pagination="true"
|
|
data-page-size="25"
|
|
data-click-to-select="true"
|
|
data-search="true" >
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="col-right" class="col-md-6">
|
|
<div class="d-flex mb-1">
|
|
<div class="d-flex">
|
|
<button id="expand-col-right" class="btn btn-light m-1" type="button" aria-expanded="false">
|
|
<i class="bi bi-box-arrow-in-left"></i>
|
|
</button>
|
|
</div>
|
|
<div class="dropdown flex-grow-1">
|
|
<div class="d-flex flex-row-reverse">
|
|
<button class="btn btn-light dropdown-toggle m-1 d-none" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
{% translate "Carte" %}
|
|
</button>
|
|
<div class="dropdown-menu">
|
|
<form class="px-4 py-3">
|
|
|
|
<button type="submit" class="btn btn-primary">{% translate "Filtrer" %}</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="map" class="rounded-2">
|
|
<button id="filterzone" class="btn btn-light btn-sm d-flex mx-auto mt-1 " type="button">
|
|
{% translate "Filtrer sur cette zone" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock content%}
|
|
|
|
|
|
{% block script %}
|
|
<!-- <script src="{% static 'common/proj4.min.js' %}"></script> -->
|
|
<script src="{% static 'common/turf.min.js' %}"></script>
|
|
<script>
|
|
const projectsgeojsonUrl = "{% url 'projects:projects_geojson' %}";
|
|
const projectsurl = "{% url 'projects:projects_index' %}";
|
|
const savePreferencesUrl = "{% url 'common:save_project_list_preferences' %}";
|
|
const savedSort = {{ saved_sort|safe }};
|
|
</script>
|
|
<script src="{% url 'javascript-catalog' %}"></script>
|
|
<script src="{% static 'common/base_script.js' %}"></script>
|
|
<script src="{% static 'common/base_map.js' %}"></script>
|
|
<script src="{% static 'projects/projects_index.js' %}"></script>
|
|
{% endblock script %}
|
|
|