@viur/shop-components 0.0.1-dev.60 → 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 (135) hide show
  1. package/old/client/HttpClient.js +111 -0
  2. package/old/client/ViURShopClient.js +472 -0
  3. package/old/client/index.js +23 -0
  4. package/old/client/types.js +10 -0
  5. package/old/components/ExampleUsage.vue +95 -0
  6. package/old/components/ShopCart.vue +91 -0
  7. package/old/components/ShopOrderConfirm.vue +311 -0
  8. package/{src → old}/components/ShopOrderStepper.vue +111 -23
  9. package/old/components/ShopPaymentProvider.vue +113 -0
  10. package/old/components/ShopShippingMethod.vue +52 -0
  11. package/{src/components/ui → old/components}/ShopSummary.vue +28 -35
  12. package/{src → old}/components/ShopUserData.vue +51 -65
  13. package/{src → old}/components/cart/CartLeafModel.vue +24 -16
  14. package/{src → old}/components/cart/CartNode.vue +1 -0
  15. package/{src → old}/components/cart/CartTree.vue +13 -0
  16. package/old/components/cart/CartView.vue +82 -0
  17. package/{src → old}/components/cart/Discount.vue +8 -8
  18. package/old/components/generic/loadinghandler.vue +76 -0
  19. package/old/components/paymentProvider/prepayment.vue +0 -0
  20. package/old/components/paymentProvider/unzerPayment.vue +140 -0
  21. package/old/components/simple/ShopUserData.vue +161 -0
  22. package/old/components/simple/SimpleDefaultLayout.vue +116 -0
  23. package/old/components/ui/generic/CardSelector.vue +52 -0
  24. package/old/components/ui/generic/CartList.vue +69 -0
  25. package/old/components/ui/generic/ShippingInfo.vue +56 -0
  26. package/old/components/ui/generic/alerts/ShopAlert.vue +30 -0
  27. package/old/components/ui/payment/PaymentOption.vue +79 -0
  28. package/old/components/ui/payment/PaymentSelector.vue +158 -0
  29. package/old/components/ui/stepper/StepperItem.vue +90 -0
  30. package/{src → old}/components/ui/stepper/StepperTab.vue +30 -2
  31. package/old/components/ui/stepper/StepperTrigger.vue +69 -0
  32. package/old/components/ui/userdata/AddForm.vue +160 -0
  33. package/old/components/ui/userdata/AddressBox.vue +137 -0
  34. package/{src → old}/components/ui/userdata/BaseLayout.vue +15 -32
  35. package/old/stores/address.js +122 -0
  36. package/old/stores/cart.js +266 -0
  37. package/old/stores/message.js +21 -0
  38. package/old/stores/order.js +202 -0
  39. package/old/stores/payment.js +79 -0
  40. package/old/stores/shipping.js +78 -0
  41. package/package.json +3 -5
  42. package/src/Shop.vue +212 -0
  43. package/src/ShopOrderStepper.vue +89 -0
  44. package/src/ShopSummary.vue +170 -0
  45. package/src/Steps/ShopCart.vue +60 -0
  46. package/src/Steps/ShopOrderComplete.vue +24 -0
  47. package/src/Steps/ShopOrderConfirm.vue +295 -0
  48. package/src/Steps/ShopPaymentProvider.vue +53 -0
  49. package/src/Steps/ShopShippingMethod.vue +53 -0
  50. package/src/Steps/ShopUserDataGuest.vue +78 -0
  51. package/src/Steps/index.js +15 -0
  52. package/src/components/AddressForm.vue +84 -0
  53. package/src/components/AddressFormLayout.vue +107 -0
  54. package/src/components/CardSelector.vue +68 -0
  55. package/src/components/CartItem.vue +325 -0
  56. package/src/components/CartItemSmall.vue +257 -0
  57. package/src/components/LoadingHandler.vue +76 -0
  58. package/src/components/PaymentOption.vue +78 -0
  59. package/src/components/PaymentProviderUnzer.vue +201 -0
  60. package/src/components/PaymentSelector.vue +55 -0
  61. package/src/components/ShopAlert.vue +30 -0
  62. package/src/components/StepperTab.vue +132 -0
  63. package/src/components/dialogButton.vue +49 -0
  64. package/src/composables/address.js +95 -0
  65. package/src/composables/cart.js +132 -0
  66. package/src/composables/order.js +80 -0
  67. package/src/composables/payment.js +75 -0
  68. package/src/composables/shipping.js +32 -0
  69. package/src/main.js +32 -38
  70. package/src/shop.js +251 -0
  71. package/src/translations/de.js +15 -0
  72. package/src/translations/en.js +5 -0
  73. package/src/utils.js +49 -0
  74. package/vite.config.js +0 -2
  75. package/src/components/ShopCart.vue +0 -512
  76. package/src/components/ShopOrderConfirm.vue +0 -291
  77. package/src/components/cart/CartView.vue +0 -723
  78. package/src/components/order/OrderSidebar.vue +0 -102
  79. package/src/components/order/category/CategoryList.vue +0 -83
  80. package/src/components/order/category/CategoryView.vue +0 -143
  81. package/src/components/order/information/adress/ShippingAdress.vue +0 -143
  82. package/src/components/order/item/ItemCard.vue +0 -168
  83. package/src/components/order/item/ItemView.vue +0 -232
  84. package/src/components/order/process/ConfirmView.vue +0 -312
  85. package/src/components/order/process/ExampleUsage.vue +0 -113
  86. package/src/components/order/process/OrderTabHeader.vue +0 -16
  87. package/src/components/order/process/SelectPaymentProvider.vue +0 -62
  88. package/src/components/order/process/Shipping.vue +0 -46
  89. package/src/components/ui/generic/ArticleList.vue +0 -222
  90. package/src/components/ui/generic/ExamplePagination.vue +0 -236
  91. package/src/components/ui/generic/alerts/ShopAlert.vue +0 -19
  92. package/src/components/ui/generic/makeData.js +0 -39
  93. package/src/components/ui/stepper/StepperItem.vue +0 -39
  94. package/src/components/ui/stepper/StepperTrigger.vue +0 -35
  95. package/src/components/ui/userdata/AddForm.vue +0 -125
  96. package/src/components/ui/userdata/AddressBox.vue +0 -117
  97. package/src/router/index.js +0 -103
  98. package/src/stores/cart.js +0 -336
  99. package/src/views/ViewMissing.vue +0 -20
  100. /package/{src → old}/components/ShopOrderComplete.vue +0 -0
  101. /package/{src → old}/components/cart/CartLeaf.vue +0 -0
  102. /package/{src → old}/components/cart/CartTreeWrapper.vue +0 -0
  103. /package/{src/components/lib/utils.js → old/components/paymentProvider/paypalplus.vue} +0 -0
  104. /package/{src → old}/components/ui/generic/ShopPriceFormatter.vue +0 -0
  105. /package/{src → old}/components/ui/userdata/CustomBooleanBone.vue +0 -0
  106. /package/{src → old}/components/ui/userdata/CustomSelectBone.vue +0 -0
  107. /package/{src → old}/components/ui/userdata/CustomStringBone.vue +0 -0
  108. /package/{src → old}/components/ui/userdata/DefaultLayout.vue +0 -0
  109. /package/{src → old}/components/ui/userdata/SelectAddress.vue +0 -0
  110. /package/{src → old}/components/ui/userdata/multi/ActionBar.vue +0 -0
  111. /package/{src → old}/components/ui/userdata/multi/CartSelection.vue +0 -0
  112. /package/{src/style → old}/ignite/.editorconfig +0 -0
  113. /package/{src/style → old}/ignite/.github/workflows/ignite.yml +0 -0
  114. /package/{src/style → old}/ignite/.github/workflows/node.yml +0 -0
  115. /package/{src/style → old}/ignite/.postcssrc.cjs +0 -0
  116. /package/{src/style → old}/ignite/CHANGELOG.md +0 -0
  117. /package/{src/style → old}/ignite/LICENSE +0 -0
  118. /package/{src/style → old}/ignite/README.md +0 -0
  119. /package/{src/style → old}/ignite/dist/ignite.css +0 -0
  120. /package/{src/style → old}/ignite/dist/ignite.min.css +0 -0
  121. /package/{src/style → old}/ignite/foundation/basic.css +0 -0
  122. /package/{src/style → old}/ignite/foundation/color.css +0 -0
  123. /package/{src/style → old}/ignite/foundation/config.css +0 -0
  124. /package/{src/style → old}/ignite/foundation/grid.css +0 -0
  125. /package/{src/style → old}/ignite/foundation/mediaqueries.css +0 -0
  126. /package/{src/style → old}/ignite/foundation/reset.css +0 -0
  127. /package/{src/style → old}/ignite/ignite.css +0 -0
  128. /package/{src/style → old}/ignite/ignite.css.map +0 -0
  129. /package/{src/style → old}/ignite/package-lock.json +0 -0
  130. /package/{src/style → old}/ignite/package.json +0 -0
  131. /package/{src/style → old}/ignite/shoelace.css +0 -0
  132. /package/{src/style → old}/ignite/themes/dark.css +0 -0
  133. /package/{src/style → old}/ignite/themes/light.css +0 -0
  134. /package/{src/style → old}/ignite/utilities/shoelace.css +0 -0
  135. /package/{src/style → old}/ignite/utilities/utilities.css +0 -0
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
 
