club account forms

This commit is contained in:
Jérémy Munsch 2024-07-08 16:15:49 +02:00
parent 88631d3069
commit 6ecafee16f
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
8 changed files with 405 additions and 1 deletions

View file

@ -0,0 +1,59 @@
<?php
namespace App\Enums\Customers;
use App\Traits\Enums\BaseEnum;
use Illuminate\Support\Facades\Vite;
enum Civility: int
{
use BaseEnum;
case m = 1;
case mme = 2;
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::m->name => 'Un poulet',
self::mme->name => 'Une poule',
];
/**
* Get picture
*
* @return string
*/
public function picture(): string
{
return match ($this) {
self::m => Vite::asset("resources/assets/images/club/game-points/chicken.png"),
self::mme => Vite::asset("resources/assets/images/club/game-points/hen.png"),
};
}
/**
* Get autocomplete
*
* @return string
*/
public function autoComplete(): string
{
return match ($this) {
self::m => 'Monsieur',
self::mme => 'Madame',
};
}
/**
* Get i18n Label
*
* @return string
*/
public function transLabel(): string
{
return __($this->label());
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace App\Enums\Customers;
use App\Traits\Enums\BaseEnum;
enum LivingStatus: int
{
use BaseEnum;
case teenage = 0;
case youngAdult = 1;
case parent = 2;
case parentAlone = 3;
case elder = 4;
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::teenage->name => 'Adolescent/Étudiant',
self::youngAdult->name => 'Jeune actif sans enfant',
self::parent->name => 'Parents',
self::parentAlone->name => 'Adulte sans enfant',
self::elder->name => 'Grand-parent',
];
/**
* Get i18n Label
*
* @return string
*/
public function transLabel(): string
{
return __($this->label());
}
}

View file

@ -19,6 +19,8 @@
@import "./pages/home";
// * PARTIALS
@import "./partials/form-customer-info";
@import "./partials/form-customer-sponsorship";
@import "./partials/card-discount";
@import "./partials/card-club-departaimant";
@import "./partials/card-club-favorite";

View file

@ -0,0 +1,22 @@
.form-customer-info {
.img-civility {
width: 4.1875rem;
height: 4.5rem;
filter: saturate(100%) contrast(65%) brightness(80%) sepia(100%) hue-rotate(157deg);
}
.form-check-input, .form-control {
background-color: $secondary-text-emphasis-dark;
color: $color-primary;
}
.label, label {
display: flex;
align-items: center;
font-weight: 600;
}
.form-check .label, label {
display: inherit;
}
}

View file

@ -0,0 +1,12 @@
.form-customer-sponsorship {
.img-civility {
width: 4.1875rem;
height: 4.5rem;
filter: saturate(100%) contrast(65%) brightness(80%) sepia(100%) hue-rotate(157deg);
}
.form-check-input, .form-control {
background-color: $secondary-text-emphasis-dark;
color: $color-primary;
}
}

View file

@ -100,9 +100,20 @@
</section>
{{-- Mobile Departaimant complete collection --}}
<section class="row mb-5 pb-5">
<section class="row mb-5">
<div class="col">
@include('club.pages.customers.partials.card-club-departaimant')
</div>
</section>
<section class="row mb-5">
<div class="col">
@include('club.pages.customers.partials.customer-info-form')
</div>
</section>
<section class="row mb-5 pb-5">
<div class="col">
@include('club.pages.customers.partials.customer-sponsorship-form')
</div>
</section>
@endsection

View file

