diff --git a/.config/psysh/psysh_history b/.config/psysh/psysh_history new file mode 100644 index 00000000..a3cd822c --- /dev/null +++ b/.config/psysh/psysh_history @@ -0,0 +1,3 @@ +Hash::make('password'); +Hash::make('alexisgrossebitemesbr'); +exit; diff --git a/app/Enums/ContactFormType.php b/app/Enums/ContactFormType.php new file mode 100644 index 00000000..ba0572df --- /dev/null +++ b/app/Enums/ContactFormType.php @@ -0,0 +1,211 @@ +name => [ + self::restauration, + self::export, + ], + self::collaborator->name => [], + self::breeder->name => [], + self::restauration->name => [], + self::export->name => [], + self::finance->name => [], + self::engagements->name => [], + self::product->name => [], + self::info->name => [], + self::press->name => [], + ]; + + /** + * Get Class + * + * @return string|null + */ + public function isSubtype(): bool + { + foreach (self::SUBTYPES as $subtypes) { + if (in_array($this, $subtypes, true)) { + return true; + } + } + return false; + } + + + /** + * Optionnal TOPLEVELS definition. + * + * @phpstan-ignore-next-line + */ + private const TOPLEVELS = [ + self::professional->name => true, + self::collaborator->name => true, + self::breeder->name => true, + self::restauration->name => false, + self::export->name => false, + self::finance->name => true, + self::engagements->name => true, + self::product->name => true, + self::info->name => true, + self::press->name => true, + ]; + + /** + * Get Class + * + * @return string|null + */ + public function topLevel(): ?string + { + return !empty(self::TOPLEVELS[$this->name]) ? + self::TOPLEVELS[$this->name] : false; + } + + /** + * Optionnal labels definition. + * + * @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::engagements->name => 'enums.contactFormType.engagements.label', + self::product->name => 'enums.contactFormType.product.label', + self::info->name => 'enums.contactFormType.info.label', + self::press->name => 'enums.contactFormType.press.label', + ]; + + /** + * Get the data-target + * + * @return string + */ + public function dataTarget(): string + { + return match ($this) { + self::professional => 'askPro', + }; + } + + /** + * Get the data-target + * + * @return string + */ + public function hasBlankTarget(): string + { + $locale = "fr"; #FIXME: récupérer la vraie locale + + return match (true) { + $this === self::restauration => $locale === "en" ? true : false, + default => false, + }; + } + + /** + * Get the slug for each type + * + * @return string|null + */ + public function slug(): string|null + { + return match ($this) { + self::collaborator => __('enums.contactFormType.collaborator.slug'), + self::breeder => __('enums.contactFormType.breeder.slug'), + self::professional => null, + self::restauration => __('enums.contactFormType.restauration.slug'), + self::export => __('enums.contactFormType.export.slug'), + self::finance => __('enums.contactFormType.finance.slug'), + self::engagements => __('enums.contactFormType.engagements.slug'), + self::product => __('enums.contactFormType.product.slug'), + self::info => __('enums.contactFormType.info.slug'), + self::press => null, + }; + } + + + /** + * Get the route + * + * @return string|null + */ + public function route() + { + $commonRoutes = [ + self::collaborator, + self::breeder, + self::export, + self::finance, + self::engagements, + self::product, + self::info, + + ]; + $locale = "fr"; #FIXME: récupérer la vraie locale + return match (true) { + in_array($this, $commonRoutes, true) => route('front.contact.show', ['slug' => $this->slug()]), + $this === self::professional => null, + $this === self::press => route('front.espace-presse') . '#page-press-form', + $this === self::restauration => $locale === "fr" ? route('front.contact.show', ['slug' => $this->slug()]) : 'https://www.legauloisprofessionnel.fr/contactez-nous', + default => null, + }; + } + + + /** + * Get the slug for each type + * + * @return string|null + */ + public function seo() + { + $commonRoutes = [ + self::collaborator, + self::breeder, + self::export, + self::finance, + self::engagements, + self::professional, + self::product, + self::info, + self::press, + self::restauration + ]; + return match (true) { + in_array($this, $commonRoutes, true) => [ + 'title' => __('enums.contactFormType.' . $this->name . '.seo.title'), + 'description' => __('enums.contactFormType.' . $this->name . '.seo.description'), + ], + default => [], + }; + } +} diff --git a/app/Http/Controllers/Front/ContactController.php b/app/Http/Controllers/Front/ContactController.php new file mode 100644 index 00000000..a338938f --- /dev/null +++ b/app/Http/Controllers/Front/ContactController.php @@ -0,0 +1,28 @@ +first(function ($enum) use ($slug) { + return $enum->slug() === $slug; + }); + + if (!$enumType) { + return redirect()->route('front.contact.index'); + } + + return view('front.pages.contact.show', compact('enumType')); + } +} diff --git a/lang/en/enums.php b/lang/en/enums.php index 53c70a97..ea70d734 100644 --- a/lang/en/enums.php +++ b/lang/en/enums.php @@ -6,4 +6,43 @@ return [ "admin" => "Admin", "visitor" => "Visitor", ], + 'contactFormType' => [ + 'collaborator' => [ + 'label' => 'join us as an employee', + 'slug' => 'join-us-as-an-employee' + ], + 'breeder' => [ + 'label' => 'join us as a farmer', + 'slug' => 'join us as a farmer' + ], + 'professional' => [ + 'label' => 'a request as a professional' + ], + 'restauration' => [ + 'label' => 'foodservice, Industry, Retailer France & Overseas', + ], + 'export' => [ + 'label' => 'other countries / Export', + 'slug' => 'export' + ], + 'finance' => [ + 'label' => 'finance', + 'slug' => 'finance-2' #FIXME: revoir le slug + ], + 'engagements' => [ + 'label' => 'our commitments', + 'slug' => 'our-commitments-2' #FIXME: revoir le slug + ], + 'product' => [ + 'label' => 'product information', + 'slug' => 'product-information' + ], + 'info' => [ + 'label' => 'other general information', + 'slug' => 'other-general-information' + ], + 'press' => [ + 'label' => 'a press request' + ], + ], ]; diff --git a/lang/fr/enums.php b/lang/fr/enums.php index 6b93a669..ab9a2348 100644 --- a/lang/fr/enums.php +++ b/lang/fr/enums.php @@ -6,4 +6,44 @@ return [ "admin" => "Administrateur", "visitor" => "Visiteur", ], + 'contactFormType' => [ + 'collaborator' => [ + 'label' => 'nous rejoindre en tant que collaborateur', + 'slug' => 'nous-rejoindre-en-tant-que-collaborateur' + ], + 'breeder' => [ + 'label' => 'nous rejoindre en tant qu’éleveur', + 'slug' => 'nous-rejoindre-en-tant-queleveur' + ], + 'professional' => [ + 'label' => 'une demande en tant que professionnel' + ], + 'restauration' => [ + 'label' => 'restaurations, Distributeurs et Détaillants France', + 'slug' => 'une-demande-en-tant-que-client-detaillant-distributeur' + ], + 'export' => [ + 'label' => 'l’export', + 'slug' => 'lexport' + ], + 'finance' => [ + 'label' => 'la finance', + 'slug' => 'la-finance' + ], + 'engagements' => [ + 'label' => 'nos engagements', + 'slug' => 'nos-engagements' + ], + 'product' => [ + 'label' => 'une information produit', + 'slug' => 'une-information-produit' + ], + 'info' => [ + 'label' => 'une autre information générale', + 'slug' => 'une-autre-information-generale' + ], + 'press' => [ + 'label' => 'une demande presse' + ], + ], ]; diff --git a/resources/views/components/front/back-to-contact.blade.php b/resources/views/components/front/back-to-contact.blade.php new file mode 100644 index 00000000..a6aab69d --- /dev/null +++ b/resources/views/components/front/back-to-contact.blade.php @@ -0,0 +1,4 @@ +
diff --git a/resources/views/components/front/cta.blade.php b/resources/views/components/front/cta.blade.php index f458bf57..1c3c5fd7 100644 --- a/resources/views/components/front/cta.blade.php +++ b/resources/views/components/front/cta.blade.php @@ -1,3 +1,8 @@ +@php + $type = isset($type) && $type ? $type : "link"; +@endphp + +@if($type === "link") +@else + +@endif diff --git a/resources/views/components/front/inputs/checkbox.blade.php b/resources/views/components/front/inputs/checkbox.blade.php new file mode 100644 index 00000000..ea9cbf6f --- /dev/null +++ b/resources/views/components/front/inputs/checkbox.blade.php @@ -0,0 +1,10 @@ +
+ Vous souhaitez consulter nos offres d'emploi, de stage et d'alternance ; ou nous adresser une
+ candidature spontanée ? Cliquez ici : recrutement.ldc.fr
+
+ Si votre demande concerne un autre sujet, merci de contacter par téléphone le service RH de la
+ société
+ concernée.
+