@things-factory/tax-invoice 6.2.126 → 6.2.131

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 (57) hide show
  1. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +99 -61
  2. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +2 -67
  3. package/client/pages/{tax-invoice-company/tax-invoice-company-importer.ts → tax-invoice-send/company-list-popup.ts} +60 -46
  4. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +144 -3
  5. package/config/config.development.js +13 -0
  6. package/config/config.production.js +13 -0
  7. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +3 -2
  8. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +91 -61
  9. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
  10. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +2 -11
  11. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +0 -10
  12. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -1
  13. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +0 -16
  14. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +3 -62
  15. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -1
  16. package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +65 -0
  17. package/dist-client/pages/tax-invoice-send/company-list-popup.js +199 -0
  18. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -0
  19. package/dist-client/pages/tax-invoice-send/supplier-list-popup.d.ts +77 -0
  20. package/dist-client/pages/tax-invoice-send/supplier-list-popup.js +209 -0
  21. package/dist-client/pages/tax-invoice-send/supplier-list-popup.js.map +1 -0
  22. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +7 -1
  23. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +130 -2
  24. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  25. package/dist-client/tsconfig.tsbuildinfo +1 -1
  26. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +20 -12
  27. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  28. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +13 -7
  29. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
  30. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +3 -7
  31. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
  32. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +9 -21
  33. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
  34. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +41 -6
  35. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -1
  36. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +55 -5
  37. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -1
  38. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +1 -19
  39. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -1
  40. package/dist-server/service/unipost-api/tax-invoice-inquiry.js +6 -10
  41. package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
  42. package/dist-server/service/unipost-api/tax-invoice-send.js +4 -5
  43. package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -1
  44. package/dist-server/service/unipost-api/test-data.js +3812 -0
  45. package/dist-server/service/unipost-api/test-data.js.map +1 -0
  46. package/dist-server/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +3 -2
  48. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +34 -20
  49. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +12 -6
  50. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +2 -5
  51. package/server/service/tax-invoice-api/tax-invoice-api.ts +9 -19
  52. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +35 -5
  53. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +40 -4
  54. package/server/service/tax-invoice-company/tax-invoice-company.ts +0 -18
  55. package/server/service/unipost-api/tax-invoice-inquiry.ts +6 -10
  56. package/server/service/unipost-api/tax-invoice-send.ts +5 -5
  57. package/translations/ko.json +3 -0
@@ -11,6 +11,7 @@ import { i18next, localize } from '@operato/i18n'
11
11
  import { notify } from '@operato/layout'
12
12
  import { isMobileDevice } from '@operato/utils'
13
13
  import gql from 'graphql-tag'
14
+ import { OxPrompt } from '@operato/popup'
14
15
 
15
16
  @customElement('tax-invoice-api-page')
16
17
  export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
@@ -47,6 +48,11 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
47
48
  title: i18next.t('button.save'),
48
49
  action: this._updateTaxInvoiceApi.bind(this),
49
50
  ...CommonButtonStyles.save
51
+ },
52
+ {
53
+ title: i18next.t('button.delete'),
54
+ action: this._deleteTaxAuditResult.bind(this),
55
+ ...CommonButtonStyles.delete
50
56
  }
51
57
  ]
52
58
  }
@@ -68,25 +74,23 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
68
74
  { type: 'gutter', gutterName: 'sequence' },
69
75
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
70
76
  {
71
- type: 'string',
72
- name: 'name',
73
- header: i18next.t('field.name'),
77
+ type: 'boolean',
78
+ name: 'isDefault',
79
+ header: i18next.t('field.is_default'),
74
80
  record: {
75
81
  editable: true,
76
- classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })
82
+ align: 'center'
77
83
  },
78
- sortable: true,
79
- width: 150
84
+ width: 70
80
85
  },
81
86
  {
82
87
  type: 'string',
83
- name: 'description',
84
- header: i18next.t('field.description'),
88
+ name: 'provider',
89
+ header: i18next.t('field.provider'),
85
90
  record: {
86
91
  editable: true
87
92
  },
88
- filter: 'search',
89
- width: 200
93
+ width: 150
90
94
  },
91
95
  {
92
96
  type: 'string',
@@ -119,9 +123,7 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
119
123
  type: 'string',
120
124
  name: 'businessRegistrationNumber',
121
125
  header: i18next.t('field.business registration number'),
122
- record: {
123
- editable: true
124
- },
126
+ record: { editable: true },
125
127
  width: 150
126
128
  },
127
129
  {
@@ -256,78 +258,82 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
256
258
  },
257
259
  width: 180
258
260
  }
259
- ],
260
- rows: {
261
- selectable: {
262
- multiple: true
263
- },
264
- appendable: false
265
- }
261
+ ]
266
262
  }
