@shopbite-de/storefront 1.31.2 → 2.0.0
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/.github/workflows/ci.yaml +54 -0
- package/.nuxtrc +1 -1
- package/CLAUDE.md +23 -8
- package/app/app.vue +10 -6
- package/app/assets/css/main.css +100 -61
- package/app/components/AddToWishlist.vue +15 -25
- package/app/components/Address/Card.vue +6 -11
- package/app/components/Address/Detail.vue +23 -23
- package/app/components/Address/Fields.vue +175 -73
- package/app/components/Address/Form.vue +107 -106
- package/app/components/Cart/Bar.vue +6 -9
- package/app/components/Cart/Item.vue +48 -63
- package/app/components/Cart/QuickView.vue +38 -25
- package/app/components/Cart/Upsell.vue +24 -62
- package/app/components/Category/Breadcrumb.vue +29 -3
- package/app/components/Category/FilterGroup.vue +20 -41
- package/app/components/Category/Listing.vue +100 -130
- package/app/components/Category/SearchInput.vue +22 -19
- package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
- package/app/components/Checkout/LoginOrRegister.vue +28 -29
- package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
- package/app/components/Checkout/Summary.vue +90 -60
- package/app/components/Checkout/VoucherInput.vue +40 -27
- package/app/components/Contact/Form.vue +164 -192
- package/app/components/DemoBanner.vue +5 -5
- package/app/components/Footer/StoreStatus.vue +2 -2
- package/app/components/Footer.vue +125 -57
- package/app/components/Header.vue +283 -18
- package/app/components/Home/Categories.vue +116 -0
- package/app/components/Home/Facts.vue +71 -0
- package/app/components/Home/Faq.vue +34 -16
- package/app/components/Home/Hero.vue +172 -0
- package/app/components/Home/Highlights.vue +29 -37
- package/app/components/Home/Restaurant.vue +102 -0
- package/app/components/Menu/BonCard.vue +180 -0
- package/app/components/Menu/CartPanel.vue +24 -0
- package/app/components/Menu/CategoryIndex.vue +54 -0
- package/app/components/Menu/OrderMode.vue +20 -0
- package/app/components/Menu/SectionHeader.vue +38 -0
- package/app/components/Navigation/MobileTop.vue +23 -15
- package/app/components/Order/Confirmation.vue +119 -0
- package/app/components/Order/Detail.vue +80 -88
- package/app/components/Product/CardSkeleton.vue +8 -12
- package/app/components/Product/Configurator.vue +8 -16
- package/app/components/Product/CrossSelling.vue +75 -83
- package/app/components/Product/DeselectIngredient.vue +17 -22
- package/app/components/Product/Detail.vue +35 -27
- package/app/components/Product/QuickView.vue +80 -51
- package/app/components/SalesChannelSwitch.vue +14 -28
- package/app/components/Sb/Button.vue +70 -0
- package/app/components/Sb/Checkbox.vue +73 -0
- package/app/components/Sb/Chip.vue +51 -0
- package/app/components/Sb/ChoiceGroup.vue +82 -0
- package/app/components/Sb/ConfirmDialog.vue +60 -0
- package/app/components/Sb/Field.vue +77 -0
- package/app/components/Sb/Icon.vue +66 -0
- package/app/components/Sb/IconButton.vue +55 -0
- package/app/components/Sb/Input.vue +23 -0
- package/app/components/Sb/SegmentedControl.vue +34 -0
- package/app/components/Sb/Select.vue +49 -0
- package/app/components/Sb/Sheet.vue +83 -0
- package/app/components/Sb/Stars.vue +60 -0
- package/app/components/Sb/StatusPill.vue +38 -0
- package/app/components/Sb/Stepper.vue +72 -0
- package/app/components/User/AccountHeader.vue +16 -0
- package/app/components/User/AuthPanel.vue +41 -0
- package/app/components/User/Detail.vue +32 -29
- package/app/components/User/LoginForm.vue +92 -98
- package/app/components/User/RegistrationForm.vue +285 -249
- package/app/components/Wishlist.vue +55 -155
- package/app/composables/useCartMutations.ts +9 -27
- package/app/composables/useCheckoutMethodGuard.ts +2 -24
- package/app/composables/useContactForm.ts +66 -0
- package/app/composables/useHomeMenuCategories.ts +41 -0
- package/app/composables/useNavigation.ts +10 -2
- package/app/composables/useOrderMode.ts +65 -0
- package/app/composables/useRegistrationForm.ts +161 -0
- package/app/composables/useRestaurantSchema.ts +1 -1
- package/app/composables/useShareLink.ts +3 -13
- package/app/composables/useSortingSelection.ts +13 -0
- package/app/composables/useThemePreset.ts +15 -0
- package/app/composables/useVoucherCode.ts +7 -16
- package/app/composables/useWishlistActions.ts +0 -51
- package/app/error.vue +31 -9
- package/app/layouts/account.vue +45 -50
- package/app/layouts/default.vue +2 -3
- package/app/layouts/listing.vue +3 -5
- package/app/pages/[...all].vue +8 -4
- package/app/pages/account/recover/password/index.vue +113 -80
- package/app/pages/anmelden.vue +11 -10
- package/app/pages/bestellung/[id]/erfolg.vue +1 -15
- package/app/pages/bestellung/[id]/fehler.vue +63 -51
- package/app/pages/bestellung/[id]/index.vue +3 -85
- package/app/pages/bestellung/kasse.vue +29 -0
- package/app/pages/bestellung.vue +8 -60
- package/app/pages/index.vue +12 -52
- package/app/pages/kontakt.vue +27 -7
- package/app/pages/konto/adressen.vue +106 -102
- package/app/pages/konto/bestellung/[id].vue +9 -43
- package/app/pages/konto/bestellungen.vue +55 -33
- package/app/pages/konto/index.vue +47 -62
- package/app/pages/konto/profil.vue +162 -100
- package/app/pages/maintenance.vue +8 -6
- package/app/pages/merkliste.vue +7 -8
- package/app/pages/passwort-vergessen.vue +92 -75
- package/app/pages/registrierung/bestaetigen.vue +20 -48
- package/app/pages/registrierung/index.vue +16 -7
- package/app/pages/suche.vue +94 -95
- package/app/plugins/theme-preset.ts +9 -0
- package/app/utils/highlight.ts +25 -0
- package/app/utils/product.ts +9 -0
- package/app/validation/registrationSchema.ts +1 -1
- package/docs/notes/2026-10-07-issue-434-property-group-projection.md +27 -0
- package/docs/notes/2026-10-07-listing-payload.md +38 -0
- package/docs/notes/2026-10-07-nuxt-4.6-inline-error-rendering.md +31 -0
- package/modules/theme.ts +115 -0
- package/nuxt.config.ts +27 -15
- package/package.json +6 -8
- package/playwright.config.ts +11 -0
- package/server/api/listing/[categoryId].get.ts +10 -11
- package/server/api/product/[productId].get.ts +4 -2
- package/server/api/product/variant.get.ts +1 -2
- package/server/api/search.get.ts +7 -12
- package/shared/theme/presets.ts +303 -0
- package/test/a11y/presets.test.ts +225 -0
- package/test/nuxt/AccountPagesPreset.test.ts +191 -0
- package/test/nuxt/AuthPagesPreset.test.ts +87 -0
- package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
- package/test/nuxt/CartItem.test.ts +18 -3
- package/test/nuxt/CartUpsell.test.ts +1 -2
- package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
- package/test/nuxt/CheckoutOnePage.test.ts +115 -0
- package/test/nuxt/CheckoutSummary.test.ts +6 -6
- package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
- package/test/nuxt/ContactFormPreset.test.ts +115 -0
- package/test/nuxt/FooterStoreStatus.test.ts +2 -2
- package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
- package/test/nuxt/HomeFaq.test.ts +3 -2
- package/test/nuxt/MenuBonCard.test.ts +122 -0
- package/test/nuxt/OrderPagesPreset.test.ts +132 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
- package/test/nuxt/ProductCrossSelling.test.ts +2 -1
- package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
- package/test/nuxt/ProductSheetPreset.test.ts +105 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
- package/test/nuxt/RegistrationForm.test.ts +89 -270
- package/test/nuxt/SbBaseComponents.test.ts +170 -0
- package/test/nuxt/SbStars.test.ts +25 -0
- package/test/nuxt/useCartMutations.test.ts +3 -17
- package/test/nuxt/useCartUpsell.test.ts +1 -1
- package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
- package/test/nuxt/useShareLink.test.ts +1 -9
- package/test/nuxt/useWishlistActions.test.ts +3 -26
- package/test/unit/highlight.spec.ts +31 -0
- package/test/unit/product.spec.ts +12 -0
- package/test/unit/themePresets.spec.ts +61 -0
- package/app/app.config.ts +0 -19
- package/app/components/AnimatedSection.vue +0 -74
- package/app/components/BottomNavi.vue +0 -70
- package/app/components/Category/Header.vue +0 -48
- package/app/components/Checkout/PaymentMethod.vue +0 -30
- package/app/components/Checkout/ShippingMethod.vue +0 -30
- package/app/components/Cta.vue +0 -30
- package/app/components/Feature/Card.vue +0 -121
- package/app/components/Features.vue +0 -42
- package/app/components/Footer/Contact.vue +0 -82
- package/app/components/Header/Body.vue +0 -82
- package/app/components/Header/Right.vue +0 -187
- package/app/components/Header/Title.vue +0 -10
- package/app/components/Hero.vue +0 -233
- package/app/components/Home/MenuCategories.vue +0 -148
- package/app/components/ImageGallery.vue +0 -63
- package/app/components/Loading.vue +0 -29
- package/app/components/Navigation/DesktopLeft.vue +0 -39
- package/app/components/Product/Card.vue +0 -177
- package/app/components/Product/CardCompact.vue +0 -72
- package/app/components/Product/CardDietBadges.vue +0 -43
- package/app/components/Product/CardIngredients.vue +0 -35
- package/app/components/Product/CardKitchen.vue +0 -34
- package/app/components/Product/Category.vue +0 -160
- package/app/components/Product/SearchBar.vue +0 -95
- package/app/components/PublicAnnouncement.vue +0 -17
- package/app/pages/bestellung/bestaetigen.vue +0 -16
- package/app/pages/bestellung/warenkorb.vue +0 -49
- package/app/pages/bestellung/zahlung-versand.vue +0 -25
- package/test/nuxt/AddressFields.test.ts +0 -222
- package/test/nuxt/AnimatedSection.test.ts +0 -67
- package/test/nuxt/ContactForm.test.ts +0 -207
- package/test/nuxt/FooterContact.test.ts +0 -102
- package/test/nuxt/HeaderRight.test.ts +0 -142
- package/test/nuxt/Hero.test.ts +0 -126
- package/test/nuxt/HomeMenuCategories.test.ts +0 -94
- package/test/nuxt/LoginForm.test.ts +0 -159
|
@@ -1,288 +1,324 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { createRegistrationSchema } from "~/validation/registrationSchema";
|
|
3
2
|
import type { RegistrationSchema } from "~/validation/registrationSchema";
|
|
4
|
-
import { ApiClientError } from "@shopware/api-client";
|
|
5
|
-
import type { FormSubmitEvent } from "@nuxt/ui";
|
|
6
3
|
import type { Schemas } from "#shopware";
|
|
7
4
|
|
|
8
|
-
const props = withDefaults(
|
|
9
|
-
defineProps<{
|
|
10
|
-
/**
|
|
11
|
-
* Whether the visitor may skip the customer account (guest order). The
|
|
12
|
-
* registration page (`/registrierung`) always creates a real account, the
|
|
13
|
-
* checkout offers the choice.
|
|
14
|
-
*/
|
|
15
|
-
allowGuest?: boolean;
|
|
16
|
-
}>(),
|
|
17
|
-
{
|
|
18
|
-
allowGuest: true,
|
|
19
|
-
},
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const config = useRuntimeConfig();
|
|
23
|
-
// Where to go after a successful registration is the caller's decision: the
|
|
24
|
-
// registration page sends the visitor to the account, the checkout continues
|
|
25
|
-
// with the order.
|
|
26
|
-
const { register } = useUser();
|
|
27
|
-
|
|
28
|
-
const state = reactive({
|
|
29
|
-
accountType: "private" as "private" | "business",
|
|
30
|
-
salutationId: "",
|
|
31
|
-
firstName: "",
|
|
32
|
-
lastName: "",
|
|
33
|
-
email: "",
|
|
34
|
-
guest: props.allowGuest,
|
|
35
|
-
password: "",
|
|
36
|
-
passwordConfirm: "",
|
|
37
|
-
acceptedDataProtection: false,
|
|
38
|
-
isShippingAddressDifferent: false,
|
|
39
|
-
storefrontUrl: config.public.shopware.devStorefrontUrl,
|
|
40
|
-
billingAddress: {
|
|
41
|
-
company: "",
|
|
42
|
-
department: "",
|
|
43
|
-
salutationId: "",
|
|
44
|
-
firstName: "",
|
|
45
|
-
lastName: "",
|
|
46
|
-
phoneNumber: "",
|
|
47
|
-
additionalAddressLine1: "",
|
|
48
|
-
street: "",
|
|
49
|
-
zipcode: "",
|
|
50
|
-
city: "",
|
|
51
|
-
countryId: config.public.site.countryId,
|
|
52
|
-
},
|
|
53
|
-
shippingAddress: {
|
|
54
|
-
company: "",
|
|
55
|
-
department: "",
|
|
56
|
-
salutationId: "",
|
|
57
|
-
firstName: "",
|
|
58
|
-
lastName: "",
|
|
59
|
-
phoneNumber: "",
|
|
60
|
-
additionalAddressLine1: "",
|
|
61
|
-
street: "",
|
|
62
|
-
zipcode: "",
|
|
63
|
-
city: "",
|
|
64
|
-
countryId: config.public.site.countryId,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const schema = computed(() => createRegistrationSchema(state));
|
|
69
|
-
|
|
70
|
-
// The API payload keeps the negated `guest` flag, the form asks the positive
|
|
71
|
-
// question: a guest order is the default, creating an account is the opt-in.
|
|
72
|
-
const createAccount = computed({
|
|
73
|
-
get: () => !state.guest,
|
|
74
|
-
set: (value: boolean) => {
|
|
75
|
-
state.guest = !value;
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
5
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
6
|
+
* Registration and guest order form of the presets (#443): the logic of
|
|
7
|
+
* useRegistrationForm with the base components. The schema is checked on
|
|
8
|
+
* submit; errors appear at their fields and in a summary above the form
|
|
9
|
+
* that takes the focus and links to each field (WCAG 3.3.1).
|
|
82
10
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const toast = useToast();
|
|
88
|
-
|
|
89
|
-
const billingAddressFields = ref();
|
|
90
|
-
const shippingAddressFields = ref();
|
|
91
|
-
|
|
92
|
-
async function onSubmit(event: FormSubmitEvent<RegistrationSchema>) {
|
|
93
|
-
billingAddressFields.value?.flushPendingCheck();
|
|
94
|
-
if (state.isShippingAddressDifferent) {
|
|
95
|
-
shippingAddressFields.value?.flushPendingCheck();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const registrationData = { ...event.data };
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
!registrationData.billingAddress.firstName &&
|
|
102
|
-
registrationData.firstName
|
|
103
|
-
) {
|
|
104
|
-
registrationData.billingAddress.firstName = registrationData.firstName;
|
|
105
|
-
}
|
|
11
|
+
const props = withDefaults(defineProps<{ allowGuest?: boolean }>(), {
|
|
12
|
+
allowGuest: true,
|
|
13
|
+
});
|
|
106
14
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
"registration-success": [
|
|
17
|
+
data: RegistrationSchema,
|
|
18
|
+
customer: Schemas["Customer"] | undefined,
|
|
19
|
+
];
|
|
20
|
+
}>();
|
|
110
21
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
22
|
+
const {
|
|
23
|
+
state,
|
|
24
|
+
schema,
|
|
25
|
+
createAccount,
|
|
26
|
+
billingAddressFields,
|
|
27
|
+
shippingAddressFields,
|
|
28
|
+
accountTypes,
|
|
29
|
+
submit,
|
|
30
|
+
} = useRegistrationForm({ allowGuest: props.allowGuest });
|
|
31
|
+
|
|
32
|
+
const errors = ref<Record<string, string>>({});
|
|
33
|
+
const submitError = ref<string | null>(null);
|
|
34
|
+
const notice = ref<string | null>(null);
|
|
35
|
+
const submitting = ref(false);
|
|
36
|
+
const summary = ref<HTMLElement | null>(null);
|
|
37
|
+
|
|
38
|
+
// Field ids follow the schema paths ("billingAddress.street" →
|
|
39
|
+
// "billingAddress-street"), so the summary can link to them.
|
|
40
|
+
const fieldId = (path: string) => path.replace(/\./g, "-");
|
|
41
|
+
// The summary lists the errors in the order of the form, not the schema.
|
|
42
|
+
const ADDRESS_ORDER = [
|
|
43
|
+
"company",
|
|
44
|
+
"department",
|
|
45
|
+
"firstName",
|
|
46
|
+
"lastName",
|
|
47
|
+
"street",
|
|
48
|
+
"zipcode",
|
|
49
|
+
"city",
|
|
50
|
+
"additionalAddressLine1",
|
|
51
|
+
"phoneNumber",
|
|
52
|
+
];
|
|
53
|
+
const FIELD_ORDER = [
|
|
54
|
+
"accountType",
|
|
55
|
+
"firstName",
|
|
56
|
+
"lastName",
|
|
57
|
+
"email",
|
|
58
|
+
"password",
|
|
59
|
+
"passwordConfirm",
|
|
60
|
+
...ADDRESS_ORDER.map((name) => `billingAddress.${name}`),
|
|
61
|
+
...ADDRESS_ORDER.map((name) => `shippingAddress.${name}`),
|
|
62
|
+
"acceptedDataProtection",
|
|
63
|
+
];
|
|
64
|
+
const position = (path: string) => {
|
|
65
|
+
const index = FIELD_ORDER.indexOf(path);
|
|
66
|
+
return index === -1 ? FIELD_ORDER.length : index;
|
|
67
|
+
};
|
|
68
|
+
const errorList = computed(() =>
|
|
69
|
+
Object.entries(errors.value)
|
|
70
|
+
.map(([path, message]) => ({ path, message, id: fieldId(path) }))
|
|
71
|
+
.sort((a, b) => position(a.path) - position(b.path)),
|
|
72
|
+
);
|
|
114
73
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
74
|
+
async function onSubmit() {
|
|
75
|
+
submitError.value = null;
|
|
76
|
+
notice.value = null;
|
|
77
|
+
const result = schema.value.safeParse(state);
|
|
78
|
+
if (!result.success) {
|
|
79
|
+
const next: Record<string, string> = {};
|
|
80
|
+
for (const issue of result.error.issues) {
|
|
81
|
+
const path = issue.path.join(".");
|
|
82
|
+
if (!next[path]) next[path] = issue.message;
|
|
83
|
+
}
|
|
84
|
+
errors.value = next;
|
|
85
|
+
await nextTick();
|
|
86
|
+
summary.value?.focus();
|
|
87
|
+
return;
|
|
118
88
|
}
|
|
119
|
-
|
|
89
|
+
errors.value = {};
|
|
90
|
+
submitting.value = true;
|
|
120
91
|
try {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
title: "Fast geschafft!",
|
|
128
|
-
description:
|
|
129
|
-
"Wir haben dir eine E-Mail geschickt. Bitte bestätige den Link darin, um dein Konto zu aktivieren.",
|
|
130
|
-
color: "info",
|
|
131
|
-
});
|
|
132
|
-
} else {
|
|
133
|
-
toast.add({
|
|
134
|
-
title: registrationData.guest
|
|
135
|
-
? "Erfolgreich Kundendaten erfasst"
|
|
136
|
-
: "Konto erfolgreich erstellt",
|
|
137
|
-
color: "success",
|
|
138
|
-
});
|
|
92
|
+
const outcome = await submit(result.data as RegistrationSchema);
|
|
93
|
+
if (!outcome.ok) {
|
|
94
|
+
submitError.value = outcome.message;
|
|
95
|
+
await nextTick();
|
|
96
|
+
summary.value?.focus();
|
|
97
|
+
return;
|
|
139
98
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
registrationData as unknown as RegistrationSchema,
|
|
144
|
-
customer,
|
|
145
|
-
);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error("Registration failed:", error);
|
|
148
|
-
let description = "Bitte versuchen Sie es erneut.";
|
|
149
|
-
if (error instanceof ApiClientError) {
|
|
150
|
-
const errors = error.details?.errors;
|
|
151
|
-
if (Array.isArray(errors) && errors.length > 0) {
|
|
152
|
-
description = errors
|
|
153
|
-
.map((e) => e.detail || e.title)
|
|
154
|
-
.filter(Boolean)
|
|
155
|
-
.join("\n");
|
|
156
|
-
}
|
|
99
|
+
if (outcome.needsConfirmation) {
|
|
100
|
+
notice.value =
|
|
101
|
+
"Fast geschafft: Wir haben Ihnen eine E-Mail geschickt. Bitte bestätigen Sie den Link darin, um Ihr Konto zu aktivieren.";
|
|
157
102
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
color: "error",
|
|
162
|
-
});
|
|
103
|
+
emit("registration-success", outcome.data, outcome.customer);
|
|
104
|
+
} finally {
|
|
105
|
+
submitting.value = false;
|
|
163
106
|
}
|
|
164
107
|
}
|
|
165
|
-
|
|
166
|
-
const accountTypes = ref([
|
|
167
|
-
{
|
|
168
|
-
label: "Privatkunde",
|
|
169
|
-
value: "private",
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
label: "Geschäftskunde",
|
|
173
|
-
value: "business",
|
|
174
|
-
},
|
|
175
|
-
]);
|
|
176
|
-
|
|
177
|
-
const emit = defineEmits<{
|
|
178
|
-
"registration-success": [
|
|
179
|
-
data: RegistrationSchema,
|
|
180
|
-
customer: Schemas["Customer"] | undefined,
|
|
181
|
-
];
|
|
182
|
-
}>();
|
|
183
108
|
</script>
|
|
184
109
|
|
|
185
110
|
<template>
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
@submit="onSubmit"
|
|
191
|
-
@error="(error: any) => console.log('Form validation error:', error)"
|
|
111
|
+
<form
|
|
112
|
+
novalidate
|
|
113
|
+
class="flex flex-col gap-5 font-body text-sb-ink"
|
|
114
|
+
@submit.prevent="onSubmit"
|
|
192
115
|
>
|
|
193
|
-
<
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</
|
|
116
|
+
<div
|
|
117
|
+
v-if="errorList.length || submitError"
|
|
118
|
+
ref="summary"
|
|
119
|
+
role="alert"
|
|
120
|
+
tabindex="-1"
|
|
121
|
+
class="flex flex-col gap-2 rounded-sb-control border-[1.5px] border-sb-danger p-4 text-sm"
|
|
122
|
+
>
|
|
123
|
+
<strong class="text-base">
|
|
124
|
+
{{
|
|
125
|
+
submitError
|
|
126
|
+
? "Das hat nicht geklappt"
|
|
127
|
+
: errorList.length === 1
|
|
128
|
+
? "Ein Feld braucht noch Ihre Angabe"
|
|
129
|
+
: `${errorList.length} Felder brauchen noch Ihre Angabe`
|
|
130
|
+
}}
|
|
131
|
+
</strong>
|
|
132
|
+
<p v-if="submitError" class="whitespace-pre-line">{{ submitError }}</p>
|
|
133
|
+
<ul v-else class="flex flex-col gap-1">
|
|
134
|
+
<li v-for="item in errorList" :key="item.path">
|
|
135
|
+
<a
|
|
136
|
+
:href="`#${item.id}`"
|
|
137
|
+
class="font-semibold text-sb-danger underline underline-offset-2"
|
|
138
|
+
>{{ item.message }}</a
|
|
139
|
+
>
|
|
140
|
+
</li>
|
|
141
|
+
</ul>
|
|
210
142
|
</div>
|
|
143
|
+
<p
|
|
144
|
+
v-if="notice"
|
|
145
|
+
role="status"
|
|
146
|
+
class="rounded-sb-control bg-sb-primary-tint p-4 text-sm"
|
|
147
|
+
>
|
|
148
|
+
{{ notice }}
|
|
149
|
+
</p>
|
|
211
150
|
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<UCheckbox
|
|
218
|
-
v-model="createAccount"
|
|
219
|
-
label="Kundenkonto anlegen"
|
|
220
|
-
description="Für schnellere Bestellungen mit gespeicherten Adressen"
|
|
221
|
-
class="w-full"
|
|
222
|
-
/>
|
|
223
|
-
</UFormField>
|
|
151
|
+
<SbSegmentedControl
|
|
152
|
+
v-model="state.accountType"
|
|
153
|
+
label="Kundenart"
|
|
154
|
+
:options="accountTypes"
|
|
155
|
+
/>
|
|
224
156
|
|
|
225
|
-
<
|
|
226
|
-
<
|
|
227
|
-
|
|
157
|
+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
158
|
+
<SbField
|
|
159
|
+
id="firstName"
|
|
160
|
+
v-slot="{ id, describedBy, invalid }"
|
|
161
|
+
label="Vorname"
|
|
162
|
+
:error="errors.firstName"
|
|
163
|
+
>
|
|
164
|
+
<SbInput
|
|
165
|
+
:id="id"
|
|
166
|
+
v-model="state.firstName"
|
|
167
|
+
name="firstName"
|
|
168
|
+
autocomplete="given-name"
|
|
169
|
+
:aria-describedby="describedBy"
|
|
170
|
+
:invalid="invalid"
|
|
171
|
+
/>
|
|
172
|
+
</SbField>
|
|
173
|
+
<SbField
|
|
174
|
+
id="lastName"
|
|
175
|
+
v-slot="{ id, describedBy, invalid }"
|
|
176
|
+
label="Nachname"
|
|
177
|
+
:error="errors.lastName"
|
|
178
|
+
>
|
|
179
|
+
<SbInput
|
|
180
|
+
:id="id"
|
|
181
|
+
v-model="state.lastName"
|
|
182
|
+
name="lastName"
|
|
183
|
+
autocomplete="family-name"
|
|
184
|
+
:aria-describedby="describedBy"
|
|
185
|
+
:invalid="invalid"
|
|
186
|
+
/>
|
|
187
|
+
</SbField>
|
|
188
|
+
</div>
|
|
228
189
|
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
190
|
+
<SbField
|
|
191
|
+
id="email"
|
|
192
|
+
v-slot="{ id, describedBy, invalid }"
|
|
193
|
+
label="E-Mail"
|
|
194
|
+
hint="Für die Bestellbestätigung"
|
|
195
|
+
:error="errors.email"
|
|
234
196
|
>
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
197
|
+
<SbInput
|
|
198
|
+
:id="id"
|
|
199
|
+
v-model="state.email"
|
|
200
|
+
name="email"
|
|
201
|
+
type="email"
|
|
202
|
+
autocomplete="email"
|
|
203
|
+
:aria-describedby="describedBy"
|
|
204
|
+
:invalid="invalid"
|
|
205
|
+
/>
|
|
206
|
+
</SbField>
|
|
207
|
+
|
|
208
|
+
<SbCheckbox
|
|
209
|
+
v-if="allowGuest"
|
|
210
|
+
v-model="createAccount"
|
|
211
|
+
label="Kundenkonto anlegen"
|
|
212
|
+
description="Für schnellere Bestellungen mit gespeicherten Adressen"
|
|
213
|
+
plain
|
|
245
214
|
/>
|
|
246
215
|
|
|
247
|
-
<
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
216
|
+
<div v-if="!state.guest" class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
217
|
+
<SbField
|
|
218
|
+
id="password"
|
|
219
|
+
v-slot="{ id, describedBy, invalid }"
|
|
220
|
+
label="Passwort"
|
|
221
|
+
hint="Mindestens 8 Zeichen"
|
|
222
|
+
:error="errors.password"
|
|
223
|
+
>
|
|
224
|
+
<SbInput
|
|
225
|
+
:id="id"
|
|
226
|
+
v-model="state.password"
|
|
227
|
+
name="password"
|
|
228
|
+
type="password"
|
|
229
|
+
autocomplete="new-password"
|
|
230
|
+
:aria-describedby="describedBy"
|
|
231
|
+
:invalid="invalid"
|
|
232
|
+
/>
|
|
233
|
+
</SbField>
|
|
234
|
+
<SbField
|
|
235
|
+
id="passwordConfirm"
|
|
236
|
+
v-slot="{ id, describedBy, invalid }"
|
|
237
|
+
label="Passwort wiederholen"
|
|
238
|
+
:error="errors.passwordConfirm"
|
|
239
|
+
>
|
|
240
|
+
<SbInput
|
|
241
|
+
:id="id"
|
|
242
|
+
v-model="state.passwordConfirm"
|
|
243
|
+
name="passwordConfirm"
|
|
244
|
+
type="password"
|
|
245
|
+
autocomplete="new-password"
|
|
246
|
+
:aria-describedby="describedBy"
|
|
247
|
+
:invalid="invalid"
|
|
248
|
+
/>
|
|
249
|
+
</SbField>
|
|
250
|
+
</div>
|
|
253
251
|
|
|
254
|
-
<
|
|
255
|
-
<
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
<fieldset class="flex flex-col gap-4 border-t border-sb-line pt-5">
|
|
253
|
+
<legend class="mb-1 font-bold">
|
|
254
|
+
{{
|
|
255
|
+
state.isShippingAddressDifferent
|
|
256
|
+
? "Rechnungsadresse"
|
|
257
|
+
: "Rechnungs- und Lieferadresse"
|
|
258
|
+
}}
|
|
259
|
+
</legend>
|
|
260
|
+
<AddressFields
|
|
261
|
+
ref="billingAddressFields"
|
|
262
|
+
v-model="state.billingAddress"
|
|
263
|
+
prefix="billingAddress"
|
|
264
|
+
:account-type="state.accountType"
|
|
265
|
+
:errors="errors"
|
|
259
266
|
/>
|
|
260
|
-
</
|
|
267
|
+
</fieldset>
|
|
261
268
|
|
|
262
|
-
<
|
|
263
|
-
|
|
269
|
+
<SbCheckbox
|
|
270
|
+
v-model="state.isShippingAddressDifferent"
|
|
271
|
+
label="Lieferadresse weicht von der Rechnungsadresse ab"
|
|
272
|
+
plain
|
|
273
|
+
/>
|
|
264
274
|
|
|
275
|
+
<fieldset
|
|
276
|
+
v-if="state.isShippingAddressDifferent"
|
|
277
|
+
class="flex flex-col gap-4 border-t border-sb-line pt-5"
|
|
278
|
+
>
|
|
279
|
+
<legend class="mb-1 font-bold">Lieferadresse</legend>
|
|
265
280
|
<AddressFields
|
|
266
281
|
ref="shippingAddressFields"
|
|
267
282
|
v-model="state.shippingAddress"
|
|
268
283
|
prefix="shippingAddress"
|
|
269
284
|
:account-type="state.accountType"
|
|
285
|
+
:errors="errors"
|
|
270
286
|
show-names
|
|
271
287
|
/>
|
|
272
|
-
</
|
|
273
|
-
|
|
274
|
-
<
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
288
|
+
</fieldset>
|
|
289
|
+
|
|
290
|
+
<div class="flex flex-col gap-1">
|
|
291
|
+
<SbCheckbox
|
|
292
|
+
id="acceptedDataProtection"
|
|
293
|
+
v-model="state.acceptedDataProtection"
|
|
294
|
+
label="Datenschutzerklärung"
|
|
295
|
+
plain
|
|
296
|
+
:invalid="!!errors.acceptedDataProtection"
|
|
297
|
+
:described-by="
|
|
298
|
+
errors.acceptedDataProtection
|
|
299
|
+
? 'acceptedDataProtection-error'
|
|
300
|
+
: undefined
|
|
301
|
+
"
|
|
302
|
+
>
|
|
303
|
+
Ich habe die
|
|
304
|
+
<NuxtLink
|
|
305
|
+
to="/datenschutz"
|
|
306
|
+
class="font-semibold text-sb-primary-ink underline underline-offset-2"
|
|
307
|
+
>Datenschutzerklärung</NuxtLink
|
|
308
|
+
>
|
|
309
|
+
gelesen und akzeptiere sie.
|
|
310
|
+
</SbCheckbox>
|
|
311
|
+
<p
|
|
312
|
+
v-if="errors.acceptedDataProtection"
|
|
313
|
+
id="acceptedDataProtection-error"
|
|
314
|
+
class="text-sm font-semibold text-sb-danger"
|
|
315
|
+
>
|
|
316
|
+
{{ errors.acceptedDataProtection }}
|
|
317
|
+
</p>
|
|
318
|
+
</div>
|
|
285
319
|
|
|
286
|
-
<
|
|
287
|
-
|
|
320
|
+
<SbButton type="submit" size="lg" block :loading="submitting">
|
|
321
|
+
Angaben speichern
|
|
322
|
+
</SbButton>
|
|
323
|
+
</form>
|
|
288
324
|
</template>
|