@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,295 @@
1
+ <template>
2
+ <div class="list">
3
+ <h2 class="viur-shop-cart-headline headline">{{ $t('shop.check_order')}}</h2>
4
+ <div class="viur-shop-cart-address-wrap">
5
+ <div class="viur-shop-cart-address">
6
+ <div class="viur-shop-cart-address-headline">
7
+ {{ $t('viur.shop.skeleton.cartnode.shipping_address') }}
8
+ </div>
9
+ <template v-if="state.shippingAddress">
10
+ {{ state.shippingAddress?.firstname }}
11
+ {{ state.shippingAddress?.lastname }}<br />
12
+ {{ state.shippingAddress?.street_name }}
13
+ {{ state.shippingAddress?.street_number }}<br />
14
+ {{ state.shippingAddress?.zip_code }}
15
+ {{ state.shippingAddress?.city }}<br />
16
+ {{ getDescrName('country',state.shippingAddress?.country) }}<br />
17
+ </template>
18
+ </div>
19
+ <div class="viur-shop-cart-address">
20
+ <div class="viur-shop-cart-address-headline">
21
+ {{ $t('viur.shop.skeleton.order.billing_address') }}
22
+ </div>
23
+ <template v-if="state.billingAddress">
24
+ {{ state.billingAddress.firstname }}
25
+ {{ state.billingAddress.lastname }}<br />
26
+ {{ state.billingAddress.street_name }}
27
+ {{ state.billingAddress.street_number }}<br />
28
+ {{ state.billingAddress.zip_code }}
29
+ {{ state.billingAddress.city }}<br />
30
+ {{ getDescrName('country',state.billingAddress.country) }}<br />
31
+ </template>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="viur-shop-cart-payment">
36
+ <div class="viur-shop-cart-payment-method">
37
+ <span>{{ $t('viur.shop.skeleton.order.payment') }} </span>
38
+ <p>
39
+ {{ shopStore.state['paymentMeta']?.[state.payment]?.['title']}}
40
+ </p>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="viur-shop-cart-payment">
45
+ <div class="viur-shop-cart-payment-method">
46
+ <span>{{ $t('viur.shop.module.shipping') }}</span>
47
+ <p>
48
+ {{ state.shipping?.name }}
49
+ -
50
+ <sl-format-number
51
+ type="currency"
52
+ currency="EUR"
53
+ :value="
54
+ state.shipping?.shipping_cost
55
+ "
56
+ lang="de"
57
+ >
58
+ </sl-format-number>
59
+ </p>
60
+ </div>
61
+ </div>
62
+
63
+ <sl-details :summary="$t('viur.shop.skeleton.order.cart')">
64
+ <cart-item-small v-for="item in state.cartList" :item="item">
65
+ </cart-item-small>
66
+ </sl-details>
67
+ </div>
68
+
69
+ <div class="wrapper">
70
+ <sl-button size="small" @click="startCheckout" :disabled="!shopStore.state.canCheckout" variant="success">{{ $t('shop.order_pay') }}</sl-button>
71
+ </div>
72
+
73
+ <template v-if="shopStore.state.order?.['payment_provider'] !== null && shopStore.state.order?.['payment_provider'].startsWith('unzer-')">
74
+ <sl-dialog v-if="state.paymentPopup" label="Zahlung" :open="state.paymentPopup" @sl-after-hide="state.paymentPopup=false">
75
+ <payment-provider-unzer @cancel="paymentCanceled"></payment-provider-unzer>
76
+ </sl-dialog>
77
+ </template>
78
+ </template>
79
+ <script setup>
80
+ import {computed, onBeforeMount, reactive, watch} from 'vue'
81
+ import { useViurShopStore } from '../shop';
82
+ import boneUtils from '@viur/vue-utils/bones/utils'
83
+ import {Request} from '@viur/vue-utils'
84
+ import CartItemSmall from '../components/CartItemSmall.vue';
85
+ import PaymentProviderUnzer from '../components/PaymentProviderUnzer.vue';
86
+ const shopStore = useViurShopStore()
87
+
88
+
89
+ // collected data from order Object > Session cart is not available anymore
90
+ const state = reactive({
91
+ shippingAddress: computed(()=>shopStore.state.order?.['cart']?.['dest']?.['shipping_address']?.['dest']),
92
+ shipping: computed(()=>shopStore.state.order?.['cart']?.['dest']?.['shipping']?.['dest']),
93
+ billingAddress: computed(()=>shopStore.state.order?.['billing_address']?.['dest']),
94
+ payment: computed(()=>shopStore.state.order?.['payment_provider']),
95
+ cartList:[],
96
+ paymentPopup:false
97
+ })
98
+
99
+
100
+ // simple wrapper for value rendering
101
+ function getDescrName(boneName, val) {
102
+ if (!shopStore.state.addressStructure || !val) return val
103
+ return boneUtils.getDescr(shopStore.state.addressStructure[boneName],val)
104
+ }
105
+
106
+ // fetch cart from order
107
+ function getOrderCart(){
108
+ let cartKey = shopStore.state.order?.['cart']?.['dest']?.['key']
109
+ Request.get(`${shopStore.state.shopApiUrl}/cart_list`,{dataObj:{
110
+ cart_key:cartKey
111
+ }}).then(async( resp) =>{
112
+ let data = await resp.json()
113
+ state.cartList=data
114
+ })
115
+ }
116
+
117
+ function paymentCanceled(){
118
+ state.paymentPopup=false
119
+ }
120
+
121
+ //open popup and freeze cart
122
+ function startCheckout(){
123
+ state.paymentPopup=true
124
+ shopStore.checkout()
125
+ }
126
+
127
+ //close popup if payment successfull
128
+ watch(()=>shopStore.state.order?.['is_paid'],(newVal,oldVal)=>{
129
+ if(newVal){
130
+ state.paymentPopup=false
131
+ }
132
+ })
133
+
134
+ onBeforeMount(()=>{
135
+ getOrderCart()
136
+ })
137
+
138
+ </script>
139
+
140
+ <style scoped>
141
+ .wrapper{
142
+ padding:20px;
143
+ }
144
+
145
+ .viur-shop-cart-sidebar-btn-wrap {
146
+ display: flex;
147
+ flex-direction: column;
148
+ margin-top: var(--sl-spacing-large);
149
+
150
+ sl-button {
151
+ margin-bottom: var(--sl-spacing-x-small);
152
+ }
153
+ }
154
+
155
+ sl-alert {
156
+ margin-top: var(--sl-spacing-medium);
157
+ margin-bottom: var(--sl-spacing-medium);
158
+ }
159
+
160
+ sl-tooltip {
161
+ &::part(body) {
162
+ line-height: 1.2;
163
+ font-weight: 400;
164
+ padding: 10px;
165
+ }
166
+ }
167
+
168
+ sl-menu-item {
169
+ &::part(base) {
170
+ padding: 0.2em 0.9em 0.2em 0.8em;
171
+ }
172
+
173
+ &::part(checked-icon) {
174
+ display: none;
175
+ }
176
+
177
+ &::part(prefix) {
178
+ margin-right: 10px;
179
+ }
180
+
181
+ &::part(suffix) {
182
+ margin-right: -1.5em;
183
+ }
184
+ }
185
+
186
+ .viur-shop-cart-sidebar-info-line {
187
+ display: flex;
188
+ flex-direction: row;
189
+ flex-wrap: nowrap;
190
+ margin: var(--sl-spacing-2x-small) 0;
191
+
192
+ span {
193
+ margin-right: auto;
194
+ }
195
+
196
+ &.total {
197
+ font-weight: 600;
198
+ border-top: 1px solid var(--sl-color-neutral-300);
199
+ border-bottom: 1px solid var(--sl-color-neutral-300);
200
+ padding: var(--sl-spacing-x-small) 0;
201
+ margin: var(--sl-spacing-small) 0;
202
+ }
203
+ }
204
+
205
+ .viur-shop-cart-mini-card {
206
+ margin-bottom: var(--sl-spacing-x-large);
207
+
208
+ &::part(header) {
209
+ border-bottom: none;
210
+ padding-top: 0;
211
+ padding-right: 0;
212
+ }
213
+
214
+ &::part(image) {
215
+ flex-basis: 25%;
216
+ max-width: 90px;
217
+ }
218
+
219
+ &::part(body) {
220
+ display: flex;
221
+ flex: 1;
222
+ padding-top: 0;
223
+ padding-bottom: 0;
224
+ padding-right: 0;
225
+ }
226
+
227
+ &::part(group) {
228
+ padding: var(--sl-spacing-small) 0;
229
+ }
230
+ }
231
+
232
+ .viur-shop-cart-mini-card-body-row {
233
+ display: grid;
234
+ grid-template-columns: 1fr auto auto;
235
+ gap: var(--sl-spacing-large);
236
+ flex: 1;
237
+ }
238
+
239
+ .viur-shop-cart-mini-card-body-info {
240
+ display: flex;
241
+ flex-direction: column;
242
+ height: 100%;
243
+ }
244
+
245
+ .viur-shop-cart-mini-card-info-wrap {
246
+ display: flex;
247
+ flex-wrap: nowrap;
248
+ gap: var(--sl-spacing-medium);
249
+ }
250
+
251
+ .viur-shop-cart-mini-card-info {
252
+ display: flex;
253
+ flex-direction: row;
254
+ flex-wrap: nowrap;
255
+
256
+ span {
257
+ margin-right: var(--sl-spacing-x-small);
258
+ font-weight: 600;
259
+ }
260
+ }
261
+
262
+ .viur-shop-cart-address-wrap {
263
+ display: grid;
264
+ grid-template-columns: 1fr 1fr;
265
+ gap: var(--sl-spacing-x-large);
266
+ margin-bottom: var(--sl-spacing-x-large);
267
+ }
268
+
269
+ .viur-shop-cart-address-headline {
270
+ display: flex;
271
+ flex-direction: row;
272
+ flex-wrap: nowrap;
273
+ align-items: center;
274
+ justify-content: space-between;
275
+ font-weight: 600;
276
+ }
277
+
278
+ .viur-shop-cart-payment {
279
+ display: flex;
280
+ flex-direction: row;
281
+ flex-wrap: nowrap;
282
+ align-items: center;
283
+ justify-content: space-between;
284
+ margin-bottom: var(--sl-spacing-x-large);
285
+
286
+ span {
287
+ font-weight: 600;
288
+ }
289
+ }
290
+
291
+ .viur-shop-cart-headline {
292
+ margin: 0 0 var(--sl-spacing-x-large) 0;
293
+ font-size: var(--shop-form-headline-size);
294
+ }
295
+ </style>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <sl-radio-group :value="state.selection">
3
+ <sl-details-group>
4
+
5
+ <payment-option v-for="option in paymentState.paymentData" :key="option.id"
6
+ :paymenttype="option.paymenttype"
7
+ :name="option.name"
8
+ :icon="option.icon"
9
+ :widget="option.widget"
10
+ :description="option.description"
11
+ @change="optionChanged"
12
+
13
+ >
14
+ </payment-option>
15
+
16
+ </sl-details-group>
17
+ </sl-radio-group>
18
+
19
+ <slot
20
+ nextName="weiter"
21
+ :activefunction="()=>shopStore.state.order?.['payment_provider']"
22
+ :nextfunction="()=>true"
23
+ >
24
+ </slot>
25
+
26
+ </template>
27
+ <script setup>
28
+ import {computed, reactive, onBeforeMount} from 'vue'
29
+ import PaymentOption from "../components/PaymentOption.vue";
30
+ import {usePayment} from "../composables/payment";
31
+ import {useOrder} from "../composables/order";
32
+ import {useViurShopStore} from "../shop";
33
+
34
+ const {state:paymentState, fetchPaymentData} = usePayment()
35
+ const {addOrUpdateOrder} = useOrder()
36
+ const shopStore = useViurShopStore()
37
+
38
+ const state = reactive({
39
+ selection:null,
40
+ })
41
+
42
+ function optionChanged(type){
43
+ shopStore.state.order['payment_provider'] = null
44
+ state.selection=type
45
+ addOrUpdateOrder({payment_provider:type})
46
+ }
47
+
48
+ onBeforeMount(()=>{
49
+ fetchPaymentData().then(()=>{
50
+ state.selection = shopStore.state.order?.['payment_provider']
51
+ })
52
+ })
53
+ </script>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <loading-handler :isLoading="shippingState.isLoading">
3
+
4
+ <card-selector :options="shippingState.shippingData"
5
+ v-model:selection="state.selectedShippingMethod"
6
+ @change="updateShippingMethod"
7
+ >
8
+ <template v-slot="{option, index}">
9
+ <img slot="image">
10
+ {{ option['dest']['name'] }} - Lieferzeit: {{ option['dest']['delivery_time_range'] }} Tage
11
+ </template>
12
+ </card-selector>
13
+ </loading-handler>
14
+ <slot
15
+ nextName="weiter"
16
+ :activefunction="()=>shopStore.state.cartRoot?.['shipping']"
17
+ :nextfunction="()=>true"
18
+ >
19
+ </slot>
20
+ </template>
21
+ <script setup>
22
+ import {reactive,onBeforeMount} from "vue";
23
+ import CardSelector from "../components/CardSelector.vue";
24
+ import LoadingHandler from "../../old/components/generic/loadinghandler.vue";
25
+ import {useShipping} from "../composables/shipping";
26
+ import {useCart} from "../composables/cart";
27
+ import {useViurShopStore} from "../shop";
28
+
29
+ const shopStore = useViurShopStore();
30
+ const {updateCart} = useCart();
31
+ const {state: shippingState,fetchShippingData} = useShipping();
32
+
33
+ const state = reactive({
34
+ selectedShippingMethod: null
35
+ })
36
+
37
+ function updateShippingMethod(selection){
38
+ shopStore.state.cartRoot['shipping'] = null
39
+ if (selection){
40
+ updateCart({shipping_key:selection['dest']['key']})
41
+ }
42
+ }
43
+
44
+ onBeforeMount(()=>{
45
+ fetchShippingData()
46
+ state.selectedShippingMethod = shopStore.state.cartRoot?.['shipping']
47
+ })
48
+ </script>
49
+
50
+
51
+ <style scoped>
52
+
53
+ </style>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div class="viur-shop-cart-address-headline">
3
+ {{ $t("skeleton.address.address_type.shipping") }}
4
+ </div>
5
+
6
+ <address-form :formtype="addressState.billingIsShipping?'both':'shipping'">
7
+ </address-form>
8
+ <div>
9
+ <sl-switch :checked="addressState.billingIsShipping" @sl-change="switchAddresses">Verwende Lieferadresse als Rechnungsadresse</sl-switch>
10
+ </div>
11
+
12
+ <div v-show="!addressState.billingIsShipping">
13
+ <div class="viur-shop-cart-address-headline">
14
+ {{ $t("skeleton.address.address_type.billing") }}
15
+ </div>
16
+ <address-form formtype="billing" ></address-form>
17
+ </div>
18
+
19
+ <slot
20
+ nextName="weiter"
21
+ :activefunction="()=>true"
22
+ :nextfunction="nextStep"
23
+ >
24
+ </slot>
25
+ </template>
26
+
27
+
28
+
29
+ <script setup>
30
+ import {reactive, onBeforeMount, watch} from 'vue'
31
+ import AddressForm from '../components/AddressForm.vue'
32
+ import {useAddress} from "../composables/address";
33
+ import {useViurShopStore} from "../shop";
34
+ const shopStore = useViurShopStore();
35
+ const {state:addressState,saveAddresses} = useAddress()
36
+
37
+ const state = reactive({
38
+ })
39
+
40
+ function switchAddresses(event){
41
+ addressState.billingIsShipping=event.target.checked
42
+ }
43
+
44
+ onBeforeMount(()=>{
45
+ if (shopStore.state.cartRoot?.['shipping_address']?.['dest']?.['address_type']?.includes('billing') || !shopStore.state.cartRoot?.['shipping_address']?.['dest']){
46
+ addressState.billingIsShipping = true
47
+ }else{
48
+ addressState.billingIsShipping = false
49
+ }
50
+ })
51
+
52
+
53
+ async function nextStep(){
54
+ // form is only valid if the action field ends with Success
55
+ try{
56
+ let result = await saveAddresses(addressState.billingIsShipping)
57
+ if (result['action'] && result['action'].endsWith('Success')){
58
+ return true
59
+ }
60
+ return false
61
+ } catch(error){
62
+ return false
63
+ }
64
+ }
65
+
66
+ </script>
67
+
68
+ <style scoped>
69
+ .viur-shop-cart-address-headline {
70
+ display: flex;
71
+ flex-direction: row;
72
+ flex-wrap: nowrap;
73
+ align-items: center;
74
+ justify-content: space-between;
75
+ font-weight: 600;
76
+ margin-bottom: var(--sl-spacing-medium);
77
+ }
78
+ </style>
@@ -0,0 +1,15 @@
1
+ import ShopCart from './ShopCart.vue'
2
+ import ShopUserDataGuest from './ShopUserDataGuest.vue'
3
+ import ShopShippingMethod from './ShopShippingMethod.vue'
4
+ import ShopPaymentProvider from './ShopPaymentProvider.vue'
5
+ import ShopOrderConfirm from './ShopOrderConfirm.vue'
6
+ import ShopOrderComplete from './ShopOrderComplete.vue'
7
+
8
+ export {
9
+ ShopCart,
10
+ ShopUserDataGuest,
11
+ ShopShippingMethod,
12
+ ShopPaymentProvider,
13
+ ShopOrderConfirm,
14
+ ShopOrderComplete
15
+ }
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <LoadingHandler :is-loading="addressState[`${state.formtype}IsLoading`]"></LoadingHandler>
3
+ <ViForm
4
+ :ref="(el)=>{addressState[`${state.formtype}Form`]=el; return el}"
5
+ :module="`${shopStore.state.moduleName}/address`"
6
+ :action="state.action"
7
+ :skelkey="state.skelkey"
8
+ :values="{'address_type':state.address_type, 'customer_type':'private'}"
9
+ :useCategories="false"
10
+ :layout="AddressFormLayout"
11
+ >
12
+ </ViForm>
13
+ </template>
14
+
15
+ <script setup>
16
+ import {computed, reactive, watch} from 'vue'
17
+ import LoadingHandler from './LoadingHandler.vue';
18
+ import AddressFormLayout from './AddressFormLayout.vue';
19
+ import ViForm from "@viur/vue-utils/forms/ViForm.vue";
20
+ import {useViurShopStore} from "../shop";
21
+ import {useAddress} from "../composables/address";
22
+
23
+ const shopStore = useViurShopStore();
24
+ const {state:addressState} = useAddress();
25
+
26
+ const props = defineProps({
27
+ formtype:{
28
+ type:String,
29
+ default:"shipping" // formtype: shipping, billing, both
30
+ }
31
+ })
32
+
33
+ const state = reactive({
34
+ formtype:computed(()=>{
35
+ if (['shipping','both'].includes(props.formtype)){
36
+ return "shipping"
37
+ }
38
+ return 'billing'
39
+ }),
40
+
41
+ action: computed(()=>{
42
+ if (state.formtype ==='shipping' && shopStore.state.cartRoot?.['shipping_address']){
43
+ return 'edit'
44
+ } else if (props.formtype === 'billing' && shopStore.state.order?.['billing_address']){
45
+ return 'edit'
46
+ } else {
47
+ return 'add'
48
+ }
49
+ }),
50
+
51
+ skelkey:computed(()=>{
52
+ if (state.formtype === 'shipping' && shopStore.state.cartRoot?.['shipping_address']){
53
+ return shopStore.state.cartRoot['shipping_address']?.['dest']?.['key']
54
+ } else if (props.formtype === 'billing' && shopStore.state.order?.['billing_address']){
55
+ return shopStore.state.order?.['billing_address']?.['dest']?.['key']
56
+ }
57
+ return null
58
+
59
+ }),
60
+ address_type:computed(()=>{
61
+ if (props.formtype === 'both'){
62
+ return ["shipping",'billing']
63
+ }
64
+ return [state.formtype]
65
+ }),
66
+ })
67
+
68
+ watch(()=>addressState.billingIsShipping, (newVal,oldVal)=>{
69
+ if(oldVal && !newVal){
70
+ if(shopStore.state.order?.['billing_address']){
71
+ shopStore.state.order['billing_address'] = null
72
+ }
73
+
74
+ addressState[`billingForm`].state.skel = {'address_type':state.address_type, 'customer_type':'private'}
75
+
76
+ }
77
+
78
+ })
79
+
80
+ </script>
81
+
82
+ <style scoped>
83
+
84
+ </style>
@@ -0,0 +1,107 @@
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="getBoneWidget(formState.structure['salutation']['type'])"
6
+ label="placeholder"
7
+ >
8
+ </slot>
9
+
10
+ <slot boneName="firstname"
11
+ :widget="getBoneWidget(formState.structure['firstname']['type'])"
12
+ label="placeholder">
13
+ </slot>
14
+
15
+ <slot boneName="lastname"
16
+ :widget="getBoneWidget(formState.structure['lastname']['type'])"
17
+ label="placeholder">
18
+ </slot>
19
+
20
+ <slot boneName="street_name"
21
+ :widget="getBoneWidget(formState.structure['street_name']['type'])"
22
+ label="placeholder">
23
+ </slot>
24
+
25
+ <slot boneName="street_number"
26
+ :widget="getBoneWidget(formState.structure['street_number']['type'])"
27
+ label="placeholder">
28
+ </slot>
29
+
30
+ <slot
31
+ boneName="zip_code"
32
+ :widget="getBoneWidget(formState.structure['zip_code']['type'])"
33
+ placeholder="placeholder"
34
+ label="placeholder"
35
+ >
36
+ </slot>
37
+
38
+ <slot boneName="city"
39
+ :widget="getBoneWidget(formState.structure['city']['type'])"
40
+ label="placeholder">
41
+ </slot>
42
+
43
+
44
+ <slot boneName="country"
45
+ :widget="getBoneWidget(formState.structure['country']['type'])"
46
+ label="placeholder">
47
+ </slot>
48
+
49
+ </div>
50
+ </template>
51
+ <script setup>
52
+ import { inject } from "vue";
53
+ import { getBoneWidget } from "@viur/vue-utils/bones/edit";
54
+
55
+ const formState = inject("formState");
56
+ const formUpdate = inject("formUpdate");
57
+ </script>
58
+ <style scoped>
59
+
60
+ .vi-shop-cart-form-wrap{
61
+ display: grid;
62
+ grid-template-columns: repeat(4, minmax(0, 1fr));
63
+ gap: var(--sl-spacing-small);
64
+ margin-bottom: var(--sl-spacing-medium);
65
+ }
66
+
67
+ :deep(.bone-wrapper){
68
+ margin: 0;
69
+ }
70
+
71
+ :deep(.wrapper-bone-firstname){
72
+ grid-column: 1 / span 2;
73
+ }
74
+
75
+ :deep(.wrapper-bone-lastname){
76
+ grid-column: 3 / span 2;
77
+ }
78
+
79
+ :deep(.wrapper-bone-street_name){
80
+ grid-column: 1 / span 3;
81
+ }
82
+
83
+ :deep(.wrapper-bone-street_number){
84
+ grid-column: 4 / span 1;
85
+ }
86
+
87
+ :deep(.wrapper-bone-zip_code){
88
+ grid-column: 1 / span 2;
89
+ }
90
+
91
+ :deep(.wrapper-bone-city){
92
+ grid-column: 3 / span 2;
93
+ }
94
+
95
+ :deep(.wrapper-bone-country){
96
+ grid-column: 1 / span 4;
97
+ }
98
+
99
+ :deep(.wrapper-bone-is_default){
100
+ padding: var(--sl-spacing-x-small) 0;
101
+ grid-column: 1 / span 4;
102
+ }
103
+
104
+
105
+
106
+
107
+ </style>