@things-factory/sales 10.1.273 → 10.1.278

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.
@@ -1,5 +1,7 @@
1
1
  import { registerOpportunityKind } from './entity360/opportunity-360.js';
2
+ import { registerQuotationKind } from './entity360/quotation-360.js';
2
3
  export default function bootstrap() {
3
4
  registerOpportunityKind();
5
+ registerQuotationKind();
4
6
  }
5
7
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAExE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,uBAAuB,EAAE,CAAA;AAC3B,CAAC","sourcesContent":["import { registerOpportunityKind } from './entity360/opportunity-360.js'\n\nexport default function bootstrap() {\n registerOpportunityKind()\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,uBAAuB,EAAE,CAAA;IACzB,qBAAqB,EAAE,CAAA;AACzB,CAAC","sourcesContent":["import { registerOpportunityKind } from './entity360/opportunity-360.js'\nimport { registerQuotationKind } from './entity360/quotation-360.js'\n\nexport default function bootstrap() {\n registerOpportunityKind()\n registerQuotationKind()\n}\n"]}
@@ -53,6 +53,10 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
53
53
  overflow-wrap: anywhere;
54
54
  font-variant-numeric: tabular-nums;
55
55
  }
56
+ /* The opportunity's own words keep their lines. */
57
+ dd.text {
58
+ white-space: pre-line;
59
+ }
56
60
  `; }
57
61
  get answer() {
58
62
  return entity360Answer(this.opportunity, data => data?.opportunity);
@@ -77,6 +81,7 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
77
81
  <dd>${one.owner?.name ?? '—'}</dd>
78
82
  ${one.closedOn ? html `<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}
79
83
  ${one.lostReason ? html `<dt>${i18next.t('field.opportunity-lost-reason')}</dt><dd>${one.lostReason}</dd>` : ''}
84
+ ${one.description ? html `<dt>${i18next.t('field.opportunity-description')}</dt><dd class="text">${one.description}</dd>` : ''}
80
85
  </dl>`
81
86
  : ''}
82
87
  </ox-entity360-section>`;
