@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.
Files changed (193) hide show
  1. package/.github/workflows/ci.yaml +54 -0
  2. package/.nuxtrc +1 -1
  3. package/CLAUDE.md +23 -8
  4. package/app/app.vue +10 -6
  5. package/app/assets/css/main.css +100 -61
  6. package/app/components/AddToWishlist.vue +15 -25
  7. package/app/components/Address/Card.vue +6 -11
  8. package/app/components/Address/Detail.vue +23 -23
  9. package/app/components/Address/Fields.vue +175 -73
  10. package/app/components/Address/Form.vue +107 -106
  11. package/app/components/Cart/Bar.vue +6 -9
  12. package/app/components/Cart/Item.vue +48 -63
  13. package/app/components/Cart/QuickView.vue +38 -25
  14. package/app/components/Cart/Upsell.vue +24 -62
  15. package/app/components/Category/Breadcrumb.vue +29 -3
  16. package/app/components/Category/FilterGroup.vue +20 -41
  17. package/app/components/Category/Listing.vue +100 -130
  18. package/app/components/Category/SearchInput.vue +22 -19
  19. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  20. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  21. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  22. package/app/components/Checkout/Summary.vue +90 -60
  23. package/app/components/Checkout/VoucherInput.vue +40 -27
  24. package/app/components/Contact/Form.vue +164 -192
  25. package/app/components/DemoBanner.vue +5 -5
  26. package/app/components/Footer/StoreStatus.vue +2 -2
  27. package/app/components/Footer.vue +125 -57
  28. package/app/components/Header.vue +283 -18
  29. package/app/components/Home/Categories.vue +116 -0
  30. package/app/components/Home/Facts.vue +71 -0
  31. package/app/components/Home/Faq.vue +34 -16
  32. package/app/components/Home/Hero.vue +172 -0
  33. package/app/components/Home/Highlights.vue +29 -37
  34. package/app/components/Home/Restaurant.vue +102 -0
  35. package/app/components/Menu/BonCard.vue +180 -0
  36. package/app/components/Menu/CartPanel.vue +24 -0
  37. package/app/components/Menu/CategoryIndex.vue +54 -0
  38. package/app/components/Menu/OrderMode.vue +20 -0
  39. package/app/components/Menu/SectionHeader.vue +38 -0
  40. package/app/components/Navigation/MobileTop.vue +23 -15
  41. package/app/components/Order/Confirmation.vue +119 -0
  42. package/app/components/Order/Detail.vue +80 -88
  43. package/app/components/Product/CardSkeleton.vue +8 -12
  44. package/app/components/Product/Configurator.vue +8 -16
  45. package/app/components/Product/CrossSelling.vue +75 -83
  46. package/app/components/Product/DeselectIngredient.vue +17 -22
  47. package/app/components/Product/Detail.vue +35 -27
  48. package/app/components/Product/QuickView.vue +80 -51
  49. package/app/components/SalesChannelSwitch.vue +14 -28
  50. package/app/components/Sb/Button.vue +70 -0
  51. package/app/components/Sb/Checkbox.vue +73 -0
  52. package/app/components/Sb/Chip.vue +51 -0
  53. package/app/components/Sb/ChoiceGroup.vue +82 -0
  54. package/app/components/Sb/ConfirmDialog.vue +60 -0
  55. package/app/components/Sb/Field.vue +77 -0
  56. package/app/components/Sb/Icon.vue +66 -0
  57. package/app/components/Sb/IconButton.vue +55 -0
  58. package/app/components/Sb/Input.vue +23 -0
  59. package/app/components/Sb/SegmentedControl.vue +34 -0
  60. package/app/components/Sb/Select.vue +49 -0
  61. package/app/components/Sb/Sheet.vue +83 -0
  62. package/app/components/Sb/Stars.vue +60 -0
  63. package/app/components/Sb/StatusPill.vue +38 -0
  64. package/app/components/Sb/Stepper.vue +72 -0
  65. package/app/components/User/AccountHeader.vue +16 -0
  66. package/app/components/User/AuthPanel.vue +41 -0
  67. package/app/components/User/Detail.vue +32 -29
  68. package/app/components/User/LoginForm.vue +92 -98
  69. package/app/components/User/RegistrationForm.vue +285 -249
  70. package/app/components/Wishlist.vue +55 -155
  71. package/app/composables/useCartMutations.ts +9 -27
  72. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  73. package/app/composables/useContactForm.ts +66 -0
  74. package/app/composables/useHomeMenuCategories.ts +41 -0
  75. package/app/composables/useNavigation.ts +10 -2
  76. package/app/composables/useOrderMode.ts +65 -0
  77. package/app/composables/useRegistrationForm.ts +161 -0
  78. package/app/composables/useRestaurantSchema.ts +1 -1
  79. package/app/composables/useShareLink.ts +3 -13
  80. package/app/composables/useSortingSelection.ts +13 -0
  81. package/app/composables/useThemePreset.ts +15 -0
  82. package/app/composables/useVoucherCode.ts +7 -16
  83. package/app/composables/useWishlistActions.ts +0 -51
  84. package/app/error.vue +31 -9
  85. package/app/layouts/account.vue +45 -50
  86. package/app/layouts/default.vue +2 -3
  87. package/app/layouts/listing.vue +3 -5
  88. package/app/pages/[...all].vue +8 -4
  89. package/app/pages/account/recover/password/index.vue +113 -80
  90. package/app/pages/anmelden.vue +11 -10
  91. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  92. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  93. package/app/pages/bestellung/[id]/index.vue +3 -85
  94. package/app/pages/bestellung/kasse.vue +29 -0
  95. package/app/pages/bestellung.vue +8 -60
  96. package/app/pages/index.vue +12 -52
  97. package/app/pages/kontakt.vue +27 -7
  98. package/app/pages/konto/adressen.vue +106 -102
  99. package/app/pages/konto/bestellung/[id].vue +9 -43
  100. package/app/pages/konto/bestellungen.vue +55 -33
  101. package/app/pages/konto/index.vue +47 -62
  102. package/app/pages/konto/profil.vue +162 -100
  103. package/app/pages/maintenance.vue +8 -6
  104. package/app/pages/merkliste.vue +7 -8
  105. package/app/pages/passwort-vergessen.vue +92 -75
  106. package/app/pages/registrierung/bestaetigen.vue +20 -48
  107. package/app/pages/registrierung/index.vue +16 -7
  108. package/app/pages/suche.vue +94 -95
  109. package/app/plugins/theme-preset.ts +9 -0
  110. package/app/utils/highlight.ts +25 -0
  111. package/app/utils/product.ts +9 -0
  112. package/app/validation/registrationSchema.ts +1 -1
  113. package/docs/notes/2026-10-07-issue-434-property-group-projection.md +27 -0
  114. package/docs/notes/2026-10-07-listing-payload.md +38 -0
  115. package/docs/notes/2026-10-07-nuxt-4.6-inline-error-rendering.md +31 -0
  116. package/modules/theme.ts +115 -0
  117. package/nuxt.config.ts +27 -15
  118. package/package.json +6 -8
  119. package/playwright.config.ts +11 -0
  120. package/server/api/listing/[categoryId].get.ts +10 -11
  121. package/server/api/product/[productId].get.ts +4 -2
  122. package/server/api/product/variant.get.ts +1 -2
  123. package/server/api/search.get.ts +7 -12
  124. package/shared/theme/presets.ts +303 -0
  125. package/test/a11y/presets.test.ts +225 -0
  126. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  127. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  128. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  129. package/test/nuxt/CartItem.test.ts +18 -3
  130. package/test/nuxt/CartUpsell.test.ts +1 -2
  131. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  132. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  133. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  134. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  135. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  136. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  137. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  138. package/test/nuxt/HomeFaq.test.ts +3 -2
  139. package/test/nuxt/MenuBonCard.test.ts +122 -0
  140. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  141. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  142. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  143. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  144. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  145. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  146. package/test/nuxt/RegistrationForm.test.ts +89 -270
  147. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  148. package/test/nuxt/SbStars.test.ts +25 -0
  149. package/test/nuxt/useCartMutations.test.ts +3 -17
  150. package/test/nuxt/useCartUpsell.test.ts +1 -1
  151. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  152. package/test/nuxt/useShareLink.test.ts +1 -9
  153. package/test/nuxt/useWishlistActions.test.ts +3 -26
  154. package/test/unit/highlight.spec.ts +31 -0
  155. package/test/unit/product.spec.ts +12 -0
  156. package/test/unit/themePresets.spec.ts +61 -0
  157. package/app/app.config.ts +0 -19
  158. package/app/components/AnimatedSection.vue +0 -74
  159. package/app/components/BottomNavi.vue +0 -70
  160. package/app/components/Category/Header.vue +0 -48
  161. package/app/components/Checkout/PaymentMethod.vue +0 -30
  162. package/app/components/Checkout/ShippingMethod.vue +0 -30
  163. package/app/components/Cta.vue +0 -30
  164. package/app/components/Feature/Card.vue +0 -121
  165. package/app/components/Features.vue +0 -42
  166. package/app/components/Footer/Contact.vue +0 -82
  167. package/app/components/Header/Body.vue +0 -82
  168. package/app/components/Header/Right.vue +0 -187
  169. package/app/components/Header/Title.vue +0 -10
  170. package/app/components/Hero.vue +0 -233
  171. package/app/components/Home/MenuCategories.vue +0 -148
  172. package/app/components/ImageGallery.vue +0 -63
  173. package/app/components/Loading.vue +0 -29
  174. package/app/components/Navigation/DesktopLeft.vue +0 -39
  175. package/app/components/Product/Card.vue +0 -177
  176. package/app/components/Product/CardCompact.vue +0 -72
  177. package/app/components/Product/CardDietBadges.vue +0 -43
  178. package/app/components/Product/CardIngredients.vue +0 -35
  179. package/app/components/Product/CardKitchen.vue +0 -34
  180. package/app/components/Product/Category.vue +0 -160
  181. package/app/components/Product/SearchBar.vue +0 -95
  182. package/app/components/PublicAnnouncement.vue +0 -17
  183. package/app/pages/bestellung/bestaetigen.vue +0 -16
  184. package/app/pages/bestellung/warenkorb.vue +0 -49
  185. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  186. package/test/nuxt/AddressFields.test.ts +0 -222
  187. package/test/nuxt/AnimatedSection.test.ts +0 -67
  188. package/test/nuxt/ContactForm.test.ts +0 -207
  189. package/test/nuxt/FooterContact.test.ts +0 -102
  190. package/test/nuxt/HeaderRight.test.ts +0 -142
  191. package/test/nuxt/Hero.test.ts +0 -126
  192. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  193. 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
