@viur/shop-components 0.0.1-dev.9 → 0.1.1

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 (56) 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/package.json +23 -11
  7. package/src/Shop.vue +232 -0
  8. package/src/ShopOrderStepper.vue +114 -0
  9. package/src/ShopSummary.vue +196 -0
  10. package/src/Steps/ShopCart.vue +57 -0
  11. package/src/Steps/ShopOrderComplete.vue +32 -0
  12. package/src/Steps/ShopOrderConfirm.vue +300 -0
  13. package/src/Steps/ShopPaymentProvider.vue +56 -0
  14. package/src/Steps/ShopShippingMethod.vue +67 -0
  15. package/src/Steps/ShopUserDataGuest.vue +82 -0
  16. package/src/Steps/index.js +15 -0
  17. package/src/components/AddressForm.vue +95 -0
  18. package/src/components/AddressFormLayout.vue +107 -0
  19. package/src/components/CardSelector.vue +68 -0
  20. package/src/components/CartItem.vue +353 -0
  21. package/src/components/CartItemSmall.vue +257 -0
  22. package/src/components/DiscountInput.vue +91 -0
  23. package/src/components/LoadingHandler.vue +76 -0
  24. package/src/components/PaymentOption.vue +78 -0
  25. package/src/components/PaymentProviderUnzer.vue +201 -0
  26. package/src/components/PaymentSelector.vue +55 -0
  27. package/src/components/ShopAlert.vue +30 -0
  28. package/src/components/StepperTab.vue +132 -0
  29. package/src/components/dialogButton.vue +49 -0
  30. package/src/composables/address.js +95 -0
  31. package/src/composables/cart.js +189 -0
  32. package/src/composables/order.js +80 -0
  33. package/src/composables/payment.js +75 -0
  34. package/src/composables/shipping.js +40 -0
  35. package/src/main.js +44 -0
  36. package/src/shop.js +252 -0
  37. package/src/translations/de.js +36 -0
  38. package/src/translations/en.js +5 -0
  39. package/src/utils.js +56 -0
  40. package/vite.config.js +51 -0
  41. package/src/components/cart/CartView.vue +0 -693
  42. package/src/components/cart/ConfirmView.vue +0 -314
  43. package/src/components/order/category/CategoryList.vue +0 -83
  44. package/src/components/order/category/CategoryView.vue +0 -143
  45. package/src/components/order/information/UserInfoMulti.vue +0 -427
  46. package/src/components/order/information/UserInformation.vue +0 -332
  47. package/src/components/order/information/adress/ShippingAdress.vue +0 -143
  48. package/src/components/order/item/ItemCard.vue +0 -168
  49. package/src/components/order/item/ItemView.vue +0 -233
  50. package/src/components/order/process/ExampleUsage.vue +0 -100
  51. package/src/components/order/process/OrderComplete.vue +0 -41
  52. package/src/components/order/process/OrderTabHeader.vue +0 -7
  53. package/src/components/order/process/OrderView.vue +0 -210
  54. package/src/router/index.js +0 -103
  55. package/src/stores/cart.js +0 -119
  56. package/src/views/ViewMissing.vue +0 -20
