@things-factory/sales-ui 4.3.108 → 4.3.109

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.
@@ -772,7 +772,7 @@ class PurchaseOrderApprovalDetail extends connect(store)(localize(i18next)(PageV
772
772
 
773
773
  if (!response.errors) {
774
774
  this._clearView()
775
- this._showToast({ message: i18next.t('text.purchase_order_updated') })
775
+ this._showToast({ message: i18next.t('purchase_order_updated') })
776
776
  this._navigateToList()
777
777
  }
778
778
  } catch (e) {
@@ -839,10 +839,6 @@ class PurchaseOrderApprovalDetail extends connect(store)(localize(i18next)(PageV
839
839
  brand
840
840
  description
841
841
  }
842
- productDetail {
843
- id
844
- name
845
- }
846
842
  adjustedBatchId
847
843
  remark
848
844
  status
@@ -2,7 +2,6 @@ import '@things-factory/grist-ui'
2
2
  import '@things-factory/biz-ui'
3
3
  import '@things-factory/warehouse-ui'
4
4
  import '@things-factory/import-ui/client/components/import-pop-up'
5
- import '@things-factory/operato-wms/client/pages/components/select-product-popup'
6
5
 
7
6
  import gql from 'graphql-tag'
8
7
  import { css, html } from 'lit-element'
@@ -523,13 +522,29 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
523
522
  width: 150
524
523
  },
525
524
  {
526
- type: 'string',
527
- name: 'productName',
525
+ type: 'object',
526
+ name: 'product',
528
527
  header: i18next.t('field.product'),
529
- imex: { header: i18next.t('field.product'), key: 'productName', width: 50, type: 'string' },
530
- handlers: {
531
- click: (columns, data, column, record, rowIndex) => {
532
- this._openProductSelection(rowIndex)
528
+ record: {
529
+ editable: this._editable,
530
+ options: {
531
+ queryName: 'products',
532
+ basicArgs: {
533
+ filters: [{ name: 'bizplace_id', operator: 'eq', value: this._purchaseOrderData?.bizplace?.id }]
534
+ },
535
+ nameField: 'name',
536
+ descriptionField: 'description',
537
+ select: [
538
+ { name: 'id', hidden: true },
539
+ { name: 'sku', header: i18next.t('field.sku') },
540
+ { name: 'name', header: i18next.t('field.name') },
541
+ { name: 'brand', header: i18next.t('field.brand') },
542
+ { name: 'description', header: i18next.t('field.description') },
543
+ { name: 'packingType', header: i18next.t('field.packing_type') },
544
+ { name: 'primaryUnit', header: i18next.t('field.uom') },
545
+ { name: 'primaryValue', header: i18next.t('field.uom_value') }
546
+ ],
547
+ list: { fields: ['sku', 'name', 'brand', 'description', 'packingType'] }
533
548
  }
534
549
  },
535
550
  width: 350
@@ -1023,10 +1038,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1023
1038
  brand
1024
1039
  description
1025
1040
  }
1026
- productDetail {
1027
- id
1028
- name
1029
- }
1030
1041
  adjustedBatchId
1031
1042
  remark
1032
1043
  status
@@ -1154,19 +1165,11 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1154
1165
  throw new Error(i18next.t('text.container_no_is_empty'))
1155
1166
  }
1156
1167
 
1157
- _validateProducts(records = []) {
1168
+ _validateProducts() {
1158
1169
  // no records
1159
- if (!records?.length) {
1160
- records = this.productGrist.dirtyData.records
1161
- }
1162
-
1170
+ const records = this.productGrist.dirtyData.records
1163
1171
  if (!records?.length) throw new Error(i18next.t('text.no_products'))
1164
1172
 
1165
- const duplicatedProducts = records.filter((item, index) => records.indexOf(item) != index)
1166
-
1167
- if (duplicatedProducts?.length > 0)
1168
- throw new Error(i18next.t('text.there_is_duplicated_products_with_same_batch_no'))
1169
-
1170
1173
  const checkRequiredFields = ({ batchId, packingType, uomValue, uom }) =>
1171
1174
  !batchId || !packingType || !uomValue || !uom
1172
1175
 
@@ -1207,7 +1210,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1207
1210
  id: record.id || null,
1208
1211
  batchId: record.batchId,
1209
1212
  product: { id: record.product.id },
1210
- productDetail: record.productDetailId ? { id: record.productDetailId } : { id: record.productDetail.id },
1211
1213
  packingType: record.packingType,
1212
1214
  uomValue: record?.uomValue ? record.uomValue : 0,
1213
1215
  uom: record.uom,
@@ -1216,7 +1218,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1216
1218
  remark: record?.remark || null,
1217
1219
  discountAmt: record.discountAmt,
1218
1220
  unitPrice:
1219
- status == PURCHASE_ORDER_STATUS.DRAFT ? record.unitPrice : record.unitPrice > 0 ? record.unitPrice : 1,
1221
+ status == PURCHASE_ORDER_STATUS.DRAFT ? record.unitPrice : record.unitPrice > 1 ? record.unitPrice : 1,
1220
1222
  miscAmt: record.miscAmt,
1221
1223
  taxRate: record.taxRate
1222
1224
  }
@@ -1427,20 +1429,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1427
1429
  imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
1428
1430
  width: 100
1429
1431
  },
1430
- {
1431
- type: 'string',
1432
- name: 'uom',
1433
- header: i18next.t('field.uom'),
1434
- imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
1435
- width: 100
1436
- },
1437
- {
1438
- type: 'float',
1439
- name: 'uomValue',
1440
- header: i18next.t('field.uom_value'),
1441
- imex: { header: i18next.t('field.uom_value'), key: 'uomValue', width: 25, type: 'float' },
1442
- width: 100
1443
- },
1444
1432
  {
1445
1433
  type: 'string',
1446
1434
  name: 'remark',
@@ -1488,59 +1476,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1488
1476
  return productGrist
1489
1477
  }
1490
1478
 
1491
- _openProductSelection(rowIndex) {
1492
- if (this._purchaseOrderData?.bizplace?.id) {
1493
- openPopup(
1494
- html`
1495
- <select-product-popup
1496
- .bizplaceId="${this._purchaseOrderData?.bizplace?.id}"
1497
- @selected="${e => {
1498
- // let newRecord = []
1499
- // newRecord.push(e.detail)
1500
-
1501
- if (this.productGrist.dirtyData.records.length !== rowIndex) {
1502
- // update existing product data records
1503
- this.productGrist.dirtyData.records.splice(rowIndex, 1, {
1504
- ...this.productGrist.dirtyData.records[rowIndex],
1505
- ...e.detail
1506
- })
1507
-
1508
- this.productGrist.dirtyData.records = this.productGrist.dirtyData.records.map(item => {
1509
- return {
1510
- ...item,
1511
- totalUomValue:
1512
- item?.packQty > 0
1513
- ? item?.totalUomValue
1514
- ? item.totalUomValue
1515
- : `${parseFloat(item.packQty * e.detail.uomValue).toFixed(2)} ${e.detail.uom}`
1516
- : null
1517
- }
1518
- })
1519
-
1520
- this.productData = {
1521
- ...this.productData,
1522
- records: [...this.productGrist.dirtyData.records]
1523
- }
1524
- } else {
1525
- this.productData = {
1526
- ...this.productData,
1527
- records: [...this.productGrist.dirtyData.records, e.detail]
1528
- }
1529
- }
1530
- }}"
1531
- ></select-product-popup>
1532
- `,
1533
- {
1534
- backdrop: true,
1535
- size: 'large',
1536
- title: i18next.t('title.select_item')
1537
- }
1538
- )
1539
- } else {
1540
- this._showToast({ message: i18next.t('text.company_selection_is_empty') })
1541
- }
1542
- }
1543
-
1544
1479
  async _exportableData() {
1545
1480
  try {
1546
1481
  var headerSetting = [
@@ -1591,10 +1526,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1591
1526
  primaryUnit
1592
1527
  primaryValue
1593
1528
  }
1594
- productDetail {
1595
- id
1596
- name
1597
- }
1598
1529
  }
1599
1530
  }
1600
1531
  `,
@@ -1629,25 +1560,21 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1629
1560
  }
1630
1561
 
1631
1562
  async importHandler(records) {
1632
- try {
1633
- this._validateProducts(records)
1634
-
1635
- const orderProducts = records.map(record => {
1636
- delete record.cuFlag
1637
- delete record.id
1638
- return {
1639
- ...record,
1640
- unitPrice: record?.unitPrice > 0 ? parseFloat(record?.unitPrice) : 0,
1641
- packQty: parseInt(record?.packQty) || 0,
1642
- miscAmt: record?.miscAmt > 0 ? parseFloat(record?.miscAmt) : 0,
1643
- discountAmt: record?.discountAmt > 0 ? parseFloat(record?.discountAmt) : 0,
1644
- taxRate: record?.taxRate > 0 ? parseFloat(record?.taxRate) : 0
1645
- }
1646
- })
1647
- await this.bulkUploadValidatePoOrderProducts(orderProducts)
1648
- } catch (e) {
1649
- this._showToast(e)
1650
- }
1563
+ this.productData = { records }
1564
+
1565
+ const orderProducts = records.map(record => {
1566
+ delete record.cuFlag
1567
+ delete record.id
1568
+ return {
1569
+ ...record,
1570
+ unitPrice: record?.unitPrice > 0 ? parseFloat(record?.unitPrice?.toFixed(2)) : 0,
1571
+ packQty: parseInt(record?.packQty) || 0,
1572
+ miscAmt: record?.miscAmt > 0 ? parseFloat(record?.miscAmt?.toFixed(2)) : 0,
1573
+ discountAmt: record?.discountAmt > 0 ? parseFloat(record?.discountAmt?.toFixed(2)) : 0,
1574
+ taxRate: record?.taxRate > 0 ? parseFloat(record?.taxRate?.toFixed(2)) : 0
1575
+ }
1576
+ })
1577
+ await this.bulkUploadValidatePoOrderProducts(orderProducts)
1651
1578
  history.back()
1652
1579
  }
1653
1580
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/sales-ui",
3
- "version": "4.3.108",
3
+ "version": "4.3.109",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,15 +24,15 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/code-base": "^4.3.108",
28
- "@things-factory/form-ui": "^4.3.108",
29
- "@things-factory/grist-ui": "^4.3.108",
30
- "@things-factory/i18n-base": "^4.3.108",
31
- "@things-factory/import-ui": "^4.3.108",
32
- "@things-factory/sales-base": "^4.3.108",
33
- "@things-factory/setting-ui": "^4.3.108",
34
- "@things-factory/shell": "^4.3.108",
35
- "@things-factory/warehouse-ui": "^4.3.108"
27
+ "@things-factory/code-base": "^4.3.109",
28
+ "@things-factory/form-ui": "^4.3.109",
29
+ "@things-factory/grist-ui": "^4.3.109",
30
+ "@things-factory/i18n-base": "^4.3.109",
31
+ "@things-factory/import-ui": "^4.3.109",
32
+ "@things-factory/sales-base": "^4.3.109",
33
+ "@things-factory/setting-ui": "^4.3.109",
34
+ "@things-factory/shell": "^4.3.109",
35
+ "@things-factory/warehouse-ui": "^4.3.109"
36
36
  },
37
- "gitHead": "8aa8811dd0ebb1f4c1d9bc50fc221766d855c553"
37
+ "gitHead": "a1b81fa991795b27a9f30867347a3c1774d2c41b"
38
38
  }
@@ -30,7 +30,6 @@
30
30
  "text.please_select_a_valid_draft_order_to_generate_release_order": "please select a valid draft order to generate release order",
31
31
  "text.purchase_order_form_invalid": "purchase order form invalid",
32
32
  "text.purchase_order_saved": "purchase order saved",
33
- "text.purchase_order_updated": "purchase order updated",
34
33
  "text.release_order(s)_has_been_generated": "release order(s) has been generated",
35
34
  "text.update_draft_release_order": "update draft release order",
36
35
  "text.update_purchase_order": "update purchase order",
@@ -42,6 +41,5 @@
42
41
  "title.purchase_order_detail": "purchase order detail",
43
42
  "title.purchase_order": "purchase order",
44
43
  "title.purchase_orders_approval": "purchase orders approval",
45
- "title.purchase_orders": "purchase orders",
46
- "text.there_is_duplicated_products_with_same_batch_no": "there is duplicated products with same batch no"
44
+ "title.purchase_orders": "purchase orders"
47
45
  }
@@ -41,7 +41,5 @@
41
41
  "label.unit_price": "[ko] unit price",
42
42
  "label.misc_amt": "[ko] misc amt",
43
43
  "label.total_disc_amt": "[ko] total disc amt",
44
- "label.tax_rate": "[ko] tax rate",
45
- "text.purchase_order_updated": "[ko] purchase order updated",
46
- "text.there_is_duplicated_products_with_same_batch_no": "[ko] there is duplicated products with same batch no"
44
+ "label.tax_rate": "[ko] tax rate"
47
45
  }
@@ -41,7 +41,5 @@
41
41
  "label.unit_price": "[ms] unit price",
42
42
  "label.misc_amt": "[ms] misc amt",
43
43
  "label.total_disc_amt": "[ms] total disc amt",
44
- "label.tax_rate": "[ms] tax rate",
45
- "text.purchase_order_updated": "[ms] purchase order updated",
46
- "text.there_is_duplicated_products_with_same_batch_no": "[ms] there is duplicated products with same batch no"
44
+ "label.tax_rate": "[ms] tax rate"
47
45
  }
@@ -41,7 +41,5 @@
41
41
  "label.unit_price": "[zh] unit price",
42
42
  "label.misc_amt": "[zh] misc amt",
43
43
  "label.total_disc_amt": "[zh] total disc amt",
44
- "label.tax_rate": "[zh] tax rate",
45
- "text.purchase_order_updated": "[zh] purchase order updated",
46
- "text.there_is_duplicated_products_with_same_batch_no": "[zh] there is duplicated products with same batch no"
44
+ "label.tax_rate": "[zh] tax rate"
47
45
  }