@lancom/shared 0.0.427 → 0.0.428
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/components/common/client_settings_tax/client-settings-tax.scss +11 -0
- package/components/common/client_settings_tax/client-settings-tax.vue +48 -0
- package/components/common/toggle-switch.vue +123 -0
- package/components/product/gallery/gallery.vue +11 -5
- package/mixins/product-view.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ClientSettingsTax__wrapper">
|
|
3
|
+
<div class="ClientSettingsTax__toggle">
|
|
4
|
+
<toggle-switch
|
|
5
|
+
v-model="inclGST"
|
|
6
|
+
left-label="Ex VAT"
|
|
7
|
+
right-label="Inc VAT" />
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { mapGetters, mapMutations } from 'vuex';
|
|
14
|
+
import ToggleSwitch from '@lancom/shared/components/common/toggle-switch';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'ClientSettingsTax',
|
|
18
|
+
components: {
|
|
19
|
+
ToggleSwitch
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
color: {
|
|
23
|
+
type: String
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
...mapGetters(['taxName']),
|
|
28
|
+
...mapGetters('product', ['priceIncludeGST']),
|
|
29
|
+
inclGST: {
|
|
30
|
+
get() {
|
|
31
|
+
return this.priceIncludeGST;
|
|
32
|
+
},
|
|
33
|
+
set(value) {
|
|
34
|
+
this.setPriceIncludeGST(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
...mapMutations('product', ['setPriceIncludeGST'])
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss" scoped>
|
|
45
|
+
@import 'client-settings-tax';
|
|
46
|
+
</style>
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="toggle"
|
|
4
|
+
:class="[{ 'is-on': value, disabled }, sizeClass]"
|
|
5
|
+
role="switch"
|
|
6
|
+
:aria-checked="String(value)"
|
|
7
|
+
@click="toggle">
|
|
8
|
+
<span
|
|
9
|
+
class="label left"
|
|
10
|
+
:class="{ active: !value }">
|
|
11
|
+
{{ leftLabel }}
|
|
12
|
+
</span>
|
|
13
|
+
<div class="track">
|
|
14
|
+
<div class="thumb"></div>
|
|
15
|
+
</div>
|
|
16
|
+
<span
|
|
17
|
+
class="label right"
|
|
18
|
+
:class="{ active: value }">
|
|
19
|
+
{{ rightLabel }}
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
export default {
|
|
26
|
+
name: 'ToggleSwitch',
|
|
27
|
+
props: {
|
|
28
|
+
value: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
leftLabel: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: 'Off'
|
|
35
|
+
},
|
|
36
|
+
rightLabel: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'On'
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'md' // sm | md | lg
|
|
47
|
+
},
|
|
48
|
+
color: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '#1976d2'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
computed: {
|
|
54
|
+
sizeClass() {
|
|
55
|
+
return `size-${this.size}`;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
toggle() {
|
|
60
|
+
if (this.disabled) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.$emit('input', !this.value);
|
|
64
|
+
this.$emit('change', !this.value);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style scoped>
|
|
71
|
+
.toggle {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
user-select: none;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
gap: 10px;
|
|
77
|
+
position: relative;
|
|
78
|
+
padding-bottom: 6px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.label {
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
opacity: 0.6;
|
|
84
|
+
transition: opacity 0.15s, color 0.15s;
|
|
85
|
+
}
|
|
86
|
+
.label.active {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.track {
|
|
91
|
+
position: relative;
|
|
92
|
+
border-radius: 999px;
|
|
93
|
+
background: #e9eef6;
|
|
94
|
+
transition: background 0.2s ease;
|
|
95
|
+
}
|
|
96
|
+
.thumb {
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: 50%;
|
|
99
|
+
left: 2px;
|
|
100
|
+
transform: translate(0, -50%);
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
background: #fff;
|
|
103
|
+
transition: left 0.25s ease;
|
|
104
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
|
105
|
+
}
|
|
106
|
+
.is-on .thumb {
|
|
107
|
+
left: calc(100% - 2px - var(--thumb-size));
|
|
108
|
+
}
|
|
109
|
+
.is-on .track {
|
|
110
|
+
background: var(--color, #1976d2);
|
|
111
|
+
}
|
|
112
|
+
.disabled {
|
|
113
|
+
opacity: 0.5;
|
|
114
|
+
cursor: not-allowed;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.size-sm .track { width: 36px; height: 18px; }
|
|
118
|
+
.size-sm .thumb { width: 14px; height: 14px; --thumb-size: 14px; }
|
|
119
|
+
.size-md .track { width: 44px; height: 22px; }
|
|
120
|
+
.size-md .thumb { width: 18px; height: 18px; --thumb-size: 18px; }
|
|
121
|
+
.size-lg .track { width: 54px; height: 28px; }
|
|
122
|
+
.size-lg .thumb { width: 24px; height: 24px; --thumb-size: 24px; }
|
|
123
|
+
</style>
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
class="Gallery__big">
|
|
6
6
|
<div class="Gallery__big-image">
|
|
7
7
|
<img
|
|
8
|
-
:src="staticLink(currentImage.large)"
|
|
9
|
-
:alt="
|
|
8
|
+
:src="staticLink(currentImage.extralarge || currentImage.large)"
|
|
9
|
+
:alt="imageAlt(currentImage)"
|
|
10
10
|
class="Gallery__big-image-src"
|
|
11
11
|
@mouseenter="startZoom"
|
|
12
12
|
@mousemove="updateZoomWithThrottle"
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
preview: !showBigImage
|
|
48
48
|
}">
|
|
49
49
|
<img
|
|
50
|
-
:src="staticLink(currentImage.large)"
|
|
50
|
+
:src="staticLink(currentImage.extralarge || currentImage.large)"
|
|
51
51
|
:style="zoomImageStyles"
|
|
52
52
|
class="Gallery__zoom-image-src" />
|
|
53
53
|
</div>
|
|
54
54
|
<div class="Gallery__small">
|
|
55
55
|
<div
|
|
56
56
|
v-for="(image, index) in visibleImages"
|
|
57
|
-
:key="image.large"
|
|
57
|
+
:key="image.extralarge || image.large"
|
|
58
58
|
class="Gallery__small-image"
|
|
59
59
|
:class="{
|
|
60
60
|
'Gallery__small-image--active': (visibleImagesFrom + index) === activeIndex
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
@mouseleave="stopZoom">
|
|
65
65
|
<img
|
|
66
66
|
:src="staticLink(image.small)"
|
|
67
|
-
:alt="
|
|
67
|
+
:alt="imageAlt(image)"
|
|
68
68
|
width="65"
|
|
69
69
|
height="65"
|
|
70
70
|
class="Gallery__small-image-src" />
|
|
@@ -217,6 +217,12 @@ export default {
|
|
|
217
217
|
methods: {
|
|
218
218
|
...mapActions('product', ['selectColor']),
|
|
219
219
|
staticLink,
|
|
220
|
+
imageAlt(image) {
|
|
221
|
+
const { name, SKU } = this.product;
|
|
222
|
+
const type = image.types?.find(t => t === 'front' || t === 'back');
|
|
223
|
+
const productName = [image.colorName, type, name].filter(i => !!i).join(' ');
|
|
224
|
+
return [productName, SKU].join(' | ');
|
|
225
|
+
},
|
|
220
226
|
startPreview(index) {
|
|
221
227
|
if (!this.isZoomin) {
|
|
222
228
|
this.startZoom();
|
package/mixins/product-view.js
CHANGED
|
@@ -124,7 +124,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
124
124
|
return (thumbProductImages.length > 0 ? thumbProductImages : this.images).slice(0, 6);
|
|
125
125
|
},
|
|
126
126
|
mainProductImageSrc() {
|
|
127
|
-
return this.mainProductImage && staticLink(this.mainProductImage.large);
|
|
127
|
+
return this.mainProductImage && staticLink(this.mainProductImage.extralarge || this.mainProductImage.large);
|
|
128
128
|
},
|
|
129
129
|
mainProductImageStyles() {
|
|
130
130
|
return this.mainProductImageSrc ? { 'background-image': `url(${this.mainProductImageSrc});` } : {};
|
|
@@ -326,7 +326,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
326
326
|
"gtin13": sp.gtin,
|
|
327
327
|
"image": [
|
|
328
328
|
image,
|
|
329
|
-
...galleryImages.map(i => i.large).filter(i => !!i && i !== image)
|
|
329
|
+
...galleryImages.map(i => i.extralarge || i.large).filter(i => !!i && i !== image)
|
|
330
330
|
],
|
|
331
331
|
"name": name,
|
|
332
332
|
"description": description,
|