From 6e6ab9ae3a63a0a2fd364a548d03a4d42b03df2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Wed, 24 Jul 2024 10:32:48 +0200 Subject: [PATCH] siae offer and formset with image --- .../templates/dashboard/siae_edit_info.html | 4 +- .../templates/dashboard/siae_edit_offer.html | 513 +++++++++--------- .../templates/storage/s3_upload_form.html | 17 +- 3 files changed, 253 insertions(+), 281 deletions(-) diff --git a/lemarche/templates/dashboard/siae_edit_info.html b/lemarche/templates/dashboard/siae_edit_info.html index f7cb9f357..ec6417c80 100644 --- a/lemarche/templates/dashboard/siae_edit_info.html +++ b/lemarche/templates/dashboard/siae_edit_info.html @@ -17,7 +17,7 @@
{% dsfr_form_field form.description %} -
+
{{ form.logo_url.as_hidden }} @@ -33,7 +33,7 @@
{% else %} - Aucun +

Aucun

{% endif %}
diff --git a/lemarche/templates/dashboard/siae_edit_offer.html b/lemarche/templates/dashboard/siae_edit_offer.html index 8281e17dc..8969fecba 100644 --- a/lemarche/templates/dashboard/siae_edit_offer.html +++ b/lemarche/templates/dashboard/siae_edit_offer.html @@ -1,135 +1,145 @@ {% extends "dashboard/siae_edit_base.html" %} -{% load static bootstrap4 addstr %} +{% load static dsfr_tags addstr %} {% block extra_css %} -{% endblock %} +{% endblock extra_css %} {% block content_siae_form %} -
+ {% csrf_token %} - - {% bootstrap_form_errors form type="all" %} - -
+ {% if form.non_field_errors %} +
+ {{ form.non_field_errors }} +
+ {% endif %} +
-
-
- Vos prestations commerciales (services rendus, produits vendus, activités exercées par vos salariés…) - {% bootstrap_formset_errors offer_formset %} - {% if offer_formset.errors %} - - {% endif %} - - {% bootstrap_formset offer_formset %} - -
{% bootstrap_form offer_formset.empty_form %}
- -
+
+ {{ offer_formset.management_form }} +

Vos prestations commerciales

+

(services rendus, produits vendus, activités exercées par vos salariés…)

+ {% if offer_formset.errors %} +
{{ offer_formset.errors }}
+ {% endif %} + {% for form_formset in offer_formset %} +
+ {% for hidden in form_formset.hidden_fields %} + {{ hidden }} + {% endfor %} + {% for field in form_formset.visible_fields %} + {% include "dsfr/form_field_snippets/field_snippet.html" %} + {% endfor %} +
+ {% endfor %}
+
+
+ {% dsfr_form offer_formset.empty_form %} +
+
+
-
- -
+
-
-
- Références clients - {% bootstrap_formset_errors client_reference_formset %} - {% if client_reference_formset.errors %} - - {% endif %} - - {{ client_reference_formset.management_form }} - - {% for form in client_reference_formset %} -
- {% bootstrap_field form.id %} - {% bootstrap_field form.name %} - -
-
-
- {{ form.logo_url.as_hidden }} - {% with "id_client_references-"|addstr:forloop.counter0|addstr:"-logo_form" as id_logo_form %} - - {% include "storage/s3_upload_form.html" with dropzone_form_id=id_logo_form %} - {% endwith %} +
+ {{ client_reference_formset.management_form }} +

Références clients

+ {% if client_reference_formset.errors %} +
{{ client_reference_formset.errors }}
+ {% endif %} + {% for form_formset in client_reference_formset %} +
+ {% with "id_client_references-"|addstr:forloop.counter0|addstr:"-logo_form" as id_logo_form %} + {% for hidden in form_formset.hidden_fields %} + {{ hidden }} + {% endfor %} + {% for field in form_formset.visible_fields %} + {% if field.name == 'logo_url' %} + +
+
+
+ {{ form_formset.logo_url.as_hidden }} + + {% include "storage/s3_upload_form.html" with dropzone_form_id=id_logo_form %} +
+
+
+
+ + {% if form_formset.logo_url.value %} +
+ +
+ {% else %} +

Aucun

