diff --git a/app/Enums/Contact/ContactFormType.php b/app/Enums/Contact/ContactFormType.php index 9f4d733c..dfb86401 100644 --- a/app/Enums/Contact/ContactFormType.php +++ b/app/Enums/Contact/ContactFormType.php @@ -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', ]; /** diff --git a/app/Enums/Contact/ExportAskingType.php b/app/Enums/Contact/ExportAskingType.php new file mode 100644 index 00000000..f8043e7b --- /dev/null +++ b/app/Enums/Contact/ExportAskingType.php @@ -0,0 +1,25 @@ +name => 'enums.exportAskingType.customer', + self::provider->name => 'enums.exportAskingType.provider', + self::other->name => 'enums.exportAskingType.other', + ]; +} diff --git a/app/Http/Controllers/Front/ContactController.php b/app/Http/Controllers/Front/ContactController.php index bd18dc9b..70b2b362 100644 --- a/app/Http/Controllers/Front/ContactController.php +++ b/app/Http/Controllers/Front/ContactController.php @@ -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)) diff --git a/app/Http/Requests/Front/Contact/ContactRequest.php b/app/Http/Requests/Front/Contact/ContactRequest.php index f1f4dbcf..68e1747a 100644 --- a/app/Http/Requests/Front/Contact/ContactRequest.php +++ b/app/Http/Requests/Front/Contact/ContactRequest.php @@ -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))) { diff --git a/lang/en/enums.php b/lang/en/enums.php index e7c74f95..32ecc17a 100644 --- a/lang/en/enums.php +++ b/lang/en/enums.php @@ -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', + ] ]; diff --git a/lang/fr/enums.php b/lang/fr/enums.php index 0c033eba..dd8f6fff 100644 --- a/lang/fr/enums.php +++ b/lang/fr/enums.php @@ -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', + ], ]; diff --git a/public/assets/css/media.css b/public/assets/css/media.css index 8fea7d4d..ab9bcc05 100644 --- a/public/assets/css/media.css +++ b/public/assets/css/media.css @@ -22,7 +22,6 @@ } .textblock__container_swap > .image-content-size img { width: 100% !important; - height: 545px !important; object-fit: cover !important; } diff --git a/resources/views/emails/contact.blade.php b/resources/views/emails/contact.blade.php index 5eeaace7..954092e0 100644 --- a/resources/views/emails/contact.blade.php +++ b/resources/views/emails/contact.blade.php @@ -1,4 +1,5 @@ - + @@ -15,11 +16,11 @@

Ville : {{ $data->town }}

@endif - @if(isset($data->postalcode)) + @if (isset($data->postalcode))

Code Postal : {{ $data->postalcode }}

@endif - @if(isset($data->country)) + @if (isset($data->country))

Pays : {{ $data->country }}

@endif @@ -31,14 +32,14 @@ @if (\App\Enums\Contact\ContactFormType::breeder->equals($data->enumType))

Type d'élevage :

Zone géographique :

@@ -49,12 +50,20 @@

Société : {{ $data->company }}

@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))

Type de demande :

+ @endif + + {{-- Export --}} + @if (\App\Enums\Contact\ContactFormType::export->equals($data->enumType)) +

Type de demande :

+ diff --git a/resources/views/front/pages/contact/partials/professional.blade.php b/resources/views/front/pages/contact/partials/professional.blade.php index f0bec226..4edec027 100644 --- a/resources/views/front/pages/contact/partials/professional.blade.php +++ b/resources/views/front/pages/contact/partials/professional.blade.php @@ -7,7 +7,8 @@
- equals($contactFormType)) + + @endif + + @if (\App\Enums\Contact\ContactFormType::export->equals($contactFormType)) + + @endif @if (\App\Enums\Contact\ContactFormType::restauration->equals($contactFormType))