@lancom/shared 0.0.113 → 0.0.116

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.
@@ -28,15 +28,30 @@ export default {
28
28
  removeShop(id) {
29
29
  return _delete(`admin/shops/${id}`);
30
30
  },
31
- fetchOrderById(id) {
32
- return _get(`admin/order/${id}`);
31
+ fetchOrderById(id, params) {
32
+ return _get(`admin/order/${id}`, params);
33
33
  },
34
34
  saveOrder(order) {
35
35
  return order._id ? _put(`admin/order/${order._id}`, order) : _post('admin/order', order);
36
36
  },
37
+ createOrderSubsequentInvoice(order, invoice) {
38
+ return _post(`admin/shop/${order.shop}/order/${order._id}/invoice`, invoice);
39
+ },
40
+ sendOrderSubsequentInvoice(order, invoice) {
41
+ return _post(`admin/shop/${order.shop}/order/${order._id}/invoice/${invoice}/send`);
42
+ },
37
43
  exportOrderToStarshipit(order, shipment) {
38
44
  return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/export-to-starshipit`, shipment);
39
45
  },
46
+ markShipmentAsDispatched(order, shipment) {
47
+ return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/dispatched`, shipment);
48
+ },
49
+ markSubOrderAsDispatched(order, subOrder) {
50
+ return _post(`admin/shop/${order.shop}/order/${order._id}/sub-order/${subOrder._id}/dispatched`, subOrder);
51
+ },
52
+ removeShipmentFromStarshipit(order, shipment) {
53
+ return _delete(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}`);
54
+ },
40
55
  calculateShipmentRates(order, shipment) {
41
56
  return _get(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/calculate-shipping`);
42
57
  },
