@revenexx/cover 0.2.17 → 0.2.19

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.
Files changed (53) hide show
  1. package/app/components/account/address/AccountAddressView.vue +433 -0
  2. package/app/components/account/dashboard/AccountDashboard.vue +10 -330
  3. package/app/components/account/dashboard/AccountDashboardBudgets.vue +71 -0
  4. package/app/components/account/dashboard/AccountDashboardGreeting.vue +17 -0
  5. package/app/components/account/dashboard/AccountDashboardKpis.vue +71 -0
  6. package/app/components/account/dashboard/AccountDashboardQuickActions.vue +36 -0
  7. package/app/components/account/dashboard/AccountDashboardRecentOrders.vue +70 -0
  8. package/app/components/account/dashboard/AccountDashboardRequisitions.vue +60 -0
  9. package/app/components/account/profile/AccountPasswordForm.vue +155 -0
  10. package/app/components/account/profile/AccountProfileForm.vue +159 -0
  11. package/app/components/auth/AuthLoginTeaser.vue +1 -1
  12. package/app/components/auth/AuthRegisterPanel.vue +123 -119
  13. package/app/components/cart/position/CartPosition.vue +26 -17
  14. package/app/components/cart/recommend/CartReorderStrip.vue +27 -12
  15. package/app/components/cart/view/CartView.vue +1 -8
  16. package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +52 -0
  17. package/app/components/checkout/confirmation/CheckoutConfirmationHero.vue +41 -0
  18. package/app/components/checkout/confirmation/CheckoutConfirmationNextSteps.vue +60 -0
  19. package/app/components/checkout/confirmation/CheckoutConfirmationOrderRecap.vue +102 -0
  20. package/app/components/checkout/confirmation/CheckoutConfirmationView.vue +30 -265
  21. package/app/components/listing/ListingActiveFilters.vue +59 -0
  22. package/app/components/listing/ListingFilterBar.vue +24 -0
  23. package/app/components/listing/ListingFilterDrawer.vue +72 -0
  24. package/app/components/listing/ListingFilterRail.vue +23 -0
  25. package/app/components/listing/ListingResults.vue +88 -0
  26. package/app/components/listing/ListingToolbar.vue +46 -0
  27. package/app/components/listing/ListingView.vue +14 -204
  28. package/app/components/product/detail/ProductDetailIdentity.vue +44 -0
  29. package/app/components/product/detail/ProductDetailPrice.vue +39 -0
  30. package/app/components/search/filter/SearchFacets.vue +12 -102
  31. package/app/components/search/filter/SearchFacetsBar.vue +161 -0
  32. package/app/composables/useAccountDashboard.ts +112 -0
  33. package/app/composables/useCategoryListing.ts +92 -0
  34. package/app/composables/useCheckoutConfirmation.ts +63 -0
  35. package/app/composables/useFacetFilters.ts +122 -0
  36. package/app/composables/useProduct.ts +11 -0
  37. package/app/composables/useProductListing.ts +5 -1
  38. package/app/composables/useSearchListing.ts +71 -0
  39. package/app/interfaces/checkout.ts +27 -0
  40. package/i18n/locales/de/auth.json +1 -1
  41. package/i18n/locales/de/editor.json +33 -0
  42. package/i18n/locales/en/editor.json +33 -0
  43. package/package.json +1 -1
  44. package/server/data/media/60794300.jpg +0 -0
  45. package/server/data/media/aussen-rueckwaertsdrehen.jpg +0 -0
  46. package/server/data/media/bohrtiefe-8.jpg +0 -0
  47. package/server/data/media/dummy-brw-image.png +0 -0
  48. package/server/data/media/feindrehen.jpg +0 -0
  49. package/server/data/media/header-aktuelles.jpg +0 -0
  50. package/server/data/media/sternsiebeinsatz-gr-3-000028480.stp +19039 -0
  51. package/server/data/media/zaehnezahl-z4.jpg +0 -0
  52. package/server/data/media/zaehnezahl-z6.jpg +0 -0
  53. package/server/services/ApiProductService.ts +4 -1