267
263
  }
268
264
 
269
265
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
270
266
  const response = await client.query({
271
267
  query: gql`
272
- query TaxInvoiceApi {
273
- response: taxInvoiceApi {
274
- id
275
- name
276
- description
277
- apiKey
278
- apiAccountId
279
- apiAccountPassword
280
- businessRegistrationNumber
281
- branchIdentification
282
- businessName
283
- representativeName
284
- address
285
- businessType
286
- industryType
287
- department
288
- contactName
289
- contactPhone
290
- contactEmail
291
- contactCellPhone
292
- attributes
293
- updater {
268
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
269
+ responses: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {
270
+ items {
294
271
  id
295
- name
272
+ isDefault
273
+ provider
274
+ apiKey
275
+ apiAccountId
276
+ apiAccountPassword
277
+ businessRegistrationNumber
278
+ branchIdentification
279
+ businessName
280
+ representativeName
281
+ address
282
+ businessType
283
+ industryType
284
+ department
285
+ contactName
286
+ contactPhone
287
+ contactEmail
288
+ contactCellPhone
289
+ attributes
290
+ updater {
291
+ id
292
+ name
293
+ }
294
+ updatedAt
296
295
  }
297
- updatedAt
296
+ total
298
297
  }
299
298
  }
300
- `
299
+ `,
300
+ variables: {
301
+ filters,
302
+ pagination: { page, limit },
303
+ sortings
304
+ }
301
305
  })
302
306
 
303
- const records = response.data.response ? [response.data.response] : [{}]
304
-
305
307
  return {
306
- total: 1,
307
- records: records
308
+ total: response.data.responses.total || 0,
309
+ records: response.data.responses.items || []
308
310
  }
309
311
  }
310
312
 
311
313
  async _updateTaxInvoiceApi() {
312
- let patch = this.grist.dirtyRecords[0]
313
- if (patch) {
314
- let patchField: any = patch.id ? { id: patch.id } : {}
315
- const dirtyFields = patch.__dirtyfields__
316
- for (let key in dirtyFields) {
317
- patchField[key] = key === 'type' ? Number(dirtyFields[key].after) : dirtyFields[key].after
318
- }
319
- patchField.cuFlag = patch.id ? 'M' : '+'
314
+ let patches = this.grist.dirtyRecords
315
+ if (patches && patches.length) {
316
+ patches = patches.map(patch => {
317
+ let patchField: any = patch.id ? { id: patch.id } : {}
318
+ const dirtyFields = patch.__dirtyfields__
319
+ for (let key in dirtyFields) {
320
+ patchField[key] = dirtyFields[key].after
321
+ }
322
+ patchField.cuFlag = patch.__dirty__
323
+
324
+ return patchField
325
+ })
320
326
 
321
327
  const response = await client.mutate({
322
328
  mutation: gql`
323
- mutation ($patch: TaxInvoiceApiPatch!) {
324
- updateMultipleTaxInvoiceApi(patch: $patch) {
325
- name
329
+ mutation ($patches: [TaxInvoiceApiPatch!]!) {
330
+ updateMultipleTaxInvoiceApi(patches: $patches) {
331
+ provider
326
332
  }
327
333
  }
328
334
  `,
329
335
  variables: {
330
- patch: patchField
336
+ patches
331
337
  }
332
338
  })
333
339
 
@@ -363,4 +369,36 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
363
369
 
364
370
  return response.data?.attributeSet || {}
365
371
  }
372
+
373
+ async _deleteTaxAuditResult() {
374
+ if (
375
+ await OxPrompt.open({
376
+ title: i18next.t('text.are_you_sure'),
377
+ text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
378
+ confirmButton: { text: i18next.t('button.confirm') },
379
+ cancelButton: { text: i18next.t('button.cancel') }
380
+ })
381
+ ) {
382
+ const ids = this.grist.selected.map(record => record.id)
383
+ if (ids && ids.length > 0) {
384
+ const response = await client.mutate({
385
+ mutation: gql`
386
+ mutation ($ids: [String!]!) {
387
+ deleteTaxInvoiceApis(ids: $ids)
388
+ }
389
+ `,
390
+ variables: {
391
+ ids
392
+ }
393
+ })
394
+
395
+ if (!response.errors) {
396
+ this.grist.fetch()
397
+ notify({
398
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
399
+ })
400
+ }
401
+ }
402
+ }
403
+ }
366
404
  }
@@ -12,16 +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
-
17
- export enum CompanyType {
18
- SUPPLIER = 10, // 공급자
19
- BUYER = 20 // 거래처
20
- }
21
- export const COMPANY_TYPE_LABEL = {
22
- [CompanyType.SUPPLIER]: '공급자',
23
- [CompanyType.BUYER]: '거래처'
24
- }
25
15
 
26
16
  @customElement('tax-invoice-company-list-page')
27
17
  export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
@@ -40,12 +30,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
40
30
  `
41
31
  ]
42
32
 
43
- static get scopedElements() {
44
- return {
45
- 'tax-invoice-company-importer': TaxInvoiceCompanyImporter
46
- }
47
- }
48
-
49
33
  @property({ type: Object }) gristConfig: any
50
34
  @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
51
35
 
@@ -70,9 +54,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
70
54
  exportable: {
71
55
  name: i18next.t('title.tax invoice company list'),
72
56
  data: this.exportHandler.bind(this)
73
- },
74
- importable: {
75
- handler: this.importHandler.bind(this)
76
57
  }
77
58
  }
78
59
  }
@@ -122,27 +103,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
122
103
  filter: 'search',
123
104
  width: 200
124
105
  },
