@things-factory/tax-invoice 10.1.123 → 10.1.127

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.
@@ -40,6 +40,8 @@ export declare const counterpartOf: (value: {
40
40
  supplierBusinessName?: string;
41
41
  buyerBusinessName?: string;
42
42
  }) => string;
43
+ /** Applications may use their own domain-scoped ledger read door without granting framework privileges. */
44
+ export declare function configureTaxInvoice360Query(field: string): void;
43
45
  export declare function registerTaxInvoiceKind(): void;
44
46
  export declare class TaxInvoiceOverviewSection extends LitElement {
45
47
  static styles: import("lit").CSSResult;
@@ -11,11 +11,18 @@ export const businessNumber = (value) => (value && /^\d{10}$/.test(value) ? valu
11
11
  const amount = (value) => (value === null || value === undefined ? '' : Number(value).toLocaleString(i18next.language || 'ko'));
12
12
  /** The other party: the buyer of a sale, the supplier of a purchase. */
13
13
  export const counterpartOf = (value) => (value.category === Category.EXPORT ? value.buyerBusinessName : value.supplierBusinessName) || '';
14
+ let invoiceQueryField = 'taxInvoice';
15
+ /** Applications may use their own domain-scoped ledger read door without granting framework privileges. */
16
+ export function configureTaxInvoice360Query(field) {
17
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(field))
18
+ throw new Error('Invalid invoice query field');
19
+ invoiceQueryField = field;
20
+ }
14
21
  export function registerTaxInvoiceKind() {
15
22
  registerEntity360Kind({
16
23
  kind: 'tax-invoice',
17
24
  typenames: ['TaxInvoice'],
18
- title: ({ value }) => counterpartOf(value) || value.approvalNo || '',
25
+ title: ({ value }) => `${i18next.t('title.tax invoice')} · ${counterpartOf(value) || value.name || value.approvalNo || ''}`,
19
26
  context: ({ value }) => [CATEGORY[value.category], value.issueDate, value.approvalNo].filter(Boolean).join(' · ')
20
27
  });
21
28
  registerEntity360Section('tax-invoice', {
@@ -26,6 +33,32 @@ export function registerTaxInvoiceKind() {
26
33
  }
27
34
  let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitElement {
28
35
  static { this.styles = css `
36
+ :host { font-size: var(--ui-t-body, 13px); line-height: 1.5; }
37
+ h4 { font: inherit; font-weight: 600; margin: 12px 0 4px; }
38
+ .info { font-size: var(--ui-t-body, 13px); margin-top: 0; }
39
+ .info th { width: 1%; padding: 6px 8px; background: var(--md-sys-color-surface-container, transparent); font-size: var(--ui-t-small, 11.5px); }
40
+ .info td { padding: 6px 8px; }
41
+ .info { border-top: 1px solid var(--md-sys-color-outline-variant); }
42
+ .items th { padding: 5px 6px; background: var(--md-sys-color-surface-container, transparent); }
43
+ .items td { padding: 7px 6px; }
44
+
45
+ th, .date { white-space: nowrap; }
46
+ .info td { overflow-wrap: anywhere; }
47
+ .secondary { display: block; color: var(--md-sys-color-on-surface-variant); font-size: var(--ui-t-small, 11.5px); }
48
+ .item-layout { container-type: inline-size; }
49
+ .items { table-layout: fixed; }
50
+ .items-wide { display: none; }
51
+ .items-wide .wide-name { width: 32%; }
52
+ .items-wide .wide-date { width: 90px; }
53
+ .items-wide .wide-spec { width: 8%; }
54
+ @container (min-width: 720px) {
55
+ .items-compact { display: none; }
56
+ .items-wide { display: table; }
57
+ }
58
+ .item-col { width: 58%; }
59
+ .item-name { overflow-wrap: anywhere; }
60
+ .total { font-weight: 600; }
61
+
29
62
  dl {
30
63
  margin: 0;
31
64
  display: grid;
@@ -78,9 +111,9 @@ let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitEleme
78
111
  let response;
79
112
  try {
80
113
  response = await client.query({
81
- query: gql `
114
+ query: gql(`
82
115
  query ($id: String!) {
83
- taxInvoice(id: $id) {
116
+ taxInvoice: ${invoiceQueryField}(id: $id) {
84
117
  id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0
85
118
  supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName
86
119
  buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName
@@ -88,7 +121,7 @@ let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitEleme
88
121
  taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }
89
122
  }
90
123
  }
91
- `,
124
+ `),
92
125
  variables: { id },
93
126
  fetchPolicy: 'no-cache',
94
127
  errorPolicy: 'all'
@@ -108,60 +141,40 @@ let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitEleme
108
141
  const items = [...(one?.taxInvoiceItems ?? [])].sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0));
109
142
  return html `<ox-entity360-section .heading=${t('title.tax invoice')} .state=${answer?.state ?? 'loading'} .message=${answer?.message ?? ''}>
110
143
  ${one
111
- ? html `<dl>
112
- <dt>${t('field.tax invoice category')}</dt>
113
- <dd>${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType] ?? one.invoiceType}</dd>
114
- <dt>${t('field.issue date')}</dt>
115
- <dd>${one.issueDate}</dd>
116
- <dt>${t('field.signature date')}</dt>
117
- <dd>${one.signatureDate ?? ''}</dd>
118
- <dt>${t('field.transmission date')}</dt>
119
- <dd>${one.transmissionDate ?? ''}</dd>
120
- <dt>${t('field.approval no')}</dt>
121
- <dd>${one.approvalNo}</dd>
122
- ${one.originalApprovalNo ? html `<dt>${t('field.original approval no')}</dt><dd>${one.originalApprovalNo}</dd>` : ''}
123
- <dt>${t('field.tax invoice supplier')}</dt>
124
- <dd>${one.supplierBusinessName} (${businessNumber(one.supplierBusinessRegistrationNumber)}) ${one.supplierRepresentativeName ?? ''}</dd>
125
- <dt>${t('field.tax invoice buyer')}</dt>
126
- <dd>${one.buyerBusinessName} (${businessNumber(one.buyerBusinessRegistrationNumber)}) ${one.buyerRepresentativeName ?? ''}</dd>
127
- <dt>${t('field.supply amount')}</dt>
128
- <dd>${amount(one.supplyAmount)}</dd>
129
- <dt>${t('field.tax amount')}</dt>
130
- <dd>${amount(one.taxAmount)}</dd>
131
- <dt>${t('field.total amount')}</dt>
132
- <dd>${amount(one.totalAmount)}</dd>
133
- <dt>${t('field.purpose')}</dt>
134
- <dd>${PURPOSE[one.purpose] ?? ''}</dd>
135
- <dt>${t('field.issue channel')}</dt>
136
- <dd>${one.issueChannel ?? ''}</dd>
137
- ${one.remark0 ? html `<dt>${t('field.remark0')}</dt><dd>${one.remark0}</dd>` : ''}
138
- </dl>
139
- ${items.length
140
- ? html `<table>
141
- <thead>
142
- <tr>
143
- <th>${t('field.tax invoice supply date')}</th>
144
- <th>${t('field.tax invoice item name')}</th>
145
- <th>${t('field.tax invoice ea')}</th>
146
- <th class="num">${t('field.tax invoice quantity')}</th>
147
- <th class="num">${t('field.tax invoice price')}</th>
148
- <th class="num">${t('field.supply amount')}</th>
149
- <th class="num">${t('field.tax amount')}</th>
150
- </tr>
151
- </thead>
152
- <tbody>
153
- ${items.map(item => html `<tr>
154
- <td>${item.supplyDate ?? ''}</td>
155
- <td>${item.itemName ?? ''}</td>
156
- <td>${item.specification ?? ''}</td>
157
- <td class="num">${amount(item.quantity)}</td>
158
- <td class="num">${amount(item.unitPrice)}</td>
159
- <td class="num">${amount(item.supplyPrice)}</td>
160
- <td class="num">${amount(item.taxPrice)}</td>
161
- </tr>`)}
162
- </tbody>
163
- </table>`
164
- : ''}`
144
+ ? html `
145
+ <table class="info" aria-label=${t('title.tax invoice')}>
146
+ <tbody>
147
+ <tr><th>${t('field.tax invoice category')}</th><td colspan="3">${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType] ?? one.invoiceType} · ${PURPOSE[one.purpose] ?? ''}</td></tr>
148
+ <tr><th>${t('field.approval no')}</th><td colspan="3">${one.approvalNo}</td></tr>
149
+ ${one.originalApprovalNo ? html `<tr><th>${t('field.original approval no')}</th><td colspan="3">${one.originalApprovalNo}</td></tr>` : ''}
150
+ <tr><th>${t('field.issue date')}</th><td class="date">${one.issueDate}</td><th>${t('field.signature date')}</th><td class="date">${one.signatureDate ?? '—'}</td></tr>
151
+ <tr><th>${t('field.transmission date')}</th><td class="date">${one.transmissionDate ?? '—'}</td><th>${t('field.issue channel')}</th><td>${one.issueChannel ?? '—'}</td></tr>
152
+ <tr><th>${t('field.tax invoice supplier')}</th><td colspan="3">${one.supplierBusinessName}<span class="secondary">${businessNumber(one.supplierBusinessRegistrationNumber)} · ${one.supplierRepresentativeName ?? ''}</span></td></tr>
153
+ <tr><th>${t('field.tax invoice buyer')}</th><td colspan="3">${one.buyerBusinessName}<span class="secondary">${businessNumber(one.buyerBusinessRegistrationNumber)} · ${one.buyerRepresentativeName ?? ''}</span></td></tr>
154
+ <tr><th>${t('field.supply amount')}</th><td class="num">${amount(one.supplyAmount)}</td><th>${t('field.tax amount')}</th><td class="num">${amount(one.taxAmount)}</td></tr>
155
+ <tr><th>${t('field.total amount')}</th><td colspan="3" class="num total">${amount(one.totalAmount)}</td></tr>
156
+ ${one.remark0 ? html `<tr><th>${t('field.remark0')}</th><td colspan="3">${one.remark0}</td></tr>` : ''}
157
+ </tbody>
158
+ </table>
159
+ ${items.length ? html `<h4>${t('field.tax invoice item name')} (${items.length})</h4>
160
+ <div class="item-layout"><table class="items items-compact"><colgroup><col class="item-col"/><col/><col/></colgroup>
161
+ <thead><tr><th>${t('field.tax invoice item name')}</th><th class="num">${t('field.supply amount')}</th><th class="num">${t('field.tax amount')}</th></tr></thead>
162
+ <tbody>${items.map(item => html `<tr>
163
+ <td><span class="item-name">${item.itemName ?? ''}</span><span class="secondary">${item.supplyDate ?? ''}${item.specification ? html ` · ${item.specification}` : ''}</span><span class="secondary">${t('field.tax invoice quantity')} ${amount(item.quantity)} · ${t('field.tax invoice price')} ${amount(item.unitPrice)}</span></td>
164
+ <td class="num">${amount(item.supplyPrice)}</td><td class="num">${amount(item.taxPrice)}</td>
165
+ </tr>`)}</tbody>
166
+ </table>
167
+ <table class="items items-wide">
168
+ <colgroup><col class="wide-date"/><col class="wide-name"/><col class="wide-spec"/><col/><col/><col/><col/></colgroup>
169
+ <thead><tr>
170
+ <th>${t('field.tax invoice supply date')}</th><th>${t('field.tax invoice item name')}</th><th>${t('field.tax invoice ea')}</th>
171
+ <th class="num">${t('field.tax invoice quantity')}</th><th class="num">${t('field.tax invoice price')}</th><th class="num">${t('field.supply amount')}</th><th class="num">${t('field.tax amount')}</th>
172
+ </tr></thead>
173
+ <tbody>${items.map(item => html `<tr>
174
+ <td class="date">${item.supplyDate ?? ''}</td><td class="item-name">${item.itemName ?? ''}</td><td>${item.specification ?? ''}</td>
175
+ <td class="num">${amount(item.quantity)}</td><td class="num">${amount(item.unitPrice)}</td><td class="num">${amount(item.supplyPrice)}</td><td class="num">${amount(item.taxPrice)}</td>
176
+ </tr>`)}</tbody>
177
+ </table></div>` : ''}`
165
178
  : ''}
166
179
  </ox-entity360-section>`;
167
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tax-invoice-360.js","sourceRoot":"","sources":["../../client/entity360/tax-invoice-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,wBAAwB,EAAmD,MAAM,iBAAiB,CAAA;AAErJ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAA;AA+BtG,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC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,CAAC,WAAW,CAAC;0CACxB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;4BACnC,CACP;;yBAEI;gBACX,CAAC,CAAC,EAAE,EAAE;YACZ,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AArG+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAA2B;AACjD;IAAR,KAAK,EAAE;;yDAAkD;AA5C/C,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CAiJrC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { readEntity360Door, registerEntity360Kind, registerEntity360Section, type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout'\n\nimport { CATEGORY, Category, INVOICE_TYPE, PURPOSE } from '../pages/tax-invoice/tax-invoice-list-page'\n\n/*\n * A tax invoice's 360 (ADR-0067). The framework draws the invoice itself — parties, amounts, items.\n * An application adds its own sections (what the invoice is bound to) with registerEntity360Section('tax-invoice', …).\n */\n\ntype Invoice = {\n id: string\n category: string\n approvalNo?: string\n originalApprovalNo?: string\n issueDate?: string\n signatureDate?: string\n transmissionDate?: string\n invoiceType?: string\n purpose?: string\n issueChannel?: string\n remark0?: string\n supplierBusinessRegistrationNumber?: string\n supplierBusinessName?: string\n supplierRepresentativeName?: string\n buyerBusinessRegistrationNumber?: string\n buyerBusinessName?: string\n buyerRepresentativeName?: string\n supplyAmount?: number\n taxAmount?: number\n totalAmount?: number\n taxInvoiceItems?: { sequence?: number; supplyDate?: string; itemName?: string; specification?: string; quantity?: number; unitPrice?: number; supplyPrice?: number; taxPrice?: number }[]\n}\n\n/** 1234567890 → 123-45-67890; anything else as it is. */\nexport const businessNumber = (value?: string) => (value && /^\\d{10}$/.test(value) ? value.replace(/(\\d{3})(\\d{2})(\\d{5})/, '$1-$2-$3') : value || '')\n\nconst amount = (value?: number | null) => (value === null || value === undefined ? '' : Number(value).toLocaleString(i18next.language || 'ko'))\n\n/** The other party: the buyer of a sale, the supplier of a purchase. */\nexport const counterpartOf = (value: { category?: string; supplierBusinessName?: string; buyerBusinessName?: string }) =>\n (value.category === Category.EXPORT ? value.buyerBusinessName : value.supplierBusinessName) || ''\n\nexport function registerTaxInvoiceKind() {\n registerEntity360Kind({\n kind: 'tax-invoice',\n typenames: ['TaxInvoice'],\n title: ({ value }) => counterpartOf(value) || value.approvalNo || '',\n context: ({ value }) => [CATEGORY[value.category], value.issueDate, value.approvalNo].filter(Boolean).join(' · ')\n })\n registerEntity360Section('tax-invoice', {\n name: 'overview',\n order: 10,\n render: subject => html`<tax-invoice-overview-section .subject=${subject}></tax-invoice-overview-section>`\n })\n}\n\n@customElement('tax-invoice-overview-section')\nexport class TaxInvoiceOverviewSection extends LitElement {\n static styles = css`\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small, 4px) var(--spacing-large, 12px);\n font-size: var(--ui-t-body, 13px);\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n table {\n width: 100%;\n margin-top: var(--spacing-medium, 8px);\n border-collapse: collapse;\n font-size: var(--ui-t-small, 11.5px);\n font-variant-numeric: tabular-nums;\n color: var(--md-sys-color-on-surface);\n }\n th {\n text-align: left;\n font-weight: normal;\n color: var(--md-sys-color-on-surface-variant);\n }\n th,\n td {\n padding: var(--spacing-tiny, 2px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n vertical-align: top;\n }\n .num {\n text-align: right;\n white-space: nowrap;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<Invoice | undefined>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n let response: any\n try {\n response = await client.query({\n query: gql`\n query ($id: String!) {\n taxInvoice(id: $id) {\n id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0\n supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName\n buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName\n supplyAmount taxAmount totalAmount\n taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }\n }\n }\n `,\n variables: { id },\n fetchPolicy: 'no-cache',\n errorPolicy: 'all'\n } as any)\n } catch (e: any) {\n response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] }\n }\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => data?.taxInvoice)\n }\n\n render() {\n const answer = this.answer\n const one = answer?.data\n const t = (key: string) => i18next.t(key)\n const items = [...(one?.taxInvoiceItems ?? [])].sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0))\n return html`<ox-entity360-section .heading=${t('title.tax invoice')} .state=${answer?.state ?? 'loading'} .message=${answer?.message ?? ''}>\n ${one\n ? html`<dl>\n <dt>${t('field.tax invoice category')}</dt>\n <dd>${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType!] ?? one.invoiceType}</dd>\n <dt>${t('field.issue date')}</dt>\n <dd>${one.issueDate}</dd>\n <dt>${t('field.signature date')}</dt>\n <dd>${one.signatureDate ?? ''}</dd>\n <dt>${t('field.transmission date')}</dt>\n <dd>${one.transmissionDate ?? ''}</dd>\n <dt>${t('field.approval no')}</dt>\n <dd>${one.approvalNo}</dd>\n ${one.originalApprovalNo ? html`<dt>${t('field.original approval no')}</dt><dd>${one.originalApprovalNo}</dd>` : ''}\n <dt>${t('field.tax invoice supplier')}</dt>\n <dd>${one.supplierBusinessName} (${businessNumber(one.supplierBusinessRegistrationNumber)}) ${one.supplierRepresentativeName ?? ''}</dd>\n <dt>${t('field.tax invoice buyer')}</dt>\n <dd>${one.buyerBusinessName} (${businessNumber(one.buyerBusinessRegistrationNumber)}) ${one.buyerRepresentativeName ?? ''}</dd>\n <dt>${t('field.supply amount')}</dt>\n <dd>${amount(one.supplyAmount)}</dd>\n <dt>${t('field.tax amount')}</dt>\n <dd>${amount(one.taxAmount)}</dd>\n <dt>${t('field.total amount')}</dt>\n <dd>${amount(one.totalAmount)}</dd>\n <dt>${t('field.purpose')}</dt>\n <dd>${PURPOSE[one.purpose!] ?? ''}</dd>\n <dt>${t('field.issue channel')}</dt>\n <dd>${one.issueChannel ?? ''}</dd>\n ${one.remark0 ? html`<dt>${t('field.remark0')}</dt><dd>${one.remark0}</dd>` : ''}\n </dl>\n ${items.length\n ? html`<table>\n <thead>\n <tr>\n <th>${t('field.tax invoice supply date')}</th>\n <th>${t('field.tax invoice item name')}</th>\n <th>${t('field.tax invoice ea')}</th>\n <th class=\"num\">${t('field.tax invoice quantity')}</th>\n <th class=\"num\">${t('field.tax invoice price')}</th>\n <th class=\"num\">${t('field.supply amount')}</th>\n <th class=\"num\">${t('field.tax amount')}</th>\n </tr>\n </thead>\n <tbody>\n ${items.map(\n item => html`<tr>\n <td>${item.supplyDate ?? ''}</td>\n <td>${item.itemName ?? ''}</td>\n <td>${item.specification ?? ''}</td>\n <td class=\"num\">${amount(item.quantity)}</td>\n <td class=\"num\">${amount(item.unitPrice)}</td>\n <td class=\"num\">${amount(item.supplyPrice)}</td>\n <td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`\n )}\n </tbody>\n </table>`\n : ''}`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
1
+ {"version":3,"file":"tax-invoice-360.js","sourceRoot":"","sources":["../../client/entity360/tax-invoice-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAA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CAAC;oCACvG,CAAC,CAAC,4BAA4B,CAAC,wBAAwB,CAAC,CAAC,yBAAyB,CAAC,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,wBAAwB,CAAC,CAAC,kBAAkB,CAAC;;yBAE3L,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;qCACV,IAAI,CAAC,UAAU,IAAI,EAAE,8BAA8B,IAAI,CAAC,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,aAAa,IAAI,EAAE;oCAC3G,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;sBAC9K,CAAC;6BACM,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AA/E+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAA2B;AACjD;IAAR,KAAK,EAAE;;yDAAkD;AAtE/C,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CAqJrC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { readEntity360Door, registerEntity360Kind, registerEntity360Section, type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout'\n\nimport { CATEGORY, Category, INVOICE_TYPE, PURPOSE } from '../pages/tax-invoice/tax-invoice-list-page'\n\n/*\n * A tax invoice's 360 (ADR-0067). The framework draws the invoice itself — parties, amounts, items.\n * An application adds its own sections (what the invoice is bound to) with registerEntity360Section('tax-invoice', …).\n */\n\ntype Invoice = {\n id: string\n category: string\n approvalNo?: string\n originalApprovalNo?: string\n issueDate?: string\n signatureDate?: string\n transmissionDate?: string\n invoiceType?: string\n purpose?: string\n issueChannel?: string\n remark0?: string\n supplierBusinessRegistrationNumber?: string\n supplierBusinessName?: string\n supplierRepresentativeName?: string\n buyerBusinessRegistrationNumber?: string\n buyerBusinessName?: string\n buyerRepresentativeName?: string\n supplyAmount?: number\n taxAmount?: number\n totalAmount?: number\n taxInvoiceItems?: { sequence?: number; supplyDate?: string; itemName?: string; specification?: string; quantity?: number; unitPrice?: number; supplyPrice?: number; taxPrice?: number }[]\n}\n\n/** 1234567890 → 123-45-67890; anything else as it is. */\nexport const businessNumber = (value?: string) => (value && /^\\d{10}$/.test(value) ? value.replace(/(\\d{3})(\\d{2})(\\d{5})/, '$1-$2-$3') : value || '')\n\nconst amount = (value?: number | null) => (value === null || value === undefined ? '' : Number(value).toLocaleString(i18next.language || 'ko'))\n\n/** The other party: the buyer of a sale, the supplier of a purchase. */\nexport const counterpartOf = (value: { category?: string; supplierBusinessName?: string; buyerBusinessName?: string }) =>\n (value.category === Category.EXPORT ? value.buyerBusinessName : value.supplierBusinessName) || ''\n\nlet invoiceQueryField = 'taxInvoice'\n/** Applications may use their own domain-scoped ledger read door without granting framework privileges. */\nexport function configureTaxInvoice360Query(field: string): void {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) throw new Error('Invalid invoice query field')\n invoiceQueryField = field\n}\n\nexport function registerTaxInvoiceKind() {\n registerEntity360Kind({\n kind: 'tax-invoice',\n typenames: ['TaxInvoice'],\n title: ({ value }) => `${i18next.t('title.tax invoice')} · ${counterpartOf(value) || value.name || value.approvalNo || ''}`,\n context: ({ value }) => [CATEGORY[value.category], value.issueDate, value.approvalNo].filter(Boolean).join(' · ')\n })\n registerEntity360Section('tax-invoice', {\n name: 'overview',\n order: 10,\n render: subject => html`<tax-invoice-overview-section .subject=${subject}></tax-invoice-overview-section>`\n })\n}\n\n@customElement('tax-invoice-overview-section')\nexport class TaxInvoiceOverviewSection extends LitElement {\n static styles = css`\n :host { font-size: var(--ui-t-body, 13px); line-height: 1.5; }\n h4 { font: inherit; font-weight: 600; margin: 12px 0 4px; }\n .info { font-size: var(--ui-t-body, 13px); margin-top: 0; }\n .info th { width: 1%; padding: 6px 8px; background: var(--md-sys-color-surface-container, transparent); font-size: var(--ui-t-small, 11.5px); }\n .info td { padding: 6px 8px; }\n .info { border-top: 1px solid var(--md-sys-color-outline-variant); }\n .items th { padding: 5px 6px; background: var(--md-sys-color-surface-container, transparent); }\n .items td { padding: 7px 6px; }\n\n th, .date { white-space: nowrap; }\n .info td { overflow-wrap: anywhere; }\n .secondary { display: block; color: var(--md-sys-color-on-surface-variant); font-size: var(--ui-t-small, 11.5px); }\n .item-layout { container-type: inline-size; }\n .items { table-layout: fixed; }\n .items-wide { display: none; }\n .items-wide .wide-name { width: 32%; }\n .items-wide .wide-date { width: 90px; }\n .items-wide .wide-spec { width: 8%; }\n @container (min-width: 720px) {\n .items-compact { display: none; }\n .items-wide { display: table; }\n }\n .item-col { width: 58%; }\n .item-name { overflow-wrap: anywhere; }\n .total { font-weight: 600; }\n\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small, 4px) var(--spacing-large, 12px);\n font-size: var(--ui-t-body, 13px);\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n table {\n width: 100%;\n margin-top: var(--spacing-medium, 8px);\n border-collapse: collapse;\n font-size: var(--ui-t-small, 11.5px);\n font-variant-numeric: tabular-nums;\n color: var(--md-sys-color-on-surface);\n }\n th {\n text-align: left;\n font-weight: normal;\n color: var(--md-sys-color-on-surface-variant);\n }\n th,\n td {\n padding: var(--spacing-tiny, 2px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n vertical-align: top;\n }\n .num {\n text-align: right;\n white-space: nowrap;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<Invoice | undefined>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n let response: any\n try {\n response = await client.query({\n query: gql(`\n query ($id: String!) {\n taxInvoice: ${invoiceQueryField}(id: $id) {\n id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0\n supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName\n buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName\n supplyAmount taxAmount totalAmount\n taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }\n }\n }\n `),\n variables: { id },\n fetchPolicy: 'no-cache',\n errorPolicy: 'all'\n } as any)\n } catch (e: any) {\n response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] }\n }\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => data?.taxInvoice)\n }\n\n render() {\n const answer = this.answer\n const one = answer?.data\n const t = (key: string) => i18next.t(key)\n const items = [...(one?.taxInvoiceItems ?? [])].sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0))\n return html`<ox-entity360-section .heading=${t('title.tax invoice')} .state=${answer?.state ?? 'loading'} .message=${answer?.message ?? ''}>\n ${one\n ? html`\n <table class=\"info\" aria-label=${t('title.tax invoice')}>\n <tbody>\n <tr><th>${t('field.tax invoice category')}</th><td colspan=\"3\">${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType!] ?? one.invoiceType} · ${PURPOSE[one.purpose!] ?? ''}</td></tr>\n <tr><th>${t('field.approval no')}</th><td colspan=\"3\">${one.approvalNo}</td></tr>\n ${one.originalApprovalNo ? html`<tr><th>${t('field.original approval no')}</th><td colspan=\"3\">${one.originalApprovalNo}</td></tr>` : ''}\n <tr><th>${t('field.issue date')}</th><td class=\"date\">${one.issueDate}</td><th>${t('field.signature date')}</th><td class=\"date\">${one.signatureDate ?? '—'}</td></tr>\n <tr><th>${t('field.transmission date')}</th><td class=\"date\">${one.transmissionDate ?? '—'}</td><th>${t('field.issue channel')}</th><td>${one.issueChannel ?? '—'}</td></tr>\n <tr><th>${t('field.tax invoice supplier')}</th><td colspan=\"3\">${one.supplierBusinessName}<span class=\"secondary\">${businessNumber(one.supplierBusinessRegistrationNumber)} · ${one.supplierRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.tax invoice buyer')}</th><td colspan=\"3\">${one.buyerBusinessName}<span class=\"secondary\">${businessNumber(one.buyerBusinessRegistrationNumber)} · ${one.buyerRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.supply amount')}</th><td class=\"num\">${amount(one.supplyAmount)}</td><th>${t('field.tax amount')}</th><td class=\"num\">${amount(one.taxAmount)}</td></tr>\n <tr><th>${t('field.total amount')}</th><td colspan=\"3\" class=\"num total\">${amount(one.totalAmount)}</td></tr>\n ${one.remark0 ? html`<tr><th>${t('field.remark0')}</th><td colspan=\"3\">${one.remark0}</td></tr>` : ''}\n </tbody>\n </table>\n ${items.length ? html`<h4>${t('field.tax invoice item name')} (${items.length})</h4>\n <div class=\"item-layout\"><table class=\"items items-compact\"><colgroup><col class=\"item-col\"/><col/><col/></colgroup>\n <thead><tr><th>${t('field.tax invoice item name')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th></tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td><span class=\"item-name\">${item.itemName ?? ''}</span><span class=\"secondary\">${item.supplyDate ?? ''}${item.specification ? html` · ${item.specification}` : ''}</span><span class=\"secondary\">${t('field.tax invoice quantity')} ${amount(item.quantity)} · ${t('field.tax invoice price')} ${amount(item.unitPrice)}</span></td>\n <td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table>\n <table class=\"items items-wide\">\n <colgroup><col class=\"wide-date\"/><col class=\"wide-name\"/><col class=\"wide-spec\"/><col/><col/><col/><col/></colgroup>\n <thead><tr>\n <th>${t('field.tax invoice supply date')}</th><th>${t('field.tax invoice item name')}</th><th>${t('field.tax invoice ea')}</th>\n <th class=\"num\">${t('field.tax invoice quantity')}</th><th class=\"num\">${t('field.tax invoice price')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th>\n </tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td class=\"date\">${item.supplyDate ?? ''}</td><td class=\"item-name\">${item.itemName ?? ''}</td><td>${item.specification ?? ''}</td>\n <td class=\"num\">${amount(item.quantity)}</td><td class=\"num\">${amount(item.unitPrice)}</td><td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table></div>` : ''}`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "tax-invoice-list" | "tax-invoice-send" | "tax-invoice-company-list" | "tax-invoice-api" | "tax-audit-result-list" | undefined;
1
+ export default function route(page: string): "tax-invoice-send" | "tax-invoice-list" | "tax-invoice-company-list" | "tax-invoice-api" | "tax-audit-result-list" | undefined;