fix: re7 fixes
This commit is contained in:
parent
3f4f279af3
commit
bd75fabdfa
9 changed files with 113 additions and 25 deletions
|
|
@ -27,16 +27,16 @@ enum ContactFormType: int
|
|||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::collaborator->name => 'enums.contactFormType.collaborator.label',
|
||||
self::breeder->name => 'enums.contactFormType.breeder.label',
|
||||
self::professional->name => 'enums.contactFormType.professional.label',
|
||||
self::restauration->name => 'enums.contactFormType.restauration.label',
|
||||
self::export->name => 'enums.contactFormType.export.label',
|
||||
self::finance->name => 'enums.contactFormType.finance.label',
|
||||
self::commitments->name => 'enums.contactFormType.commitments.label',
|
||||
self::product->name => 'enums.contactFormType.product.label',
|
||||
self::info->name => 'enums.contactFormType.info.label',
|
||||
self::press->name => 'enums.contactFormType.press.label',
|
||||
self::collaborator->name => 'enums.contactFormType.collaborator',
|
||||
self::breeder->name => 'enums.contactFormType.breeder',
|
||||
self::professional->name => 'enums.contactFormType.professional',
|
||||
self::restauration->name => 'enums.contactFormType.restauration',
|
||||
self::export->name => 'enums.contactFormType.export',
|
||||
self::finance->name => 'enums.contactFormType.finance',
|
||||
self::commitments->name => 'enums.contactFormType.commitments',
|
||||
self::product->name => 'enums.contactFormType.product',
|
||||
self::info->name => 'enums.contactFormType.info',
|
||||
self::press->name => 'enums.contactFormType.press',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
25
app/Enums/Contact/ExportAskingType.php
Normal file
25
app/Enums/Contact/ExportAskingType.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\Contact;
|
||||
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ExportAskingType: int
|
||||
{
|
||||
use BaseEnum;
|
||||
|
||||
case customer = 1;
|
||||
case provider = 2;
|
||||
case other = 3;
|
||||
|
||||
/**
|
||||
* Optionnal labels definition.
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::customer->name => 'enums.exportAskingType.customer',
|
||||
self::provider->name => 'enums.exportAskingType.provider',
|
||||
self::other->name => 'enums.exportAskingType.other',
|
||||
];
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ class ContactController
|
|||
$hasNewsletterError = false;
|
||||
|
||||
/** @var boolean $isNewsletter */
|
||||
$isNewsletter = $validatedData['newsletter'];
|
||||
$isNewsletter = isset($validatedData['newsletter']) ? $validatedData['newsletter'] : false;
|
||||
|
||||
try {
|
||||
dispatch(new SendContactMail($messageContact))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Requests\Front\Contact;
|
|||
use App\Enums\Contact\BreedType;
|
||||
use App\Enums\Contact\ContactFormType;
|
||||
use App\Enums\Contact\CustomerAskingType;
|
||||
use App\Enums\Contact\ExportAskingType;
|
||||
use App\Enums\Contact\PressType;
|
||||
use App\Enums\Department;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
|
@ -20,7 +21,7 @@ class ContactRequest extends FormRequest
|
|||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
|
||||
// ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version'));
|
||||
|
||||
$typeContactForm = $this->input('enumType');
|
||||
|
||||
|
|
@ -93,14 +94,21 @@ class ContactRequest extends FormRequest
|
|||
|
||||
// Validation for restauration and export commun fields.
|
||||
if (
|
||||
ContactFormType::restauration->equals(ContactFormType::make($typeContactForm)) ||
|
||||
ContactFormType::export->equals(ContactFormType::make($typeContactForm))
|
||||
ContactFormType::restauration->equals(ContactFormType::make($typeContactForm))
|
||||
) {
|
||||
$rules = array_merge($rules, [
|
||||
'type' => ['array', 'min:1'],
|
||||
'type.*' => [Rule::enum(CustomerAskingType::class)],
|
||||
]);
|
||||
}
|
||||
if (
|
||||
ContactFormType::export->equals(ContactFormType::make($typeContactForm))
|
||||
) {
|
||||
$rules = array_merge($rules, [
|
||||
'type' => ['array', 'min:1'],
|
||||
'type.*' => [Rule::enum(ExportAskingType::class)],
|
||||
]);
|
||||
}
|
||||
|
||||
// Validation for press enum.
|
||||
if (ContactFormType::press->equals(ContactFormType::make($typeContactForm))) {
|
||||
|
|
|
|||
|
|
@ -88,4 +88,21 @@ return [
|
|||
'asc' => 'From oldest to newest.',
|
||||
'desc' => 'From the most recent to the oldest.'
|
||||
],
|
||||
'exportAskingType' => [
|
||||
"customer" => "Customer",
|
||||
"provider" => "Supplier",
|
||||
"other" => "Other"
|
||||
],
|
||||
'contactFormType' => [
|
||||
'collaborator' => 'join us as an employee',
|
||||
'breeder' => 'join us as a farmer',
|
||||
'professional' => 'a request as a professional',
|
||||
'restauration' => 'foodservice, Industry, Retailer France & Overseas',
|
||||
'export' => 'other countries / Export',
|
||||
'finance' => 'finance',
|
||||
'commitments' => 'our commitments',
|
||||
'product' => 'product information',
|
||||
'info' => 'other general information',
|
||||
'press' => 'a press request',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -88,4 +88,21 @@ return [
|
|||
'asc' => 'du plus ancien au plus récent.',
|
||||
'desc' => 'du plus récent au plus ancien.'
|
||||
],
|
||||
'exportAskingType' => [
|
||||
"customer" => "Client",
|
||||
"provider" => "Fournisseur",
|
||||
"other" => "Autres"
|
||||
],
|
||||
'contactFormType' => [
|
||||
'collaborator' => 'nous rejoindre en tant que collaborateur',
|
||||
'breeder' => 'nous rejoindre en tant qu’éleveur',
|
||||
'professional' => 'une demande en tant que professionnel',
|
||||
'restauration' => 'restaurations, Distributeurs et Détaillants France',
|
||||
'export' => 'l’export',
|
||||
'finance' => 'la finance',
|
||||
'commitments' => 'nos engagements',
|
||||
'product' => 'une information produit',
|
||||
'info' => 'une autre information générale',
|
||||
'press' => 'une demande presse',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
}
|
||||
.textblock__container_swap > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 545px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
|
|
@ -15,11 +16,11 @@
|
|||
<p>Ville : {{ $data->town }}</p>
|
||||
@endif
|
||||
|
||||
@if(isset($data->postalcode))
|
||||
@if (isset($data->postalcode))
|
||||
<p>Code Postal : {{ $data->postalcode }}</p>
|
||||
@endif
|
||||
|
||||
@if(isset($data->country))
|
||||
@if (isset($data->country))
|
||||
<p>Pays : {{ $data->country }}</p>
|
||||
@endif
|
||||
|
||||
|
|
@ -31,14 +32,14 @@
|
|||
@if (\App\Enums\Contact\ContactFormType::breeder->equals($data->enumType))
|
||||
<p>Type d'élevage : </p>
|
||||
<ul>
|
||||
@foreach($data->typeelevage as $breeding)
|
||||
@foreach ($data->typeelevage as $breeding)
|
||||
<li>{{ $breeding->label() }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<p>Zone géographique : </p>
|
||||
<ul>
|
||||
@foreach($data->zonegeo as $zone)
|
||||
@foreach ($data->zonegeo as $zone)
|
||||
<li>{{ $zone->label() }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
@ -49,12 +50,20 @@
|
|||
<p>Société : {{ $data->company }}</p>
|
||||
@endif
|
||||
|
||||
{{-- Restauration and Export --}}
|
||||
@if (\App\Enums\Contact\ContactFormType::restauration->equals($data->enumType) ||
|
||||
\App\Enums\Contact\ContactFormType::export->equals($data->enumType))
|
||||
@if (\App\Enums\Contact\ContactFormType::restauration->equals($data->enumType))
|
||||
<p>Type de demande : </p>
|
||||
<ul>
|
||||
@foreach($data->type as $t)
|
||||
@foreach ($data->type as $t)
|
||||
<li>{{ $t->label() }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
{{-- Export --}}
|
||||
@if (\App\Enums\Contact\ContactFormType::export->equals($data->enumType))
|
||||
<p>Type de demande : </p>
|
||||
<ul>
|
||||
@foreach ($data->type as $t)
|
||||
<li>{{ $t->label() }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
</div>
|
||||
|
||||
<div class="form__row">
|
||||
<x-front.inputs.multi-select placeholder="{{ ucfirst(__('front.contact.inputs.customerAskingType.placeholder')) }}"
|
||||
@if (\App\Enums\Contact\ContactFormType::restauration->equals($contactFormType))
|
||||
<x-front.inputs.multi-select placeholder="{{ ucfirst(__('front.contact.inputs.customerAskingType.placeholder')) }}"
|
||||
label="{{ ucfirst(__('front.contact.inputs.customerAskingType.label')) }}" required="true" name="type"
|
||||
:options="collect(\App\Enums\Contact\CustomerAskingType::toArray())->map(function ($type) {
|
||||
return [
|
||||
|
|
@ -15,6 +16,18 @@
|
|||
'label' => $type->label,
|
||||
];
|
||||
})" />
|
||||
@endif
|
||||
|
||||
@if (\App\Enums\Contact\ContactFormType::export->equals($contactFormType))
|
||||
<x-front.inputs.multi-select placeholder="{{ ucfirst(__('front.contact.inputs.customerAskingType.placeholder')) }}"
|
||||
label="{{ ucfirst(__('front.contact.inputs.customerAskingType.label')) }}" required="true" name="type"
|
||||
:options="collect(\App\Enums\Contact\ExportAskingType::toArray())->map(function ($type) {
|
||||
return [
|
||||
'value' => $type->value,
|
||||
'label' => $type->label,
|
||||
];
|
||||
})" />
|
||||
@endif
|
||||
|
||||
@if (\App\Enums\Contact\ContactFormType::restauration->equals($contactFormType))
|
||||
<x-front.inputs.simple-input label="{{ ucfirst(__('front.contact.inputs.company.label')) }}" name="company"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue