From 4fb4c9025cd0e70c2f02f8c6e0f4e6191c19946f Mon Sep 17 00:00:00 2001 From: bohwaz Date: Fri, 17 Dec 2021 14:09:27 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20JS=20pour=20la=20s=C3=A9lection=20client/?= =?UTF-8?q?membre=20dans=20le=20formulaire=20d'ajout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/_js.tpl | 10 +++++----- templates/facture_ajouter.tpl | 27 +++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/templates/_js.tpl b/templates/_js.tpl index 8bffb35..5508ae6 100644 --- a/templates/_js.tpl +++ b/templates/_js.tpl @@ -40,14 +40,14 @@ function changeTypeSaisie(type) { g.toggle(['.type_client', '.type_membre'], false); - g.toggle('.type_' + type, true); + + if (type) { + g.toggle('.type_' + type, true); + } } const form = document.querySelector('#f_numero_facture').form; - - if (form.base_receveur) { - changeTypeSaisie(form.base_receveur.value); - } + changeTypeSaisie(form.base_receveur.value); var inputs = $('input[name="base_receveur"]'); diff --git a/templates/facture_ajouter.tpl b/templates/facture_ajouter.tpl index 7ad46c6..9aa9471 100644 --- a/templates/facture_ajouter.tpl +++ b/templates/facture_ajouter.tpl @@ -58,27 +58,26 @@ Client
-
+
{if !empty($clients)}
{input type="radio" name="base_receveur" value="membre" label="Un·e membre" default=1} {input type="radio" name="base_receveur" value="client" label="Un·e client·e"}
{/if} -
-
- {input type="select" name="membre" label="Membre" options=$membres required=1} -
- - {if !empty($clients)} -
- {input type="select" name="client" label="Client" options=$clients required=1 class="type_client"} -
- {else} - - {/if} -
+ +
+ {input type="select" name="membre" label="Membre" options=$membres required=1} +
+ + {if !empty($clients)} +
+ {input type="select" name="client" label="Client" options=$clients required=1 class="type_client"} +
+ {else} + + {/if}