@lancom/shared 0.0.422 → 0.0.424
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 +33 -7
- package/assets/js/api/index.js +17 -3
- package/assets/js/utils/share-promises/index.js +76 -0
- package/components/common/coupon_select/coupon-select.vue +12 -2
- package/components/common/phone_input/phone-input.vue +15 -3
- package/components/common/postcode_select/postcode-select.vue +3 -1
- package/components/customer/customer_navigation_menu/customer-navigation-menu.vue +11 -7
- package/components/customer/customer_preferences_form/customer-preferences-form.scss +12 -0
- package/components/customer/customer_preferences_form/customer-preferences-form.vue +87 -0
- package/components/pages/customer/preferences/preferences.vue +79 -0
- package/components/product/product.vue +0 -12
- package/components/product/product_colors_selector/product-colors-selector.vue +22 -13
- package/components/product/product_reviews/product-reviews.vue +6 -6
- package/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell.vue +23 -3
- package/components/product/products_multipacks_size_selector_color/product_multipacks_size_selector_color/product-multipacks-size-selector-color.scss +61 -0
- package/components/product/products_multipacks_size_selector_color/product_multipacks_size_selector_color/product-multipacks-size-selector-color.vue +102 -0
- package/components/product/products_multipacks_size_selector_color/products-multipacks-size-selector-color.scss +15 -0
- package/components/product/products_multipacks_size_selector_color/products-multipacks-size-selector-color.vue +95 -0
- package/components/product/related_products/related-products.vue +4 -4
- package/components/product/wizard-editor/wizard-editor.vue +5 -1
- package/components/products/children_categories/children-categories.scss +3 -3
- package/components/resource/resource_view/resource-view.mixin.js +74 -0
- package/components/resource/resource_view/resource-view.scss +13 -0
- package/components/resource/resource_view/resource-view.vue +97 -0
- package/components/resource/resource_view/resource_view_prints/resource-view-prints.scss +7 -0
- package/components/resource/resource_view/resource_view_prints/resource-view-prints.vue +42 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource-view-print.scss +5 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource-view-print.vue +54 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource-view-print-products.scss +0 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource-view-print-products.vue +45 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource_view_print_product/resource-view-print-product.scss +0 -0
- package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource_view_print_product/resource-view-print-product.vue +44 -0
- package/layouts/products.vue +7 -13
- package/package.json +1 -1
- package/pages/customer/preferences.vue +33 -0
- package/pages/order/_token/resource/_resource.vue +53 -0
- package/routes/index.js +10 -0
- package/store/auth.js +1 -0
- package/store/index.js +12 -3
- package/store/product.js +2 -1
|
@@ -63,6 +63,9 @@ export default {
|
|
|
63
63
|
type: Object,
|
|
64
64
|
required: true
|
|
65
65
|
},
|
|
66
|
+
multipack: {
|
|
67
|
+
type: Object
|
|
68
|
+
},
|
|
66
69
|
sideControls: {
|
|
67
70
|
type: Boolean,
|
|
68
71
|
default: false
|
|
@@ -88,7 +91,7 @@ export default {
|
|
|
88
91
|
},
|
|
89
92
|
computed: {
|
|
90
93
|
...mapGetters(['currency']),
|
|
91
|
-
...mapGetters('product', ['usedSimpleProducts', 'product']),
|
|
94
|
+
...mapGetters('product', ['commonProductsMultipacks', 'usedSimpleProducts', 'product']),
|
|
92
95
|
disabled() {
|
|
93
96
|
const sizeWithoutColor = this.color.sizes && !this.color.sizes.find(({ alias }) => alias === this.size.alias);
|
|
94
97
|
return sizeWithoutColor || this.outStock;
|
|
@@ -97,17 +100,34 @@ export default {
|
|
|
97
100
|
return this.usedSimpleProducts
|
|
98
101
|
.find(({ color, size }) => color._id === this.color._id && size._id === this.size._id);
|
|
99
102
|
},
|
|
103
|
+
simpleProductAmount() {
|
|
104
|
+
return (this.simpleProduct || {}).amount || this.defaultValue || 0;
|
|
105
|
+
},
|
|
100
106
|
model: {
|
|
101
107
|
get() {
|
|
102
|
-
|
|
108
|
+
const amount = this.simpleProductAmount;
|
|
109
|
+
if (this.multipack) {
|
|
110
|
+
const biggerMultipacks = [...this.commonProductsMultipacks]
|
|
111
|
+
.sort((a, b) => b.qty - a.qty)
|
|
112
|
+
.filter(p => p.qty > this.multipack.qty);
|
|
113
|
+
const biggerMultipacksAmount = amount - biggerMultipacks.reduce((leftAmount, p) => leftAmount % p.qty, amount);
|
|
114
|
+
const multipackAmount = amount - biggerMultipacksAmount;
|
|
115
|
+
const result = Math.floor(multipackAmount / this.multipack.qty);
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
return amount;
|
|
103
119
|
},
|
|
104
120
|
set(value) {
|
|
105
121
|
const outOfStockQuantity = this.simpleProduct?.quantityStock;
|
|
122
|
+
if (this.multipack) {
|
|
123
|
+
const leftAmount = this.simpleProductAmount - (this.model * this.multipack.qty);
|
|
124
|
+
value = leftAmount + Math.max(0, value) * this.multipack.qty;
|
|
125
|
+
}
|
|
106
126
|
if (outOfStockQuantity && outOfStockQuantity < value && this.showMaxModal) {
|
|
107
127
|
const message = `Maximum value: ${outOfStockQuantity}`;
|
|
108
128
|
this.showConfirmationModal(message);
|
|
109
129
|
}
|
|
110
|
-
const amount = inRange(value, 0, outOfStockQuantity ||
|
|
130
|
+
const amount = inRange(value, 0, outOfStockQuantity || 1000);
|
|
111
131
|
this.setSimpleProductAmount({
|
|
112
132
|
colorId: this.color._id,
|
|
113
133
|
sizeId: this.size._id,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@import '@/assets/scss/variables';
|
|
2
|
+
|
|
3
|
+
.ProductMultipacksSizeSelectorColor {
|
|
4
|
+
&__wrapper td {
|
|
5
|
+
font-weight: 800;
|
|
6
|
+
font-size: 18px;
|
|
7
|
+
line-height: 25px;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
color: $black;
|
|
10
|
+
&.disabled {
|
|
11
|
+
color: $gray_main;
|
|
12
|
+
pointer-events: none !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
&__color-name {
|
|
16
|
+
width: 70px;
|
|
17
|
+
span {
|
|
18
|
+
writing-mode: vertical-lr;
|
|
19
|
+
transform: rotate(180deg);
|
|
20
|
+
width: 100%;
|
|
21
|
+
display: block;
|
|
22
|
+
margin-left: -20px;
|
|
23
|
+
}
|
|
24
|
+
@media (max-width: $bp-extra-small-max) {
|
|
25
|
+
width: 40px;
|
|
26
|
+
span {
|
|
27
|
+
margin-left: -6px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
&__size {
|
|
32
|
+
width: 70px;
|
|
33
|
+
}
|
|
34
|
+
&__in-stock,
|
|
35
|
+
&__out-stock {
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
text-transform: none;
|
|
38
|
+
}
|
|
39
|
+
&__out-stock {
|
|
40
|
+
color: $gray_main;
|
|
41
|
+
}
|
|
42
|
+
&__stock {
|
|
43
|
+
font-size: 11px;
|
|
44
|
+
letter-spacing: -1px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::v-deep .ProductSizeSelectorColorCell {
|
|
49
|
+
&__field {
|
|
50
|
+
line-height: 20px;
|
|
51
|
+
input {
|
|
52
|
+
height: 30px;
|
|
53
|
+
padding: 5px !important;
|
|
54
|
+
background-color: $gray;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
&__side-control {
|
|
58
|
+
background: $green;
|
|
59
|
+
width: 26px;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr class="ProductMultipacksSizeSelectorColor__wrapper">
|
|
3
|
+
<td
|
|
4
|
+
v-if="rowspan"
|
|
5
|
+
:rowspan="rowspan"
|
|
6
|
+
class="ProductMultipacksSizeSelectorColor__color-name">
|
|
7
|
+
<span>
|
|
8
|
+
{{ product.color.name }}
|
|
9
|
+
</span>
|
|
10
|
+
</td>
|
|
11
|
+
<td
|
|
12
|
+
class="ProductMultipacksSizeSelectorColor__size"
|
|
13
|
+
:class="{ disabled }">
|
|
14
|
+
<div>
|
|
15
|
+
{{ product.size.shortName }}
|
|
16
|
+
</div>
|
|
17
|
+
<div class="ProductMultipacksSizeSelectorColor__stock">
|
|
18
|
+
<div
|
|
19
|
+
v-if="product.quantityStock"
|
|
20
|
+
class="ProductMultipacksSizeSelectorColor__in-stock">
|
|
21
|
+
{{ currentQuantityStockLabel }} in stock
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
v-else
|
|
25
|
+
class="ProductMultipacksSizeSelectorColor__out-stock">
|
|
26
|
+
out of stock
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</td>
|
|
30
|
+
<td
|
|
31
|
+
v-for="multipack in commonProductsMultipacks"
|
|
32
|
+
:key="multipack._id"
|
|
33
|
+
class="ProductMultipacksSizeSelectorColor__cell">
|
|
34
|
+
<product-size-selector-color-cell
|
|
35
|
+
:side-controls="true"
|
|
36
|
+
:show-max-modal="false"
|
|
37
|
+
:out-stock="disabled"
|
|
38
|
+
:color="product.color"
|
|
39
|
+
:size="product.size"
|
|
40
|
+
:multipack="multipack" />
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import { mapGetters } from 'vuex';
|
|
47
|
+
import { price, tax } from '@lancom/shared/assets/js/utils/filters';
|
|
48
|
+
import ProductSizeSelectorColorCell from '@lancom/shared/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell';
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: 'ProductMultipacksSizeSelectorColor',
|
|
52
|
+
filters: {
|
|
53
|
+
price
|
|
54
|
+
},
|
|
55
|
+
components: {
|
|
56
|
+
ProductSizeSelectorColorCell
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
product: {
|
|
60
|
+
type: Object,
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
rowspan: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 0
|
|
66
|
+
},
|
|
67
|
+
withGst: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
...mapGetters('product', ['commonProductsMultipacks', 'isPrintPricing', 'usedSimpleProductsQuantity', 'printsPrice']),
|
|
74
|
+
...mapGetters(['gstTax', 'currency']),
|
|
75
|
+
currentQuantityStockLabel() {
|
|
76
|
+
return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
|
|
77
|
+
},
|
|
78
|
+
pricing() {
|
|
79
|
+
return (this.isPrintPricing ? this.product.pricing : this.product.unprintedPricing) || [];
|
|
80
|
+
},
|
|
81
|
+
productPrice() {
|
|
82
|
+
const amount = this.usedSimpleProductsQuantity;
|
|
83
|
+
const pricing = this.pricing;
|
|
84
|
+
const price = (pricing.find(({ min, max }) => (!min || min <= amount) && (!max || max >= amount)) || pricing[0] || {}).price || 0;
|
|
85
|
+
return this.withGst ? tax(price, this.gstTax) : price;
|
|
86
|
+
},
|
|
87
|
+
productPrintsPrice() {
|
|
88
|
+
return this.withGst ? tax(this.printsPrice, this.gstTax) : this.printsPrice;
|
|
89
|
+
},
|
|
90
|
+
disabled() {
|
|
91
|
+
return !this.product.quantityStock || !this.productPrice;
|
|
92
|
+
},
|
|
93
|
+
currentQuantityStock() {
|
|
94
|
+
return (this.product.quantityStock || 0) - (this.product.amount || 0);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<style lang="scss" scoped>
|
|
101
|
+
@import 'product-multipacks-size-selector-color.scss';
|
|
102
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import '@/assets/scss/variables';
|
|
2
|
+
|
|
3
|
+
.ProductsMultipacksSizeSelectorColor {
|
|
4
|
+
&__table {
|
|
5
|
+
border: 1px solid $gray;
|
|
6
|
+
font-weight: 800;
|
|
7
|
+
font-size: 18px;
|
|
8
|
+
line-height: 25px;
|
|
9
|
+
text-transform: uppercase;
|
|
10
|
+
color: $black;
|
|
11
|
+
}
|
|
12
|
+
&__cost-column {
|
|
13
|
+
width: 150px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<table class="ProductsMultipacksSizeSelectorColor__table lc_table bordered">
|
|
4
|
+
<thead class="centered">
|
|
5
|
+
<tr>
|
|
6
|
+
<th
|
|
7
|
+
colspan="2"
|
|
8
|
+
class="ProductsMultipacksSizeSelectorColor__cost-column">
|
|
9
|
+
</th>
|
|
10
|
+
<th
|
|
11
|
+
v-for="multipack in commonProductsMultipacks"
|
|
12
|
+
:key="multipack._id">
|
|
13
|
+
{{ multipack.name }} ({{ multipack.qty }})
|
|
14
|
+
</th>
|
|
15
|
+
</tr>
|
|
16
|
+
<tr>
|
|
17
|
+
<th
|
|
18
|
+
colspan="2"
|
|
19
|
+
class="ProductsMultipacksSizeSelectorColor__cost-column">
|
|
20
|
+
COST
|
|
21
|
+
</th>
|
|
22
|
+
<th
|
|
23
|
+
v-for="multipack in commonProductsMultipacks"
|
|
24
|
+
:key="multipack._id">
|
|
25
|
+
{{ priceFromRange(multipack.qty, multipack.qty) | price(currency) }}
|
|
26
|
+
</th>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<th
|
|
30
|
+
colspan="2"
|
|
31
|
+
style="width: 140px;">
|
|
32
|
+
UNiTCOST
|
|
33
|
+
</th>
|
|
34
|
+
<th
|
|
35
|
+
v-for="multipack in commonProductsMultipacks"
|
|
36
|
+
:key="multipack._id">
|
|
37
|
+
{{ priceFromRange(multipack.qty, 1) | price(currency) }}
|
|
38
|
+
</th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody class="centered">
|
|
42
|
+
<product-multipacks-size-selector-color
|
|
43
|
+
v-for="(product, index) in products"
|
|
44
|
+
:key="`${editableColor._id}_${product._id}`"
|
|
45
|
+
:rowspan="index === 0 ? products.length : 0"
|
|
46
|
+
:with-gst="withGst"
|
|
47
|
+
:product="product" />
|
|
48
|
+
</tbody>
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
import { mapGetters } from 'vuex';
|
|
55
|
+
import { sortBySize } from '@lancom/shared/assets/js/utils/sizes';
|
|
56
|
+
import { priceFromRange } from '@lancom/shared/assets/js/utils/pricing';
|
|
57
|
+
import { price, tax } from '@lancom/shared/assets/js/utils/filters';
|
|
58
|
+
import ProductMultipacksSizeSelectorColor from './product_multipacks_size_selector_color/product-multipacks-size-selector-color';
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
name: 'ProductsMultipacksSizeSelectorColor',
|
|
62
|
+
filters: {
|
|
63
|
+
price
|
|
64
|
+
},
|
|
65
|
+
components: {
|
|
66
|
+
ProductMultipacksSizeSelectorColor
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
withGst: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
computed: {
|
|
75
|
+
...mapGetters(['gstTax']),
|
|
76
|
+
...mapGetters('product', ['defaultSimpleProduct', 'commonProductsMultipacks', 'editableColor', 'editableColorSimpleProducts']),
|
|
77
|
+
products() {
|
|
78
|
+
return sortBySize(this.editableColorSimpleProducts);
|
|
79
|
+
},
|
|
80
|
+
pricing() {
|
|
81
|
+
return this.defaultSimpleProduct.pricing;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
priceFromRange(min, qty) {
|
|
86
|
+
const price = priceFromRange(min, this.pricing) * qty;
|
|
87
|
+
return this.withGst ? tax(price, this.gstTax) : price;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang="scss" scoped>
|
|
94
|
+
@import 'products-multipacks-size-selector-color.scss';
|
|
95
|
+
</style>
|
|
@@ -36,15 +36,15 @@ export default {
|
|
|
36
36
|
products: []
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
|
+
async fetch() {
|
|
40
|
+
const { products } = await api.fetchRelatedProducts(this.shop._id, this.product.alias, { needShuffle: true });
|
|
41
|
+
this.products = products.splice(0, 6);
|
|
42
|
+
},
|
|
39
43
|
computed: {
|
|
40
44
|
...mapGetters(['shop']),
|
|
41
45
|
hasProducts() {
|
|
42
46
|
return this.products.length > 0;
|
|
43
47
|
}
|
|
44
|
-
},
|
|
45
|
-
async fetch() {
|
|
46
|
-
const { products } = await api.fetchRelatedProducts(this.shop._id, this.product.alias, { needShuffle: true });
|
|
47
|
-
this.products = products.splice(0, 6);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
</script>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
v-show="visibleWizard" />
|
|
11
11
|
</div>
|
|
12
12
|
<div
|
|
13
|
-
v-if="editableColor"
|
|
13
|
+
v-if="editableColor && availableMultipacks"
|
|
14
14
|
class="Editor__section">
|
|
15
15
|
<product-multipacks-carousel
|
|
16
16
|
:key="editableColor._id"
|
|
@@ -77,6 +77,10 @@ export default {
|
|
|
77
77
|
'isPrintPricing',
|
|
78
78
|
'priceIncludeGST'
|
|
79
79
|
]),
|
|
80
|
+
availableMultipacks() {
|
|
81
|
+
const multipacks = (this.product.multipacks || []);
|
|
82
|
+
return multipacks.some(m => !!m.SKU);
|
|
83
|
+
},
|
|
80
84
|
visibleWizard() {
|
|
81
85
|
return (this.product.printTypes || []).length > 0;
|
|
82
86
|
},
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.CategoryCard {
|
|
15
|
-
width:
|
|
15
|
+
width: 170px;
|
|
16
16
|
margin: 0 0 15px 15px;
|
|
17
17
|
position: relative;
|
|
18
18
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
&__image-wrapper {
|
|
36
36
|
width: 100%;
|
|
37
|
-
height:
|
|
37
|
+
height: 200px;
|
|
38
38
|
overflow: hidden;
|
|
39
39
|
position: relative;
|
|
40
40
|
}
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
@media (max-width: $bp-extra-small-max) {
|
|
63
63
|
margin: 0 auto 25px auto;
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import api from '@lancom/shared/assets/js/api';
|
|
2
|
+
|
|
3
|
+
const ORDER_RESOURCE_STATUS = {
|
|
4
|
+
PENDING_APPROVAL: 'pending approval',
|
|
5
|
+
APPROVED: 'approved',
|
|
6
|
+
NOT_APPROVED: 'not approved'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
props: {
|
|
11
|
+
order: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
resource: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
processing: false
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
file() {
|
|
27
|
+
return this.resource.file;
|
|
28
|
+
},
|
|
29
|
+
isNotApproved() {
|
|
30
|
+
return this.resource.status === ORDER_RESOURCE_STATUS.NOT_APPROVED;
|
|
31
|
+
},
|
|
32
|
+
isApproved() {
|
|
33
|
+
return this.resource.status === ORDER_RESOURCE_STATUS.APPROVED;
|
|
34
|
+
},
|
|
35
|
+
isAvailableForApprove() {
|
|
36
|
+
const statuses = [
|
|
37
|
+
ORDER_RESOURCE_STATUS.APPROVED,
|
|
38
|
+
ORDER_RESOURCE_STATUS.NOT_APPROVED,
|
|
39
|
+
ORDER_RESOURCE_STATUS.PENDING_APPROVAL
|
|
40
|
+
];
|
|
41
|
+
return statuses.includes(this.resource.status);
|
|
42
|
+
},
|
|
43
|
+
isValidStatus() {
|
|
44
|
+
const statuses = [
|
|
45
|
+
ORDER_RESOURCE_STATUS.APPROVED,
|
|
46
|
+
ORDER_RESOURCE_STATUS.NOT_APPROVED
|
|
47
|
+
];
|
|
48
|
+
return statuses.includes(this.resource.status);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
mounted() {
|
|
52
|
+
console.log('this.resource: ', this.resource);
|
|
53
|
+
console.log('this.order: ', this.order);
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
approveMockup() {
|
|
57
|
+
this.resource.status = 'approved';
|
|
58
|
+
},
|
|
59
|
+
notApproveMockup() {
|
|
60
|
+
this.resource.status = 'not approved';
|
|
61
|
+
},
|
|
62
|
+
async submitApproval() {
|
|
63
|
+
this.processing = true;
|
|
64
|
+
try {
|
|
65
|
+
await api.approveOrderMockup(this.order, this.resource);
|
|
66
|
+
this.processing = false;
|
|
67
|
+
this.$toastr.s('Approval submitted successfully.');
|
|
68
|
+
} catch (error) {
|
|
69
|
+
this.processing = false;
|
|
70
|
+
this.$toastr.e('Failed to submit approval.');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ResourceView__wrapper">
|
|
3
|
+
<div class="row">
|
|
4
|
+
<div class="col-6">
|
|
5
|
+
<div class="ResourceView__code lc_h3">
|
|
6
|
+
{{ order.code }}
|
|
7
|
+
</div>
|
|
8
|
+
<div>
|
|
9
|
+
<div>
|
|
10
|
+
<div class="ResourceView__code lc_h5">
|
|
11
|
+
Approve Mockup
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
v-if="file"
|
|
15
|
+
class="lc_regular16">
|
|
16
|
+
<span>
|
|
17
|
+
Mockup:
|
|
18
|
+
</span>
|
|
19
|
+
<a
|
|
20
|
+
:href="file.origin"
|
|
21
|
+
target="_blank"
|
|
22
|
+
class="lc_black">
|
|
23
|
+
{{ file.fileName }}
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="ResourceView__approve">
|
|
28
|
+
<div>
|
|
29
|
+
<btn
|
|
30
|
+
:btn-class="isApproved ? 'purple' : 'white'"
|
|
31
|
+
:btn-disabled="!isAvailableForApprove || processing"
|
|
32
|
+
:btn-processing="processing"
|
|
33
|
+
btn-label="Approved"
|
|
34
|
+
class="ResourceView__approve-btn"
|
|
35
|
+
@onclick="approveMockup()">
|
|
36
|
+
</btn>
|
|
37
|
+
<btn
|
|
38
|
+
:btn-class="isNotApproved ? 'purple' : 'white'"
|
|
39
|
+
:btn-disabled="!isAvailableForApprove"
|
|
40
|
+
:btn-processing="processing"
|
|
41
|
+
btn-label="Not Approved"
|
|
42
|
+
class="ResourceView__approve-btn"
|
|
43
|
+
@onclick="notApproveMockup()">
|
|
44
|
+
</btn>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="mt-10">
|
|
47
|
+
<validation-provider
|
|
48
|
+
tag="div"
|
|
49
|
+
name="Comment"
|
|
50
|
+
class="mb-5 mt-5">
|
|
51
|
+
<textarea
|
|
52
|
+
id="timeline_message"
|
|
53
|
+
v-model="resource.comment"
|
|
54
|
+
name="comment"
|
|
55
|
+
style="height: 140px"
|
|
56
|
+
placeholder="Comment"
|
|
57
|
+
class="form-field no-label"></textarea>
|
|
58
|
+
</validation-provider>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="mt-10">
|
|
61
|
+
<btn
|
|
62
|
+
btn-class="green"
|
|
63
|
+
:btn-disabled="!isValidStatus || processing"
|
|
64
|
+
:btn-processing="processing"
|
|
65
|
+
btn-label="Save"
|
|
66
|
+
class="ResourceView__approve-btn"
|
|
67
|
+
@onclick="submitApproval()">
|
|
68
|
+
</btn>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="col-6">
|
|
74
|
+
<resource-view-prints
|
|
75
|
+
:order="order"
|
|
76
|
+
:resource="resource" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
import ResourceViewMixin from './resource-view.mixin';
|
|
84
|
+
import ResourceViewPrints from './resource_view_prints/resource-view-prints';
|
|
85
|
+
|
|
86
|
+
export default {
|
|
87
|
+
name: 'LancomResourceView',
|
|
88
|
+
components: {
|
|
89
|
+
ResourceViewPrints
|
|
90
|
+
},
|
|
91
|
+
mixins: [ResourceViewMixin]
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style lang="scss" scoped>
|
|
96
|
+
@import 'resource-view.scss';
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ResourceViewPrints__wrapper">
|
|
3
|
+
<resource-view-print
|
|
4
|
+
v-for="print in prints"
|
|
5
|
+
:key="print._id"
|
|
6
|
+
:order="order"
|
|
7
|
+
:resource="resource"
|
|
8
|
+
:print="print"
|
|
9
|
+
class="ResourceViewPrints__print" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import ResourceViewPrint from './resource_view_print/resource-view-print';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'LancomResourceViewPrints',
|
|
18
|
+
components: {
|
|
19
|
+
ResourceViewPrint
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
order: {
|
|
23
|
+
type: Object,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
resource: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
computed: {
|
|
32
|
+
prints() {
|
|
33
|
+
const productsPrints = this.order.products.reduce((prints, product) => [...prints, ...product.prints], []);
|
|
34
|
+
return [...this.order.prints, ...productsPrints];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
@import 'resource-view-prints.scss';
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ResourceViewPrint__wrapper">
|
|
3
|
+
<div class="lc_regular12">
|
|
4
|
+
<div v-if="print.printType">
|
|
5
|
+
<b class="lc_bold">Print Type:</b> {{ print.printType.name }}
|
|
6
|
+
</div>
|
|
7
|
+
<div v-if="print.printArea">
|
|
8
|
+
<b class="lc_bold">Print Area:</b> {{ print.printArea.name }}
|
|
9
|
+
</div>
|
|
10
|
+
<div v-if="print.printSize">
|
|
11
|
+
<b class="lc_bold">Print Size:</b> {{ print.printSize.name }}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="ResourceViewPrint__products">
|
|
15
|
+
<resource-view-print-products
|
|
16
|
+
:order="order"
|
|
17
|
+
:resource="resource"
|
|
18
|
+
:print="print" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import ResourceViewPrintProducts from './resource_view_print_products/resource-view-print-products';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'LancomResourceViewPrint',
|
|
28
|
+
components: {
|
|
29
|
+
ResourceViewPrintProducts
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
order: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
resource: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
print: {
|
|
41
|
+
type: Object,
|
|
42
|
+
required: true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
mounted() {
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log('this.print: ', this.print);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style lang="scss" scoped>
|
|
53
|
+
@import 'resource-view-print.scss';
|
|
54
|
+
</style>
|