diff --git a/app/Enums/ActivityLogs/ActivityLogsEventEnum.php b/app/Enums/ActivityLogs/ActivityLogsEventEnum.php index ebb098c..658641c 100644 --- a/app/Enums/ActivityLogs/ActivityLogsEventEnum.php +++ b/app/Enums/ActivityLogs/ActivityLogsEventEnum.php @@ -23,7 +23,6 @@ enum ActivityLogsEventEnum: int self::deleted->name => 'Suppression', ]; - /** * Custom added classes definition */ diff --git a/app/Enums/Contact/CivilityEnum.php b/app/Enums/Contact/CivilityEnum.php new file mode 100644 index 0000000..50c8146 --- /dev/null +++ b/app/Enums/Contact/CivilityEnum.php @@ -0,0 +1,21 @@ +name => 'Homme', + self::woman->name => 'Femme', + ]; +} diff --git a/app/Enums/Contact/ObjectEnum.php b/app/Enums/Contact/ObjectEnum.php new file mode 100644 index 0000000..cb0590c --- /dev/null +++ b/app/Enums/Contact/ObjectEnum.php @@ -0,0 +1,25 @@ +name => 'Service consommateurs', + self::ideasSuggestions->name => 'Idées & suggestions', + self::informationRequest->name => 'Demande d’informations', + self::other->name => 'Divers', + ]; +} diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index b7e75ea..039e513 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -4,11 +4,14 @@ namespace App\Http\Controllers\Fo; use App\Enums\StaticPageType; use App\Http\Controllers\Controller; +use App\Http\Requests\Fo\ContactRequest; +use App\Mail\SendContactForm; use App\Models\Homepage; use App\Models\News; use App\Models\Range; use App\Models\SeasonalSection; use App\Models\StaticPage; +use Illuminate\Support\Facades\Mail; class StaticPageController extends Controller { @@ -68,4 +71,34 @@ class StaticPageController extends Controller 'rangeModels', )); } + + /** + * Display a listing of the resource. + * + * @return \Illuminate\Contracts\View\View + */ + public function contact(): \Illuminate\Contracts\View\View + { + /** @var \App\Models\StaticPage $staticPageModel */ + $contactModel = StaticPage::query()->where('type', StaticPageType::contact)->firstOrFail(); + + return view('fo.pages.contact', compact('contactModel')); + } + + /** + * Display a listing of the resource. + * + * @param \App\Http\Requests\Fo\ContactRequest $request + * @return \Illuminate\Http\RedirectResponse + */ + public function contactForm(ContactRequest $request): \Illuminate\Http\RedirectResponse + { + Mail::to(\config('mail.from.address'))->send(new SendContactForm($request->validated())); + + return redirect()->route('fo.contact.show') + ->with( + 'success', + 'Bonjour, votre message a bien été transmis. nous vous en remercions. Cordialement, l’équipe Agis.' + ); + } } diff --git a/app/Http/Requests/Fo/.gitkeep b/app/Http/Requests/Fo/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/app/Http/Requests/Fo/ContactRequest.php b/app/Http/Requests/Fo/ContactRequest.php new file mode 100644 index 0000000..76d4f3d --- /dev/null +++ b/app/Http/Requests/Fo/ContactRequest.php @@ -0,0 +1,184 @@ +merge([ + 'accept_rules' => $this->accept_rules ? true : false, + 'send_data' => $this->send_data ? true : false, + ]); + $this->mergePicture('file'); + } + + /** + * Get the validation rules that apply to the request. + * + * @return array + */ + public function rules() + { + $rules = [ + 'civility' => ['sometimes', 'nullable', new Enum(CivilityEnum::class)], + 'last_name' => 'sometimes|nullable|string|between:3,255', + 'first_name' => 'sometimes|nullable|string|between:3,255', + 'society' => 'sometimes|nullable|string|between:3,255', + 'email' => 'required|email:rfc,strict,dns,spoof,filter|max:255', + 'phone' => 'sometimes|nullable|numeric|min:0', + 'address' => 'sometimes|nullable|string|between:3,255', + 'postal_code' => 'sometimes|nullable|numeric|min:0', + 'city' => 'sometimes|nullable|string|between:3,255', + 'object' => ['sometimes', 'nullable', new Enum(ObjectEnum::class)], + 'product_name' => [ + 'nullable', 'string', 'between:3,255', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_date_limit,product_barcode,product_lot,product_date_consumption,product_location', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_name'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'product_date_limit' => [ + 'sometimes', 'nullable', 'string', 'between:3,255', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_name,product_barcode,product_lot,product_date_consumption,product_location', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_date_limit'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'product_barcode' => [ + 'sometimes', 'nullable', 'numeric', 'min:0', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_name,product_date_limit,product_lot,product_date_consumption,product_location', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_barcode'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'product_lot' => [ + 'sometimes', 'nullable', 'numeric', 'min:0', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_name,product_date_limit,product_barcode,product_date_consumption,product_location', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_lot'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'product_date_consumption' => [ + 'sometimes', 'nullable', 'string', 'between:3,255', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_name,product_date_limit,product_barcode,product_lot,product_location', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_date_consumption'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'product_location' => [ + 'sometimes', 'nullable', 'string', 'between:3,255', + // @phpcs:ignore Generic.Files.LineLength.TooLong + 'required_with:product_name,product_date_limit,product_barcode,product_lot,product_date_consumption', + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed + function ($attribute, $value, $fail) { + if ($this->get("object") != ObjectEnum::customerService->value()) { + $fail(\trans('le Champs :field doit être vide lorsque le champs objet + n\'est pas égale à :enumValue.', [ + 'field' => trans('validation.custom.product_location'), + 'enumValue' => ObjectEnum::customerService->label(), + ])); + } + } + ], + 'message' => 'sometimes|nullable|string|between:3,255', + 'accept_rules' => 'required|boolean', + 'send_data' => 'required|boolean', + ]; + + return \array_merge($rules, $this->pictureRules('file', 0, 0, 1920, 1080, true)); + } + + /** + * Get custom attributes for validator errors. + * + * @return array + */ + public function attributes(): array + { + return [ + 'civility' => trans('validation.custom.civility'), + 'first_name' => trans('validation.attributes.first_name'), + 'last_name' => trans('validation.attributes.last_name'), + 'society' => trans('validation.custom.society'), + 'email' => trans('validation.attributes.email'), + 'phone' => trans('validation.attributes.phone'), + 'address' => trans('validation.attributes.address'), + 'postal_code' => trans('validation.attributes.postal_code'), + 'city' => trans('validation.attributes.city'), + 'object' => trans('validation.custom.object'), + 'product_name' => trans('validation.custom.product_name'), + 'product_date_limit' => trans('validation.custom.product_date_limit'), + 'product_barcode' => trans('validation.custom.product_barcode'), + 'product_lot' => trans('validation.custom.product_lot'), + 'product_date_consumption' => trans('validation.custom.product_date_consumption'), + 'product_location' => trans('validation.custom.product_location'), + 'message' => trans('validation.attributes.message'), + 'accept_rules' => trans('validation.custom.accept_rules'), + 'send_data' => trans('validation.custom.send_data'), + ]; + } +} diff --git a/app/Mail/SendContactForm.php b/app/Mail/SendContactForm.php new file mode 100644 index 0000000..07d00ba --- /dev/null +++ b/app/Mail/SendContactForm.php @@ -0,0 +1,208 @@ +civility = (isset($edition['civility'])) ? CivilityEnum::make(intval($edition['civility']))->label() : null; + $this->first_name = $edition['first_name'] ?? null; + $this->last_name = $edition['last_name'] ?? null; + $this->society = $edition['society'] ?? null; + $this->email = $edition['email']; + $this->phone = $edition['phone'] ?? null; + $this->address = $edition['address'] ?? null; + $this->postal_code = $edition['postal_code'] ?? null; + $this->city = $edition['city'] ?? null; + $this->object = (isset($edition['object'])) ? ObjectEnum::make(intval($edition['object']))->label() : null; + $this->product_name = $edition['product_name']; + $this->product_date_limit = $edition['product_date_limit']; + $this->product_barcode = $edition['product_barcode']; + $this->product_lot = $edition['product_lot']; + $this->product_date_consumption = $edition['product_date_consumption']; + $this->product_location = $edition['product_location']; + $this->message = $edition['message'] ?? null; + $this->file = $edition['file'] ?? null; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + $mail = $this->subject(\config('app.name') . ' - contact formulaire') + ->markdown('emails.send-contact-form') + ->with([ + 'civility' => $this->civility, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'society' => $this->society, + 'email' => $this->email, + 'phone' => $this->phone, + 'address' => $this->address, + 'postal_code' => $this->postal_code, + 'city' => $this->city, + 'object' => $this->object, + 'product_name' => $this->product_name, + 'product_date_limit' => $this->product_date_limit, + 'product_barcode' => $this->product_barcode, + 'product_lot' => $this->product_lot, + 'product_date_consumption' => $this->product_date_consumption, + 'product_location' => $this->product_location, + 'message' => $this->message, + ]); + if (isset($this->file)) { + $mail = $mail->attach($this->file->getRealPath(), [ + 'as' => $this->file->getClientOriginalName(), + 'mime' => $this->file->getClientMimeType(), + ]); + } + return $mail; + } +} diff --git a/resources/assets/images/homepage/swiper-nav.png b/resources/assets/images/global/btn-arrow.png similarity index 100% rename from resources/assets/images/homepage/swiper-nav.png rename to resources/assets/images/global/btn-arrow.png diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index d5429cd..2fd8c98 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -221,53 +221,65 @@ return [ 'female' => 'of the ', 'vowel' => 'of the ' ], - 'event' => 'event', - 'model' => 'target element', - 'order' => 'order', - 'publication' => 'publication', - 'activated' => 'activated', - 'target' => 'target', - 'static_page_type' => 'static page type', - 'seo' => 'SEO', - 'seo_title' => 'SEO title', - 'seo_description' => 'SEO description', - 'description' => 'description', - 'subtitle' => 'subtitle', - 'tagline' => 'tagline', - 'attribute_alt' => 'alt attribute', - 'attribute_title' => 'title attribute', - 'picture_productsheet' => 'productsheet picture', - 'picture_thumbnail' => 'thumbnail', - 'category' => 'category', - 'publish_at' => 'publication date', - 'unpublish_at' => 'end of publication date', - 'background' => 'background', - 'picture' => 'picture', - 'picture_1' => 'picture one', - 'picture_2' => 'picture two', - 'picture_3' => 'picture three', - 'presentation_title' => 'presentation title', - 'title_part1' => 'title part one', - 'title_part2' => 'title part two', - 'title_part3' => 'title part three', - 'category' => 'category', - 'publish_at' => 'publication date', - 'unpublish_at' => 'end of publication date', - 'picture_ambiance' => 'ambiance picture', - 'picture_packshot' => 'packshot picture', - 'cooking_advice' => 'cooking advice', - 'ingredients' => 'ingredients', - 'nutritionnal_values' => 'nutritionnal values', - 'key_feed' => 'key number for "feed well"', - 'key_earth_1' => 'key number for "respect the earth" 1', - 'key_earth_2' => 'key number for "respect the earth" 2', - 'key_together_1' => 'key number for "live together" 1', - 'key_together_2' => 'key number for "live together" 2', - 'key_together_3' => 'key number for "live together" 3', - 'key_together_4' => 'key number for "live together" 4', - 'key_territory' => 'key number for "integrate its territory"', - 'video_url' => 'URL of the video', - 'job' => 'job', - 'statut' => 'statut', + 'event' => 'event', + 'model' => 'target element', + 'order' => 'order', + 'publication' => 'publication', + 'activated' => 'activated', + 'target' => 'target', + 'static_page_type' => 'static page type', + 'seo' => 'SEO', + 'seo_title' => 'SEO title', + 'seo_description' => 'SEO description', + 'description' => 'description', + 'subtitle' => 'subtitle', + 'tagline' => 'tagline', + 'attribute_alt' => 'alt attribute', + 'attribute_title' => 'title attribute', + 'picture_productsheet' => 'productsheet picture', + 'picture_thumbnail' => 'thumbnail', + 'category' => 'category', + 'publish_at' => 'publication date', + 'unpublish_at' => 'end of publication date', + 'background' => 'background', + 'picture' => 'picture', + 'picture_1' => 'picture one', + 'picture_2' => 'picture two', + 'picture_3' => 'picture three', + 'presentation_title' => 'presentation title', + 'title_part1' => 'title part one', + 'title_part2' => 'title part two', + 'title_part3' => 'title part three', + 'category' => 'category', + 'publish_at' => 'publication date', + 'unpublish_at' => 'end of publication date', + 'picture_ambiance' => 'ambiance picture', + 'picture_packshot' => 'packshot picture', + 'cooking_advice' => 'cooking advice', + 'ingredients' => 'ingredients', + 'nutritionnal_values' => 'nutritionnal values', + 'key_feed' => 'key number for "feed well"', + 'key_earth_1' => 'key number for "respect the earth" 1', + 'key_earth_2' => 'key number for "respect the earth" 2', + 'key_together_1' => 'key number for "live together" 1', + 'key_together_2' => 'key number for "live together" 2', + 'key_together_3' => 'key number for "live together" 3', + 'key_together_4' => 'key number for "live together" 4', + 'key_territory' => 'key number for "integrate its territory"', + 'video_url' => 'URL of the video', + 'job' => 'job', + 'statut' => 'statut', + 'society' => 'society', + 'civility' => 'civility', + 'object' => 'object', + 'product_name' => 'product name', + 'product_date_consumption' => 'product date consumption', + 'product_date_limit' => 'product date limit', + 'product_barcode' => 'product barcode', + 'product_lot' => 'product lot', + 'product_location' => 'product location', + 'accept_rules' => 'acceptation of rules', + 'send_data' => 'autorization to send data', + 'file' => 'file', ], ]; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 3aebdb6..3815d1b 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -223,53 +223,65 @@ return [ 'female' => 'de la ', 'vowel' => 'de l\'' ], - 'event' => 'évènement', - 'model' => 'élément ciblé', - 'order' => 'ordre', - 'publication' => 'publication', - 'activated' => 'activé', - 'target' => 'cible', - 'static_page_type' => 'type de page', - 'seo' => 'référencement SEO', - 'seo_title' => 'titre SEO', - 'seo_description' => 'description SEO', - 'description' => 'description', - 'subtitle' => 'sous-titre', - 'tagline' => 'phrase d\'accroche', - 'attribute_alt' => 'attribut alt', - 'attribute_title' => 'attribut title', - 'picture_productsheet' => 'image de la fiche produit', - 'picture_thumbnail' => 'vignette', - 'category' => 'catégorie', - 'publish_at' => 'date de publication', - 'unpublish_at' => 'date de fin de publication', - 'background' => 'fond', - 'picture' => 'image', - 'picture_1' => 'image une', - 'picture_2' => 'image deux', - 'picture_3' => 'image trois', - 'presentation_title' => 'titre de présentation', - 'title_part1' => 'première partie du titre', - 'title_part2' => 'seconde partie du titre', - 'title_part3' => 'dernière partie du titre', - 'category' => 'catégorie', - 'publish_at' => 'date de publication', - 'unpublish_at' => 'date de fin de publication', - 'picture_ambiance' => 'image d\'ambiance', - 'picture_packshot' => 'image du packshot', - 'cooking_advice' => 'conseil de réchauffage', - 'ingredients' => 'ingrédients', - 'nutritionnal_values' => 'valeurs nutritionnelles', - 'key_feed' => 'chiffre clé "bien nourrir"', - 'key_earth_1' => 'Chiffre clé "respecter la terre" 1', - 'key_earth_2' => 'Chiffre clé "respecter la terre" 2', - 'key_together_1' => 'Chiffre clé "vivre ensemble" 1', - 'key_together_2' => 'Chiffre clé "vivre ensemble" 2', - 'key_together_3' => 'Chiffre clé "vivre ensemble" 3', - 'key_together_4' => 'Chiffre clé "vivre ensemble" 4', - 'key_territory' => 'Chiffre clé "intégrer son territoire"', - 'video_url' => 'URL de la vidéo', - 'job' => 'métier', - 'statut' => 'statut', + 'event' => 'évènement', + 'model' => 'élément ciblé', + 'order' => 'ordre', + 'publication' => 'publication', + 'activated' => 'activé', + 'target' => 'cible', + 'static_page_type' => 'type de page', + 'seo' => 'référencement SEO', + 'seo_title' => 'titre SEO', + 'seo_description' => 'description SEO', + 'description' => 'description', + 'subtitle' => 'sous-titre', + 'tagline' => 'phrase d\'accroche', + 'attribute_alt' => 'attribut alt', + 'attribute_title' => 'attribut title', + 'picture_productsheet' => 'image de la fiche produit', + 'picture_thumbnail' => 'vignette', + 'category' => 'catégorie', + 'publish_at' => 'date de publication', + 'unpublish_at' => 'date de fin de publication', + 'background' => 'fond', + 'picture' => 'image', + 'picture_1' => 'image une', + 'picture_2' => 'image deux', + 'picture_3' => 'image trois', + 'presentation_title' => 'titre de présentation', + 'title_part1' => 'première partie du titre', + 'title_part2' => 'seconde partie du titre', + 'title_part3' => 'dernière partie du titre', + 'category' => 'catégorie', + 'publish_at' => 'date de publication', + 'unpublish_at' => 'date de fin de publication', + 'picture_ambiance' => 'image d\'ambiance', + 'picture_packshot' => 'image du packshot', + 'cooking_advice' => 'conseil de réchauffage', + 'ingredients' => 'ingrédients', + 'nutritionnal_values' => 'valeurs nutritionnelles', + 'key_feed' => 'chiffre clé "bien nourrir"', + 'key_earth_1' => 'Chiffre clé "respecter la terre" 1', + 'key_earth_2' => 'Chiffre clé "respecter la terre" 2', + 'key_together_1' => 'Chiffre clé "vivre ensemble" 1', + 'key_together_2' => 'Chiffre clé "vivre ensemble" 2', + 'key_together_3' => 'Chiffre clé "vivre ensemble" 3', + 'key_together_4' => 'Chiffre clé "vivre ensemble" 4', + 'key_territory' => 'Chiffre clé "intégrer son territoire"', + 'video_url' => 'URL de la vidéo', + 'job' => 'métier', + 'statut' => 'statut', + 'society' => 'société', + 'civility' => 'civilité', + 'object' => 'objet', + 'product_name' => 'nom du produit', + 'product_date_consumption' => 'date de consommation', + 'product_date_limit' => 'date de limite de consommation', + 'product_barcode' => 'le code barre du produit', + 'product_lot' => 'numéro du lot figurant à côté de la date', + 'product_location' => 'le lieu de l\'achat', + 'accept_rules' => 'acceptation des règles', + 'send_data' => 'autorisation d\'enregistrer des données', + 'file' => 'fichier', ], ]; diff --git a/resources/sass/fo/base/_common.scss b/resources/sass/fo/base/_common.scss index 274fe08..9700a58 100644 --- a/resources/sass/fo/base/_common.scss +++ b/resources/sass/fo/base/_common.scss @@ -12,3 +12,15 @@ img { background-repeat: no-repeat; background-size: 100% 100%; } + +.divide { + height: 4px; + background-image: url('@/images/homepage/h-bar.svg'); + background-position: center bottom; + background-repeat: no-repeat; + background-size: 100% .2rem; +} + +.highlight.black { + @include button-shape(#000000); +} diff --git a/resources/sass/fo/fo.scss b/resources/sass/fo/fo.scss index 8b5ea9f..7b62dcc 100644 --- a/resources/sass/fo/fo.scss +++ b/resources/sass/fo/fo.scss @@ -17,3 +17,4 @@ // * PAGES. @import './pages/homepage'; +@import './pages/contact'; diff --git a/resources/sass/fo/pages/_contact.scss b/resources/sass/fo/pages/_contact.scss new file mode 100644 index 0000000..af3ef6c --- /dev/null +++ b/resources/sass/fo/pages/_contact.scss @@ -0,0 +1,32 @@ +.contact { + .select-form { + &::after { + position: absolute; + right: 1rem; + bottom: 0.3rem; + display: block; + width: 2rem; + height: 2rem; + background: url("@/images/global/btn-arrow.png"); + background-position: center; + background-repeat: no-repeat; + background-size: 100% 100%; + content: ""; + pointer-events: none; + transform: rotate(180deg); + transition: 0.1s ease-in-out; + } + + &.active::after { + transform: rotate(270deg); + } + } + + &-products-input { + display: none; + + &.active { + display: flex; + } + } +} diff --git a/resources/sass/fo/pages/_homepage.scss b/resources/sass/fo/pages/_homepage.scss index bb16a8a..a87a235 100644 --- a/resources/sass/fo/pages/_homepage.scss +++ b/resources/sass/fo/pages/_homepage.scss @@ -15,14 +15,6 @@ .f-rufina { font-size: 1.2rem; } - - .divide { - height: 4px; - background-image: url('@/images/homepage/h-bar.svg'); - background-position: center bottom; - background-repeat: no-repeat; - background-size: 100% .2rem; - } } .seasonal-sections { diff --git a/resources/ts/fo/fo.ts b/resources/ts/fo/fo.ts index f35fa50..393a71e 100644 --- a/resources/ts/fo/fo.ts +++ b/resources/ts/fo/fo.ts @@ -10,6 +10,9 @@ import "./utilities/vue-fo"; // CUSTOM import "./base/common"; +// PAGES +import "./pages/contact"; + // COOKIES import CookieNotice from "@ldc-web/cookie-notice"; window.CookieNotice = CookieNotice; diff --git a/resources/ts/fo/pages/contact.ts b/resources/ts/fo/pages/contact.ts new file mode 100644 index 0000000..3341a45 --- /dev/null +++ b/resources/ts/fo/pages/contact.ts @@ -0,0 +1,35 @@ +document.addEventListener("DOMContentLoaded", function () { + // Select after animation + const selects = document.querySelectorAll(".contact .select-form") as NodeListOf; + + document.body.addEventListener("click", function (event) { + const target = event.target as Node | null; + selects.forEach(select => { + if(select.contains(target)){ + selectToggleArrowClass(select); + } else { + selectRemoveArrowClass(select); + } + }); + }); + + function selectToggleArrowClass(select: HTMLFieldSetElement) { + select.classList.toggle("active"); + } + + function selectRemoveArrowClass(select: HTMLFieldSetElement) { + select.classList.remove("active"); + } + + // Show more input on specific option selected + const selectObject = document.getElementsByName("object")[0] as unknown as HTMLSelectElement; + selectObject.addEventListener("click", function () { + const contactProductsInput = document.querySelector(".contact-products-input") as HTMLDivElement; + if (Number(selectObject.value) === 1) { + contactProductsInput.classList.add("active"); + } + else { + contactProductsInput.classList.remove("active"); + } + }); +}); diff --git a/resources/views/emails/send-contact-form.blade.php b/resources/views/emails/send-contact-form.blade.php new file mode 100644 index 0000000..2129c33 --- /dev/null +++ b/resources/views/emails/send-contact-form.blade.php @@ -0,0 +1,28 @@ +@component('mail::message') + # Bonjour, + + Voici un message depuis le formulaire de contact du site web {{ config('app.name') }} : + + Information sur l'utilisateur: + {{ __('validation.custom.civility') }}: {{ $civility }} + {{ __('validation.attributes.first_name') }}: {{ $first_name }} + {{ __('validation.attributes.last_name') }}: {{ $last_name }} + {{ __('validation.custom.society') }}: {{ $society }} + {{ __('validation.attributes.email') }}: {{ $email }} + {{ __('validation.attributes.password') }}: {{ $phone }} + {{ __('validation.attributes.address') }}: {{ $address }} + {{ __('validation.attributes.postal_code') }}: {{ $postal_code }} + {{ __('validation.attributes.city') }}: {{ $city }} + {{ __('validation.custom.object') }}: {{ $object }} + {{ __('validation.attributes.message') }}: {{ $message }} + + Information sur le produit: + {{ __('validation.custom.product_name') }}: {{ $product_name }} + {{ __('validation.custom.product_date_limit') }}: {{ $product_date_limit }} + {{ __('validation.custom.product_barcode') }}: {{ $product_barcode }} + {{ __('validation.custom.product_lot') }}: {{ $product_lot }} + {{ __('validation.custom.product_date_consumption') }}: {{ $product_date_consumption }} + {{ __('validation.custom.product_location') }}: {{ $product_location }} + + {{ config('app.name') }}. +@endcomponent diff --git a/resources/views/fo/layout.blade.php b/resources/views/fo/layout.blade.php index 2cba7fe..1db9e1b 100644 --- a/resources/views/fo/layout.blade.php +++ b/resources/views/fo/layout.blade.php @@ -8,8 +8,8 @@ @include('fo.layouts.header')
-
-
+
+
@include('modules.flash-messages')
diff --git a/resources/views/fo/layouts/footer.blade.php b/resources/views/fo/layouts/footer.blade.php index efe27c3..798b3b6 100644 --- a/resources/views/fo/layouts/footer.blade.php +++ b/resources/views/fo/layouts/footer.blade.php @@ -83,8 +83,8 @@ diff --git a/resources/views/fo/layouts/nav-list.blade.php b/resources/views/fo/layouts/nav-list.blade.php index 299837d..8c5b02d 100644 --- a/resources/views/fo/layouts/nav-list.blade.php +++ b/resources/views/fo/layouts/nav-list.blade.php @@ -25,7 +25,7 @@ {{ __('Rejoignez-nous') }} + href="{{ route('fo.contact.show') }}" title="{{ __('Contact') }}"> {{ __('Contact') }} diff --git a/resources/views/fo/layouts/nav-menu.blade.php b/resources/views/fo/layouts/nav-menu.blade.php deleted file mode 100644 index 56bf824..0000000 --- a/resources/views/fo/layouts/nav-menu.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -@auth('backend') - -@endauth diff --git a/resources/views/fo/pages/contact.blade.php b/resources/views/fo/pages/contact.blade.php new file mode 100644 index 0000000..0c82681 --- /dev/null +++ b/resources/views/fo/pages/contact.blade.php @@ -0,0 +1,225 @@ +@extends('fo.layout') + +@section('title', $contactModel->seo_title ?? __('Contact')) +@section('description', $contactModel->seo_description ?? __('Contactez-nous !')) +@section('breadcrumb', + request()->route()->getName()) + +@section('content') +
+
+
+
+ +

{{ $contactModel->title }}

+ +
+
+

{{ __('siège social agis') }}

+

{{ __('802 rue sainte-geneviève') }}

+

{{ __('84000 avignon') }}

+

{{ __('t. +33 (0)1 4 90 80 99') }}

+
+
+
+
+ @method('POST') + @csrf +
+
+
+

+ {{ __('Formulaire de contact') }}

+
+
+
+
+ +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+
+

+ {{ Str::of(__('pour pouvoir vous répondre nous avons besoin de quelques informations :'))->ucFirst()->value() }} +

+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ + {{ Str::of(__('formats acceptés : jpg, png'))->ucFirst()->value() }} +
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+

{{ __('*Champ obligatoire') }}

+
+
+ +
+
+
+ +
+
+
+@endsection diff --git a/resources/views/fo/pages/home.blade.php b/resources/views/fo/pages/home.blade.php index 1c01233..3755e3c 100644 --- a/resources/views/fo/pages/home.blade.php +++ b/resources/views/fo/pages/home.blade.php @@ -109,11 +109,11 @@
- {{ __('flèche vers la gauche') }}
- {{ __('flèche vers la droite') }}
@@ -155,11 +155,11 @@ diff --git a/resources/views/vendor/errors/403.blade.php b/resources/views/vendor/errors/403.blade.php index 959d814..95e2fe9 100644 --- a/resources/views/vendor/errors/403.blade.php +++ b/resources/views/vendor/errors/403.blade.php @@ -8,5 +8,5 @@ @section('button', true) @section('image') - + @endsection diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php index 8d17628..7833571 100644 --- a/resources/views/vendor/mail/html/header.blade.php +++ b/resources/views/vendor/mail/html/header.blade.php @@ -4,9 +4,7 @@ @if (trim($slot) === 'Laravel') @else - {{-- FIXME: Personaliser ca --}} - - {{ $slot }} + @endif diff --git a/routes/web-fo.php b/routes/web-fo.php index 744c805..b7a5e23 100644 --- a/routes/web-fo.php +++ b/routes/web-fo.php @@ -9,6 +9,8 @@ Route::middleware(['throttle:credentials']) Route::get('/', [StaticPageController::class, 'homepage'])->name('homepage'); Route::view('/bs-demo', 'fo.pages.bs-demo')->name('bs-demo'); + Route::get('/contact', [StaticPageController::class, 'contact'])->name('contact.show'); + Route::post('/contact-form', [StaticPageController::class, 'contactForm'])->name('contact.store'); Route::get('/mentions-legales', [StaticPageController::class, 'legals'])->name('legals.show'); Route::get('/charte-de-confidentialite', [StaticPageController::class, 'policies'])->name('policies.show'); });