@things-factory/sales-ui 3.8.25 → 3.8.29

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.
@@ -13,7 +13,7 @@ import { openPopup } from '@things-factory/layout-base'
13
13
  import { fetchSettingRule } from '@things-factory/setting-ui'
14
14
  import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
15
15
  import { CommonButtonStyles } from '@things-factory/styles'
16
- import { flattenObject, gqlBuilder, isMobileDevice } from '@things-factory/utils'
16
+ import { flattenObject, isMobileDevice } from '@things-factory/utils'
17
17
 
18
18
  import { PURCHASE_ORDER_STATUS } from '../../constants'
19
19
 
@@ -912,7 +912,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
912
912
  purchaseOrder.orderProducts = this._getOrderProducts()
913
913
  purchaseOrder.otherCharges = this._getPoOtherCharges()
914
914
 
915
- const attachments = this._document?.files ? this._document.files : undefined
915
+ const fileUploader = this._document?.files ? this._document.files : undefined
916
916
 
917
917
  const objectNames = [
918
918
  'bizplace|name',
@@ -931,30 +931,25 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
931
931
  delete purchaseOrder[objectName]
932
932
  })
933
933
 
934
- const args = {
935
- purchaseOrder: {
936
- ...purchaseOrder,
937
- status,
938
- ownTransport: this._purchaseOrderData?.importCargo ? true : this._purchaseOrderData?.ownTransport,
939
- supplier: { id: purchaseOrder?.supplier?.id }
940
- }
941
- }
942
-
943
- const response = await client.query({
944
- query: gql`
945
- mutation ($attachments: Upload) {
946
- upsertPurchaseOrder(${gqlBuilder.buildArgs(args)}, file:$attachments) {
947
- id
948
- name
949
- }
934
+ const response = await client.mutate({
935
+ mutation: gql`
936
+ mutation upsertPurchaseOrder($purchaseOrder: PurchaseOrderPatch!, $files: [Upload!]) {
937
+ upsertPurchaseOrder(purchaseOrder: $purchaseOrder, files: $files) {
938
+ id
939
+ name
950
940
  }
951
- `,
941
+ }
942
+ `,
952
943
  variables: {
953
- attachments
944
+ purchaseOrder: {
945
+ ...purchaseOrder,
946
+ status,
947
+ ownTransport: this._purchaseOrderData?.importCargo ? true : this._purchaseOrderData?.ownTransport,
948
+ supplier: { id: purchaseOrder?.supplier?.id }
949
+ },
950
+ files: fileUploader
954
951
  },
955
- context: {
956
- hasUpload: true
957
- }
952
+ context: { hasUpload: true }
958
953
  })
959
954
 
960
955
  if (!response.errors) {
@@ -984,10 +979,8 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
984
979
  this._status = ''
985
980
  const response = await client.query({
986
981
  query: gql`
987
- query {
988
- purchaseOrder(${gqlBuilder.buildArgs({
989
- name: this._poNo
990
- })}) {
982
+ query purchaseOrder($name: String!) {
983
+ purchaseOrder(name: $name) {
991
984
  id
992
985
  name
993
986
  remark
@@ -1051,13 +1044,13 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1051
1044
  name
1052
1045
  description
1053
1046
  }
1054
- supplier{
1047
+ supplier {
1055
1048
  id
1056
1049
  name
1057
1050
  companyName
1058
1051
  description
1059
1052
  }
1060
- bufferLocation{
1053
+ bufferLocation {
1061
1054
  id
1062
1055
  name
1063
1056
  description
@@ -1076,7 +1069,8 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1076
1069
  }
1077
1070
  }
1078
1071
  }
1079
- `
1072
+ `,
1073
+ variables: { name: this._poNo }
1080
1074
  })
1081
1075
 
1082
1076
  if (!response.errors) {
@@ -1276,7 +1270,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1276
1270
  html`
1277
1271
  <contact-points-popup
1278
1272
  type="SUPPLIER"
1279
- partnerBizplaceId=${this.partnerBizplaceId}
1273
+ partnerBizplaceId=${this.partnerBizplaceId ? this.partnerBizplaceId : this._purchaseOrderData.bizplace?.id}
1280
1274
  @selected="${e => {
1281
1275
  this._purchaseOrderData = {
1282
1276
  ...this._purchaseOrderData,
@@ -1,13 +1,14 @@
1
- import { getCodeByName } from '@things-factory/code-base'
2
1
  import '@things-factory/form-ui'
3
2
  import '@things-factory/grist-ui'
4
- import { i18next, localize } from '@things-factory/i18n-base'
5
- import { client, navigate, PageView } from '@things-factory/shell'
6
- import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
7
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
3
+
8
4
  import gql from 'graphql-tag'
9
5
  import { css, html } from 'lit-element'
10
- // import { ORDER_STATUS } from '../../constants'
6
+
7
+ import { getCodeByName } from '@things-factory/code-base'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, navigate, PageView } from '@things-factory/shell'
10
+ import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
11
+ import { isMobileDevice } from '@things-factory/utils'
11
12
 
12
13
  class PurchaseOrderList extends localize(i18next)(PageView) {
13
14
  static get styles() {
@@ -242,12 +243,8 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
242
243
  async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
243
244
  const response = await client.query({
244
245
  query: gql`
245
- query {
246
- purchaseOrders(${gqlBuilder.buildArgs({
247
- filters: this.searchForm.queryFilters,
248
- pagination: { page, limit },
249
- sortings: sorters
250
- })}) {
246
+ query purchaseOrders($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
247
+ purchaseOrders(filters: $filters, pagination: $pagination, sortings: $sortings) {
251
248
  items {
252
249
  id
253
250
  name
@@ -263,8 +260,8 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
263
260
  container
264
261
  ownTransport
265
262
  importCargo
266
- currency
267
- arrivalNotice{
263
+ currency
264
+ arrivalNotice {
268
265
  id
269
266
  name
270
267
  description
@@ -274,7 +271,7 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
274
271
  name
275
272
  description
276
273
  }
277
- supplier{
274
+ supplier {
278
275
  id
279
276
  name
280
277
  description
@@ -295,7 +292,12 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
295
292
  total
296
293
  }
297
294
  }
298
- `
295
+ `,
296
+ variables: {
297
+ filters: this.searchForm.queryFilters,
298
+ pagination: { page, limit },
299
+ sortings: sorters
300
+ }
299
301
  })
300
302
 
301
303
  if (!response.errors) {
@@ -317,12 +319,8 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
317
319
  async _fetchContactPoints() {
318
320
  const response = await client.query({
319
321
  query: gql`
320
- query {
321
- contactPoints(${gqlBuilder.buildArgs({
322
- filters: [{ name: 'type', operator: 'eq', value: 'SUPPLIER' }],
323
- pagination: { page: 0, limit: 999999 },
324
- sortings: [{ name: 'name' }]
325
- })}) {
322
+ query contactPoints($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
323
+ contactPoints(filters: $filters, pagination: $pagination, sortings: $sortings) {
326
324
  items {
327
325
  id
328
326
  name
@@ -330,7 +328,12 @@ class PurchaseOrderList extends localize(i18next)(PageView) {
330
328
  }
331
329
  }
332
330
  }
333
- `
331
+ `,
332
+ variables: {
333
+ filters: [{ name: 'type', operator: 'eq', value: 'SUPPLIER' }],
334
+ pagination: { page: 0, limit: 999999 },
335
+ sortings: [{ name: 'name' }]
336
+ }
334
337
  })
335
338
 
336
339
  return response.data.contactPoints.items || []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/sales-ui",
3
- "version": "3.8.25",
3
+ "version": "3.8.29",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -29,10 +29,10 @@
29
29
  "@things-factory/grist-ui": "^3.7.5",
30
30
  "@things-factory/i18n-base": "^3.8.0",
31
31
  "@things-factory/import-ui": "^3.8.0",
32
- "@things-factory/sales-base": "^3.8.25",
32
+ "@things-factory/sales-base": "^3.8.29",
33
33
  "@things-factory/setting-ui": "^3.8.19",
34
34
  "@things-factory/shell": "^3.8.0",
35
- "@things-factory/warehouse-ui": "^3.8.25"
35
+ "@things-factory/warehouse-ui": "^3.8.29"
36
36
  },
37
- "gitHead": "65fc6a560f15143d908bb290e70f4f87f6575c7f"
37
+ "gitHead": "aab48875c1a169b2d75f9fe8aa6af029c3d5b3dd"
38
38
  }