@things-factory/tax-invoice 6.2.129 → 6.2.133

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.
Files changed (22) hide show
  1. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +2 -35
  2. package/client/pages/{tax-invoice-company/tax-invoice-company-importer.ts → tax-invoice-send/company-list-popup.ts} +61 -37
  3. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +142 -1
  4. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +0 -8
  5. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +3 -30
  6. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -1
  7. package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +65 -0
  8. package/dist-client/pages/tax-invoice-send/company-list-popup.js +199 -0
  9. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -0
  10. package/dist-client/pages/tax-invoice-send/supplier-list-popup.d.ts +77 -0
  11. package/dist-client/pages/tax-invoice-send/supplier-list-popup.js +209 -0
  12. package/dist-client/pages/tax-invoice-send/supplier-list-popup.js.map +1 -0
  13. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +7 -1
  14. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +128 -0
  15. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  16. package/dist-client/tsconfig.tsbuildinfo +1 -1
  17. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +14 -0
  18. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -1
  19. package/dist-server/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +5 -5
  21. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +11 -0
  22. package/translations/ko.json +2 -0
@@ -12,7 +12,6 @@ import { notify, openPopup } from '@operato/layout'
12
12
  import { OxPrompt } from '@operato/popup'
13
13
  import { isMobileDevice } from '@operato/utils'
14
14
  import gql from 'graphql-tag'
15
- import { TaxInvoiceCompanyImporter } from './tax-invoice-company-importer'
16
15
 
17
16
  @customElement('tax-invoice-company-list-page')
18
17
  export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
@@ -31,12 +30,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
31
30
  `
32
31
  ]
33
32
 
34
- static get scopedElements() {
35
- return {
36
- 'tax-invoice-company-importer': TaxInvoiceCompanyImporter
37
- }
38
- }
39
-
40
33
  @property({ type: Object }) gristConfig: any
41
34
  @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
42
35
 
@@ -61,9 +54,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
61
54
  exportable: {
62
55
  name: i18next.t('title.tax invoice company list'),
63
56
  data: this.exportHandler.bind(this)
64
- },
65
- importable: {
66
- handler: this.importHandler.bind(this)
67
57
  }
68
58
  }
69
59
  }
@@ -134,7 +124,7 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
134
124
  {
135
125
  type: 'string',
136
126
  name: 'businessName',
137
- header: i18next.t('field.business name'),
127
+ header: i18next.t('field.tax invoice business name'),
138
128
  record: {
139
129
  editable: true
140
130
  },
@@ -143,7 +133,7 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
143
133
  {
144
134
  type: 'string',
145
135
  name: 'representativeName',
146
- header: i18next.t('field.representative name'),
136
+ header: i18next.t('field.tax invoice representative name'),
147
137
  record: {
148
138
  editable: true
149
139
  },
@@ -438,27 +428,4 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
438
428
  return tempObj
439
429
  })
440
430
  }
441
-
442
- async importHandler(records) {
443
- const popup = openPopup(
444
- html`
445
- <tax-invoice-company-importer
446
- .taxInvoiceCompanies=${records}
447
- @imported=${() => {
448
- history.back()
449
- this.grist.fetch()
450
- }}
451
- ></tax-invoice-company-importer>
452
- `,
453
- {
454
- backdrop: true,
455
- size: 'large',
456
- title: i18next.t('title.import tax invoice company')
457
- }
458
- )
459
-
460
- popup.onclosed = () => {
461
- this.grist.fetch()
462
- }
463
- }
464
431
  }
@@ -1,14 +1,11 @@
1
1
  import '@operato/data-grist'
2
2
 
3
- import gql from 'graphql-tag'
4
3
  import { css, html, LitElement } from 'lit'
5
- import { property } from 'lit/decorators.js'
6
-
7
- import { client } from '@operato/graphql'
4
+ import { property, query } from 'lit/decorators.js'
5
+ import { DataGrist } from '@operato/data-grist'
8
6
  import { i18next } from '@operato/i18n'
9
- import { isMobileDevice } from '@operato/utils'
10
7
 
11
- export class TaxInvoiceCompanyImporter extends LitElement {
8
+ export class CompanyListPopup extends LitElement {
12
9
  static styles = [
13
10
  css`