125
- {
126
- type: 'select',
127
- name: 'type',
128
- header: i18next.t('field.type'),
129
- record: {
130
- editable: true,
131
- classifier: () => ({ emphasized: ['#D1E8FF', '#000'] }),
132
- options: [
133
- {},
134
- {
135
- display: i18next.t('text.company supplier'),
136
- value: CompanyType.SUPPLIER
137
- },
138
- {
139
- display: i18next.t('text.company buyer'),
140
- value: CompanyType.BUYER
141
- }
142
- ]
143
- },
144
- width: 100
145
- },
146
106
  {
147
107
  type: 'string',
148
108
  name: 'businessRegistrationNumber',
@@ -164,7 +124,7 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
164
124
  {
165
125
  type: 'string',
166
126
  name: 'businessName',
167
- header: i18next.t('field.business name'),
127
+ header: i18next.t('field.tax invoice business name'),
168
128
  record: {
169
129
  editable: true
170
130
  },
@@ -173,7 +133,7 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
173
133
  {
174
134
  type: 'string',
175
135
  name: 'representativeName',
176
- header: i18next.t('field.representative name'),
136
+ header: i18next.t('field.tax invoice representative name'),
177
137
  record: {
178
138
  editable: true
179
139
  },
@@ -313,7 +273,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
313
273
  id
314
274
  name
315
275
  description
316
- type
317
276
  businessRegistrationNumber
318
277
  branchIdentification
319
278
  businessName
@@ -445,7 +404,6 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
445
404
  'id',
446
405
  'name',
447
406
  'description',
448
- 'type',
449
407
  'businessRegistrationNumber',
450
408
  'branchIdentification',
451
409
  'businessName',
@@ -470,27 +428,4 @@ export class TaxInvoiceCompanyListPage extends localize(i18next)(ScopedElementsM
470
428
  return tempObj
471
429
  })
472
430
  }
473
-
474
- async importHandler(records) {
475
- const popup = openPopup(
476
- html`
477
- <tax-invoice-company-importer
478
- .taxInvoiceCompanies=${records}
479
- @imported=${() => {
480
- history.back()
481
- this.grist.fetch()
482
- }}
483
- ></tax-invoice-company-importer>
484
- `,
485
- {
486
- backdrop: true,
487
- size: 'large',
488
- title: i18next.t('title.import tax invoice company')
489
- }
490
- )
491
-
492
- popup.onclosed = () => {
493
- this.grist.fetch()
494
- }
495
- }
496
431
  }
@@ -1,15 +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
- import { COMPANY_TYPE_LABEL } from './tax-invoice-company-list-page'
11
7
 