- * With double opt-in enabled in Shopware the customer stays inactive until the
81
- * confirmation link is clicked, so there is no session to continue with.
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
- function needsEmailConfirmation(customer: Schemas["Customer"] | undefined) {
84
- return !!customer?.doubleOptInRegistration && !customer?.active;
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
- if (!registrationData.billingAddress.lastName && registrationData.lastName) {
108
- registrationData.billingAddress.lastName = registrationData.lastName;
109
- }
15
+ const emit = defineEmits<{
16
+ "registration-success": [
17
+ data: RegistrationSchema,
18
+ customer: Schemas["Customer"] | undefined,
19
+ ];
20
+ }>();
110
21
 
111
- if (!state.isShippingAddressDifferent) {
112
- delete registrationData.shippingAddress;
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
- if (registrationData.guest) {
116
- delete registrationData.password;
117
- delete registrationData.passwordConfirm;
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 customer: Schemas["Customer"] | undefined =
122
- // @ts-expect-error - password is required in the API type but not for guests
123
- await register(registrationData);
124
-
125
- if (needsEmailConfirmation(customer)) {
126
- toast.add({
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
- emit(
142
- "registration-success",
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
- toast.add({
159
- title: "Registrierung fehlgeschlagen",
160
- description,
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
- <UForm
187
- :schema="schema"
188
- :state="state"
189
- class="space-y-4"
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
- <UFormField name="accountType">
194
- <USelect
195
- v-model="state.accountType"
196
- value-key="value"
197
- :items="accountTypes"
198
- class="w-full"
199
- />
200
- </UFormField>
201
-
202
- <div class="flex flex-row justify-between gap-4">
203
- <UFormField label="Vorname" name="firstName" required class="w-full">
204
- <UInput v-model="state.firstName" type="text" class="w-full" />
205
- </UFormField>
206
-
207
- <UFormField label="Nachname" name="lastName" required class="w-full">
208
- <UInput v-model="state.lastName" type="text" class="w-full" />
209
- </UFormField>
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
- <UFormField label="Email" name="email" required>
213
- <UInput v-model="state.email" class="w-full" />
214
- </UFormField>
215
-
216
- <UFormField v-if="allowGuest" name="guest">
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
- <UFormField v-if="!state.guest" label="Passwort" name="password" required>
226
- <UInput v-model="state.password" type="password" class="w-full" />
227
- </UFormField>
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
- <UFormField
230
- v-if="!state.guest"
231
- label="Passwort wiederholen"
232
- name="passwordConfirm"
233
- required
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
- <UInput v-model="state.passwordConfirm" type="password" class="w-full" />
236
- </UFormField>
237
-
238
- <USeparator
239
- color="primary"
240
- :label="
241
- state.isShippingAddressDifferent
242
- ? 'Rechnungsadresse'
243
- : 'Rechnungs- und Lieferadresse'
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
- <AddressFields
248
- ref="billingAddressFields"
249
- v-model="state.billingAddress"
250
- prefix="billingAddress"
251
- :account-type="state.accountType"
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
- <UFormField name="isShippingAddressDifferent">
255
- <UCheckbox
256
- v-model="state.isShippingAddressDifferent"
257
- label="Rechnungsadresse weicht von Lieferadresse ab"
258
- class="w-full"
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
- </UFormField>
267
+ </fieldset>
261
268
 
262
- <template v-if="state.isShippingAddressDifferent">
263
- <USeparator color="primary" label="Lieferadresse" />
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
- </template>
273
-
274
- <UFormField name="acceptedDataProtection">
275
- <UCheckbox v-model="state.acceptedDataProtection" class="w-full">
276
- <template #label>
277
- <span>
278
- Ich habe die
279
- <ULink to="/datenschutz"> Datenschutzbestimmungen </ULink>
280
- gelesen und akzeptiere diese.
281
- </span>
282
- </template>
283
- </UCheckbox>
284
- </UFormField>
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
- <UButton block type="submit">Speichern</UButton>
287
- </UForm>
320
+ <SbButton type="submit" size="lg" block :loading="submitting">
321
+ Angaben speichern
322
+ </SbButton>
323
+ </form>
288
324
  </template>