@viur/shop-components 0.0.1-dev.6 → 0.0.1-dev.61

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 (131) hide show
  1. package/.editorconfig +16 -0
  2. package/.github/workflows/npm-publish.yml +42 -0
  3. package/.gitmodules +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +13 -2
  6. package/old/client/HttpClient.js +111 -0
  7. package/old/client/ViURShopClient.js +472 -0
  8. package/old/client/index.js +23 -0
  9. package/old/client/types.js +10 -0
  10. package/old/components/ExampleUsage.vue +95 -0
  11. package/old/components/ShopCart.vue +91 -0
  12. package/old/components/ShopOrderComplete.vue +73 -0
  13. package/old/components/ShopOrderConfirm.vue +311 -0
  14. package/old/components/ShopOrderStepper.vue +352 -0
  15. package/old/components/ShopPaymentProvider.vue +113 -0
  16. package/old/components/ShopShippingMethod.vue +52 -0
  17. package/old/components/ShopSummary.vue +138 -0
  18. package/old/components/ShopUserData.vue +218 -0
  19. package/old/components/cart/CartLeaf.vue +277 -0
  20. package/old/components/cart/CartLeafModel.vue +312 -0
  21. package/old/components/cart/CartNode.vue +26 -0
  22. package/old/components/cart/CartTree.vue +67 -0
  23. package/old/components/cart/CartTreeWrapper.vue +73 -0
  24. package/old/components/cart/CartView.vue +82 -0
  25. package/old/components/cart/Discount.vue +91 -0
  26. package/old/components/generic/loadinghandler.vue +76 -0
  27. package/old/components/paymentProvider/paypalplus.vue +0 -0
  28. package/old/components/paymentProvider/prepayment.vue +0 -0
  29. package/old/components/paymentProvider/unzerPayment.vue +140 -0
  30. package/old/components/simple/ShopUserData.vue +161 -0
  31. package/old/components/simple/SimpleDefaultLayout.vue +116 -0
  32. package/old/components/ui/generic/CardSelector.vue +52 -0
  33. package/old/components/ui/generic/CartList.vue +69 -0
  34. package/old/components/ui/generic/ShippingInfo.vue +56 -0
  35. package/old/components/ui/generic/ShopPriceFormatter.vue +41 -0
  36. package/old/components/ui/generic/alerts/ShopAlert.vue +30 -0
  37. package/old/components/ui/payment/PaymentOption.vue +79 -0
  38. package/old/components/ui/payment/PaymentSelector.vue +158 -0
  39. package/old/components/ui/stepper/StepperItem.vue +90 -0
  40. package/old/components/ui/stepper/StepperTab.vue +161 -0
  41. package/old/components/ui/stepper/StepperTrigger.vue +69 -0
  42. package/old/components/ui/userdata/AddForm.vue +160 -0
  43. package/old/components/ui/userdata/AddressBox.vue +137 -0
  44. package/old/components/ui/userdata/BaseLayout.vue +77 -0
  45. package/old/components/ui/userdata/CustomBooleanBone.vue +58 -0
  46. package/old/components/ui/userdata/CustomSelectBone.vue +91 -0
  47. package/old/components/ui/userdata/CustomStringBone.vue +71 -0
  48. package/old/components/ui/userdata/DefaultLayout.vue +126 -0
  49. package/old/components/ui/userdata/SelectAddress.vue +21 -0
  50. package/old/components/ui/userdata/multi/ActionBar.vue +38 -0
  51. package/old/components/ui/userdata/multi/CartSelection.vue +42 -0
  52. package/old/ignite/.editorconfig +20 -0
  53. package/old/ignite/.github/workflows/ignite.yml +64 -0
  54. package/old/ignite/.github/workflows/node.yml +30 -0
  55. package/old/ignite/.postcssrc.cjs +25 -0
  56. package/old/ignite/CHANGELOG.md +244 -0
  57. package/old/ignite/LICENSE +21 -0
  58. package/old/ignite/README.md +92 -0
  59. package/old/ignite/dist/ignite.css +2019 -0
  60. package/old/ignite/dist/ignite.min.css +4 -0
  61. package/old/ignite/foundation/basic.css +371 -0
  62. package/old/ignite/foundation/color.css +323 -0
  63. package/old/ignite/foundation/config.css +188 -0
  64. package/old/ignite/foundation/grid.css +78 -0
  65. package/old/ignite/foundation/mediaqueries.css +71 -0
  66. package/old/ignite/foundation/reset.css +261 -0
  67. package/old/ignite/ignite.css +29 -0
  68. package/old/ignite/ignite.css.map +1 -0
  69. package/old/ignite/package-lock.json +5530 -0
  70. package/old/ignite/package.json +58 -0
  71. package/old/ignite/shoelace.css +19 -0
  72. package/old/ignite/themes/dark.css +12 -0
  73. package/old/ignite/themes/light.css +11 -0
  74. package/old/ignite/utilities/shoelace.css +537 -0
  75. package/old/ignite/utilities/utilities.css +24 -0
  76. package/old/stores/address.js +122 -0
  77. package/old/stores/cart.js +266 -0
  78. package/old/stores/message.js +21 -0
  79. package/old/stores/order.js +202 -0
  80. package/old/stores/payment.js +79 -0
  81. package/old/stores/shipping.js +78 -0
  82. package/package.json +23 -23
  83. package/src/Shop.vue +212 -0
  84. package/src/ShopOrderStepper.vue +89 -0
  85. package/src/ShopSummary.vue +170 -0
  86. package/src/Steps/ShopCart.vue +60 -0
  87. package/src/Steps/ShopOrderComplete.vue +24 -0
  88. package/src/Steps/ShopOrderConfirm.vue +295 -0
  89. package/src/Steps/ShopPaymentProvider.vue +53 -0
  90. package/src/Steps/ShopShippingMethod.vue +53 -0
  91. package/src/Steps/ShopUserDataGuest.vue +78 -0
  92. package/src/Steps/index.js +15 -0
  93. package/src/components/AddressForm.vue +84 -0
  94. package/src/components/AddressFormLayout.vue +107 -0
  95. package/src/components/CardSelector.vue +68 -0
  96. package/src/components/CartItem.vue +325 -0
  97. package/src/components/CartItemSmall.vue +257 -0
  98. package/src/components/LoadingHandler.vue +76 -0
  99. package/src/components/PaymentOption.vue +78 -0
  100. package/src/components/PaymentProviderUnzer.vue +201 -0
  101. package/src/components/PaymentSelector.vue +55 -0
  102. package/src/components/ShopAlert.vue +30 -0
  103. package/src/components/StepperTab.vue +132 -0
  104. package/src/components/dialogButton.vue +49 -0
  105. package/src/composables/address.js +95 -0
  106. package/src/composables/cart.js +132 -0
  107. package/src/composables/order.js +80 -0
  108. package/src/composables/payment.js +75 -0
  109. package/src/composables/shipping.js +32 -0
  110. package/src/main.js +44 -0
  111. package/src/shop.js +251 -0
  112. package/src/translations/de.js +15 -0
  113. package/src/translations/en.js +5 -0
  114. package/src/utils.js +49 -0
  115. package/vite.config.js +51 -0
  116. package/src/components/cart/CartView.vue +0 -692
  117. package/src/components/cart/ConfirmView.vue +0 -314
  118. package/src/components/order/category/CategoryList.vue +0 -83
  119. package/src/components/order/category/CategoryView.vue +0 -143
  120. package/src/components/order/information/UserInfoMulti.vue +0 -427
  121. package/src/components/order/information/UserInformation.vue +0 -332
  122. package/src/components/order/information/adress/ShippingAdress.vue +0 -143
  123. package/src/components/order/item/ItemCard.vue +0 -168
  124. package/src/components/order/item/ItemView.vue +0 -233
  125. package/src/components/order/process/ExampleUsage.vue +0 -100
  126. package/src/components/order/process/OrderComplete.vue +0 -41
  127. package/src/components/order/process/OrderTabHeader.vue +0 -7
  128. package/src/components/order/process/OrderView.vue +0 -210
  129. package/src/router/index.js +0 -103
  130. package/src/stores/cart.js +0 -111
  131. package/src/views/ViewMissing.vue +0 -20
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <template v-if="isLoading">
3
+ <slot name="loading">
4
+ <shop-alert duration="Infinity" variant="info" :closeable="false">
5
+ <template #icon>
6
+ <sl-spinner class="spinner-loading" slot="icon"></sl-spinner>
7
+ </template>
8
+ <template #alertMsg>
9
+ Daten werden abgefragt...
10
+ </template>
11
+ </shop-alert>
12
+ </slot>
13
+ </template>
14
+ <template v-else-if="isUpdating">
15
+ <slot name="updating">
16
+ <shop-alert duration="Infinity" variant="info" :closeable="false">
17
+ <template #icon>
18
+ <sl-spinner class="spinner-loading" slot="icon"></sl-spinner>
19
+ </template>
20
+ <template #alertMsg>
21
+ Daten werden aktualisiert...
22
+ </template>
23
+ </shop-alert>
24
+ </slot>
25
+ </template>
26
+ <template v-else-if="hasError">
27
+ <slot name="error">
28
+ <shop-alert duration="Infinity" iconName="x-lg" variant="danger" :closeable="false">
29
+ <template #alertMsg>
30
+ {{ errorMessage }}
31
+ </template>
32
+ </shop-alert>
33
+ </slot>
34
+ </template>
35
+ <template v-else>
36
+ <slot>
37
+ </slot>
38
+ </template>
39
+
40
+
41
+
42
+ </template>
43
+
44
+ <script setup>
45
+ import ShopAlert from '../ui/generic/alerts/ShopAlert.vue'
46
+
47
+ const props = defineProps({
48
+ isLoading:{
49
+ type:Boolean,
50
+ default:true
51
+ },
52
+ isUpdating:{
53
+ type:Boolean,
54
+ default:false
55
+ },
56
+ hasError:{
57
+ type:Boolean,
58
+ default:false
59
+ },
60
+ errorMessage:{
61
+ type:String,
62
+ default:"Ein Fehler ist aufgetreten."
63
+ }
64
+
65
+ })
66
+ </script>
67
+
68
+ <style scoped>
69
+
70
+ .spinner-loading{
71
+ --indicator-color:var(--sl-color-info-500);
72
+ }
73
+ .spinner-error{
74
+ --indicator-color:var(--sl-color-danger-500);
75
+ }
76
+ </style>
File without changes
File without changes
@@ -0,0 +1,140 @@
1
+ <template>
2
+
3
+ <form id="payment-form" class="unzerUI form" novalidate
4
+ @submit.prevent="submitFormToUnzer"
5
+ >
6
+ <template v-if="paymentStore.state.paymentSelection[0] === 'unzer-card'">
7
+ <div class="field">
8
+ <div id="card-element-id-number" class="unzerInput">
9
+ <!-- Card number UI Element is inserted here. -->
10
+ </div>
11
+ </div>
12
+ <div class="two fields">
13
+ <div class="field ten wide">
14
+ <div id="card-element-id-expiry" class="unzerInput">
15
+ <!-- Card expiry date UI Element is inserted here. -->
16
+ </div>
17
+ </div>
18
+ <div class="field six wide">
19
+ <div id="card-element-id-cvc" class="unzerInput">
20
+ <!-- Card CVC UI Element is inserted here. -->
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <template v-if="paymentStore.state.paymentSelection[0] === 'unzer-paypal'">
27
+ <div id="paypal-element" class="field"></div>
28
+ </template>
29
+
30
+ <template v-if="paymentStore.state.paymentSelection[0] === 'unzer-ideal'">
31
+ <div id="ideal-element" class="field"></div>
32
+ </template>
33
+
34
+ <div id="error-holder" class="field" style="color: #9f3a38">
35
+ <!-- Errors will be inserted here -->
36
+ </div>
37
+
38
+ <div class="field">
39
+ <button
40
+ class="unzerUI primary button fluid"
41
+ type="submit">
42
+ Pay
43
+ </button>
44
+ </div>
45
+ </form>
46
+
47
+ </template>
48
+
49
+ <script setup>
50
+ import {reactive, computed, onBeforeMount,watch} from 'vue'
51
+ import {usePaymentStore} from "../../stores/payment"
52
+ import {useOrderStore} from '../../stores/order'
53
+ import { Request } from '@viur/vue-utils'
54
+ const paymentStore = usePaymentStore()
55
+ const orderStore = useOrderStore()
56
+
57
+ const state = reactive({
58
+ unzer: computed(()=>{
59
+ //if (!orderStore.state.checkout) return null
60
+
61
+ return new unzer(orderStore.state.checkout.payment.public_key, {locale: 'de-DE'})
62
+ }),
63
+ })
64
+
65
+ function initUnzerForm(){
66
+ //Unzer field definition
67
+ if (paymentStore.state.paymentSelection[0] === 'unzer-card') {
68
+ const card = state.unzer.Card();
69
+ // Rendering input field card number
70
+ card.create('number', {
71
+ containerId: 'card-element-id-number',
72
+ onlyIframe: false,
73
+ });
74
+ // Rendering input field card expiry
75
+ card.create('expiry', {
76
+ containerId: 'card-element-id-expiry',
77
+ onlyIframe: false,
78
+ });
79
+ // Rendering input field card cvc
80
+ card.create('cvc', {
81
+ containerId: 'card-element-id-cvc',
82
+ onlyIframe: false,
83
+ });
84
+
85
+ state.handler = card
86
+ } else if (paymentStore.state.paymentSelection[0] === 'unzer-paypal') {
87
+ // Creating a PayPal instance
88
+ const paypal = state.unzer.Paypal()
89
+ // Rendering input field
90
+ //paypal.create('email', {
91
+ // containerId: 'paypal-element',
92
+ //});
93
+ state.handler = paypal;
94
+ } else if (paymentStore.state.paymentSelection[0] === 'unzer-sofort') {
95
+ const sofort = state.unzer.Sofort()
96
+ state.handler= sofort;
97
+ } else if (paymentStore.state.paymentSelection[0] === 'unzer-ideal') {
98
+ const ideal = state.unzer.Ideal()
99
+ ideal.create('ideal', {
100
+ containerId: 'ideal-element',
101
+ });
102
+ state.handler = ideal;
103
+ }
104
+ }
105
+
106
+ function submitFormToUnzer(){
107
+ let paymenttarget = paymentStore.state.paymentSelection[0].split("-")[1]
108
+ //send to unzer
109
+ state.handler.createResource().then((result)=>{
110
+ Request.post(`/${orderStore.state.shopClient.shop_module}/pp_unzer_${paymenttarget}/save_type`, {dataObj:{
111
+ order_key: orderStore.state.currentOrderkey,
112
+ type_id: result.id,
113
+ }}).then(async (resp)=>{
114
+ let data = await resp.json()
115
+ orderStore.state.currentOrder = data
116
+ await orderStore.startCheckout()
117
+ }).catch(error => {
118
+ console.log(error)
119
+ })
120
+ }).catch((error)=> {
121
+ // handle errors
122
+ console.error(error)
123
+ })
124
+ }
125
+
126
+
127
+ async function initPayment(){
128
+ initUnzerForm()
129
+ }
130
+
131
+ watch(()=>paymentStore.state.paymentSelection, (newVal, oldVal)=>{
132
+ initUnzerForm()
133
+ })
134
+
135
+
136
+ onBeforeMount(async ()=>{
137
+ initPayment()
138
+ })
139
+
140
+ </script>
@@ -0,0 +1,161 @@
1
+ <template>
2
+ Billing:{{ orderStore.state.currentOrder['billing_address'] }} <br>
3
+ Shipping: {{ cartStore.state.basket['shipping_address'] }}
4
+ ----<br>
5
+
6
+
7
+ <div class="viur-shop-cart-address-headline">
8
+ {{ $t("skeleton.address.address_type.shipping") }}
9
+ </div>
10
+ <loading-handler :isLoading="state.shippingFormLoading || state.billingFormLoading"
11
+ :isUpdating="state.shippingSending || state.billingSending"
12
+ :hasError="state.hasError"
13
+ :errorMessage="state.errorMessage">
14
+ </loading-handler>
15
+ <ViForm
16
+ ref="shippingForm"
17
+ :module="`${cartStore.state.shopModuleName}/address`"
18
+ :action="cartStore.state.basket['shipping_address']? 'edit' : 'add'"
19
+ :skelkey="cartStore.state.basket['shipping_address']? cartStore.state.basket['shipping_address']['dest']['key'] : null"
20
+ :useCategories="false"
21
+ :layout="DefaultLayout"
22
+ >
23
+ </ViForm>
24
+ <div>
25
+ <sl-switch checked @sl-change="state.billingIsShipping=$event.target.checked">Verwende Lieferadresse als Rechnungsadresse</sl-switch>
26
+ </div>
27
+
28
+ <div v-show="!state.billingIsShipping">
29
+ <div class="viur-shop-cart-address-headline">
30
+ {{ $t("skeleton.address.address_type.billing") }}
31
+ </div>
32
+
33
+ <ViForm
34
+ ref="billingForm"
35
+ :module="`${cartStore.state.shopModuleName}/address`"
36
+ :action="orderStore.state.currentOrder['billing_address']? 'edit' : 'add'"
37
+ :skelkey="orderStore.state.currentOrder['billing_address']? orderStore.state.currentOrder['billing_address']['dest']['key'] : null"
38
+ :useCategories="false"
39
+ :layout="DefaultLayout"
40
+ >
41
+ </ViForm>
42
+ </div>
43
+ <sl-button @click="saveAddresses">weiter</sl-button>
44
+ </template>
45
+
46
+ <script setup>
47
+ // Functions
48
+ import { ref, reactive, computed, onBeforeMount, watch } from "vue";
49
+ import { Request } from '@viur/vue-utils'
50
+ import ViForm from "@viur/vue-utils/forms/ViForm.vue";
51
+ import DefaultLayout from "./SimpleDefaultLayout.vue";
52
+ // Stores
53
+ import { useCartStore } from "../../stores/cart";
54
+ import { useAddressStore } from "../../stores/address";
55
+ import { useOrderStore } from "../../stores/order";
56
+
57
+ import loadingHandler from "../generic/loadinghandler.vue"
58
+
59
+
60
+ const emit = defineEmits(["valid"]);
61
+
62
+ const props = defineProps({
63
+ });
64
+
65
+ const cartStore = useCartStore();
66
+ const addressStore = useAddressStore();
67
+ const orderStore = useOrderStore()
68
+
69
+ const shippingForm = ref(null)
70
+ const billingForm = ref(null)
71
+
72
+
73
+
74
+
75
+
76
+ const state = reactive({
77
+ billingIsShipping:true,
78
+
79
+ shippingFormLoading:computed(()=>{
80
+ if (!shippingForm.value){
81
+ return true
82
+ }
83
+ return shippingForm.value.state.loading
84
+ }),
85
+
86
+ billingFormLoading:computed(()=>{
87
+ if (!billingForm.value){
88
+ return true
89
+ }
90
+ return billingForm.value.state.loading
91
+ }),
92
+
93
+ shippingSending:false,
94
+ billingSending:false,
95
+ shippingSuccess:false,
96
+ billingSuccess:false,
97
+ hasError:false,
98
+ errorMessage:"",
99
+ })
100
+
101
+ function saveAddresses(){
102
+ state.shippingSending = true
103
+ state.billingSending = true
104
+ state.shippingSuccess = false
105
+ state.billingSuccess = false
106
+
107
+ shippingForm.value.sendData().then(async (resp)=>{
108
+ let data = await resp.json()
109
+ state.shippingSending = undefined
110
+ if (data['action']==="addSuccess"){
111
+ state.shippingSuccess = true
112
+ }
113
+ })
114
+
115
+ // copy shipping to billing
116
+ if(state.billingIsShipping){
117
+ billingForm.value.state.skel = shippingForm.value.state.skel
118
+ }
119
+
120
+ billingForm.value.sendData().then(async (resp)=>{
121
+ let data = await resp.json()
122
+ state.billingSending = undefined
123
+ if (data['action']==="addSuccess"){
124
+ state.billingSuccess = true
125
+ }
126
+
127
+ await cartStore.state.shopClient.update_cart(cartStore.state.currentbasketKey, )
128
+ })
129
+
130
+
131
+
132
+ }
133
+
134
+
135
+
136
+ function getData(){
137
+
138
+ }
139
+
140
+
141
+ function init(){
142
+ getData()
143
+ }
144
+
145
+ onBeforeMount(()=>{
146
+ init()
147
+ })
148
+
149
+ </script>
150
+
151
+ <style scoped>
152
+ .viur-shop-cart-address-headline {
153
+ display: flex;
154
+ flex-direction: row;
155
+ flex-wrap: nowrap;
156
+ align-items: center;
157
+ justify-content: space-between;
158
+ font-weight: 600;
159
+ margin-bottom: var(--sl-spacing-medium);
160
+ }
161
+ </style>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="vi-shop-cart-form-wrap" v-if="Object.keys(formState.structure).length > 0">
3
+ <slot
4
+ boneName="salutation"
5
+ :widget="CustomSelectBone"
6
+ label="hide"
7
+ >
8
+ </slot>
9
+
10
+ <slot boneName="firstname"
11
+ :widget="CustomStringBone"
12
+ label="hide">
13
+ </slot>
14
+
15
+ <slot boneName="lastname"
16
+ :widget="CustomStringBone"
17
+ label="hide">
18
+ </slot>
19
+
20
+ <slot boneName="street_name"
21
+ :widget="CustomStringBone"
22
+ label="hide">
23
+ </slot>
24
+
25
+ <slot boneName="street_number"
26
+ :widget="CustomStringBone"
27
+ label="hide">
28
+ </slot>
29
+
30
+ <slot
31
+ boneName="zip_code"
32
+ :widget="CustomStringBone"
33
+ placeholder="PLZ"
34
+ label="hide"
35
+ >
36
+ </slot>
37
+
38
+ <slot boneName="city"
39
+ :widget="CustomStringBone"
40
+ label="hide">
41
+ </slot>
42
+
43
+
44
+ <slot boneName="country"
45
+ :widget="CustomSelectBone"
46
+ label="hide">
47
+ </slot>
48
+
49
+ <slot boneName="address_type"
50
+ :widget="CustomSelectBone"
51
+ label="hide">
52
+ </slot>
53
+ </div>
54
+
55
+
56
+ </template>
57
+ <script setup>
58
+ import { inject } from "vue";
59
+ import { getBoneWidget } from "@viur/vue-utils/bones/edit";
60
+ import CustomBooleanBone from "../ui/userdata/CustomBooleanBone.vue";
61
+ import CustomStringBone from "../ui/userdata/CustomStringBone.vue";
62
+ import CustomSelectBone from "../ui/userdata/CustomSelectBone.vue";
63
+
64
+ const formState = inject("formState");
65
+ const formUpdate = inject("formUpdate");
66
+ </script>
67
+ <style scoped>
68
+
69
+ .vi-shop-cart-form-wrap{
70
+ display: grid;
71
+ grid-template-columns: repeat(4, minmax(0, 1fr));
72
+ gap: var(--sl-spacing-small);
73
+ margin-bottom: var(--sl-spacing-medium);
74
+ }
75
+
76
+ :deep(.bone-wrapper){
77
+ margin: 0;
78
+ }
79
+
80
+ :deep(.wrapper-bone-firstname){
81
+ grid-column: 1 / span 2;
82
+ }
83
+
84
+ :deep(.wrapper-bone-lastname){
85
+ grid-column: 3 / span 2;
86
+ }
87
+
88
+ :deep(.wrapper-bone-street_name){
89
+ grid-column: 1 / span 3;
90
+ }
91
+
92
+ :deep(.wrapper-bone-street_number){
93
+ grid-column: 4 / span 1;
94
+ }
95
+
96
+ :deep(.wrapper-bone-zip_code){
97
+ grid-column: 1 / span 2;
98
+ }
99
+
100
+ :deep(.wrapper-bone-city){
101
+ grid-column: 3 / span 2;
102
+ }
103
+
104
+ :deep(.wrapper-bone-country){
105
+ grid-column: 1 / span 4;
106
+ }
107
+
108
+ :deep(.wrapper-bone-is_default){
109
+ padding: var(--sl-spacing-x-small) 0;
110
+ grid-column: 1 / span 4;
111
+ }
112
+
113
+
114
+
115
+
116
+ </style>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <template v-for="(option,i) in options">
3
+ <sl-card selectable @sl-change="changeSelection(i)" :selected="i===state.currentSelection" horizontal>
4
+ <slot :option="option" :index="i">
5
+ {{i}}: {{ option }}
6
+ </slot>
7
+ </sl-card>
8
+ </template>
9
+ </template>
10
+
11
+ <script setup>
12
+ import {reactive} from 'vue'
13
+
14
+ const selection = defineModel("selection")
15
+
16
+ const emits = defineEmits(['change'])
17
+
18
+ const props = defineProps({
19
+ options:{
20
+ type: Array,
21
+ default:[]
22
+ },
23
+ })
24
+
25
+ const state = reactive({
26
+ currentSelection:null
27
+ })
28
+
29
+ function changeSelection(i){
30
+ if (state.currentSelection === i){
31
+ state.currentSelection = null
32
+ selection.value = null
33
+ }else{
34
+ state.currentSelection = i
35
+ selection.value = props.options[i]
36
+ }
37
+ emits("change", selection.value)
38
+ }
39
+
40
+
41
+ </script>
42
+
43
+ <style scoped>
44
+ sl-card{
45
+ width: 100%;
46
+ &[selected]::part(base){
47
+ border:1px solid var(--sl-color-primary-500);
48
+ box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color);
49
+ }
50
+ }
51
+
52
+ </style>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <!-- <pre v-for="item in list">
3
+ {{ item }}
4
+ </pre> -->
5
+ <sl-table-wrapper searchable sortable>
6
+ <table>
7
+ <thead>
8
+ <tr>
9
+ <th></th>
10
+ <th>Name</th>
11
+ <th>Anzahl</th>
12
+ <th>Preis</th>
13
+ </tr>
14
+ </thead>
15
+
16
+ <tbody>
17
+ <template v-for="(item, index) in list">
18
+ <tr v-if="index < count">
19
+ <td>
20
+ <img
21
+ :src="Request.downloadUrlFor(item.shop_image)"
22
+ alt=""
23
+ style="width: 50px; height: 50px; object-fit: cover"
24
+ v-if="item?.shop_image"
25
+ />
26
+ <img
27
+ :src="cartStore.state.placeholder"
28
+ alt=""
29
+ style="width: 50px; height: 50px; object-fit: cover"
30
+ v-else
31
+ />
32
+ </td>
33
+
34
+ <td>{{ item.shop_name }}</td>
35
+ <td>{{ item.quantity }}</td>
36
+ <td>{{ item.shop_price_retail * item.quantity }}</td>
37
+ </tr>
38
+ <div v-else-if="index === list.length - 1">...</div>
39
+ </template>
40
+ </tbody>
41
+ </table>
42
+ </sl-table-wrapper>
43
+ <div v-if="showTrigger">
44
+ <sl-button v-if="!showMore" @click="showMore = !showMore">
45
+ Mehr anzeigen
46
+ </sl-button>
47
+ <sl-button v-else @click="showMore = !showMore">
48
+ Weniger anzeigen
49
+ </sl-button>
50
+ </div>
51
+ </template>
52
+ <script setup>
53
+ import { computed, ref } from "vue";
54
+ import { Request } from "@viur/vue-utils";
55
+ import { useCartStore } from "../../../stores/cart";
56
+
57
+ const props = defineProps({
58
+ list: { type: Array, required: true },
59
+ limit: { type: Number, default: 4 },
60
+ });
61
+
62
+ const cartStore = useCartStore();
63
+
64
+ const showTrigger = computed(() => props.list.length > props.limit);
65
+ const showMore = ref(false);
66
+ const count = computed(() =>
67
+ showMore.value ? props.list.length : props.limit,
68
+ );
69
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="viur-shop-cart-sidebar-shipping">
3
+ <div class="viur-shop-cart-shipping-item">
4
+ <slot name="custom"></slot>
5
+ </div>
6
+ <div class="viur-shop-cart-shipping-item">
7
+ <span>Versandkosten </span>
8
+ <sl-format-number
9
+ type="currency"
10
+ currency="EUR"
11
+ :value="shippingCost"
12
+ lang="de"
13
+ >
14
+ </sl-format-number>
15
+ </div>
16
+ <div class="viur-shop-cart-shipping-item">
17
+ <span>Lieferzeit </span>
18
+ {{ deliveryTime === 1 ? deliveryTime + " Tag" : deliveryTime + " Tage" }}
19
+ </div>
20
+ </div>
21
+ </template>
22
+ <script setup>
23
+ import { useShippingStore } from "../../../stores/shipping";
24
+ import { computed } from "vue";
25
+
26
+ const shippingStore = useShippingStore();
27
+
28
+ const shippingCost = computed(() => {
29
+ return shippingStore.state.selectedShippingMethod?.dest.shipping_cost
30
+ ? shippingStore.state.selectedShippingMethod.dest.shipping_cost
31
+ : 0;
32
+ });
33
+
34
+ const deliveryTime = computed(() => {
35
+ return shippingStore.state.selectedShippingMethod?.dest.delivery_time_max
36
+ ? shippingStore.state.selectedShippingMethod.dest.delivery_time_max
37
+ : 0;
38
+ });
39
+ </script>
40
+
41
+ <style scoped>
42
+ .viur-shop-cart-sidebar-shipping {
43
+ width: 100%;
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: center;
47
+ justify-content: flex-start;
48
+ flex-wrap: nowrap;
49
+ margin: var(--sl-spacing-2x-small) 0;
50
+ }
51
+ .viur-shop-cart-shipping-item {
52
+ width: 100%;
53
+ display: flex;
54
+ justify-content: space-between;
55
+ }
56
+ </style>