Skip to content

Commit

Permalink
adapt contact detail click modal
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Aug 6, 2024
1 parent 264d555 commit 1c1e988
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 43 deletions.
16 changes: 8 additions & 8 deletions lemarche/templates/tenders/_detail_contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ <h2>
{% endif %}
</h2>

<div class="fr-grid-row">
<div class="fr-grid-row fr-grid-row--gutters">
{% if tender.contact_full_name %}
<div class="fr-col-md-6">
<i class="ri-account-circle-line"></i>
<span class="fr-icon-account-circle-line"></span>
{{ tender.contact_full_name|safe }}
</div>
{% endif %}
{% if tender.contact_company_name_display %}
<div class="fr-col-md-6">
<i class="ri-building-4-line"></i>
<span class="fr-icon-building-line"></span>
{{ tender.contact_company_name_display }}
</div>
{% endif %}
</div>
<div class="fr-grid-row">
<div class="fr-grid-row fr-grid-row--gutters">
{% if tender.can_display_contact_email %}
<div class="fr-col-md-6">
<i class="ri-at-line"></i>
<span class="fr-icon-mail-line"></span>
{{ tender.contact_email }}
</div>
{% endif %}
{% if tender.can_display_contact_phone %}
<div class="fr-col-md-6">
<i class="ri-phone-line"></i>
<span class="fr-icon-phone-line"></span>
{{ tender.contact_phone }}
</div>
{% endif %}
{% if source == "alert" and not tender.response_kind_is_only_external %}
<div class="fr-col-md-12">
<i class="ri-at-line"></i>
<span class="fr-icon-mail-line"></span>
{{ TEAM_CONTACT_EMAIL }}
</div>
{% endif %}
Expand All @@ -55,7 +55,7 @@ <h2>
{% endif %}
<a href="{{ tender.external_link }}" target="_blank" class="btn btn-outline-primary float-right">
{{ tender.external_link_title|safe }}
<i class="ri-external-link-line" aria-hidden="true"></i>
<span class="fr-icon-external-link-line" aria-hidden="true"></span>
</a>
</div>
</div>
Expand Down
60 changes: 34 additions & 26 deletions lemarche/templates/tenders/_detail_contact_click_confirm_modal.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
<div class="modal fade modal-siae" id="detail_contact_click_confirm_modal" tabindex="-1" role="dialog" aria-modal="true" data-backdrop="static" data-keyboard="false" aria-labelledby="modalTitle">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="modalTitle">Signaler votre intérêt à l'acheteur ?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Fermer">
<i class="ri-close-line"></i>
</button>
</div>
<form method="POST" action="{% url 'tenders:detail-contact-click-stat' tender.slug %}?siae_id=siae-id-params-to-replace">
{% csrf_token %}
<div class="modal-body home-content-body">
<p>
Pour {{ tender.cta_card_button_text | lower }}, vous devez signaler votre intérêt à l'acheteur.
</p>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-sm btn-link" name="detail_contact_click_confirm" value="false">Non</button>
<button type="submit" class="btn btn-sm btn-primary" name="detail_contact_click_confirm" value="true">Oui</button>
<dialog id="detail_contact_click_confirm_modal" role="dialog" class="fr-modal" aria-labelledby="detail_contact_click_confirm_modal_title">
<div class="fr-container fr-container--fluid fr-container-md">
<div class="fr-grid-row fr-grid-row--center">
<div class="fr-col-12 fr-col-md-8">
<div class="fr-modal__body">
<div class="fr-modal__header">
<button class="fr-btn--close fr-btn" title="Fermer la fenêtre modale" aria-controls="detail_contact_click_confirm_modal" target="_self">Fermer</button>
</div>
<div class="fr-modal__content">
<h3 id="detail_contact_click_confirm_modal_title" class="fr-modal__title">Signaler votre intérêt à l'acheteur ?</h3>
<p>
Pour {{ tender.cta_card_button_text | lower }}, vous devez signaler votre intérêt à l'acheteur.
</p>
</div>
<form method="post" action="{% url 'tenders:detail-contact-click-stat' tender.slug %}?siae_id=siae-id-params-to-replace">
{% csrf_token %}
<div class="fr-modal__footer">
<ul class="fr-btns-group fr-btns-group--inline-sm fr-btns-group--equisized fr-btns-group--right">
<li>
<button type="submit" class="fr-btn fr-btn--secondary" name="detail_contact_click_confirm" value="false">Non</button>
</li>
<li>
<button type="submit" class="fr-btn" name="detail_contact_click_confirm" value="true">Oui</button>
</li>
</ul>
</form>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</dialog>

<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
const MODAL_ID = '#detail_contact_click_confirm_modal';
$(MODAL_ID).on('show.bs.modal', function (event) {
const MODAL_ID = 'detail_contact_click_confirm_modal';
document.getElementById(MODAL_ID).addEventListener('dsfr.disclose', (event) => {
// Button that triggered the modal
var button = $(event.relatedTarget);
var button = event.explicitOriginalTarget;

// Extract info from data-* attributes
var siaeIdParams = button.data('siae-id');
var siaeIdParams = button.dataset['siaeId'];

// Update the modal's content
var modal = document.querySelector(MODAL_ID);
var modal = document.querySelector('#' + MODAL_ID);
var form = modal.querySelector('form');
var formAction = form.getAttribute('action');
form.setAttribute('action', formAction.replace('siae-id-params-to-replace', siaeIdParams));
Expand Down
4 changes: 3 additions & 1 deletion lemarche/templates/tenders/_detail_sidebar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<!-- admin info -->
{% load info_card_cms %}
{% if user.is_authenticated and user.is_admin %}
{% include "tenders/_detail_admin_extra_info.html" with tender=tender %}
<div class="fr-col-12">
{% include "tenders/_detail_admin_extra_info.html" with tender=tender %}
</div>
{% endif %}
<!-- author stats info -->
{% if user == tender.author %}
Expand Down
13 changes: 5 additions & 8 deletions lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
<!-- Contact details above + help -->
{% if not tender.deadline_date_outdated and not tender.response_is_anonymous %}
{% if siae_has_detail_contact_click_date %}
<div class="fr-grid-row">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-lg-8">
<div class="alert alert-info fade show" role="status">
<div class="fr-alert fr-alert--info" role="status">
{% include "tenders/_detail_contact.html" with tender=tender source="alert" %}
</div>
</div>
<div class="fr-col-12 fr-col-lg-4">
<div class="alert alert-info mt-3 mt-lg-0" role="alert">
<p class="mb-1">
<i class="ri-information-line ri-lg"></i>
<strong>Conseil</strong>
</p>
<p class="mb-0 fs-sm">
<div class="fr-callout fr-icon-lightbulb-line">
<h3 class="fr-callout__title">Conseil</h3>
<p class="fr-callout__text">
N'attendez pas et contactez dès maintenant le client.
En fonction, envoyez lui un devis, une plaquette commerciale ou répondez à son marché.
</p>
Expand Down

0 comments on commit 1c1e988

Please sign in to comment.