14
11
  :host {
@@ -34,132 +31,159 @@ export class TaxInvoiceCompanyImporter extends LitElement {
34
31
  `
35
32
  ]
36
33
 
37
- @property({ type: Array }) taxInvoiceCompanies: any[] = []
34
+ @query('ox-grist') private grist!: DataGrist
35
+
36
+ @property({ type: Array }) companyList: any[] = []
38
37
  @property({ type: Object }) columns = {
39
- list: { fields: ['name', 'description'] },
40
38
  pagination: { infinite: true },
41
39
  columns: [
40
+ { type: 'gutter', gutterName: 'sequence' },
41
+ { type: 'gutter', gutterName: 'row-selector', multiple: false },
42
42
  {
43
43
  type: 'string',
44
44
  name: 'name',
45
45
  header: i18next.t('field.name'),
46
+ record: {
47
+ editable: false
48
+ },
49
+ filter: 'search',
50
+ sortable: true,
46
51
  width: 150
47
52
  },
48
- {
49
- type: 'string',
50
- name: 'description',
51
- header: i18next.t('field.description'),
52
- width: 200
53
- },
54
53
  {
55
54
  type: 'string',
56
55
  name: 'businessRegistrationNumber',
57
56
  header: i18next.t('field.business registration number'),
57
+ record: {
58
+ editable: false
59
+ },
58
60
  width: 150
59
61
  },
60
62
  {
61
63
  type: 'string',
62
64
  name: 'branchIdentification',
63
65
  header: i18next.t('field.branch identification'),
66
+ record: {
67
+ editable: false
68
+ },
64
69
  width: 150
65
70
  },
66
71
  {
67
72
  type: 'string',
68
73
  name: 'businessName',
69
74
  header: i18next.t('field.tax invoice business name'),
75
+ record: {
76
+ editable: false
77
+ },
70
78
  width: 150
71
79
  },
72
80
  {
73
81
  type: 'string',
74
82
  name: 'representativeName',
75
83
  header: i18next.t('field.tax invoice representative name'),
84
+ record: {
85
+ editable: false
86
+ },
76
87
  width: 150
77
88
  },
78
89
  {
79
90
  type: 'string',
80
91
  name: 'address',
81
92
  header: i18next.t('field.address'),
93
+ record: {
94
+ editable: false
95
+ },
82
96
  width: 200
83
97
  },
84
98
  {
85
99
  type: 'string',
86
100
  name: 'businessType',
87
101
  header: i18next.t('field.business type'),
102
+ record: {
103
+ editable: false
104
+ },
88
105
  width: 100
89
106
  },
90
107
  {
91
108
  type: 'string',
92
109
  name: 'industryType',
93
110
  header: i18next.t('field.industry type'),
111
+ record: {
112
+ editable: false
113
+ },
94
114
  width: 100
95
115
  },
96
116
  {
97
117
  type: 'string',
98
118
  name: 'department',
99
119
  header: i18next.t('field.department'),
120
+ record: {
121
+ editable: false
122
+ },
100
123
  width: 150
101
124
  },
102
125
  {
103
126
  type: 'string',
104
127
  name: 'contactName',
105
128
  header: i18next.t('field.contact name'),
129
+ record: {
130
+ editable: false
131
+ },
106
132
  width: 150
107
133
  },
108
134
  {
109
135
  type: 'string',
110
136
  name: 'contactPhone',
111
137
  header: i18next.t('field.contact phone'),
138
+ record: {
139
+ editable: false
140
+ },
112
141
  width: 150
113
142
  },
114
143
  {
115
144
  type: 'string',
116
145
  name: 'contactEmail',
117
146
  header: i18next.t('field.contact email'),
147
+ record: {
148
+ editable: false
149
+ },
118
150
  width: 150
119
151
  },
120
152
  {
121
153
  type: 'string',
122
154
  name: 'contactCellPhone',
123
155
  header: i18next.t('field.contact cell phone'),
124
- width: 150
125
- },
126
- {
127
- type: 'attributes',
128
- name: 'attributes',
129
- header: i18next.t('field.attributes'),
156
+ record: {
157
+ editable: false
158
+ },
130
159
  width: 150
131
160
  }
132
- ]
161
+ ],
162
+ rows: {
163
+ selectable: {
164
+ multiple: false
165
+ },
166
+ appendable: false
167
+ }
133
168
  }
134
169
 
135
170
  render() {
136
171
  return html`
137
172
  <ox-grist
138
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
173
+ .mode=${'GRID'}
139
174
  .config=${this.columns}
140
175
  .data=${{
141
- records: this.taxInvoiceCompanies
176
+ records: this.companyList
142
177
  }}
143
178
  ></ox-grist>
144
179
 
145
180
  <div class="button-container">
146
- <mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
181
+ <mwc-button raised @click="${this.select.bind(this)}">${i18next.t('button.select')}</mwc-button>
147
182
  </div>
148
183
  `
149
184
  }
150
185
 
151
- async save() {
152
- const response = await client.mutate({
153
- mutation: gql`
154
- mutation importTaxInvoiceCompanies($taxInvoiceCompanies: [TaxInvoiceCompanyPatch!]!) {
155
- importTaxInvoiceCompanies(taxInvoiceCompanies: $taxInvoiceCompanies)
156
- }
157
- `,
158
- variables: { taxInvoiceCompanies: this.taxInvoiceCompanies }
159
- })
160
-
161
- if (response.errors?.length) return
162
-
163
- this.dispatchEvent(new CustomEvent('imported'))
186
+ async select() {
187
+ this.dispatchEvent(new CustomEvent('selected', { detail: this.grist.selected[0] }))
164
188
  }
165
189
  }
@@ -10,6 +10,8 @@ import { i18next, localize } from '@operato/i18n'
10
10
  import { notify } from '@operato/layout'
11
11
  import gql from 'graphql-tag'
12
12
  import { BUSINESS_REGISTRATION_CATEGORY, BusinessRegistrationCategory, Category, INVOICE_TYPE, InvoiceType, PURPOSE, Purpose } from '../tax-invoice/tax-invoice-list-page'
13
+ import { openPopup } from '@operato/layout'
14
+ import { CompanyListPopup } from './company-list-popup'
13
15
 
14
16
  const SHORT_INVOICE_TYPE = {
15
17
  TAX_INVOICE: {
@@ -31,7 +33,7 @@ const SHORT_BUSINESS_REGISTRATION_CATEGORY = {
31
33
  [BusinessRegistrationCategory.FOREIGNER_REGISTRATION_NUMBER]: '외국인'
32
34
  }
33
35
 
34
- interface Supplier {
36
+ export interface Supplier {
35
37
  supplierBusinessRegistrationCategory: string
36
38
  supplierBusinessRegistrationNumber: string
37
39
  supplierBranchIdentification?: string
@@ -237,6 +239,14 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
237
239
  }
238
240
  }
239
241
 
242
+ div.header {
243
+ display: flex;
244
+
245
+ span {
246
+ flex: 1;
247
+ }
248
+ }
249
+
240
250
  div.info {
241
251
  margin-top: 15px;
242
252
  border: solid;
@@ -357,6 +367,12 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
357
367
  `
358
368
  ]
359
369
 
370
+ static get scopedElements() {
371
+ return {
372
+ 'company-list-popup': CompanyListPopup
373
+ }
374
+ }
375
+
360
376
  // 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
361
377
  private today: string = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date())
