@revenexx/cover 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/account/address/AccountAddressView.vue +433 -0
- package/app/components/account/dashboard/AccountDashboard.vue +10 -330
- package/app/components/account/dashboard/AccountDashboardBudgets.vue +71 -0
- package/app/components/account/dashboard/AccountDashboardGreeting.vue +17 -0
- package/app/components/account/dashboard/AccountDashboardKpis.vue +71 -0
- package/app/components/account/dashboard/AccountDashboardQuickActions.vue +36 -0
- package/app/components/account/dashboard/AccountDashboardRecentOrders.vue +70 -0
- package/app/components/account/dashboard/AccountDashboardRequisitions.vue +60 -0
- package/app/components/account/profile/AccountPasswordForm.vue +155 -0
- package/app/components/account/profile/AccountProfileForm.vue +159 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +52 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationHero.vue +41 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationNextSteps.vue +60 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationOrderRecap.vue +102 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationView.vue +30 -265
- package/app/components/listing/ListingActiveFilters.vue +59 -0
- package/app/components/listing/ListingFilterBar.vue +24 -0
- package/app/components/listing/ListingFilterDrawer.vue +72 -0
- package/app/components/listing/ListingFilterRail.vue +23 -0
- package/app/components/listing/ListingResults.vue +88 -0
- package/app/components/listing/ListingToolbar.vue +46 -0
- package/app/components/listing/ListingView.vue +14 -204
- package/app/components/product/detail/ProductDetailIdentity.vue +44 -0
- package/app/components/product/detail/ProductDetailPrice.vue +39 -0
- package/app/components/search/filter/SearchFacets.vue +12 -102
- package/app/components/search/filter/SearchFacetsBar.vue +161 -0
- package/app/composables/useAccountDashboard.ts +112 -0
- package/app/composables/useCategoryListing.ts +92 -0
- package/app/composables/useCheckoutConfirmation.ts +63 -0
- package/app/composables/useFacetFilters.ts +122 -0
- package/app/composables/useSearchListing.ts +71 -0
- package/app/interfaces/checkout.ts +27 -0
- package/i18n/locales/de/editor.json +33 -0
- package/i18n/locales/en/editor.json +33 -0
- package/package.json +1 -1
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
2
|
+
import type { ConfirmationType } from "../../../interfaces/checkout";
|
|
3
|
+
import CheckoutConfirmationActions from "../../../components/checkout/confirmation/CheckoutConfirmationActions.vue";
|
|
4
|
+
import CheckoutConfirmationHero from "../../../components/checkout/confirmation/CheckoutConfirmationHero.vue";
|
|
5
|
+
import CheckoutConfirmationNextSteps from "../../../components/checkout/confirmation/CheckoutConfirmationNextSteps.vue";
|
|
6
|
+
import CheckoutConfirmationOrderRecap from "../../../components/checkout/confirmation/CheckoutConfirmationOrderRecap.vue";
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* The thank-you page after checkout: hero with the order number, the
|
|
7
10
|
* "what happens next" steps, and — for signed-in customers — the full
|
|
8
11
|
* order recap (positions, addresses, payment, total). Covers all three
|
|
9
12
|
* outcomes: plain order, order awaiting approval, requisition.
|
|
13
|
+
*
|
|
14
|
+
* A thin wrapper: the recap data comes from `useCheckoutConfirmation` and
|
|
15
|
+
* each section renders as its own child component.
|
|
10
16
|
*/
|
|
11
|
-
export type ConfirmationType
|
|
17
|
+
export type { ConfirmationType } from "../../../interfaces/checkout";
|
|
12
18
|
|
|
13
19
|
const props = defineProps<{
|
|
14
20
|
recordId: string;
|
|
@@ -16,274 +22,33 @@ const props = defineProps<{
|
|
|
16
22
|
approvers: string[];
|
|
17
23
|
}>();
|
|
18
24
|
|
|
19
|
-
const {
|
|
20
|
-
const { t, tm, rt } = useI18n();
|
|
21
|
-
const localePath = useLocalePath();
|
|
22
|
-
const { to } = useAppUrl();
|
|
23
|
-
const checkout = useCheckoutOnePage();
|
|
24
|
-
const { getImage } = useProductImage();
|
|
25
|
-
const { formatCurrency } = useCartSummaryFormatting();
|
|
26
|
-
// Forwards the auth cookie during SSR — plain $fetch would lose it.
|
|
27
|
-
const requestFetch = useRequestFetch();
|
|
28
|
-
|
|
29
|
-
/* ---- recap data (signed-in customers only; guests get the hero) ------- */
|
|
30
|
-
interface ConfirmationLine {
|
|
31
|
-
id: number;
|
|
32
|
-
name: string;
|
|
33
|
-
image?: string;
|
|
34
|
-
sku: string;
|
|
35
|
-
quantity: number;
|
|
36
|
-
unitPrice: number;
|
|
37
|
-
lineTotal: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface ConfirmationRecap {
|
|
41
|
-
lines: ConfirmationLine[];
|
|
42
|
-
total: number;
|
|
43
|
-
deliveryLines: string[];
|
|
44
|
-
billingLines: string[];
|
|
45
|
-
paymentMethod?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const { data: recap } = await useAsyncData<ConfirmationRecap | null>(
|
|
49
|
-
`checkout-confirmation:${props.recordId}`,
|
|
50
|
-
async () => {
|
|
51
|
-
try {
|
|
52
|
-
if (props.type === "requisition") {
|
|
53
|
-
const requisition = await requestFetch<Requisition>(`/api/account/requisitions/${props.recordId}`);
|
|
54
|
-
const address = requisition.deliveryAddress;
|
|
55
|
-
return {
|
|
56
|
-
lines: requisition.items.map(item => ({
|
|
57
|
-
id: item.id,
|
|
58
|
-
name: item.name,
|
|
59
|
-
...(item.image ? { image: item.image } : {}),
|
|
60
|
-
sku: item.sku,
|
|
61
|
-
quantity: item.quantity,
|
|
62
|
-
unitPrice: item.price,
|
|
63
|
-
lineTotal: Math.round(item.price * item.quantity * 100) / 100,
|
|
64
|
-
})),
|
|
65
|
-
total: requisition.totalValue,
|
|
66
|
-
deliveryLines: address
|
|
67
|
-
? [address.company, address.street, `${address.postalCode} ${address.city}`.trim()].filter(Boolean)
|
|
68
|
-
: [],
|
|
69
|
-
billingLines: [],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const order = await requestFetch<AccountOrder>(`/api/account/orders/${props.recordId}`);
|
|
73
|
-
return {
|
|
74
|
-
lines: order.positions.map(position => ({
|
|
75
|
-
id: position.id,
|
|
76
|
-
name: position.name,
|
|
77
|
-
...(position.image ? { image: position.image } : {}),
|
|
78
|
-
sku: position.sku,
|
|
79
|
-
quantity: position.quantity,
|
|
80
|
-
unitPrice: position.unitPrice,
|
|
81
|
-
lineTotal: position.lineTotal,
|
|
82
|
-
})),
|
|
83
|
-
total: order.total,
|
|
84
|
-
deliveryLines: order.deliveryAddress?.split(" · ") ?? [],
|
|
85
|
-
billingLines: order.billingAddress?.split(" · ") ?? [],
|
|
86
|
-
...(order.paymentMethod ? { paymentMethod: order.paymentMethod } : {}),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
/* ---- next steps -------------------------------------------------------- */
|
|
96
|
-
interface NextStep { title: string; text: string }
|
|
97
|
-
|
|
98
|
-
const nextSteps = computed<NextStep[]>(() =>
|
|
99
|
-
(tm(`confirmation.steps.${props.type}`) as unknown[]).map(step => ({
|
|
100
|
-
title: rt((step as Record<string, never>).title),
|
|
101
|
-
text: rt((step as Record<string, never>).text),
|
|
102
|
-
})));
|
|
103
|
-
|
|
104
|
-
const stepIcons: Record<ConfirmationType, string[]> = {
|
|
105
|
-
order: ["mail", "package", "delivery"],
|
|
106
|
-
approval: ["shield", "package", "delivery"],
|
|
107
|
-
requisition: ["route", "cart", "eye"],
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const detailLink = computed(() =>
|
|
111
|
-
props.type === "requisition"
|
|
112
|
-
? localePath(`/account/requisitions/${props.recordId}`)
|
|
113
|
-
: localePath(`/account/orders/${props.recordId}`));
|
|
114
|
-
|
|
115
|
-
function continueShopping() {
|
|
116
|
-
checkout.reset();
|
|
117
|
-
void navigateTo(to("/"));
|
|
118
|
-
}
|
|
25
|
+
const { recap } = useCheckoutConfirmation(props.recordId, props.type);
|
|
119
26
|
</script>
|
|
120
27
|
|
|
121
28
|
<template>
|
|
122
29
|
<div class="py-12 sm:py-16">
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
tag="p"
|
|
134
|
-
class="mt-3 text-base text-muted"
|
|
135
|
-
>
|
|
136
|
-
<template #id>
|
|
137
|
-
<span class="font-semibold text-highlighted">{{ recordId }}</span>
|
|
138
|
-
</template>
|
|
139
|
-
</i18n-t>
|
|
140
|
-
<p
|
|
141
|
-
v-if="type === 'approval' && approvers.length"
|
|
142
|
-
class="mt-2 text-sm text-warning font-medium"
|
|
143
|
-
>
|
|
144
|
-
{{ t('confirmation.approval.approvers', { names: approvers.join(', ') }) }}
|
|
145
|
-
</p>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<!-- Next steps -->
|
|
149
|
-
<section class="mt-12">
|
|
150
|
-
<h2 class="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
151
|
-
{{ t('confirmation.nextSteps') }}
|
|
152
|
-
</h2>
|
|
153
|
-
<ol class="mt-4 grid grid-cols-1 sm:grid-cols-3 border border-(--ui-border) rounded-xl overflow-hidden">
|
|
154
|
-
<li
|
|
155
|
-
v-for="(step, index) in nextSteps"
|
|
156
|
-
:key="step.title"
|
|
157
|
-
class="relative p-4 sm:p-5 border-(--ui-border)
|
|
158
|
-
max-sm:not-first:border-t sm:not-first:border-l"
|
|
159
|
-
>
|
|
160
|
-
<span class="flex items-center gap-2.5">
|
|
161
|
-
<span
|
|
162
|
-
class="flex size-8 shrink-0 items-center justify-center rounded-full
|
|
163
|
-
bg-primary/10"
|
|
164
|
-
>
|
|
165
|
-
<UIcon
|
|
166
|
-
:name="icon(stepIcons[type][index] ?? 'check')"
|
|
167
|
-
class="size-4 text-primary"
|
|
168
|
-
/>
|
|
169
|
-
</span>
|
|
170
|
-
<span class="text-sm font-semibold text-highlighted">{{ step.title }}</span>
|
|
171
|
-
</span>
|
|
172
|
-
<p class="mt-2.5 text-sm text-muted">
|
|
173
|
-
{{ step.text }}
|
|
174
|
-
</p>
|
|
175
|
-
</li>
|
|
176
|
-
</ol>
|
|
177
|
-
</section>
|
|
30
|
+
<CheckoutConfirmationHero
|
|
31
|
+
:type="type"
|
|
32
|
+
:record-id="recordId"
|
|
33
|
+
:approvers="approvers"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<CheckoutConfirmationNextSteps
|
|
37
|
+
:type="type"
|
|
38
|
+
class="mt-12"
|
|
39
|
+
/>
|
|
178
40
|
|
|
179
|
-
|
|
180
|
-
<section
|
|
41
|
+
<CheckoutConfirmationOrderRecap
|
|
181
42
|
v-if="recap?.lines.length"
|
|
43
|
+
:recap="recap"
|
|
182
44
|
class="mt-12"
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
:key="line.id"
|
|
192
|
-
class="flex items-center gap-4 py-4"
|
|
193
|
-
>
|
|
194
|
-
<span
|
|
195
|
-
class="size-16 shrink-0 flex items-center justify-center rounded-lg
|
|
196
|
-
bg-elevated/60 ring-1 ring-(--ui-border) p-1.5"
|
|
197
|
-
>
|
|
198
|
-
<img
|
|
199
|
-
v-if="line.image"
|
|
200
|
-
:src="getImage(line.image)"
|
|
201
|
-
:alt="line.name"
|
|
202
|
-
class="max-h-full max-w-full object-contain"
|
|
203
|
-
>
|
|
204
|
-
</span>
|
|
205
|
-
<div class="min-w-0 flex-1">
|
|
206
|
-
<p class="text-sm font-medium text-highlighted truncate">
|
|
207
|
-
{{ line.name }}
|
|
208
|
-
</p>
|
|
209
|
-
<p class="text-xs text-muted">
|
|
210
|
-
{{ line.sku }} · {{ line.quantity }}× {{ formatCurrency(line.unitPrice) }}
|
|
211
|
-
</p>
|
|
212
|
-
</div>
|
|
213
|
-
<span class="text-sm tabular-nums text-highlighted shrink-0">
|
|
214
|
-
{{ formatCurrency(line.lineTotal) }}
|
|
215
|
-
</span>
|
|
216
|
-
</li>
|
|
217
|
-
</ul>
|
|
218
|
-
|
|
219
|
-
<dl
|
|
220
|
-
v-if="recap.deliveryLines.length || recap.billingLines.length || recap.paymentMethod"
|
|
221
|
-
class="grid grid-cols-1 sm:grid-cols-3 gap-x-6 gap-y-5 px-4 sm:px-5 py-5
|
|
222
|
-
border-t border-(--ui-border) text-sm"
|
|
223
|
-
>
|
|
224
|
-
<div v-if="recap.deliveryLines.length">
|
|
225
|
-
<dt class="font-medium text-highlighted">
|
|
226
|
-
{{ t('orders.deliveryAddress') }}
|
|
227
|
-
</dt>
|
|
228
|
-
<dd class="mt-2 text-muted">
|
|
229
|
-
<span
|
|
230
|
-
v-for="line in recap.deliveryLines"
|
|
231
|
-
:key="line"
|
|
232
|
-
class="block"
|
|
233
|
-
>{{ line }}</span>
|
|
234
|
-
</dd>
|
|
235
|
-
</div>
|
|
236
|
-
<div v-if="recap.billingLines.length">
|
|
237
|
-
<dt class="font-medium text-highlighted">
|
|
238
|
-
{{ t('orders.detail.billingAddress') }}
|
|
239
|
-
</dt>
|
|
240
|
-
<dd class="mt-2 text-muted">
|
|
241
|
-
<span
|
|
242
|
-
v-for="line in recap.billingLines"
|
|
243
|
-
:key="line"
|
|
244
|
-
class="block"
|
|
245
|
-
>{{ line }}</span>
|
|
246
|
-
</dd>
|
|
247
|
-
</div>
|
|
248
|
-
<div v-if="recap.paymentMethod">
|
|
249
|
-
<dt class="font-medium text-highlighted">
|
|
250
|
-
{{ t('orders.detail.paymentMethodLabel') }}
|
|
251
|
-
</dt>
|
|
252
|
-
<dd class="mt-2 text-muted">
|
|
253
|
-
{{ t(`paymentMethods.${recap.paymentMethod}`) }}
|
|
254
|
-
</dd>
|
|
255
|
-
</div>
|
|
256
|
-
</dl>
|
|
257
|
-
|
|
258
|
-
<div
|
|
259
|
-
class="flex justify-between px-4 sm:px-5 py-4 border-t border-(--ui-border)
|
|
260
|
-
text-sm font-semibold text-highlighted"
|
|
261
|
-
>
|
|
262
|
-
<span>{{ t('orders.card.total') }}</span>
|
|
263
|
-
<span class="tabular-nums">{{ formatCurrency(recap.total) }}</span>
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
</section>
|
|
267
|
-
|
|
268
|
-
<!-- Actions -->
|
|
269
|
-
<div class="mt-10 flex flex-wrap items-center gap-3">
|
|
270
|
-
<UButton
|
|
271
|
-
color="primary"
|
|
272
|
-
size="lg"
|
|
273
|
-
tabindex="0"
|
|
274
|
-
:label="t('confirmation.continueShopping')"
|
|
275
|
-
:trailing-icon="icon('arrow-right')"
|
|
276
|
-
@click="continueShopping"
|
|
277
|
-
/>
|
|
278
|
-
<UButton
|
|
279
|
-
v-if="recap"
|
|
280
|
-
color="neutral"
|
|
281
|
-
variant="outline"
|
|
282
|
-
size="lg"
|
|
283
|
-
tabindex="0"
|
|
284
|
-
:label="type === 'requisition' ? t('confirmation.viewRequisition') : t('confirmation.viewOrder')"
|
|
285
|
-
:to="detailLink"
|
|
286
|
-
/>
|
|
287
|
-
</div>
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<CheckoutConfirmationActions
|
|
48
|
+
:type="type"
|
|
49
|
+
:record-id="recordId"
|
|
50
|
+
:has-recap="!!recap"
|
|
51
|
+
class="mt-10"
|
|
52
|
+
/>
|
|
288
53
|
</div>
|
|
289
54
|
</template>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Active filter chips with per-value remove buttons and a clear-all action.
|
|
6
|
+
* Renders nothing when no filters are active.
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
listing: ProductListing;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const { icon } = useIcons();
|
|
13
|
+
const { t } = useI18n();
|
|
14
|
+
|
|
15
|
+
const FACET_VALUE_LABELS: Record<string, Record<string, string>> = {
|
|
16
|
+
available: { true: "search.filters.values.inStock", false: "search.filters.values.outOfStock" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const listing = props.listing;
|
|
20
|
+
|
|
21
|
+
function chipLabel(field: string, value: string): string {
|
|
22
|
+
const key = FACET_VALUE_LABELS[field]?.[value];
|
|
23
|
+
return key ? t(key) : value;
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div
|
|
29
|
+
v-if="listing.chips.value.length"
|
|
30
|
+
class="flex flex-wrap items-center gap-2 mb-4"
|
|
31
|
+
>
|
|
32
|
+
<button
|
|
33
|
+
v-for="chip in listing.chips.value"
|
|
34
|
+
:key="`${chip.field}:${chip.value}`"
|
|
35
|
+
type="button"
|
|
36
|
+
tabindex="0"
|
|
37
|
+
class="inline-flex items-center gap-1.5 ps-3 pe-2 py-1 rounded-full text-xs
|
|
38
|
+
font-medium bg-elevated text-highlighted border border-(--ui-border)
|
|
39
|
+
hover:border-(--ui-primary) transition-colors cursor-pointer"
|
|
40
|
+
:aria-label="t('search.filters.removeFilter', { value: chipLabel(chip.field, chip.value) })"
|
|
41
|
+
@click="listing.removeChip(chip.field, chip.value)"
|
|
42
|
+
>
|
|
43
|
+
{{ chipLabel(chip.field, chip.value) }}
|
|
44
|
+
<UIcon
|
|
45
|
+
:name="icon('close')"
|
|
46
|
+
class="size-3.5 text-muted"
|
|
47
|
+
/>
|
|
48
|
+
</button>
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
tabindex="0"
|
|
52
|
+
class="text-xs text-muted hover:text-highlighted underline underline-offset-4
|
|
53
|
+
decoration-2 transition-colors cursor-pointer"
|
|
54
|
+
@click="listing.clearFilters()"
|
|
55
|
+
>
|
|
56
|
+
{{ t('search.filters.clearAll') }}
|
|
57
|
+
</button>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import SearchFacetsBar from "../search/filter/SearchFacetsBar.vue";
|
|
3
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Horizontal facet filter bar for the listing — the above-the-results
|
|
7
|
+
* alternative to ListingFilterRail. Wraps the shared SearchFacetsBar.
|
|
8
|
+
*/
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
listing: ProductListing;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const listing = props.listing;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="pb-6">
|
|
18
|
+
<SearchFacetsBar
|
|
19
|
+
v-model="listing.activeFilters.value"
|
|
20
|
+
v-model:price-range="listing.priceRange.value"
|
|
21
|
+
:facets="listing.facets.value"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import SearchFacets from "../search/filter/SearchFacets.vue";
|
|
3
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mobile-only filter access: a trigger button (with an active-filter badge)
|
|
7
|
+
* that opens a left drawer holding the shared facet panel and a "show results"
|
|
8
|
+
* button. Self-contained open state so it can be dropped into a toolbar as-is.
|
|
9
|
+
*/
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
listing: ProductListing;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const { icon } = useIcons();
|
|
15
|
+
const { t } = useI18n();
|
|
16
|
+
|
|
17
|
+
const open = ref(false);
|
|
18
|
+
|
|
19
|
+
const listing = props.listing;
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<UButton
|
|
24
|
+
color="neutral"
|
|
25
|
+
variant="outline"
|
|
26
|
+
size="sm"
|
|
27
|
+
tabindex="0"
|
|
28
|
+
class="lg:hidden"
|
|
29
|
+
:icon="icon('filters')"
|
|
30
|
+
:label="t('search.filters.title')"
|
|
31
|
+
@click="open = true"
|
|
32
|
+
>
|
|
33
|
+
<template
|
|
34
|
+
v-if="listing.activeFilterCount.value"
|
|
35
|
+
#trailing
|
|
36
|
+
>
|
|
37
|
+
<UBadge
|
|
38
|
+
color="primary"
|
|
39
|
+
variant="solid"
|
|
40
|
+
size="sm"
|
|
41
|
+
:label="String(listing.activeFilterCount.value)"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
</UButton>
|
|
45
|
+
|
|
46
|
+
<UDrawer
|
|
47
|
+
v-model:open="open"
|
|
48
|
+
direction="left"
|
|
49
|
+
:ui="{ content: 'w-80 max-w-[85vw] h-full' }"
|
|
50
|
+
>
|
|
51
|
+
<template #content>
|
|
52
|
+
<div class="flex h-full flex-col">
|
|
53
|
+
<div class="flex-1 overflow-y-auto p-4">
|
|
54
|
+
<SearchFacets
|
|
55
|
+
v-model="listing.activeFilters.value"
|
|
56
|
+
v-model:price-range="listing.priceRange.value"
|
|
57
|
+
:facets="listing.facets.value"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="border-t border-(--ui-border) p-4">
|
|
61
|
+
<UButton
|
|
62
|
+
block
|
|
63
|
+
color="primary"
|
|
64
|
+
tabindex="0"
|
|
65
|
+
:label="t('search.filters.showResults', listing.found.value, { count: listing.found.value })"
|
|
66
|
+
@click="open = false"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
</UDrawer>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import SearchFacets from "../search/filter/SearchFacets.vue";
|
|
3
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Desktop-only sticky facet rail wrapping the shared SearchFacets panel.
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
listing: ProductListing;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const listing = props.listing;
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="hidden lg:block w-60 shrink-0 sticky top-(--ui-header-height) pt-1">
|
|
17
|
+
<SearchFacets
|
|
18
|
+
v-model="listing.activeFilters.value"
|
|
19
|
+
v-model:price-range="listing.priceRange.value"
|
|
20
|
+
:facets="listing.facets.value"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The results column: loading skeleton, error boundary, the product grid/list
|
|
6
|
+
* (grid or list per useViewMode) and pagination. Falls back to the #empty slot
|
|
7
|
+
* (default: a no-results empty state) when the listing returns no products.
|
|
8
|
+
*/
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
listing: ProductListing;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const { t } = useI18n();
|
|
14
|
+
const { viewMode } = useViewMode();
|
|
15
|
+
|
|
16
|
+
const listing = props.listing;
|
|
17
|
+
|
|
18
|
+
const gridClasses = computed(() => viewMode.value === "grid"
|
|
19
|
+
? "grid grid-cols-[repeat(auto-fill,minmax(16rem,1fr))] gap-4"
|
|
20
|
+
: "flex flex-col gap-4");
|
|
21
|
+
|
|
22
|
+
const listView = resolveComponent("CategoryViewListView");
|
|
23
|
+
const gridView = resolveComponent("CategoryViewGridView");
|
|
24
|
+
const productComponent = computed(() => viewMode.value === "list" ? listView : gridView);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div>
|
|
29
|
+
<!-- Loading skeleton -->
|
|
30
|
+
<div
|
|
31
|
+
v-if="listing.pending.value && !listing.data.value"
|
|
32
|
+
:class="gridClasses"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
v-for="n in 8"
|
|
36
|
+
:key="n"
|
|
37
|
+
class="space-y-3"
|
|
38
|
+
>
|
|
39
|
+
<USkeleton class="h-44 w-full rounded-lg" />
|
|
40
|
+
<USkeleton class="h-4 w-3/4" />
|
|
41
|
+
<USkeleton class="h-4 w-1/2" />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<UiFeedbackErrorBoundary
|
|
46
|
+
v-else-if="listing.error.value"
|
|
47
|
+
:title="t('search.results.error')"
|
|
48
|
+
@retry="listing.execute"
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<!-- Results -->
|
|
52
|
+
<template v-else-if="listing.products.value.length">
|
|
53
|
+
<div
|
|
54
|
+
:class="[gridClasses, listing.pending.value ? 'opacity-60 transition-opacity' : '']"
|
|
55
|
+
>
|
|
56
|
+
<component
|
|
57
|
+
:is="productComponent"
|
|
58
|
+
v-for="product in listing.products.value"
|
|
59
|
+
:key="product.id"
|
|
60
|
+
:product="product"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div
|
|
65
|
+
v-if="listing.totalPages.value > 1"
|
|
66
|
+
class="mt-8 flex flex-col items-center gap-2"
|
|
67
|
+
>
|
|
68
|
+
<UPagination
|
|
69
|
+
v-model:page="listing.page.value"
|
|
70
|
+
:total="listing.found.value"
|
|
71
|
+
:items-per-page="listing.perPage"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<!-- Empty -->
|
|
77
|
+
<slot
|
|
78
|
+
v-else-if="listing.isEmpty.value"
|
|
79
|
+
name="empty"
|
|
80
|
+
>
|
|
81
|
+
<UiFeedbackEmptyState
|
|
82
|
+
icon="no-results"
|
|
83
|
+
:title="t('search.results.emptyTitle')"
|
|
84
|
+
:description="t('search.results.emptyDescription')"
|
|
85
|
+
/>
|
|
86
|
+
</slot>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProductListing } from "../../composables/useProductListing";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Listing toolbar: result count, sort select, the grid/list view toggle and —
|
|
6
|
+
* on mobile — the filter drawer trigger.
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
listing: ProductListing;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
|
|
14
|
+
const listing = props.listing;
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div
|
|
19
|
+
class="flex flex-wrap items-center justify-between gap-3 border-b border-(--ui-border)
|
|
20
|
+
pb-4"
|
|
21
|
+
>
|
|
22
|
+
<p
|
|
23
|
+
class="text-sm text-muted tabular-nums"
|
|
24
|
+
aria-live="polite"
|
|
25
|
+
>
|
|
26
|
+
<template v-if="listing.pending.value && !listing.data.value">
|
|
27
|
+
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else>
|
|
30
|
+
{{ t('search.results.count', listing.found.value, { count: listing.found.value }) }}
|
|
31
|
+
</template>
|
|
32
|
+
</p>
|
|
33
|
+
<div class="flex items-center gap-2">
|
|
34
|
+
<ListingFilterDrawer :listing="listing" />
|
|
35
|
+
<USelect
|
|
36
|
+
v-model="listing.sort.value"
|
|
37
|
+
:items="listing.sortOptions.value"
|
|
38
|
+
value-key="value"
|
|
39
|
+
size="sm"
|
|
40
|
+
class="w-44"
|
|
41
|
+
:aria-label="t('search.sort.label')"
|
|
42
|
+
/>
|
|
43
|
+
<CategoryViewToggle class="max-sm:hidden" />
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|