@@ -1 +1 @@
1
- {"version":3,"file":"opportunity-360.js","sourceRoot":"","sources":["../../client/entity360/opportunity-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,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,wBAAwB,EAAyB,MAAM,iBAAiB,CAAA;AACxI,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE3D,iIAAiI;AACjI,MAAM,UAAU,uBAAuB;IACrC,qBAAqB,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,CAAC,aAAa,CAAC;QAC1B,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,IAA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CAAC,EAAE;gBAC1G;YACR,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AAzC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2DAA2B;AAtB/C,0BAA0B;IADtC,aAAa,CAAC,8BAA8B,CAAC;GACjC,0BAA0B,CAgEtC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Answer, entity360Name, registerEntity360Kind, registerEntity360Section, type Entity360Subject } from '@operato/layout'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { opportunityStageWord } from '../opportunity-words'\n\n/** An opportunity's 360 (ADR-0067). The module draws the opportunity; an application hangs its own sections on 'opportunity'. */\nexport function registerOpportunityKind() {\n registerEntity360Kind({\n kind: 'opportunity',\n typenames: ['Opportunity'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.opportunity')} · ${value.name || ''}`,\n context: ({ value }) => [value.counterparty?.name, value.stage ? opportunityStageWord(value.stage) : '', value.expectedCloseMonth].filter(Boolean).join(' · ')\n })\n registerEntity360Section('opportunity', {\n name: 'overview',\n order: 10,\n render: subject => html`<opportunity-overview-section .subject=${subject}></opportunity-overview-section>`\n })\n}\n\n@customElement('opportunity-overview-section')\nexport class OpportunityOverviewSection extends LitElement {\n static styles = css`\n :host {\n font-size: var(--ui-t-body);\n line-height: 1.5;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small) var(--spacing-large);\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n private opportunity = new QueryController(\n this,\n gql`\n query ($id: String!) {\n opportunity(id: $id) {\n id name stage probability amount currency expectedCloseMonth closedOn lostReason description\n counterparty { id name } endCustomer { id name } owner { id name }\n }\n }\n `,\n { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) }\n )\n\n get answer() {\n return entity360Answer(this.opportunity, data => data?.opportunity)\n }\n\n render() {\n const one = this.answer?.data\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '—')\n return html`<ox-entity360-section .heading=${i18next.t('title.opportunity')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>\n ${one\n ? html`<dl>\n <dt>${i18next.t('field.opportunity-stage')}</dt>\n <dd>${opportunityStageWord(one.stage)} · ${one.probability}%</dd>\n <dt>${i18next.t('field.opportunity-counterparty')}</dt>\n <dd>${party(one.counterparty)}</dd>\n <dt>${i18next.t('field.opportunity-end-customer')}</dt>\n <dd>${party(one.endCustomer)}</dd>\n <dt>${i18next.t('field.opportunity-amount')}</dt>\n <dd>${documentAmount(one.amount, one.currency || 'KRW')}</dd>\n <dt>${i18next.t('field.opportunity-expected-close-month')}</dt>\n <dd>${one.expectedCloseMonth}</dd>\n <dt>${i18next.t('field.opportunity-owner')}</dt>\n <dd>${one.owner?.name ?? '—'}</dd>\n ${one.closedOn ? html`<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}\n ${one.lostReason ? html`<dt>${i18next.t('field.opportunity-lost-reason')}</dt><dd>${one.lostReason}</dd>` : ''}\n </dl>`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
1
+ {"version":3,"file":"opportunity-360.js","sourceRoot":"","sources":["../../client/entity360/opportunity-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,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB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CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC;kBACjD,OAAO,CAAC,CAAC,CAAC,wCAAwC,CAAC;kBACnD,GAAG,CAAC,kBAAkB;kBACtB,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;kBACpC,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,GAAG;cAC1B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,YAAY,GAAG,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,EAAE;cACtG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,YAAY,GAAG,CAAC,UAAU,OAAO,CAAC,CAAC,CAAC,EAAE;cAC5G,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,yBAAyB,GAAG,CAAC,WAAW,OAAO,CAAC,CAAC,CAAC,EAAE;gBACzH;YACR,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AA1C+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2DAA2B;AA1B/C,0BAA0B;IADtC,aAAa,CAAC,8BAA8B,CAAC;GACjC,0BAA0B,CAqEtC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Answer, entity360Name, registerEntity360Kind, registerEntity360Section, type Entity360Subject } from '@operato/layout'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { opportunityStageWord } from '../opportunity-words'\n\n/** An opportunity's 360 (ADR-0067). The module draws the opportunity; an application hangs its own sections on 'opportunity'. */\nexport function registerOpportunityKind() {\n registerEntity360Kind({\n kind: 'opportunity',\n typenames: ['Opportunity'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.opportunity')} · ${value.name || ''}`,\n context: ({ value }) => [value.counterparty?.name, value.stage ? opportunityStageWord(value.stage) : '', value.expectedCloseMonth].filter(Boolean).join(' · ')\n })\n registerEntity360Section('opportunity', {\n name: 'overview',\n order: 10,\n render: subject => html`<opportunity-overview-section .subject=${subject}></opportunity-overview-section>`\n })\n}\n\n@customElement('opportunity-overview-section')\nexport class OpportunityOverviewSection extends LitElement {\n static styles = css`\n :host {\n font-size: var(--ui-t-body);\n line-height: 1.5;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small) var(--spacing-large);\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n /* The opportunity's own words keep their lines. */\n dd.text {\n white-space: pre-line;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n private opportunity = new QueryController(\n this,\n gql`\n query ($id: String!) {\n opportunity(id: $id) {\n id name stage probability amount currency expectedCloseMonth closedOn lostReason description\n counterparty { id name } endCustomer { id name } owner { id name }\n }\n }\n `,\n { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) }\n )\n\n get answer() {\n return entity360Answer(this.opportunity, data => data?.opportunity)\n }\n\n render() {\n const one = this.answer?.data\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '—')\n return html`<ox-entity360-section .heading=${i18next.t('title.opportunity')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>\n ${one\n ? html`<dl>\n <dt>${i18next.t('field.opportunity-stage')}</dt>\n <dd>${opportunityStageWord(one.stage)} · ${one.probability}%</dd>\n <dt>${i18next.t('field.opportunity-counterparty')}</dt>\n <dd>${party(one.counterparty)}</dd>\n <dt>${i18next.t('field.opportunity-end-customer')}</dt>\n <dd>${party(one.endCustomer)}</dd>\n <dt>${i18next.t('field.opportunity-amount')}</dt>\n <dd>${documentAmount(one.amount, one.currency || 'KRW')}</dd>\n <dt>${i18next.t('field.opportunity-expected-close-month')}</dt>\n <dd>${one.expectedCloseMonth}</dd>\n <dt>${i18next.t('field.opportunity-owner')}</dt>\n <dd>${one.owner?.name ?? '—'}</dd>\n ${one.closedOn ? html`<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}\n ${one.lostReason ? html`<dt>${i18next.t('field.opportunity-lost-reason')}</dt><dd>${one.lostReason}</dd>` : ''}\n ${one.description ? html`<dt>${i18next.t('field.opportunity-description')}</dt><dd class=\"text\">${one.description}</dd>` : ''}\n </dl>`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ import { type Entity360Subject } from '@operato/layout';
3
+ /**
4
+ * A quotation's 360 (ADR-0067) - what the quotation list opens to read, as the opportunity and invoice lists open
5
+ * theirs (the user, 2026-11-13: 「팝업 보다는 360이 일관성있는 UX가 될 것 같다」). The module draws the quotation; the
6
+ * quotation itself, lines and terms, is read in its preview.
7
+ */
8
+ export declare function registerQuotationKind(): void;
9
+ export declare class QuotationOverviewSection extends LitElement {
10
+ static styles: import("lit").CSSResult[];
11
+ subject?: Entity360Subject;
12
+ private quotation;
13
+ get answer(): import("@operato/layout").Entity360DoorAnswer<any> | undefined;
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ }
@@ -0,0 +1,101 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import gql from 'graphql-tag';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property } from 'lit/decorators.js';
5
+ import { QueryController } from '@operato/graphql';
6
+ import { i18next } from '@operato/i18n';
7
+ import { entity360Answer, entity360Link, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
8
+ import { ButtonStyles } from '@operato/styles';
9
+ import { counterpartOf, DocumentFormStyles, renderDocumentTotals } from '@things-factory/invoice/dist-client';
10
+ import { previewQuotation } from '../quotation-preview';
11
+ import { quotationStatusWord } from '../quotation-words';
12
+ /**
13
+ * A quotation's 360 (ADR-0067) - what the quotation list opens to read, as the opportunity and invoice lists open
14
+ * theirs (the user, 2026-11-13: 「팝업 보다는 360이 일관성있는 UX가 될 것 같다」). The module draws the quotation; the
15
+ * quotation itself, lines and terms, is read in its preview.
16
+ */
17
+ export function registerQuotationKind() {
18
+ registerEntity360Kind({
19
+ kind: 'quotation',
20
+ typenames: ['Quotation'],
21
+ assistantSubject: true,
22
+ title: ({ value }) => `${i18next.t('title.quotation')} · ${counterpartOf(value) || value.number || ''}`,
23
+ context: ({ value }) => [value.number && `${value.number} v${value.version ?? ''}`, value.issueDate, value.status ? quotationStatusWord(value.status) : ''].filter(Boolean).join(' · ')
24
+ });
25
+ registerEntity360Section('quotation', {
26
+ name: 'overview',
27
+ order: 10,
28
+ render: subject => html `<quotation-overview-section .subject=${subject}></quotation-overview-section>`
29
+ });
30
+ }
31
+ let QuotationOverviewSection = class QuotationOverviewSection extends LitElement {
32
+ constructor() {
33
+ super(...arguments);
34
+ /* The quotation of the subject shown (ADR-0190). */
35
+ this.quotation = new QueryController(this, gql `
36
+ query ($id: String!) {
37
+ quotation(id: $id) {
38
+ id number version status direction currency language issueDate validUntil supplierName buyerName opportunity { id name }
39
+ supplyAmount taxAmount totalAmount taxGroups { taxKind taxRate supplyAmount taxAmount }
40
+ }
41
+ }
42
+ `, { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) });
43
+ }
44
+ static { this.styles = [
45
+ ButtonStyles,
46
+ DocumentFormStyles,
47
+ css `
48
+ :host {
49
+ font-size: var(--ui-t-body);
50
+ line-height: 1.5;
51
+ }
52
+ dl {
53
+ margin: 0 0 var(--spacing-large);
54
+ display: grid;
55
+ grid-template-columns: max-content 1fr;
56
+ gap: var(--spacing-small) var(--spacing-large);
57
+ }
58
+ dt {
59
+ color: var(--ui-muted);
60
+ }
61
+ dd {
62
+ margin: 0;
63
+ overflow-wrap: anywhere;
64
+ font-variant-numeric: tabular-nums;
65
+ }
66
+ `
67
+ ]; }
68
+ get answer() {
69
+ return entity360Answer(this.quotation, data => data?.quotation);
70
+ }
71
+ render() {
72
+ const one = this.answer?.data;
73
+ return html `<ox-entity360-section .heading=${i18next.t('title.quotation')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>
74
+ ${one ? html `<button slot="actions" quiet small @click=${() => previewQuotation(one)}>${i18next.t('button.preview')}</button>` : ''}
75
+ ${one
76
+ ? html `<dl>
77
+ <dt>${i18next.t('field.quotation-number')}</dt>
78
+ <dd>${one.number} v${one.version} · ${quotationStatusWord(one.status)}</dd>
79
+ <dt>${i18next.t('field.quotation-counterpart')}</dt>
80
+ <dd>${counterpartOf(one) || '—'}</dd>
81
+ <dt>${i18next.t('field.quotation-opportunity')}</dt>
82
+ <dd>${one.opportunity ? entity360Link('opportunity', one.opportunity.id, one.opportunity.name) : '—'}</dd>
83
+ <dt>${i18next.t('field.quotation-issue-date')}</dt>
84
+ <dd>${one.issueDate ?? '—'}</dd>
85
+ <dt>${i18next.t('field.quotation-valid-until')}</dt>
86
+ <dd>${one.validUntil ?? '—'}</dd>
87
+ </dl>
88
+ ${renderDocumentTotals(one)}`
89
+ : ''}
90
+ </ox-entity360-section>`;
91
+ }
92
+ };
93
+ __decorate([
94
+ property({ attribute: false }),
95
+ __metadata("design:type", Object)
96
+ ], QuotationOverviewSection.prototype, "subject", void 0);
97
+ QuotationOverviewSection = __decorate([
98
+ customElement('quotation-overview-section')
99
+ ], QuotationOverviewSection);
100
+ export { QuotationOverviewSection };
101
+ //# sourceMappingURL=quotation-360.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-360.js","sourceRoot":"","sources":["../../client/entity360/quotation-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAA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CAAC,IAAI,CAAA;oBACM,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;oBACnC,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;oBAC/D,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;oBACxC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG;oBACzB,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;oBACxC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;oBAC9F,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;oBACvC,GAAG,CAAC,SAAS,IAAI,GAAG;oBACpB,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;oBACxC,GAAG,CAAC,UAAU,IAAI,GAAG;;cAE3B,oBAAoB,CAAC,GAAG,CAAC,EAAE;YACjC,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AAvC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;yDAA2B;AA1B/C,wBAAwB;IADpC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,wBAAwB,CAkEpC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Answer, entity360Link, registerEntity360Kind, registerEntity360Section, type Entity360Subject } from '@operato/layout'\nimport { ButtonStyles } from '@operato/styles'\nimport { counterpartOf, DocumentFormStyles, renderDocumentTotals } from '@things-factory/invoice/dist-client'\n\nimport { previewQuotation } from '../quotation-preview'\nimport { quotationStatusWord } from '../quotation-words'\n\n/**\n * A quotation's 360 (ADR-0067) - what the quotation list opens to read, as the opportunity and invoice lists open\n * theirs (the user, 2026-11-13: 「팝업 보다는 360이 일관성있는 UX가 될 것 같다」). The module draws the quotation; the\n * quotation itself, lines and terms, is read in its preview.\n */\nexport function registerQuotationKind() {\n registerEntity360Kind({\n kind: 'quotation',\n typenames: ['Quotation'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.quotation')} · ${counterpartOf(value) || value.number || ''}`,\n context: ({ value }) =>\n [value.number && `${value.number} v${value.version ?? ''}`, value.issueDate, value.status ? quotationStatusWord(value.status) : ''].filter(Boolean).join(' · ')\n })\n registerEntity360Section('quotation', {\n name: 'overview',\n order: 10,\n render: subject => html`<quotation-overview-section .subject=${subject}></quotation-overview-section>`\n })\n}\n\n@customElement('quotation-overview-section')\nexport class QuotationOverviewSection extends LitElement {\n static styles = [\n ButtonStyles,\n DocumentFormStyles,\n css`\n :host {\n font-size: var(--ui-t-body);\n line-height: 1.5;\n }\n dl {\n margin: 0 0 var(--spacing-large);\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small) var(--spacing-large);\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n `\n ]\n\n @property({ attribute: false }) subject?: Entity360Subject\n /* The quotation of the subject shown (ADR-0190). */\n private quotation = new QueryController(\n this,\n gql`\n query ($id: String!) {\n quotation(id: $id) {\n id number version status direction currency language issueDate validUntil supplierName buyerName opportunity { id name }\n supplyAmount taxAmount totalAmount taxGroups { taxKind taxRate supplyAmount taxAmount }\n }\n }\n `,\n { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) }\n )\n\n get answer() {\n return entity360Answer(this.quotation, data => data?.quotation)\n }\n\n render() {\n const one = this.answer?.data\n return html`<ox-entity360-section .heading=${i18next.t('title.quotation')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>\n ${one ? html`<button slot=\"actions\" quiet small @click=${() => previewQuotation(one)}>${i18next.t('button.preview')}</button>` : ''}\n ${one\n ? html`<dl>\n <dt>${i18next.t('field.quotation-number')}</dt>\n <dd>${one.number} v${one.version} · ${quotationStatusWord(one.status)}</dd>\n <dt>${i18next.t('field.quotation-counterpart')}</dt>\n <dd>${counterpartOf(one) || '—'}</dd>\n <dt>${i18next.t('field.quotation-opportunity')}</dt>\n <dd>${one.opportunity ? entity360Link('opportunity', one.opportunity.id, one.opportunity.name) : '—'}</dd>\n <dt>${i18next.t('field.quotation-issue-date')}</dt>\n <dd>${one.issueDate ?? '—'}</dd>\n <dt>${i18next.t('field.quotation-valid-until')}</dt>\n <dd>${one.validUntil ?? '—'}</dd>\n </dl>\n ${renderDocumentTotals(one)}`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
@@ -4,8 +4,8 @@ import { FetchOption } from '@operato/data-grist';
4
4
  import { PageView } from '@operato/shell';
5
5
  declare const OpportunityList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
6
6
  /**
7
- * 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows
8
- * picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
7
+ * 영업 기회 — every opportunity of the domain, narrowed by stage. A click or a tap on the row opens its 360 to read; with one
8
+ * row picked, 「수정」 on the bar opens the editor. Rows picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
9
9
  *
10
10
  * The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow
11
11
  * the list, each with how many opportunities it holds under the other conditions — counted by the server, so the
@@ -40,6 +40,7 @@ export declare class OpportunityList extends OpportunityList_base {
40
40
  data: () => any[];
41
41
  };
42
42
  };
43
+ private editAction;
43
44
  render(): import("lit-html").TemplateResult<1>;
44
45
  pageInitialized(): Promise<void>;
45
46
  fetchHandler({ page, limit, sortings, filters, search }: FetchOption): Promise<{
@@ -7,7 +7,7 @@ import { customElement, query, state } from 'lit/decorators.js';
7
7
  import { DataGrist } from '@operato/data-grist';
8
8
  import { client } from '@operato/graphql';
9
9
  import { i18next, localize } from '@operato/i18n';
10
- import { entity360Name } from '@operato/layout';
10
+ import { entity360Name, openEntity360Kind } from '@operato/layout';
11
11
  import { navigate, PageView } from '@operato/shell';
12
12
  import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
13
13
  import { isMobileDevice } from '@operato/utils';
@@ -17,8 +17,8 @@ import { OPEN_STAGES, opportunityFilters, STAGES } from '../list-filters';
17
17
  import { opportunityStageWord } from '../opportunity-words';
18
18
  const today = () => new Date().toLocaleDateString('en-CA');
19
19
  /**
20
- * 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows
21
- * picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
20
+ * 영업 기회 — every opportunity of the domain, narrowed by stage. A click or a tap on the row opens its 360 to read; with one
21
+ * row picked, 「수정」 on the bar opens the editor. Rows picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
22
22
  *
23
23
  * The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow
24
24
  * the list, each with how many opportunities it holds under the other conditions — counted by the server, so the
@@ -27,6 +27,20 @@ const today = () => new Date().toLocaleDateString('en-CA');
27
27
  * with the search, sort and page, and a change reads page 1 (FOOTER-BUTTON-REVIEW G09).
28
28
  */
29
29
  let OpportunityList = class OpportunityList extends localize(i18next)(PageView) {
30
+ constructor() {
31
+ super(...arguments);
32
+ /* Changing it is apart from reading it: one picked row, 「수정」 on the bar over the list (the user, 2026-11-13). */
33
+ this.editAction = {
34
+ title: i18next.t('button.edit'),
35
+ icon: 'edit',
36
+ single: true,
37
+ action: () => {
38
+ const row = this.grist.selected?.[0];
39
+ if (row?.id)
40
+ navigate(`opportunity-editor?id=${row.id}`);
41
+ }
42
+ };
43
+ }
30
44
  static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
31
45
  /* The people an opportunity may be put in the charge of - the editor's choices, read when the filter opens. */
32
46
  async owners() {
@@ -59,6 +73,7 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
59
73
  list="opportunities"
60
74
  axis="opportunity"
61
75
  .labelOf=${(row) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}
76
+ .actions=${[this.editAction]}
62
77
  ></ox-assistant-selection-bar>
63
78
  <ox-grist
64
79
  class="page-fill"
@@ -75,7 +90,7 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
75
90
  </ox-grist>`;
76
91
  }
77
92
  async pageInitialized() {
78
- const open = (record) => record?.id && navigate(`opportunity-editor?id=${record.id}`);
93
+ const open = (record) => record?.id && openEntity360Kind('opportunity', record);
79
94
  const party = (value) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '');
80
95
  const readonly = (type, name, header, width, extra = {}) => ({
81
96
  type,
@@ -87,14 +102,18 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
87
102
  record: { editable: false, ...extra.record }
88
103
  });
89
104
  this.gristConfig = {
90
- rows: { appendable: false, selectable: { multiple: true } },
105
+ /* The row's picker (a gutter) picks it for the bar; the rest of the row opens its 360 to read. */
106
+ rows: {
107
+ appendable: false,
108
+ selectable: { multiple: true },
109
+ handlers: { click: (_c, _d, column, record) => column?.type !== 'gutter' && open(record) }
110
+ },
91
111
  pagination: { limit: 50, pages: [50, 100, 500] },
92
112
  emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },
93
113
  list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },
94
114
  columns: [
95
115
  { type: 'gutter', gutterName: 'sequence' },
96
116
  SELECTION_ROW_PICKER,
97
- { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c, _d, _col, record) => open(record) } },
98
117
  readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {
99
118
  record: { renderer: (_v, _c, record) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }
100
119
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"opportunity-list.js","sourceRoot":"","sources":["../../client/pages/opportunity-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,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,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEpE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE3D,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;AAE1D;;;;;;;;;GASG;AAEI,IAAM,eAAe,GAArB,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AAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACrD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,GAAqC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IACnJ,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,OAAc,EAAE,UAA2C,EAAE,QAAe,EAAE,MAAe;QACnH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBT;YACD,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;YACpD,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC,SAA4C,CAAA;IACnE,CAAC;;AA3JQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;IAE5C,+GAA+G;;8CAFnE;AAJjC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CA+J3B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { OPEN_STAGES, opportunityFilters, STAGES } from '../list-filters'\nimport { opportunityStageWord } from '../opportunity-words'\n\nconst today = () => new Date().toLocaleDateString('en-CA')\n\n/**\n * 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows\n * picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).\n *\n * The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow\n * the list, each with how many opportunities it holds under the other conditions — counted by the server, so the\n * numbers agree with one another whichever chips are pressed. The list opens on the open stages, won and lost left\n * out; with none pressed every stage shows. All three are the grid's own column filters, so the address keeps them\n * with the search, sort and page, and a change reads page 1 (FOOTER-BUTTON-REVIEW G09).\n */\n@customElement('opportunity-list')\nexport class OpportunityList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n /* The people an opportunity may be put in the charge of - the editor's choices, read when the filter opens. */\n private async owners(): Promise<{ value: string; display: string }[]> {\n const response = await client.query({ query: gql`{ opportunityOwners { id name } }` })\n return (response.data?.opportunityOwners ?? []).map((one: any) => ({ value: one.id, display: one.name }))\n }\n\n get context() {\n return {\n title: i18next.t('title.opportunity-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n /* Narrowing by stage stays in the headroom, and this folds it. */\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [{ title: i18next.t('button.opportunity-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('opportunity-editor') }],\n exportable: { name: i18next.t('title.opportunity-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-assistant-selection-bar\n .gridOf=${() => this.grist}\n name=${i18next.t('title.opportunity-list')}\n list=\"opportunities\"\n axis=\"opportunity\"\n .labelOf=${(row: any) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}\n ></ox-assistant-selection-bar>\n <ox-grist\n class=\"page-fill\"\n search-mode=\"term\"\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .countHandler=${this.countHandler.bind(this)}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const open = (record: any) => record?.id && navigate(`opportunity-editor?id=${record.id}`)\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '')\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true } },\n pagination: { limit: 50, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },\n list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n SELECTION_ROW_PICKER,\n { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {\n record: { renderer: (_v: any, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }\n }),\n readonly('string', 'counterparty', i18next.t('field.opportunity-counterparty'), 180, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'endCustomer', i18next.t('field.opportunity-end-customer'), 160, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'stage', i18next.t('field.opportunity-stage'), 90, {\n record: { renderer: (value: string) => opportunityStageWord(value) },\n /* Chips with their counts; the list opens on the open stages, and none pressed is every stage. */\n filter: { type: 'select-buttons', operator: 'in', value: OPEN_STAGES, options: STAGES.map(stage => ({ value: stage, display: opportunityStageWord(stage) })) }\n }),\n readonly('integer', 'probability', i18next.t('field.opportunity-probability'), 70, { record: { align: 'right', renderer: (value: number) => `${value ?? 0}%` } }),\n readonly('float', 'amount', i18next.t('field.opportunity-amount'), 150, {\n record: { align: 'right', renderer: (value: number, _c: any, record: any) => documentAmount(value, record?.currency || 'KRW') }\n }),\n readonly('string', 'expectedCloseMonth', i18next.t('field.opportunity-expected-close-month'), 100, {\n /* A period named relative to today, so a shared address reads the same period on another day's terms. */\n filter: {\n type: 'select',\n operator: 'eq',\n options: ['', 'this-month', 'next-month', 'this-quarter', 'this-year'].map(value => ({ value, display: i18next.t(`text.opportunity-close-${value || 'all'}`) }))\n }\n }),\n readonly('string', 'owner', i18next.t('field.opportunity-owner'), 110, {\n sortable: false,\n record: { renderer: (value: any) => value?.name ?? '' },\n filter: { type: 'select', operator: 'eq', options: async () => [{ value: '', display: i18next.t('text.opportunity-owner-all') }, ...(await this.owners())] }\n })\n ],\n sorters: [{ name: 'expectedCloseMonth' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\n const response = await this.fetchPage(opportunityFilters(filters, today()), { page, limit }, sortings, search?.trim() || undefined)\n return { total: response.total, records: response.items }\n }\n\n /* The stage chips' numbers under the list's other conditions - the chips' own left out - counted by the server. */\n async countHandler({ filters = [], search, signal }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $search: String) {\n opportunityStageCounts(filters: $filters, search: $search) {\n stage\n count\n }\n }\n `,\n variables: { filters: opportunityFilters(filters, today()).filter(one => one.name !== 'stage'), search: search?.trim() || undefined },\n fetchPolicy: 'no-cache',\n context: { fetchOptions: { signal }, queryDeduplication: false }\n })\n if (response.errors?.length) throw response.errors[0]\n return { stage: Object.fromEntries(response.data.opportunityStageCounts.map((row: { stage: string; count: number }) => [row.stage, row.count])) }\n }\n\n private async fetchPage(filters: any[], pagination: { page: number; limit: number }, sortings: any[], search?: string) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: opportunities(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id\n name\n stage\n probability\n amount\n currency\n expectedCloseMonth\n counterparty { id name }\n endCustomer { id name }\n owner { id name }\n }\n total\n }\n }\n `,\n variables: { filters, pagination, sortings, search },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return response.data.responses as { items: any[]; total: number }\n }\n}\n"]}
1
+ {"version":3,"file":"opportunity-list.js","sourceRoot":"","sources":["../../client/pages/opportunity-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,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,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,EAAE,cAAc,EAAE,MAA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E,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBT;YACD,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;YACpD,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC,SAA4C,CAAA;IACnE,CAAC;;AA3KQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;IAE5C,+GAA+G;;8CAFnE;AAJjC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CA+K3B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name, openEntity360Kind } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { OPEN_STAGES, opportunityFilters, STAGES } from '../list-filters'\nimport { opportunityStageWord } from '../opportunity-words'\n\nconst today = () => new Date().toLocaleDateString('en-CA')\n\n/**\n * 영업 기회 — every opportunity of the domain, narrowed by stage. A click or a tap on the row opens its 360 to read; with one\n * row picked, 「수정」 on the bar opens the editor. Rows picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).\n *\n * The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow\n * the list, each with how many opportunities it holds under the other conditions — counted by the server, so the\n * numbers agree with one another whichever chips are pressed. The list opens on the open stages, won and lost left\n * out; with none pressed every stage shows. All three are the grid's own column filters, so the address keeps them\n * with the search, sort and page, and a change reads page 1 (FOOTER-BUTTON-REVIEW G09).\n */\n@customElement('opportunity-list')\nexport class OpportunityList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n /* The people an opportunity may be put in the charge of - the editor's choices, read when the filter opens. */\n private async owners(): Promise<{ value: string; display: string }[]> {\n const response = await client.query({ query: gql`{ opportunityOwners { id name } }` })\n return (response.data?.opportunityOwners ?? []).map((one: any) => ({ value: one.id, display: one.name }))\n }\n\n get context() {\n return {\n title: i18next.t('title.opportunity-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n /* Narrowing by stage stays in the headroom, and this folds it. */\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [{ title: i18next.t('button.opportunity-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('opportunity-editor') }],\n exportable: { name: i18next.t('title.opportunity-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n /* Changing it is apart from reading it: one picked row, 「수정」 on the bar over the list (the user, 2026-11-13). */\n private editAction = {\n title: i18next.t('button.edit'),\n icon: 'edit',\n single: true,\n action: () => {\n const row = this.grist.selected?.[0]\n if (row?.id) navigate(`opportunity-editor?id=${row.id}`)\n }\n }\n\n render() {\n return html`<ox-assistant-selection-bar\n .gridOf=${() => this.grist}\n name=${i18next.t('title.opportunity-list')}\n list=\"opportunities\"\n axis=\"opportunity\"\n .labelOf=${(row: any) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}\n .actions=${[this.editAction]}\n ></ox-assistant-selection-bar>\n <ox-grist\n class=\"page-fill\"\n search-mode=\"term\"\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .countHandler=${this.countHandler.bind(this)}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const open = (record: any) => record?.id && openEntity360Kind('opportunity', record)\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '')\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n /* The row's picker (a gutter) picks it for the bar; the rest of the row opens its 360 to read. */\n rows: {\n appendable: false,\n selectable: { multiple: true },\n handlers: { click: (_c: any, _d: any, column: any, record: any) => column?.type !== 'gutter' && open(record) }\n },\n pagination: { limit: 50, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },\n list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n SELECTION_ROW_PICKER,\n readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {\n record: { renderer: (_v: any, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }\n }),\n readonly('string', 'counterparty', i18next.t('field.opportunity-counterparty'), 180, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'endCustomer', i18next.t('field.opportunity-end-customer'), 160, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'stage', i18next.t('field.opportunity-stage'), 90, {\n record: { renderer: (value: string) => opportunityStageWord(value) },\n /* Chips with their counts; the list opens on the open stages, and none pressed is every stage. */\n filter: { type: 'select-buttons', operator: 'in', value: OPEN_STAGES, options: STAGES.map(stage => ({ value: stage, display: opportunityStageWord(stage) })) }\n }),\n readonly('integer', 'probability', i18next.t('field.opportunity-probability'), 70, { record: { align: 'right', renderer: (value: number) => `${value ?? 0}%` } }),\n readonly('float', 'amount', i18next.t('field.opportunity-amount'), 150, {\n record: { align: 'right', renderer: (value: number, _c: any, record: any) => documentAmount(value, record?.currency || 'KRW') }\n }),\n readonly('string', 'expectedCloseMonth', i18next.t('field.opportunity-expected-close-month'), 100, {\n /* A period named relative to today, so a shared address reads the same period on another day's terms. */\n filter: {\n type: 'select',\n operator: 'eq',\n options: ['', 'this-month', 'next-month', 'this-quarter', 'this-year'].map(value => ({ value, display: i18next.t(`text.opportunity-close-${value || 'all'}`) }))\n }\n }),\n readonly('string', 'owner', i18next.t('field.opportunity-owner'), 110, {\n sortable: false,\n record: { renderer: (value: any) => value?.name ?? '' },\n filter: { type: 'select', operator: 'eq', options: async () => [{ value: '', display: i18next.t('text.opportunity-owner-all') }, ...(await this.owners())] }\n })\n ],\n sorters: [{ name: 'expectedCloseMonth' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\n const response = await this.fetchPage(opportunityFilters(filters, today()), { page, limit }, sortings, search?.trim() || undefined)\n return { total: response.total, records: response.items }\n }\n\n /* The stage chips' numbers under the list's other conditions - the chips' own left out - counted by the server. */\n async countHandler({ filters = [], search, signal }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $search: String) {\n opportunityStageCounts(filters: $filters, search: $search) {\n stage\n count\n }\n }\n `,\n variables: { filters: opportunityFilters(filters, today()).filter(one => one.name !== 'stage'), search: search?.trim() || undefined },\n fetchPolicy: 'no-cache',\n context: { fetchOptions: { signal }, queryDeduplication: false }\n })\n if (response.errors?.length) throw response.errors[0]\n return { stage: Object.fromEntries(response.data.opportunityStageCounts.map((row: { stage: string; count: number }) => [row.stage, row.count])) }\n }\n\n private async fetchPage(filters: any[], pagination: { page: number; limit: number }, sortings: any[], search?: string) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: opportunities(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id\n name\n stage\n probability\n amount\n currency\n expectedCloseMonth\n counterparty { id name }\n endCustomer { id name }\n owner { id name }\n }\n total\n }\n }\n `,\n variables: { filters, pagination, sortings, search },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return response.data.responses as { items: any[]; total: number }\n }\n}\n"]}
@@ -111,10 +111,6 @@ export declare class QuotationEditor extends QuotationEditor_base {
111
111
  * as the invoice editor links it.
112
112
  */
113
113
  private makeInvoice;
114
- /**
115
- * The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
116
- * quotation's own first, to download as PDF or print. What is on screen and not saved is not in it.
117
- */
118
114
  private preview;
119
115
  }
