From 7ca97a3a4f721f247fb46fd5b96d418376aef12a Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Wed, 23 Dec 2020 14:26:33 +0100 Subject: [PATCH] saint-denis: add a madis-associations JSON cell (#49717) --- static/saint-denis/config.json | 25 +++++++ .../combo/json/mgdis-associations.html | 71 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 templates/variants/saint-denis/combo/json/mgdis-associations.html diff --git a/static/saint-denis/config.json b/static/saint-denis/config.json index 351c8f71..05d2baad 100644 --- a/static/saint-denis/config.json +++ b/static/saint-denis/config.json @@ -7,6 +7,31 @@ "combo": { "COMBO_ASSET_SLOTS.update": { "header:logo": { "label": "Têtière : logo" } + }, + "JSON_CELL_TYPES.update": { + "mgdis-associations": { + "name": "mgdis : associations", + "url": "https://{{ login }}:{{ password }}@{{ host }}/aides/api/tenants/saintdenis/tiers?userid={{ user_nameid }}", + "form": [ + {"label": "Adresse du serveur", "varname": "host", "required": true}, + {"label": "Login", "varname": "login", "required": true}, + {"label": "Mot de passe", "varname": "password", "required": true} + ], + "varnames": [], + "log_errors": false, + "cache_duration": 0, + "force_async": true, + "timeout": 5, + "additional-data": [ + { + "key": "json_demandes", + "url": "https://{{ login }}:{{ password }}@{{ host }}/aides/api/tenants/saintdenis/demandes?userid={{ user_nameid }}", + "cache_duration": 0, + "log_errors": false, + "timeout": 5 + } + ] + } } } } diff --git a/templates/variants/saint-denis/combo/json/mgdis-associations.html b/templates/variants/saint-denis/combo/json/mgdis-associations.html new file mode 100644 index 00000000..bb4e8644 --- /dev/null +++ b/templates/variants/saint-denis/combo/json/mgdis-associations.html @@ -0,0 +1,71 @@ +
+ {% if json_status != 200 or json_demandes_status != 200 %} + ERREUR : logiciel de gestion des associations indisponible. Réponses transmises : + + {% else %} + + {# Tiers #} + {% if not json or json.total == 0 %} +

+ Afin de pouvoir réaliser des démarches pour le compte de votre association, il faut préalablement déclarer celle-ci auprès de la Ville de Saint-Denis, une fois cette déclaration effectuée de votre part et la fiche validée par la Ville de Saint-Denis, vous aurez accès aux démarches en ligne. +

+

+ + Déclarer votre association + +

+ {% else %} +

Votre compte est lié à l'association : {{ json.data.0.raisonSociale }}

+ {% endif %} + + + {# Demandes #} + {% if json_demandes and json_demandes.total > 0 %} +

Demandes en cours pour votre association

+ + {% for demande in json_demandes.data %} + + {% endfor %} + + + Accéder au détail de ces demandes + + + {% endif %} + + {# liens vers les démarches #} + {% if json and json.total > 0 and json.data.0.status == 'SUPPORTED' and json_demandes and json_demandes.total > 0 %} + {% with first_demande=json_demandes.data|dictsort:"datetime"|first %} + {% if first_demande.status == 'Clôturée' %} + +

Déposer une nouvelle demande pour le compte de mon association

+ + {% endif %} + {% endwith %} + {% endif %} + +{% endif %} +