From 0daabb01e7d62945e713f000c4bf17dce67bd428 Mon Sep 17 00:00:00 2001
From: Serghei Mihai <smihai@entrouvert.com>
Date: Wed, 28 Aug 2019 15:47:10 +0200
Subject: [PATCH] =?UTF-8?q?alpes-maritimes-2018:=20display=20association?=
 =?UTF-8?q?=20d=C3=A9tails=20and=20contacts=20on=20the=20same=20page=20(#3?=
 =?UTF-8?q?5131)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 static/alpes-maritimes-2018/config.json        | 18 +++++-------------
 .../combo/json/contacts-association.html       | 17 -----------------
 .../combo/json/informations-association.html   | 12 ++++++++++++
 3 files changed, 17 insertions(+), 30 deletions(-)
 delete mode 100644 templates/variants/alpes-maritimes-2018/combo/json/contacts-association.html

diff --git a/static/alpes-maritimes-2018/config.json b/static/alpes-maritimes-2018/config.json
index b2047852..b44de5a8 100644
--- a/static/alpes-maritimes-2018/config.json
+++ b/static/alpes-maritimes-2018/config.json
@@ -92,19 +92,6 @@
                   "varnames": ["dossier"],
                   "url": "{{ passerelle_url }}atos-genesys/genesys-prod/dossiers?NameID={{user_nameid}}&link_id={{ dossier }}"
               },
-              "contacts-association": {
-                  "cache_duration": 1,
-                  "name": "Contacts association",
-                  "form": [
-                    {
-                      "label": "Identifiant du connecteur",
-                      "varname": "slug",
-                      "required": true
-                    }
-                  ],
-                  "varnames": ["association_id"],
-                  "url": "{{ passerelle_url }}astregs/{{ slug }}/get-association-link-means?association_id={{ association_id }}&NameID={{ user_nameid }}"
-              },
               "informations-association": {
                   "cache_duration": 1,
                   "name": "Informations de l'association",
@@ -115,6 +102,11 @@
                       "required": true
                     }
                   ],
+                  "additional-data": [
+                    {"key": "json_contact",
+                     "url": "{{ passerelle_url }}astregs/{{ slug }}/get-contact?contact_id={{ json.data.EncodeKeyContact }}"
+                    }
+                  ],
                   "varnames": ["association_id"],
                   "url": "{{ passerelle_url }}astregs/{{ slug }}/get-association-by-id?association_id={{ association_id }}&NameID={{ user_nameid }}"
               },
diff --git a/templates/variants/alpes-maritimes-2018/combo/json/contacts-association.html b/templates/variants/alpes-maritimes-2018/combo/json/contacts-association.html
deleted file mode 100644
index 6d98279b..00000000
--- a/templates/variants/alpes-maritimes-2018/combo/json/contacts-association.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<div class="cell textcell pink-header">
-  <div>
-    <h3>Moyens de contact</h3>
-    <p>
-      {% if json.data %}
-      {% for canal in json.data %}
-      {% if canal.type == "email" %}
-      Courriel : <strong>{{canal.value}}</strong><br/>{% endif%}
-      {% if canal.type == "mobile" %}Téléphone : <strong>{{canal.value}}</strong><br/>{% endif%}
-      {% if canal.type == "mail" %}Adresse : <strong>{{canal.value}}</strong><br/>{% endif%}
-      {% endfor %}
-      {% else %}
-      Aucun moyen de contact.
-      {% endif %}
-    </p>
-  </div>
-</div>
diff --git a/templates/variants/alpes-maritimes-2018/combo/json/informations-association.html b/templates/variants/alpes-maritimes-2018/combo/json/informations-association.html
index ba4e5b43..4ea4458b 100644
--- a/templates/variants/alpes-maritimes-2018/combo/json/informations-association.html
+++ b/templates/variants/alpes-maritimes-2018/combo/json/informations-association.html
@@ -18,6 +18,18 @@
         {% if json.data.AdresseBureauDistributeur %}{{ json.data.AdresseBureauDistributeur }}<br/>{% endif %}
       </strong>
     </p>
+    <h3>Moyens de contact</h3>
+      {% if json_contact.data %}
+        <p>
+          <strong>{{json_contact.data.Prenom}} {{json_contact.data.Nom}}</strong><br/>
+          Courriel : <strong>{{json_contact.data.AdresseMail|default:"Non renseigné"}}</strong><br/>
+          Téléphone : <strong>{{json_contact.data.TelephoneMobile|default:"Non renseigné"}}</strong><br/>
+          Adresse : <strong>{{json_contact.data.RueVoie|default:""}} {{json_contact.data.CodePostal|default:""}} {{json_contact.data.Ville|default:""}}</strong>
+        </p>
+        {% else %}
+          <p>Aucun contact n'est renseigné.</p>
+        {% endif %}
   </div>
 </div>
+
 {% endif %}
-- 
2.23.0

