@lancom/shared 0.0.227 → 0.0.229

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.
@@ -68,6 +68,12 @@ export default {
68
68
  getWorkflowStepsTypes(params) {
69
69
  return _get(`admin/workflow-step/types`, params);
70
70
  },
71
+ fetchWorkflowSteps(params) {
72
+ return _get('admin/workflow-step', params);
73
+ },
74
+ fetchWorkflowStepById(id) {
75
+ return _get(`admin/workflow-step/${id}`);
76
+ },
71
77
  saveWorkflowStep(step) {
72
78
  return step._id ? _put(`admin/workflow-step/${step._id}`, step) : _post('admin/workflow-step', step);
73
79
  },
@@ -480,6 +486,9 @@ export default {
480
486
  removeWarehouseAllocation(allocation) {
481
487
  return _delete(`admin/allocations/${allocation._id}`, allocation);
482
488
  },
489
+ removeWarehouseAllocations(allocations) {
490
+ return _delete(`admin/allocations`, { allocations });
491
+ },
483
492
  fetchWarehouseLocationById(id) {
484
493
  return _get(`admin/warehouse-locations/${id}`);
485
494
  },
@@ -24,14 +24,18 @@ export default {
24
24
  'suburb',
25
25
  'quantities',
26
26
  'notValidProductsQuantities',
27
+ 'notValidStockQuantities',
27
28
  'notValidPrintsQuantities'
28
29
  ]),
29
30
  isNotValidQuantity() {
30
- return this.isNotValidProductsQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
31
+ return this.isNotValidProductsQuantity || this.isNotValidStockQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
31
32
  },
32
33
  isNotValidProductsQuantity() {
33
34
  return this.notValidProductsQuantities.length > 0;
34
35
  },
36
+ isNotValidStockQuantity() {
37
+ return this.notValidStockQuantities.length > 0;
38
+ },
35
39
  isNotValidPrintsQuantity() {
36
40
  return this.notValidPrintsQuantities.length > 0;
37
41
  },
@@ -55,6 +55,9 @@ export default {
55
55
  return this.simpleProductsWithAmount.reduce((amount, entity) => {
56
56
  return amount + entity.amount;
57
57
  }, 0);
58
+ },
59
+ simpleProductWithInvalidStock() {
60
+ return this.simpleProductsWithAmount.filter(({ amount, quantityStock }) => amount > quantityStock)
58
61
  }
59
62
  },
60
63
  methods: {
@@ -71,6 +71,11 @@
71
71
  margin-right: 26px;
72
72
  }
73
73
  }
74
+ &__error {
75
+ margin-bottom: 5px;
76
+ color: $error;
77
+ font-size: 12px;
78
+ }
74
79
  &__totals {
75
80
  width: 200px;
76
81
  display: flex;
@@ -49,6 +49,14 @@
49
49
  :display-unit-price="displayUnitPrice"
50
50
  @change="onChangeQty" />
51
51
  </div>
52
+ <div v-if="simpleProductWithInvalidStock.length > 0">
53
+ <div
54
+ v-for="simpleProduct in simpleProductWithInvalidStock"
55
+ :key="simpleProduct._id"
56
+ class="CartEntityColorSimpleProducts__error">
57
+ Error size {{ simpleProduct.size.shortName }}, qty available: {{ simpleProduct.quantityStock }}
58
+ </div>
59
+ </div>
52
60
  <div class="CartEntityColorSimpleProducts__totals">
53
61
  <div class="CartEntityColorSimpleProducts__total">
54
62
  <div class="lc_title-small">
@@ -16,7 +16,10 @@
16
16
  type="number"
17
17
  min="0"
18
18
  class="form-field centered CartColorSimpleProduct__field"
19
- :class="{ empty: !model }"
19
+ :class="{
20
+ empty: !model,
21
+ error: model > simpleProduct.quantityStock
22
+ }"
20
23
  @change="onChange()"
21
24
  @focus="onFocus()"
22
25
  @blur="onBlur()" />