4
4
  <span>Haben Sie noch ein Gutschein?</span><br>
5
- <span v-if="!cartStore.state.basketRootNode.discount">Es befindet sich noch kein Gutschein im Warenkorb.</span>
5
+ <span v-if="!cartStore.state.basket.discount">Es befindet sich noch kein Gutschein im Warenkorb.</span>
6
6
  <sl-button-group>
7
7
  <sl-input placeholder="Rabatt Code" ref="codeInput">
8
8
 
@@ -15,17 +15,17 @@
15
15
  </sl-alert>
16
16
  </div>
17
17
  <div>
18
- <div v-if="cartStore.state.basketRootNode.discount">
18
+ <div v-if="cartStore.state.basket.discount">
19
19
  <!--Todo bessere texte und translations??-->
20
- <div v-if="cartStore.state.basketRootNode.discount.dest.discount_type==='absolute'">
20
+ <div v-if="cartStore.state.basket.discount.dest.discount_type==='absolute'">
21
21
  <span>
22
- Sie haben einen Rabattcode im Wert von {{ cartStore.state.basketRootNode.discount.dest.absolute }} € eingegeben
22
+ Sie haben einen Rabattcode im Wert von {{ cartStore.state.basket.discount.dest.absolute }} € eingegeben
23
23
  </span>