362
378
 
@@ -445,6 +461,11 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
445
461
  </div>
446
462
 
447
463
  <div class="body">
464
+ <div class="header">
465
+ <span><button @click=${this._openSupplierPopup}>공급처 선택</button></span>
466
+ <span><button @click=${this._openBuyerPopup}>공급받는자 선택</button></span>
467
+ </div>
468
+
448
469
  <div class="data">
449
470
  <table class="supplier">
450
471
  <colgroup>
@@ -835,6 +856,126 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
835
856
  this.taxInvoiceItems[idx][target.name] = inputVal
836
857
  }
837
858
 
859
+ private async _openSupplierPopup() {
860
+ const response = await client.query({
861
+ query: gql`
862
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
863
+ responses: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {
864
+ items {
865
+ id
866
+ name: provider
867
+ businessRegistrationNumber
868
+ branchIdentification
869
+ businessName
870
+ representativeName
871
+ address
872
+ businessType
873
+ industryType
874
+ department
875
+ contactName
876
+ contactPhone
877
+ contactEmail
878
+ contactCellPhone
879
+ }
880
+ }
881
+ }
882
+ `
883
+ })
884
+
885
+ const items = response.data.responses.items || []
886
+ openPopup(
887
+ html`
888
+ <company-list-popup
889
+ .companyList=${items}
890
+ @selected=${e => {
891
+ this.supplier = {
892
+ supplierBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
893
+ supplierBusinessRegistrationNumber: e.detail.businessRegistrationNumber || '',
894
+ supplierBranchIdentification: e.detail.branchIdentification || '',
895
+ supplierBusinessName: e.detail.businessName || '',
896
+ supplierRepresentativeName: e.detail.representativeName || '',
897
+ supplierAddress: e.detail.address || '',
898
+ supplierBusinessType: e.detail.businessType || '',
899
+ supplierIndustryType: e.detail.industryType || '',
900
+ supplierDepartment: e.detail.department || '',
901
+ supplierContactName: e.detail.contactName || '',
902
+ supplierContactPhone: e.detail.contactPhone || '',
903
+ supplierContactEmail: e.detail.contactEmail || '',
904
+ supplierContactCellPhone: e.detail.contactCellPhone || ''
905
+ }
906
+
907
+ history.back()
908
+ }}
909
+ >
910
+ </company-list-popup>
911
+ `,
912
+ {
913
+ backdrop: true,
914
+ size: 'large',
915
+ title: i18next.t('title.company list popup')
916
+ }
917
+ )
918
+ }
919
+
920
+ private async _openBuyerPopup() {
921
+ const response = await client.query({
922
+ query: gql`
923
+ query TaxInvoiceBuyerList {
924
+ responses: taxInvoiceBuyerList {
925
+ id
926
+ name
927
+ businessRegistrationNumber
928
+ branchIdentification
929
+ businessName
930
+ representativeName
931
+ address
932
+ businessType
933
+ industryType
934
+ department
935
+ contactName
936
+ contactPhone
937
+ contactEmail
938
+ contactCellPhone
939
+ }
940
+ }
941
+ `
942
+ })
943
+
944
+ const items = response.data.responses || []
945
+ openPopup(
946
+ html`
947
+ <company-list-popup
948
+ .companyList=${items}
949
+ @selected=${e => {
950
+ this.buyer = {
951
+ buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
952
+ buyerBusinessRegistrationNumber: e.detail.businessRegistrationNumber || '',
953
+ buyerBranchIdentification: e.detail.branchIdentification || '',
954
+ buyerBusinessName: e.detail.businessName || '',
955
+ buyerRepresentativeName: e.detail.representativeName || '',
956
+ buyerAddress: e.detail.address || '',
957
+ buyerBusinessType: e.detail.businessType || '',
958
+ buyerIndustryType: e.detail.industryType || '',
959
+ buyer1stDepartment: e.detail.department || '',
960
+ buyer1stContactName: e.detail.contactName || '',
961
+ buyer1stContactPhone: e.detail.contactPhone || '',
962
+ buyer1stContactEmail: e.detail.contactEmail || '',
963
+ buyer1stContactCellPhone: e.detail.contactCellPhone || ''
964
+ }
965
+
966
+ history.back()
967
+ }}
968
+ >
969
+ </company-list-popup>
970
+ `,
971
+ {
972
+ backdrop: true,
973
+ size: 'large',
974
+ title: i18next.t('title.company list popup')
975
+ }
976
+ )
977
+ }
978
+
838
979
  private _onAddInvoiceItem(e: Event) {
839
980
  e.preventDefault()
840
981
  if (this.taxInvoiceItems.length >= 16) {
@@ -1,13 +1,9 @@
1
1
  import '@operato/data-grist';
2
2
  import { PageView } from '@operato/shell';
3
3
  import { FetchOption } from '@operato/data-grist';
4
- import { TaxInvoiceCompanyImporter } from './tax-invoice-company-importer';
5
4
  declare const TaxInvoiceCompanyListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
6
5
  export declare class TaxInvoiceCompanyListPage extends TaxInvoiceCompanyListPage_base {
7
6
  static styles: import("lit").CSSResult[];
8
- static get scopedElements(): {
9
- 'tax-invoice-company-importer': typeof TaxInvoiceCompanyImporter;
10
- };
11
7
  gristConfig: any;
12
8
  mode: 'CARD' | 'GRID' | 'LIST';
13
9
  private grist;
@@ -29,9 +25,6 @@ export declare class TaxInvoiceCompanyListPage extends TaxInvoiceCompanyListPage
29
25
  name: string;
30
26
  data: () => Promise<{}[]>;
31
27
  };
32
- importable: {
33
- handler: (records: any) => Promise<void>;
34
- };
35
28
  };
36
29
  render(): import("lit-html").TemplateResult<1>;
37
30
  pageInitialized(lifecycle: any): Promise<void>;
@@ -44,6 +37,5 @@ export declare class TaxInvoiceCompanyListPage extends TaxInvoiceCompanyListPage
44
37
  _updateTaxInvoiceCompany(): Promise<void>;
45
38
  getAttributeSetForDomain(): Promise<any>;
46
39
  exportHandler(): Promise<{}[]>;
47
- importHandler(records: any): Promise<void>;
48
40
  }
