@things-factory/tax-invoice 6.2.88 → 6.2.90
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.
- package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +47 -110
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +2 -4
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +47 -101
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +13 -21
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +4 -25
- package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js +7 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +19 -33
- package/server/service/tax-invoice-api/tax-invoice-api-query.ts +4 -21
- package/server/service/tax-invoice-api/tax-invoice-api.ts +7 -15
|
@@ -9,7 +9,6 @@ import { DataGrist, FetchOption } from '@operato/data-grist'
|
|
|
9
9
|
import { client } from '@operato/graphql'
|
|
10
10
|
import { i18next, localize } from '@operato/i18n'
|
|
11
11
|
import { notify } from '@operato/layout'
|
|
12
|
-
import { OxPrompt } from '@operato/popup'
|
|
13
12
|
import { isMobileDevice } from '@operato/utils'
|
|
14
13
|
import gql from 'graphql-tag'
|
|
15
14
|
|
|
@@ -27,6 +26,10 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
|
|
|
27
26
|
--grid-record-emphasized-background-color: red;
|
|
28
27
|
--grid-record-emphasized-color: yellow;
|
|
29
28
|
}
|
|
29
|
+
|
|
30
|
+
ox-grist {
|
|
31
|
+
margin-top: 15px;
|
|
32
|
+
}
|
|
30
33
|
`
|
|
31
34
|
]
|
|
32
35
|
|
|
@@ -44,11 +47,6 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
|
|
|
44
47
|
title: i18next.t('button.save'),
|
|
45
48
|
action: this._updateTaxInvoiceApi.bind(this),
|
|
46
49
|
...CommonButtonStyles.save
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
title: i18next.t('button.delete'),
|
|
50
|
-
action: this._deleteTaxInvoiceApi.bind(this),
|
|
51
|
-
...CommonButtonStyles.delete
|
|
52
50
|
}
|
|
53
51
|
]
|
|
54
52
|
}
|
|
@@ -57,15 +55,7 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
|
|
|
57
55
|
render() {
|
|
58
56
|
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
59
57
|
|
|
60
|
-
return html`
|
|
61
|
-
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
62
|
-
<div slot="headroom">
|
|
63
|
-
<div id="filters">
|
|
64
|
-
<ox-filters-form autofocus></ox-filters-form>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</ox-grist>
|
|
68
|
-
`
|
|
58
|
+
return html` <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist> `
|
|
69
59
|
}
|
|
70
60
|
|
|
71
61
|
async pageInitialized(lifecycle: any) {
|
|
@@ -85,7 +75,6 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
|
|
|
85
75
|
editable: true,
|
|
86
76
|
classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })
|
|
87
77
|
},
|
|
88
|
-
filter: 'search',
|
|
89
78
|
sortable: true,
|
|
90
79
|
width: 150
|
|
91
80
|
},
|
|
@@ -271,126 +260,74 @@ export class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(Pag
|
|
|
271
260
|
rows: {
|
|
272
261
|
selectable: {
|
|
273
262
|
multiple: true
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
{
|
|
278
|
-
name: 'name'
|
|
279
|
-
}
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
async pageUpdated(changes: any, lifecycle: any) {
|
|
285
|
-
if (this.active) {
|
|
286
|
-
this.grist.fetch()
|
|
263
|
+
},
|
|
264
|
+
appendable: false
|
|
265
|
+
}
|
|
287
266
|
}
|
|
288
267
|
}
|
|
289
268
|
|
|
290
269
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
291
270
|
const response = await client.query({
|
|
292
271
|
query: gql`
|
|
293
|
-
query
|
|
294
|
-
|
|
295
|
-
|
|
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 {
|
|
296
294
|
id
|
|
297
295
|
name
|
|
298
|
-
description
|
|
299
|
-
apiKey
|
|
300
|
-
apiAccountId
|
|
301
|
-
apiAccountPassword
|
|
302
|
-
businessRegistrationNumber
|
|
303
|
-
branchIdentification
|
|
304
|
-
businessName
|
|
305
|
-
representativeName
|
|
306
|
-
address
|
|
307
|
-
businessType
|
|
308
|
-
industryType
|
|
309
|
-
department
|
|
310
|
-
contactName
|
|
311
|
-
contactPhone
|
|
312
|
-
contactEmail
|
|
313
|
-
contactCellPhone
|
|
314
|
-
attributes
|
|
315
|
-
updater {
|
|
316
|
-
id
|
|
317
|
-
name
|
|
318
|
-
}
|
|
319
|
-
updatedAt
|
|
320
296
|
}
|
|
321
|
-
|
|
297
|
+
updatedAt
|
|
322
298
|
}
|
|
323
299
|
}
|
|
324
|
-
|
|
325
|
-
variables: {
|
|
326
|
-
filters,
|
|
327
|
-
pagination: { page, limit },
|
|
328
|
-
sortings
|
|
329
|
-
}
|
|
300
|
+
`
|
|
330
301
|
})
|
|
331
302
|
|
|
332
|
-
|
|
333
|
-
total: response.data.responses.total || 0,
|
|
334
|
-
records: response.data.responses.items || []
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
async _deleteTaxInvoiceApi() {
|
|
339
|
-
if (
|
|
340
|
-
await OxPrompt.open({
|
|
341
|
-
title: i18next.t('text.are_you_sure'),
|
|
342
|
-
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
343
|
-
confirmButton: { text: i18next.t('button.confirm') },
|
|
344
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
345
|
-
})
|
|
346
|
-
) {
|
|
347
|
-
const ids = this.grist.selected.map(record => record.id)
|
|
348
|
-
if (ids && ids.length > 0) {
|
|
349
|
-
const response = await client.mutate({
|
|
350
|
-
mutation: gql`
|
|
351
|
-
mutation ($ids: [String!]!) {
|
|
352
|
-
deleteTaxInvoiceApis(ids: $ids)
|
|
353
|
-
}
|
|
354
|
-
`,
|
|
355
|
-
variables: {
|
|
356
|
-
ids
|
|
357
|
-
}
|
|
358
|
-
})
|
|
303
|
+
const records = response.data.response ? [response.data.response] : [{}]
|
|
359
304
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
364
|
-
})
|
|
365
|
-
}
|
|
366
|
-
}
|
|
305
|
+
return {
|
|
306
|
+
total: 1,
|
|
307
|
+
records: records
|
|
367
308
|
}
|
|
368
309
|
}
|
|
369
310
|
|
|
370
311
|
async _updateTaxInvoiceApi() {
|
|
371
|
-
let
|
|
372
|
-
if (
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
patchField.cuFlag = patch.__dirty__
|
|
380
|
-
|
|
381
|
-
return patchField
|
|
382
|
-
})
|
|
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' : '+'
|
|
383
320
|
|
|
384
321
|
const response = await client.mutate({
|
|
385
322
|
mutation: gql`
|
|
386
|
-
mutation ($
|
|
387
|
-
|
|
323
|
+
mutation ($patch: TaxInvoiceApiPatch!) {
|
|
324
|
+
updateMultipleTaxInvoiceApi(patch: $patch) {
|
|
388
325
|
name
|
|
389
326
|
}
|
|
390
327
|
}
|
|
391
328
|
`,
|
|
392
329
|
variables: {
|
|
393
|
-
|
|
330
|
+
patch: patchField
|
|
394
331
|
}
|
|
395
332
|
})
|
|
396
333
|
|
|
@@ -24,12 +24,10 @@ export declare class TaxInvoiceApiPage extends TaxInvoiceApiPage_base {
|
|
|
24
24
|
};
|
|
25
25
|
render(): import("lit-html").TemplateResult<1>;
|
|
26
26
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
27
|
-
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
28
27
|
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
29
|
-
total:
|
|
30
|
-
records: any;
|
|
28
|
+
total: number;
|
|
29
|
+
records: any[];
|
|
31
30
|
}>;
|
|
32
|
-
_deleteTaxInvoiceApi(): Promise<void>;
|
|
33
31
|
_updateTaxInvoiceApi(): Promise<void>;
|
|
34
32
|
getAttributeSetForEntity(): Promise<any>;
|
|
35
33
|
}
|
|
@@ -9,7 +9,6 @@ import { DataGrist } from '@operato/data-grist';
|
|
|
9
9
|
import { client } from '@operato/graphql';
|
|
10
10
|
import { i18next, localize } from '@operato/i18n';
|
|
11
11
|
import { notify } from '@operato/layout';
|
|
12
|
-
import { OxPrompt } from '@operato/popup';
|
|
13
12
|
import { isMobileDevice } from '@operato/utils';
|
|
14
13
|
import gql from 'graphql-tag';
|
|
15
14
|
let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
|
|
@@ -22,22 +21,13 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
22
21
|
title: i18next.t('title.tax invoice api'),
|
|
23
22
|
help: 'tax-invoice-api/tax-invoice-api',
|
|
24
23
|
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)
|
|
24
|
+
Object.assign({ title: i18next.t('button.save'), action: this._updateTaxInvoiceApi.bind(this) }, CommonButtonStyles.save)
|
|
27
25
|
]
|
|
28
26
|
};
|
|
29
27
|
}
|
|
30
28
|
render() {
|
|
31
29
|
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
|
-
`;
|
|
30
|
+
return html ` <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist> `;
|
|
41
31
|
}
|
|
42
32
|
async pageInitialized(lifecycle) {
|
|
43
33
|
this.gristConfig = {
|
|
@@ -56,7 +46,6 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
56
46
|
editable: true,
|
|
57
47
|
classifier: () => ({ emphasized: ['#D1E8FF', '#000'] })
|
|
58
48
|
},
|
|
59
|
-
filter: 'search',
|
|
60
49
|
sortable: true,
|
|
61
50
|
width: 150
|
|
62
51
|
},
|
|
@@ -242,116 +231,69 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
242
231
|
rows: {
|
|
243
232
|
selectable: {
|
|
244
233
|
multiple: true
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
{
|
|
249
|
-
name: 'name'
|
|
250
|
-
}
|
|
251
|
-
]
|
|
234
|
+
},
|
|
235
|
+
appendable: false
|
|
236
|
+
}
|
|
252
237
|
};
|
|
253
238
|
}
|
|
254
|
-
async pageUpdated(changes, lifecycle) {
|
|
255
|
-
if (this.active) {
|
|
256
|
-
this.grist.fetch();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
239
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
260
240
|
const response = await client.query({
|
|
261
241
|
query: gql `
|
|
262
|
-
query
|
|
263
|
-
|
|
264
|
-
|
|
242
|
+
query TaxInvoiceApi {
|
|
243
|
+
response: taxInvoiceApi {
|
|
244
|
+
id
|
|
245
|
+
name
|
|
246
|
+
description
|
|
247
|
+
apiKey
|
|
248
|
+
apiAccountId
|
|
249
|
+
apiAccountPassword
|
|
250
|
+
businessRegistrationNumber
|
|
251
|
+
branchIdentification
|
|
252
|
+
businessName
|
|
253
|
+
representativeName
|
|
254
|
+
address
|
|
255
|
+
businessType
|
|
256
|
+
industryType
|
|
257
|
+
department
|
|
258
|
+
contactName
|
|
259
|
+
contactPhone
|
|
260
|
+
contactEmail
|
|
261
|
+
contactCellPhone
|
|
262
|
+
attributes
|
|
263
|
+
updater {
|
|
265
264
|
id
|
|
266
265
|
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
|
-
attributes
|
|
284
|
-
updater {
|
|
285
|
-
id
|
|
286
|
-
name
|
|
287
|
-
}
|
|
288
|
-
updatedAt
|
|
289
266
|
}
|
|
290
|
-
|
|
267
|
+
updatedAt
|
|
291
268
|
}
|
|
292
269
|
}
|
|
293
|
-
|
|
294
|
-
variables: {
|
|
295
|
-
filters,
|
|
296
|
-
pagination: { page, limit },
|
|
297
|
-
sortings
|
|
298
|
-
}
|
|
270
|
+
`
|
|
299
271
|
});
|
|
272
|
+
const records = response.data.response ? [response.data.response] : [{}];
|
|
300
273
|
return {
|
|
301
|
-
total:
|
|
302
|
-
records:
|
|
274
|
+
total: 1,
|
|
275
|
+
records: records
|
|
303
276
|
};
|
|
304
277
|
}
|
|
305
|
-
async _deleteTaxInvoiceApi() {
|
|
306
|
-
if (await OxPrompt.open({
|
|
307
|
-
title: i18next.t('text.are_you_sure'),
|
|
308
|
-
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
309
|
-
confirmButton: { text: i18next.t('button.confirm') },
|
|
310
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
311
|
-
})) {
|
|
312
|
-
const ids = this.grist.selected.map(record => record.id);
|
|
313
|
-
if (ids && ids.length > 0) {
|
|
314
|
-
const response = await client.mutate({
|
|
315
|
-
mutation: gql `
|
|
316
|
-
mutation ($ids: [String!]!) {
|
|
317
|
-
deleteTaxInvoiceApis(ids: $ids)
|
|
318
|
-
}
|
|
319
|
-
`,
|
|
320
|
-
variables: {
|
|
321
|
-
ids
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
if (!response.errors) {
|
|
325
|
-
this.grist.fetch();
|
|
326
|
-
notify({
|
|
327
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
278
|
async _updateTaxInvoiceApi() {
|
|
334
|
-
let
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
patchField.cuFlag = patch.__dirty__;
|
|
343
|
-
return patchField;
|
|
344
|
-
});
|
|
279
|
+
let patch = this.grist.dirtyRecords[0];
|
|
280
|
+
if (patch) {
|
|
281
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
|
282
|
+
const dirtyFields = patch.__dirtyfields__;
|
|
283
|
+
for (let key in dirtyFields) {
|
|
284
|
+
patchField[key] = key === 'type' ? Number(dirtyFields[key].after) : dirtyFields[key].after;
|
|
285
|
+
}
|
|
286
|
+
patchField.cuFlag = patch.id ? 'M' : '+';
|
|
345
287
|
const response = await client.mutate({
|
|
346
288
|
mutation: gql `
|
|
347
|
-
mutation ($
|
|
348
|
-
|
|
289
|
+
mutation ($patch: TaxInvoiceApiPatch!) {
|
|
290
|
+
updateMultipleTaxInvoiceApi(patch: $patch) {
|
|
349
291
|
name
|
|
350
292
|
}
|
|
351
293
|
}
|
|
352
294
|
`,
|
|
353
295
|
variables: {
|
|
354
|
-
|
|
296
|
+
patch: patchField
|
|
355
297
|
}
|
|
356
298
|
});
|
|
357
299
|
if (!response.errors) {
|
|
@@ -399,6 +341,10 @@ TaxInvoiceApiPage.styles = [
|
|
|
399
341
|
--grid-record-emphasized-background-color: red;
|
|
400
342
|
--grid-record-emphasized-color: yellow;
|
|
401
343
|
}
|
|
344
|
+
|
|
345
|
+
ox-grist {
|
|
346
|
+
margin-top: 15px;
|
|
347
|
+
}
|
|
402
348
|
`
|
|
403
349
|
];
|
|
404
350
|
__decorate([
|
|
@@ -1 +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,EAA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,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBT;SACF,CAAC,CAAA;QAEF,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,YAAY,KAAI,EAAE,CAAA;IAC1C,CAAC;;AA1ZM,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,CA4Z7B;SA5ZY,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.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.getAttributeSetForEntity()\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 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 _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 getAttributeSetForEntity() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"TaxInvoiceApi\") {\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"]}
|
|
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,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;;QAqBuB,SAAI,GAA6B,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,C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Q,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;AAvBjC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CA8V7B;SA9VY,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 { 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 ox-grist {\n margin-top: 15px;\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 }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html` <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist> `\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 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.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.getAttributeSetForEntity()\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 appendable: false\n }\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query TaxInvoiceApi {\n response: taxInvoiceApi {\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 attributes\n updater {\n id\n name\n }\n updatedAt\n }\n }\n `\n })\n\n const records = response.data.response ? [response.data.response] : [{}]\n\n return {\n total: 1,\n records: records\n }\n }\n\n async _updateTaxInvoiceApi() {\n let patch = this.grist.dirtyRecords[0]\n if (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.id ? 'M' : '+'\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patch: TaxInvoiceApiPatch!) {\n updateMultipleTaxInvoiceApi(patch: $patch) {\n name\n }\n }\n `,\n variables: {\n patch: patchField\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 getAttributeSetForEntity() {\n const response = await client.query({\n query: gql`\n query {\n attributeSet: attributeSetByEntity(entity: \"TaxInvoiceApi\") {\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"]}
|