24
24
  <sl-icon-button name="x-lg" label="Löschen" @click="removeDiscountCode"></sl-icon-button>
25
25
  </div>
26
- <div v-if="cartStore.state.basketRootNode.discount.dest.discount_type==='percentage'">
26
+ <div v-if="cartStore.state.basket.discount.dest.discount_type==='percentage'">
27
27
  <span>
28
- Sie haben einen Rabattcode im Wert von {{ cartStore.state.basketRootNode.discount.dest.percentage }} % eingegeben
28
+ Sie haben einen Rabattcode im Wert von {{ cartStore.state.basket.discount.dest.percentage }} % eingegeben
29
29
  </span>
30
30
  <sl-icon-button name="x-lg" label="Löschen" @click="removeDiscountCode"></sl-icon-button>
31
31
  </div>
@@ -72,8 +72,8 @@ async function removeDiscountCode() {
72
72
 
73
73
  errorMessageContainer.value.hide();
74
74
  state.isFetching = true;
75
- console.log("code ", cartStore.state.basketRootNode.discount.dest.key)
76
- cartStore.removeDiscount(cartStore.state.basketRootNode.discount.dest.key).then((res) => {
75
+ console.log("code ", cartStore.state.basket.discount.dest.key)
76
+ cartStore.removeDiscount(cartStore.state.basket.discount.dest.key).then((res) => {
77
77
  cartStore.init();//TODO muss man alles neuladen ??
78
78
  state.isFetching = false;
79
79
 
@@ -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
@@ -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>