@lancom/shared 0.0.334 → 0.0.335
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 +12 -0
- package/assets/js/api/index.js +3 -0
- package/assets/js/utils/breakpoints.js +10 -2
- package/components/checkout/order/address-form/address-form.vue +1 -1
- package/components/common/product_side_with_print/product-side-with-print.vue +4 -3
- package/components/customer/customer_menu/customer-menu.scss +113 -0
- package/components/customer/customer_menu/customer-menu.vue +49 -0
- package/components/customer/customer_orders/customer-orders.scss +19 -0
- package/components/customer/customer_orders/customer-orders.vue +69 -0
- package/components/editor/editor_product_details/editor-product-details.scss +2 -2
- package/components/editor/editor_product_details/editor-product-details.vue +1 -0
- package/components/editor/editor_workspace/editor-workspace.scss +15 -4
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +1 -0
- package/package.json +1 -1
- package/pages/customer/orders/index.vue +29 -0
- package/routes/index.js +5 -0
package/assets/js/api/admin.js
CHANGED
|
@@ -284,6 +284,18 @@ export default {
|
|
|
284
284
|
removeUser(id) {
|
|
285
285
|
return _delete(`admin/user/${id}`);
|
|
286
286
|
},
|
|
287
|
+
fetchCustomerById(id) {
|
|
288
|
+
return _get(`admin/customer/${id}`);
|
|
289
|
+
},
|
|
290
|
+
saveCustomer(customer) {
|
|
291
|
+
return customer._id ? _put(`admin/customer/${customer._id}`, customer) : _post('admin/customer', customer);
|
|
292
|
+
},
|
|
293
|
+
saveCustomerPassword(customer) {
|
|
294
|
+
return _put(`admin/customer/${customer._id}/password/${customer.passwordResetToken}`, customer);
|
|
295
|
+
},
|
|
296
|
+
removeCustomer(id) {
|
|
297
|
+
return _delete(`admin/customer/${id}`);
|
|
298
|
+
},
|
|
287
299
|
fetchInventoryHistory(params) {
|
|
288
300
|
return _get('admin/inventory-history', params);
|
|
289
301
|
},
|
package/assets/js/api/index.js
CHANGED
|
@@ -35,6 +35,9 @@ const api = {
|
|
|
35
35
|
saveCustomerPassword(customer, shop) {
|
|
36
36
|
return _patch(`shop/${shop}/customer/${customer._id}/password/${customer.passwordResetToken}`, customer);
|
|
37
37
|
},
|
|
38
|
+
fetchCustomerOrders(customer, shop) {
|
|
39
|
+
return _get(`shop/${shop}/customer/${customer._id}/orders`);
|
|
40
|
+
},
|
|
38
41
|
searchProducts(shop, text) {
|
|
39
42
|
return _get(`shop/${shop}/products/search`, { text });
|
|
40
43
|
},
|
|
@@ -3,6 +3,7 @@ import debounce from 'lodash.debounce';
|
|
|
3
3
|
|
|
4
4
|
class Breakpoints {
|
|
5
5
|
screens = {
|
|
6
|
+
mini: 448,
|
|
6
7
|
sm: 768,
|
|
7
8
|
md: 1024,
|
|
8
9
|
lg: 1280,
|
|
@@ -28,7 +29,9 @@ class Breakpoints {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
getBreakpoint(w) {
|
|
31
|
-
if (this.
|
|
32
|
+
if (this.isMini(w)) {
|
|
33
|
+
return 'mini';
|
|
34
|
+
} else if (this.isXs(w)) {
|
|
32
35
|
return 'xs';
|
|
33
36
|
} else if (this.isSm(w)) {
|
|
34
37
|
return 'sm';
|
|
@@ -43,8 +46,13 @@ class Breakpoints {
|
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
|
|
50
|
+
isMini(val) {
|
|
51
|
+
return val < this.screens.mini;
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
isXs(val) {
|
|
47
|
-
return val < this.screens.sm;
|
|
55
|
+
return val >= this.screens.xs && val < this.screens.sm;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
isSm(val) {
|
|
@@ -317,7 +317,7 @@ export default {
|
|
|
317
317
|
this.$set(this.address, 'state', suburb.state);
|
|
318
318
|
this.$set(this.address, 'postcode', suburb.postcode);
|
|
319
319
|
this.$set(this.address, 'city', suburb.locality);
|
|
320
|
-
this.$set(this.address, 'country', suburb.country);
|
|
320
|
+
this.$set(this.address, 'country', suburb.country || 'Australia');
|
|
321
321
|
}
|
|
322
322
|
},
|
|
323
323
|
handleSuburbChange(suburb) {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
<div
|
|
3
3
|
class="ProductSideWithPrint__wrapper"
|
|
4
4
|
:class="{ preview }"
|
|
5
|
+
:style="colorBackground"
|
|
5
6
|
@click="showImage()">
|
|
6
7
|
<div
|
|
7
8
|
class="ProductSideWithPrint__thumb"
|
|
8
9
|
:style="{
|
|
9
|
-
'background-image': imageBackground
|
|
10
|
-
'background-color': colorBackground
|
|
10
|
+
'background-image': imageBackground
|
|
11
11
|
}"></div>
|
|
12
12
|
<div
|
|
13
13
|
v-if="print"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<script>
|
|
20
20
|
import { getProductCover, getColorImage } from '@lancom/shared/assets/js/utils/colors';
|
|
21
21
|
import ImageViewer from '@lancom/shared/components/common/image_viewer/image-viewer';
|
|
22
|
+
import { getColorBackgroundStyle } from '@lancom/shared/assets/js/utils/colors';
|
|
22
23
|
|
|
23
24
|
export default {
|
|
24
25
|
name: 'ProductSideWithPrint',
|
|
@@ -75,7 +76,7 @@ export default {
|
|
|
75
76
|
return [...this.priviewProducts.reduce(predicate, new Map()).values()];
|
|
76
77
|
},
|
|
77
78
|
colorBackground() {
|
|
78
|
-
return this.fillBackground && this.product.color
|
|
79
|
+
return this.fillBackground && getColorBackgroundStyle(this.product.color);
|
|
79
80
|
},
|
|
80
81
|
imageBackground() {
|
|
81
82
|
return this.image && this.getImageBackground(this.image);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@import "@/assets/scss/variables";
|
|
2
|
+
|
|
3
|
+
.CustomerMenu {
|
|
4
|
+
&__wrapper {
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
&__inner {
|
|
8
|
+
min-width: 72px;
|
|
9
|
+
width: 33%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
border-radius: 2px;
|
|
12
|
+
box-shadow: $elevation1;
|
|
13
|
+
}
|
|
14
|
+
&__value {
|
|
15
|
+
color: $grey_1;
|
|
16
|
+
text-transform: uppercase;
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
background-color: rgba(125, 106, 239, 0.07);
|
|
21
|
+
padding: 10px 10px 5px 10px;
|
|
22
|
+
border-radius: 20px;
|
|
23
|
+
&--divider {
|
|
24
|
+
display: block;
|
|
25
|
+
height: 16px;
|
|
26
|
+
width: 1px;
|
|
27
|
+
background-color: rgba(0, 0, 0, 0.14);
|
|
28
|
+
margin: 0 5px;
|
|
29
|
+
}
|
|
30
|
+
span i {
|
|
31
|
+
color: $brand_color_1;
|
|
32
|
+
font-size: 25px;
|
|
33
|
+
}
|
|
34
|
+
span img {
|
|
35
|
+
height: 25px;
|
|
36
|
+
position: relative;
|
|
37
|
+
top: 3px;
|
|
38
|
+
left: 2px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
&__divider {
|
|
42
|
+
margin-top: 10px;
|
|
43
|
+
margin-bottom: 5px;
|
|
44
|
+
border: 1px solid rgba(0, 0, 0, 0.14);
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
&__caret {
|
|
48
|
+
color: $grey_5;
|
|
49
|
+
font-size: 18px;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
&__dropdown {
|
|
53
|
+
position: absolute;
|
|
54
|
+
z-index: 101;
|
|
55
|
+
top: 40px;
|
|
56
|
+
width: 220px;
|
|
57
|
+
margin-top: 20px;
|
|
58
|
+
margin-left: -55px;
|
|
59
|
+
// transform: translateY(-50%);
|
|
60
|
+
padding: 15px;
|
|
61
|
+
box-shadow: 0px 4px 121px 0px rgba(145, 136, 188, 0.34);
|
|
62
|
+
background-color: white;
|
|
63
|
+
border-radius: 12px;
|
|
64
|
+
}
|
|
65
|
+
&__backdrop {
|
|
66
|
+
top: 0;
|
|
67
|
+
right: 0;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
position: absolute;
|
|
71
|
+
z-index: 100;
|
|
72
|
+
background: red;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
&__field {
|
|
76
|
+
font-size: 18px;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
line-height: 26px;
|
|
79
|
+
letter-spacing: -0.025em;
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
padding: 6px;
|
|
84
|
+
align-items: center;
|
|
85
|
+
&--open,
|
|
86
|
+
&--open * {
|
|
87
|
+
pointer-events: none !important;
|
|
88
|
+
}
|
|
89
|
+
> i {
|
|
90
|
+
color: $purple;
|
|
91
|
+
}
|
|
92
|
+
&-item {
|
|
93
|
+
padding: 7px 10px;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
color: $purple;
|
|
99
|
+
|
|
100
|
+
&-checked {
|
|
101
|
+
margin-right: 10px;
|
|
102
|
+
margin-top: 2px;
|
|
103
|
+
}
|
|
104
|
+
&-icon {
|
|
105
|
+
margin-right: 10px;
|
|
106
|
+
margin-top: 3px;
|
|
107
|
+
}
|
|
108
|
+
&:hover {
|
|
109
|
+
color: $purple;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="CustomerMenu__wrapper">
|
|
3
|
+
<div class="CustomerMenu__field">
|
|
4
|
+
<div class="lc_regular16 CustomerMenu__value">
|
|
5
|
+
<btn
|
|
6
|
+
class="ml-10"
|
|
7
|
+
btn-class="black"
|
|
8
|
+
btn-label=" "
|
|
9
|
+
@onclick="isOpen = !isOpen">
|
|
10
|
+
<template #icon-before>
|
|
11
|
+
<i class="icon-user"></i>
|
|
12
|
+
</template>
|
|
13
|
+
<template #icon-after>
|
|
14
|
+
<i class="icon-angle-down"></i>
|
|
15
|
+
</template>
|
|
16
|
+
</btn>
|
|
17
|
+
<span>
|
|
18
|
+
<i class="icon-globe"></i>
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div
|
|
23
|
+
v-if="isOpen"
|
|
24
|
+
class="CustomerMenu__dropdown">
|
|
25
|
+
<div>
|
|
26
|
+
<a href="/customer/settings" class="CustomerMenu__field-item">Settings</a>
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<a href="/customer/orders" class="CustomerMenu__field-item">Orders</a>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
export default {
|
|
37
|
+
name: 'CustomerMenu',
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
isOpen: false,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
@import 'customer-menu';
|
|
48
|
+
</style>
|
|
49
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="CustomerOrders__wrapper">
|
|
3
|
+
<table class="lc_table bordered CustomerOrders__table">
|
|
4
|
+
<thead class="centered">
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Created At</th>
|
|
7
|
+
<th>Code</th>
|
|
8
|
+
<th>Status</th>
|
|
9
|
+
</tr>
|
|
10
|
+
</thead>
|
|
11
|
+
<tbody>
|
|
12
|
+
<tr
|
|
13
|
+
v-for="order of orders"
|
|
14
|
+
:key="order._id">
|
|
15
|
+
<td>{{ order.createdAt | date }}</td>
|
|
16
|
+
<td>
|
|
17
|
+
<a
|
|
18
|
+
:href="`/order/${order.token}`"
|
|
19
|
+
target="_blank">
|
|
20
|
+
{{ order.code }}
|
|
21
|
+
</a>
|
|
22
|
+
</td>
|
|
23
|
+
<td>{{ order.status }}</td>
|
|
24
|
+
</tr>
|
|
25
|
+
</tbody>
|
|
26
|
+
</table>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { mapGetters } from 'vuex';
|
|
32
|
+
import api from '@lancom/shared/assets/js/api';
|
|
33
|
+
import { date } from '@lancom/shared/assets/js/utils/filters';
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: 'CustomerOrders',
|
|
38
|
+
filters: {
|
|
39
|
+
date
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
customer: {
|
|
43
|
+
type: Object,
|
|
44
|
+
required: true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
orders: []
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
...mapGetters(['contacts', 'shop']),
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
this.locadCustomerOrders();
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
async locadCustomerOrders() {
|
|
60
|
+
this.orders = await api.fetchCustomerOrders(this.customer, this.shop._id);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<style lang="scss">
|
|
67
|
+
@import 'customer-orders';
|
|
68
|
+
</style>
|
|
69
|
+
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
margin-top: 10px;
|
|
74
74
|
}
|
|
75
75
|
&__product-image {
|
|
76
|
-
width: 100%;
|
|
77
76
|
text-align: center;
|
|
78
|
-
margin: 15px
|
|
77
|
+
margin: 15px auto;
|
|
79
78
|
height: 300px;
|
|
79
|
+
width: 300px;
|
|
80
80
|
position: relative;
|
|
81
81
|
display: none;
|
|
82
82
|
@media (max-width: $bp-extra-small-max) {
|
|
@@ -20,9 +20,13 @@
|
|
|
20
20
|
&-container {
|
|
21
21
|
position: relative;
|
|
22
22
|
margin: 0 auto;
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
23
|
+
width: 290px;
|
|
24
|
+
height: 290px;
|
|
25
25
|
max-width: 100%;
|
|
26
|
+
@media (min-width: $bp-extra-small-min) {
|
|
27
|
+
width: 330px;
|
|
28
|
+
height: 330px;
|
|
29
|
+
}
|
|
26
30
|
@media (min-width: $bp-small-min) {
|
|
27
31
|
width: 580px;
|
|
28
32
|
height: 580px;
|
|
@@ -95,20 +99,27 @@
|
|
|
95
99
|
margin: 0 auto;
|
|
96
100
|
max-width: 100%;
|
|
97
101
|
position: sticky;
|
|
98
|
-
bottom:
|
|
102
|
+
bottom: 0px;
|
|
99
103
|
background: white;
|
|
100
|
-
width:
|
|
104
|
+
width: 290px;
|
|
105
|
+
@media (min-width: $bp-extra-small-min) {
|
|
106
|
+
width: 370px;
|
|
107
|
+
}
|
|
101
108
|
@media (min-width: $bp-small-min) {
|
|
102
109
|
width: 580px;
|
|
110
|
+
bottom: 20px;
|
|
103
111
|
}
|
|
104
112
|
@media (min-width: $bp-medium-min) {
|
|
105
113
|
width: 430px;
|
|
114
|
+
bottom: 20px;
|
|
106
115
|
}
|
|
107
116
|
@media (min-width: $bp-large-min) {
|
|
108
117
|
width: 600px;
|
|
118
|
+
bottom: 20px;
|
|
109
119
|
}
|
|
110
120
|
@media (min-width: $bp-extra-large-min) {
|
|
111
121
|
width: 720px;
|
|
122
|
+
bottom: 20px;
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
&--bottom {
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="CustomerCreate__wrapper">
|
|
3
|
+
<div class="lc_h2">Customer Orders</div>
|
|
4
|
+
<customer-orders class="mt-10" :customer="user" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { mapGetters } from 'vuex';
|
|
10
|
+
import CustomerOrders from '@lancom/shared/components/customer/customer_orders/customer-orders';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'CustomerOrdersPage',
|
|
14
|
+
components: {
|
|
15
|
+
CustomerOrders
|
|
16
|
+
},
|
|
17
|
+
computed: {
|
|
18
|
+
...mapGetters('auth', ['user'])
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style lang="scss" scoped>
|
|
24
|
+
.CustomerCreate {
|
|
25
|
+
&__wrapper {
|
|
26
|
+
padding-top: 30px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|
package/routes/index.js
CHANGED
|
@@ -109,6 +109,11 @@ module.exports = function(routes, resolve) {
|
|
|
109
109
|
path: '/customer/settings',
|
|
110
110
|
component: resolve('@lancom/shared/pages/customer/settings.vue'),
|
|
111
111
|
chunkName: 'pages/customer/settings'
|
|
112
|
+
}, {
|
|
113
|
+
name: 'customer-orders',
|
|
114
|
+
path: '/customer/orders',
|
|
115
|
+
component: resolve('@lancom/shared/pages/customer/orders.vue'),
|
|
116
|
+
chunkName: 'pages/customer/orders'
|
|
112
117
|
}, {
|
|
113
118
|
name: 'customer-recovery',
|
|
114
119
|
path: '/customer/recovery',
|