+ {% endif %} +
+
-
+ {% else %} +
+
+ {% include "dsfr/form_field_snippets/field_snippet.html" %} +
+
+ {% endif %} + {% endfor %} + {% endwith %} +
+ {% endfor %} +
+
+
+ {% for hidden in client_reference_formset.empty_form.hidden_fields %} + {{ hidden }} + {% endfor %} + {% for field in client_reference_formset.empty_form.visible_fields %} + {% if field.name == 'logo_url' %} + +
-
- - {% if form.logo_url.value %} -
- -
- {% else %} - Aucun - {% endif %} +
+ {{ field.as_hidden }} + {% include "storage/s3_upload_form.html" with dropzone_form_id="id_client_references-__prefix__-logo_form" %}
- {% bootstrap_field form.DELETE %} -
-
- {% endfor %} - -
-
- - -
-
-
-
- - - - {% include "storage/s3_upload_form.html" with dropzone_form_id="id_client_references-__prefix__-logo_form" %} + {% else %} +
+
+ {% include "dsfr/form_field_snippets/field_snippet.html" %}
-
- -
-
- - -
-
- -
- -
+ {% endif %} + {% endfor %} +
+
- -
+
-
-
- Vos réalisations - {% bootstrap_formset_errors image_formset %} - {% if image_formset.errors %} - - {% endif %} - - {{ image_formset.management_form }} - - {% for form in image_formset %} -
- {% bootstrap_field form.id %} - {% bootstrap_field form.name %} - -
-
-
- {{ form.image_url.as_hidden }} - {% with "id_images-"|addstr:forloop.counter0|addstr:"-image_form" as id_image_form %} - +
+ {{ image_formset.management_form }} +

Vos réalisations

+ {% if image_formset.errors %} +
{{ image_formset.errors }}
+ {% endif %} + {% for form_formset in image_formset %} +
+ {% with "id_images-"|addstr:forloop.counter0|addstr:"-image_form" as id_image_form %} + {% for hidden in form_formset.hidden_fields %} + {{ hidden }} + {% endfor %} + {% for field in form_formset.visible_fields %} + {% if field.name == 'image_url' %} + +
+
+
+ {{ form_formset.image_url.as_hidden }} + {% include "storage/s3_upload_form.html" with dropzone_form_id=id_image_form %} - {% endwith %} +
+
+
+
+ + {% if form_forset.image_url.value %} +
+ +
+ {% else %} +

Aucune

+ {% endif %} +
-
-
- - {% if form.image_url.value %} -
- -
- {% else %} - Aucun - {% endif %} + {% else %} +
+
+ {% include "dsfr/form_field_snippets/field_snippet.html" %}
-
- {% bootstrap_field form.DELETE %} -
-
+ {% endif %} + {% endfor %} + {% endwith %} +
+ {% endfor %} +
+
+
+ {% for hidden in image_formset.empty_form.hidden_fields %} + {{ hidden }} {% endfor %} - -
-
- - -
-
-
-
- - - - {% include "storage/s3_upload_form.html" with dropzone_form_id="id_images-__prefix__-image_form" %} + {% for field in image_formset.empty_form.visible_fields %} + {% if field.name == 'image_url' %} + +
+
+
+ {{ field.as_hidden }} + {% include "storage/s3_upload_form.html" with dropzone_form_id="id_images-__prefix__-image_form" %} +
-
- -
-
- - + {% else %} +
+
+ {% include "dsfr/form_field_snippets/field_snippet.html" %} +
-
- -
- -
+ {% endif %} + {% endfor %} +
+
-
- -
-
- +
+
+
    +
  • + {% dsfr_button label="Enregistrer mes modifications" extra_classes="fr-mt-4v" %} + {% comment %}The following tooltip is triggered in s3_upload.js{% endcomment %} + +
  • +
-{% endblock %} +{% endblock content_siae_form %} {% block extra_js %} @@ -251,7 +265,7 @@ {{ s3_upload_config_siae_image|json_script:"s3-upload-config-siae-image" }} -{% endblock %} +{% endblock extra_js %} diff --git a/lemarche/templates/storage/s3_upload_form.html b/lemarche/templates/storage/s3_upload_form.html index 8b7a0a981..466f2fe88 100644 --- a/lemarche/templates/storage/s3_upload_form.html +++ b/lemarche/templates/storage/s3_upload_form.html @@ -1,20 +1,19 @@
-
-
-
+
+
+ -
Choisissez une image ou glissez ici.
-
Taille maximale : {{ s3_upload_config.max_file_size }} Mo
-
Type de fichier : PNG, JPEG, SVG, GIF
- +
Choisissez une image ou glissez ici.
+
Taille maximale : {{ s3_upload_config.max_file_size }} Mo
+
Type de fichier : PNG, JPEG, SVG, GIF