@lancom/shared 0.0.131 → 0.0.134

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.
@@ -16,6 +16,18 @@ export default {
16
16
  removeNews(id) {
17
17
  return _delete(`admin/news/${id}`);
18
18
  },
19
+ fetchNewsTags() {
20
+ return _get('admin/news-tag');
21
+ },
22
+ fetchNewsTagById(id) {
23
+ return _get(`admin/news-tag/${id}`);
24
+ },
25
+ saveNewsTag(newsTag) {
26
+ return newsTag._id ? _put(`admin/news-tag/${newsTag._id}`, newsTag) : _post('admin/news-tag', newsTag);
27
+ },
28
+ removeNewsTag(id) {
29
+ return _delete(`admin/news-tag/${id}`);
30
+ },
19
31
  fetchShops() {
20
32
  return _get('admin/shops');
21
33
  },
@@ -46,6 +58,9 @@ export default {
46
58
  savePurchaseOrder(purchaseOrder) {
47
59
  return purchaseOrder._id ? _put(`admin/purchase-order/${purchaseOrder._id}`, purchaseOrder) : _post('admin/purchase-order', purchaseOrder);
48
60
  },
61
+ savePurchaseOrderShipment(purchaseOrder, shipment) {
62
+ return _put(`admin/purchase-order/${purchaseOrder._id}/shipments/${shipment._id}`, shipment);
63
+ },
49
64
  fetchPurchaseOrderWoTasks(purchaseOrderId) {
50
65
  return _get(`admin/purchase-order/${purchaseOrderId}/wo-tasks`);
51
66
  },
@@ -63,6 +63,12 @@ const api = {
63
63
  fetchSingleNews(shop, alias, preview = false) {
64
64
  return _get(`shop/${shop}/news/${alias}?preview=${preview}`);
65
65
  },
66
+ fetchNewsTags(shop, params) {
67
+ return _get(`shop/${shop}/news-tag`, params);
68
+ },
69
+ fetchNewsTag(shop, alias) {
70
+ return _get(`shop/${shop}/news-tag/${alias}`);
71
+ },
66
72
  fetchProductDetails(shop, alias) {
67
73
  return _get(`shop/${shop}/products/${alias}/simple-products`);
68
74
  },
@@ -1,4 +1,5 @@
1
1
  export function convertQuoteToOrder(quote, option) {
2
+ const files = [quote.file, ...(quote.files || [])].filter(f => !!f);
2
3
  return {
3
4
  paymentMethod: option.paymentMethod || 'deposit',
4
5
  billingAddress: quote.address,
@@ -15,14 +16,14 @@ export function convertQuoteToOrder(quote, option) {
15
16
  shippingTotal: option.shippingTotal,
16
17
  adminShippingTotal: option.adminShippingTotal,
17
18
  quote: quote._id,
18
- resources: quote.file ? [{
19
+ resources: files.map(f => ({
19
20
  status: 'pending approval',
20
21
  prints: [],
21
22
  revision: null,
22
23
  note: null,
23
24
  type: 'Artwork Files',
24
- file: quote.file
25
- }] : []
25
+ file: f.file
26
+ }))
26
27
  };
27
28
  }
28
29
 
@@ -26,16 +26,19 @@ export default {
26
26
  hasPrints() {
27
27
  return this.sumPrints > 0;
28
28
  },
29
+ cartEntityPricing() {
30
+ return this.cartProductsPricing[this.entity.guid] || {};
31
+ },
29
32
  totalPrice() {
30
- const { totalPriceWithoutTax = 0 } = this.cartProductsPricing[this.entity.guid] || {};
33
+ const { totalPriceWithoutTax = 0 } = this.cartEntityPricing;
31
34
  return totalPriceWithoutTax;
32
35
  },
33
36
  printsTotalPrice() {
34
- const { prints = {} } = this.cartProductsPricing[this.product.guid] || {};
37
+ const { prints = {} } = this.cartEntityPricing;
35
38
  return prints.totalPriceWithoutTax || 0;
36
39
  },
37
40
  productsTotalPrice() {
38
- const { product = {} } = this.cartProductsPricing[this.entity.guid] || {};
41
+ const { product = {} } = this.cartEntityPricing;
39
42
  return product.totalPriceWithoutTax || 0;
40
43
  },
41
44
  simpleProductsWithAmount() {
@@ -46,6 +49,19 @@ export default {
46
49
  },
47
50
  groupedSimpleProducts() {
48
51
  return groupSimpleProducts(this.entity, true, true);
52
+ },
53
+ isSameUnitPrices() {
54
+ const { products } = this.cartEntityPricing;
55
+ const uniquePrices = (products?.products || []).reduce((prices, product) => {
56
+ prices.add(product.priceWithoutTax);
57
+ return prices;
58
+ }, new Set());
59
+ return uniquePrices.size === 1;
60
+ },
61
+ unitPrice() {
62
+ const { products } = this.cartEntityPricing;
63
+ const product = (products?.products || [])[0];
64
+ return product ? product.priceWithoutTax : null;
49
65
  }
50
66
  },
51
67
  methods: {
@@ -33,9 +33,15 @@
33
33
  :entity="entity"
34
34
  :group="group"
35
35
  :default-preview="false"
36
+ :display-unit-price="!isSameUnitPrices"
36
37
  class="CartEntity__item"
37
38
  @remove="removeSimpleProducts" />
38
39
  </div>
40
+ <div
41
+ v-if="isSameUnitPrices"
42
+ class="lc_title-small mt-8">
43
+ Price Per Unit: {{ unitPrice | price }}
44
+ </div>
39
45
  <div
40
46
  v-if="hasPrints"
41
47
  class="CartEntity__decorations">
@@ -17,6 +17,10 @@ export default {
17
17
  type: Boolean,
18
18
  default: true
19
19
  },
20
+ displayUnitPrice: {
21
+ type: Boolean,
22
+ default: false
23
+ },
20
24
  defaultPreview: {
21
25
  type: Boolean,
22
26
  default: true
@@ -34,11 +34,19 @@
34
34
  <div class="lc_title-small mt-8">
35
35
  Qty:
36
36
  </div>
37
+ <div
38
+ v-if="displayUnitPrice && cartProductsPricing"
39
+ class="lc_title-small mt-8">
40
+ &nbsp;
41
+ </div>
42
+
37
43
  </div>
38
44
  <cart-entity-color-simple-product
39
45
  v-for="simpleProduct in group.simpleProducts"
40
46
  :key="simpleProduct._id"
41
- :simple-product="simpleProduct" />
47
+ :simple-product="simpleProduct"
48
+ :entity="entity"
49
+ :display-unit-price="displayUnitPrice" />
42
50
  </div>
43
51
  <div class="CartEntityColorSimpleProducts__totals">
44
52
  <div class="CartEntityColorSimpleProducts__total">
@@ -48,6 +48,14 @@
48
48
  color: #B0B0BA;
49
49
  }
50
50
  }
51
+ &__price {
52
+ width: 32px;
53
+ height: 28px;
54
+ font-size: 9px;
55
+ text-align: center;
56
+ color: #A2A2A2;
57
+ padding-top: 5px;
58
+ }
51
59
  &__controls {
52
60
  display: flex;
53
61
  flex-direction: column;
@@ -38,6 +38,13 @@
38
38
  class="centered CartColorSimpleProduct__field">
39
39
  {{ model }}
40
40
  </div>
41
+ <div
42
+ v-if="displayUnitPrice"
43
+ class="centered CartColorSimpleProduct__price">
44
+ <span v-if="model > 0">
45
+ {{ unitPrice | price }}
46
+ </span>
47
+ </div>
41
48
  </div>
42
49
  </template>
43
50
 
@@ -45,12 +52,19 @@
45
52
  import debounce from 'lodash.debounce';
46
53
  import { mapGetters, mapActions } from 'vuex';
47
54
  import confirm from '@lancom/shared/mixins/confirm';
48
- import { inRange } from '@lancom/shared/assets/js/utils/filters';
55
+ import { inRange, price } from '@lancom/shared/assets/js/utils/filters';
49
56
 
50
57
  export default {
51
58
  name: 'CartColorSimpleProduct',
52
59
  mixins: [confirm],
60
+ filters: {
61
+ price
62
+ },
53
63
  props: {
64
+ entity: {
65
+ type: Object,
66
+ required: true
67
+ },
54
68
  simpleProduct: {
55
69
  type: Object,
56
70
  required: true
@@ -62,6 +76,10 @@ export default {
62
76
  editable: {
63
77
  type: Boolean,
64
78
  default: true
79
+ },
80
+ displayUnitPrice: {
81
+ type: Boolean,
82
+ default: false
65
83
  }
66
84
  },
67
85
  data() {
@@ -72,7 +90,7 @@ export default {
72
90
  },
73
91
  computed: {
74
92
  ...mapGetters(['shop']),
75
- ...mapGetters('cart', ['simpleProducts']),
93
+ ...mapGetters('cart', ['simpleProducts', 'cartProductsPricing']),
76
94
  model: {
77
95
  get() {
78
96
  return (this.simpleProducts.find(sp => sp.guid === this.simpleProduct.guid) || {}).amount || this.defaultValue;
@@ -88,6 +106,11 @@ export default {
88
106
  shop: this.shop
89
107
  });
90
108
  }
109
+ },
110
+ unitPrice() {
111
+ const { products } = this.cartProductsPricing[this.entity.guid] || {};
112
+ const product = (products || {})[this.simpleProduct.guid];
113
+ return product ? product.priceWithoutTax : null;
91
114
  }
92
115
  },
93
116
  methods: {
@@ -4,6 +4,7 @@
4
4
  &__wrapper {
5
5
  display: flex;
6
6
  flex-wrap: wrap;
7
+ margin-bottom: 20px;
7
8
  }
8
9
  &__item {
9
10
  width: calc(50% - 30px);
@@ -21,4 +22,47 @@
21
22
  }
22
23
  }
23
24
  }
25
+ }
26
+
27
+
28
+ .VuePagination {
29
+ &__pagination {
30
+ display: flex;
31
+ justify-content: center;
32
+ &-item {
33
+ font-size: 16px;
34
+ line-height: 170%;
35
+ color: $black;
36
+ width: 50px;
37
+ height: 50px;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ border: 1px solid $grey_3;
42
+ border-radius: 4px;
43
+ margin: 0 3px;
44
+ a {
45
+ display: block;
46
+ width: 100%;
47
+ height: 100%;
48
+ text-align: center;
49
+ padding-top: 11px;
50
+ cursor: pointer;
51
+ &:hover {
52
+ background-color: $grey_3;
53
+ }
54
+ }
55
+ &.active {
56
+ background-color: $black;
57
+ color: white;
58
+ }
59
+ &.disabled {
60
+ pointer-events: none;
61
+ opacity: .5;
62
+ }
63
+ }
64
+ }
65
+ &__count {
66
+ display: none;
67
+ }
24
68
  }
@@ -1,38 +1,74 @@
1
1
  <template>
2
- <div class="NewsList__wrapper">
3
- <div
4
- v-for="(item, index) in news"
5
- :key="item._id"
6
- :class="{
7
- 'NewsList__item--large': (index + 1) % 3 === 0
8
- }"
9
- class="NewsList__item">
10
- <transition
11
- :name="(index + 1) % 3 ? 'from-right-to-left' : 'from-left-to-right'"
12
- appear>
13
- <news-list-item :item="item" class="elevation2" />
14
- </transition>
2
+ <div>
3
+ <div class="NewsList__wrapper">
4
+ <div
5
+ v-for="(item, index) in news"
6
+ :key="item._id"
7
+ :class="{
8
+ 'NewsList__item--large': (index + 1) % 3 === 0
9
+ }"
10
+ class="NewsList__item">
11
+ <transition
12
+ :name="(index + 1) % 3 ? 'from-right-to-left' : 'from-left-to-right'"
13
+ appear>
14
+ <news-list-item :item="item" class="elevation2" />
15
+ </transition>
16
+ </div>
15
17
  </div>
18
+ <pagination
19
+ v-if="perPage > 0"
20
+ v-model="currentPage"
21
+ :records="count"
22
+ :per-page="perPage"
23
+ :options="{ chunk: 3 }" />
16
24
  </div>
17
25
  </template>
18
26
 
19
27
  <script>
28
+ import Pagination from 'vue-pagination-2';
20
29
  import NewsListItem from '../news_list_item/news-list-item';
21
30
 
22
31
  export default {
23
32
  name: 'NewsList',
24
33
  components: {
25
- NewsListItem
34
+ NewsListItem,
35
+ Pagination
26
36
  },
27
37
  props: {
28
38
  news: {
29
39
  type: Array,
30
40
  required: true
41
+ },
42
+ count: {
43
+ type: Number
44
+ },
45
+ perPage: {
46
+ type: Number
47
+ },
48
+ page: {
49
+ type: Number
50
+ }
51
+ },
52
+ computed: {
53
+ currentPage: {
54
+ get() {
55
+ return this.page;
56
+ },
57
+ set(page) {
58
+ const params = [];
59
+ if (page > 1) {
60
+ params.push(`page=${page}`);
61
+ }
62
+ const link = `${this.$route.path}${params.length ? `?${params.join('&')}` : ''}`;
63
+ window.location = link;
64
+ // this.$router.push(link);
65
+ // window.scrollTo(0, 0);
66
+ }
31
67
  }
32
68
  }
33
69
  };
34
70
  </script>
35
71
 
36
- <style lang="scss" scoped>
72
+ <style lang="scss">
37
73
  @import 'news-list';
38
74
  </style>
@@ -17,7 +17,7 @@
17
17
  </h4>
18
18
  </div>
19
19
  <h1 class="text-secondary lc_h1">
20
- {{ model.paymentMethod === 'deposit' ? 'Proforma Invoice' : 'Tax invoice' }}
20
+ Tax invoice
21
21
  </h1>
22
22
  </div>
23
23
  <div class="OrderView__info">
@@ -144,6 +144,9 @@
144
144
  <div class="lc_regular16">
145
145
  Total inc GST: <b>{{ model.totalGST | price }}</b>
146
146
  </div>
147
+ <div class="lc_regular16">
148
+ Pending Payment: <b>{{ model.totalGST | price }}</b>
149
+ </div>
147
150
  </div>
148
151
  </div>
149
152
  </div>
@@ -94,7 +94,7 @@
94
94
  Upload your logo/artwork
95
95
  </div>
96
96
  <file-uploader
97
- :multiple="false"
97
+ :multiple="true"
98
98
  :url="`image/editor/${shop._id}/undefined`"
99
99
  :has-conversion-error-modal="false"
100
100
  :show-error-message="false"
@@ -135,14 +135,14 @@
135
135
  {{ uploadError }}
136
136
  </div>
137
137
  <div
138
- v-if="quote.file"
139
- class="QuoteRequest__upload-file">
140
- <span @click="quote.file = null">x</span>
141
- Logo:
138
+ v-for="file in quote.files"
139
+ :key="file._id"
140
+ class="QuoteRequest__upload-file mt-5">
141
+ <span @click="quote.files.splice(quote.files.indexOf(file), 1)">x</span>
142
142
  <a
143
- :href="quote.file.origin"
143
+ :href="file.origin"
144
144
  target="_blank">
145
- {{ quote.file.fileName }}
145
+ {{ file.fileName }}
146
146
  </a>
147
147
  </div>
148
148
  </div>
@@ -357,7 +357,7 @@ export default {
357
357
  quoteTypes: [],
358
358
  needToPrint: null,
359
359
  needItBy: null,
360
- file: null
360
+ files: []
361
361
  }
362
362
  };
363
363
  },
@@ -366,15 +366,15 @@ export default {
366
366
  },
367
367
  methods: {
368
368
  handleUploaded(file) {
369
- this.quote.file = file;
369
+ this.quote.files.push(file);
370
370
  },
371
371
  handleUploadError(e) {
372
372
  const { error, data } = e?.response?.data || {};
373
373
  if (data) {
374
- this.quote.file = {
374
+ this.quote.files.push({
375
375
  fileName: data.fileName,
376
376
  origin: data.source
377
- };
377
+ });
378
378
  } else {
379
379
  this.uploadError = error;
380
380
  }
package/nuxt.config.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = (config, axios) => ({
1
+ module.exports = (config, axios, { raygunClient } = {}) => ({
2
2
  mode: 'universal',
3
3
  head: {
4
4
  title: config.npm_package_name || '',
@@ -79,6 +79,15 @@ module.exports = (config, axios) => ({
79
79
  }
80
80
  }
81
81
  },
82
+ hooks: {
83
+ render: {
84
+ errorMiddleware(app) {
85
+ if (raygunClient) {
86
+ app.use(raygunClient.expressHandler);
87
+ }
88
+ }
89
+ },
90
+ },
82
91
  feed: [{
83
92
  path: '/google-shopping.xml',
84
93
  async get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.131",
3
+ "version": "0.0.134",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {