@things-factory/tax-invoice 6.2.84

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 (151) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/client/bootstrap.ts +0 -0
  4. package/client/index.ts +0 -0
  5. package/client/pages/main.ts +25 -0
  6. package/client/pages/tax-audit-result/tax-audit-result-importer.ts +97 -0
  7. package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +355 -0
  8. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +424 -0
  9. package/client/pages/tax-invoice/tax-invoice-list-page.ts +517 -0
  10. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +428 -0
  11. package/client/pages/tax-invoice-company/tax-invoice-company-importer.ts +175 -0
  12. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +496 -0
  13. package/client/route.ts +23 -0
  14. package/client/tsconfig.json +11 -0
  15. package/dist-client/bootstrap.d.ts +0 -0
  16. package/dist-client/bootstrap.js +2 -0
  17. package/dist-client/bootstrap.js.map +1 -0
  18. package/dist-client/index.d.ts +0 -0
  19. package/dist-client/index.js +2 -0
  20. package/dist-client/index.js.map +1 -0
  21. package/dist-client/pages/main.d.ts +1 -0
  22. package/dist-client/pages/main.js +27 -0
  23. package/dist-client/pages/main.js.map +1 -0
  24. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.d.ts +22 -0
  25. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js +100 -0
  26. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js.map +1 -0
  27. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.d.ts +62 -0
  28. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js +331 -0
  29. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js.map +1 -0
  30. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.d.ts +14 -0
  31. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +430 -0
  32. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -0
  33. package/dist-client/pages/tax-invoice/tax-invoice-list-page.d.ts +70 -0
  34. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js +500 -0
  35. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js.map +1 -0
  36. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +36 -0
  37. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +419 -0
  38. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -0
  39. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +31 -0
  40. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +182 -0
  41. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -0
  42. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +57 -0
  43. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +477 -0
  44. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -0
  45. package/dist-client/route.d.ts +1 -0
  46. package/dist-client/route.js +20 -0
  47. package/dist-client/route.js.map +1 -0
  48. package/dist-client/tsconfig.tsbuildinfo +1 -0
  49. package/dist-server/index.js +6 -0
  50. package/dist-server/index.js.map +1 -0
  51. package/dist-server/routes.js +25 -0
  52. package/dist-server/routes.js.map +1 -0
  53. package/dist-server/service/index.js +37 -0
  54. package/dist-server/service/index.js.map +1 -0
  55. package/dist-server/service/tax-audit-result/event-subscriber.js +21 -0
  56. package/dist-server/service/tax-audit-result/event-subscriber.js.map +1 -0
  57. package/dist-server/service/tax-audit-result/index.js +12 -0
  58. package/dist-server/service/tax-audit-result/index.js.map +1 -0
  59. package/dist-server/service/tax-audit-result/tax-audit-result-history.js +123 -0
  60. package/dist-server/service/tax-audit-result/tax-audit-result-history.js.map +1 -0
  61. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js +168 -0
  62. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js.map +1 -0
  63. package/dist-server/service/tax-audit-result/tax-audit-result-query.js +97 -0
  64. package/dist-server/service/tax-audit-result/tax-audit-result-query.js.map +1 -0
  65. package/dist-server/service/tax-audit-result/tax-audit-result-type.js +86 -0
  66. package/dist-server/service/tax-audit-result/tax-audit-result-type.js.map +1 -0
  67. package/dist-server/service/tax-audit-result/tax-audit-result.js +110 -0
  68. package/dist-server/service/tax-audit-result/tax-audit-result.js.map +1 -0
  69. package/dist-server/service/tax-invoice/index.js +9 -0
  70. package/dist-server/service/tax-invoice/index.js.map +1 -0
  71. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +127 -0
  72. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -0
  73. package/dist-server/service/tax-invoice/tax-invoice-query.js +90 -0
  74. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -0
  75. package/dist-server/service/tax-invoice/tax-invoice-type.js +553 -0
  76. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -0
  77. package/dist-server/service/tax-invoice/tax-invoice.js +465 -0
  78. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -0
  79. package/dist-server/service/tax-invoice-api/index.js +9 -0
  80. package/dist-server/service/tax-invoice-api/index.js.map +1 -0
  81. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +64 -0
  82. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -0
  83. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +79 -0
  84. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -0
  85. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +103 -0
  86. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -0
  87. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +163 -0
  88. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -0
  89. package/dist-server/service/tax-invoice-company/index.js +9 -0
  90. package/dist-server/service/tax-invoice-company/index.js.map +1 -0
  91. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js +80 -0
  92. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js.map +1 -0
  93. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +89 -0
  94. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -0
  95. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +100 -0
  96. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -0
  97. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +166 -0
  98. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -0
  99. package/dist-server/service/tax-invoice-item/index.js +9 -0
  100. package/dist-server/service/tax-invoice-item/index.js.map +1 -0
  101. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js +127 -0
  102. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js.map +1 -0
  103. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js +87 -0
  104. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -0
  105. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +121 -0
  106. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -0
  107. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +115 -0
  108. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -0
  109. package/dist-server/tsconfig.tsbuildinfo +1 -0
  110. package/helps/tax-invoice/tax-audit-result.md +160 -0
  111. package/helps/tax-invoice/tax-invoice-api.md +160 -0
  112. package/helps/tax-invoice/tax-invoice-send.md +160 -0
  113. package/helps/tax-invoice/tax-invoice.md +160 -0
  114. package/package.json +37 -0
  115. package/server/index.ts +2 -0
  116. package/server/routes.ts +28 -0
  117. package/server/service/index.ts +36 -0
  118. package/server/service/tax-audit-result/event-subscriber.ts +17 -0
  119. package/server/service/tax-audit-result/index.ts +9 -0
  120. package/server/service/tax-audit-result/tax-audit-result-history.ts +110 -0
  121. package/server/service/tax-audit-result/tax-audit-result-mutation.ts +198 -0
  122. package/server/service/tax-audit-result/tax-audit-result-query.ts +62 -0
  123. package/server/service/tax-audit-result/tax-audit-result-type.ts +61 -0
  124. package/server/service/tax-audit-result/tax-audit-result.ts +95 -0
  125. package/server/service/tax-invoice/index.ts +6 -0
  126. package/server/service/tax-invoice/tax-invoice-mutation.ts +122 -0
  127. package/server/service/tax-invoice/tax-invoice-query.ts +54 -0
  128. package/server/service/tax-invoice/tax-invoice-type.ts +411 -0
  129. package/server/service/tax-invoice/tax-invoice.ts +389 -0
  130. package/server/service/tax-invoice-api/index.ts +6 -0
  131. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +67 -0
  132. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +48 -0
  133. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +71 -0
  134. package/server/service/tax-invoice-api/tax-invoice-api.ts +137 -0
  135. package/server/service/tax-invoice-company/index.ts +6 -0
  136. package/server/service/tax-invoice-company/tax-invoice-company-mutation.ts +84 -0
  137. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +53 -0
  138. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +69 -0
  139. package/server/service/tax-invoice-company/tax-invoice-company.ts +142 -0
  140. package/server/service/tax-invoice-item/index.ts +6 -0
  141. package/server/service/tax-invoice-item/tax-invoice-item-mutation.ts +128 -0
  142. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +57 -0
  143. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +86 -0
  144. package/server/service/tax-invoice-item/tax-invoice-item.ts +85 -0
  145. package/server/tsconfig.json +10 -0
  146. package/things-factory.config.js +23 -0
  147. package/translations/en.json +1 -0
  148. package/translations/ja.json +1 -0
  149. package/translations/ko.json +71 -0
  150. package/translations/ms.json +1 -0
  151. package/translations/zh.json +1 -0
