From e2d7bbb04301de7b7451132abc5cf2d481861f2f Mon Sep 17 00:00:00 2001 From: elvira Date: Fri, 25 Sep 2026 17:44:42 +0300 Subject: [PATCH] order emails theming, sold out product card, contact page hcaptcha --- app/Catalog/ProductCard.php | 6 +- app/Http/Requests/ContactRequest.php | 9 + config/services.php | 2 +- .../views/components/product-grid.blade.php | 1 + .../components/ui/product-card.blade.php | 6 +- .../views/components/ui/sold-badge.blade.php | 8 + resources/views/contact.blade.php | 21 +- resources/views/emails/layout.blade.php | 3 +- .../views/emails/partials/address.blade.php | 15 ++ .../views/emails/partials/button.blade.php | 13 ++ .../emails/partials/section-heading.blade.php | 2 + resources/views/home.blade.php | 12 +- .../order/notifications/captured.blade.php | 27 ++- .../order/notifications/completed.blade.php | 27 ++- .../order/notifications/delivered.blade.php | 27 ++- .../order/notifications/dispatched.blade.php | 27 ++- .../notifications/pickup-ready.blade.php | 27 ++- .../core/order/notifications/placed.blade.php | 188 ++++++++++++++++-- .../order/notifications/refunded.blade.php | 27 ++- .../notifications/status-updated.blade.php | 35 +++- resources/views/wishlist/list.blade.php | 1 + 21 files changed, 445 insertions(+), 39 deletions(-) create mode 100644 resources/views/components/ui/sold-badge.blade.php create mode 100644 resources/views/emails/partials/address.blade.php create mode 100644 resources/views/emails/partials/button.blade.php create mode 100644 resources/views/emails/partials/section-heading.blade.php diff --git a/app/Catalog/ProductCard.php b/app/Catalog/ProductCard.php index d5a5189..7c2c053 100644 --- a/app/Catalog/ProductCard.php +++ b/app/Catalog/ProductCard.php @@ -19,7 +19,7 @@ final class ProductCard { /** * @param array $product one item from ProductService's localized array shape - * @return array{name: ?string, price: ?string, image: ?string, href: string, variantId: ?int, hasCustomFields: bool} + * @return array{name: ?string, price: ?string, image: ?string, href: string, variantId: ?int, hasCustomFields: bool, soldOut: bool} */ public static function fromIndexed(array $product): array { @@ -38,6 +38,10 @@ public static function fromIndexed(array $product): array // can't be quick-added from a card — the card links to the // product page instead, even when every field is optional. 'hasCustomFields' => ! empty($product['custom_fields']), + // Index-time stock (see boboko-core's ProductIndexer `in_stock`), + // so only as fresh as the last reindex. A document missing the + // field is treated as in stock rather than hiding its cart button. + 'soldOut' => ! ($product['in_stock'] ?? true), ]; } } diff --git a/app/Http/Requests/ContactRequest.php b/app/Http/Requests/ContactRequest.php index f79c293..80cb496 100644 --- a/app/Http/Requests/ContactRequest.php +++ b/app/Http/Requests/ContactRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Requests; +use App\Rules\HCaptcha; use Illuminate\Foundation\Http\FormRequest; class ContactRequest extends FormRequest @@ -17,6 +18,14 @@ public function rules(): array 'name' => ['required', 'string', 'max:100'], 'email' => ['required', 'email', 'max:255'], 'message' => ['required', 'string', 'max:5000'], + 'h-captcha-response' => ['bail', 'required', new HCaptcha], + ]; + } + + public function messages(): array + { + return [ + 'h-captcha-response.required' => __('storefront.auth.captcha_failed'), ]; } } diff --git a/config/services.php b/config/services.php index dc5f182..f5d90d3 100644 --- a/config/services.php +++ b/config/services.php @@ -40,7 +40,7 @@ 'email' => env('CONTACT_EMAIL'), ], - // Bot check on guest forms (login), verified by App\Rules\HCaptcha. For + // Bot check on guest forms (login, contact), verified by App\Rules\HCaptcha. For // local dev use hCaptcha's test keys, the real ones reject localhost: // sitekey 10000000-ffff-ffff-ffff-000000000001, // secret 0x0000000000000000000000000000000000000000. diff --git a/resources/views/components/product-grid.blade.php b/resources/views/components/product-grid.blade.php index 0055cea..cae26fe 100644 --- a/resources/views/components/product-grid.blade.php +++ b/resources/views/components/product-grid.blade.php @@ -26,6 +26,7 @@ :href="$product['href'] ?? '#'" :variant-id="$product['variantId'] ?? null" :has-custom-fields="$product['hasCustomFields'] ?? false" + :sold-out="$product['soldOut'] ?? false" /> @endforeach diff --git a/resources/views/components/ui/product-card.blade.php b/resources/views/components/ui/product-card.blade.php index beda473..2e164a4 100644 --- a/resources/views/components/ui/product-card.blade.php +++ b/resources/views/components/ui/product-card.blade.php @@ -5,6 +5,8 @@ 'href' => '#', 'variantId' => null, 'hasCustomFields' => false, + // Shows the "sold" star and drops the quick add-to-cart/personalize button. + 'soldOut' => false, // Heart toggle at the top right of the image; needs productId. 'productId' => null, 'wishlist' => false, @@ -36,7 +38,9 @@ class="w-full h-auto block" @endif - @if ($hasCustomFields) + @if ($soldOut) + + @elseif ($hasCustomFields) {{-- Custom fields have to be filled in on the product page. --}} class('z-10 flex h-20 w-22 items-center justify-center text-black') }}> + + {{ __('storefront.product.sold') }} + diff --git a/resources/views/contact.blade.php b/resources/views/contact.blade.php index bfc14da..17d04df 100644 --- a/resources/views/contact.blade.php +++ b/resources/views/contact.blade.php @@ -3,6 +3,11 @@ @section('title', __('storefront.nav.contact')) @section('description', 'Επικοινώνησε μαζί μας για οποιαδήποτε απορία ή ιδέα έχεις και θα σου απαντήσουμε το συντομότερο δυνατό.') +{{-- Only on pages with a captcha, not in the global layout. --}} +@push('scripts') + +@endpush + @section('content')
@@ -30,25 +35,35 @@ @csrf
- + - +
- + {{ old('message') }} + {{-- hCaptcha checkbox, verified by App\Rules\HCaptcha (see auth/login). --}} + +
has('h-captcha-response')) aria-describedby="contact-captcha-error" @endif + >
+
+ @if (session('contact_error')) @endif diff --git a/resources/views/emails/layout.blade.php b/resources/views/emails/layout.blade.php index 2e10913..670d1b0 100644 --- a/resources/views/emails/layout.blade.php +++ b/resources/views/emails/layout.blade.php @@ -45,6 +45,7 @@ @media only screen and (max-width: 480px) { .email-container { width: 100% !important; max-width: 100% !important; } .email-header { padding: 24px 20px 12px !important; } + .email-gutter { padding: 0 !important; } .email-card { padding: 28px 20px !important; } .email-footer { padding: 0 20px 32px !important; } } @@ -69,7 +70,7 @@ - +