From 54e501cd03e023a3ff10e419dc3d1e32d72be3ea Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Mon, 22 Jan 2024 09:56:19 +0000 Subject: [PATCH] In contact form, dates are now dates inpiuts instead of string --- app/Http/Requests/Fo/ContactRequest.php | 4 ++-- resources/views/emails/send-contact-form.blade.php | 4 ++-- resources/views/fo/pages/contact.blade.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Requests/Fo/ContactRequest.php b/app/Http/Requests/Fo/ContactRequest.php index 32b9375..5671d5d 100644 --- a/app/Http/Requests/Fo/ContactRequest.php +++ b/app/Http/Requests/Fo/ContactRequest.php @@ -69,7 +69,7 @@ class ContactRequest extends FormRequest } ], 'product_date_limit' => [ - 'string', 'between:3,255', 'required', + 'required', 'date', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed function ($attribute, $value, $fail) { if ($this->get("object") != ObjectEnum::customerService->value()) { @@ -108,7 +108,7 @@ class ContactRequest extends FormRequest } ], 'product_date_consumption' => [ - 'string', 'between:3,255', 'required', + 'required', 'date', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed function ($attribute, $value, $fail) { if ($this->get("object") != ObjectEnum::customerService->value()) { diff --git a/resources/views/emails/send-contact-form.blade.php b/resources/views/emails/send-contact-form.blade.php index 20bdc59..08060ef 100644 --- a/resources/views/emails/send-contact-form.blade.php +++ b/resources/views/emails/send-contact-form.blade.php @@ -28,10 +28,10 @@ ### Information sur le produit: @component('mail::panel') - **{{ __('validation.custom.product_name') }}:** {{ $data->product_name ?? '' }} -- **{{ __('validation.custom.product_date_limit') }}:** {{ $data->product_date_limit ?? '' }} +- **{{ __('validation.custom.product_date_limit') }}:** {{ \Carbon\Carbon::make($data->product_date_limit)->format('d/m/Y') ?? '' }} - **{{ __('validation.custom.product_barcode') }}:** {{ $data->product_barcode ?? '' }} - **{{ __('validation.custom.product_lot') }}:** {{ $data->product_lot ?? '' }} -- **{{ __('validation.custom.product_date_consumption') }}:** {{ $data->product_date_consumption ?? '' }} +- **{{ __('validation.custom.product_date_consumption') }}:** {{ \Carbon\Carbon::make($data->product_date_consumption)->format('d/m/Y') ?? '' }} - **{{ __('validation.custom.product_location') }}:** {{ $data->product_location ?? '' }} @endcomponent @endif diff --git a/resources/views/fo/pages/contact.blade.php b/resources/views/fo/pages/contact.blade.php index 283d892..938f2a7 100644 --- a/resources/views/fo/pages/contact.blade.php +++ b/resources/views/fo/pages/contact.blade.php @@ -128,7 +128,7 @@ {{ Str::of(__('validation.custom.product_date_limit'))->ucFirst()->value() }}* : {{ __('Ex : 25/08/2028') }} - @@ -158,7 +158,7 @@ {{ __('Ex : 25/08/2028') }} + type="date" value="{{ old('product_date_consumption') }}">