@shopbite-de/storefront 1.31.3 → 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 (185) hide show
  1. package/.github/workflows/ci.yaml +54 -0
  2. package/CLAUDE.md +23 -8
  3. package/app/app.vue +10 -6
  4. package/app/assets/css/main.css +100 -61
  5. package/app/components/AddToWishlist.vue +15 -25
  6. package/app/components/Address/Card.vue +6 -11
  7. package/app/components/Address/Detail.vue +23 -23
  8. package/app/components/Address/Fields.vue +175 -73
  9. package/app/components/Address/Form.vue +107 -106
  10. package/app/components/Cart/Bar.vue +6 -9
  11. package/app/components/Cart/Item.vue +48 -63
  12. package/app/components/Cart/QuickView.vue +38 -25
  13. package/app/components/Cart/Upsell.vue +24 -62
  14. package/app/components/Category/Breadcrumb.vue +29 -3
  15. package/app/components/Category/FilterGroup.vue +20 -41
  16. package/app/components/Category/Listing.vue +100 -130
  17. package/app/components/Category/SearchInput.vue +22 -19
  18. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  19. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  20. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  21. package/app/components/Checkout/Summary.vue +90 -60
  22. package/app/components/Checkout/VoucherInput.vue +40 -27
  23. package/app/components/Contact/Form.vue +164 -192
  24. package/app/components/DemoBanner.vue +5 -5
  25. package/app/components/Footer/StoreStatus.vue +2 -2
  26. package/app/components/Footer.vue +125 -57
  27. package/app/components/Header.vue +283 -18
  28. package/app/components/Home/Categories.vue +116 -0
  29. package/app/components/Home/Facts.vue +71 -0
  30. package/app/components/Home/Faq.vue +34 -16
  31. package/app/components/Home/Hero.vue +172 -0
  32. package/app/components/Home/Highlights.vue +29 -37
  33. package/app/components/Home/Restaurant.vue +102 -0
  34. package/app/components/Menu/BonCard.vue +180 -0
  35. package/app/components/Menu/CartPanel.vue +24 -0
  36. package/app/components/Menu/CategoryIndex.vue +54 -0
  37. package/app/components/Menu/OrderMode.vue +20 -0
  38. package/app/components/Menu/SectionHeader.vue +38 -0
  39. package/app/components/Navigation/MobileTop.vue +23 -15
  40. package/app/components/Order/Confirmation.vue +119 -0
  41. package/app/components/Order/Detail.vue +80 -88
  42. package/app/components/Product/CardSkeleton.vue +8 -12
  43. package/app/components/Product/Configurator.vue +8 -16
  44. package/app/components/Product/CrossSelling.vue +75 -83
  45. package/app/components/Product/DeselectIngredient.vue +17 -22
  46. package/app/components/Product/Detail.vue +35 -27
  47. package/app/components/Product/QuickView.vue +80 -51
  48. package/app/components/SalesChannelSwitch.vue +14 -28
  49. package/app/components/Sb/Button.vue +70 -0
  50. package/app/components/Sb/Checkbox.vue +73 -0
  51. package/app/components/Sb/Chip.vue +51 -0
  52. package/app/components/Sb/ChoiceGroup.vue +82 -0
  53. package/app/components/Sb/ConfirmDialog.vue +60 -0
  54. package/app/components/Sb/Field.vue +77 -0
  55. package/app/components/Sb/Icon.vue +66 -0
  56. package/app/components/Sb/IconButton.vue +55 -0
  57. package/app/components/Sb/Input.vue +23 -0
  58. package/app/components/Sb/SegmentedControl.vue +34 -0
  59. package/app/components/Sb/Select.vue +49 -0
  60. package/app/components/Sb/Sheet.vue +83 -0
  61. package/app/components/Sb/Stars.vue +60 -0
  62. package/app/components/Sb/StatusPill.vue +38 -0
  63. package/app/components/Sb/Stepper.vue +72 -0
  64. package/app/components/User/AccountHeader.vue +16 -0
  65. package/app/components/User/AuthPanel.vue +41 -0
  66. package/app/components/User/Detail.vue +32 -29
  67. package/app/components/User/LoginForm.vue +92 -98
  68. package/app/components/User/RegistrationForm.vue +285 -249
  69. package/app/components/Wishlist.vue +55 -155
  70. package/app/composables/useCartMutations.ts +9 -27
  71. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  72. package/app/composables/useContactForm.ts +66 -0
  73. package/app/composables/useHomeMenuCategories.ts +41 -0
  74. package/app/composables/useNavigation.ts +10 -2
  75. package/app/composables/useOrderMode.ts +65 -0
  76. package/app/composables/useRegistrationForm.ts +161 -0
  77. package/app/composables/useRestaurantSchema.ts +1 -1
  78. package/app/composables/useShareLink.ts +3 -13
  79. package/app/composables/useSortingSelection.ts +13 -0
  80. package/app/composables/useThemePreset.ts +15 -0
  81. package/app/composables/useVoucherCode.ts +7 -16
  82. package/app/composables/useWishlistActions.ts +0 -51
  83. package/app/error.vue +31 -9
  84. package/app/layouts/account.vue +45 -50
  85. package/app/layouts/default.vue +2 -3
  86. package/app/layouts/listing.vue +3 -5
  87. package/app/pages/[...all].vue +8 -4
  88. package/app/pages/account/recover/password/index.vue +113 -80
  89. package/app/pages/anmelden.vue +11 -10
  90. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  91. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  92. package/app/pages/bestellung/[id]/index.vue +3 -85
  93. package/app/pages/bestellung/kasse.vue +29 -0
  94. package/app/pages/bestellung.vue +8 -60
  95. package/app/pages/index.vue +12 -52
  96. package/app/pages/kontakt.vue +27 -7
  97. package/app/pages/konto/adressen.vue +106 -102
  98. package/app/pages/konto/bestellung/[id].vue +9 -43
  99. package/app/pages/konto/bestellungen.vue +55 -33
  100. package/app/pages/konto/index.vue +47 -62
  101. package/app/pages/konto/profil.vue +162 -100
  102. package/app/pages/maintenance.vue +8 -6
  103. package/app/pages/merkliste.vue +7 -8
  104. package/app/pages/passwort-vergessen.vue +92 -75
  105. package/app/pages/registrierung/bestaetigen.vue +20 -48
  106. package/app/pages/registrierung/index.vue +16 -7
  107. package/app/pages/suche.vue +94 -95
  108. package/app/plugins/theme-preset.ts +9 -0
  109. package/app/utils/highlight.ts +25 -0
  110. package/app/utils/product.ts +9 -0
  111. package/app/validation/registrationSchema.ts +1 -1
  112. package/modules/theme.ts +115 -0
  113. package/nuxt.config.ts +27 -15
  114. package/package.json +6 -8
  115. package/playwright.config.ts +11 -0
  116. package/server/api/listing/[categoryId].get.ts +3 -0
  117. package/shared/theme/presets.ts +303 -0
  118. package/test/a11y/presets.test.ts +225 -0
  119. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  120. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  121. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  122. package/test/nuxt/CartItem.test.ts +18 -3
  123. package/test/nuxt/CartUpsell.test.ts +1 -2
  124. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  125. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  126. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  127. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  128. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  129. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  130. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  131. package/test/nuxt/HomeFaq.test.ts +3 -2
  132. package/test/nuxt/MenuBonCard.test.ts +122 -0
  133. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  134. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  135. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  136. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  137. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  138. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  139. package/test/nuxt/RegistrationForm.test.ts +89 -270
  140. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  141. package/test/nuxt/SbStars.test.ts +25 -0
  142. package/test/nuxt/useCartMutations.test.ts +3 -17
  143. package/test/nuxt/useCartUpsell.test.ts +1 -1
  144. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  145. package/test/nuxt/useShareLink.test.ts +1 -9
  146. package/test/nuxt/useWishlistActions.test.ts +3 -26
  147. package/test/unit/highlight.spec.ts +31 -0
  148. package/test/unit/product.spec.ts +12 -0
  149. package/test/unit/themePresets.spec.ts +61 -0
  150. package/app/app.config.ts +0 -19
  151. package/app/components/AnimatedSection.vue +0 -74
  152. package/app/components/BottomNavi.vue +0 -70
  153. package/app/components/Category/Header.vue +0 -48
  154. package/app/components/Checkout/PaymentMethod.vue +0 -30
  155. package/app/components/Checkout/ShippingMethod.vue +0 -30
  156. package/app/components/Cta.vue +0 -30
  157. package/app/components/Feature/Card.vue +0 -121
  158. package/app/components/Features.vue +0 -42
  159. package/app/components/Footer/Contact.vue +0 -82
  160. package/app/components/Header/Body.vue +0 -82
  161. package/app/components/Header/Right.vue +0 -187
  162. package/app/components/Header/Title.vue +0 -10
  163. package/app/components/Hero.vue +0 -233
  164. package/app/components/Home/MenuCategories.vue +0 -148
  165. package/app/components/ImageGallery.vue +0 -63
  166. package/app/components/Loading.vue +0 -29
  167. package/app/components/Navigation/DesktopLeft.vue +0 -39
  168. package/app/components/Product/Card.vue +0 -177
  169. package/app/components/Product/CardCompact.vue +0 -72
  170. package/app/components/Product/CardDietBadges.vue +0 -43
  171. package/app/components/Product/CardIngredients.vue +0 -35
  172. package/app/components/Product/CardKitchen.vue +0 -34
  173. package/app/components/Product/SearchBar.vue +0 -95
  174. package/app/components/PublicAnnouncement.vue +0 -17
  175. package/app/pages/bestellung/bestaetigen.vue +0 -16
  176. package/app/pages/bestellung/warenkorb.vue +0 -49
  177. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  178. package/test/nuxt/AddressFields.test.ts +0 -222
  179. package/test/nuxt/AnimatedSection.test.ts +0 -67
  180. package/test/nuxt/ContactForm.test.ts +0 -207
  181. package/test/nuxt/FooterContact.test.ts +0 -102
  182. package/test/nuxt/HeaderRight.test.ts +0 -142
  183. package/test/nuxt/Hero.test.ts +0 -126
  184. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  185. package/test/nuxt/LoginForm.test.ts +0 -159