12
- export class TaxInvoiceCompanyImporter extends LitElement {
8
+ export class CompanyListPopup extends LitElement {
13
9
  static styles = [
14
10
  css`
15
11
  :host {
@@ -35,141 +31,159 @@ export class TaxInvoiceCompanyImporter extends LitElement {
35
31
  `
36
32
  ]
37
33
 
38
- @property({ type: Array }) taxInvoiceCompanies: any[] = []
34
+ @query('ox-grist') private grist!: DataGrist
35
+
36
+ @property({ type: Array }) companyList: any[] = []
39
37
  @property({ type: Object }) columns = {
40
- list: { fields: ['name', 'description'] },
41
38
  pagination: { infinite: true },
42
39
  columns: [
40
+ { type: 'gutter', gutterName: 'sequence' },
41
+ { type: 'gutter', gutterName: 'row-selector', multiple: false },
43
42
  {
44
43
  type: 'string',
45
44
  name: 'name',
46
45
  header: i18next.t('field.name'),
47
- width: 150
48
- },
49
- {
50
- type: 'string',
51
- name: 'description',
52
- header: i18next.t('field.description'),
53
- width: 200
54
- },
55
- {
56
- type: 'select',
57
- name: 'type',
58
- header: i18next.t('field.type'),
59
46
  record: {
60
- renderer: value => COMPANY_TYPE_LABEL[value]
47
+ editable: false
61
48
  },
62
- width: 100
49
+ filter: 'search',
50
+ sortable: true,
51
+ width: 150
63
52
  },
64
53
  {
65
54
  type: 'string',
66
55
  name: 'businessRegistrationNumber',
67
56
  header: i18next.t('field.business registration number'),
57
+ record: {
58
+ editable: false
59
+ },
68
60
  width: 150
69
61
  },
70
62
  {
71
63
  type: 'string',
72
64
  name: 'branchIdentification',
73
65
  header: i18next.t('field.branch identification'),
66
+ record: {
67
+ editable: false
68
+ },
74
69
  width: 150
75
70
  },
76
71
  {
77
72
  type: 'string',
78
73
  name: 'businessName',
79
74
  header: i18next.t('field.tax invoice business name'),
75
+ record: {
76
+ editable: false
77
+ },
80
78
  width: 150
81
79
  },
82
80
  {
83
81
  type: 'string',
84
82
  name: 'representativeName',
85
83
  header: i18next.t('field.tax invoice representative name'),
84
+ record: {
85
+ editable: false
86
+ },
86
87
  width: 150
87
88
  },
88
89
  {
89
90
  type: 'string',
90
91
  name: 'address',
91
92
  header: i18next.t('field.address'),
93
+ record: {
94
+ editable: false
95
+ },
92
96
  width: 200
93
97
  },
94
98
  {
95
99
  type: 'string',
96
100
  name: 'businessType',
97
101
  header: i18next.t('field.business type'),
102
+ record: {
103
+ editable: false
104
+ },
98
105
  width: 100
99
106
  },
100
107
  {
101
108
  type: 'string',
102
109
  name: 'industryType',
103
110
  header: i18next.t('field.industry type'),
111
+ record: {
112
+ editable: false
113
+ },
104
114
  width: 100
105
115
  },
106
116
  {
107
117
  type: 'string',
108
118
  name: 'department',
109
119
  header: i18next.t('field.department'),
120
+ record: {
121
+ editable: false
122
+ },
110
123
  width: 150
111
124
  },
112
125
  {
113
126
  type: 'string',
114
127
  name: 'contactName',
115
128
  header: i18next.t('field.contact name'),
129
+ record: {
130
+ editable: false
131
+ },
116
132
  width: 150
117
133
  },
118
134
  {
119
135
  type: 'string',
120
136
  name: 'contactPhone',
121
137
  header: i18next.t('field.contact phone'),
138
+ record: {
139
+ editable: false
140
+ },
122
141
  width: 150
123
142
  },
124
143
  {
125
144
  type: 'string',
126
145
  name: 'contactEmail',
127
146
  header: i18next.t('field.contact email'),
147
+ record: {
148
+ editable: false
149
+ },
128
150
  width: 150
129
151
  },
130
152
  {
131
153
  type: 'string',
132
154
  name: 'contactCellPhone',
133
155
  header: i18next.t('field.contact cell phone'),
134
- width: 150
135
- },
136
- {
137
- type: 'attributes',
138
- name: 'attributes',
139
- header: i18next.t('field.attributes'),
156
+ record: {
157
+ editable: false
158
+ },
140
159
  width: 150
141
160
  }
142
- ]
161
+ ],
162
+ rows: {
163
+ selectable: {
164
+ multiple: false
165
+ },
166
+ appendable: false
167
+ }
143
168
  }
144
169
 
145
170
  render() {
146
171
  return html`
147
172
  <ox-grist
148
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
173
+ .mode=${'GRID'}
149
174
  .config=${this.columns}
150
175
  .data=${{
151
- records: this.taxInvoiceCompanies
176
+ records: this.companyList
152
177
  }}
153
178
  ></ox-grist>
154
179
 
155
180
  <div class="button-container">
156
- <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>
157
182
  </div>
158
183
  `
159
184
  }
160
185
 
161
- async save() {
162
- const response = await client.mutate({
163
- mutation: gql`
164
- mutation importTaxInvoiceCompanies($taxInvoiceCompanies: [TaxInvoiceCompanyPatch!]!) {
165
- importTaxInvoiceCompanies(taxInvoiceCompanies: $taxInvoiceCompanies)
166
- }
167
- `,
168
- variables: { taxInvoiceCompanies: this.taxInvoiceCompanies }
169
- })
170
-
171
- if (response.errors?.length) return
172
-
173
- this.dispatchEvent(new CustomEvent('imported'))
186
+ async select() {
187
+ this.dispatchEvent(new CustomEvent('selected', { detail: this.grist.selected[0] }))
174
188
  }
175
189
  }