@viur/shop-components 0.0.1-dev.5 → 0.0.1-dev.50

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.
@@ -1,692 +0,0 @@
1
- <template>
2
- <Loader v-if="!state.cartIsInit"></Loader>
3
- <template v-else>
4
- <div class="bind viur-shop-cart-wrap">
5
- <sl-dialog ref="confirm" @sl-hide="onDialogHide">
6
- <p>Möchten Sie den Artikel wirklich aus dem Warenkorb entfernen?</p>
7
- <div class="footer-wrap" slot="footer">
8
- <sl-button variant="danger" @click="confirm.hide()" size="medium">
9
- Abbrechen
10
- </sl-button>
11
- <sl-button variant="success" @click="onConfirm" size="medium">
12
- Aus Warenkorb entfernen
13
- </sl-button>
14
- </div>
15
- </sl-dialog>
16
-
17
- <div class="viur-shop-cart-list">
18
- <div class="viur-shop-cart-controlbar" v-if="mode !== 'basket'">
19
- <div class="viur-shop-cart-button-list left">
20
- <sl-input
21
- ref="cartNameField"
22
- name="cart-name"
23
- placeholder="Warenkorbname"
24
- v-model="cartStore.state.carts[cartStore.state.basket].info.name"
25
- required="true"
26
- inputmode="text"
27
- class="viur-shop-cart-headline"
28
- >
29
- <sl-icon library="hsk" name="pen" slot="suffix"></sl-icon>
30
- </sl-input>
31
- </div>
32
- <sl-dropdown distance="10">
33
- <sl-icon
34
- class="dots"
35
- name="dots"
36
- library="hsk"
37
- slot="trigger"
38
- ></sl-icon>
39
- <sl-menu>
40
- <sl-menu-item @click="saveCart" title="Warenkorb speichern">
41
- <sl-icon
42
- slot="prefix"
43
- library="hsk"
44
- name="save"
45
- class="primary-icon"
46
- ></sl-icon>
47
- Warenkorb speichern
48
- </sl-menu-item>
49
- <sl-menu-item @click="saveCart" title="Zu Projekt hinzufügen">
50
- <sl-icon
51
- slot="prefix"
52
- library="hsk"
53
- name="project"
54
- class="primary-icon"
55
- ></sl-icon>
56
- Zu Projekt hinzufügen
57
- </sl-menu-item>
58
- <sl-menu-item @click="saveCart" title="Warenkorb kopieren">
59
- <sl-icon
60
- slot="prefix"
61
- library="hsk"
62
- name="clone"
63
- class="primary-icon"
64
- ></sl-icon>
65
- Warenkorb kopieren
66
- </sl-menu-item>
67
- <sl-menu-item @click="saveCart" title="Warenkorb löschen">
68
- <sl-icon
69
- slot="prefix"
70
- library="hsk"
71
- name="delete"
72
- class="delete-icon"
73
- ></sl-icon>
74
- Warenkorb löschen
75
- </sl-menu-item>
76
- </sl-menu>
77
- </sl-dropdown>
78
- </div>
79
- <sl-input
80
- v-if="mode !== 'basket'"
81
- name="cart-internalCartNo"
82
- placeholder="Freifeld (Kommission)"
83
- v-model="
84
- cartStore.state.carts[cartStore.state.basket].info.customer_comment
85
- "
86
- inputmode="text"
87
- class="viur-shop-cart-descr"
88
- >
89
- <sl-icon library="hsk" name="pen" slot="suffix"></sl-icon>
90
- </sl-input>
91
- <br />
92
- <sl-alert
93
- ref="cartActionInfo"
94
- variant="primary"
95
- duration="3000"
96
- closable
97
- >
98
- <sl-icon slot="icon" name="check"></sl-icon>
99
- <strong>Warenkorb gespeichert!</strong><br />
100
- </sl-alert>
101
- <sl-alert ref="cartErrorInfo" variant="danger" duration="3000" closable>
102
- <sl-icon slot="icon" name="error"></sl-icon>
103
- <strong>Warenkorb nicht gespeichert!</strong><br />
104
- </sl-alert>
105
-
106
- <sl-spinner v-if="!state.itemsIsInit"></sl-spinner>
107
-
108
- <template v-else>
109
- <sl-card
110
- horizontal
111
- class="viur-shop-cart-card"
112
- v-for="item in cartStore.state.carts[cartStore.state.basket].items"
113
- >
114
- <img
115
- class="viur-shop-cart-card-img"
116
- slot="image"
117
- src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"
118
- />
119
- <div class="viur-shop-cart-card-header" slot="header">
120
- <h4 class="viur-shop-cart-card-headline headline">
121
- {{ item.article.dest.shop_name }} | 425018
122
- </h4>
123
- </div>
124
- <div class="viur-shop-cart-card-body-row">
125
- <div class="viur-shop-cart-card-body-info">
126
- <div class="viur-shop-cart-card-descr">
127
- Version: 900x900x2000 <br />
128
- Farbe: Chromoptik <br />
129
- Glasart: Klar hell mit Edelglasbeschichtung<br />
130
- Anschlag: Beidseitig variabel<br />
131
- Griff: Stangengriff Exklusiv (56)
132
- </div>
133
- <div class="viur-shop-cart-card-body-footer">
134
- <sl-button
135
- size="small"
136
- outline
137
- class="viur-shop-cart-card-add-to-favourites-btn"
138
- variant="primary"
139
- title="Add to favourites"
140
- >
141
- <sl-icon name="heart" slot="prefix"></sl-icon>
142
- </sl-button>
143
- <sl-button
144
- size="small"
145
- outline
146
- class="viur-shop-cart-card-delete-btn"
147
- variant="primary"
148
- title="Remove from cart"
149
- @click="
150
- removeItem(
151
- item,
152
- item.article.dest.key,
153
- cartStore.state.basket,
154
- )
155
- "
156
- >
157
- <sl-icon name="trash" slot="prefix"></sl-icon>
158
- </sl-button>
159
- </div>
160
- </div>
161
- <div class="viur-shop-cart-card-body-amount">
162
- <sl-input
163
- class="amount-input"
164
- type="number"
165
- label="Anzahl"
166
- placeholder="Number"
167
- min="0"
168
- v-model="item.quantity"
169
- @input="
170
- updateItem(
171
- item,
172
- item.article.dest.key,
173
- cartStore.state.basket,
174
- item.quantity,
175
- )
176
- "
177
- >
178
- </sl-input>
179
- </div>
180
- <div class="viur-shop-cart-card-price-wrap" slot="footer">
181
- <div class="viur-shop-cart-card-price-label">Preis</div>
182
- <div class="viur-shop-cart-card-price">
183
- {{ item.price.retail }}
184
-
185
- </div>
186
- <div class="viur-shop-cart-card-small-print">Brutto / Stk.</div>
187
- </div>
188
- </div>
189
- </sl-card>
190
- </template>
191
- </div>
192
-
193
- <teleport to="#order_sidebar" v-if="sidebar">
194
- <h2 class="viur-shop-cart-sidebar-headline headline">
195
- Zusammenfassung
196
- </h2>
197
- <br />
198
-
199
- <sl-input label="Rabattcode eingeben"></sl-input>
200
- <br />
201
-
202
- <div class="viur-shop-cart-sidebar-info-line">
203
- <span>Zwischensumme</span>
204
- <!-- TODO: Preis in shop modul muss trotzdem ohne rabatt sein - extra feld für rabattierten preis und rabatt müssen ebenfalls hier sichtbar werden -->
205
- {{ cartStore.state.carts[cartStore.state.basket].info.total }} €
206
- </div>
207
- <div class="viur-shop-cart-sidebar-info-line">
208
- <span>Rabatt</span>
209
- 0 €
210
- </div>
211
- <div class="viur-shop-cart-sidebar-info-line">
212
- <span>Versandkosten</span>
213
- 0 €
214
- </div>
215
- <div class="viur-shop-cart-sidebar-info-line total">
216
- <span>Gesamt:</span>
217
- {{ cartStore.state.carts[cartStore.state.basket].info.total }} €
218
- </div>
219
- <div class="viur-shop-cart-sidebar-btn-wrap">
220
- <sl-button variant="info" size="small"> Jetzt Bestellen </sl-button>
221
- <sl-button size="small" variant="primary">
222
- <sl-icon name="paypal" slot="prefix"></sl-icon>
223
- Paypal
224
- </sl-button>
225
- </div>
226
- </teleport>
227
- </div>
228
- </template>
229
- </template>
230
-
231
- <script setup>
232
- import { reactive, computed, onBeforeMount, ref } from "vue";
233
- import Loader from "@viur/vue-utils/generic/Loader.vue";
234
- import { useCartStore } from "../../stores/cart.js";
235
- import { Request } from "@viur/vue-utils";
236
-
237
- const props = defineProps({
238
- mode: { type: String, default: "basket" },
239
- cartKey: { type: String, default: "" },
240
- sidebar: { type: Boolean, default: true },
241
- });
242
-
243
- const cartStore = useCartStore();
244
-
245
- const confirm = ref(null);
246
-
247
- const state = reactive({
248
- cartIsInit: computed(() => {
249
- return cartStore.state.basket.length ? true : false;
250
- }),
251
- itemsIsInit: computed(() => {
252
- return cartStore.state.carts[cartStore.state.basket].items ? true : false;
253
- }),
254
- images: {},
255
- currentItem: {},
256
- });
257
-
258
- const currentCartKey = computed(() => {
259
- return props.mode === "basket" ? cartStore.state.basket : props.cartKey;
260
- });
261
-
262
- // function getImage(item) {
263
- // Request.get(`/json/dk_variante/view/${item}`).then(async (resp) => {
264
- // let data = await resp.json();
265
-
266
- // data = data.values;
267
-
268
- // let imageUrl = data.dk_artikel.dest.image
269
- // ? Request.downloadUrlFor(data.dk_artikel.dest.image)
270
- // : "https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80";
271
-
272
- // state.images[item] = imageUrl;
273
- // });
274
-
275
- // return state.images[item];
276
- // }
277
-
278
- async function onConfirm() {
279
- await cartStore.updateItem(
280
- state.currentItem.article.dest.key,
281
- cartStore.state.basket,
282
- 0,
283
- );
284
- confirm.value.hide();
285
- }
286
-
287
- function updateItem(item, articleKey, cartKey, quantity) {
288
- if (quantity === 0) {
289
- confirm.value.show();
290
- state.currentItem = item;
291
- } else {
292
- cartStore.updateItem(articleKey, cartKey, quantity);
293
- }
294
- }
295
-
296
- function removeItem(item, articleKey, cartKey) {
297
- confirm.value.show();
298
- state.currentItem = item;
299
- }
300
-
301
- function onDialogHide() {
302
- cartStore.state.carts[cartStore.state.basket].items.forEach((item) => {
303
- if (item.key === state.currentItem.key) {
304
- item.quantity = 1;
305
- }
306
- });
307
- state.currentItem = {};
308
- }
309
-
310
- onBeforeMount(async () => {
311
- await cartStore.init();
312
- });
313
- </script>
314
-
315
- <style scoped>
316
- .viur-shop-cart-wrap {
317
- flex-direction: row;
318
- gap: var(--sl-spacing-x-large);
319
- align-items: flex-start;
320
- }
321
-
322
- .viur-shop-cart-sidebar-btn-wrap {
323
- display: flex;
324
- flex-direction: column;
325
- margin-top: var(--sl-spacing-large);
326
-
327
- sl-button {
328
- margin-bottom: var(--sl-spacing-x-small);
329
- }
330
- }
331
-
332
- sl-alert {
333
- margin-top: var(--sl-spacing-medium);
334
- margin-bottom: var(--sl-spacing-medium);
335
- }
336
-
337
- .viur-shop-cart-controlbar {
338
- width: 100%;
339
- display: flex;
340
- justify-content: space-between;
341
- align-items: center;
342
-
343
- sl-input {
344
- flex: 1;
345
-
346
- &::part(base) {
347
- margin-bottom: 0;
348
- }
349
- }
350
- }
351
-
352
- .viur-shop-cart-button-list {
353
- display: flex;
354
- flex-direction: row;
355
- gap: 10px;
356
-
357
- &.left {
358
- flex: 1;
359
- margin-right: 10px;
360
- }
361
- }
362
-
363
- .search {
364
- flex: 1 1 100%;
365
- margin-left: 10px;
366
- }
367
-
368
- .article-combobox {
369
- float: left;
370
- width: 75ch;
371
- }
372
-
373
- .viur-shop-cart-card-img {
374
- aspect-ratio: 1;
375
- }
376
-
377
- .viur-shop-cart-selection {
378
- flex: 1;
379
- }
380
-
381
- .cart-wrap {
382
- display: flex;
383
- flex-direction: column;
384
- width: 100%;
385
- }
386
-
387
- .soma-input {
388
- display: grid;
389
- grid-template-columns: 120px 1fr;
390
- align-items: center;
391
- }
392
-
393
- .soma-label {
394
- display: flex;
395
- flex-direction: row;
396
- align-items: center;
397
-
398
- sl-icon {
399
- margin-left: 5px;
400
- background-color: @highlightColor;
401
- color: #fff;
402
- aspect-ratio: 1;
403
- border-radius: 50%;
404
- padding: 0.3em;
405
- font-size: 0.6em;
406
- cursor: pointer;
407
- }
408
- }
409
-
410
- sl-tooltip {
411
- &::part(body) {
412
- line-height: 1.2;
413
- font-weight: 400;
414
- padding: 10px;
415
- }
416
- }
417
-
418
- .cart-tab {
419
- sl-tab {
420
- width: 25%;
421
-
422
- &::part(base) {
423
- width: 100%;
424
- height: 100%;
425
- display: flex;
426
- justify-content: center;
427
- align-items: center;
428
- position: relative;
429
- color: var(--sl-color-neutral-400);
430
- }
431
-
432
- &[aria-selected="true"]::part(base) {
433
- color: var(--ignt-color-primary) !important;
434
- }
435
- }
436
- }
437
-
438
- .cart-status-text {
439
- font-size: 0.8em;
440
- color: inherit;
441
- text-align: center;
442
- margin-top: 0.6em;
443
- white-space: initial;
444
- }
445
-
446
- .search-box {
447
- display: flex;
448
- flex-direction: row;
449
- flex-wrap: nowrap;
450
- align-items: stretch;
451
- margin-bottom: 30px;
452
-
453
- sl-button {
454
- &::part(base) {
455
- height: 100%;
456
- }
457
- }
458
-
459
- @media (--ignt-mq-max-break-medium) {
460
- flex-wrap: wrap;
461
- }
462
- }
463
-
464
- .article-combobox {
465
- flex: 1 1 100%;
466
- margin-bottom: 10px;
467
-
468
- &::part(base) {
469
- margin-bottom: 0;
470
- }
471
-
472
- @media (--ignt-mq-max-break-medium) {
473
- margin-bottom: 0;
474
- }
475
- }
476
-
477
- .comission-box {
478
- margin-right: 10px;
479
-
480
- &::part(base) {
481
- margin-bottom: 0;
482
- }
483
-
484
- @media (--ignt-mq-max-break-medium) {
485
- flex: 1;
486
- }
487
- }
488
-
489
- .search-amt {
490
- margin-right: 10px;
491
-
492
- &::part(base) {
493
- margin-bottom: 0;
494
- width: 80px;
495
- }
496
- }
497
-
498
- .viur-shop-cart-headline {
499
- &::part(base) {
500
- background-color: transparent;
501
- transition: all ease 0.3s;
502
- border-bottom: 1px solid transparent;
503
- height: auto;
504
- }
505
-
506
- :deep(.input--focused) {
507
- border-bottom: 1px solid var(--sl-color-primary-500) !important;
508
- }
509
-
510
- &::part(input) {
511
- color: var(--sl-color-primary-500);
512
- font-weight: 300;
513
- text-transform: uppercase;
514
- font-size: 1.85em;
515
- padding: 0.1em 0;
516
- height: auto;
517
- }
518
-
519
- &::part(suffix) {
520
- pointer-events: none;
521
- width: 1.5em;
522
- margin-left: -1em;
523
- font-size: 1.5em;
524
- }
525
-
526
- &:hover {
527
- &::part(base) {
528
- border-bottom: 1px solid var(--sl-color-primary-500);
529
- }
530
- }
531
- }
532
-
533
- .viur-shop-cart-descr {
534
- margin-top: 10px;
535
-
536
- &::part(base) {
537
- background-color: transparent;
538
- transition: all ease 0.3s;
539
- border-bottom: 1px solid transparent;
540
- margin-bottom: 0;
541
- }
542
-
543
- &::part(input) {
544
- padding: 0.1em 0;
545
- height: auto;
546
- color: var(--ignt-color-text);
547
- }
548
-
549
- &::part(suffix) {
550
- pointer-events: none;
551
- width: 1.5em;
552
- margin-left: -1em;
553
- font-size: 1.5em;
554
- }
555
-
556
- &:hover {
557
- &::part(base) {
558
- border-bottom: 1px solid var(--ignt-color-text);
559
- }
560
- }
561
- }
562
-
563
- sl-menu-item {
564
- &::part(base) {
565
- padding: 0.2em 0.9em 0.2em 0.8em;
566
- }
567
-
568
- &::part(checked-icon) {
569
- display: none;
570
- }
571
-
572
- &::part(prefix) {
573
- margin-right: 10px;
574
- }
575
-
576
- &::part(suffix) {
577
- margin-right: -1.5em;
578
- }
579
- }
580
-
581
- .primary-icon {
582
- color: var(--ignt-color-primary);
583
- }
584
-
585
- .delete-icon {
586
- color: @warnColor;
587
- }
588
-
589
- .dots {
590
- color: var(--ignt-color-primary);
591
- width: 1.5em;
592
- height: 100%;
593
- font-size: 1em;
594
- padding: 0.4em;
595
- }
596
-
597
- .viur-shop-cart-sidebar-info-line {
598
- display: flex;
599
- flex-direction: row;
600
- flex-wrap: nowrap;
601
- margin: var(--sl-spacing-2x-small) 0;
602
-
603
- &.total {
604
- font-weight: 600;
605
- border-top: 1px solid var(--sl-color-neutral-300);
606
- border-bottom: 1px solid var(--sl-color-neutral-300);
607
- padding: var(--sl-spacing-x-small) 0;
608
- margin: var(--sl-spacing-small) 0;
609
- }
610
-
611
- span {
612
- margin-right: auto;
613
- }
614
- }
615
-
616
- .viur-shop-cart-card {
617
- margin-bottom: var(--sl-spacing-x-large);
618
-
619
- &::part(header) {
620
- border-bottom: none;
621
- padding-top: 0;
622
- padding-right: 0;
623
- }
624
-
625
- &::part(image) {
626
- flex-basis: 25%;
627
- max-width: 250px;
628
- }
629
-
630
- &::part(body) {
631
- display: flex;
632
- flex: 1;
633
- padding-top: 0;
634
- padding-bottom: 0;
635
- padding-right: 0;
636
- }
637
-
638
- &::part(group) {
639
- padding: var(--sl-spacing-small) 0;
640
- }
641
- }
642
-
643
- .viur-shop-cart-card-body-row {
644
- display: grid;
645
- grid-template-columns: 1fr auto auto;
646
- gap: var(--sl-spacing-large);
647
- flex: 1;
648
- }
649
-
650
- .viur-shop-cart-card-body-info {
651
- display: flex;
652
- flex-direction: column;
653
- height: 100%;
654
- }
655
-
656
- .viur-shop-cart-card-descr {
657
- margin-bottom: auto;
658
- }
659
-
660
- .viur-shop-cart-card-body-footer {
661
- display: flex;
662
- flex-direction: row;
663
- gap: var(--sl-spacing-2x-small);
664
- margin-top: var(--sl-spacing-large);
665
- }
666
-
667
- .amount-input {
668
- width: 5em;
669
- }
670
-
671
- .viur-shop-cart-card-price-wrap {
672
- display: flex;
673
- flex-direction: column;
674
-
675
- .viur-shop-cart-card-small-print {
676
- font-size: 0.75em;
677
- margin-left: auto;
678
- }
679
- }
680
-
681
- .viur-shop-cart-card-price {
682
- font-size: 1.3em;
683
- }
684
-
685
- .viur-shop-cart-card-price-label {
686
- color: var(--ignt-color-primary);
687
- font-weight: 600;
688
- margin-bottom: 10px;
689
- font-size: 1em;
690
- margin-left: auto;
691
- }
692
- </style>