49
41
  export {};
@@ -8,21 +8,15 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
8
8
  import { DataGrist } from '@operato/data-grist';
9
9
  import { client } from '@operato/graphql';
10
10
  import { i18next, localize } from '@operato/i18n';
11
- import { notify, openPopup } from '@operato/layout';
11
+ import { notify } from '@operato/layout';
12
12
  import { OxPrompt } from '@operato/popup';
13
13
  import { isMobileDevice } from '@operato/utils';
14
14
  import gql from 'graphql-tag';
15
- import { TaxInvoiceCompanyImporter } from './tax-invoice-company-importer';
16
15
  let TaxInvoiceCompanyListPage = class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
17
16
  constructor() {
18
17
  super(...arguments);
19
18
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
20
19
  }
21
- static get scopedElements() {
22
- return {
23
- 'tax-invoice-company-importer': TaxInvoiceCompanyImporter
24
- };
25
- }
26
20
  get context() {
27
21
  return {
28
22
  title: i18next.t('title.tax invoice company list'),
@@ -34,9 +28,6 @@ let TaxInvoiceCompanyListPage = class TaxInvoiceCompanyListPage extends localize
34
28
  exportable: {
35
29
  name: i18next.t('title.tax invoice company list'),
36
30
  data: this.exportHandler.bind(this)
37
- },
38
- importable: {
39
- handler: this.importHandler.bind(this)
40
31
  }
41
32
  };
42
33
  }
