@lancom/shared 0.0.81 → 0.0.85

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.
@@ -34,6 +34,18 @@ export default {
34
34
  saveOrder(order) {
35
35
  return order._id ? _put(`admin/order/${order._id}`, order) : _post('admin/order', order);
36
36
  },
37
+ exportOrderToStarshipit(order) {
38
+ return _post(`shop/${order.shop}/order/${order._id}/export-to-starshipit`, order);
39
+ },
40
+ createOrderRefund(order, refund, shop) {
41
+ return _post(`shop/${shop}/order/${order}/refund`, refund);
42
+ },
43
+ sendOrderRefundRequest(order, refund, shop) {
44
+ return _post(`shop/${shop}/order/${order}/refund/${refund}/send`);
45
+ },
46
+ chargeOrderRefund(order, refund, shop) {
47
+ return _post(`shop/${shop}/order/${order}/refund/${refund}/charge`);
48
+ },
37
49
  fetchPages() {
38
50
  return _get('admin/pages');
39
51
  },
@@ -45,8 +45,8 @@ const api = {
45
45
  fetchPricingProducts(shop) {
46
46
  return _get(`shop/${shop}/products/pricing-products`);
47
47
  },
48
- fetchProduct(shop, alias) {
49
- return _get(`shop/${shop}/products/${alias}`);
48
+ fetchProduct(shop, alias, print) {
49
+ return _get(`shop/${shop}/products/${alias}?print=${print || ''}`);
50
50
  },
51
51
  fetchMenus(shop) {
52
52
  return _get(`shop/${shop}/menus`);
@@ -14,6 +14,7 @@ export class Layer {
14
14
  left = null;
15
15
  centeredScaling = true;
16
16
  lockUniScaling = true;
17
+ required = false;
17
18
 
18
19
  // selection style
19
20
  rotatingPointOffset = 30;
@@ -12,7 +12,7 @@ const decodeDecimal = entity => {
12
12
  };
13
13
 
14
14
  export const number = (value, digits = 0) => {
15
- const fixed = (value || 0).toFixed(digits);
15
+ const fixed = (+value || 0).toFixed(digits);
16
16
  return fixed.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
17
17
  };
18
18
 
@@ -0,0 +1,53 @@
1
+ .OrderRefundView {
2
+ &__wrapper {
3
+ margin-top: 50px;
4
+ }
5
+ &__logo {
6
+ margin-bottom: 10px;
7
+ }
8
+ &__info {
9
+ display: flex;
10
+ justify-content: space-between;
11
+ margin-bottom: 10px;
12
+ }
13
+ &__table {
14
+ margin-top: 20px;
15
+ td {
16
+ width: 50%;
17
+ padding: 20px;
18
+ }
19
+ }
20
+ &__products {
21
+ border: 1px solid #dee2e6;
22
+ padding: 30px;
23
+ margin-top: 20px;
24
+ }
25
+ &__product {
26
+ padding-bottom: 20px;
27
+ margin-bottom: 20px;
28
+ border-bottom: 1px solid #dee2e6;
29
+ }
30
+ &__totals {
31
+ margin: 30px 0;
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: flex-end;
35
+ page-break-inside: avoid;
36
+ }
37
+ &__totals {
38
+ margin: 30px 0;
39
+ padding: 20px 0;
40
+ display: flex;
41
+ flex-direction: column;
42
+ align-items: flex-end;
43
+ &--paid {
44
+ background-image: url(../../../static/images/paid.svg);
45
+ background-repeat: no-repeat;
46
+ background-position: 0px 0px;
47
+ background-size: contain;
48
+ }
49
+ }
50
+ }
51
+ .uppercase {
52
+ text-transform: uppercase;
53
+ }
@@ -0,0 +1,142 @@
1
+ <template>
2
+ <div class="OrderRefundView__wrapper">
3
+ <div
4
+ v-if="order.shop.logo"
5
+ class="OrderRefundView__logo">
6
+ <img :src="order.shop.logo.small" />
7
+ </div>
8
+ <div class="OrderRefundView__info">
9
+ <div>
10
+ <h2 class="lc_h1">
11
+ {{ order.shop.name }}
12
+ </h2>
13
+ <h4
14
+ v-if="shopContacts"
15
+ class="lc_h4">
16
+ ABN: {{ shopContacts.abn }}
17
+ </h4>
18
+ </div>
19
+ <h1 class="text-secondary lc_h1">
20
+ {{ refund.status === 'pending' ? 'CREDIT NOTE' : 'REFUNDED IN FULL' }}
21
+ </h1>
22
+ </div>
23
+ <div class="OrderRefundView__info">
24
+ <div v-if="shopContacts">
25
+ <div class="lc_regular16">
26
+ {{ shopContacts.company }}
27
+ </div>
28
+ <div class="lc_regular16">
29
+ {{ shopContacts.address }}
30
+ </div>
31
+ <div class="lc_regular16">
32
+ {{ shopContacts.phone }}
33
+ </div>
34
+ </div>
35
+ <div>
36
+ <div class="lc_regular16">
37
+ DATE: {{ refund.createdAt | shortDate }}
38
+ </div>
39
+ <div class="lc_regular16">
40
+ Order ID: {{ orderId }}
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <table class="OrderRefundView__table mt-4 lc_table bordered">
45
+ <tr>
46
+ <td>
47
+ <div class="lc_regular16">
48
+ <b>Order</b>
49
+ </div>
50
+ <div class="lc_regular16">
51
+ {{ order.billingAddress.fullName }}
52
+ </div>
53
+ <div
54
+ v-if="order.billingAddress.company"
55
+ class="lc_regular16">
56
+ {{ order.billingAddress.company }}
57
+ </div>
58
+ <div
59
+ v-if="order.billingAddress.phone"
60
+ class="lc_regular16">
61
+ {{ order.billingAddress.phone }}
62
+ </div>
63
+ <div class="lc_regular16">
64
+ {{ order.billingAddress.email }}
65
+ </div>
66
+ <div class="lc_regular16">
67
+ {{ orderAddress }}
68
+ </div>
69
+ <div class="lc_regular16">
70
+ {{ order.additionalInfo }}
71
+ </div>
72
+ </td>
73
+ </tr>
74
+ </table>
75
+ <div class="mt-3">
76
+ <div class="OrderRefundView__products-wrapper">
77
+ <div class="OrderRefundView__products">
78
+ <order-view-product
79
+ v-for="product of products"
80
+ :key="product._id"
81
+ :product="product"
82
+ :responsive="responsive"
83
+ class="OrderRefundView__product" />
84
+ </div>
85
+ <div
86
+ class="OrderRefundView__totals"
87
+ :class="{
88
+ 'OrderRefundView__totals--paid': isPaid
89
+ }">
90
+ <div class="lc_regular16">
91
+ Total ex GST: <b>{{ refund.total | price }}</b>
92
+ </div>
93
+ <div class="lc_regular16">
94
+ GST: <b>{{ refund.totalGST - refund.total | price }}</b>
95
+ </div>
96
+ <div class="lc_regular16">
97
+ Total inc GST: <b>{{ refund.totalGST | price }}</b>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import OrderViewMixin from './../order_view/order-view.mixin';
107
+ import OrderViewProduct from './../order_view/order_view_product/order-view-product';
108
+
109
+ export default {
110
+ name: 'LancomOrderRefundView',
111
+ components: {
112
+ OrderViewProduct
113
+ },
114
+ mixins: [OrderViewMixin],
115
+ props: {
116
+ responsive: {
117
+ type: Boolean,
118
+ default: true
119
+ },
120
+ refund: {
121
+ type: Object,
122
+ required: true
123
+ }
124
+ },
125
+ computed: {
126
+ isPaid() {
127
+ return this.refund.status === 'refunded';
128
+ },
129
+ products() {
130
+ return [
131
+ ...this.refund.products,
132
+ this.refund.refundShipping > 0 ? { isCustom: true, SKU: 'RefundS hipping', simpleProducts: [{ amount: 1, productCost: this.refund.refundShipping }] } : null,
133
+ this.refund.additionalRefund > 0 ? { isCustom: true, SKU: this.refund.additionalRefundInfo || 'Additional Refund', simpleProducts: [{ amount: 1, productCost: this.refund.additionalRefund }] } : null
134
+ ].filter(i => !!i);
135
+ }
136
+ }
137
+ };
138
+ </script>
139
+
140
+ <style lang="scss" scoped>
141
+ @import 'order-refund-view.scss';
142
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.81",
3
+ "version": "0.0.85",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/product.js CHANGED
@@ -10,6 +10,7 @@ import { sortByName } from '../assets/js/utils/filters';
10
10
 
11
11
  export const state = () => ({
12
12
  product: null,
13
+ preSetPrint: null,
13
14
  loadError: null,
14
15
  productDetails: null,
15
16
  editorSize: {
@@ -40,6 +41,7 @@ export const state = () => ({
40
41
 
41
42
  export const getters = {
42
43
  product: ({ product }) => product,
44
+ preSetPrint: ({ preSetPrint }) => preSetPrint,
43
45
  loadError: ({ loadError }) => loadError,
44
46
  productDetails: ({ productDetails }) => productDetails,
45
47
  productDetailsLoaded: ({ productDetails }) => !!productDetails,
@@ -115,12 +117,14 @@ export const getters = {
115
117
  };
116
118
 
117
119
  export const actions = {
118
- async fetchProduct({ commit }, { shop, slug }) {
120
+ async fetchProduct({ commit }, { shop, slug, print }) {
119
121
  try {
120
122
  commit('setLoadError', null);
121
- const response = await api.fetchProduct(shop, slug);
123
+ const response = await api.fetchProduct(shop, slug, print);
122
124
  commit('setProduct', response);
125
+ commit('setPreSetPrint', (response.prints || []).find(({ _id }) => _id === print));
123
126
  } catch (e) {
127
+ console.log(e);
124
128
  const { status, data } = e?.response || {};
125
129
  const statusCode = status || 500;
126
130
  commit('setLoadError', {
@@ -210,6 +214,8 @@ export const mutations = {
210
214
  state.loadError = error;
211
215
  },
212
216
  setProductDetails(state, simpleProducts) {
217
+ const { preSetPrint } = state;
218
+ simpleProducts = simpleProducts.filter(sp => !preSetPrint || (preSetPrint.colors || []).includes(sp.color._id) )
213
219
  state.productDetails = { simpleProducts };
214
220
  const availableSizes = [];
215
221
  const sizesPerColor = simpleProducts.reduce((map, { color, size }) => {
@@ -287,6 +293,7 @@ export const mutations = {
287
293
  ...(state.template.layers || []).filter(l => l.guid !== layer.guid),
288
294
  layer
289
295
  ];
296
+ console.log('addTemplateLayer: ', layer);
290
297
  Vue.set(state.template, 'layers', layers);
291
298
  },
292
299
  removeTemplateLayer(state, layer) {
@@ -363,6 +370,9 @@ export const mutations = {
363
370
  },
364
371
  setVisibleSteps(state, visibleSteps) {
365
372
  state.template.visibleSteps = visibleSteps;
373
+ },
374
+ setPreSetPrint(state, preSetPrint) {
375
+ state.preSetPrint = preSetPrint;
366
376
  }
367
377
  };
368
378