@things-factory/sales-ui 4.3.81 → 4.3.82

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.
@@ -839,6 +839,10 @@ class PurchaseOrderApprovalDetail extends connect(store)(localize(i18next)(PageV
839
839
  brand
840
840
  description
841
841
  }
842
+ productDetail {
843
+ id
844
+ name
845
+ }
842
846
  adjustedBatchId
843
847
  remark
844
848
  status
@@ -2,6 +2,7 @@ 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'
5
6
 
6
7
  import gql from 'graphql-tag'
7
8
  import { css, html } from 'lit-element'
@@ -522,29 +523,13 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
522
523
  width: 150
523
524
  },
524
525
  {
525
- type: 'object',
526
- name: 'product',
526
+ type: 'string',
527
+ name: 'productName',
527
528
  header: i18next.t('field.product'),
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'] }
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)
548
533
  }
549
534
  },
550
535
  width: 350
@@ -1038,6 +1023,10 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1038
1023
  brand
1039
1024
  description
1040
1025
  }
1026
+ productDetail {
1027
+ id
1028
+ name
1029
+ }
1041
1030
  adjustedBatchId
1042
1031
  remark
1043
1032
  status
@@ -1210,6 +1199,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1210
1199
  id: record.id || null,
1211
1200
  batchId: record.batchId,
1212
1201
  product: { id: record.product.id },
1202
+ productDetail: record.productDetailId ? { id: record.productDetailId } : { id: record.productDetail.id },
1213
1203
  packingType: record.packingType,
1214
1204
  uomValue: record?.uomValue ? record.uomValue : 0,
1215
1205
  uom: record.uom,
@@ -1476,6 +1466,59 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1476
1466
  return productGrist
1477
1467
  }
1478
1468
 
1469
+ _openProductSelection(rowIndex) {
1470
+ if (this._purchaseOrderData?.bizplace?.id) {
1471
+ openPopup(
1472
+ html`
1473
+ <select-product-popup
1474
+ .bizplaceId="${this._purchaseOrderData?.bizplace?.id}"
1475
+ @selected="${e => {
1476
+ // let newRecord = []
1477
+ // newRecord.push(e.detail)
1478
+
1479
+ if (this.productGrist.dirtyData.records.length !== rowIndex) {
1480
+ // update existing product data records
1481
+ this.productGrist.dirtyData.records.splice(rowIndex, 1, {
1482
+ ...this.productGrist.dirtyData.records[rowIndex],
1483
+ ...e.detail
1484
+ })
1485
+
1486
+ this.productGrist.dirtyData.records = this.productGrist.dirtyData.records.map(item => {
1487
+ return {
1488
+ ...item,
1489
+ totalUomValue:
1490
+ item?.packQty > 0
1491
+ ? item?.totalUomValue
1492
+ ? item.totalUomValue
1493
+ : `${parseFloat(item.packQty * e.detail.uomValue).toFixed(2)} ${e.detail.uom}`
1494
+ : null
1495
+ }
1496
+ })
1497
+
1498
+ this.productData = {
1499
+ ...this.productData,
1500
+ records: [...this.productGrist.dirtyData.records]
1501
+ }
1502
+ } else {
1503
+ this.productData = {
1504
+ ...this.productData,
1505
+ records: [...this.productGrist.dirtyData.records, e.detail]
1506
+ }
1507
+ }
1508
+ }}"
1509
+ ></select-product-popup>
1510
+ `,
1511
+ {
1512
+ backdrop: true,
1513
+ size: 'large',
1514
+ title: i18next.t('title.select_item')
1515
+ }
1516
+ )
1517
+ } else {
1518
+ this._showToast({ message: i18next.t('text.company_selection_is_empty') })
1519
+ }
1520
+ }
1521
+
1479
1522
  async _exportableData() {
1480
1523
  try {
1481
1524
  var headerSetting = [
@@ -1526,6 +1569,10 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1526
1569
  primaryUnit
1527
1570
  primaryValue
1528
1571
  }
1572
+ productDetail {
1573
+ id
1574
+ name
1575
+ }
1529
1576
  }
1530
1577
  }
1531
1578
  `,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/sales-ui",
3
- "version": "4.3.81",
3
+ "version": "4.3.82",
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.78",
28
- "@things-factory/form-ui": "^4.3.78",
29
- "@things-factory/grist-ui": "^4.3.78",
30
- "@things-factory/i18n-base": "^4.3.78",
31
- "@things-factory/import-ui": "^4.3.78",
32
- "@things-factory/sales-base": "^4.3.81",
33
- "@things-factory/setting-ui": "^4.3.78",
34
- "@things-factory/shell": "^4.3.78",
35
- "@things-factory/warehouse-ui": "^4.3.81"
27
+ "@things-factory/code-base": "^4.3.82",
28
+ "@things-factory/form-ui": "^4.3.82",
29
+ "@things-factory/grist-ui": "^4.3.82",
30
+ "@things-factory/i18n-base": "^4.3.82",
31
+ "@things-factory/import-ui": "^4.3.82",
32
+ "@things-factory/sales-base": "^4.3.82",
33
+ "@things-factory/setting-ui": "^4.3.82",
34
+ "@things-factory/shell": "^4.3.82",
35
+ "@things-factory/warehouse-ui": "^4.3.82"
36
36
  },
37
- "gitHead": "42c857ad7bcd48adb8da6e514c6e30b41040d04f"
37
+ "gitHead": "fb0cb65bba75de2d2d0784202138d6d79dafa274"
38
38
  }