120
116
  export {};
@@ -14,9 +14,10 @@ import { OxPrompt } from '@operato/popup/ox-prompt.js';
14
14
  import { navigate, PageView, DraftController } from '@operato/shell';
15
15
  import { ButtonStyles, CommonGristStyles, DocumentPageStyles, FormFieldStyles, ScrollbarStyles } from '@operato/styles';
16
16
  import { hasPrivilege } from '@things-factory/auth-base/dist-client';
17
- import { daysAfter, documentAmount, DocumentFormStyles, documentLinesConfig, linesOf, onLineChange, openDocumentPreview, reckonLines, renderDocumentHead, renderDocumentTotals, DOCUMENT_DEFAULTS, DOCUMENT_DEFAULTS_READER, headFromDefaults, nextInvoiceNumber, OUR_SIDE_FIELDS, oursFromLast, partyOfName } from '@things-factory/invoice/dist-client';
17
+ import { daysAfter, documentAmount, DocumentFormStyles, documentLinesConfig, linesOf, onLineChange, reckonLines, renderDocumentHead, renderDocumentTotals, DOCUMENT_DEFAULTS, DOCUMENT_DEFAULTS_READER, headFromDefaults, nextInvoiceNumber, OUR_SIDE_FIELDS, oursFromLast, partyOfName } from '@things-factory/invoice/dist-client';
18
18
  import '@things-factory/biz-base/dist-client';
