@lancom/shared 0.0.182 → 0.0.184

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.
@@ -85,8 +85,8 @@ export default {
85
85
  savePurchaseOrder(purchaseOrder) {
86
86
  return purchaseOrder._id ? _put(`admin/purchase-order/${purchaseOrder._id}`, purchaseOrder) : _post('admin/purchase-order', purchaseOrder);
87
87
  },
88
- savePurchaseOrderShipment(purchaseOrder, shipment) {
89
- return _put(`admin/purchase-order/${purchaseOrder._id}/shipments/${shipment._id}`, shipment);
88
+ savePurchaseOrderShipment(purchaseOrder, shipment, params) {
89
+ return _put(`admin/purchase-order/${purchaseOrder._id}/shipments/${shipment._id}`, shipment, params);
90
90
  },
91
91
  fetchPurchaseOrderWoTasks(purchaseOrderId) {
92
92
  return _get(`admin/purchase-order/${purchaseOrderId}/wo-tasks`);
@@ -365,9 +365,9 @@ export default {
365
365
  async fetchWarehouses(params) {
366
366
  return sortByName(await _get('admin/warehouse', params));
367
367
  },
368
- fetchWarehouseLocations(params) {
369
- return _get('admin/warehouse/locations', params);
370
- },
368
+ // fetchWarehouseLocations(params) {
369
+ // return _get('admin/warehouse/locations', params);
370
+ // },
371
371
  fetchWarehouseById(id) {
372
372
  return _get(`admin/warehouse/${id}`);
373
373
  },
@@ -386,6 +386,21 @@ export default {
386
386
  removeWarehouseTask(id) {
387
387
  return _delete(`admin/warehouse-task/${id}`);
388
388
  },
389
+ fetchWarehouseLocations(params) {
390
+ return _get('admin/warehouse-locations', params);
391
+ },
392
+ fetchWarehouseLocationById(id) {
393
+ return _get(`admin/warehouse-locations/${id}`);
394
+ },
395
+ saveWarehouseLocation(item) {
396
+ return item._id ? _put(`admin/warehouse-locations/${item._id}`, item) : _post('admin/warehouse-locations', item);
397
+ },
398
+ removeWarehouseLocation(id) {
399
+ return _delete(`admin/warehouse-locations/${id}`);
400
+ },
401
+ moveToWarehouseLocation(move) {
402
+ return _post(`admin/warehouse-locations/move`, move);
403
+ },
389
404
  async fetchBanners(params) {
390
405
  return sortByName(await _get('admin/banners', params));
391
406
  },
@@ -38,6 +38,6 @@ export const prepareHeaders = method => {
38
38
 
39
39
  export const _post = (url, data, config) => axiosApiInstance.post(buildPath(url), data, { ...config, headers: prepareHeaders() }).then(response => response.data);
40
40
  export const _get = (url, params) => axiosApiInstance.get(buildPath(url), { params, headers: prepareHeaders('get') }).then(response => response.data);
41
- export const _put = (url, data) => axiosApiInstance.put(buildPath(url), { ...data, __v: undefined }, { headers: prepareHeaders() }).then(response => response.data);
41
+ export const _put = (url, data, params) => axiosApiInstance.put(buildPath(url), { ...data, __v: undefined }, { params, headers: prepareHeaders() }).then(response => response.data);
42
42
  export const _patch = (url, data) => axiosApiInstance.patch(buildPath(url), { ...data, __v: undefined }, { headers: prepareHeaders() }).then(response => response.data);
43
43
  export const _delete = (url, data) => axiosApiInstance.delete(buildPath(url), { data, headers: prepareHeaders() }).then(response => response.data);
@@ -31,39 +31,31 @@
31
31
  class="icon-cancel FAQ__group-caret"
32
32
  :class="{ active: openedGroup === group.type }"></i>
33
33
  </div>
34
- <transition
35
- name="fade"
36
- appear>
34
+ <div
35
+ v-show="openedGroup === group.type"
36
+ class="FAQ__group-content view-transition">
37
37
  <div
38
- v-if="openedGroup === group.type"
39
- class="FAQ__group-content view-transition">
38
+ v-for="entity in group.entities"
39
+ :key="entity._id"
40
+ :ref="entity._id"
41
+ class="FAQ__entity">
40
42
  <div
41
- v-for="entity in group.entities"
42
- :key="entity._id"
43
- :ref="entity._id"
44
- class="FAQ__entity">
45
- <div
46
- class="FAQ__entity-header"
47
- @click="toggleEntity(entity)">
48
- <div class="FAQ__entity-title">
49
- {{ entity.question }}
50
- </div>
51
- <i
52
- class="icon-angle-down FAQ__entity-header-caret"
53
- :class="{ active: openedEntities.includes(entity._id) }"></i>
43
+ class="FAQ__entity-header"
44
+ @click="toggleEntity(entity)">
45
+ <div class="FAQ__entity-title">
46
+ {{ entity.question }}
54
47
  </div>
55
- <transition
56
- name="fade"
57
- appear>
58
- <div
59
- v-if="openedEntities.includes(entity._id)"
60
- class="FAQ__entity-body view-transition"
61
- v-html="entity.answer">
62
- </div>
63
- </transition>
48
+ <i
49
+ class="icon-angle-down FAQ__entity-header-caret"
50
+ :class="{ active: openedEntities.includes(entity._id) }"></i>
51
+ </div>
52
+ <div
53
+ v-show="openedEntities.includes(entity._id)"
54
+ class="FAQ__entity-body view-transition"
55
+ v-html="entity.answer">
64
56
  </div>
65
57
  </div>
66
- </transition>
58
+ </div>
67
59
  </div>
68
60
  </div>
69
61
  </div>
@@ -7,6 +7,7 @@
7
7
  :key="updateCarouselTime"
8
8
  :arrows="true"
9
9
  :dots="true"
10
+ :infinite="false"
10
11
  :swipe="false"
11
12
  :speed="800"
12
13
  @beforeChange="onChange">
@@ -55,6 +56,7 @@
55
56
  :key="updateCarouselTime"
56
57
  :slides-per-row="slidesPerRow"
57
58
  :arrows="true"
59
+ :infinite="false"
58
60
  :dots="true"
59
61
  :speed="800">
60
62
  <div
@@ -8,6 +8,7 @@
8
8
  class="ProductReviews__carousel">
9
9
  <vue-slick-carousel
10
10
  :arrows="true"
11
+ :infinite="false"
11
12
  :speed="800">
12
13
  <product-review
13
14
  v-for="review in reviews"
@@ -9,7 +9,12 @@ const metaInfo = {
9
9
  },
10
10
  computed: {
11
11
  ...mapGetters('page', ['routeInfo']),
12
- ...mapGetters(['shop'])
12
+ ...mapGetters(['shop']),
13
+ pageTitle() {
14
+ const { title, meta = {} } = this.routeInfo || {};
15
+ const pageItemMeta = this.pageItem?.meta || {};
16
+ return this.fillWithItemData(pageItemMeta.title || meta.title || title || this.generateTitleFromRoute());
17
+ }
13
18
  },
14
19
  methods: {
15
20
  generateTitleFromRoute() {
@@ -30,10 +35,10 @@ const metaInfo = {
30
35
  head() {
31
36
  const hasQueryParams = Object.keys(this.$route.query || {}).length > 0;
32
37
 
33
- const { title, short_text: shortText, image, meta = {} } = this.routeInfo || {};
38
+ const { short_text: shortText, image, meta = {} } = this.routeInfo || {};
34
39
  const pageItemMeta = this.pageItem?.meta || {};
35
40
 
36
- const pageTitle = this.fillWithItemData(pageItemMeta.title || meta.title || title || this.generateTitleFromRoute());
41
+ const pageTitle = this.pageTitle;
37
42
 
38
43
  const metaTags = [{
39
44
  hid: 'og:title',
package/nuxt.config.js CHANGED
@@ -42,6 +42,7 @@ module.exports = (config, axios, { raygunClient } = {}) => ({
42
42
  '@/node_modules/@lancom/shared/plugins/global-components',
43
43
  '@/node_modules/@lancom/shared/plugins/directives',
44
44
  '@/node_modules/@lancom/shared/plugins/vue-js-modal',
45
+ '@/node_modules/@lancom/shared/plugins/v-style',
45
46
  '@/node_modules/@lancom/shared/plugins/vee-validate',
46
47
  { src: '@/node_modules/@lancom/shared/plugins/vue-toastr', ssr: false },
47
48
  { src: '@/node_modules/@lancom/shared/plugins/vue-hummer', ssr: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.182",
3
+ "version": "0.0.184",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,7 @@
1
+ import Vue from 'vue';
2
+
3
+ Vue.component('v-style', {
4
+ render: function (createElement) {
5
+ return createElement('style', this.$slots.default)
6
+ }
7
+ });
package/store/product.js CHANGED
@@ -120,7 +120,26 @@ export const getters = {
120
120
  ...printTypesMinQuantity
121
121
  );
122
122
  },
123
- images: ({ images }) => images,
123
+ images: ({ images, product }) => {
124
+ const productImages = images.map((image, index) => {
125
+ const types = (image.types || []).filter(t => ['front', 'back', 'model'].includes(t));
126
+ return {
127
+ ...image,
128
+ alt: [
129
+ product.name,
130
+ product.brand?.name,
131
+ (types[0] || '').toUpperCase(),
132
+ types[0] && images.reduce((id, img, i) => {
133
+ if (i <= index && (img.types || []).includes(types[0])) {
134
+ id++;
135
+ }
136
+ return id;
137
+ }, 0)
138
+ ].filter(n => !!n).join(' ')
139
+ }
140
+ });
141
+ return productImages;
142
+ },
124
143
  editableSide: ({ editableSide }) => editableSide,
125
144
  priceIncludeGST: ({ priceIncludeGST }) => priceIncludeGST,
126
145
  hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice
package/store/products.js CHANGED
@@ -5,6 +5,8 @@ export const state = () => ({
5
5
  page: 1,
6
6
  count: 500,
7
7
  perPage: 2,
8
+ minPrice: 0,
9
+ maxPrice: 0,
8
10
  types: [],
9
11
  colors: [],
10
12
  brands: [],
@@ -23,6 +25,8 @@ export const getters = {
23
25
  attributes: ({ attributes }) => attributes || [],
24
26
  page: ({ page }) => page,
25
27
  count: ({ count }) => count,
28
+ minPrice: ({ minPrice }) => minPrice,
29
+ maxPrice: ({ maxPrice }) => maxPrice,
26
30
  perPage: ({ perPage }) => perPage,
27
31
  loadError: ({ loadError }) => loadError,
28
32
  placeholder: ({ placeholder }) => placeholder
@@ -33,7 +37,8 @@ export const actions = {
33
37
  try {
34
38
  commit('setLoadError', null);
35
39
  const {
36
- products, count, page, perPage, productTypes, colors, brands, tags, attributes
40
+ products, count, page, perPage, productTypes, colors, brands, tags, attributes,
41
+ minPrice, maxPrice
37
42
  } = await api.fetchProducts(shop, params);
38
43
  commit('setProducts', products);
39
44
  commit('setPage', page);
@@ -44,6 +49,8 @@ export const actions = {
44
49
  commit('setBrands', brands);
45
50
  commit('setTags', tags);
46
51
  commit('setAttributes', attributes);
52
+ commit('setMinPrice', minPrice);
53
+ commit('setMaxPrice', maxPrice);
47
54
  } catch (e) {
48
55
  const { status, data } = e?.response || {};
49
56
  const statusCode = status || 500;
@@ -78,6 +85,12 @@ export const mutations = {
78
85
  setColors(state, colors) {
79
86
  state.colors = colors;
80
87
  },
88
+ setMinPrice(state, minPrice) {
89
+ state.minPrice = minPrice;
90
+ },
91
+ setMaxPrice(state, maxPrice) {
92
+ state.maxPrice = maxPrice;
93
+ },
81
94
  setBrands(state, brands) {
82
95
  state.brands = brands;
83
96
  },