@@ -0,0 +1,433 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * The buyer's address book — billing and shipping addresses in a two-column
4
+ * grid of AccountAddressCards, each editable/deletable inline, plus an Add
5
+ * button opening the create modal. Self-contained: backed by the account
6
+ * addresses service (useAccountAddresses) with the single-default-per-type
7
+ * rule enforced client-side.
8
+ */
9
+ import { COUNTRIES } from "../../../config/countries";
10
+ import type {
11
+ AccountAddress,
12
+ AccountAddressFormState,
13
+ } from "../../../interfaces/account/address-list";
14
+
15
+ const { icon } = useIcons();
16
+
17
+ const { t } = useI18n();
18
+ const toast = useToast();
19
+ const {
20
+ addresses, status, error, updateAddress, createAddress, deleteAddress,
21
+ } = useAccountAddresses();
22
+
23
+ const editingIds = reactive<Record<string, boolean>>({});
24
+ const formStates = reactive<Record<string, AccountAddressFormState>>({});
25
+ const savingIds = reactive<Record<string, boolean>>({});
26
+ const saveErrors = reactive<Record<string, string | null>>({});
27
+
28
+ function initFormState(address: AccountAddress) {
29
+ formStates[address.id] = {
30
+ company: address.company,
31
+ label: address.label,
32
+ firstName: address.firstName,
33
+ lastName: address.lastName,
34
+ street: address.street,
35
+ streetNumber: address.streetNumber,
36
+ city: address.city,
37
+ zip: address.zip,
38
+ country: address.country,
39
+ type: address.type,
40
+ isDefault: address.isDefault,
41
+ };
42
+ }
43
+
44
+ watch(addresses, (list: AccountAddress[]) => {
45
+ for (const address of list) {
46
+ if (!formStates[address.id] || !editingIds[address.id]) {
47
+ initFormState(address);
48
+ }
49
+ }
50
+ }, { immediate: true });
51
+
52
+ function toggleEdit(address: AccountAddress) {
53
+ if (editingIds[address.id]) {
54
+ initFormState(address);
55
+ saveErrors[address.id] = null;
56
+ }
57
+ editingIds[address.id] = !editingIds[address.id];
58
+ }
59
+
60
+ function onIsDefaultChange(address: AccountAddress, value: boolean) {
61
+ const state = formStates[address.id];
62
+ if (!state) {
63
+ return;
64
+ }
65
+ state.isDefault = value;
66
+ if (value) {
67
+ for (const other of addresses.value) {
68
+ if (other.id !== address.id && other.type === address.type) {
69
+ const otherState = formStates[other.id];
70
+ if (otherState) {
71
+ otherState.isDefault = false;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ async function onSubmit(address: AccountAddress) {
79
+ savingIds[address.id] = true;
80
+ saveErrors[address.id] = null;
81
+
82
+ try {
83
+ await updateAddress(address.id, formStates[address.id]!);
84
+ editingIds[address.id] = false;
85
+ toast.add({
86
+ title: t("addresses.success.updated"),
87
+ color: "success",
88
+ icon: icon("success"),
89
+ });
90
+ }
91
+ catch (err) {
92
+ const message = (err as { statusMessage?: string }).statusMessage;
93
+ const fallback = t("auth.login.errors.unknown");
94
+ saveErrors[address.id] = typeof message === "string" ? message : fallback;
95
+ }
96
+ finally {
97
+ savingIds[address.id] = false;
98
+ }
99
+ }
100
+
101
+ const hasAddresses = computed(() => addresses.value.length > 0);
102
+
103
+ const typeOptions = computed(() => [
104
+ { label: t("addresses.type.billing"), value: "billing" },
105
+ { label: t("addresses.type.shipping"), value: "shipping" },
106
+ ]);
107
+
108
+ function sortAddressList(list: AccountAddress[]): AccountAddress[] {
109
+ return [...list].sort((a, b) => {
110
+ if (a.isDefault !== b.isDefault) {
111
+ return a.isDefault ? -1 : 1;
112
+ }
113
+ return a.label.localeCompare(b.label);
114
+ });
115
+ }
116
+
117
+ const deleteDisabledIds = computed(() => {
118
+ const defaultBilling = addresses.value.find(
119
+ (a: AccountAddress) => a.type === "billing" && formStates[a.id]?.isDefault,
120
+ );
121
+ if (!defaultBilling) {
122
+ return new Set<string>();
123
+ }
124
+ return new Set([defaultBilling.id]);
125
+ });
126
+
127
+ async function onDeleteAddress(address: AccountAddress) {
128
+ try {
129
+ await deleteAddress(address.id);
130
+ Reflect.deleteProperty(formStates, address.id);
131
+ Reflect.deleteProperty(editingIds, address.id);
132
+ Reflect.deleteProperty(savingIds, address.id);
133
+ Reflect.deleteProperty(saveErrors, address.id);
134
+ toast.add({
135
+ title: t("addresses.success.deleted"),
136
+ color: "success",
137
+ icon: icon("success"),
138
+ });
139
+ }
140
+ catch (err) {
141
+ const message = (err as { statusMessage?: string }).statusMessage;
142
+ const fallback = t("auth.login.errors.unknown");
143
+ toast.add({
144
+ title: typeof message === "string" ? message : fallback,
145
+ color: "error",
146
+ icon: icon("error"),
147
+ });
148
+ }
149
+ }
150
+
151
+ const defaultLockedIds = computed(() => {
152
+ const defaultCounts: Record<string, number> = {};
153
+ for (const a of addresses.value) {
154
+ if (formStates[a.id]?.isDefault) {
155
+ defaultCounts[a.type] = (defaultCounts[a.type] ?? 0) + 1;
156
+ }
157
+ }
158
+ const locked = new Set<string>();
159
+ for (const a of addresses.value) {
160
+ if (formStates[a.id]?.isDefault && (defaultCounts[a.type] ?? 0) === 1) {
161
+ locked.add(a.id);
162
+ }
163
+ }
164
+ return locked;
165
+ });
166
+
167
+ const billingAddresses = computed(() =>
168
+ sortAddressList(addresses.value.filter((a: AccountAddress) => a.type === "billing")),
169
+ );
170
+
171
+ const shippingAddresses = computed(() =>
172
+ sortAddressList(addresses.value.filter((a: AccountAddress) => a.type === "shipping")),
173
+ );
174
+
175
+ const addModalOpen = ref(false);
176
+ const isAdding = ref(false);
177
+ const addError = ref<string | null>(null);
178
+
179
+ function emptyAddFormState(): AccountAddressFormState {
180
+ return {
181
+ company: "",
182
+ label: "",
183
+ firstName: "",
184
+ lastName: "",
185
+ street: "",
186
+ streetNumber: "",
187
+ city: "",
188
+ zip: "",
189
+ country: "Deutschland",
190
+ type: "shipping",
191
+ isDefault: false,
192
+ };
193
+ }
194
+
195
+ const addFormState = reactive<AccountAddressFormState>(emptyAddFormState());
196
+
197
+ watch(addModalOpen, (open: boolean) => {
198
+ if (open) {
199
+ Object.assign(addFormState, emptyAddFormState());
200
+ addError.value = null;
201
+ }
202
+ });
203
+
204
+ async function onAddAddress() {
205
+ isAdding.value = true;
206
+ addError.value = null;
207
+ try {
208
+ const created = await createAddress({ ...addFormState });
209
+ initFormState(created);
210
+ addModalOpen.value = false;
211
+ toast.add({
212
+ title: t("addresses.success.created"),
213
+ color: "success",
214
+ icon: icon("success"),
215
+ });
216
+ }
217
+ catch (err) {
218
+ const message = (err as { statusMessage?: string }).statusMessage;
219
+ addError.value = typeof message === "string" ? message : t("auth.login.errors.unknown");
220
+ }
221
+ finally {
222
+ isAdding.value = false;
223
+ }
224
+ }
225
+ </script>
226
+
227
+ <template>
228
+ <div class="space-y-6">
229
+ <div class="flex justify-end">
230
+ <UButton
231
+ :icon="icon('plus')"
232
+ :label="t('addresses.actions.add')"
233
+ @click="addModalOpen = true"
234
+ />
235
+ </div>
236
+
237
+ <UiFeedbackErrorBoundary
238
+ v-if="error"
239
+ :title="t('addresses.errorTitle')"
240
+ :description="t('addresses.errorDescription')"
241
+ :show-retry="false"
242
+ />
243
+
244
+ <div
245
+ v-else-if="status === 'pending'"
246
+ class="grid grid-cols-1 md:grid-cols-2 gap-4"
247
+ >
248
+ <USkeleton
249
+ v-for="index in 4"
250
+ :key="index"
251
+ class="h-44 w-full rounded-xl"
252
+ />
253
+ </div>
254
+
255
+ <UiFeedbackEmptyState
256
+ v-else-if="!hasAddresses"
257
+ :icon="icon('location-missing')"
258
+ :title="t('addresses.empty.title')"
259
+ :description="t('addresses.empty.description')"
260
+ />
261
+
262
+ <div
263
+ v-else
264
+ class="grid grid-cols-1 md:grid-cols-2 items-start gap-4"
265
+ >
266
+ <div class="space-y-4">
267
+ <AccountAddressCard
268
+ v-for="address in billingAddresses"
269
+ :key="address.id"
270
+ v-model:form-state="formStates[address.id]!"
271
+ :address="address"
272
+ :is-default-locked="defaultLockedIds.has(address.id)"
273
+ :is-delete-disabled="deleteDisabledIds.has(address.id)"
274
+ :is-editing="!!editingIds[address.id]"
275
+ :is-saving="!!savingIds[address.id]"
276
+ :save-error="saveErrors[address.id] ?? null"
277
+ :type-options="typeOptions"
278
+ @toggle-edit="toggleEdit(address)"
279
+ @submit="onSubmit(address)"
280
+ @is-default-change="onIsDefaultChange(address, $event)"
281
+ @delete="onDeleteAddress(address)"
282
+ />
283
+ </div>
284
+ <div class="space-y-4">
285
+ <AccountAddressCard
286
+ v-for="address in shippingAddresses"
287
+ :key="address.id"
288
+ v-model:form-state="formStates[address.id]!"
289
+ :address="address"
290
+ :is-default-locked="defaultLockedIds.has(address.id)"
291
+ :is-delete-disabled="deleteDisabledIds.has(address.id)"
292
+ :is-editing="!!editingIds[address.id]"
293
+ :is-saving="!!savingIds[address.id]"
294
+ :save-error="saveErrors[address.id] ?? null"
295
+ :type-options="typeOptions"
296
+ @toggle-edit="toggleEdit(address)"
297
+ @submit="onSubmit(address)"
298
+ @is-default-change="onIsDefaultChange(address, $event)"
299
+ @delete="onDeleteAddress(address)"
300
+ />
301
+ </div>
302
+ </div>
303
+
304
+ <UModal
305
+ v-model:open="addModalOpen"
306
+ :title="t('addresses.add.title')"
307
+ >
308
+ <template #body>
309
+ <FormKit
310
+ type="form"
311
+ :actions="false"
312
+ @submit="onAddAddress"
313
+ >
314
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
315
+ <FormKit
316
+ v-model="addFormState.label"
317
+ type="text"
318
+ :label="t('addresses.fields.label')"
319
+ name="label"
320
+ validation="required|length:2,200"
321
+ outer-class="sm:col-span-2"
322
+ />
323
+ <FormKit
324
+ v-model="addFormState.company"
325
+ type="text"
326
+ :label="t('addresses.fields.company')"
327
+ name="company"
328
+ validation="companyName"
329
+ :validation-messages="{ companyName: t('validation.invalidCompanyName') }"
330
+ autocomplete="organization"
331
+ outer-class="sm:col-span-2"
332
+ />
333
+ <FormKit
334
+ v-model="addFormState.firstName"
335
+ type="text"
336
+ :label="t('addresses.fields.firstName')"
337
+ name="firstName"
338
+ validation="required|length:2,100"
339
+ autocomplete="given-name"
340
+ />
341
+ <FormKit
342
+ v-model="addFormState.lastName"
343
+ type="text"
344
+ :label="t('addresses.fields.lastName')"
345
+ name="lastName"
346
+ validation="required|length:2,100"
347
+ autocomplete="family-name"
348
+ />
349
+ <FormKit
350
+ v-model="addFormState.street"
351
+ type="text"
352
+ :label="t('addresses.fields.street')"
353
+ name="street"
354
+ validation="required|length:2,200"
355
+ autocomplete="street-address"
356
+ />
357
+ <FormKit
358
+ v-model="addFormState.streetNumber"
359
+ type="text"
360
+ :label="t('addresses.fields.streetNumber')"
361
+ name="streetNumber"
362
+ validation="required"
363
+ />
364
+ <FormKit
365
+ v-model="addFormState.zip"
366
+ type="text"
367
+ :label="t('addresses.fields.zip')"
368
+ name="zip"
369
+ validation="required|zip"
370
+ :validation-messages="{ zip: t('validation.invalidZipCode') }"
371
+ autocomplete="postal-code"
372
+ />
373
+ <FormKit
374
+ v-model="addFormState.city"
375
+ type="text"
376
+ :label="t('addresses.fields.city')"
377
+ name="city"
378
+ validation="required|length:2,100"
379
+ autocomplete="address-level2"
380
+ />
381
+ <FormKit
382
+ v-model="addFormState.country"
383
+ type="select"
384
+ :label="t('addresses.fields.country')"
385
+ name="country"
386
+ validation="required"
387
+ :options="COUNTRIES"
388
+ outer-class="sm:col-span-2"
389
+ />
390
+ <FormKit
391
+ v-model="addFormState.type"
392
+ type="select"
393
+ :label="t('addresses.fields.type')"
394
+ name="type"
395
+ validation="required"
396
+ :options="typeOptions"
397
+ outer-class="sm:col-span-2"
398
+ />
399
+ <div class="sm:col-span-2">
400
+ <UCheckbox
401
+ v-model="addFormState.isDefault"
402
+ :label="t('addresses.fields.isDefault')"
403
+ />
404
+ </div>
405
+ </div>
406
+
407
+ <UAlert
408
+ v-if="addError"
409
+ color="error"
410
+ variant="soft"
411
+ :title="addError"
412
+ />
413
+
414
+ <div class="flex justify-end gap-2">
415
+ <UButton
416
+ color="neutral"
417
+ variant="ghost"
418
+ @click="addModalOpen = false"
419
+ >
420
+ {{ t('addresses.delete.cancel') }}
421
+ </UButton>
422
+ <UButton
423
+ type="submit"
424
+ :loading="isAdding"
425
+ >
426
+ {{ t('addresses.add.submit') }}
427
+ </UButton>
428
+ </div>
429
+ </FormKit>
430
+ </template>
431
+ </UModal>
432
+ </div>
433
+ </template>