@@ -0,0 +1,419 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
+ import { PageView } from '@operato/shell';
5
+ import { css, html } from 'lit';
6
+ import { customElement, property, query } from 'lit/decorators.js';
7
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
8
+ import { DataGrist } from '@operato/data-grist';
9
+ import { client } from '@operato/graphql';
10
+ import { i18next, localize } from '@operato/i18n';
11
+ import { notify } from '@operato/layout';
12
+ import { OxPrompt } from '@operato/popup';
13
+ import { isMobileDevice } from '@operato/utils';
14
+ import gql from 'graphql-tag';
15
+ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.mode = isMobileDevice() ? 'CARD' : 'GRID';
19
+ }
20
+ get context() {
21
+ return {
22
+ title: i18next.t('title.tax invoice api'),
23
+ help: 'tax-invoice-api/tax-invoice-api',
24
+ actions: [
25
+ Object.assign({ title: i18next.t('button.save'), action: this._updateTaxInvoiceApi.bind(this) }, CommonButtonStyles.save),
26
+ Object.assign({ title: i18next.t('button.delete'), action: this._deleteTaxInvoiceApi.bind(this) }, CommonButtonStyles.delete)
27
+ ]
28
+ };
29
+ }
30
+ render() {
31
+ const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
32
+ return html `
33
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
34
+ <div slot="headroom">
35
+ <div id="filters">
36
+ <ox-filters-form autofocus></ox-filters-form>
37
+ </div>
38
+ </div>
39
+ </ox-grist>
40
+ `;
41
+ }
42
+ async pageInitialized(lifecycle) {
43
+ this.gristConfig = {
44
+ list: {
45
+ fields: ['name', 'description'],
46
+ details: ['name', 'updatedAt']
47
+ },
48
+ columns: [
49
+ { type: 'gutter', gutterName: 'sequence' },
50
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
51
+ {
52
+ type: 'string',
53
+ name: 'name',
54
+ header: i18next.t('field.name'),
55
+ record: {
56
+ editable: true,
57
+ classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })
58
+ },
59
+ filter: 'search',
60
+ sortable: true,
61
+ width: 150
62
+ },
63
+ {
64
+ type: 'string',
65
+ name: 'description',
66
+ header: i18next.t('field.description'),
67
+ record: {
68
+ editable: true
69
+ },
70
+ filter: 'search',
71
+ width: 200
72
+ },
73
+ {
74
+ type: 'string',
75
+ name: 'apiKey',
76
+ header: i18next.t('field.api key'),
77
+ record: {
78
+ editable: true
79
+ },
80
+ width: 150
81
+ },
82
+ {
83
+ type: 'string',
84
+ name: 'apiAccountId',
85
+ header: i18next.t('field.api account id'),
86
+ record: {
87
+ editable: true
88
+ },
89
+ width: 150
90
+ },
91
+ {
92
+ type: 'password',
93
+ name: 'apiAccountPassword',
94
+ header: i18next.t('field.api account password'),
95
+ record: {
96
+ editable: true
97
+ },
98
+ width: 150
99
+ },
100
+ {
101
+ type: 'string',
102
+ name: 'businessRegistrationNumber',
103
+ header: i18next.t('field.business registration number'),
104
+ record: {
105
+ editable: true
106
+ },
107
+ width: 150
108
+ },
109
+ {
110
+ type: 'string',
111
+ name: 'branchIdentification',
112
+ header: i18next.t('field.branch identification'),
113
+ record: {
114
+ editable: true
115
+ },
116
+ width: 150
117
+ },
118
+ {
119
+ type: 'string',
120
+ name: 'businessName',
121
+ header: i18next.t('field.business name'),
122
+ record: {
123
+ editable: true
124
+ },
125
+ width: 150
126
+ },
127
+ {
128
+ type: 'string',
129
+ name: 'representativeName',
130
+ header: i18next.t('field.representative name'),
131
+ record: {
132
+ editable: true
133
+ },
134
+ width: 150
135
+ },
136
+ {
137
+ type: 'string',
138
+ name: 'address',
139
+ header: i18next.t('field.address'),
140
+ record: {
141
+ editable: true
142
+ },
143
+ width: 200
144
+ },
145
+ {
146
+ type: 'string',
147
+ name: 'businessType',
148
+ header: i18next.t('field.business type'),
149
+ record: {
150
+ editable: true
151
+ },
152
+ width: 100
153
+ },
154
+ {
155
+ type: 'string',
156
+ name: 'industryType',
157
+ header: i18next.t('field.industry type'),
158
+ record: {
159
+ editable: true
160
+ },
161
+ width: 100
162
+ },
163
+ {
164
+ type: 'string',
165
+ name: 'department',
166
+ header: i18next.t('field.department'),
167
+ record: {
168
+ editable: true
169
+ },
170
+ width: 150
171
+ },
172
+ {
173
+ type: 'string',
174
+ name: 'contactName',
175
+ header: i18next.t('field.contact name'),
176
+ record: {
177
+ editable: true
178
+ },
179
+ width: 150
180
+ },
181
+ {
182
+ type: 'string',
183
+ name: 'contactPhone',
184
+ header: i18next.t('field.contact phone'),
185
+ record: {
186
+ editable: true
187
+ },
188
+ width: 150
189
+ },
190
+ {
191
+ type: 'string',
192
+ name: 'contactEmail',
193
+ header: i18next.t('field.contact email'),
194
+ record: {
195
+ editable: true
196
+ },
197
+ width: 150
198
+ },
199
+ {
200
+ type: 'string',
201
+ name: 'contactCellPhone',
202
+ header: i18next.t('field.contact cell phone'),
203
+ record: {
204
+ editable: true
205
+ },
206
+ width: 150
207
+ },
208
+ {
209
+ type: 'attributes',
210
+ name: 'attributes',
211
+ header: i18next.t('field.attributes'),
212
+ record: {
213
+ editable: true,
214
+ options: async () => {
215
+ return {
216
+ objectified: true,
217
+ attributeSet: await this.getAttributeSetForDomain()
218
+ };
219
+ }
220
+ },
221
+ width: 150
222
+ },
223
+ {
224
+ type: 'resource-object',
225
+ name: 'updater',
226
+ header: i18next.t('field.updater'),
227
+ record: {
228
+ editable: false
229
+ },
230
+ width: 120
231
+ },
232
+ {
233
+ type: 'datetime',
234
+ name: 'updatedAt',
235
+ header: i18next.t('field.updated_at'),
236
+ record: {
237
+ editable: false
238
+ },
239
+ width: 180
240
+ }
241
+ ],
242
+ rows: {
243
+ selectable: {
244
+ multiple: true
245
+ }
246
+ },
247
+ sorters: [
248
+ {
249
+ name: 'name'
250
+ }
251
+ ]
252
+ };
253
+ }
254
+ async pageUpdated(changes, lifecycle) {
255
+ if (this.active) {
256
+ this.grist.fetch();
257
+ }
258
+ }
259
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
260
+ const response = await client.query({
261
+ query: gql `
262
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
263
+ responses: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {
264
+ items {
265
+ id
266
+ name
267
+ description
268
+ apiKey
269
+ apiAccountId
270
+ apiAccountPassword
271
+ businessRegistrationNumber
272
+ branchIdentification
273
+ businessName
274
+ representativeName
275
+ address
276
+ businessType
277
+ industryType
278
+ department
279
+ contactName
280
+ contactPhone
281
+ contactEmail
282
+ contactCellPhone
283
+ updater {
284
+ id
285
+ name
286
+ }
287
+ updatedAt
288
+ }
289
+ total
290
+ }
291
+ }
292
+ `,
293
+ variables: {
294
+ filters,
295
+ pagination: { page, limit },
296
+ sortings
297
+ }
298
+ });
299
+ return {
300
+ total: response.data.responses.total || 0,
301
+ records: response.data.responses.items || []
302
+ };
303
+ }
304
+ async _deleteTaxInvoiceApi() {
305
+ if (await OxPrompt.open({
306
+ title: i18next.t('text.are_you_sure'),
307
+ text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
308
+ confirmButton: { text: i18next.t('button.confirm') },
309
+ cancelButton: { text: i18next.t('button.cancel') }
310
+ })) {
311
+ const ids = this.grist.selected.map(record => record.id);
312
+ if (ids && ids.length > 0) {
313
+ const response = await client.mutate({
314
+ mutation: gql `
315
+ mutation ($ids: [String!]!) {
316
+ deleteTaxInvoiceApis(ids: $ids)
317
+ }
318
+ `,
319
+ variables: {
320
+ ids
321
+ }
322
+ });
323
+ if (!response.errors) {
324
+ this.grist.fetch();
325
+ notify({
326
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
327
+ });
328
+ }
329
+ }
330
+ }
331
+ }
332
+ async _updateTaxInvoiceApi() {
333
+ let patches = this.grist.dirtyRecords;
334
+ if (patches && patches.length) {
335
+ patches = patches.map(patch => {
336
+ let patchField = patch.id ? { id: patch.id } : {};
337
+ const dirtyFields = patch.__dirtyfields__;
338
+ for (let key in dirtyFields) {
339
+ patchField[key] = key === 'type' ? Number(dirtyFields[key].after) : dirtyFields[key].after;
340
+ }
341
+ patchField.cuFlag = patch.__dirty__;
342
+ return patchField;
343
+ });
344
+ const response = await client.mutate({
345
+ mutation: gql `
346
+ mutation ($patches: [TaxInvoiceApiPatch!]!) {
347
+ updateMultipleTaxInvoiceApis(patches: $patches) {
348
+ name
349
+ }
350
+ }
351
+ `,
352
+ variables: {
353
+ patches
354
+ }
355
+ });
356
+ if (!response.errors) {
357
+ this.grist.fetch();
358
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') }) });
359
+ }
360
+ else {
361
+ notify({ message: i18next.t('error.fail-save'), level: 'error' });
362
+ }
363
+ }
364
+ }
365
+ async getAttributeSetForDomain() {
366
+ var _a;
367
+ const response = await client.query({
368
+ query: gql `
369
+ query {
370
+ attributeSet: attributeSetByEntity(entity: "Domain") {
371
+ entity
372
+ description
373
+ items {
374
+ name
375
+ description
376
+ tag
377
+ type
378
+ active
379
+ hidden
380
+ options
381
+ }
382
+ }
383
+ }
384
+ `
385
+ });
386
+ return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.attributeSet) || {};
387
+ }
388
+ };
389
+ TaxInvoiceApiPage.styles = [
390
+ ScrollbarStyles,
391
+ CommonGristStyles,
392
+ css `
393
+ :host {
394
+ display: flex;
395
+
396
+ width: 100%;
397
+
398
+ --grid-record-emphasized-background-color: red;
399
+ --grid-record-emphasized-color: yellow;
400
+ }
401
+ `
402
+ ];
403
+ __decorate([
404
+ property({ type: Object }),
405
+ __metadata("design:type", Object)
406
+ ], TaxInvoiceApiPage.prototype, "gristConfig", void 0);
407
+ __decorate([
408
+ property({ type: String }),
409
+ __metadata("design:type", String)
410
+ ], TaxInvoiceApiPage.prototype, "mode", void 0);
411
+ __decorate([
412
+ query('ox-grist'),
413
+ __metadata("design:type", DataGrist)
414
+ ], TaxInvoiceApiPage.prototype, "grist", void 0);
415
+ TaxInvoiceApiPage = __decorate([
416
+ customElement('tax-invoice-api-page')
417
+ ], TaxInvoiceApiPage);
418
+ export { TaxInvoiceApiPage };
419
+ //# sourceMappingURL=tax-invoice-api-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-invoice-api-page.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice-api/tax-invoice-api-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,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAAhF;;QAiBuB,SAAI,GAA6B,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;IA0YjG,CAAC;IAtYC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,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AC,CAAA;QAEF,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,YAAY,KAAI,EAAE,CAAA;IAC1C,CAAC;;AAzZM,wBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAnBjC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CA2Z7B;SA3ZY,iBAAiB","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 } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport gql from 'graphql-tag'\n\n@customElement('tax-invoice-api-page')\nexport class TaxInvoiceApiPage 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 api'),\n help: 'tax-invoice-api/tax-invoice-api',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateTaxInvoiceApi.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteTaxInvoiceApi.bind(this),\n ...CommonButtonStyles.delete\n }\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: 'apiKey',\n header: i18next.t('field.api key'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'apiAccountId',\n header: i18next.t('field.api account id'),\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'password',\n name: 'apiAccountPassword',\n header: i18next.t('field.api account password'),\n record: {\n editable: true\n },\n width: 150\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: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n apiKey\n apiAccountId\n apiAccountPassword\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 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 _deleteTaxInvoiceApi() {\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 deleteTaxInvoiceApis(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 _updateTaxInvoiceApi() {\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: [TaxInvoiceApiPatch!]!) {\n updateMultipleTaxInvoiceApis(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') }) })\n } else {\n notify({ message: i18next.t('error.fail-save'), level: 'error' })\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"]}
@@ -0,0 +1,31 @@
1
+ import '@operato/data-grist';
2
+ import { LitElement } from 'lit';
3
+ export declare class TaxInvoiceCompanyImporter extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ taxInvoiceCompanies: any[];
6
+ columns: {
7
+ list: {
8
+ fields: string[];
9
+ };
10
+ pagination: {
11
+ infinite: boolean;
12
+ };
13
+ columns: ({
14
+ type: string;
15
+ name: string;
16
+ header: string;
17
+ width: number;
18
+ record?: undefined;
19
+ } | {
20
+ type: string;
21
+ name: string;
22
+ header: string;
23
+ record: {
24
+ renderer: (value: any) => any;
25
+ };
26
+ width: number;
27
+ })[];
28
+ };
29
+ render(): import("lit-html").TemplateResult<1>;
30
+ save(): Promise<void>;
31
+ }
@@ -0,0 +1,182 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import gql from 'graphql-tag';
4
+ import { css, html, LitElement } from 'lit';
5
+ import { property } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import { i18next } from '@operato/i18n';
8
+ import { isMobileDevice } from '@operato/utils';
9
+ import { COMPANY_TYPE_LABEL } from './tax-invoice-company-list-page';
10
+ export class TaxInvoiceCompanyImporter extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.taxInvoiceCompanies = [];
14
+ this.columns = {
15
+ list: { fields: ['name', 'description'] },
16
+ pagination: { infinite: true },
17
+ columns: [
18
+ {
19
+ type: 'string',
20
+ name: 'name',
21
+ header: i18next.t('field.name'),
22
+ width: 150
23
+ },
24
+ {
25
+ type: 'string',
26
+ name: 'description',
27
+ header: i18next.t('field.description'),
28
+ width: 200
29
+ },
30
+ {
31
+ type: 'select',
32
+ name: 'type',
33
+ header: i18next.t('field.type'),
34
+ record: {
35
+ renderer: value => COMPANY_TYPE_LABEL[value]
36
+ },
37
+ width: 100
38
+ },
39
+ {
40
+ type: 'string',
41
+ name: 'businessRegistrationNumber',
42
+ header: i18next.t('field.business registration number'),
43
+ width: 150
44
+ },
45
+ {
46
+ type: 'string',
47
+ name: 'branchIdentification',
48
+ header: i18next.t('field.branch identification'),
49
+ width: 150
50
+ },
51
+ {
52
+ type: 'string',
53
+ name: 'businessName',
54
+ header: i18next.t('field.business name'),
55
+ width: 150
56
+ },
57
+ {
58
+ type: 'string',
59
+ name: 'representativeName',
60
+ header: i18next.t('field.representative name'),
61
+ width: 150
62
+ },
63
+ {
64
+ type: 'string',
65
+ name: 'address',
66
+ header: i18next.t('field.address'),
67
+ width: 200
68
+ },
69
+ {
70
+ type: 'string',
71
+ name: 'businessType',
72
+ header: i18next.t('field.business type'),
73
+ width: 100
74
+ },
75
+ {
76
+ type: 'string',
77
+ name: 'industryType',
78
+ header: i18next.t('field.industry type'),
79
+ width: 100
80
+ },
81
+ {
82
+ type: 'string',
83
+ name: 'department',
84
+ header: i18next.t('field.department'),
85
+ width: 150
86
+ },
87
+ {
88
+ type: 'string',
89
+ name: 'contactName',
90
+ header: i18next.t('field.contact name'),
91
+ width: 150
92
+ },
93
+ {
94
+ type: 'string',
95
+ name: 'contactPhone',
96
+ header: i18next.t('field.contact phone'),
97
+ width: 150
98
+ },
99
+ {
100
+ type: 'string',
101
+ name: 'contactEmail',
102
+ header: i18next.t('field.contact email'),
103
+ width: 150
104
+ },
105
+ {
106
+ type: 'string',
107
+ name: 'contactCellPhone',
108
+ header: i18next.t('field.contact cell phone'),
109
+ width: 150
110
+ },
111
+ {
112
+ type: 'attributes',
113
+ name: 'attributes',
114
+ header: i18next.t('field.attributes'),
115
+ width: 150
116
+ }
117
+ ]
118
+ };
119
+ }
120
+ render() {
121
+ return html `
122
+ <ox-grist
123
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
124
+ .config=${this.columns}
125
+ .data=${{
126
+ records: this.taxInvoiceCompanies
127
+ }}
128
+ ></ox-grist>
129
+
130
+ <div class="button-container">
131
+ <mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
132
+ </div>
133
+ `;
134
+ }
135
+ async save() {
136
+ var _a;
137
+ const response = await client.mutate({
138
+ mutation: gql `
139
+ mutation importTaxInvoiceCompanies($taxInvoiceCompanies: [TaxInvoiceCompanyPatch!]!) {
140
+ importTaxInvoiceCompanies(taxInvoiceCompanies: $taxInvoiceCompanies)
141
+ }
142
+ `,
143
+ variables: { taxInvoiceCompanies: this.taxInvoiceCompanies }
144
+ });
145
+ if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)
146
+ return;
147
+ this.dispatchEvent(new CustomEvent('imported'));
148
+ }
149
+ }
150
+ TaxInvoiceCompanyImporter.styles = [
151
+ css `
152
+ :host {
153
+ display: flex;
154
+ flex-direction: column;
155
+
156
+ background-color: #fff;
157
+ }
158
+
159
+ ox-grist {
160
+ flex: 1;
161
+ }
162
+
163
+ .button-container {
164
+ display: flex;
165
+ margin-left: auto;
166
+ padding: var(--padding-default);
167
+ }
168
+
169
+ mwc-button {
170
+ margin-left: var(--margin-default);
171
+ }
172
+ `
173
+ ];
174
+ __decorate([
175
+ property({ type: Array }),
176
+ __metadata("design:type", Array)
177
+ ], TaxInvoiceCompanyImporter.prototype, "taxInvoiceCompanies", void 0);
178
+ __decorate([
179
+ property({ type: Object }),
180
+ __metadata("design:type", Object)
181
+ ], TaxInvoiceCompanyImporter.prototype, "columns", void 0);
182
+ //# sourceMappingURL=tax-invoice-company-importer.js.map