@ -0,0 +1,201 @@
<form class="text-bg-light form-customer-info rounded-4 container container p-3">
@php
$columns = [
'label' => 'col-sm-4 col-md-2',
'input' => 'col-sm-7 offset-sm-1 col-md-4 offset-md-0',
];
@endphp
<fieldset class="row mb-3">
<legend class="col-12 f-bourton-base mb-4">{{ __('Mes informations personelles') }}</legend>
{{-- CIVILITY --}}
<div class="label col-md-2 mb-3">{{ __('Civilité') }}</div>
<div class="col-md-10 text-md-start mb-3 text-center">
@foreach (\App\Enums\Customers\Civility::all() as $civilityEnum)
<div class="d-inline-block d-inline-flex align-items-center">
<img class="img-fluid img-civility" src="{{ $civilityEnum->picture() }}" alt="{{ $civilityEnum->transLabel() }}"
role="img">
<div class="form-check mx-3">
<input class="form-check-input bg-secondary-emphasis" id="info-civility-{{ $civilityEnum->value() }}"
name="civility" type="radio" value="{{ $civilityEnum->value() }}"
aria-label="{{ $civilityEnum->autoComplete() }}" autocomplete="sex">
<label class="form-check-label text-uppercase f-bourton-base fw-normal mx-2"
for="info-civility-{{ $civilityEnum->value() }}">{{ $civilityEnum->transLabel() }}</label>
</div>
</div>
@endforeach
@foreach ($errors->get('civility') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- LASTNAME --}}
<label for="info-lastname" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ __('Nom') }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('lastname')) is-invalid @endif mx-auto" id="info-lastname" name="lastname"
type="text" value="{{ old('lastname', $crmCustomer->lastname ?? null) }}" aria-label="{{ __('Nom') }}"
autocomplete="family-name" required />
@foreach ($errors->get('lastname') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- FIRSTNAME --}}
<label for="info-firstname" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ __('Prénom') }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('firstname')) is-invalid @endif mx-auto" id="info-firstname" name="firstname"
type="text" value="{{ old('firstname', $crmCustomer->firstname ?? null) }}" aria-label="{{ __('Prénom') }}"
autocomplete="given-name" required />
@foreach ($errors->get('firstname') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- PSEUDO --}}
<label for="info-username" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ __('Pseudo') }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('username')) is-invalid @endif mx-auto" id="info-username" name="username"
data-form-type="username" type="text" value="{{ old('username', $customer->username ?? null) }}"
aria-label="{{ __('Pseudo') }}" autocomplete="username" required />
@foreach ($errors->get('username') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- EMAIL --}}
<label for="info-email" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ __('Email Address') }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('email')) is-invalid @endif mx-auto" id="info-email" name="email"
data-form-type="email" type="text" value="{{ old('email', $customer->email ?? null) }}"
aria-label="{{ __('Email Address') }}" autocomplete="email" required />
@foreach ($errors->get('email') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- ADDRESS --}}
<label for="info-address" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ Str::ucfirst(__('validation.attributes.line_address_1')) }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('address')) is-invalid @endif mx-auto" id="info-address" name="address"
type="text" value="{{ old('address', $customer->address ?? null) }}"
aria-label="{{ __('validation.attributes.line_address_1') }}" autocomplete="address-line1" required />
@foreach ($errors->get('address') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- ADDRESS 2 --}}
<label for="info-address2" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ Str::ucfirst(__('validation.attributes.line_address_2')) }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('address2')) is-invalid @endif mx-auto" id="info-address2" name="address2"
type="text" value="{{ old('address2', $customer->address2 ?? null) }}"
aria-label="{{ __('validation.attributes.line_address_2') }}" autocomplete="address-line2" required />
@foreach ($errors->get('address2') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- POSTCODE --}}
<label for="info-postalcode" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ Str::ucfirst(__('validation.attributes.postal_code')) }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('postal_code')) is-invalid @endif mx-auto" id="info-postalcode" name="postal_code"
type="text" value="{{ old('postal_code', $customer->postal_code ?? null) }}"
aria-label="{{ __('validation.attributes.postal_code') }}" autocomplete="postal-code" required />
@foreach ($errors->get('postal_code') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- CITY --}}
<label for="info-city" @class(array_merge(['mb-3', Arr::first($columns)]))>{{ Str::ucfirst(__('validation.attributes.city')) }}</label>
<div @class(array_merge(['mb-3', Arr::last($columns)]))>
<input class="form-control @if ($errors->has('city')) is-invalid @endif mx-auto" id="info-city" name="postal_code"
type="text" value="{{ old('city', $customer->postal_code ?? null) }}"
aria-label="{{ __('validation.attributes.city') }}" autocomplete="address-level2" required />
@foreach ($errors->get('city') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
{{-- LIVING STATUS --}}
<div class="col-md-3 label mb-3">{{ __('Civilité') }}</div>
<div class="col-md-9 mb-3">
@foreach (\App\Enums\Customers\LivingStatus::all() as $livingStatus)
<div class="d-inline-block d-inline-flex align-items-center">
<div class="form-check mx-4">
<input class="form-check-input bg-secondary-emphasis" id="info-living-status-{{ $livingStatus->value() }}"
name="living_status" type="radio" value="{{ $livingStatus->value() }}">
<label class="form-check-label text-uppercase f-bourton-base fw-normal mx-2"
for="info-living-status-{{ $livingStatus->value() }}">{{ $livingStatus->transLabel() }}</label>
</div>
</div>
@endforeach
@foreach ($errors->get('living_status') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
</fieldset>
<fieldset class="row mb-3">
<legend class="col-12 f-bourton-base mb-4">{{ __('Mes poussins (enfants)') }}</legend>
<div class="col-12">
<div class="row">
<div class="col-12">{{ __('Poussin 1') }}</div>
<label class="col-md-3" for="birthday-0">{{ Str::ucfirst(__('validation.attributes.birthday')) }}</label>
<div class="col-md-5">
<input class="form-control @if ($errors->has('birthday.0')) is-invalid @endif mx-auto" id="birthday-0"
name="birthday[]" type="date" value="" aria-label="{{ __('validation.attributes.birthday') }}" />
@foreach ($errors->get('birthday.0') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
<div class="col-12 my-3">
<button class="btn btn-warning text-uppercase">{{ __('+ Ajouter des poussins') }}</button>
</div>
</div>
</div>
</fieldset>
<fieldset class="row mb-3">
<legend class="col-12 f-bourton-base mb-4">{{ __('Mes préférences') }}</legend>
{{-- NEWSLETTER --}}
<div class="col-12 mb-2">
<div class="form-check">
<input class="form-check-input bg-secondary-emphasis" id="info-newsletter" name="newsletter" type="checkbox"
value="1">
<label class="form-check-label" for="info-newsletter">
<span class="fw-bold">{{ __('J\'accepte de recevoir les newsletters du Club des Gaulois :') }}</span><br>
<span>{{ __('Les newsletters traiteront en partie des produits mais aussi des nouveautés, des nouvelles activités, des jeux-concours... nous vous enverrons environ un mail par mois.') }}</span>
</label>
</div>
</div>
{{-- CGU --}}
<div class="col-12 mb-2">
<div class="form-check">
<input class="form-check-input bg-secondary-emphasis" id="info-cgu" name="cgu" type="checkbox" value="1">
<label class="form-check-label" for="info-cgu">
<span
class="fw-bold">{{ __('J\'accepte les conditions générales d\'utilisation du site et autorise Le Gaulois à traiter mes données personnelles conformément à la Charte de confidentialité.') }}</span>
</label>
</div>
</div>
{{-- CGV --}}
<div class="col-12 mb-2">
<div class="form-check">
<input class="form-check-input bg-secondary-emphasis" id="info-cgv" name="cgu" type="checkbox" value="1">
<label class="form-check-label" for="info-cgv">
<span class="fw-bold">{{ __('J\'accepte les Conditions Générales de Vente.') }}</span>
</label>
</div>
</div>
</fieldset>
<div class="row">
<div class="col text-end">
<button class="btn btn-lg btn-tertiary" type="submit">{{ __('Enregistrer') }}</button>
</div>
</div>
</form>

View file

@ -0,0 +1,59 @@
<form class="text-bg-light form-customer-sponsorship rounded-4 container p-3">
<fieldset class="row mb-3">
<legend class="col-12 f-bourton-base mb-4">{{ __('Mes parrainages') }}</legend>
<div class="col-12">
<div class="row">
<div class="col-12 d-flex f-bourton-base align-items-center flex-row">
<span class="flex-grow-1 mb-2">{{ __('Filleul 1') }}</span>
<span>{{ __('Parrainage accepté') }}</span>
<span class="rounded-pill text-bg-danger d-flex flex-column ms-2 px-3 py-2">
<span>
<span>+</span><span>50</span>
</span>
<span>pts</span>
</span>
</div>
<label class="col-md-3" for="birthday-0">{{ Str::ucfirst(__('validation.attributes.email')) }}</label>
<div class="col-md-5">
<input class="form-control @if ($errors->has('email.0')) is-invalid @endif mx-auto" id="email-0" name="email[]"
type="email" value="" aria-label="{{ __('validation.attributes.email') }}" />
@foreach ($errors->get('email.0') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
</div>
<div class="row">
<div class="col-12 d-flex f-bourton-base align-items-center flex-row">
<span class="flex-grow-1 mb-2">{{ __('Filleul 2') }}</span>
<span>{{ __('Parrainage en cours') }}</span>
<span class="rounded-pill text-bg-danger d-flex flex-column ms-2 px-3 py-2 opacity-50">
<span>
<span>+</span><span>50</span>
</span>
<span>pts</span>
</span>
</div>
<label class="col-md-3" for="birthday-0">{{ Str::ucfirst(__('validation.attributes.email')) }}</label>
<div class="col-md-5">
<input class="form-control @if ($errors->has('email.0')) is-invalid @endif mx-auto" id="email-0" name="email[]"
type="email" value="" aria-label="{{ __('validation.attributes.email') }}" />
@foreach ($errors->get('email.0') as $message)
<div class="invalid-feedback">{{ $message }}</div>
@endforeach
</div>
</div>
</div>
</fieldset>
<div class="row">
<div class="col d-flex justify-content-between">
<span>
<button class="btn btn-warning">+&nbsp;{{ __('Ajouter un filleul') }}</button>
</span>
<span>
<button class="btn btn-lg btn-tertiary" type="submit">{{ __('Enregistrer') }}</button>
</span>
</div>
</div>
</form>