@viur/shop-components 0.0.1-dev.6 → 0.0.1-dev.60
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/.editorconfig +16 -0
- package/.github/workflows/npm-publish.yml +42 -0
- package/.gitmodules +3 -0
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/package.json +25 -23
- package/src/components/ShopCart.vue +512 -0
- package/src/components/ShopOrderComplete.vue +73 -0
- package/src/components/ShopOrderConfirm.vue +291 -0
- package/src/components/ShopOrderStepper.vue +264 -0
- package/src/components/ShopUserData.vue +232 -0
- package/src/components/cart/CartLeaf.vue +277 -0
- package/src/components/cart/CartLeafModel.vue +304 -0
- package/src/components/cart/CartNode.vue +25 -0
- package/src/components/cart/CartTree.vue +54 -0
- package/src/components/cart/CartTreeWrapper.vue +73 -0
- package/src/components/cart/CartView.vue +205 -174
- package/src/components/cart/Discount.vue +91 -0
- package/src/components/lib/utils.js +0 -0
- package/src/components/order/OrderSidebar.vue +102 -0
- package/src/components/order/item/ItemView.vue +0 -1
- package/src/components/{cart → order/process}/ConfirmView.vue +94 -96
- package/src/components/order/process/ExampleUsage.vue +79 -66
- package/src/components/order/process/OrderTabHeader.vue +10 -1
- package/src/components/order/process/SelectPaymentProvider.vue +62 -0
- package/src/components/order/process/Shipping.vue +46 -0
- package/src/components/ui/ShopSummary.vue +145 -0
- package/src/components/ui/generic/ArticleList.vue +222 -0
- package/src/components/ui/generic/ExamplePagination.vue +236 -0
- package/src/components/ui/generic/ShopPriceFormatter.vue +41 -0
- package/src/components/ui/generic/alerts/ShopAlert.vue +19 -0
- package/src/components/ui/generic/makeData.js +39 -0
- package/src/components/ui/stepper/StepperItem.vue +39 -0
- package/src/components/ui/stepper/StepperTab.vue +133 -0
- package/src/components/ui/stepper/StepperTrigger.vue +35 -0
- package/src/components/ui/userdata/AddForm.vue +125 -0
- package/src/components/ui/userdata/AddressBox.vue +117 -0
- package/src/components/ui/userdata/BaseLayout.vue +94 -0
- package/src/components/ui/userdata/CustomBooleanBone.vue +58 -0
- package/src/components/ui/userdata/CustomSelectBone.vue +91 -0
- package/src/components/ui/userdata/CustomStringBone.vue +71 -0
- package/src/components/ui/userdata/DefaultLayout.vue +126 -0
- package/src/components/ui/userdata/SelectAddress.vue +21 -0
- package/src/components/ui/userdata/multi/ActionBar.vue +38 -0
- package/src/components/ui/userdata/multi/CartSelection.vue +42 -0
- package/src/main.js +50 -0
- package/src/router/index.js +1 -1
- package/src/stores/cart.js +267 -42
- package/src/style/ignite/.editorconfig +20 -0
- package/src/style/ignite/.github/workflows/ignite.yml +64 -0
- package/src/style/ignite/.github/workflows/node.yml +30 -0
- package/src/style/ignite/.postcssrc.cjs +25 -0
- package/src/style/ignite/CHANGELOG.md +244 -0
- package/src/style/ignite/LICENSE +21 -0
- package/src/style/ignite/README.md +92 -0
- package/src/style/ignite/dist/ignite.css +2019 -0
- package/src/style/ignite/dist/ignite.min.css +4 -0
- package/src/style/ignite/foundation/basic.css +371 -0
- package/src/style/ignite/foundation/color.css +323 -0
- package/src/style/ignite/foundation/config.css +188 -0
- package/src/style/ignite/foundation/grid.css +78 -0
- package/src/style/ignite/foundation/mediaqueries.css +71 -0
- package/src/style/ignite/foundation/reset.css +261 -0
- package/src/style/ignite/ignite.css +29 -0
- package/src/style/ignite/ignite.css.map +1 -0
- package/src/style/ignite/package-lock.json +5530 -0
- package/src/style/ignite/package.json +58 -0
- package/src/style/ignite/shoelace.css +19 -0
- package/src/style/ignite/themes/dark.css +12 -0
- package/src/style/ignite/themes/light.css +11 -0
- package/src/style/ignite/utilities/shoelace.css +537 -0
- package/src/style/ignite/utilities/utilities.css +24 -0
- package/vite.config.js +53 -0
- package/src/components/order/information/UserInfoMulti.vue +0 -427
- package/src/components/order/information/UserInformation.vue +0 -332
- package/src/components/order/process/OrderComplete.vue +0 -41
- package/src/components/order/process/OrderView.vue +0 -210
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bind">
|
|
3
|
+
<h1 class="viur-shop-success-headline headline">
|
|
4
|
+
Vielen Dank für Ihre Bestellung
|
|
5
|
+
</h1>
|
|
6
|
+
<p class="paragraph"><strong>Ihre Bestellnummer:</strong> 123345670</p>
|
|
7
|
+
<p class="paragraph">
|
|
8
|
+
Wir haben Ihre Bestellung erhalten und werden diese schenllstmöglich
|
|
9
|
+
bearbeiten.<br />
|
|
10
|
+
Sie erhalten in wenigen Minuten eine Bestätigung per E-Mail.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="viur-shop-order-complete-slot"
|
|
15
|
+
v-if="additionalComponents.length"
|
|
16
|
+
>
|
|
17
|
+
<template v-for="component in additionalComponents">
|
|
18
|
+
<component
|
|
19
|
+
:is="component.component"
|
|
20
|
+
v-bind="component.props ? component.props : ''"
|
|
21
|
+
>
|
|
22
|
+
</component>
|
|
23
|
+
</template>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="btn-wrap">
|
|
27
|
+
<sl-button size="medium" @click="goToStart()"> Zur Startseite </sl-button>
|
|
28
|
+
|
|
29
|
+
<sl-button variant="primary" @click="goToShop()" size="medium">
|
|
30
|
+
Weiter Einkaufen
|
|
31
|
+
</sl-button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
redirectUrl: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
additionalComponents: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: [],
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const emit = defineEmits(["goToStart"]);
|
|
48
|
+
|
|
49
|
+
function goToStart() {
|
|
50
|
+
emit("goToStart");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function goToShop() {
|
|
54
|
+
window.location.href = props.redirectUrl;
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
.btn-wrap {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
flex-wrap: nowrap;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
width: 100%;
|
|
65
|
+
|
|
66
|
+
margin-top: var(--sl-spacing-x-large);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.viur-shop-success-headline {
|
|
70
|
+
margin: 0 0 var(--sl-spacing-x-large) 0;
|
|
71
|
+
font-size: var(--shop-success-headline-size);
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Loader v-if="!state.cartIsInit"></Loader>
|
|
3
|
+
|
|
4
|
+
<template v-else>
|
|
5
|
+
<div class="list">
|
|
6
|
+
<h2 class="viur-shop-cart-headline headline">Bestellung prüfen</h2>
|
|
7
|
+
<div class="viur-shop-cart-address-wrap">
|
|
8
|
+
<div class="viur-shop-cart-address">
|
|
9
|
+
<div class="viur-shop-cart-address-headline">
|
|
10
|
+
Versandadresse
|
|
11
|
+
<sl-button
|
|
12
|
+
outline
|
|
13
|
+
size="small"
|
|
14
|
+
@click="editShippingAddress(tabName)"
|
|
15
|
+
>
|
|
16
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
17
|
+
</sl-button>
|
|
18
|
+
</div>
|
|
19
|
+
{{ cartStore.state.activeShippingAddress.firstname }}
|
|
20
|
+
{{ cartStore.state.activeShippingAddress.lastname }}<br />
|
|
21
|
+
{{ cartStore.state.activeShippingAddress.street_name }}
|
|
22
|
+
{{ cartStore.state.activeShippingAddress.street_number }}<br />
|
|
23
|
+
{{ cartStore.state.activeShippingAddress.zip_code }}
|
|
24
|
+
{{ cartStore.state.activeShippingAddress.city }}
|
|
25
|
+
{{ cartStore.state.activeShippingAddress.country }}<br />
|
|
26
|
+
</div>
|
|
27
|
+
<div class="viur-shop-cart-address">
|
|
28
|
+
<div class="viur-shop-cart-address-headline">
|
|
29
|
+
Rechnungsadresse
|
|
30
|
+
<sl-button outline size="small">
|
|
31
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
32
|
+
</sl-button>
|
|
33
|
+
</div>
|
|
34
|
+
{{ cartStore.state.activeBillingAddress.firstname }}
|
|
35
|
+
{{ cartStore.state.activeBillingAddress.lastname }}<br />
|
|
36
|
+
{{ cartStore.state.activeBillingAddress.street_name }}
|
|
37
|
+
{{ cartStore.state.activeBillingAddress.street_number }}<br />
|
|
38
|
+
{{ cartStore.state.activeBillingAddress.zip_code }}
|
|
39
|
+
{{ cartStore.state.activeBillingAddress.city }}
|
|
40
|
+
{{ cartStore.state.activeBillingAddress.country }}<br />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="viur-shop-cart-payment">
|
|
45
|
+
<div class="viur-shop-cart-payment-method">
|
|
46
|
+
<span>Zahlungsmethode:</span>
|
|
47
|
+
{{ state.selectedPaymentProvider }}
|
|
48
|
+
</div>
|
|
49
|
+
<sl-button outline size="small">
|
|
50
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
51
|
+
</sl-button>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<h2 class="viur-shop-cart-headline headline">Warenkorb</h2>
|
|
55
|
+
<CartView :in-order-confirm="true"></CartView>
|
|
56
|
+
<sl-button size="small" @click="addOrder">
|
|
57
|
+
Zahlungspflichtig bestellen
|
|
58
|
+
</sl-button>
|
|
59
|
+
<!-- <sl-card
|
|
60
|
+
horizontal
|
|
61
|
+
class="viur-shop-cart-mini-card"
|
|
62
|
+
v-for="item in cartStore.state.carts[cartStore.state.basket].items"
|
|
63
|
+
>
|
|
64
|
+
<img
|
|
65
|
+
class="viur-shop-cart-mini-card-img"
|
|
66
|
+
slot="image"
|
|
67
|
+
:src="getImage(item.article.dest.key)"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<div class="viur-shop-cart-mini-cart-header" slot="header">
|
|
71
|
+
<h4 class="viur-shop-cart-mini-headline headline">{{ item.article.dest.shop_name }} | 425018</h4>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="viur-shop-cart-mini-card-body-row">
|
|
74
|
+
<div class="viur-shop-cart-mini-card-body-info">
|
|
75
|
+
<div class="viur-shop-cart-mini-card-info-wrap">
|
|
76
|
+
<div class="viur-shop-cart-mini-card-info">
|
|
77
|
+
<span>Anzahl: </span>
|
|
78
|
+
1
|
|
79
|
+
</div>
|
|
80
|
+
<div class="viur-shop-cart-mini-card-info">
|
|
81
|
+
<span>Preis: </span>
|
|
82
|
+
{{ item.article.dest.shop_price_recommended }} €
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</sl-card> -->
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup>
|
|
93
|
+
import { reactive, onBeforeMount, computed } from "vue";
|
|
94
|
+
import Loader from "@viur/vue-utils/generic/Loader.vue";
|
|
95
|
+
import { useCartStore } from "../stores/cart.js";
|
|
96
|
+
import { Request } from "@viur/vue-utils";
|
|
97
|
+
import CartView from "./cart/CartView.vue";
|
|
98
|
+
|
|
99
|
+
const emit = defineEmits(["editAddress"]);
|
|
100
|
+
|
|
101
|
+
const props = defineProps({
|
|
102
|
+
tabName: { type: String, required: true },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const cartStore = useCartStore();
|
|
106
|
+
|
|
107
|
+
// const searchWarning = ref()
|
|
108
|
+
const state = reactive({
|
|
109
|
+
cartIsInit: computed(() => {
|
|
110
|
+
return true;
|
|
111
|
+
}),
|
|
112
|
+
itemsIsInit: computed(() => {
|
|
113
|
+
return !!cartStore.state?.carts[cartStore.state.basket].items;
|
|
114
|
+
}),
|
|
115
|
+
selectedPaymentProvider: computed(() => {
|
|
116
|
+
/* fixme this compute generates an error
|
|
117
|
+
Uncaught (in promise) TypeError: Cannot set properties of null (setting '__vnode')
|
|
118
|
+
but the value is correct.
|
|
119
|
+
*/
|
|
120
|
+
return cartStore.state?.selectedPaymentProvider.title;
|
|
121
|
+
}),
|
|
122
|
+
images: {},
|
|
123
|
+
showOrderButton: false,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
function editShippingAddress(e) {
|
|
127
|
+
emit("editAddress", e);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function addOrder() {
|
|
131
|
+
console.log("start order add");
|
|
132
|
+
cartStore.orderAdd();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
onBeforeMount(async () => {
|
|
136
|
+
await cartStore.init();
|
|
137
|
+
});
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<style scoped>
|
|
141
|
+
.viur-shop-cart-sidebar-btn-wrap {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
margin-top: var(--sl-spacing-large);
|
|
145
|
+
|
|
146
|
+
sl-button {
|
|
147
|
+
margin-bottom: var(--sl-spacing-x-small);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
sl-alert {
|
|
152
|
+
margin-top: var(--sl-spacing-medium);
|
|
153
|
+
margin-bottom: var(--sl-spacing-medium);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
sl-tooltip {
|
|
157
|
+
&::part(body) {
|
|
158
|
+
line-height: 1.2;
|
|
159
|
+
font-weight: 400;
|
|
160
|
+
padding: 10px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
sl-menu-item {
|
|
165
|
+
&::part(base) {
|
|
166
|
+
padding: 0.2em 0.9em 0.2em 0.8em;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&::part(checked-icon) {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&::part(prefix) {
|
|
174
|
+
margin-right: 10px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&::part(suffix) {
|
|
178
|
+
margin-right: -1.5em;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.viur-shop-cart-sidebar-info-line {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: row;
|
|
185
|
+
flex-wrap: nowrap;
|
|
186
|
+
margin: var(--sl-spacing-2x-small) 0;
|
|
187
|
+
|
|
188
|
+
span {
|
|
189
|
+
margin-right: auto;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.total {
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
border-top: 1px solid var(--sl-color-neutral-300);
|
|
195
|
+
border-bottom: 1px solid var(--sl-color-neutral-300);
|
|
196
|
+
padding: var(--sl-spacing-x-small) 0;
|
|
197
|
+
margin: var(--sl-spacing-small) 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.viur-shop-cart-mini-card {
|
|
202
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
203
|
+
|
|
204
|
+
&::part(header) {
|
|
205
|
+
border-bottom: none;
|
|
206
|
+
padding-top: 0;
|
|
207
|
+
padding-right: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&::part(image) {
|
|
211
|
+
flex-basis: 25%;
|
|
212
|
+
max-width: 90px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&::part(body) {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex: 1;
|
|
218
|
+
padding-top: 0;
|
|
219
|
+
padding-bottom: 0;
|
|
220
|
+
padding-right: 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&::part(group) {
|
|
224
|
+
padding: var(--sl-spacing-small) 0;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.viur-shop-cart-mini-card-body-row {
|
|
229
|
+
display: grid;
|
|
230
|
+
grid-template-columns: 1fr auto auto;
|
|
231
|
+
gap: var(--sl-spacing-large);
|
|
232
|
+
flex: 1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.viur-shop-cart-mini-card-body-info {
|
|
236
|
+
display: flex;
|
|
237
|
+
flex-direction: column;
|
|
238
|
+
height: 100%;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.viur-shop-cart-mini-card-info-wrap {
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-wrap: nowrap;
|
|
244
|
+
gap: var(--sl-spacing-medium);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.viur-shop-cart-mini-card-info {
|
|
248
|
+
display: flex;
|
|
249
|
+
flex-direction: row;
|
|
250
|
+
flex-wrap: nowrap;
|
|
251
|
+
|
|
252
|
+
span {
|
|
253
|
+
margin-right: var(--sl-spacing-x-small);
|
|
254
|
+
font-weight: 600;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.viur-shop-cart-address-wrap {
|
|
259
|
+
display: grid;
|
|
260
|
+
grid-template-columns: 1fr 1fr;
|
|
261
|
+
gap: var(--sl-spacing-x-large);
|
|
262
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.viur-shop-cart-address-headline {
|
|
266
|
+
display: flex;
|
|
267
|
+
flex-direction: row;
|
|
268
|
+
flex-wrap: nowrap;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: space-between;
|
|
271
|
+
font-weight: 600;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.viur-shop-cart-payment {
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-direction: row;
|
|
277
|
+
flex-wrap: nowrap;
|
|
278
|
+
align-items: center;
|
|
279
|
+
justify-content: space-between;
|
|
280
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
281
|
+
|
|
282
|
+
span {
|
|
283
|
+
font-weight: 600;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.viur-shop-cart-headline {
|
|
288
|
+
margin: 0 0 var(--sl-spacing-x-large) 0;
|
|
289
|
+
font-size: var(--shop-form-headline-size);
|
|
290
|
+
}
|
|
291
|
+
</style>
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bind viur-shop-wrap">
|
|
3
|
+
<div
|
|
4
|
+
class="viur-shop-stepper-wrap"
|
|
5
|
+
:class="{ 'full-width': sidebarBottom }"
|
|
6
|
+
>
|
|
7
|
+
<slot name="main">
|
|
8
|
+
<sl-tab-group
|
|
9
|
+
class="viur-shop-order-tabgroup"
|
|
10
|
+
noScrollControls
|
|
11
|
+
@sl-tab-show="onTabChange($event)"
|
|
12
|
+
ref="tabGroup"
|
|
13
|
+
>
|
|
14
|
+
<StepperTab
|
|
15
|
+
v-for="(tab, index) in state.tabNames"
|
|
16
|
+
:key="tab"
|
|
17
|
+
:tab="tab"
|
|
18
|
+
:tabs="tabs"
|
|
19
|
+
:tabIdx="index"
|
|
20
|
+
:stepperLength="state.tabNames.length"
|
|
21
|
+
>
|
|
22
|
+
</StepperTab>
|
|
23
|
+
|
|
24
|
+
<StepperItem
|
|
25
|
+
v-for="tab in state.tabNames"
|
|
26
|
+
:tab="tab"
|
|
27
|
+
:tabs="tabs"
|
|
28
|
+
:key="tab"
|
|
29
|
+
@goToStart="goToStart()"
|
|
30
|
+
@editAddress="editAddress"
|
|
31
|
+
>
|
|
32
|
+
</StepperItem>
|
|
33
|
+
</sl-tab-group>
|
|
34
|
+
</slot>
|
|
35
|
+
|
|
36
|
+
<slot name="trigger" v-if="trigger">
|
|
37
|
+
<div
|
|
38
|
+
class="viur-shop-form-footer"
|
|
39
|
+
:class="{ 'flex-end': state.tabIdx === 0, 'last-row': sidebarBottom }"
|
|
40
|
+
v-if="state.tabIdx !== state.tabNames.length - 1"
|
|
41
|
+
>
|
|
42
|
+
<StepperTrigger
|
|
43
|
+
:index="state.tabIdx"
|
|
44
|
+
@prevTab="prevTab"
|
|
45
|
+
@nextTab="nextTab"
|
|
46
|
+
>
|
|
47
|
+
</StepperTrigger>
|
|
48
|
+
</div>
|
|
49
|
+
</slot>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<slot
|
|
53
|
+
name="sidebar"
|
|
54
|
+
v-if="sidebar && state.tabIdx < state.tabNames.length - 1"
|
|
55
|
+
>
|
|
56
|
+
<div class="viur-shop-sidebar-wrap" :class="{ bottom: sidebarBottom }">
|
|
57
|
+
<ShopSummary
|
|
58
|
+
:showDiscount="showDiscount"
|
|
59
|
+
:customShippingComponent="customShippingComponent"
|
|
60
|
+
>
|
|
61
|
+
<template #custom v-if="customComponent">
|
|
62
|
+
<component :is="customComponent"></component>
|
|
63
|
+
</template>
|
|
64
|
+
</ShopSummary>
|
|
65
|
+
</div>
|
|
66
|
+
</slot>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script setup>
|
|
71
|
+
import { reactive, computed, ref, onBeforeMount } from "vue";
|
|
72
|
+
import StepperTab from "./ui/stepper/StepperTab.vue";
|
|
73
|
+
import StepperItem from "./ui/stepper/StepperItem.vue";
|
|
74
|
+
import StepperTrigger from "./ui/stepper/StepperTrigger.vue";
|
|
75
|
+
import ShopSummary from "./ui/ShopSummary.vue";
|
|
76
|
+
import { useCartStore } from "../stores/cart";
|
|
77
|
+
|
|
78
|
+
const cartStore = useCartStore();
|
|
79
|
+
|
|
80
|
+
const props = defineProps({
|
|
81
|
+
tabs: {
|
|
82
|
+
type: Object,
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
sidebar: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true,
|
|
88
|
+
required: false,
|
|
89
|
+
},
|
|
90
|
+
trigger: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true,
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
95
|
+
sidebarBottom: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false,
|
|
98
|
+
required: false,
|
|
99
|
+
},
|
|
100
|
+
showDiscount: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: true,
|
|
103
|
+
},
|
|
104
|
+
customComponent: { default: undefined },
|
|
105
|
+
customShippingComponent: { default: undefined },
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const emit = defineEmits(["tabChange"]);
|
|
109
|
+
|
|
110
|
+
const state = reactive({
|
|
111
|
+
tabNames: computed(() => sortTabs(props.tabs)),
|
|
112
|
+
tabIdx: 0,
|
|
113
|
+
currentTab: "",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const tabGroup = ref(null);
|
|
117
|
+
|
|
118
|
+
function sortTabs(tabs) {
|
|
119
|
+
let sortedArray = [];
|
|
120
|
+
let outputArray = [];
|
|
121
|
+
|
|
122
|
+
for (const tab in tabs) {
|
|
123
|
+
if (tabs[tab].position) {
|
|
124
|
+
sortedArray.push([tab, tabs[tab].position]);
|
|
125
|
+
} else {
|
|
126
|
+
sortedArray.push([tab, 0]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
sortedArray.sort((a, b) => {
|
|
131
|
+
return a[1] - b[1];
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
sortedArray.forEach((tab) => {
|
|
135
|
+
outputArray.push(tab[0]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return outputArray;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function onTabChange(e) {
|
|
142
|
+
state.currentTab = e?.detail.name;
|
|
143
|
+
state.tabIdx = state.tabNames.indexOf(state.currentTab);
|
|
144
|
+
|
|
145
|
+
emit("tabChange", e);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function prevTab() {
|
|
149
|
+
if (state.tabIdx > 0) {
|
|
150
|
+
tabGroup.value.show(state.tabNames[state.tabIdx - 1]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function nextTab() {
|
|
155
|
+
if (state.tabIdx < state.tabNames.length - 1) {
|
|
156
|
+
tabGroup.value.show(state.tabNames[state.tabIdx + 1]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function goToStart() {
|
|
161
|
+
tabGroup.value.show(state.tabNames[0]);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function editAddress(e) {
|
|
165
|
+
tabGroup.value.show(e);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
onBeforeMount(async () => {
|
|
169
|
+
await cartStore.init();
|
|
170
|
+
console.log("init node ");
|
|
171
|
+
const tabNames = sortTabs(props.tabs);
|
|
172
|
+
state.currentTab = tabNames[0];
|
|
173
|
+
});
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped>
|
|
177
|
+
* {
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.viur-shop-wrap {
|
|
182
|
+
--shop-sidebar-background: var(--sl-color-neutral-100);
|
|
183
|
+
--shop-sidebar-columns: 4;
|
|
184
|
+
--shop-main-columns: 8;
|
|
185
|
+
--shop-tab-color: var(--sl-color-neutral-400);
|
|
186
|
+
--shop-tab-color-active: var(--ignt-color-primary);
|
|
187
|
+
|
|
188
|
+
--shop-form-headline-size: 1.5em;
|
|
189
|
+
--shop-success-headline-size: var(--shop-form-headline-size);
|
|
190
|
+
|
|
191
|
+
display: grid;
|
|
192
|
+
grid-template-columns: repeat(12, minmax(0, 1fr));
|
|
193
|
+
grid-template-rows: 1fr max-content;
|
|
194
|
+
grid-gap: var(--ignt-spacing-2x-large);
|
|
195
|
+
|
|
196
|
+
width: 100%;
|
|
197
|
+
border: 0 white solid;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@layer foundation.shop {
|
|
201
|
+
.viur-shop-sidebar-wrap {
|
|
202
|
+
display: flex;
|
|
203
|
+
flex-direction: column;
|
|
204
|
+
background-color: var(--shop-sidebar-background);
|
|
205
|
+
padding: var(--sl-spacing-medium);
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
border-radius: var(--sl-border-radius-medium);
|
|
208
|
+
grid-column: auto / span var(--shop-sidebar-columns);
|
|
209
|
+
/* height has to be set or sidebar grows until infinity... */
|
|
210
|
+
height: min-content;
|
|
211
|
+
@media (min-width: 1024px) {
|
|
212
|
+
position: sticky;
|
|
213
|
+
top: 2rem;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.viur-shop-stepper-wrap {
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
grid-column: auto / span var(--shop-main-columns);
|
|
221
|
+
|
|
222
|
+
@media (max-width: 1024px) {
|
|
223
|
+
grid-column: auto / span 12;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media (max-width: 600px) {
|
|
227
|
+
&::part(active-tab-indicator) {
|
|
228
|
+
display: none;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.viur-shop-form-footer {
|
|
234
|
+
height: fit-content;
|
|
235
|
+
|
|
236
|
+
/* TODO: sticky Trigger yes no? */
|
|
237
|
+
/* position: sticky;
|
|
238
|
+
bottom: 2rem; */
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
:deep(.viur-shop-form-footer) {
|
|
242
|
+
display: flex;
|
|
243
|
+
justify-content: space-between;
|
|
244
|
+
margin-top: var(--sl-spacing-large);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.flex-end {
|
|
248
|
+
justify-content: flex-end;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.bottom {
|
|
252
|
+
grid-column: auto / span 12;
|
|
253
|
+
grid-row-start: 2;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.full-width {
|
|
257
|
+
grid-column: auto / span 12;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.last-row {
|
|
261
|
+
grid-row-start: 3;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
</style>
|