Skip to content

Commit

Permalink
Update signup form
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 4, 2023
1 parent 7960db3 commit 4d6b806
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
23 changes: 19 additions & 4 deletions lemarche/templates/auth/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,24 @@ <h1 class="s-title-01__title h1">Inscription</h1>

<div class="c-form">
{% bootstrap_form_errors form type="all" %}

<!-- User kind -->
<fieldset>
<legend>Vous êtes <strong class="fs-base">*</strong></legend>
{% bootstrap_field form.kind %}
</fieldset>
<hr>

<!-- User contact -->
<fieldset>
<legend>Contact</legend>
{% bootstrap_field form.first_name %}
{% bootstrap_field form.last_name %}
{% bootstrap_field form.phone form_group_class="phone-form-group form-group" %}

</fieldset>
<hr>

<!-- User company -->
<fieldset id="infoStructuresFieldset" class="d-none">
<legend>Informations structure</legend>
{% bootstrap_field form.buyer_kind_detail form_group_class="buyer-kind-detail-form-group form-group form-group-required d-none" %}
Expand All @@ -66,12 +71,17 @@ <h1 class="s-title-01__title h1">Inscription</h1>
</div>
<hr>
</fieldset>

<!-- User password -->
<fieldset>
<legend>Création du mot de passe</legend>
{% bootstrap_field form.email %}
{% bootstrap_field form.password1 %}
{% bootstrap_field form.password2 %}
</fieldset>
<hr>

<!-- Legal mentions, survey & co -->
<fieldset id="statsSignupBuyer" class="d-none">
<hr>
<div class="form-group">
Expand All @@ -86,6 +96,8 @@ <h1 class="s-title-01__title h1">Inscription</h1>
{% bootstrap_field form.accept_share_contact_to_external_partners form_group_class="form-group accept-survey-form-group d-none" %}
</div>
<hr>

<!-- Submit -->
<div class="row">
<div class="col-12">
<div class="form-row justify-content-end align-items-center">
Expand Down Expand Up @@ -117,6 +129,8 @@ <h1 class="s-title-01__title h1">Inscription</h1>
* - add buyer_kind_detail field (and make it required)
* - add position field (and make it required)
* - add survey checkbox for newsletter
* - if the user is an INDIVIDUAL:
* - hide company section
*/
document.addEventListener('DOMContentLoaded', function() {
let phoneInput = document.getElementById('id_phone');
Expand Down Expand Up @@ -164,10 +178,11 @@ <h1 class="s-title-01__title h1">Inscription</h1>
} else {
toggleInputElement(false, element=partnerKindInput, required=false);
}
if(radio.value){
infoStructuresFieldset.classList.remove('d-none');
} else { //empty

if (radio.value === 'INDIVIDUAL') {
infoStructuresFieldset.classList.add('d-none');
} else {
infoStructuresFieldset.classList.remove('d-none');
}
}));
});
Expand Down
1 change: 1 addition & 0 deletions lemarche/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class User(AbstractUser):
KIND_SIAE = user_constants.KIND_SIAE
KIND_BUYER = user_constants.KIND_BUYER
KIND_PARTNER = user_constants.KIND_PARTNER
KIND_INDIVIDUAL = user_constants.KIND_INDIVIDUAL
KIND_ADMIN = user_constants.KIND_ADMIN

username = None
Expand Down
1 change: 1 addition & 0 deletions lemarche/www/auth/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SignupForm(UserCreationForm):
(User.KIND_SIAE, "Une entreprise sociale inclusive (SIAE ou structure du handicap, GEIQ)"),
(User.KIND_BUYER, "Un acheteur"),
(User.KIND_PARTNER, "Un partenaire (réseaux, facilitateurs)"),
(User.KIND_INDIVIDUAL, "Un particulier"),
)
FORM_PARTNER_KIND_CHOICES = EMPTY_CHOICE + user_constants.PARTNER_KIND_CHOICES

Expand Down

0 comments on commit 4d6b806

Please sign in to comment.