@@ -104,7 +95,7 @@ let TaxInvoiceCompanyListPage = class TaxInvoiceCompanyListPage extends localize
104
95
  {
105
96
  type: 'string',
106
97
  name: 'businessName',
107
- header: i18next.t('field.business name'),
98
+ header: i18next.t('field.tax invoice business name'),
108
99
  record: {
109
100
  editable: true
110
101
  },
@@ -113,7 +104,7 @@ let TaxInvoiceCompanyListPage = class TaxInvoiceCompanyListPage extends localize
113
104
  {
114
105
  type: 'string',
115
106
  name: 'representativeName',
116
- header: i18next.t('field.representative name'),
107
+ header: i18next.t('field.tax invoice representative name'),
117
108
  record: {
118
109
  editable: true
119
110
  },
@@ -393,24 +384,6 @@ let TaxInvoiceCompanyListPage = class TaxInvoiceCompanyListPage extends localize
393
384
  return tempObj;
394
385
  });
395
386
  }
396
- async importHandler(records) {
397
- const popup = openPopup(html `
398
- <tax-invoice-company-importer
399
- .taxInvoiceCompanies=${records}
400
- @imported=${() => {
401
- history.back();
402
- this.grist.fetch();
403
- }}
404
- ></tax-invoice-company-importer>
405
- `, {
406
- backdrop: true,
407
- size: 'large',
408
- title: i18next.t('title.import tax invoice company')
409
- });
410
- popup.onclosed = () => {
411
- this.grist.fetch();
412
- };
413
- }
414
387
  };