@@ -0,0 +1,353 @@
1
+ <template>
2
+ <div class="item-wrapper">
3
+ <sl-card horizontal class="viur-shop-cart-leaf">
4
+ <img
5
+ class="viur-shop-cart-leaf-image"
6
+ slot="image"
7
+ :src="
8
+ getImage(
9
+ item?.shop_image
10
+ ? item.shop_image
11
+ : undefined,
12
+ )
13
+ "
14
+ />
15
+ <h4
16
+ class="viur-shop-cart-leaf-headline headline"
17
+ v-html="getValue(item.shop_name)"
18
+ ></h4>
19
+ <h5 class="viur-shop-cart-leaf-artno">
20
+ {{ getValue(item.shop_art_no_or_gtin) }}
21
+ </h5>
22
+ <div
23
+ class="viur-shop-cart-leaf-description"
24
+ v-html="getValue(item.shop_description)"
25
+ ></div>
26
+ <sl-input
27
+ :disabled="!edit"
28
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--quantity"
29
+ type="number"
30
+ placeholder="Number"
31
+ min="0"
32
+ noSpinButtons
33
+ :value="item.quantity"
34
+ @sl-change="changeAmount($event.target.value)"
35
+ >
36
+ <dialog-Button slot="prefix" class="decent" v-if="item.quantity===1" variant="danger" outline>
37
+ <sl-icon name="trash"></sl-icon>
38
+ <template #dialog="{close}">
39
+ {{ $t('messages.remove_article_from_cart') }}
40
+ <sl-bar>
41
+ <sl-button slot="left" @click="close">{{$t('actions.cancel')}}</sl-button>
42
+ <sl-button slot="right" variant="danger" @click="removeArticle(); close()">{{ $t('actions.delete') }}</sl-button>
43
+ </sl-bar>
44
+ </template>
45
+ </dialog-Button>
46
+ <sl-button slot="prefix" v-else @click="changeAmount(item.quantity-=1)">
47
+ <sl-icon name="dash-lg"></sl-icon>
48
+ </sl-button>
49
+ <sl-button slot="suffix" @click="changeAmount(item.quantity+=1)">
50
+ <sl-icon name="plus-lg"></sl-icon>
51
+ </sl-button>
52
+ </sl-input>
53
+
54
+ <div class="viur-shop-cart-leaf-unitprice">
55
+ <div class="viur-shop-cart-leaf-label">{{$t('shop.unit_price')}}</div>
56
+ <sl-format-number
57
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--unitprice"
58
+ lang="de"
59
+ type="currency"
60
+ currency="EUR"
61
+ :value="item.price.current"
62
+ >
63
+ </sl-format-number>
64
+ </div>
65
+
66
+
67
+ <div class="availability"
68
+ :class="`availability--${item.shop_availability}`"
69
+ >
70
+ {{$t(item.shop_availability)}}
71
+ </div>
72
+
73
+ <div class="viur-shop-cart-leaf-price">
74
+ <div class="viur-shop-cart-leaf-label">{{ $t('shop.total_price') }}</div>
75
+ <sl-format-number
76
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--price"
77
+ lang="de"
78
+ type="currency"
79
+ currency="EUR"
80
+ :value="item.price.current * item.quantity"
81
+ >
82
+ </sl-format-number>
83
+ </div>
84
+
85
+
86
+ </sl-card>
87
+ <div class="loading" v-if="cartState.isUpdating">
88
+ <sl-spinner></sl-spinner>
89
+ </div>
90
+ </div>
91
+ </template>
92
+ <script setup>
93
+ import { useDebounceFn } from '@vueuse/core'
94
+ import { getImage } from '../utils';
95
+ import { useCart } from '../composables/cart';
96
+ import dialogButton from './dialogButton.vue';
97
+
98
+ const {addItem, removeItem, state:cartState, getValue} = useCart()
99
+
100
+ const changeAmount = useDebounceFn((amount) => {
101
+ props.item.quantity = amount
102
+ addItem(props.item['article']['dest']['key'],amount)
103
+ }, 1000)
104
+
105
+
106
+
107
+
108
+
109
+ const props = defineProps({
110
+ item:{
111
+ required:true
112
+ },
113
+ edit:{
114
+ type:Boolean,
115
+ default:false //true
116
+ }
117
+ })
118
+
119
+ function removeArticle(){
120
+ removeItem(props.item['article']['dest']['key'])
121
+ }
122
+
123
+ </script>
124
+ <style scoped>
125
+ @layer foundation.shop {
126
+
127
+ .availability {
128
+ display: flex;
129
+ flex-basis: 70%;
130
+ font-size: .9em;
131
+ align-items: center;
132
+ justify-content: flex-end;
133
+ white-space: nowrap;
134
+ &:before {
135
+ content: '';
136
+ display: block;
137
+ background-color: #666;
138
+ width: .7em;
139
+ height: .7em;
140
+ border-radius: 50%;
141
+ margin-right: 5px;
142
+ margin-bottom: 2px;
143
+ }
144
+ }
145
+ .availability--onrequest,
146
+ .availability--instock {
147
+ color: var(--ignt-color-success);
148
+ &:before {
149
+ background-color: var(--ignt-color-success);
150
+ }
151
+ }
152
+ .availability--discontinued,
153
+ .availability--outofstock {
154
+ color: var(--ignt-color-danger);
155
+ &:before {
156
+ background-color: var(--ignt-color-danger);
157
+ }
158
+ }
159
+ .availability--limited,
160
+ .availability--preorder {
161
+ color: var(--ignt-color-warning);
162
+ &:before {
163
+ background-color: var(--ignt-color-warning);
164
+ }
165
+ }
166
+
167
+ .viur-shop-cart-leaf {
168
+ --shop-leaf-label-color: var(--ignt-color-primary);
169
+ --shop-leaf-label-font-weight: 600;
170
+ --shop-leaf-label-font-size: 1em;
171
+ --shop-leaf-price-font-size: 1em;
172
+ --shop-leaf-headline-font-size: 1.3em;
173
+
174
+ &::part(base) {
175
+ display: flex;
176
+ position: relative;
177
+ }
178
+
179
+ &::part(header) {
180
+ border-bottom: none;
181
+ padding-top: 0;
182
+ padding-right: 0;
183
+ }
184
+
185
+ &::part(image) {
186
+ aspect-ratio: 1;
187
+ }
188
+
189
+ &::part(body) {
190
+ display: grid;
191
+ grid-template-columns: repeat(5, minmax(0, 1fr));
192
+ gap: var(--sl-spacing-medium);
193
+ padding: var(--sl-spacing-large);
194
+ height: 100%;
195
+ }
196
+
197
+ &::part(group) {
198
+ padding: 0;
199
+ }
200
+
201
+ @media (max-width: 600px) {
202
+ &::part(body) {
203
+ grid-template-columns: repeat(2, minmax(0, 1fr));
204
+ gap: var(--sl-spacing-medium);
205
+ padding: var(--sl-spacing-large);
206
+ height: 100%;
207
+ }
208
+
209
+ &::part(image) {
210
+ border-radius: var(--border-radius);
211
+ align-self: baseline;
212
+ }
213
+ }
214
+ }
215
+
216
+ .viur-shop-cart-leaf-image {
217
+ aspect-ratio: 1;
218
+ }
219
+
220
+ .viur-shop-cart-leaf-headline {
221
+ grid-column: 1 / span 4;
222
+ order: -2;
223
+ margin: 0;
224
+ font-size: var(--shop-leaf-headline-font-size);
225
+
226
+ @media (max-width: 600px) {
227
+ grid-column: 1 / span 2;
228
+ }
229
+ }
230
+
231
+ .viur-shop-cart-leaf-artno {
232
+ grid-column: 1 / span 5;
233
+ margin: 0;
234
+
235
+ @media (max-width: 600px) {
236
+ grid-column: 1 / span 2;
237
+ }
238
+ }
239
+
240
+ .viur-shop-cart-leaf-actions {
241
+ display: flex;
242
+ justify-content: start;
243
+ gap: var(--sl-spacing-x-small);
244
+
245
+ @media (min-width: 600px) {
246
+ grid-column: 5 / span 1;
247
+ order: -1;
248
+ justify-content: end;
249
+ align-items: end;
250
+ }
251
+ }
252
+
253
+ .viur-shop-cart-leaf-description {
254
+ grid-column: 1 / span 5;
255
+ margin-bottom: var(--ignt-spacing-small);
256
+ display: -webkit-box;
257
+ -webkit-line-clamp: 3;
258
+ -webkit-box-orient: vertical;
259
+ height: fit-content;
260
+ overflow: hidden;
261
+
262
+ &:deep(*) {
263
+ margin: 0;
264
+ }
265
+
266
+ @media (max-width: 600px) {
267
+ grid-column: span 2;
268
+ }
269
+
270
+ @media (max-width: 500px) {
271
+ display: none;
272
+ }
273
+ }
274
+
275
+ .viur-shop-cart-leaf-price {
276
+ grid-column: 5 / span 1;
277
+ align-self: center;
278
+ text-align: right;
279
+ font-size: var(--shop-leaf-price-font-size);
280
+ }
281
+
282
+ .viur-shop-cart-leaf-quantity {
283
+ align-self: center;
284
+ }
285
+
286
+ .viur-shop-cart-leaf-unitprice {
287
+ align-self: center;
288
+
289
+ @media (max-width: 600px) {
290
+ text-align: right;
291
+ }
292
+ }
293
+
294
+ .viur-shop-cart-leaf-label,
295
+ .viur-shop-cart-leaf-value--quantity::part(form-control-label) {
296
+ color: var(--shop-leaf-label-color);
297
+ font-weight: var(--shop-leaf-label-font-weight);
298
+ font-size: calc(var(--shop-leaf-label-font-size) * .75);
299
+ margin-bottom: var(--ignt-spacing-2x-small);
300
+ }
301
+
302
+ .loading{
303
+ position: absolute;
304
+ top: 0;
305
+ background: #ffffffcc;
306
+ width: 100%;
307
+ height: 100%;
308
+ display: flex;
309
+ flex-direction: row;
310
+ flex-wrap: nowrap;
311
+ justify-content: center;
312
+ align-items: center;
313
+
314
+
315
+ & sl-spinner{
316
+ font-size:3rem;
317
+ }
318
+ }
319
+
320
+ .item-wrapper{
321
+ position: relative;
322
+ }
323
+
324
+
325
+ .viur-shop-cart-leaf-value--quantity{
326
+ align-self: center;
327
+ grid-column: span 1;
328
+
329
+ &::part(input){
330
+ text-align: center;
331
+ padding: 0;
332
+ }
333
+
334
+ sl-button{
335
+ margin: 0;
336
+ transition: all ease .3s;
337
+
338
+ &::part(base){
339
+ background-color: transparent;
340
+ border: none;
341
+ }
342
+
343
+ &::part(label){
344
+ padding: 0;
345
+ height: var(--sl-input-height-medium);
346
+ width: calc(var(--sl-input-height-medium) / 5 * 4);
347
+ }
348
+ }
349
+
350
+ }
351
+
352
+ }
353
+ </style>
@@ -0,0 +1,257 @@
1
+ <template>
2
+ <div class="item-wrapper">
3
+ <sl-card horizontal class="viur-shop-cart-leaf-small">
4
+ <img
5
+ class="viur-shop-cart-leaf-image"
6
+ slot="image"
7
+ :src="
8
+ getImage(
9
+ item?.shop_image
10
+ ? item.shop_image
11
+ : undefined,
12
+ )
13
+ "
14
+ />
15
+ <h4
16
+ class="viur-shop-cart-leaf-headline headline"
17
+ v-html="getValue(item.shop_name)"
18
+ ></h4>
19
+
20
+ <sl-input
21
+ :disabled="!edit"
22
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--quantity"
23
+ type="number"
24
+ placeholder="Number"
25
+ min="0"
26
+ noSpinButtons
27
+ :value="item.quantity"
28
+ @sl-change="changeAmount($event.target.value)"
29
+ >
30
+ <dialog-Button slot="prefix" class="decent" v-if="item.quantity===1" variant="danger" outline>
31
+ <sl-icon name="trash"></sl-icon>
32
+ <template #dialog="{close}">
33
+ {{ $t('messages.remove_article_from_cart') }}
34
+ <sl-bar>
35
+ <sl-button slot="left" @click="close">{{$t('actions.cancel')}}</sl-button>
36
+ <sl-button slot="right" variant="danger" @click="removeArticle(); close()">{{ $t('actions.delete') }}</sl-button>
37
+ </sl-bar>
38
+ </template>
39
+ </dialog-Button>
40
+ <sl-button slot="prefix" v-else @click="changeAmount(item.quantity-=1)">
41
+ <sl-icon name="dash-lg"></sl-icon>
42
+ </sl-button>
43
+ <sl-button slot="suffix" @click="changeAmount(item.quantity+=1)">
44
+ <sl-icon name="plus-lg"></sl-icon>
45
+ </sl-button>
46
+ </sl-input>
47
+
48
+ <div class="viur-shop-cart-leaf-article-number">
49
+ <div class="viur-shop-cart-leaf-label">{{ $t('shop.articlenumber') }}</div>
50
+ {{ getValue(item.shop_art_no_or_gtin) }}
51
+ </div>
52
+
53
+ <div class="viur-shop-cart-leaf-unitprice">
54
+ <div class="viur-shop-cart-leaf-label">{{$t('shop.unit_price')}}</div>
55
+ <sl-format-number
56
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--unitprice"
57
+ lang="de"
58
+ type="currency"
59
+ currency="EUR"
60
+ :value="item.price.current"
61
+ >
62
+ </sl-format-number>
63
+ </div>
64
+
65
+
66
+ <div class="viur-shop-cart-leaf-price">
67
+ <div class="viur-shop-cart-leaf-label">{{ $t('shop.total_price') }}</div>
68
+ <sl-format-number
69
+ class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--price"
70
+ lang="de"
71
+ type="currency"
72
+ currency="EUR"
73
+ :value="item.price.current * item.quantity"
74
+ >
75
+ </sl-format-number>
76
+ </div>
77
+ </sl-card>
78
+ <div class="loading" v-if="cartState.isUpdating">
79
+ <sl-spinner></sl-spinner>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ <script setup>
84
+ import { useDebounceFn } from '@vueuse/core'
85
+ import { getImage } from '../utils';
86
+ import { useCart } from '../composables/cart';
87
+ import dialogButton from './dialogButton.vue';
88
+
89
+ const {addItem, removeItem, state:cartState, getValue} = useCart()
90
+
91
+ const changeAmount = useDebounceFn((amount) => {
92
+ props.item.quantity = amount
93
+ addItem(props.item['article']['dest']['key'],amount)
94
+ }, 1000)
95
+
96
+ const props = defineProps({
97
+ item:{
98
+ required:true
99
+ },
100
+ edit:{
101
+ type:Boolean,
102
+ default:false //true
103
+ }
104
+ })
105
+
106
+ function removeArticle(){
107
+ removeItem(props.item['article']['dest']['key'])
108
+ }
109
+
110
+ </script>
111
+ <style scoped>
112
+ @layer foundation.shop {
113
+ .viur-shop-cart-leaf-small {
114
+ --shop-leaf-label-color: var(--ignt-color-primary);
115
+ --shop-leaf-label-font-weight: 600;
116
+ --shop-leaf-label-font-size: 1em;
117
+ --shop-leaf-price-font-size: 1em;
118
+ --shop-leaf-headline-font-size: 1.3em;
119
+
120
+ &::part(base) {
121
+ display: flex;
122
+ position: relative;
123
+ }
124
+
125
+ &::part(header) {
126
+ border-bottom: none;
127
+ padding-top: 0;
128
+ padding-right: 0;
129
+ }
130
+
131
+ &::part(image) {
132
+ aspect-ratio: 1;
133
+ flex-basis: 120px;
134
+ }
135
+
136
+ &::part(body) {
137
+ display: grid;
138
+ grid-template-columns: repeat(5, minmax(0, 1fr));
139
+ gap: var(--sl-spacing-medium);
140
+ padding: var(--sl-spacing-large);
141
+ height: 100%;
142
+ }
143
+
144
+ &::part(group) {
145
+ padding: 0;
146
+ }
147
+
148
+ @media (max-width: 600px) {
149
+ &::part(body) {
150
+ grid-template-columns: repeat(2, minmax(0, 1fr));
151
+ gap: var(--sl-spacing-medium);
152
+ padding: var(--sl-spacing-large);
153
+ height: 100%;
154
+ }
155
+
156
+ &::part(image) {
157
+ border-radius: var(--border-radius);
158
+ align-self: baseline;
159
+ }
160
+ }
161
+ }
162
+
163
+ .viur-shop-cart-leaf-image {
164
+ aspect-ratio: 1;
165
+ }
166
+
167
+ .viur-shop-cart-leaf-headline {
168
+ grid-column: 1 / span 4;
169
+ order: -2;
170
+ margin: 0;
171
+ font-size: var(--shop-leaf-headline-font-size);
172
+
173
+ @media (max-width: 600px) {
174
+ grid-column: 1 / span 2;
175
+ }
176
+ }
177
+
178
+ .viur-shop-cart-leaf-price {
179
+ grid-column: 5 / span 1;
180
+ align-self: flex-end;
181
+ text-align: right;
182
+ font-size: var(--shop-leaf-price-font-size);
183
+ }
184
+
185
+ .viur-shop-cart-leaf-article-number {
186
+ align-self: center;
187
+ grid-column: span 2;
188
+ }
189
+
190
+ .viur-shop-cart-leaf-quantity {
191
+ align-self: center;
192
+ }
193
+
194
+ .viur-shop-cart-leaf-unitprice {
195
+ align-self: center;
196
+ grid-column: 4 / span 1;
197
+ }
198
+
199
+ .viur-shop-cart-leaf-label,
200
+ .viur-shop-cart-leaf-value--quantity::part(form-control-label) {
201
+ color: var(--shop-leaf-label-color);
202
+ font-weight: var(--shop-leaf-label-font-weight);
203
+ font-size: calc(var(--shop-leaf-label-font-size) *.75);
204
+ margin-bottom: var(--ignt-spacing-2x-small);
205
+ }
206
+
207
+ .loading{
208
+ position: absolute;
209
+ top: 0;
210
+ background: #ffffffcc;
211
+ width: 100%;
212
+ height: 100%;
213
+ display: flex;
214
+ flex-direction: row;
215
+ flex-wrap: nowrap;
216
+ justify-content: center;
217
+ align-items: center;
218
+
219
+
220
+ & sl-spinner{
221
+ font-size:3rem;
222
+ }
223
+ }
224
+
225
+ .item-wrapper{
226
+ position: relative;
227
+ }
228
+
229
+ .viur-shop-cart-leaf-value--quantity{
230
+ align-self: center;
231
+ grid-column: span 1;
232
+
233
+ &::part(input){
234
+ text-align: center;
235
+ padding: 0;
236
+ }
237
+
238
+ sl-button{
239
+ margin: 0;
240
+ transition: all ease .3s;
241
+
242
+ &::part(base){
243
+ background-color: transparent;
244
+ border: none;
245
+ }
246
+
247
+ &::part(label){
248
+ padding: 0;
249
+ height: var(--sl-input-height-medium);
250
+ width: calc(var(--sl-input-height-medium) / 5 * 4);
251
+ }
252
+ }
253
+
254
+ }
255
+
256
+ }
257
+ </style>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ {{ state.alert.msg }}
3
+ <shop-alert
4
+ v-if="state.alert.show"
5
+ :variant="state.alert.variant"
6
+ @onHide="state.alert = {}"
7
+ duration="infinity"
8
+ >
9
+ <template #alertMsg>
10
+ {{ state.alert.msg }}
11
+ </template>
12
+ </shop-alert>
13
+
14
+ <template v-if="shopStore.state.cartRoot.discount">
15
+ <div class="discount-view">
16
+ <span>Code: {{ shopStore.state.cartRoot.discount.dest.name }}</span>
17
+ <sl-button size="small" outline variant="danger" @click="removeDiscountAction" :loading="state.loading">
18
+ <sl-icon name="x-lg" slot="prefix"></sl-icon>
19
+
20
+ </sl-button>
21
+ </div>
22
+ </template>
23
+ <template v-else>
24
+ <sl-input
25
+ placeholder="Rabattcode eingeben"
26
+ v-model="state.code"
27
+ @keypress.enter="addDiscountAction()"
28
+ >
29
+ </sl-input>
30
+ <button @click="addDiscountAction()" :loading="state.loading">{{ $t('shop.add_discount') }}</button>
31
+ </template>
32
+ </template>
33
+
34
+ <script setup>
35
+ import { reactive } from "vue";
36
+ import { useViurShopStore } from "../shop";
37
+ import { useCart } from '../composables/cart';
38
+ const shopStore = useViurShopStore();
39
+ const {addDiscount, removeDiscount} = useCart()
40
+
41
+ import ShopAlert from "./ShopAlert.vue";
42
+
43
+ const state = reactive({
44
+ code: "",
45
+ alert: {},
46
+ loading:false
47
+ });
48
+
49
+ function addDiscountAction() {
50
+ state.loading=true
51
+ addDiscount(state.code)
52
+ .then(async (resp) => {
53
+ state.loading=false
54
+ })
55
+ .catch((error) => {
56
+ state.loading=false
57
+ console.log("error bei rabatt", error);
58
+ state.alert.msg = "not found";
59
+ state.alert.show = true;
60
+ state.alert.variant = "danger";
61
+ });
62
+ }
63
+
64
+ function removeDiscountAction(){
65
+ state.loading=true
66
+ removeDiscount()
67
+ .then(async (resp) => {
68
+ state.loading=false
69
+ state.alert.msg = "Discount removed";
70
+ state.alert.show = true;
71
+ state.alert.variant = "success";
72
+ })
73
+ .catch((error) => {
74
+ state.loading=false
75
+ console.log("error bei rabatt", error);
76
+ state.alert.msg = "not found";
77
+ state.alert.show = true;
78
+ state.alert.variant = "danger";
79
+ });
80
+ }
81
+
82
+ </script>
83
+ <style scoped>
84
+ .discount-view{
85
+ font-size:0.8em;
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: space-between;
89
+ }
90
+
91
+ </style>