@@ -5,6 +5,11 @@
5
5
  :key="product._id">
6
6
  Minimum <b>{{ product.name }}</b> order quantity: {{ product.minimumOrderQuantity }}
7
7
  </li>
8
+ <li
9
+ v-for="product in notValidStockQuantities"
10
+ :key="product._id">
11
+ Available <b>{{ product.name }}</b> quantity: {{ product.maxQuantity }}
12
+ </li>
8
13
  <li
9
14
  v-for="print in notValidPrintsQuantities"
10
15
  :key="print._id">
@@ -26,6 +31,7 @@ export default {
26
31
  computed: {
27
32
  ...mapGetters('cart', [
28
33
  'notValidProductsQuantities',
34
+ 'notValidStockQuantities',
29
35
  'notValidPrintsQuantities'
30
36
  ])
31
37
  }
@@ -282,7 +282,7 @@ export default {
282
282
  },
283
283
  methods: {
284
284
  validateAddress() {
285
- this.$refs.addressProvider.validate();
285
+ // this.$refs.addressProvider.validate();
286
286
  },
287
287
  ...mapMutations('cart', [
288
288
  'setSuburb'
@@ -28,8 +28,7 @@ export default {
28
28
  computed: {
29
29
  ...mapGetters(['payment']),
30
30
  cardComponent() {
31
- console.log('payment: ', this.payment);
32
- return 'stripe';
31
+ return this.payment?.type || 'stripe';
33
32
  }
34
33
  },
35
34
  methods: {
@@ -74,6 +74,7 @@
74
74
  }
75
75
  &__big-image,
76
76
  &__small-image {
77
+ text-align: center;
77
78
  width: 100%;
78
79
  position: relative;
79
80
  background-repeat: no-repeat;
@@ -89,6 +90,7 @@
89
90
  }
90
91
  &__small-image {
91
92
  height: 75px;
93
+ max-width: 140px;
92
94
  padding: 5px 0;
93
95
  text-align: center;
94
96
  &-src {
@@ -5,6 +5,8 @@
5
5
  <img
6
6
  :src="staticLink(currentImage.large)"
7
7
  :alt="product.name"
8
+ width="400"
9
+ height="400"
8
10
  class="Gallery__big-image-src" />
9
11
  <div
10
12
  v-if="currentImage.print"
@@ -47,18 +49,22 @@
47
49
  <img
48
50
  :src="staticLink(image.small)"
49
51
  :alt="product.name"
52
+ width="65"
53
+ height="65"
50
54
  class="Gallery__small-image-src" />
51
55
  <div class="Gallery__small-printed">
52
56
  {{ image.printType ? 'Printed' : (product.prePrint ? product.prePrintText : image.colorName || 'Blank') }}
53
57
  </div>
54
58
  </div>
55
59
  <button
60
+ v-if="hasThumbsArrows"
56
61
  type="button"
57
62
  class="slick-arrow slick-prev slick-disabled"
58
63
  @click="goToPrevPage()">
59
64
  Previous
60
65
  </button>
61
66
  <button
67
+ v-if="hasThumbsArrows"
62
68
  type="button"
63
69
  class="slick-arrow slick-next"
64
70
  @click="goToNextPage()">
@@ -141,6 +147,9 @@ export default {
141
147
  visibleImages() {
142
148
  return this.filteredImages.slice(this.visibleImagesFrom, this.visibleImagesFrom + this.slidesPerRow);
143
149
  },
150
+ hasThumbsArrows() {
151
+ return this.filteredImages.length > this.slidesPerRow;
152
+ },
144
153
  filteredImages() {
145
154
  const images = this.filterType ? this.images.filter(i => this.isValidImageByFilter(this.filterType, i)) : this.images;
146
155
  return images.map(image => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.227",
3
+ "version": "0.0.229",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/auth.js CHANGED
@@ -20,6 +20,7 @@ export const getters = {
20
20
  isContentEditor: state => checkRoles(state.user, ['admin', 'content-editor']),
21
21
  isWarehouse: state => checkRoles(state.user, ['admin', 'warehouse']),
22
22
  user: state => state.user,
23
+ userWarehouse: state => state.user?.warehouse,
23
24
  authStatus: state => state.status,
24
25
  stateError: state => state.err
25
26
  };
package/store/cart.js CHANGED
@@ -31,6 +31,19 @@ const getProductsQuantities = entities => {
31
31
  return quantities;
32
32
  };
33
33
 
34
+ const getInvalidStockQuantities = entities => {
35
+ const quantities = entities.reduce((items, entity) => {
36
+ const { product: { name }, simpleProducts } = entity;
37
+ return [
38
+ ...items,
39
+ ...simpleProducts
40
+ .filter(({ amount }) => amount > 0)
41
+ .map(({ _id, amount, quantityStock, size }) => ({ _id, name: `${name}, ${size.shortName}`, quantity: amount, maxQuantity: quantityStock }))
42
+ ];
43
+ }, []);
44
+ return quantities;
45
+ };
46
+
34
47
  const getPrintsQuantities = entities => {
35
48
  const printTypes = entities.reduce((types, e) => [...types, ...e.prints.map(({ printType }) => ({ ...printType, guid: `${e.guid}-${printType._id}` }))], []);
36
49
  const grouped = groupBy(printTypes, 'guid');
@@ -56,11 +69,15 @@ export const getters = {
56
69
  isEmpty: (state, { entities }) => (entities || []).length === 0,
57
70
  quantities: ({ entities }) => ({
58
71
  products: getProductsQuantities(entities),
59
- prints: getPrintsQuantities(entities)
72
+ prints: getPrintsQuantities(entities),
73
+ stock: getInvalidStockQuantities(entities)
60
74
  }),
61
75
  notValidProductsQuantities(state, { quantities }) {
62
76
  return (quantities?.products || []).filter(({ minimumOrderQuantity, quantity }) => quantity < minimumOrderQuantity);
63
77
  },
78
+ notValidStockQuantities(state, { quantities }) {
79
+ return (quantities?.stock || []).filter(({ maxQuantity, quantity }) => quantity > maxQuantity);
80
+ },
64
81
  notValidPrintsQuantities(state, { quantities }) {
65
82
  return (quantities?.prints || []).filter(({ minQuantity, quantity }) => quantity < minQuantity);
66
83
  },
package/store/product.js CHANGED
@@ -324,6 +324,9 @@ export const mutations = {
324
324
  clearTemplateLayers(state) {
325
325
  state.template.layers = [];
326
326
  },
327
+ setTemplateLayers(layers) {
328
+ state.template.layers = layers;
329
+ },
327
330
  /*
328
331
  ** MANAGE LAYERS
329
332
  */
package/store/quote.js CHANGED
@@ -16,6 +16,18 @@ export const getters = {
16
16
  selectedOption: ({ selectedOption }) => selectedOption,
17
17
  proceedOption: ({ option, selectedOption }) => option || selectedOption,
18
18
  hasProceedOption: (state, { proceedOption }) => !!proceedOption,
19
+ proceedOptionNotValidStock: (state, { proceedOption }) => {
20
+ if (!proceedOption) {
21
+ return false;
22
+ }
23
+ const simpleProducts = proceedOption.products.reduce((simpleProducts, product) => {
24
+ return [
25
+ ...simpleProducts,
26
+ ...(product.isCustom ? [] : product.simpleProducts.filter(({ amount }) => amount > 0))
27
+ ];
28
+ }, []);
29
+ return simpleProducts.some(sp => sp.amount > sp.quantityStock);
30
+ },
19
31
  options: ({ option, quote }) => (option ? quote.options.filter(o => o._id === option) : quote.options) || [],
20
32
  quoteId: ({ quote }) => `${quote.code}`.replace('QUOTE', ''),
21
33
  shopContacts: ({ quote }) => quote.shop.settings?.contacts || {},