19
19
  import { quotationSection } from '../quotation-attach';
20
+ import { previewQuotation } from '../quotation-preview';
20
21
  import '../sales-product-pick';
21
22
  import { lineOfProduct } from '../sales-product-pick';
22
23
  import { quotationStatusWord } from '../quotation-words';
@@ -547,26 +548,9 @@ let QuotationEditor = class QuotationEditor extends localize(i18next)(PageView)
547
548
  this.making = false;
548
549
  }
549
550
  }
550
- /**
551
- * The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
552
- * quotation's own first, to download as PDF or print. What is on screen and not saved is not in it.
553
- */
554
551
  preview() {
555
552
  const { id, number, version, language } = this.quotation;
556
- openDocumentPreview(async (format, lng) => {
557
- const response = await client.query({
558
- query: gql `
559
- query ($id: String!, $format: DocumentFileFormat!, $language: String) {
560
- quotationDocumentFile(id: $id, format: $format, language: $language) { fileName mimeType content }
561
- }
562
- `,
563
- variables: { id, format, language: lng },
564
- fetchPolicy: 'no-cache'
565
- });
566
- if (!response.data?.quotationDocumentFile)
567
- throw response.errors?.[0] ?? new Error(i18next.t('text.quotation-not-found'));
568
- return response.data.quotationDocumentFile;
569
- }, language, `${i18next.t('title.preview')} · ${number} · v${version}`);
553
+ previewQuotation({ id, number, version, language });
570
554
  }
571
555
  };
572
556
  __decorate([