@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.
- package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +99 -61
- package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +2 -67
- package/client/pages/{tax-invoice-company/tax-invoice-company-importer.ts → tax-invoice-send/company-list-popup.ts} +60 -46
- package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +144 -3
- package/config/config.development.js +13 -0
- package/config/config.production.js +13 -0
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +3 -2
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +91 -61
- package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +2 -11
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +0 -10
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -1
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +0 -16
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +3 -62
- package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -1
- package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +65 -0
- package/dist-client/pages/tax-invoice-send/company-list-popup.js +199 -0
- package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -0
- package/dist-client/pages/tax-invoice-send/supplier-list-popup.d.ts +77 -0
- package/dist-client/pages/tax-invoice-send/supplier-list-popup.js +209 -0
- package/dist-client/pages/tax-invoice-send/supplier-list-popup.js.map +1 -0
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +7 -1
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +130 -2
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +20 -12
- 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 +13 -7
- 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-type.js +3 -7
- package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js +9 -21
- package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
- package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +41 -6
- package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -1
- package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +55 -5
- package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -1
- package/dist-server/service/tax-invoice-company/tax-invoice-company.js +1 -19
- package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -1
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js +6 -10
- package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
- package/dist-server/service/unipost-api/tax-invoice-send.js +4 -5
- package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -1
- package/dist-server/service/unipost-api/test-data.js +3812 -0
- package/dist-server/service/unipost-api/test-data.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +34 -20
- package/server/service/tax-invoice-api/tax-invoice-api-query.ts +12 -6
- package/server/service/tax-invoice-api/tax-invoice-api-type.ts +2 -5
- package/server/service/tax-invoice-api/tax-invoice-api.ts +9 -19
- package/server/service/tax-invoice-company/tax-invoice-company-query.ts +35 -5
- package/server/service/tax-invoice-company/tax-invoice-company-type.ts +40 -4
- package/server/service/tax-invoice-company/tax-invoice-company.ts +0 -18
- package/server/service/unipost-api/tax-invoice-inquiry.ts +6 -10
- package/server/service/unipost-api/tax-invoice-send.ts +5 -5
- package/translations/ko.json +3 -0
|
@@ -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>
|
|
@@ -675,8 +696,8 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
675
696
|
async _fetchSupplier() {
|
|
676
697
|
const response = await client.query({
|
|
677
698
|
query: gql`
|
|
678
|
-
query
|
|
679
|
-
response:
|
|
699
|
+
query taxInvoiceDefaultCompany {
|
|
700
|
+
response: taxInvoiceDefaultCompany {
|
|
680
701
|
businessRegistrationNumber
|
|
681
702
|
branchIdentification
|
|
682
703
|
businessName
|
|
@@ -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) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 유니택스 API 개발서버 URL (! 운영서버 URL은 config.production 참고)
|
|
3
|
+
* INQUIRY_URL: 세금계산서 조회
|
|
4
|
+
* CONFIRM_URL: 세금계산서 조회 후 유니택스에 처리 결과 갱신
|
|
5
|
+
* SEND_URL: 세금계산서 발행
|
|
6
|
+
*/
|
|
7
|
+
module.exports = {
|
|
8
|
+
unitax: {
|
|
9
|
+
INQUIRY_URL: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/searchbills',
|
|
10
|
+
CONFIRM_URL: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/updateBills',
|
|
11
|
+
SEND_URL: 'https://inf2dev.unipost.co.kr:47543/mbill-etaxr-server/api/rest/v3/receivebill'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 유니택스 API 운영서버 URL (! 개발서버 URL은 config.development 참고)
|
|
3
|
+
* INQUIRY_URL: 세금계산서 조회
|
|
4
|
+
* CONFIRM_URL: 세금계산서 조회 후 유니택스에 처리 결과 갱신
|
|
5
|
+
* SEND_URL: 세금계산서 발행
|
|
6
|
+
*/
|
|
7
|
+
module.exports = {
|
|
8
|
+
unitax: {
|
|
9
|
+
INQUIRY_URL: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/searchbills',
|
|
10
|
+
CONFIRM_URL: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/updateBills',
|
|
11
|
+
SEND_URL: 'https://inf1.unipost.co.kr/mbill-etaxr-server/api/rest/v3/receivebill'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -25,10 +25,11 @@ export declare class TaxInvoiceApiPage extends TaxInvoiceApiPage_base {
|
|
|
25
25
|
render(): import("lit-html").TemplateResult<1>;
|
|
26
26
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
27
27
|
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
28
|
-
total:
|
|
29
|
-
records: any
|
|
28
|
+
total: any;
|
|
29
|
+
records: any;
|
|
30
30
|
}>;
|
|
31
31
|
_updateTaxInvoiceApi(): Promise<void>;
|
|
32
32
|
getAttributeSetForEntity(): Promise<any>;
|
|
33
|
+
_deleteTaxAuditResult(): Promise<void>;
|
|
33
34
|
}
|
|
34
35
|
export {};
|
|
@@ -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
|
let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
@@ -21,7 +22,8 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
21
22
|
title: i18next.t('title.tax invoice api'),
|
|
22
23
|
help: 'tax-invoice-api/tax-invoice-api',
|
|
23
24
|
actions: [
|
|
24
|
-
Object.assign({ title: i18next.t('button.save'), action: this._updateTaxInvoiceApi.bind(this) }, CommonButtonStyles.save)
|
|
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._deleteTaxAuditResult.bind(this) }, CommonButtonStyles.delete)
|
|
25
27
|
]
|
|
26
28
|
};
|
|
27
29
|
}
|
|
@@ -39,25 +41,23 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
39
41
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
40
42
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
41
43
|
{
|
|
42
|
-
type: '
|
|
43
|
-
name: '
|
|
44
|
-
header: i18next.t('field.
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
name: 'isDefault',
|
|
46
|
+
header: i18next.t('field.is_default'),
|
|
45
47
|
record: {
|
|
46
48
|
editable: true,
|
|
47
|
-
|
|
49
|
+
align: 'center'
|
|
48
50
|
},
|
|
49
|
-
|
|
50
|
-
width: 150
|
|
51
|
+
width: 70
|
|
51
52
|
},
|
|
52
53
|
{
|
|
53
54
|
type: 'string',
|
|
54
|
-
name: '
|
|
55
|
-
header: i18next.t('field.
|
|
55
|
+
name: 'provider',
|
|
56
|
+
header: i18next.t('field.provider'),
|
|
56
57
|
record: {
|
|
57
58
|
editable: true
|
|
58
59
|
},
|
|
59
|
-
|
|
60
|
-
width: 200
|
|
60
|
+
width: 150
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
type: 'string',
|
|
@@ -90,9 +90,7 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
90
90
|
type: 'string',
|
|
91
91
|
name: 'businessRegistrationNumber',
|
|
92
92
|
header: i18next.t('field.business registration number'),
|
|
93
|
-
record: {
|
|
94
|
-
editable: true
|
|
95
|
-
},
|
|
93
|
+
record: { editable: true },
|
|
96
94
|
width: 150
|
|
97
95
|
},
|
|
98
96
|
{
|
|
@@ -227,73 +225,77 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
227
225
|
},
|
|
228
226
|
width: 180
|
|
229
227
|
}
|
|
230
|
-
]
|
|
231
|
-
rows: {
|
|
232
|
-
selectable: {
|
|
233
|
-
multiple: true
|
|
234
|
-
},
|
|
235
|
-
appendable: false
|
|
236
|
-
}
|
|
228
|
+
]
|
|
237
229
|
};
|
|
238
230
|
}
|
|
239
231
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
240
232
|
const response = await client.query({
|
|
241
233
|
query: gql `
|
|
242
|
-
query
|
|
243
|
-
|
|
244
|
-
|
|
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 {
|
|
234
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
235
|
+
responses: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
236
|
+
items {
|
|
264
237
|
id
|
|
265
|
-
|
|
238
|
+
isDefault
|
|
239
|
+
provider
|
|
240
|
+
apiKey
|
|
241
|
+
apiAccountId
|
|
242
|
+
apiAccountPassword
|
|
243
|
+
businessRegistrationNumber
|
|
244
|
+
branchIdentification
|
|
245
|
+
businessName
|
|
246
|
+
representativeName
|
|
247
|
+
address
|
|
248
|
+
businessType
|
|
249
|
+
industryType
|
|
250
|
+
department
|
|
251
|
+
contactName
|
|
252
|
+
contactPhone
|
|
253
|
+
contactEmail
|
|
254
|
+
contactCellPhone
|
|
255
|
+
attributes
|
|
256
|
+
updater {
|
|
257
|
+
id
|
|
258
|
+
name
|
|
259
|
+
}
|
|
260
|
+
updatedAt
|
|
266
261
|
}
|
|
267
|
-
|
|
262
|
+
total
|
|
268
263
|
}
|
|
269
264
|
}
|
|
270
|
-
|
|
265
|
+
`,
|
|
266
|
+
variables: {
|
|
267
|
+
filters,
|
|
268
|
+
pagination: { page, limit },
|
|
269
|
+
sortings
|
|
270
|
+
}
|
|
271
271
|
});
|
|
272
|
-
const records = response.data.response ? [response.data.response] : [{}];
|
|
273
272
|
return {
|
|
274
|
-
total:
|
|
275
|
-
records:
|
|
273
|
+
total: response.data.responses.total || 0,
|
|
274
|
+
records: response.data.responses.items || []
|
|
276
275
|
};
|
|
277
276
|
}
|
|
278
277
|
async _updateTaxInvoiceApi() {
|
|
279
|
-
let
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
278
|
+
let patches = this.grist.dirtyRecords;
|
|
279
|
+
if (patches && patches.length) {
|
|
280
|
+
patches = patches.map(patch => {
|
|
281
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
|
282
|
+
const dirtyFields = patch.__dirtyfields__;
|
|
283
|
+
for (let key in dirtyFields) {
|
|
284
|
+
patchField[key] = dirtyFields[key].after;
|
|
285
|
+
}
|
|
286
|
+
patchField.cuFlag = patch.__dirty__;
|
|
287
|
+
return patchField;
|
|
288
|
+
});
|
|
287
289
|
const response = await client.mutate({
|
|
288
290
|
mutation: gql `
|
|
289
|
-
mutation ($
|
|
290
|
-
updateMultipleTaxInvoiceApi(
|
|
291
|
-
|
|
291
|
+
mutation ($patches: [TaxInvoiceApiPatch!]!) {
|
|
292
|
+
updateMultipleTaxInvoiceApi(patches: $patches) {
|
|
293
|
+
provider
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
296
|
`,
|
|
295
297
|
variables: {
|
|
296
|
-
|
|
298
|
+
patches
|
|
297
299
|
}
|
|
298
300
|
});
|
|
299
301
|
if (!response.errors) {
|
|
@@ -328,6 +330,34 @@ let TaxInvoiceApiPage = class TaxInvoiceApiPage extends localize(i18next)(Scoped
|
|
|
328
330
|
});
|
|
329
331
|
return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.attributeSet) || {};
|
|
330
332
|
}
|
|
333
|
+
async _deleteTaxAuditResult() {
|
|
334
|
+
if (await OxPrompt.open({
|
|
335
|
+
title: i18next.t('text.are_you_sure'),
|
|
336
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
337
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
338
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
339
|
+
})) {
|
|
340
|
+
const ids = this.grist.selected.map(record => record.id);
|
|
341
|
+
if (ids && ids.length > 0) {
|
|
342
|
+
const response = await client.mutate({
|
|
343
|
+
mutation: gql `
|
|
344
|
+
mutation ($ids: [String!]!) {
|
|
345
|
+
deleteTaxInvoiceApis(ids: $ids)
|
|
346
|
+
}
|
|
347
|
+
`,
|
|
348
|
+
variables: {
|
|
349
|
+
ids
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
if (!response.errors) {
|
|
353
|
+
this.grist.fetch();
|
|
354
|
+
notify({
|
|
355
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
331
361
|
};
|
|
332
362
|
TaxInvoiceApiPage.styles = [
|
|
333
363
|
ScrollbarStyles,
|
|
@@ -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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,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;aAC1F;iBAAM;gBACL,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;aAClE;SACF;IACH,CAAC;IAED,KAAK,CAAC,wBAAwB;;QAC5B,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;;AA5VM,wBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;KAaF;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;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"]}
|
|
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,E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AAC,MAAM,CAAC;oBACnC,QAAQ,EAAE,GAAG,CAAA;;;;WAIZ;oBACD,SAAS,EAAE;wBACT,GAAG;qBACJ;iBACF,CAAC,CAAA;gBAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;oBAClB,MAAM,CAAC;wBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;qBAChF,CAAC,CAAA;iBACH;aACF;SACF;IACH,CAAC;;AAjYM,wBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;KAaF;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;AAvBjC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAmY7B;SAnYY,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'\nimport { OxPrompt } from '@operato/popup'\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 title: i18next.t('button.delete'),\n action: this._deleteTaxAuditResult.bind(this),\n ...CommonButtonStyles.delete\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: 'boolean',\n name: 'isDefault',\n header: i18next.t('field.is_default'),\n record: {\n editable: true,\n align: 'center'\n },\n width: 70\n },\n {\n type: 'string',\n name: 'provider',\n header: i18next.t('field.provider'),\n record: {\n editable: true\n },\n width: 150\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: { editable: true },\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 }\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 isDefault\n provider\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 _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] = 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 updateMultipleTaxInvoiceApi(patches: $patches) {\n provider\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 async _deleteTaxAuditResult() {\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"]}
|
|
@@ -10,21 +10,12 @@ export declare class TaxInvoiceCompanyImporter extends LitElement {
|
|
|
10
10
|
pagination: {
|
|
11
11
|
infinite: boolean;
|
|
12
12
|
};
|
|
13
|
-
columns:
|
|
13
|
+
columns: {
|
|
14
14
|
type: string;
|
|
15
15
|
name: string;
|
|
16
16
|
header: string;
|
|
17
17
|
width: number;
|
|
18
|
-
|
|
19
|
-
} | {
|
|
20
|
-
type: string;
|
|
21
|
-
name: string;
|
|
22
|
-
header: string;
|
|
23
|
-
record: {
|
|
24
|
-
renderer: (value: any) => any;
|
|
25
|
-
};
|
|
26
|
-
width: number;
|
|
27
|
-
})[];
|
|
18
|
+
}[];
|
|
28
19
|
};
|
|
29
20
|
render(): import("lit-html").TemplateResult<1>;
|
|
30
21
|
save(): Promise<void>;
|
|
@@ -6,7 +6,6 @@ import { property } from 'lit/decorators.js';
|
|
|
6
6
|
import { client } from '@operato/graphql';
|
|
7
7
|
import { i18next } from '@operato/i18n';
|
|
8
8
|
import { isMobileDevice } from '@operato/utils';
|
|
9
|
-
import { COMPANY_TYPE_LABEL } from './tax-invoice-company-list-page';
|
|
10
9
|
export class TaxInvoiceCompanyImporter extends LitElement {
|
|
11
10
|
constructor() {
|
|
12
11
|
super(...arguments);
|
|
@@ -27,15 +26,6 @@ export class TaxInvoiceCompanyImporter extends LitElement {
|
|
|
27
26
|
header: i18next.t('field.description'),
|
|
28
27
|
width: 200
|
|
29
28
|
},
|
|
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
29
|
{
|
|
40
30
|
type: 'string',
|
|
41
31
|
name: 'businessRegistrationNumber',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-company-importer.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice-company/tax-invoice-company-importer.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"tax-invoice-company-importer.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice-company/tax-invoice-company-importer.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,OAAO,yBAA0B,SAAQ,UAAU;IAAzD;;QA0B6B,wBAAmB,GAAU,EAAE,CAAA;QAC9B,YAAO,GAAG;YACpC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE;YACz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AI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;;KAEjF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;;QACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE;SAC7D,CAAC,CAAA;QAEF,IAAI,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM;YAAE,OAAM;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,CAAC;;AAxJM,gCAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;sEAAgC;AAC1D;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DA+F1B","sourcesContent":["import '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\n\nexport class TaxInvoiceCompanyImporter extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n padding: var(--padding-default);\n }\n\n mwc-button {\n margin-left: var(--margin-default);\n }\n `\n ]\n\n @property({ type: Array }) taxInvoiceCompanies: any[] = []\n @property({ type: Object }) columns = {\n list: { fields: ['name', 'description'] },\n pagination: { infinite: true },\n columns: [\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n width: 200\n },\n {\n type: 'string',\n name: 'businessRegistrationNumber',\n header: i18next.t('field.business registration number'),\n width: 150\n },\n {\n type: 'string',\n name: 'branchIdentification',\n header: i18next.t('field.branch identification'),\n width: 150\n },\n {\n type: 'string',\n name: 'businessName',\n header: i18next.t('field.tax invoice business name'),\n width: 150\n },\n {\n type: 'string',\n name: 'representativeName',\n header: i18next.t('field.tax invoice representative name'),\n width: 150\n },\n {\n type: 'string',\n name: 'address',\n header: i18next.t('field.address'),\n width: 200\n },\n {\n type: 'string',\n name: 'businessType',\n header: i18next.t('field.business type'),\n width: 100\n },\n {\n type: 'string',\n name: 'industryType',\n header: i18next.t('field.industry type'),\n width: 100\n },\n {\n type: 'string',\n name: 'department',\n header: i18next.t('field.department'),\n width: 150\n },\n {\n type: 'string',\n name: 'contactName',\n header: i18next.t('field.contact name'),\n width: 150\n },\n {\n type: 'string',\n name: 'contactPhone',\n header: i18next.t('field.contact phone'),\n width: 150\n },\n {\n type: 'string',\n name: 'contactEmail',\n header: i18next.t('field.contact email'),\n width: 150\n },\n {\n type: 'string',\n name: 'contactCellPhone',\n header: i18next.t('field.contact cell phone'),\n width: 150\n },\n {\n type: 'attributes',\n name: 'attributes',\n header: i18next.t('field.attributes'),\n width: 150\n }\n ]\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{\n records: this.taxInvoiceCompanies\n }}\n ></ox-grist>\n\n <div class=\"button-container\">\n <mwc-button raised @click=\"${this.save.bind(this)}\">${i18next.t('button.save')}</mwc-button>\n </div>\n `\n }\n\n async save() {\n const response = await client.mutate({\n mutation: gql`\n mutation importTaxInvoiceCompanies($taxInvoiceCompanies: [TaxInvoiceCompanyPatch!]!) {\n importTaxInvoiceCompanies(taxInvoiceCompanies: $taxInvoiceCompanies)\n }\n `,\n variables: { taxInvoiceCompanies: this.taxInvoiceCompanies }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n"]}
|