@lancom/shared 0.0.227 → 0.0.228
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/assets/js/api/admin.js +3 -0
- package/components/checkout/cart/cart.mixin.js +5 -1
- package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart-entity-color-simple-products.mixin.js +3 -0
- package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart-entity-color-simple-products.scss +5 -0
- package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart-entity-color-simple-products.vue +8 -0
- package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart_entity_color_simple_product/cart-entity-color-simple-product.scss +3 -0
- package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart_entity_color_simple_product/cart-entity-color-simple-product.vue +4 -1
- package/components/checkout/cart/cart_quantity_errors/cart-quantity-errors.vue +6 -0
- package/components/checkout/order/address-form/address-form.vue +1 -1
- package/components/common/payment/payment_card/payment-card.vue +1 -2
- package/components/product/gallery/gallery.scss +2 -0
- package/components/product/gallery/gallery.vue +9 -0
- package/package.json +1 -1
- package/store/cart.js +18 -1
- package/store/product.js +3 -0
- package/store/quote.js +12 -0
package/assets/js/api/admin.js
CHANGED
|
@@ -480,6 +480,9 @@ export default {
|
|
|
480
480
|
removeWarehouseAllocation(allocation) {
|
|
481
481
|
return _delete(`admin/allocations/${allocation._id}`, allocation);
|
|
482
482
|
},
|
|
483
|
+
removeWarehouseAllocations(allocations) {
|
|
484
|
+
return _delete(`admin/allocations`, { allocations });
|
|
485
|
+
},
|
|
483
486
|
fetchWarehouseLocationById(id) {
|
|
484
487
|
return _get(`admin/warehouse-locations/${id}`);
|
|
485
488
|
},
|
|
@@ -24,14 +24,18 @@ export default {
|
|
|
24
24
|
'suburb',
|
|
25
25
|
'quantities',
|
|
26
26
|
'notValidProductsQuantities',
|
|
27
|
+
'notValidStockQuantities',
|
|
27
28
|
'notValidPrintsQuantities'
|
|
28
29
|
]),
|
|
29
30
|
isNotValidQuantity() {
|
|
30
|
-
return this.isNotValidProductsQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
|
|
31
|
+
return this.isNotValidProductsQuantity || this.isNotValidStockQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
|
|
31
32
|
},
|
|
32
33
|
isNotValidProductsQuantity() {
|
|
33
34
|
return this.notValidProductsQuantities.length > 0;
|
|
34
35
|
},
|
|
36
|
+
isNotValidStockQuantity() {
|
|
37
|
+
return this.notValidStockQuantities.length > 0;
|
|
38
|
+
},
|
|
35
39
|
isNotValidPrintsQuantity() {
|
|
36
40
|
return this.notValidPrintsQuantities.length > 0;
|
|
37
41
|
},
|
|
@@ -55,6 +55,9 @@ export default {
|
|
|
55
55
|
return this.simpleProductsWithAmount.reduce((amount, entity) => {
|
|
56
56
|
return amount + entity.amount;
|
|
57
57
|
}, 0);
|
|
58
|
+
},
|
|
59
|
+
simpleProductWithInvalidStock() {
|
|
60
|
+
return this.simpleProductsWithAmount.filter(({ amount, quantityStock }) => amount > quantityStock)
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
methods: {
|
|
@@ -49,6 +49,14 @@
|
|
|
49
49
|
:display-unit-price="displayUnitPrice"
|
|
50
50
|
@change="onChangeQty" />
|
|
51
51
|
</div>
|
|
52
|
+
<div v-if="simpleProductWithInvalidStock.length > 0">
|
|
53
|
+
<div
|
|
54
|
+
v-for="simpleProduct in simpleProductWithInvalidStock"
|
|
55
|
+
:key="simpleProduct._id"
|
|
56
|
+
class="CartEntityColorSimpleProducts__error">
|
|
57
|
+
Error size {{ simpleProduct.size.shortName }}, qty available: {{ simpleProduct.quantityStock }}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
52
60
|
<div class="CartEntityColorSimpleProducts__totals">
|
|
53
61
|
<div class="CartEntityColorSimpleProducts__total">
|
|
54
62
|
<div class="lc_title-small">
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
type="number"
|
|
17
17
|
min="0"
|
|
18
18
|
class="form-field centered CartColorSimpleProduct__field"
|
|
19
|
-
:class="{
|
|
19
|
+
:class="{
|
|
20
|
+
empty: !model,
|
|
21
|
+
error: model > simpleProduct.quantityStock
|
|
22
|
+
}"
|
|
20
23
|
@change="onChange()"
|
|
21
24
|
@focus="onFocus()"
|
|
22
25
|
@blur="onBlur()" />
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
:key="product._id">
|
|
6
6
|
Minimum <b>{{ product.name }}</b> order quantity: {{ product.minimumOrderQuantity }}
|
|
7
7
|
</li>
|
|
8
|
+
<li
|
|
9
|
+
v-for="product in notValidStockQuantities"
|
|
10
|
+
:key="product._id">
|
|
11
|
+
Available <b>{{ product.name }}</b> quantity: {{ product.maxQuantity }}
|
|
12
|
+
</li>
|
|
8
13
|
<li
|
|
9
14
|
v-for="print in notValidPrintsQuantities"
|
|
10
15
|
:key="print._id">
|
|
@@ -26,6 +31,7 @@ export default {
|
|
|
26
31
|
computed: {
|
|
27
32
|
...mapGetters('cart', [
|
|
28
33
|
'notValidProductsQuantities',
|
|
34
|
+
'notValidStockQuantities',
|
|
29
35
|
'notValidPrintsQuantities'
|
|
30
36
|
])
|
|
31
37
|
}
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
&__big-image,
|
|
76
76
|
&__small-image {
|
|
77
|
+
text-align: center;
|
|
77
78
|
width: 100%;
|
|
78
79
|
position: relative;
|
|
79
80
|
background-repeat: no-repeat;
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
}
|
|
90
91
|
&__small-image {
|
|
91
92
|
height: 75px;
|
|
93
|
+
max-width: 140px;
|
|
92
94
|
padding: 5px 0;
|
|
93
95
|
text-align: center;
|
|
94
96
|
&-src {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
<img
|
|
6
6
|
:src="staticLink(currentImage.large)"
|
|
7
7
|
:alt="product.name"
|
|
8
|
+
width="400"
|
|
9
|
+
height="400"
|
|
8
10
|
class="Gallery__big-image-src" />
|
|
9
11
|
<div
|
|
10
12
|
v-if="currentImage.print"
|
|
@@ -47,18 +49,22 @@
|
|
|
47
49
|
<img
|
|
48
50
|
:src="staticLink(image.small)"
|
|
49
51
|
:alt="product.name"
|
|
52
|
+
width="65"
|
|
53
|
+
height="65"
|
|
50
54
|
class="Gallery__small-image-src" />
|
|
51
55
|
<div class="Gallery__small-printed">
|
|
52
56
|
{{ image.printType ? 'Printed' : (product.prePrint ? product.prePrintText : image.colorName || 'Blank') }}
|
|
53
57
|
</div>
|
|
54
58
|
</div>
|
|
55
59
|
<button
|
|
60
|
+
v-if="hasThumbsArrows"
|
|
56
61
|
type="button"
|
|
57
62
|
class="slick-arrow slick-prev slick-disabled"
|
|
58
63
|
@click="goToPrevPage()">
|
|
59
64
|
Previous
|
|
60
65
|
</button>
|
|
61
66
|
<button
|
|
67
|
+
v-if="hasThumbsArrows"
|
|
62
68
|
type="button"
|
|
63
69
|
class="slick-arrow slick-next"
|
|
64
70
|
@click="goToNextPage()">
|
|
@@ -141,6 +147,9 @@ export default {
|
|
|
141
147
|
visibleImages() {
|
|
142
148
|
return this.filteredImages.slice(this.visibleImagesFrom, this.visibleImagesFrom + this.slidesPerRow);
|
|
143
149
|
},
|
|
150
|
+
hasThumbsArrows() {
|
|
151
|
+
return this.filteredImages.length > this.slidesPerRow;
|
|
152
|
+
},
|
|
144
153
|
filteredImages() {
|
|
145
154
|
const images = this.filterType ? this.images.filter(i => this.isValidImageByFilter(this.filterType, i)) : this.images;
|
|
146
155
|
return images.map(image => {
|
package/package.json
CHANGED
package/store/cart.js
CHANGED
|
@@ -31,6 +31,19 @@ const getProductsQuantities = entities => {
|
|
|
31
31
|
return quantities;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
const getInvalidStockQuantities = entities => {
|
|
35
|
+
const quantities = entities.reduce((items, entity) => {
|
|
36
|
+
const { product: { name }, simpleProducts } = entity;
|
|
37
|
+
return [
|
|
38
|
+
...items,
|
|
39
|
+
...simpleProducts
|
|
40
|
+
.filter(({ amount }) => amount > 0)
|
|
41
|
+
.map(({ _id, amount, quantityStock, size }) => ({ _id, name: `${name}, ${size.shortName}`, quantity: amount, maxQuantity: quantityStock }))
|
|
42
|
+
];
|
|
43
|
+
}, []);
|
|
44
|
+
return quantities;
|
|
45
|
+
};
|
|
46
|
+
|
|
34
47
|
const getPrintsQuantities = entities => {
|
|
35
48
|
const printTypes = entities.reduce((types, e) => [...types, ...e.prints.map(({ printType }) => ({ ...printType, guid: `${e.guid}-${printType._id}` }))], []);
|
|
36
49
|
const grouped = groupBy(printTypes, 'guid');
|
|
@@ -56,11 +69,15 @@ export const getters = {
|
|
|
56
69
|
isEmpty: (state, { entities }) => (entities || []).length === 0,
|
|
57
70
|
quantities: ({ entities }) => ({
|
|
58
71
|
products: getProductsQuantities(entities),
|
|
59
|
-
prints: getPrintsQuantities(entities)
|
|
72
|
+
prints: getPrintsQuantities(entities),
|
|
73
|
+
stock: getInvalidStockQuantities(entities)
|
|
60
74
|
}),
|
|
61
75
|
notValidProductsQuantities(state, { quantities }) {
|
|
62
76
|
return (quantities?.products || []).filter(({ minimumOrderQuantity, quantity }) => quantity < minimumOrderQuantity);
|
|
63
77
|
},
|
|
78
|
+
notValidStockQuantities(state, { quantities }) {
|
|
79
|
+
return (quantities?.stock || []).filter(({ maxQuantity, quantity }) => quantity > maxQuantity);
|
|
80
|
+
},
|
|
64
81
|
notValidPrintsQuantities(state, { quantities }) {
|
|
65
82
|
return (quantities?.prints || []).filter(({ minQuantity, quantity }) => quantity < minQuantity);
|
|
66
83
|
},
|
package/store/product.js
CHANGED
package/store/quote.js
CHANGED
|
@@ -16,6 +16,18 @@ export const getters = {
|
|
|
16
16
|
selectedOption: ({ selectedOption }) => selectedOption,
|
|
17
17
|
proceedOption: ({ option, selectedOption }) => option || selectedOption,
|
|
18
18
|
hasProceedOption: (state, { proceedOption }) => !!proceedOption,
|
|
19
|
+
proceedOptionNotValidStock: (state, { proceedOption }) => {
|
|
20
|
+
if (!proceedOption) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const simpleProducts = proceedOption.products.reduce((simpleProducts, product) => {
|
|
24
|
+
return [
|
|
25
|
+
...simpleProducts,
|
|
26
|
+
...(product.isCustom ? [] : product.simpleProducts.filter(({ amount }) => amount > 0))
|
|
27
|
+
];
|
|
28
|
+
}, []);
|
|
29
|
+
return simpleProducts.some(sp => sp.amount > sp.quantityStock);
|
|
30
|
+
},
|
|
19
31
|
options: ({ option, quote }) => (option ? quote.options.filter(o => o._id === option) : quote.options) || [],
|
|
20
32
|
quoteId: ({ quote }) => `${quote.code}`.replace('QUOTE', ''),
|
|
21
33
|
shopContacts: ({ quote }) => quote.shop.settings?.contacts || {},
|