415
388
  TaxInvoiceCompanyListPage.styles = [
416
389
  ScrollbarStyles,
@@ -1 +1 @@
1
- {"version":3,"file":"tax-invoice-company-list-page.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice-company/tax-invoice-company-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAe,MAAM,q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C,kCAAkC,CAAC;SACrD,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;;AA5bM,gCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAQD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;wDAAA;AAzBjC,yBAAyB;IADrC,aAAa,CAAC,+BAA+B,CAAC;GAClC,yBAAyB,CA8brC;SA9bY,yBAAyB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport gql from 'graphql-tag'\nimport { TaxInvoiceCompanyImporter } from './tax-invoice-company-importer'\n\n@customElement('tax-invoice-company-list-page')\nexport class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'tax-invoice-company-importer': TaxInvoiceCompanyImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.tax invoice company list'),\n help: 'tax-invoice-company/tax-invoice-company',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateTaxInvoiceCompany.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteTaxInvoiceCompany.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.tax invoice company list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['name', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true,\n classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'businessRegistrationNumber',\n header: i18next.t('field.business registration number'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'branchIdentification',\n header: i18next.t('field.branch identification'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'businessName',\n header: i18next.t('field.business name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'representativeName',\n header: i18next.t('field.representative name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'address',\n header: i18next.t('field.address'),\n record: {\n editable: true\n },\n width: 200\n },\n {\n type: 'string',\n name: 'businessType',\n header: i18next.t('field.business type'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'string',\n name: 'industryType',\n header: i18next.t('field.industry type'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'string',\n name: 'department',\n header: i18next.t('field.department'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactName',\n header: i18next.t('field.contact name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactPhone',\n header: i18next.t('field.contact phone'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactEmail',\n header: i18next.t('field.contact email'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactCellPhone',\n header: i18next.t('field.contact cell phone'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n record: {\n editable: true,\n options: async () => {\n return {\n objectified: true,\n attributeSet: await this.getAttributeSetForDomain()\n }\n }\n },\n width: 150\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: taxInvoiceCompanies(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n businessRegistrationNumber\n branchIdentification\n businessName\n representativeName\n address\n businessType\n industryType\n department\n contactName\n contactPhone\n contactEmail\n contactCellPhone\n attributes\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteTaxInvoiceCompany() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteTaxInvoiceCompanies(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateTaxInvoiceCompany() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = key === 'type' ? Number(dirtyFields[key].after) : dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [TaxInvoiceCompanyPatch!]!) {\n updateMultipleTaxInvoiceCompany(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async getAttributeSetForDomain() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"Domain\") {\n entity\n description\n items {\n name\n description\n tag\n type\n active\n hidden\n options\n }\n }\n }\n `\n })\n\n return response.data?.attributeSet || {}\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'name',\n 'description',\n 'businessRegistrationNumber',\n 'branchIdentification',\n 'businessName',\n 'representativeName',\n 'address',\n 'businessType',\n 'industryType',\n 'department',\n 'contactName',\n 'contactPhone',\n 'contactEmail',\n 'contactCellPhone',\n 'attributes'\n ])\n\n return exportTargets.map(taxInvoice => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = taxInvoice[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <tax-invoice-company-importer\n .taxInvoiceCompanies=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></tax-invoice-company-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import tax invoice company')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"tax-invoice-company-list-page.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice-company/tax-invoice-company-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EA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AQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAA;QACrG,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;YAC7B,IAAI;YACJ,MAAM;YACN,aAAa;YACb,4BAA4B;YAC5B,sBAAsB;YACtB,cAAc;YACd,oBAAoB;YACpB,SAAS;YACT,cAAc;YACd,cAAc;YACd,YAAY;YACZ,aAAa;YACb,cAAc;YACd,cAAc;YACd,kBAAkB;YAClB,YAAY;SACb,CAAC,CAAA;QAEF,OAAO,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YACpC,IAAI,OAAO,GAAG,EAAE,CAAA;YAChB,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;aACnC;YAED,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC;;AA5ZM,gCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;wDAAA;AAnBjC,yBAAyB;IADrC,aAAa,CAAC,+BAA+B,CAAC;GAClC,yBAAyB,CA8ZrC;SA9ZY,yBAAyB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport gql from 'graphql-tag'\n\n@customElement('tax-invoice-company-list-page')\nexport class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.tax invoice company list'),\n help: 'tax-invoice-company/tax-invoice-company',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateTaxInvoiceCompany.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteTaxInvoiceCompany.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.tax invoice company list'),\n data: this.exportHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['name', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true,\n classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'businessRegistrationNumber',\n header: i18next.t('field.business registration number'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'branchIdentification',\n header: i18next.t('field.branch identification'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'businessName',\n header: i18next.t('field.tax invoice business name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'representativeName',\n header: i18next.t('field.tax invoice representative name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'address',\n header: i18next.t('field.address'),\n record: {\n editable: true\n },\n width: 200\n },\n {\n type: 'string',\n name: 'businessType',\n header: i18next.t('field.business type'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'string',\n name: 'industryType',\n header: i18next.t('field.industry type'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'string',\n name: 'department',\n header: i18next.t('field.department'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactName',\n header: i18next.t('field.contact name'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactPhone',\n header: i18next.t('field.contact phone'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactEmail',\n header: i18next.t('field.contact email'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'contactCellPhone',\n header: i18next.t('field.contact cell phone'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n record: {\n editable: true,\n options: async () => {\n return {\n objectified: true,\n attributeSet: await this.getAttributeSetForDomain()\n }\n }\n },\n width: 150\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: taxInvoiceCompanies(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n businessRegistrationNumber\n branchIdentification\n businessName\n representativeName\n address\n businessType\n industryType\n department\n contactName\n contactPhone\n contactEmail\n contactCellPhone\n attributes\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteTaxInvoiceCompany() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteTaxInvoiceCompanies(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateTaxInvoiceCompany() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = key === 'type' ? Number(dirtyFields[key].after) : dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [TaxInvoiceCompanyPatch!]!) {\n updateMultipleTaxInvoiceCompany(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async getAttributeSetForDomain() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"Domain\") {\n entity\n description\n items {\n name\n description\n tag\n type\n active\n hidden\n options\n }\n }\n }\n `\n })\n\n return response.data?.attributeSet || {}\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'name',\n 'description',\n 'businessRegistrationNumber',\n 'branchIdentification',\n 'businessName',\n 'representativeName',\n 'address',\n 'businessType',\n 'industryType',\n 'department',\n 'contactName',\n 'contactPhone',\n 'contactEmail',\n 'contactCellPhone',\n 'attributes'\n ])\n\n return exportTargets.map(taxInvoice => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = taxInvoice[field]\n }\n\n return tempObj\n })\n }\n}\n"]}