@@ -121,6 +136,9 @@ export default {
121
136
  fetchInventoryHistory(params) {
122
137
  return _get('admin/inventory-history', params);
123
138
  },
139
+ fetchInventoryCommitted(params) {
140
+ return _get('admin/inventory/committed', params);
141
+ },
124
142
  fetchInventory(params) {
125
143
  return _get('admin/inventory');
126
144
  },
@@ -81,11 +81,12 @@ const api = {
81
81
  deleteOrder(token) {
82
82
  return _delete(`order/${token}`);
83
83
  },
84
- fetchOrderByToken(token) {
85
- return _get(`order/token/${token}`);
84
+ fetchOrderByToken(token, params) {
85
+ return _get(`order/token/${token}`, params);
86
86
  },
87
- createOrderPayment(id, card, shop) {
88
- return _post(`shop/${shop}/order/${id}/payment`, card);
87
+ createOrderPayment(id, card, shop, invoiceId) {
88
+ const url = invoiceId ? `shop/${shop}/order/${id}/invoice/${invoiceId}/payment` : `shop/${shop}/order/${id}/payment`;
89
+ return _post(url, card);
89
90
  },
90
91
  addOrderTimeline(id, item) {
91
92
  return _post(`order/${id}/timeline`, item);
@@ -2,14 +2,14 @@
2
2
  <div class="PaymentSuccess__wrapper">
3
3
  <div class="PaymentSuccess__icon"></div>
4
4
  <div class="lc_semibold22">
5
- {{ !order.paid ? 'Order Received' : 'Order paid successfully' }}!
5
+ {{ label }} {{ !model.paid ? ' Received' : ' paid successfully' }}!
6
6
  </div>
7
7
  <div class="lc_regular18 lc_grey1 mt-5">
8
- Order {{ order.code }}
8
+ {{ label }} {{ model.code }}
9
9
  </div>
10
10
  <div class="lc_regular16 lc_grey1 mt-5">
11
11
  {{
12
- !order.paid
12
+ !model.paid
13
13
  ? 'Our team will advise cost and the next steps. Please except a call or email from us after we review.'
14
14
  : 'The charge line will appear on your card as "Wholesale Apparel & Workwear"'
15
15
  }}
@@ -31,10 +31,21 @@ export default {
31
31
  type: Object,
32
32
  required: true
33
33
  },
34
+ invoice: {
35
+ type: Object
36
+ },
34
37
  btnLabel: {
35
38
  type: String,
36
39
  default: 'Back to editor'
37
40
  }
41
+ },
42
+ computed: {
43
+ model() {
44
+ return this.invoice || this.order
45
+ },
46
+ label() {
47
+ return this.invoice ? 'Invoice' : 'Order';
48
+ }
38
49
  }
39
50
  };
40
51
  </script>
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <div class="OrderPayment__wrapper">
3
3
  <h4 class="lc_h1 mt-10 mb-10">
4
- Payment Order #{{order.code}}
4
+ Payment {{ invoice ? 'Invoice' : 'Order'}} #{{model.code}}
5
5
  </h4>
6
6
  <payment-success
7
- v-if="order.paid"
8
- :order="order">
7
+ v-if="model.paid"
8
+ :order="order"
9
+ :invoice="invoice">
9
10
  <template slot="back-btn">
10
11
  <div class="d-flex">
11
12
  <btn
@@ -25,7 +26,7 @@
25
26
  <div>
26
27
  <payment-cart
27
28
  ref="paymentCart"
28
- :amount="order.totalGST"
29
+ :amount="model.totalGST"
29
30
  :has-spinner="false"
30
31
  :payment-data="order.shippingAddress">
31
32
  </payment-cart>
@@ -63,7 +64,11 @@ export default {
63
64
  order: {
64
65
  type: Object,
65
66
  required: true
66
- }
67
+ },
68
+ invoice: {
69
+ type: Object,
70
+ required: true
71
+ },
67
72
  },
68
73
  data() {
69
74
  return {
@@ -72,7 +77,10 @@ export default {
72
77
  };
73
78
  },
74
79
  computed: {
75
- ...mapGetters(['shop'])
80
+ ...mapGetters(['shop']),
81
+ model() {
82
+ return this.invoice || this.order;
83
+ }
76
84
  },
77
85
  methods: {
78
86
  handleErrors(err) {
@@ -86,8 +94,9 @@ export default {
86
94
  this.processing = true;
87
95
  const card = await this.$refs.paymentCart.tokenize();
88
96
  if (card) {
89
- const { paid } = await api.createOrderPayment(this.order._id, card, this.shop._id);
90
- this.order.paid = paid;
97
+ const { _id: invoiceId } = this.invoice || {};
98
+ const { paid } = await api.createOrderPayment(this.order._id, card, this.shop._id, invoiceId);
99
+ this.model.paid = paid;
91
100
  }
92
101
  } catch (e) {
93
102
  if (e.response) {
@@ -16,11 +16,17 @@ export default {
16
16
  order: {
17
17
  type: Object,
18
18
  required: true
19
- }
19
+ },
20
+ invoice: {
21
+ type: Object
22
+ },
20
23
  },
21
24
  computed: {
25
+ model() {
26
+ return this.invoice || this.order;
27
+ },
22
28
  isPaid() {
23
- return this.order.paymentStatus === 'paid';
29
+ return this.model.paymentStatus === 'paid';
24
30
  },
25
31
  orderId() {
26
32
  return `${this.order.code}`.replace('ORDER', '');
@@ -45,7 +51,7 @@ export default {
45
51
  return this.order.shop.settings?.pricing?.gstTax || 0;
46
52
  },
47
53
  gstTotal() {
48
- return tax(this.order.total, this.gstTax) - this.order.total;
54
+ return tax(this.model.total, this.gstTax) - this.model.total;
49
55
  }
50
56
  }
51
57
  };
@@ -17,7 +17,7 @@
17
17
  </h4>
18
18
  </div>
19
19
  <h1 class="text-secondary lc_h1">
20
- {{ order.paymentMethod === 'deposit' ? 'Proforma Invoice' : 'Tax invoice' }}
20
+ {{ model.paymentMethod === 'deposit' ? 'Proforma Invoice' : 'Tax invoice' }}
21
21
  </h1>
22
22
  </div>
23
23
  <div class="OrderView__info">
@@ -34,13 +34,13 @@
34
34
  </div>
35
35
  <div>
36
36
  <div class="lc_regular16">
37
- DATE: {{ order.createdAt | shortDate }}
37
+ DATE: {{ model.createdAt | shortDate }}
38
38
  </div>
39
39
  <div class="lc_regular16">
40
40
  Order ID: {{ orderId }}
41
41
  </div>
42
42
  <div class="lc_regular16">
43
- Invoice ID: INV{{ orderId.replace('ORD', '') }}-01
43
+ Invoice ID: {{ invoice ? invoice.code : `INV${orderId.replace('ORD', '')}-01` }}
44
44
  </div>
45
45
  </div>
46
46
  </div>
@@ -74,17 +74,17 @@
74
74
  </div>
75
75
  </td>
76
76
  <td
77
- v-if="order.paid"
77
+ v-if="model.paid"
78
78
  class="w-50">
79
79
  <div class="lc_regular16">
80
80
  <b>PAID VIA CREDIT CARD</b>
81
81
  </div>
82
- <div v-if="order.charge && order.charge.card">
82
+ <div v-if="model.charge && model.charge.card">
83
83
  <div class="lc_regular16">
84
- Card: {{ order.charge.card.display_number }}
84
+ Card: {{ model.charge.card.display_number }}
85
85
  </div>
86
86
  <div class="lc_regular16">
87
- Scheme: {{ order.charge.card.scheme }}
87
+ Scheme: {{ model.charge.card.scheme }}
88
88
  </div>
89
89
  </div>
90
90
  </td>
@@ -111,9 +111,11 @@
111
111
  </table>
112
112
  <div class="mt-3">
113
113
  <div class="OrderView__products-wrapper">
114
- <div class="OrderView__products">
114
+ <div
115
+ v-if="model.products.length > 0"
116
+ class="OrderView__products">
115
117
  <order-view-product
116
- v-for="product of order.products"
118
+ v-for="product of model.products"
117
119
  :key="product._id"
118
120
  :product="product"
119
121
  :responsive="responsive"
@@ -125,22 +127,22 @@
125
127
  'OrderView__totals--paid': isPaid
126
128
  }">
127
129
  <div class="lc_regular16">
128
- Products Total: <b>{{ order.productsTotal | price }}</b>
130
+ Products Total: <b>{{ model.productsTotal | price }}</b>
129
131
  </div>
130
132
  <div class="lc_regular16">
131
- Prints Total: <b>{{ order.printsTotal | price }}</b>
133
+ Prints Total: <b>{{ model.printsTotal | price }}</b>
132
134
  </div>
133
135
  <div class="lc_regular16">
134
- Shipping Total: <b>{{ order.shippingTotal | price }}</b>
136
+ Shipping Total: <b>{{ model.shippingTotal | price }}</b>
135
137
  </div>
136
138
  <div class="lc_regular16">
137
- Total ex GST: <b>{{ order.total | price }}</b>
139
+ Total ex GST: <b>{{ model.total | price }}</b>
138
140
  </div>
139
141
  <div class="lc_regular16">
140
- GST: <b>{{ order.totalGST - order.total | price }}</b>
142
+ GST: <b>{{ model.totalGST - model.total | price }}</b>
141
143
  </div>
142
144
  <div class="lc_regular16">
143
- Total inc GST: <b>{{ order.totalGST | price }}</b>
145
+ Total inc GST: <b>{{ model.totalGST | price }}</b>
144
146
  </div>
145
147
  </div>
146
148
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.113",
3
+ "version": "0.0.116",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {