@things-factory/product-ui 4.3.113-alpha.0 → 4.3.122

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.
@@ -298,7 +298,6 @@ class ProductBundleLinkPopup extends localize(i18next)(LitElement) {
298
298
  records:
299
299
  items.map(itm => {
300
300
  return {
301
- id: itm.id,
302
301
  productSku: itm.product.sku,
303
302
  productName: itm.product.name,
304
303
  productDescription: itm.product.description,
@@ -4,7 +4,6 @@ import '@things-factory/grist-ui'
4
4
 
5
5
  import gql from 'graphql-tag'
6
6
  import { css, html } from 'lit'
7
- import isEmpty from 'lodash-es/isEmpty'
8
7
 
9
8
  import { getCodeByName } from '@things-factory/code-base'
10
9
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -108,7 +107,7 @@ class ProductBundleList extends localize(i18next)(PageView) {
108
107
  ]
109
108
 
110
109
  this.productGristConfig = {
111
- pagination: { limit: 50, pages: [50, 100, 200, 500] },
110
+ pagination: { limit: 50, pages: [20, 50, 100, 500, 999] },
112
111
  list: { fields: ['sku', 'name', 'description', 'type', 'packingType'] },
113
112
  rows: {
114
113
  selectable: { multiple: true }
@@ -126,7 +125,7 @@ class ProductBundleList extends localize(i18next)(PageView) {
126
125
  {
127
126
  type: 'string',
128
127
  name: 'sku',
129
- header: `*${i18next.t('field.sku')}`,
128
+ header: i18next.t('field.sku'),
130
129
  sortable: false,
131
130
  record: { editable: true },
132
131
  width: 150
@@ -142,7 +141,7 @@ class ProductBundleList extends localize(i18next)(PageView) {
142
141
  {
143
142
  type: 'string',
144
143
  name: 'name',
145
- header: `*${i18next.t('field.name')}`,
144
+ header: i18next.t('field.name'),
146
145
  sortable: false,
147
146
  record: { editable: true },
148
147
  width: 200
@@ -183,7 +182,7 @@ class ProductBundleList extends localize(i18next)(PageView) {
183
182
  {
184
183
  type: 'select',
185
184
  name: 'packingType',
186
- header: `*${i18next.t('field.packing_type')}`,
185
+ header: i18next.t('field.packing_type'),
187
186
  record: {
188
187
  editable: true,
189
188
  options: ['', ...Object.keys(packingType).map(key => packingType[key].name)]
@@ -275,71 +274,34 @@ class ProductBundleList extends localize(i18next)(PageView) {
275
274
  }
276
275
 
277
276
  async _saveProductBundles(patches) {
278
- try {
279
- if (patches && patches.length) {
280
- this._validate()
281
- const response = await client.mutate({
282
- mutation: gql`
283
- mutation updateMultipleProductBundle($patches: [ProductBundlePatch!]!) {
284
- updateMultipleProductBundle(patches: $patches) {
285
- sku
286
- refCode
287
- name
288
- description
289
- type
290
- packingType
291
- status
292
- }
277
+ if (patches && patches.length) {
278
+ const response = await client.mutate({
279
+ mutation: gql`
280
+ mutation updateMultipleProductBundle($patches: [ProductBundlePatch!]!) {
281
+ updateMultipleProductBundle(patches: $patches) {
282
+ sku
283
+ refCode
284
+ name
285
+ description
286
+ type
287
+ packingType
288
+ status
293
289
  }
294
- `,
295
- variables: { patches },
296
- context: gqlContext()
297
- })
298
-
299
- if (!response.errors) {
300
- this.dataGrist.fetch()
301
- this._showToast(i18next.t('text.data_updated_successfully'))
302
- }
303
- } else {
304
- CustomAlert({
305
- title: i18next.t('text.nothing_changed'),
306
- text: i18next.t('text.there_is_nothing_to_save')
307
- })
308
- }
309
- } catch (e) {
310
- this._showToast(e.message)
311
- }
312
- }
313
-
314
- _validate() {
315
- let errors = []
316
-
317
- let data = this.dataGrist._data.records.map(itm => {
318
- itm.error = false
319
-
320
- if (isEmpty(itm.sku) || '') {
321
- itm.error = true
322
- if (!errors.find(err => err.type == 'sku')) errors.push({ type: 'sku', value: 'SKU is required' })
323
- }
324
- if (isEmpty(itm.name) || '') {
325
- itm.error = true
326
- if (!errors.find(err => err.type == 'name')) errors.push({ type: 'name', value: 'name is required' })
327
- }
328
- if (isEmpty(itm.packingType) || '') {
329
- itm.error = true
330
- if (!errors.find(err => err.type == 'packingType'))
331
- errors.push({ type: 'packingType', value: 'packing type is required' })
332
- }
333
- return itm
334
- })
290
+ }
291
+ `,
292
+ variables: { patches },
293
+ context: gqlContext()
294
+ })
335
295
 
336
- if (errors.length > 0) {
337
- this._data = {
338
- ...this.dataGrist.dirtyData,
339
- records: data
296
+ if (!response.errors) {
297
+ this.dataGrist.fetch()
298
+ this._showToast(i18next.t('text.data_updated_successfully'))
340
299
  }
341
-
342
- throw new Error(errors.map(itm => itm.value).join(', '))
300
+ } else {
301
+ CustomAlert({
302
+ title: i18next.t('text.nothing_changed'),
303
+ text: i18next.t('text.there_is_nothing_to_save')
304
+ })
343
305
  }
344
306
  }
345
307
 
@@ -184,7 +184,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
184
184
  {
185
185
  type: 'select',
186
186
  name: 'packingType',
187
- header: `*${i18next.t('field.packing_type')}`,
187
+ header: i18next.t('field.packing_type'),
188
188
  record: {
189
189
  editable: true,
190
190
  options: ['', ...Object.keys(packingType).map(key => packingType[key].name)]
@@ -198,14 +198,14 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
198
198
  editable: true,
199
199
  options: ['', ...Object.keys(uom).map(key => uom[key].name)]
200
200
  },
201
- header: `*${i18next.t('field.uom')}`,
201
+ header: `${i18next.t('field.uom')}`,
202
202
  width: 80
203
203
  },
204
204
  {
205
205
  type: 'float',
206
206
  name: 'uomValue',
207
207
  record: { editable: true, options: { min: 0 } },
208
- header: `*${i18next.t('field.uom_value')}`,
208
+ header: `${i18next.t('field.uom_value')}`,
209
209
  width: 100
210
210
  },
211
211
  {
@@ -884,7 +884,7 @@ class ProductList extends localize(i18next)(PageView) {
884
884
  this.dataGrist.fetch()
885
885
  }
886
886
  } catch (error) {
887
- this.showToast(error.message)
887
+ this.showToast(error)
888
888
  }
889
889
  }
890
890
 
@@ -926,7 +926,7 @@ class ProductList extends localize(i18next)(PageView) {
926
926
  this.dataGrist.fetch()
927
927
  }
928
928
  } catch (error) {
929
- this.showToast(error.message)
929
+ this.showToast(error)
930
930
  }
931
931
  }
932
932
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/product-ui",
3
- "version": "4.3.113-alpha.0",
3
+ "version": "4.3.122",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,13 +24,13 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/form-ui": "^4.3.113-alpha.0",
28
- "@things-factory/grist-ui": "^4.3.113-alpha.0",
29
- "@things-factory/i18n-base": "^4.3.113-alpha.0",
30
- "@things-factory/import-ui": "^4.3.113-alpha.0",
31
- "@things-factory/layout-base": "^4.3.113-alpha.0",
32
- "@things-factory/product-base": "^4.3.113-alpha.0",
33
- "@things-factory/shell": "^4.3.113-alpha.0"
27
+ "@things-factory/form-ui": "^4.3.122",
28
+ "@things-factory/grist-ui": "^4.3.122",
29
+ "@things-factory/i18n-base": "^4.3.122",
30
+ "@things-factory/import-ui": "^4.3.122",
31
+ "@things-factory/layout-base": "^4.3.122",
32
+ "@things-factory/product-base": "^4.3.122",
33
+ "@things-factory/shell": "^4.3.122"
34
34
  },
35
- "gitHead": "3dd2e6f58cc2828ab5e2658d3fa47120165c802b"
35
+ "gitHead": "3edd80e6ca68480b22ee0e25eba34d13ab0e49f1"
36
36
  }