generated from boboko/starter
temp emails, reviews theming and form, minor change in checkout module, validation translations seeder
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
@props(['review'])
|
||||
|
||||
<article class="flex flex-col gap-3 py-6 border-b border-black last:border-0">
|
||||
<article class="flex flex-col gap-3 py-6">
|
||||
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div class="flex items-center gap-4">
|
||||
<x-reviews-stars :rating="$review['rating']" :size="18" />
|
||||
<span class="font-bold">
|
||||
{{ $review['name'] ?? 'Ανώνυμος' }}
|
||||
</span>
|
||||
</div>
|
||||
<time class="text-sm text-neutral-500 shrink-0">{{ $review['date'] }}</time>
|
||||
<x-reviews-stars :rating="$review['rating']" :size="23" />
|
||||
|
||||
<div class="flex items-end gap-4">
|
||||
<span class="text-2xl font-bold leading-none">
|
||||
{{ $review['name'] ?? 'Ανώνυμος' }}
|
||||
</span>
|
||||
<time class="text-sm text-neutral-500 shrink-0 leading-none pb-0.5">{{ $review['date'] }}</time>
|
||||
</div>
|
||||
|
||||
<p class="leading-relaxed">{{ $review['text'] }}</p>
|
||||
@@ -24,4 +23,16 @@ class="w-24 h-24 object-cover border border-black"
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (!empty($review['reply']))
|
||||
<div class="mt-2 pl-4 border-l-2 border-neutral-300 flex flex-col gap-1">
|
||||
<p class="text-sm font-bold">
|
||||
{{ __('storefront.review.reply') }}
|
||||
@if (!empty($review['replyDate']))
|
||||
<span class="font-normal text-neutral-500">— {{ $review['replyDate'] }}</span>
|
||||
@endif
|
||||
</p>
|
||||
<p class="leading-relaxed">{{ $review['reply'] }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</article>
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
@props(['product'])
|
||||
|
||||
@php $oldRating = (int) old('rating', 0); @endphp
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
action="#"
|
||||
action="{{ route('product.reviews.store', ['locale' => app()->getLocale(), 'product' => $product['id']]) }}"
|
||||
class="flex flex-col gap-8 mt-10"
|
||||
data-controller="star-rating"
|
||||
data-star-rating-rating-value="{{ $oldRating }}"
|
||||
data-action="submit->star-rating#validate"
|
||||
>
|
||||
@csrf
|
||||
|
||||
{{-- Rating --}}
|
||||
<x-ui.field :label="__('storefront.review.rating')" for="rating" :required="true">
|
||||
<x-ui.field :label="__('storefront.review.rating')" for="rating" :required="true" :error="$errors->first('rating')">
|
||||
<div
|
||||
id="rating"
|
||||
data-controller="star-rating"
|
||||
class="flex items-center gap-1.5 text-brand"
|
||||
role="radiogroup"
|
||||
aria-label="{{ __('storefront.review.rating') }}"
|
||||
aria-required="true"
|
||||
aria-describedby="rating-client-error"
|
||||
>
|
||||
<input type="hidden" name="rating" value="0" data-star-rating-target="input">
|
||||
<input type="hidden" name="rating" value="{{ $oldRating }}" data-star-rating-target="input">
|
||||
@for($i = 1; $i <= 5; $i++)
|
||||
<button
|
||||
type="button"
|
||||
@@ -25,7 +30,7 @@ class="flex items-center gap-1.5 text-brand"
|
||||
data-value="{{ $i }}"
|
||||
data-action="click->star-rating#select mouseenter->star-rating#hover mouseleave->star-rating#leave"
|
||||
aria-label="{{ trans_choice('storefront.review.stars_count', $i, ['count' => $i]) }}"
|
||||
aria-pressed="false"
|
||||
aria-pressed="{{ $i === $oldRating ? 'true' : 'false' }}"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -41,24 +46,21 @@ class="w-6 h-6"
|
||||
</button>
|
||||
@endfor
|
||||
</div>
|
||||
<p id="rating-client-error" data-star-rating-target="error" class="text-sm text-red-600" role="alert" hidden>{{ __('storefront.review.rating_required') }}</p>
|
||||
</x-ui.field>
|
||||
|
||||
<x-ui.field :label="__('storefront.review.write_label')" for="review-content" :required="true">
|
||||
<x-ui.textarea id="review-content" name="content" :required="true" />
|
||||
<x-ui.field :label="__('storefront.review.write_label')" for="review-content" :required="true" :error="$errors->first('content')">
|
||||
<x-ui.textarea id="review-content" name="content" :required="true" :rows="6">{{ old('content') }}</x-ui.textarea>
|
||||
</x-ui.field>
|
||||
|
||||
<x-ui.field :label="__('storefront.review.name')" for="review-name" :labelDescription="__('storefront.review.name_optional')">
|
||||
<x-ui.input id="review-name" name="name" autocomplete="name" />
|
||||
<x-ui.field :label="__('storefront.review.name')" for="review-name" :labelDescription="__('storefront.review.name_optional')" :error="$errors->first('name')">
|
||||
<x-ui.input id="review-name" name="name" autocomplete="name" :value="old('name')" />
|
||||
</x-ui.field>
|
||||
|
||||
<x-ui.field :label="__('storefront.review.email')" for="review-email" :required="true" :labelDescription="__('storefront.review.email_not_published')">
|
||||
<x-ui.input id="review-email" name="email" type="email" :required="true" autocomplete="email" />
|
||||
<x-ui.field :label="__('storefront.review.email')" for="review-email" :required="true" :labelDescription="__('storefront.review.email_not_published')" :error="$errors->first('email')">
|
||||
<x-ui.input id="review-email" name="email" type="email" :required="true" autocomplete="email" :value="old('email')" />
|
||||
</x-ui.field>
|
||||
|
||||
<x-ui.checkbox id="review-save-info" name="save_info" >
|
||||
<span class="text-sm">{{ __('storefront.review.save_info') }}</span>
|
||||
</x-ui.checkbox>
|
||||
|
||||
<div>
|
||||
<x-ui.button type="submit">{{ __('storefront.review.submit') }}</x-ui.button>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
'count' => 0,
|
||||
'showCount' => false,
|
||||
'size' => 24,
|
||||
'linkable' => false,
|
||||
])
|
||||
|
||||
<div class="flex items-center gap-3" {{ $attributes }}>
|
||||
@@ -28,9 +29,17 @@ class="flex items-center gap-1.5 text-brand"
|
||||
</div>
|
||||
|
||||
@if ($showCount && $count > 0)
|
||||
<span class="text-sm text-neutral-500">
|
||||
({{ trans_choice('storefront.customer_reviews', $count, ['count' => $count]) }})
|
||||
</span>
|
||||
@php $countText = '(' . trans_choice('storefront.customer_reviews', $count, ['count' => $count]) . ')'; @endphp
|
||||
@if ($linkable)
|
||||
<button
|
||||
type="button"
|
||||
data-action="click->review-count#activate"
|
||||
class="text-sm text-neutral-500 hover:underline cursor-pointer"
|
||||
aria-controls="tab-panel-reviews"
|
||||
>{{ $countText }}</button>
|
||||
@else
|
||||
<span class="text-sm text-neutral-500">{{ $countText }}</span>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@props(['tabs' => [], 'size' => 'md'])
|
||||
@props(['tabs' => [], 'size' => 'md', 'active' => null])
|
||||
@php
|
||||
$sizeClasses = match($size) {
|
||||
'lg' => 'text-[36px] font-extrabold [--slide-h:5px]',
|
||||
default => 'text-xl font-bold [--slide-h:3px]',
|
||||
};
|
||||
$activeId = $active ?? ($tabs[0]['id'] ?? null);
|
||||
@endphp
|
||||
|
||||
{{--
|
||||
@@ -21,22 +22,22 @@
|
||||
|
||||
<div data-controller="tabs" {{ $attributes }}>
|
||||
<div class="flex gap-10 mb-8" role="tablist">
|
||||
@foreach($tabs as $i => $tab)
|
||||
@foreach($tabs as $tab)
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
data-tabs-target="button"
|
||||
data-action="click->tabs#show"
|
||||
data-panel="{{ $tab['id'] }}"
|
||||
class="underline-slide font-display pb-1 {{ $sizeClasses }} {{ $i === 0 ? 'is-active' : '' }}"
|
||||
aria-selected="{{ $i === 0 ? 'true' : 'false' }}"
|
||||
class="underline-slide font-display pb-1 {{ $sizeClasses }} {{ $tab['id'] === $activeId ? 'is-active' : '' }}"
|
||||
aria-selected="{{ $tab['id'] === $activeId ? 'true' : 'false' }}"
|
||||
aria-controls="tab-panel-{{ $tab['id'] }}"
|
||||
id="tab-btn-{{ $tab['id'] }}"
|
||||
>{{ $tab['label'] }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@foreach($tabs as $i => $tab)
|
||||
@foreach($tabs as $tab)
|
||||
@php $panelKey = $tab['id']; $panel = $$panelKey ?? null; @endphp
|
||||
<div
|
||||
role="tabpanel"
|
||||
@@ -44,7 +45,7 @@ class="underline-slide font-display pb-1 {{ $sizeClasses }} {{ $i === 0 ? 'is-ac
|
||||
id="tab-panel-{{ $tab['id'] }}"
|
||||
aria-labelledby="tab-btn-{{ $tab['id'] }}"
|
||||
tabindex="0"
|
||||
@if($i !== 0) hidden @endif
|
||||
@if($tab['id'] !== $activeId) hidden @endif
|
||||
>{{ $panel }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user