@@ -1,10 +1,13 @@
1
1
  <script setup lang="ts">
2
- import type {
3
- RadioGroupItem,
4
- RadioGroupValue,
5
- } from "#ui/components/RadioGroup.vue";
6
2
  import type { Schemas } from "#shopware";
7
3
 
4
+ // The one-page checkout of the presets shows shipping and payment as
5
+ // separate numbered sections (#443).
6
+ const props = withDefaults(
7
+ defineProps<{ part?: "both" | "shipping" | "payment" }>(),
8
+ { part: "both" },
9
+ );
10
+
8
11
  const {
9
12
  paymentMethods,
10
13
  getPaymentMethods,
@@ -19,7 +22,36 @@ const {
19
22
  const { refreshCart } = useCart();
20
23
  const { ensureAvailableCheckoutMethods } = useCheckoutMethodGuard();
21
24
 
22
- const toast = useToast();
25
+ // Presets: shipping first (payment rules can depend on it), as cards (#443).
26
+ const shippingOptions = computed(() =>
27
+ (shippingMethods.value ?? []).map((method: Schemas["ShippingMethod"]) => ({
28
+ value: method.id,
29
+ label: method.translated?.name ?? method.name,
30
+ description:
31
+ method.translated?.description ?? method.description ?? undefined,
32
+ })),
33
+ );
34
+ const paymentOptions = computed(() =>
35
+ (paymentMethods.value ?? []).map((method: Schemas["PaymentMethod"]) => ({
36
+ value: method.id,
37
+ label: method.distinguishableName ?? method.name,
38
+ description:
39
+ method.translated?.description ?? method.description ?? undefined,
40
+ })),
41
+ );
42
+ const shippingModel = computed({
43
+ get: () =>
44
+ (selectedShippingMethodId.value as string | undefined) ?? undefined,
45
+ set: (value: string | undefined) => {
46
+ selectedShippingMethodId.value = value;
47
+ },
48
+ });
49
+ const paymentModel = computed({
50
+ get: () => (selectedPaymentMethodId.value as string | undefined) ?? undefined,
51
+ set: (value: string | undefined) => {
52
+ selectedPaymentMethodId.value = value;
53
+ },
54
+ });
23
55
 
24
56
  onMounted(async () => {
25
57
  try {
@@ -30,26 +62,10 @@ onMounted(async () => {
30
62
  }
31
63
  });
32
64
 
33
- const selectablePaymentMethods = computed<RadioGroupItem[]>(() => {
34
- return paymentMethods.value?.map((method: Schemas["PaymentMethod"]) => ({
35
- label: method.distinguishableName,
36
- description: method.description,
37
- value: method.id,
38
- }));
39
- });
40
-
41
- const selectableShippingMethods = computed<RadioGroupItem[]>(() => {
42
- return shippingMethods.value?.map((method: Schemas["ShippingMethod"]) => ({
43
- label: method.name,
44
- description: method.description,
45
- value: method.id,
46
- }));
47
- });
48
-
49
- const selectedPaymentMethodId = ref<RadioGroupValue | undefined>(
65
+ const selectedPaymentMethodId = ref<string | undefined>(
50
66
  selectedPaymentMethod.value?.id,
51
67
  );
52
- const selectedShippingMethodId = ref<RadioGroupValue | undefined>(
68
+ const selectedShippingMethodId = ref<string | undefined>(
53
69
  selectedShippingMethod.value?.id,
54
70
  );
55
71
 
@@ -62,76 +78,88 @@ watch(selectedShippingMethod, (method) => {
62
78
  selectedShippingMethodId.value = method?.id;
63
79
  });
64
80
 
65
- watch(
66
- selectedPaymentMethodId,
67
- async (newValue: RadioGroupValue | undefined) => {
68
- if (newValue === undefined) return;
69
- if (selectedPaymentMethod.value === null) return;
70
- if (newValue === selectedPaymentMethod.value.id) return;
71
- await setPaymentMethod({ id: newValue as string });
72
- toast.add({
73
- title: "Zahlart geändert",
74
- description:
75
- selectedPaymentMethod.value.distinguishableName + " ausgewählt",
76
- color: "success",
77
- progress: false,
78
- });
79
- },
80
- );
81
+ watch(selectedPaymentMethodId, async (newValue: string | undefined) => {
82
+ if (newValue === undefined) return;
83
+ if (selectedPaymentMethod.value === null) return;
84
+ if (newValue === selectedPaymentMethod.value.id) return;
85
+ await setPaymentMethod({ id: newValue as string });
86
+ });
81
87
 
82
- watch(
83
- selectedShippingMethodId,
84
- async (newValue: RadioGroupValue | undefined) => {
85
- if (newValue === undefined) return;
86
- if (selectedShippingMethod.value === null) return;
87
- if (newValue === selectedShippingMethod.value.id) return;
88
- await setShippingMethod({ id: newValue as string });
89
- await refreshCart();
90
- toast.add({
91
- title: "Versandart geändert",
92
- description: selectedShippingMethod.value.name + " ausgewählt",
93
- color: "success",
94
- progress: false,
95
- });
96
- },
97
- );
88
+ watch(selectedShippingMethodId, async (newValue: string | undefined) => {
89
+ if (newValue === undefined) return;
90
+ if (selectedShippingMethod.value === null) return;
91
+ if (newValue === selectedShippingMethod.value.id) return;
92
+ await setShippingMethod({ id: newValue as string });
93
+ await refreshCart();
94
+ });
98
95
  </script>
99
96
 
100
97
  <template>
101
- <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
102
- <div class="flex flex-col gap-4">
103
- <div class="flex items-center gap-2">
104
- <UIcon name="i-lucide-badge-euro" class="size-5 text-muted" />
105
- <h2 class="text-lg font-semibold">Zahlungsarten</h2>
106
- <UButton
107
- to="/zahlung-und-versand"
108
- size="sm"
109
- variant="ghost"
110
- icon="i-lucide-circle-help"
111
- />
98
+ <div
99
+ v-if="props.part !== 'both'"
100
+ class="flex flex-col gap-3 font-body text-sb-ink"
101
+ >
102
+ <SbChoiceGroup
103
+ v-if="props.part === 'shipping'"
104
+ v-model="shippingModel"
105
+ legend="Versandarten"
106
+ hide-legend
107
+ variant="cards"
108
+ :options="shippingOptions"
109
+ />
110
+ <SbChoiceGroup
111
+ v-else
112
+ v-model="paymentModel"
113
+ legend="Zahlungsarten"
114
+ hide-legend
115
+ variant="cards"
116
+ :options="paymentOptions"
117
+ />
118
+ <NuxtLink
119
+ to="/zahlung-und-versand"
120
+ class="inline-flex min-h-11 items-center self-start text-sm font-semibold text-sb-primary-ink underline underline-offset-4 focus-visible:outline-3 focus-visible:outline-sb-focus"
121
+ >
122
+ {{
123
+ props.part === "shipping"
124
+ ? "Liefergebiet und Versandkosten"
125
+ : "Mehr zu den Zahlungsarten"
126
+ }}
127
+ </NuxtLink>
128
+ </div>
129
+ <div v-else class="flex flex-col gap-8 font-body text-sb-ink">
130
+ <section class="flex flex-col gap-3" aria-labelledby="checkout-shipping">
131
+ <div class="flex items-center justify-between gap-3">
132
+ <h2 id="checkout-shipping" class="font-display text-[28px]">
133
+ Lieferung oder Abholung
134
+ </h2>
135
+ <SbButton variant="ghost" to="/zahlung-und-versand">
136
+ Versandarten erklärt
137
+ </SbButton>
112
138
  </div>
113
- <URadioGroup
114
- v-model="selectedPaymentMethodId"
115
- :items="selectablePaymentMethods"
116
- variant="card"
139
+ <SbChoiceGroup
140
+ v-model="shippingModel"
141
+ legend="Versandarten"
142
+ hide-legend
143
+ variant="cards"
144
+ :options="shippingOptions"
117
145
  />
118
- </div>
119
- <div class="flex flex-col gap-4">
120
- <div class="flex items-center gap-2">
121
- <UIcon name="i-lucide-car" class="size-5 text-muted" />
122
- <h2 class="text-lg font-semibold">Versandarten</h2>
123
- <UButton
124
- to="/zahlung-und-versand"
125
- size="sm"
126
- variant="ghost"
127
- icon="i-lucide-circle-help"
128
- />
146
+ </section>
147
+ <section class="flex flex-col gap-3" aria-labelledby="checkout-payment">
148
+ <div class="flex items-center justify-between gap-3">
149
+ <h2 id="checkout-payment" class="font-display text-[28px]">
150
+ Bezahlung
151
+ </h2>
152
+ <SbButton variant="ghost" to="/zahlung-und-versand">
153
+ Zahlungsarten erklärt
154
+ </SbButton>
129
155
  </div>
130
- <URadioGroup
131
- v-model="selectedShippingMethodId"
132
- :items="selectableShippingMethods"
133
- variant="card"
156
+ <SbChoiceGroup
157
+ v-model="paymentModel"
158
+ legend="Zahlungsarten"
159
+ hide-legend
160
+ variant="cards"
161
+ :options="paymentOptions"
134
162
  />
135
- </div>
163
+ </section>
136
164
  </div>
137
165
  </template>
@@ -21,7 +21,13 @@ const {
21
21
  public: { storeUrl },
22
22
  } = useRuntimeConfig();
23
23
 
24
- const toast = useToast();
24
+ // The one-page checkout (#443): errors show in the form, next to the order
25
+ // button.
26
+ const orderError = ref<{ title: string; description: string } | null>(null);
27
+
28
+ function reportError(message: { title: string; description: string }) {
29
+ orderError.value = message;
30
+ }
25
31
 
26
32
  onMounted(() => {
27
33
  refresh();
@@ -55,21 +61,15 @@ const { handlePayment, paymentUrl } = useOrderPayment(
55
61
  async function hasAvailableCheckoutMethods(): Promise<boolean> {
56
62
  try {
57
63
  if (await ensureAvailableCheckoutMethods()) return true;
58
- toast.add({
64
+ reportError({
59
65
  title: `Keine ${blockedMethodLabel.value} verfügbar`,
60
66
  description: `Für deine Bestellung ist aktuell keine ${blockedMethodLabel.value} verfügbar. Bitte prüfe deine Adresse und deinen Warenkorb.`,
61
- color: "error",
62
- icon: blockedMethodIcon.value,
63
- progress: false,
64
67
  });
65
68
  } catch (error) {
66
69
  console.error("[checkout][ensureAvailableCheckoutMethods]", error);
67
- toast.add({
70
+ reportError({
68
71
  title: "Versand- und Zahlart konnten nicht geprüft werden",
69
72
  description: "Bitte versuche es in einem Moment erneut.",
70
- color: "error",
71
- icon: "i-lucide-x-circle",
72
- progress: false,
73
73
  });
74
74
  }
75
75
  return false;
@@ -77,6 +77,7 @@ async function hasAvailableCheckoutMethods(): Promise<boolean> {
77
77
 
78
78
  async function handleCreateOrder() {
79
79
  isPlacingOrder.value = true;
80
+ orderError.value = null;
80
81
  try {
81
82
  if (!(await hasAvailableCheckoutMethods())) return;
82
83
 
@@ -98,22 +99,13 @@ async function handleCreateOrder() {
98
99
  }
99
100
 
100
101
  await refreshCart();
101
- toast.add({
102
- title: "Bestellung aufgegeben!",
103
- icon: "i-lucide-shopping-cart",
104
- color: "success",
105
- progress: false,
106
- });
107
102
  navigateTo(`/bestellung/${order.id}/erfolg`);
108
103
  } catch (error) {
109
104
  console.error("[checkout][createOrder]", error);
110
- toast.add({
105
+ reportError({
111
106
  title: "Bestellung fehlgeschlagen",
112
107
  description:
113
108
  "Deine Bestellung konnte nicht aufgegeben werden. Bitte prüfe deine Angaben und versuche es erneut.",
114
- color: "error",
115
- icon: "i-lucide-x-circle",
116
- progress: false,
117
109
  });
118
110
  await refreshCart().catch(() => {});
119
111
  } finally {
@@ -142,9 +134,6 @@ const isValidToProceed = computed(
142
134
  const blockedMethodLabel = computed(() =>
143
135
  isShippingMethodBlocked.value ? "Versandart" : "Zahlart",
144
136
  );
145
- const blockedMethodIcon = computed(() =>
146
- isShippingMethodBlocked.value ? "i-lucide-truck" : "i-lucide-badge-euro",
147
- );
148
137
 
149
138
  const isPlacingOrder = ref(false);
150
139
  const selectedDeliveryTime = ref("");
@@ -153,9 +142,16 @@ const selectedDeliveryTime = ref("");
153
142
  // order button differently on the server and at hydration (#339).
154
143
  const isValidTime = ref(false);
155
144
 
145
+ const checkoutSections = [
146
+ { id: "versand", number: 1, title: "Lieferung oder Abholung" },
147
+ { id: "zeit", number: 2, title: "Wann?" },
148
+ { id: "angaben", number: 3, title: "Ihre Angaben" },
149
+ { id: "bezahlung", number: 4, title: "Bezahlung" },
150
+ ] as const;
151
+
156
152
  const checkoutButtonLabel = computed<string>(() => {
157
153
  if (!customerDataAvailable.value) {
158
- return "Bitte einloggen oder Kundendaten erfassen";
154
+ return "Bitte zuerst Ihre Angaben speichern";
159
155
  }
160
156
 
161
157
  // app.vue loads business hours and holidays after mounting. Until then (or
@@ -181,59 +177,93 @@ const checkoutButtonLabel = computed<string>(() => {
181
177
  return `Aktuell ist keine ${blockedMethodLabel.value} verfügbar`;
182
178
  }
183
179
 
184
- return "Jetzt bestellen!";
180
+ return "Zahlungspflichtig bestellen";
185
181
  });
186
182
  </script>
187
183
 
188
184
  <template>
189
- <div class="grid grid-cols-1 md:grid-cols-2 gap-8 py-8">
190
- <div class="flex flex-col gap-6">
191
- <div class="flex flex-col gap-4">
192
- <h3 class="text-lg font-semibold">Kundendaten</h3>
193
- <UserDetail v-if="customerDataAvailable" />
194
- <p v-else class="text-muted">
195
- Bitte vorher einloggen oder Kundendaten erfassen
196
- </p>
197
- </div>
198
- <div class="flex flex-col gap-4">
199
- <h3 class="text-lg font-semibold">Versand & Zahlung</h3>
200
- <CheckoutPaymentMethod :payment-method="selectedPaymentMethod" />
201
- <CheckoutShippingMethod :shipping-method="selectedShippingMethod" />
185
+ <div
186
+ class="grid grid-cols-1 gap-8 font-body text-sb-ink lg:grid-cols-[minmax(0,1fr)_400px] lg:gap-12"
187
+ >
188
+ <div class="flex min-w-0 flex-col gap-4">
189
+ <section
190
+ v-for="section in checkoutSections"
191
+ :key="section.id"
192
+ :aria-labelledby="`kasse-${section.id}`"
193
+ class="rounded-sb-card border border-sb-line bg-sb-surface p-5 sm:p-7"
194
+ >
195
+ <h2
196
+ :id="`kasse-${section.id}`"
197
+ class="mb-4 flex items-baseline gap-3 font-display text-2xl leading-tight sm:text-[28px]"
198
+ >
199
+ <span class="text-sb-accent">{{ section.number }}</span>
200
+ {{ section.title }}
201
+ </h2>
202
+ <CheckoutPaymentAndDelivery
203
+ v-if="section.id === 'versand'"
204
+ part="shipping"
205
+ />
202
206
  <CheckoutDeliveryTimeSelect
207
+ v-else-if="section.id === 'zeit'"
203
208
  v-model:valid="isValidTime"
204
209
  v-model="selectedDeliveryTime"
205
210
  />
206
- </div>
207
- </div>
208
- <div class="flex flex-col gap-4">
209
- <h3 class="text-lg font-semibold">Warenkorb</h3>
210
- <UCard>
211
- <QuickView
212
- :with-quantity-input="false"
213
- :with-delete-button="false"
214
- :with-upsell="true"
211
+ <template v-else-if="section.id === 'angaben'">
212
+ <UserDetail v-if="customerDataAvailable" :with-edit-button="true" />
213
+ <CheckoutLoginOrRegister v-else />
214
+ </template>
215
+ <CheckoutPaymentAndDelivery
216
+ v-else-if="section.id === 'bezahlung'"
217
+ part="payment"
215
218
  />
216
- </UCard>
219
+ </section>
220
+ </div>
221
+ <section
222
+ class="flex h-max flex-col gap-4 rounded-sb-card border border-sb-line bg-sb-surface p-6 lg:sticky lg:top-24"
223
+ aria-labelledby="kasse-bestellung"
224
+ >
225
+ <h2 id="kasse-bestellung" class="font-display text-[28px] leading-none">
226
+ Ihre Bestellung
227
+ </h2>
228
+ <QuickView :with-upsell="true" />
217
229
  <CheckoutVoucherInput />
218
- <UButton
219
- :icon="isValidToProceed ? 'i-lucide-shopping-cart' : 'i-lucide-lock'"
230
+ <div
231
+ v-if="orderError"
232
+ role="alert"
233
+ class="flex gap-3 rounded-sb-control border-[1.5px] border-sb-danger p-4 text-sm"
234
+ >
235
+ <span class="font-bold text-sb-danger">!</span>
236
+ <span>
237
+ <strong class="block">{{ orderError.title }}</strong>
238
+ {{ orderError.description }}
239
+ </span>
240
+ </div>
241
+ <SbButton
242
+ block
243
+ size="lg"
244
+ class="min-h-14"
220
245
  :disabled="!isValidToProceed || isPlacingOrder"
221
246
  :loading="
222
247
  isPlacingOrder || (customerDataAvailable && isLoadingOpeningHours)
223
248
  "
224
- :label="checkoutButtonLabel"
225
- size="xl"
226
- block
227
249
  @click="handleCreateOrder"
228
- />
229
- <p class="text-sm text-muted">
230
- Mit Klick auf "Jetzt bestellen!" erklärst du dich mit unseren
231
- <ULink to="/agb" class="text-primary font-medium">AGB</ULink> und
232
- <ULink to="/datenschutz" class="text-primary font-medium"
233
- >Datenschutzbestimmungen</ULink
250
+ >
251
+ {{
252
+ isValidToProceed ? "Zahlungspflichtig bestellen" : checkoutButtonLabel
253
+ }}
254
+ </SbButton>
255
+ <p class="text-sm text-sb-ink-muted">
256
+ Mit der Bestellung akzeptieren Sie unsere
257
+ <NuxtLink to="/agb" class="font-semibold text-sb-primary-ink underline"
258
+ >AGB</NuxtLink
234
259
  >
235
- einverstanden.
260
+ und die
261
+ <NuxtLink
262
+ to="/datenschutz"
263
+ class="font-semibold text-sb-primary-ink underline"
264
+ >Datenschutzerklärung</NuxtLink
265
+ >.
236
266
  </p>
237
- </div>
267
+ </section>
238
268
  </div>
239
269
  </template>
@@ -2,47 +2,60 @@
2
2
  const {
3
3
  voucherCode,
4
4
  voucherLoading,
5
+ voucherError,
5
6
  applyVoucher,
6
7
  appliedPromotionCodes,
7
8
  removeItem,
8
9
  } = useVoucherCode();
10
+ const voucherId = useId();
9
11
  </script>
10
12
 
11
13
  <template>
12
- <div class="flex flex-col gap-2">
13
- <div class="flex flex-row gap-2">
14
- <UInput
14
+ <div class="flex flex-col gap-2 font-body text-sb-ink">
15
+ <form class="flex gap-2" @submit.prevent="applyVoucher">
16
+ <label :for="voucherId" class="sr-only">Gutscheincode</label>
17
+ <SbInput
18
+ :id="voucherId"
15
19
  v-model="voucherCode"
20
+ name="voucher"
16
21
  placeholder="Gutscheincode"
22
+ autocomplete="off"
17
23
  class="flex-1"
24
+ :invalid="!!voucherError"
25
+ :aria-describedby="voucherError ? `${voucherId}-fehler` : undefined"
18
26
  :disabled="voucherLoading"
19
- @keyup.enter="applyVoucher"
20
27
  />
21
- <UButton
22
- label="Einlösen"
23
- variant="outline"
28
+ <SbButton
29
+ type="submit"
30
+ variant="secondary"
24
31
  :loading="voucherLoading"
25
32
  :disabled="!voucherCode.trim() || voucherLoading"
26
- @click="applyVoucher"
27
- />
28
- </div>
29
- <div
30
- v-for="promo in appliedPromotionCodes"
31
- :key="promo.id"
32
- class="flex flex-row justify-between items-center text-sm text-success"
33
+ >Einlösen</SbButton
34
+ >
35
+ </form>
36
+ <p
37
+ v-if="voucherError"
38
+ :id="`${voucherId}-fehler`"
39
+ role="alert"
40
+ class="text-sm font-semibold text-sb-danger"
33
41
  >
34
- <span class="flex items-center gap-1">
35
- <UIcon name="i-lucide-tag" />
36
- {{ promo.label }}
37
- </span>
38
- <UButton
39
- icon="i-lucide-x"
40
- size="xs"
41
- variant="ghost"
42
- color="neutral"
43
- aria-label="Gutschein entfernen"
44
- @click="removeItem(promo)"
45
- />
46
- </div>
42
+ {{ voucherError }}
43
+ </p>
44
+ <ul v-if="appliedPromotionCodes.length" class="flex flex-col gap-1">
45
+ <li
46
+ v-for="promo in appliedPromotionCodes"
47
+ :key="promo.id"
48
+ class="flex items-center justify-between gap-2 rounded-sb-control bg-sb-primary-tint ps-3 text-sm font-semibold text-sb-primary-ink"
49
+ >
50
+ <span>Gutschein: {{ promo.label }}</span>
51
+ <SbIconButton
52
+ :label="`Gutschein ${promo.label} entfernen`"
53
+ variant="ghost"
54
+ @click="removeItem(promo)"
55
+ >
56
+ <SbIcon name="close" :size="16" />
57
+ </SbIconButton>
58
+ </li>
59
+ </ul>
47
60
  </div>
48
61
  </template>