|
| 1 | +{% extends "base.html" %} |
| 2 | +{% load guardian_tags %} |
| 3 | +{% load static %} |
| 4 | +{% load sass_tags %} |
| 5 | +{% load django_vite %} |
| 6 | +{% block title %} |
| 7 | + Carnet de contacts {{ block.super }} |
| 8 | +{% endblock title %} |
| 9 | +{% block og_title %} |
| 10 | + Carnet de contacts {{ block.super }} |
| 11 | +{% endblock og_title %} |
| 12 | +{% block css %} |
| 13 | + <link href="{% sass_src 'addressbook/css/contact_list.scss' %}" |
| 14 | + rel="stylesheet" |
| 15 | + type="text/css"> |
| 16 | +{% endblock css %} |
| 17 | +{% block js %} |
| 18 | + {% vite_asset 'js/components/ContactBook.js' %} |
| 19 | + {% vite_asset 'js/apps/featureAddContact.js' %} |
| 20 | +{% endblock js %} |
| 21 | +{% block content %} |
| 22 | + <div x-data="ContactBook" |
| 23 | + @modal-response="closeCreateContactModal($event)" |
| 24 | + class="contact-list col-12 fr-px-15w fr-mx-auto"> |
| 25 | + <!-- Breadcrumb --> |
| 26 | + <nav role="navigation" class="fr-breadcrumb" aria-label="vous êtes ici :"> |
| 27 | + <button class="fr-breadcrumb__button" |
| 28 | + aria-expanded="false" |
| 29 | + aria-controls="breadcrumb-1">Voir le fil d’Ariane</button> |
| 30 | + <div class="fr-collapse" id="breadcrumb-1"> |
| 31 | + <ol class="fr-breadcrumb__list"> |
| 32 | + <li> |
| 33 | + <a class="fr-breadcrumb__link" href="{% url 'home' %}">Accueil</a> |
| 34 | + </li> |
| 35 | + <li> |
| 36 | + <a class="fr-breadcrumb__link" aria-current="page">Contacts</a> |
| 37 | + </li> |
| 38 | + </ol> |
| 39 | + </div> |
| 40 | + </nav> |
| 41 | + <div class="header"> |
| 42 | + <h2>Contact</h2> |
| 43 | + <div class="header__actions"> |
| 44 | + <div class="actions__search-bar"> |
| 45 | + <span class="fr-icon-search-line fr-icon--sm" aria-hidden="true"></span> |
| 46 | + <input class="fr-input w-100" |
| 47 | + type="search" |
| 48 | + @input.debounce.500ms="searchContacts($event.target.value)" |
| 49 | + x-model="searchParams.search" |
| 50 | + placeholder="Rechercher"> |
| 51 | + </div> |
| 52 | + <button class="actions__add-contact no-wrap fr-btn fr-btn--icon-left fr-icon-add-line" |
| 53 | + @click="openModalCreateContact()">Créer un contact</button> |
| 54 | + </div> |
| 55 | + <div class="header__filter d-flex"> |
| 56 | + <template x-for="letter of letters"> |
| 57 | + <button class="header__filter-letter" |
| 58 | + :class="letter === searchParams.letter ? 'header__filter-letter--active': ''" |
| 59 | + x-text="letter" |
| 60 | + @click="loadOrganizationStartingWith(letter)"></button> |
| 61 | + </template> |
| 62 | + <template x-if="searchParams.letter"> |
| 63 | + <div> |
| 64 | + <span>-</span> |
| 65 | + <button class="header__filter-letter" @click="resetLetterFilter">supprimer le filtre</button> |
| 66 | + </div> |
| 67 | + </template> |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + <div class="contact-list__list"> |
| 71 | + <template x-for="organization in contactListGroupByOrganization" :key="index"> |
| 72 | + <div class="organization-container"> |
| 73 | + <div class="d-flex align-items-center"> |
| 74 | + <h3 class="organization__name fr-mb-0 no-wrap" x-text="organization.name"></h3> |
| 75 | + <template x-if="organization.departments?.length > 0"> |
| 76 | + <div class="organization__departments" |
| 77 | + :title="organization.departments.map(department => `${department.name} (${department.code})`).join(', ')"> |
| 78 | + <template x-for="department in organization.departments"> |
| 79 | + <template x-if="department.name"> |
| 80 | + <span class="organization__departments-item" |
| 81 | + x-text="`${department.name} (${department.code})`"></span> |
| 82 | + </template> |
| 83 | + </template> |
| 84 | + </div> |
| 85 | + </template> |
| 86 | + </div> |
| 87 | + <div class="contact-list__list-container"> |
| 88 | + <template x-for="contact in organization.contacts" :key="contact.id"> |
| 89 | + <div x-data="{contact:contact, isOpenDeleteContact: false}" |
| 90 | + class="contact-list__list-item"> |
| 91 | + {% include "tools/contacts/contact_card.html" with button_actions=True %} |
| 92 | + </div> |
| 93 | + </template> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + </template> |
| 97 | + <template x-if="contactListGroupByOrganization.length === 0"> |
| 98 | + <div class="no-contacts fr-m-2w"> |
| 99 | + <p class="no-contacts__text">Aucun contact trouvé.</p> |
| 100 | + <br> |
| 101 | + <p class="no-contacts__text fr-m-0">Vous pouvez créer un contact en cliquant sur le bouton ci-dessus.</p> |
| 102 | + </div> |
| 103 | + </template> |
| 104 | + </div> |
| 105 | + {% include "tools/contacts/create_contact_modal.html" with isItReturningData=False %} |
| 106 | + </div> |
| 107 | +{% endblock content %} |
0 commit comments