@viur/shop-components 0.0.1-dev.6 → 0.0.1-dev.60
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.
- package/.editorconfig +16 -0
- package/.github/workflows/npm-publish.yml +42 -0
- package/.gitmodules +3 -0
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/package.json +25 -23
- package/src/components/ShopCart.vue +512 -0
- package/src/components/ShopOrderComplete.vue +73 -0
- package/src/components/ShopOrderConfirm.vue +291 -0
- package/src/components/ShopOrderStepper.vue +264 -0
- package/src/components/ShopUserData.vue +232 -0
- package/src/components/cart/CartLeaf.vue +277 -0
- package/src/components/cart/CartLeafModel.vue +304 -0
- package/src/components/cart/CartNode.vue +25 -0
- package/src/components/cart/CartTree.vue +54 -0
- package/src/components/cart/CartTreeWrapper.vue +73 -0
- package/src/components/cart/CartView.vue +205 -174
- package/src/components/cart/Discount.vue +91 -0
- package/src/components/lib/utils.js +0 -0
- package/src/components/order/OrderSidebar.vue +102 -0
- package/src/components/order/item/ItemView.vue +0 -1
- package/src/components/{cart → order/process}/ConfirmView.vue +94 -96
- package/src/components/order/process/ExampleUsage.vue +79 -66
- package/src/components/order/process/OrderTabHeader.vue +10 -1
- package/src/components/order/process/SelectPaymentProvider.vue +62 -0
- package/src/components/order/process/Shipping.vue +46 -0
- package/src/components/ui/ShopSummary.vue +145 -0
- package/src/components/ui/generic/ArticleList.vue +222 -0
- package/src/components/ui/generic/ExamplePagination.vue +236 -0
- package/src/components/ui/generic/ShopPriceFormatter.vue +41 -0
- package/src/components/ui/generic/alerts/ShopAlert.vue +19 -0
- package/src/components/ui/generic/makeData.js +39 -0
- package/src/components/ui/stepper/StepperItem.vue +39 -0
- package/src/components/ui/stepper/StepperTab.vue +133 -0
- package/src/components/ui/stepper/StepperTrigger.vue +35 -0
- package/src/components/ui/userdata/AddForm.vue +125 -0
- package/src/components/ui/userdata/AddressBox.vue +117 -0
- package/src/components/ui/userdata/BaseLayout.vue +94 -0
- package/src/components/ui/userdata/CustomBooleanBone.vue +58 -0
- package/src/components/ui/userdata/CustomSelectBone.vue +91 -0
- package/src/components/ui/userdata/CustomStringBone.vue +71 -0
- package/src/components/ui/userdata/DefaultLayout.vue +126 -0
- package/src/components/ui/userdata/SelectAddress.vue +21 -0
- package/src/components/ui/userdata/multi/ActionBar.vue +38 -0
- package/src/components/ui/userdata/multi/CartSelection.vue +42 -0
- package/src/main.js +50 -0
- package/src/router/index.js +1 -1
- package/src/stores/cart.js +267 -42
- package/src/style/ignite/.editorconfig +20 -0
- package/src/style/ignite/.github/workflows/ignite.yml +64 -0
- package/src/style/ignite/.github/workflows/node.yml +30 -0
- package/src/style/ignite/.postcssrc.cjs +25 -0
- package/src/style/ignite/CHANGELOG.md +244 -0
- package/src/style/ignite/LICENSE +21 -0
- package/src/style/ignite/README.md +92 -0
- package/src/style/ignite/dist/ignite.css +2019 -0
- package/src/style/ignite/dist/ignite.min.css +4 -0
- package/src/style/ignite/foundation/basic.css +371 -0
- package/src/style/ignite/foundation/color.css +323 -0
- package/src/style/ignite/foundation/config.css +188 -0
- package/src/style/ignite/foundation/grid.css +78 -0
- package/src/style/ignite/foundation/mediaqueries.css +71 -0
- package/src/style/ignite/foundation/reset.css +261 -0
- package/src/style/ignite/ignite.css +29 -0
- package/src/style/ignite/ignite.css.map +1 -0
- package/src/style/ignite/package-lock.json +5530 -0
- package/src/style/ignite/package.json +58 -0
- package/src/style/ignite/shoelace.css +19 -0
- package/src/style/ignite/themes/dark.css +12 -0
- package/src/style/ignite/themes/light.css +11 -0
- package/src/style/ignite/utilities/shoelace.css +537 -0
- package/src/style/ignite/utilities/utilities.css +24 -0
- package/vite.config.js +53 -0
- package/src/components/order/information/UserInfoMulti.vue +0 -427
- package/src/components/order/information/UserInformation.vue +0 -332
- package/src/components/order/process/OrderComplete.vue +0 -41
- package/src/components/order/process/OrderView.vue +0 -210
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-tab-panel class="viur-shop-order-tab-panel" :name="tab">
|
|
3
|
+
<component
|
|
4
|
+
:is="tabs[tab].component"
|
|
5
|
+
v-bind="tabs[tab].props ? tabs[tab].props : ''"
|
|
6
|
+
@goToStart="goToStart()"
|
|
7
|
+
@editAddress="goToUserData"
|
|
8
|
+
>
|
|
9
|
+
</component>
|
|
10
|
+
</sl-tab-panel>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
tab: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
tabs: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const emit = defineEmits(["goToStart", "editAddress"]);
|
|
26
|
+
|
|
27
|
+
function goToStart() {
|
|
28
|
+
emit("goToStart");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function goToUserData(e) {
|
|
32
|
+
emit("editAddress", e);
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.viur-shop-order-tab-panel {
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-tab
|
|
3
|
+
class="viur-shop-order-tab"
|
|
4
|
+
slot="nav"
|
|
5
|
+
:panel="tab"
|
|
6
|
+
:disabled="tabs[tab].disabled"
|
|
7
|
+
>
|
|
8
|
+
<div class="viur-shop-order-step">
|
|
9
|
+
<sl-icon
|
|
10
|
+
class="viur-shop-order-step-icon"
|
|
11
|
+
v-if="tabs[tab].icon?.name"
|
|
12
|
+
:name="tabs[tab].icon.name"
|
|
13
|
+
:library="tabs[tab].icon.library ? tabs[tab].icon.library : 'default'"
|
|
14
|
+
>
|
|
15
|
+
</sl-icon>
|
|
16
|
+
|
|
17
|
+
<div class="viur-shop-order-status-text">
|
|
18
|
+
{{ tabIdx + 1 }}.
|
|
19
|
+
<span class="viur-shop-order-status-span">{{
|
|
20
|
+
tabs[tab].displayName
|
|
21
|
+
}}</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<sl-icon
|
|
26
|
+
name="chevron-right"
|
|
27
|
+
class="viur-shop-order-tab-check"
|
|
28
|
+
v-if="tabIdx < stepperLength - 1"
|
|
29
|
+
>
|
|
30
|
+
</sl-icon>
|
|
31
|
+
</sl-tab>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
tab: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
tabIdx: {
|
|
41
|
+
type: Number,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
stepperLength: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
tabs: {
|
|
49
|
+
type: Object,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.viur-shop-order-tab {
|
|
57
|
+
width: 25%;
|
|
58
|
+
position: relative;
|
|
59
|
+
|
|
60
|
+
&::part(base) {
|
|
61
|
+
color: var(--shop-tab-color);
|
|
62
|
+
display: flex;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&[aria-selected="true"] {
|
|
67
|
+
--shop-tab-color: var(--shop-tab-color--active);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (max-width: 900px) {
|
|
71
|
+
&::part(base) {
|
|
72
|
+
height: 100%;
|
|
73
|
+
padding: var(--sl-spacing-small) var(--sl-spacing-medium);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media (max-width: 600px) {
|
|
78
|
+
&[aria-selected="true"] {
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:not([aria-selected="true"]) {
|
|
83
|
+
.viur-shop-order-status-span {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.viur-shop-order-step {
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
|
|
98
|
+
&:has(sl-icon) {
|
|
99
|
+
justify-content: flex-start;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
sl-icon {
|
|
103
|
+
font-size: 2.5em;
|
|
104
|
+
margin-bottom: 15px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (max-width: 900px) {
|
|
108
|
+
justify-content: center;
|
|
109
|
+
|
|
110
|
+
sl-icon {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.viur-shop-order-status-text {
|
|
117
|
+
font-size: 0.8em;
|
|
118
|
+
color: inherit;
|
|
119
|
+
text-align: center;
|
|
120
|
+
white-space: initial;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.viur-shop-order-tab-check {
|
|
124
|
+
position: absolute;
|
|
125
|
+
right: -0.5em;
|
|
126
|
+
|
|
127
|
+
@media (max-width: 900px) {
|
|
128
|
+
font-size: 0.7em;
|
|
129
|
+
right: -0.35em;
|
|
130
|
+
top: calc(50% - 0.35em);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-button type="submit" v-show="index !== 0" @click="prevTab()">
|
|
3
|
+
Zurück
|
|
4
|
+
<!-- TODO: $t(i18n referenz) -->
|
|
5
|
+
</sl-button>
|
|
6
|
+
|
|
7
|
+
<sl-button type="submit" variant="primary" @click="nextTab()">
|
|
8
|
+
Weiter
|
|
9
|
+
<!-- TODO: $t(i18n referenz) -->
|
|
10
|
+
</sl-button>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
index: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const emit = defineEmits({prevTab: null, nextTab: null});
|
|
21
|
+
|
|
22
|
+
function prevTab() {
|
|
23
|
+
emit("prevTab");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function nextTab() {
|
|
27
|
+
emit("nextTab");
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style scoped>
|
|
32
|
+
.sticky {
|
|
33
|
+
position: sticky;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-spinner v-if="state.isLoading"></sl-spinner>
|
|
3
|
+
<ViForm
|
|
4
|
+
ref="addForm"
|
|
5
|
+
module="shop/address"
|
|
6
|
+
action="add"
|
|
7
|
+
:useCategories="false"
|
|
8
|
+
:layout="layout ? layout : DefaultLayout"
|
|
9
|
+
:values="modelValue"
|
|
10
|
+
:skel="
|
|
11
|
+
mode === 'shipping'
|
|
12
|
+
? cartStore.state.activeShippingAddress
|
|
13
|
+
: cartStore.state.activeBillingAddress
|
|
14
|
+
"
|
|
15
|
+
@change="updateValues"
|
|
16
|
+
>
|
|
17
|
+
</ViForm>
|
|
18
|
+
|
|
19
|
+
<sl-bar>
|
|
20
|
+
<div slot="left">
|
|
21
|
+
<!-- BUTTON NUR PLATZHALTER FÜR TESTS -->
|
|
22
|
+
<sl-button
|
|
23
|
+
variant="success"
|
|
24
|
+
@click.stop.prevent="sendForm"
|
|
25
|
+
:loading="state.isSending"
|
|
26
|
+
>
|
|
27
|
+
<sl-icon name="floppy2" slot="prefix"></sl-icon>
|
|
28
|
+
{{
|
|
29
|
+
$t("actions.add").charAt(0).toUpperCase() + $t("actions.add").slice(1)
|
|
30
|
+
}}
|
|
31
|
+
</sl-button>
|
|
32
|
+
</div>
|
|
33
|
+
</sl-bar>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import { reactive, ref, computed, onMounted } from "vue";
|
|
38
|
+
import ViForm from "@viur/vue-utils/forms/ViForm.vue";
|
|
39
|
+
import DefaultLayout from "./DefaultLayout.vue";
|
|
40
|
+
import { useCartStore } from "../../../stores/cart";
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
layout: { required: false },
|
|
44
|
+
customer: { type: Object, required: true },
|
|
45
|
+
mode: { type: String, default: "shipping" },
|
|
46
|
+
modelValue: { type: Object },
|
|
47
|
+
});
|
|
48
|
+
const emit = defineEmits(["update:modelValue", "addSuccess"]);
|
|
49
|
+
const cartStore = useCartStore();
|
|
50
|
+
const addForm = ref(null);
|
|
51
|
+
const state = reactive({
|
|
52
|
+
isLoading: computed(() => (addForm.value ? addForm.value.loading : true)),
|
|
53
|
+
isSending: false,
|
|
54
|
+
wasSuccess: false,
|
|
55
|
+
user: {},
|
|
56
|
+
skel: computed(() => {
|
|
57
|
+
if (props.mode === "shipping") return cartStore.state.activeShippingAddress;
|
|
58
|
+
else return cartStore.state.activeBillingAddress;
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function sendForm() {
|
|
63
|
+
if (props.mode === "shipping") {
|
|
64
|
+
cartStore.state.activeShippingAddress = addForm.value.state.skel;
|
|
65
|
+
} else {
|
|
66
|
+
cartStore.state.activeBillingAddress = addForm.value.state.skel;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
state.isSending = true;
|
|
70
|
+
addForm.value.sendData().then(async (resp) => {
|
|
71
|
+
let data = await resp.json();
|
|
72
|
+
state.isSending = false;
|
|
73
|
+
if (data["action"] === "addSuccess") {
|
|
74
|
+
emit("addSuccess", {
|
|
75
|
+
show: true,
|
|
76
|
+
msg: "Erfolg!",
|
|
77
|
+
variant: "success",
|
|
78
|
+
icon: "check2-circle",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function setSkelValues(dict = {}) {
|
|
85
|
+
let structure = cartStore.state.structure.address;
|
|
86
|
+
let skel = {};
|
|
87
|
+
|
|
88
|
+
Object.keys(structure).forEach((boneName) => {
|
|
89
|
+
if (boneName === "customer") {
|
|
90
|
+
skel[boneName] = state.user.key;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
skel[boneName] = null;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
Object.entries(dict).forEach(([boneName, boneValue]) => {
|
|
97
|
+
skel[boneName] = boneValue;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return skel;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function updateValues() {
|
|
104
|
+
emit("update:modelValue", addForm.value.state.skel);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// onBeforeMount(() => {
|
|
108
|
+
// cartStore.getAddressStructure();
|
|
109
|
+
|
|
110
|
+
// // state.skel = setSkelValues({
|
|
111
|
+
// // address_type: "shipping",
|
|
112
|
+
// // customer: props.customer.key,
|
|
113
|
+
// // });
|
|
114
|
+
// });
|
|
115
|
+
onMounted(() => {
|
|
116
|
+
cartStore.getAddressStructure();
|
|
117
|
+
// updateValues();
|
|
118
|
+
// state.skel = setSkelValues({
|
|
119
|
+
// address_type: "shipping",
|
|
120
|
+
// customer: props.customer.key,
|
|
121
|
+
// });
|
|
122
|
+
});
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style scoped></style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="viur-shop-address-box">
|
|
3
|
+
<select-address
|
|
4
|
+
v-if="addressSelection"
|
|
5
|
+
:address-list="state.addressList"
|
|
6
|
+
v-model="state.activeAddress"
|
|
7
|
+
>
|
|
8
|
+
</select-address>
|
|
9
|
+
{{state.addressList.length}}
|
|
10
|
+
<br>
|
|
11
|
+
{{cartStore.state.billingAddressList.length}}
|
|
12
|
+
<!-- debugging -->
|
|
13
|
+
<!-- {{ mode === "billing" ? cartStore.state.activeBillingAddress : "" }} -->
|
|
14
|
+
<!-- {{ mode === "billing" ? "" : cartStore.state.activeShippingAddress }} -->
|
|
15
|
+
<!-- <pre>{{ customer }}</pre> -->
|
|
16
|
+
<div class="viur-shop-address-box-preview" v-if="state.address">
|
|
17
|
+
<span>Ausgewählte Adresse :</span>
|
|
18
|
+
<br>
|
|
19
|
+
{{ state.address?.street_name }} {{ state.address?.street_number }}<br />
|
|
20
|
+
{{ state.address?.zip_code }} {{ state.address?.city }}
|
|
21
|
+
<br />
|
|
22
|
+
{{ state.address?.country }}
|
|
23
|
+
<br />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import {
|
|
30
|
+
reactive,
|
|
31
|
+
computed,
|
|
32
|
+
onBeforeMount,
|
|
33
|
+
watch,
|
|
34
|
+
onUpdated,
|
|
35
|
+
onUnmounted,
|
|
36
|
+
} from "vue";
|
|
37
|
+
import { useCartStore } from "../../../stores/cart";
|
|
38
|
+
import SelectAddress from "./SelectAddress.vue";
|
|
39
|
+
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
mode: { type: String, default: "billing" },
|
|
42
|
+
addressSelection: { type: Boolean, default: false },
|
|
43
|
+
modelValue: { type: Object },
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
47
|
+
|
|
48
|
+
const cartStore = useCartStore();
|
|
49
|
+
|
|
50
|
+
const state = reactive({
|
|
51
|
+
addressList: computed(() =>
|
|
52
|
+
props.mode === "billing"
|
|
53
|
+
? cartStore.state.billingAddressList
|
|
54
|
+
: cartStore.state.shippingAddressList,
|
|
55
|
+
),
|
|
56
|
+
activeAddress: "",
|
|
57
|
+
address: computed(() => {
|
|
58
|
+
if (!state.activeAddress) return {};
|
|
59
|
+
|
|
60
|
+
return state.addressList.filter(
|
|
61
|
+
(address) => address.key === state.activeAddress,
|
|
62
|
+
)[0];
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
function getDefaultAddress() {
|
|
67
|
+
if (props.mode === "billing") {
|
|
68
|
+
state.activeAddress = cartStore.state.activeBillingAddress.key
|
|
69
|
+
? cartStore.state.activeBillingAddress.key
|
|
70
|
+
: "";
|
|
71
|
+
} else {
|
|
72
|
+
state.activeAddress = cartStore.state.activeShippingAddress.key
|
|
73
|
+
? cartStore.state.activeShippingAddress.key
|
|
74
|
+
: "";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
watch(
|
|
79
|
+
() => state.address,
|
|
80
|
+
(newAddress) => {
|
|
81
|
+
if (props.mode === "billing") {
|
|
82
|
+
cartStore.state.activeBillingAddress = newAddress;
|
|
83
|
+
} else cartStore.state.activeShippingAddress = newAddress;
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
watch(
|
|
88
|
+
() => cartStore.state.activeBillingAddress,
|
|
89
|
+
(newValue, oldValue) => {
|
|
90
|
+
state.activeAddress = newValue.key;
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
watch(
|
|
95
|
+
() => cartStore.state.activeShippingAddress,
|
|
96
|
+
(newValue, oldValue) => {
|
|
97
|
+
state.activeAddress = newValue.key;
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
onBeforeMount(() => {
|
|
101
|
+
getDefaultAddress();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
onUnmounted(() => {
|
|
105
|
+
state.activeAddress = "";
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
onUpdated(() => {
|
|
109
|
+
getDefaultAddress();
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style scoped>
|
|
114
|
+
.viur-shop-address-box-preview{
|
|
115
|
+
margin: var(--sl-spacing-medium) 0;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- <div style="width: 100%">
|
|
3
|
+
{{ customer.firstname }} {{ customer.lastname }}<br />
|
|
4
|
+
Phone: {{ customer.phone }} <br />
|
|
5
|
+
E-Mail : {{ customer.name }}<br />
|
|
6
|
+
Debitor: {{ customer.debitornr }}<br />
|
|
7
|
+
</div> -->
|
|
8
|
+
|
|
9
|
+
<slot name="cart-selection"></slot>
|
|
10
|
+
|
|
11
|
+
<div class="viur-shop-cart-address-wrap">
|
|
12
|
+
<div class="viur-shop-cart-address">
|
|
13
|
+
<div class="viur-shop-cart-address-headline">
|
|
14
|
+
{{ $t("skeleton.address.address_type.billing") }}
|
|
15
|
+
<sl-button outline size="small" @click="editBilling">
|
|
16
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
17
|
+
</sl-button>
|
|
18
|
+
</div>
|
|
19
|
+
<slot name="billing-address">
|
|
20
|
+
<address-box :address-selection="true" :mode="'billing'"></address-box>
|
|
21
|
+
</slot>
|
|
22
|
+
</div>
|
|
23
|
+
<slot name="mode-switch"></slot>
|
|
24
|
+
<div class="viur-shop-cart-address" v-if="customAddress">
|
|
25
|
+
<div class="viur-shop-cart-address-headline">
|
|
26
|
+
{{ $t("skeleton.address.address_type.shipping") }}
|
|
27
|
+
<sl-button
|
|
28
|
+
outline
|
|
29
|
+
size="small"
|
|
30
|
+
@click="editShipping"
|
|
31
|
+
v-if="customAddress"
|
|
32
|
+
>
|
|
33
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
34
|
+
</sl-button>
|
|
35
|
+
</div>
|
|
36
|
+
<slot name="shipping-address" v-if="customAddress">
|
|
37
|
+
<address-box
|
|
38
|
+
:address-selection="true && customAddress"
|
|
39
|
+
:mode="'shipping'"
|
|
40
|
+
></address-box>
|
|
41
|
+
</slot>
|
|
42
|
+
<slot name="shipping-address" v-else>
|
|
43
|
+
<address-box
|
|
44
|
+
:address-selection="true && customAddress"
|
|
45
|
+
:mode="'billing'"
|
|
46
|
+
>
|
|
47
|
+
</address-box>
|
|
48
|
+
</slot>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup>
|
|
54
|
+
import { reactive } from "vue";
|
|
55
|
+
import { useCartStore } from "../../../stores/cart";
|
|
56
|
+
import AddressBox from "./AddressBox.vue";
|
|
57
|
+
|
|
58
|
+
const props = defineProps({
|
|
59
|
+
customer: { type: Object, required: true },
|
|
60
|
+
customAddress: { type: Boolean, default: false },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const emit = defineEmits(["editBilling", "editShipping"]);
|
|
64
|
+
const state = reactive({ editBilling: false, editShipping: false });
|
|
65
|
+
|
|
66
|
+
function editBilling() {
|
|
67
|
+
state.editBilling = !state.editBilling;
|
|
68
|
+
emit("editBilling", state.editBilling);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function editShipping() {
|
|
72
|
+
state.editShipping = !state.editShipping;
|
|
73
|
+
emit("editShipping", state.editShipping);
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
.viur-shop-cart-address-wrap {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: var(--sl-spacing-x-large);
|
|
82
|
+
margin-top: var(--sl-spacing-large);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.viur-shop-cart-address-headline {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
flex-wrap: nowrap;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
margin-bottom: var(--sl-spacing-medium);
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-checkbox
|
|
3
|
+
class="widget-bone widget-bone-boolean widget-bone-boolean-default"
|
|
4
|
+
:class="([`widget-bone-boolean-${name}`])"
|
|
5
|
+
:disabled="boneState.readonly"
|
|
6
|
+
:checked="state.value"
|
|
7
|
+
@sl-change="changeEvent"
|
|
8
|
+
>
|
|
9
|
+
{{ boneState.bonestructure.descr }}
|
|
10
|
+
</sl-checkbox>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
//@ts-nocheck
|
|
15
|
+
import { reactive, defineComponent, onMounted, inject, computed } from "vue"
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
props: {
|
|
20
|
+
name: String,
|
|
21
|
+
value: [Object, String, Number, Boolean, Array],
|
|
22
|
+
index: Number,
|
|
23
|
+
lang: String
|
|
24
|
+
},
|
|
25
|
+
components: {},
|
|
26
|
+
emits: ["change"],
|
|
27
|
+
setup(props, context) {
|
|
28
|
+
const boneState = inject("boneState")
|
|
29
|
+
const state = reactive({
|
|
30
|
+
value: computed(() => {
|
|
31
|
+
return ![false, null, undefined, ""].includes(props.value)
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
function changeEvent(event) {
|
|
36
|
+
context.emit("change", props.name, event.target.checked, props.lang, props.index)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
let val = props.value
|
|
41
|
+
if (!val) {
|
|
42
|
+
val = false
|
|
43
|
+
}
|
|
44
|
+
context.emit("change", props.name, val, props.lang, props.index) //init
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
state,
|
|
49
|
+
boneState,
|
|
50
|
+
changeEvent
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped>
|
|
57
|
+
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-select
|
|
3
|
+
class="widget-bone widget-bone-select widget-bone-select-default"
|
|
4
|
+
:class="([`widget-bone-select-${name}`])"
|
|
5
|
+
:disabled="boneState.readonly"
|
|
6
|
+
:value="state.value"
|
|
7
|
+
hoist
|
|
8
|
+
:multiple="boneState['bonestructure']['multiple']"
|
|
9
|
+
max-options-visible="0"
|
|
10
|
+
clearable
|
|
11
|
+
@sl-change="changeEvent"
|
|
12
|
+
:placeholder="boneState.bonestructure.descr"
|
|
13
|
+
>
|
|
14
|
+
<sl-option
|
|
15
|
+
v-for="value in convertObjToList()"
|
|
16
|
+
:key="value[0]"
|
|
17
|
+
:value="value[0]"
|
|
18
|
+
>
|
|
19
|
+
{{ value[1] }}
|
|
20
|
+
</sl-option>
|
|
21
|
+
</sl-select>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
//@ts-nocheck
|
|
26
|
+
import { reactive, defineComponent, onMounted, inject, computed } from "vue"
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
inheritAttrs: false,
|
|
30
|
+
props: {
|
|
31
|
+
name: String,
|
|
32
|
+
value: null,
|
|
33
|
+
index: Number,
|
|
34
|
+
lang: String
|
|
35
|
+
},
|
|
36
|
+
components: {},
|
|
37
|
+
emits: ["change"],
|
|
38
|
+
setup(props, context) {
|
|
39
|
+
const boneState = inject("boneState")
|
|
40
|
+
const state = reactive({
|
|
41
|
+
value: computed(() => {
|
|
42
|
+
let val = props.value
|
|
43
|
+
if (Array.isArray(props.value)) {
|
|
44
|
+
if (boneState["bonestructure"]["values"] instanceof Array) {
|
|
45
|
+
val = val.filter((i) => boneState["bonestructure"]["values"].map((i) => i[0].toString()).includes(i))
|
|
46
|
+
} else
|
|
47
|
+
val = val.filter((i) =>
|
|
48
|
+
Object.keys(boneState["bonestructure"]["values"])
|
|
49
|
+
.map((i) => i.toString())
|
|
50
|
+
.includes(i)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return val.map((i) => i.toString())
|
|
54
|
+
}
|
|
55
|
+
return props.value ? props.value.toString() : ""
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
function convertObjToList() {
|
|
60
|
+
if (Array.isArray(boneState["bonestructure"]["values"])) {
|
|
61
|
+
return boneState["bonestructure"]["values"]
|
|
62
|
+
} else {
|
|
63
|
+
let objToList = []
|
|
64
|
+
for (const [key, value] of Object.entries(boneState["bonestructure"]["values"])) {
|
|
65
|
+
objToList.push([key, value])
|
|
66
|
+
}
|
|
67
|
+
return objToList
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function changeEvent(event) {
|
|
72
|
+
context.emit("change", props.name, event.target.value, props.lang, props.index)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
context.emit("change", props.name, state.value, props.lang, props.index) //init
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
state,
|
|
81
|
+
boneState,
|
|
82
|
+
changeEvent,
|
|
83
|
+
convertObjToList
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style scoped>
|
|
90
|
+
|
|
91
|
+
</style>
|