@things-factory/sales 10.1.278 → 10.1.279

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/package.json +23 -7
  2. package/CHANGELOG.md +0 -8
  3. package/dist-client/bootstrap.js.map +0 -1
  4. package/dist-client/close-months.js.map +0 -1
  5. package/dist-client/entity360/opportunity-360.js.map +0 -1
  6. package/dist-client/entity360/quotation-360.js.map +0 -1
  7. package/dist-client/index.js.map +0 -1
  8. package/dist-client/list-filters.js.map +0 -1
  9. package/dist-client/opportunity-attach.js.map +0 -1
  10. package/dist-client/opportunity-words.js.map +0 -1
  11. package/dist-client/pages/opportunity-editor.js.map +0 -1
  12. package/dist-client/pages/opportunity-list.js.map +0 -1
  13. package/dist-client/pages/quotation-editor.js.map +0 -1
  14. package/dist-client/pages/quotation-list.js.map +0 -1
  15. package/dist-client/pages/sales-product-list.js.map +0 -1
  16. package/dist-client/quotation-attach.js.map +0 -1
  17. package/dist-client/quotation-preview.js.map +0 -1
  18. package/dist-client/quotation-words.js.map +0 -1
  19. package/dist-client/route.js.map +0 -1
  20. package/dist-client/sales-product-pick.js.map +0 -1
  21. package/dist-client/sales-product-words.js.map +0 -1
  22. package/dist-client/tsconfig.tsbuildinfo +0 -1
  23. package/dist-server/controllers/index.js.map +0 -1
  24. package/dist-server/index.js.map +0 -1
  25. package/dist-server/middlewares/index.js.map +0 -1
  26. package/dist-server/migrations/index.js.map +0 -1
  27. package/dist-server/role-tasks.js.map +0 -1
  28. package/dist-server/routes.js.map +0 -1
  29. package/dist-server/service/index.js.map +0 -1
  30. package/dist-server/service/opportunity/index.js.map +0 -1
  31. package/dist-server/service/opportunity/opportunity-event-query.js.map +0 -1
  32. package/dist-server/service/opportunity/opportunity-event.js.map +0 -1
  33. package/dist-server/service/opportunity/opportunity-mutation.js.map +0 -1
  34. package/dist-server/service/opportunity/opportunity-query.js.map +0 -1
  35. package/dist-server/service/opportunity/opportunity-rules.js.map +0 -1
  36. package/dist-server/service/opportunity/opportunity-service.js.map +0 -1
  37. package/dist-server/service/opportunity/opportunity-subject.js.map +0 -1
  38. package/dist-server/service/opportunity/opportunity-type.js.map +0 -1
  39. package/dist-server/service/opportunity/opportunity.js.map +0 -1
  40. package/dist-server/service/quotation/index.js.map +0 -1
  41. package/dist-server/service/quotation/quotation-event-query.js.map +0 -1
  42. package/dist-server/service/quotation/quotation-event.js.map +0 -1
  43. package/dist-server/service/quotation/quotation-item-query.js.map +0 -1
  44. package/dist-server/service/quotation/quotation-item.js.map +0 -1
  45. package/dist-server/service/quotation/quotation-mutation.js.map +0 -1
  46. package/dist-server/service/quotation/quotation-query.js.map +0 -1
  47. package/dist-server/service/quotation/quotation-rules.js.map +0 -1
  48. package/dist-server/service/quotation/quotation-service.js.map +0 -1
  49. package/dist-server/service/quotation/quotation-status.js.map +0 -1
  50. package/dist-server/service/quotation/quotation-type.js.map +0 -1
  51. package/dist-server/service/quotation/quotation.js.map +0 -1
  52. package/dist-server/service/sales-event.js.map +0 -1
  53. package/dist-server/service/sales-product/index.js.map +0 -1
  54. package/dist-server/service/sales-product/sales-product-mutation.js.map +0 -1
  55. package/dist-server/service/sales-product/sales-product-query.js.map +0 -1
  56. package/dist-server/service/sales-product/sales-product-rules.js.map +0 -1
  57. package/dist-server/service/sales-product/sales-product-service.js.map +0 -1
  58. package/dist-server/service/sales-product/sales-product-type.js.map +0 -1
  59. package/dist-server/service/sales-product/sales-product.js.map +0 -1
  60. package/dist-server/service/sales-read.js.map +0 -1
  61. package/dist-server/tsconfig.tsbuildinfo +0 -1
  62. package/dist-server/work-doors.js.map +0 -1
package/package.json CHANGED
@@ -1,8 +1,24 @@
1
1
  {
2
2
  "name": "@things-factory/sales",
3
- "version": "10.1.278",
3
+ "version": "10.1.279",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
+ "files": [
7
+ "assets",
8
+ "dist-client",
9
+ "dist-server",
10
+ "helps",
11
+ "things-factory.config.js",
12
+ "translations",
13
+ "!**/*.map",
14
+ "!**/*.test.*",
15
+ "!**/*.spec.*",
16
+ "!**/test/**",
17
+ "!**/tests/**",
18
+ "!**/__tests__/**",
19
+ "!**/*.tsbuildinfo",
20
+ "!**/.DS_Store"
21
+ ],
6
22
  "things-factory": true,
7
23
  "license": "MIT",
8
24
  "author": "heartyoh <heartyoh@hatiolab.com>",
@@ -40,11 +56,11 @@
40
56
  "@operato/shell": "^10.29.69",
41
57
  "@operato/styles": "^10.29.1",
42
58
  "@operato/utils": "^10.0.0",
43
- "@things-factory/ai-assistant": "^10.1.278",
44
- "@things-factory/auth-base": "^10.1.278",
45
- "@things-factory/biz-base": "^10.1.278",
46
- "@things-factory/invoice": "^10.1.278",
47
- "@things-factory/shell": "^10.1.278"
59
+ "@things-factory/ai-assistant": "^10.1.279",
60
+ "@things-factory/auth-base": "^10.1.279",
61
+ "@things-factory/biz-base": "^10.1.279",
62
+ "@things-factory/invoice": "^10.1.279",
63
+ "@things-factory/shell": "^10.1.279"
48
64
  },
49
- "gitHead": "dc8920fe1a0b85e87b0069951b0ef2bd8e9bb99e"
65
+ "gitHead": "666c08055c408b408fde961ad10da080941b147c"
50
66
  }
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
- and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
-
8
- <!-- ## [Unreleased] -->
@@ -1 +0,0 @@
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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"close-months.js","sourceRoot":"","sources":["../client/close-months.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,GAAW;IACvD,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;IAC9E,IAAI,MAAM,KAAK,YAAY;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAChF,IAAI,MAAM,KAAK,YAAY;QAAE,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;IACtJ,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACjD,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC;IACD,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IACxE,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/**\n * The expected-close months a period names, as `YYYY-MM` bounds, from a day `YYYY-MM-DD`: this month, next month, this\n * quarter or this year. Any other period names none - every month.\n */\nexport function closeMonthsOf(period: string, day: string): [string, string] | undefined {\n const [year, month] = day.split('-').map(Number)\n const monthOf = (y: number, m: number) => `${y}-${String(m).padStart(2, '0')}`\n if (period === 'this-month') return [monthOf(year, month), monthOf(year, month)]\n if (period === 'next-month') return month === 12 ? [monthOf(year + 1, 1), monthOf(year + 1, 1)] : [monthOf(year, month + 1), monthOf(year, month + 1)]\n if (period === 'this-quarter') {\n const first = Math.floor((month - 1) / 3) * 3 + 1\n return [monthOf(year, first), monthOf(year, first + 2)]\n }\n if (period === 'this-year') return [monthOf(year, 1), monthOf(year, 12)]\n return undefined\n}\n"]}
@@ -1 +0,0 @@
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,CAA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B,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"]}
@@ -1 +0,0 @@
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,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,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,qBAAqB,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,CAAC,WAAW,CAAC;QACxB,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,CAAC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AC;;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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAyB,MAAM,uBAAuB,CAAA;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,2BAA2B,EAA2B,MAAM,yBAAyB,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["export { configureQuotationSection, type QuotationSection } from './quotation-attach.js'\nexport { quotationStatusWord } from './quotation-words.js'\nexport { configureOpportunitySection, type OpportunitySection } from './opportunity-attach.js'\nexport { opportunityStageWord } from './opportunity-words.js'\nexport { salesProductKindWord } from './sales-product-words.js'\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-filters.js","sourceRoot":"","sources":["../client/list-filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAUjD;;;;GAIG;AACH,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAE9B,yFAAyF;AACzF,MAAM,UAAU,mBAAmB,CAAC,OAA8B;IAChE,OAAO,OAAO;SACX,MAAM,CAAC,IAAI,CAAC;SACZ,GAAG,CAAC,GAAG,CAAC,EAAE,CACT,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,KAAK,UAAU,CAAC;QACpG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE;QAC/F,CAAC,CAAC,GAAG,CACR,CAAA;AACL,CAAC;AAED,0HAA0H;AAC1H,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAG,WAAW,EAAE,KA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,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACxC,iHAAiH;QACjH,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvF,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAChC,IAAI,IAAI;gBAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAC5E,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA","sourcesContent":["import { isFilterCondition } from '@operato/data-grist/filter-condition.js'\n\nimport { closeMonthsOf } from './close-months.js'\n\n/*\n * The sales lists' conditions are the grid's own column filters, kept in the address with the search, sort and page\n * (FOOTER-BUTTON-REVIEW G09). These turn the grid's filter values into the conditions the server's list queries read.\n * Pure: no browser, so the module's tests read them as built.\n */\n\nexport type GridFilter = { name: string; operator: string; value: any }\n\n/*\n * A filter is a condition by the grid's own rule (`isFilterCondition`: an operator that takes no value always is, an\n * empty choice is not). Every condition passes on untouched - the conversions below change only the filters they are\n * for, by name, operator and value form together.\n */\nconst said = isFilterCondition\n\n/** 상품: the 사용 chip (`active` / `inactive`) as the boolean condition the server reads. */\nexport function salesProductFilters(filters: readonly GridFilter[]): GridFilter[] {\n return filters\n .filter(said)\n .map(one =>\n one.name === 'active' && one.operator === 'eq' && (one.value === 'active' || one.value === 'inactive')\n ? { name: 'active', operator: one.value === 'active' ? 'is_true' : 'is_not_true', value: null }\n : one\n )\n}\n\n/** The opportunity stages a person still moves an opportunity through - the list opens on them, won and lost left out. */\nexport const OPEN_STAGES = ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION']\nexport const STAGES = [...OPEN_STAGES, 'WON', 'LOST']\n\n/**\n * 영업 기회: the person in charge (the `owner` column, a user id) as `ownerId`, and the expected-close period (the\n * `expectedCloseMonth` column, `this-month` … `this-year`) as the months it covers on `today` (`YYYY-MM-DD`). The stages\n * pass as they are.\n */\nexport function opportunityFilters(filters: readonly GridFilter[], today: string): GridFilter[] {\n return filters.filter(said).flatMap(one => {\n /* The person in charge is asked by id - with the operator the filter has (담당자 제외 stays an exclusion). */\n if (one.name === 'owner') {\n const id = (value: any) => (value && typeof value === 'object' ? value.id : value)\n return [{ ...one, name: 'ownerId', value: Array.isArray(one.value) ? one.value.map(id) : id(one.value) }]\n }\n /* Only the chosen period (`this-quarter` …) becomes its months; a month or any other condition passes as it is. */\n if (one.name === 'expectedCloseMonth' && one.operator === 'eq' && typeof one.value === 'string') {\n const months = closeMonthsOf(one.value, today)\n if (months) return [{ name: 'expectedCloseMonth', operator: 'between', value: months }]\n }\n return [one]\n })\n}\n\n/**\n * 견적: the issue period (the `issueDate` column, `this-month` … `last-year`) as the days it covers, by the invoice\n * module's `issuePeriodOf`. The statuses pass as they are.\n */\nexport function quotationFilters(filters: readonly GridFilter[], periodOf: (period: string) => [string, string] | undefined): GridFilter[] {\n return filters.filter(said).flatMap(one => {\n /* Only the chosen period (`this-month` …) becomes its days; a day itself or another operator passes as it is. */\n if (one.name === 'issueDate' && one.operator === 'eq' && typeof one.value === 'string') {\n const days = periodOf(one.value)\n if (days) return [{ name: 'issueDate', operator: 'between', value: days }]\n }\n return [one]\n })\n}\n\n/** Every status a quotation version takes, in the order the chips show them. */\nexport const QUOTATION_STATUSES = ['DRAFT', 'SENT', 'ACCEPTED', 'REJECTED', 'EXPIRED', 'SUPERSEDED']\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity-attach.js","sourceRoot":"","sources":["../client/opportunity-attach.ts"],"names":[],"mappings":"AAoBA,IAAI,OAAuC,CAAA;AAE3C,MAAM,UAAU,2BAA2B,CAAC,GAAuB;IACjE,OAAO,GAAG,GAAG,CAAA;AACf,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { type TemplateResult } from 'lit'\n\n/*\n * Where an application attaches its own work to an opportunity — Office ties it to the contract it became and to the\n * classification its pivot judgement reads (ADR-0138 decision 8). The sales module knows no application words. A\n * section that changed the opportunity (closed it as won) dispatches `opportunity-changed`; the editor reads it again.\n */\n\nexport type OpportunitySection = {\n /** The section's heading, already in the reader's words. */\n heading: () => string\n /** The section's body for one saved opportunity; it reads and writes through the application's own API. */\n /**\n * Whether this person may read the section. The application's section reads its own doors; someone who may not\n * open them gets no section at all - no heading, and no query refused on their screen. Left out, everyone sees it.\n */\n readable?: () => Promise<boolean>\n render: (opportunity: { id: string; name: string; stage: string; counterpartyId: string; currency: string; amount: number; expectedCloseMonth: string }) => TemplateResult\n}\n\nlet section: OpportunitySection | undefined\n\nexport function configureOpportunitySection(one: OpportunitySection): void {\n section = one\n}\n\nexport function opportunitySection(): OpportunitySection | undefined {\n return section\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity-words.js","sourceRoot":"","sources":["../client/opportunity-words.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAE,EAAE,CACrD,KAAK,KAAK,UAAU;IAClB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;IAC9C,CAAC,CAAC,KAAK,KAAK,QAAQ;QAClB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC;QAC5C,CAAC,CAAC,KAAK,KAAK,aAAa;YACvB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC;YACjD,CAAC,CAAC,KAAK,KAAK,KAAK;gBACf,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;gBACzC,CAAC,CAAC,KAAK,KAAK,MAAM;oBAChB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;oBAC1C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAA","sourcesContent":["import { i18next } from '@operato/i18n'\n\nexport const opportunityStageWord = (stage?: string) =>\n stage === 'PROPOSAL'\n ? i18next.t('text.opportunity-stage-proposal')\n : stage === 'QUOTED'\n ? i18next.t('text.opportunity-stage-quoted')\n : stage === 'NEGOTIATION'\n ? i18next.t('text.opportunity-stage-negotiation')\n : stage === 'WON'\n ? i18next.t('text.opportunity-stage-won')\n : stage === 'LOST'\n ? i18next.t('text.opportunity-stage-lost')\n : i18next.t('text.opportunity-stage-lead')\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity-editor.js","sourceRoot":"","sources":["../../client/pages/opportunity-editor.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,sCAAsC,CAAA;AAC7C,OAAO,sCAAsC,CAAA;AAE7C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACnF,OAAO,EA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;QAC9B,kBAAkB,EAAE,WAAW,CAAC,kBAAkB;QAClD,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;QAC5C,OAAO,EAAE,WAAW,CAAC,OAAO,IAAI,EAAE;QAClC,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE;KAC3C,CAAA;AACH,CAAC;AAED,SAAS,KAAK,CAAC,SAAmD,EAAE;IAClE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC,CAAA;IACrD,OAAO;QACL,IAAI,EAAE,EAAE;QACR,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,KAAK;QACf,kBAAkB,EAAE,SAAS,EAAE;QAC/B,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;QACjD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KAChB,CAAA;AACH,CAAC","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@operato/list-state/ox-page-state.js'\nimport '@things-factory/biz-base/dist-client'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { MutationController, QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView, DraftController } from '@operato/shell'\nimport { ButtonStyles, DocumentPageStyles, FormFieldStyles } from '@operato/styles'\nimport { currencyChoices, documentAmount, DocumentFormStyles } from '@things-factory/invoice/dist-client'\n\nimport { opportunitySection } from '../opportunity-attach'\nimport { opportunityStageWord } from '../opportunity-words'\nimport { quotationStatusWord } from '../quotation-words'\n\nconst FIELDS = `\n id name stage probability amount currency expectedCloseMonth closedOn lostReason description\n counterpartyId endCustomerId ownerId counterparty { id name } endCustomer { id name } owner { id name }\n quotations { id number version status issueDate validUntil totalAmount currency }\n`\n\ntype Party = { id: string; name: string; businessNumber?: string }\ntype Form = {\n name: string\n counterparty: Party | null\n endCustomer: Party | null\n amount: string\n currency: string\n expectedCloseMonth: string\n stage: string\n probability: string\n ownerId: string\n description: string\n}\n\nconst READ = gql(`\n query ($id: String!) {\n opportunity(id: $id) { ${FIELDS} }\n opportunityEvents(opportunityId: $id) { id action fromStage stage probability reason createdAt actor { id name } }\n }\n`)\n\nconst thisMonth = () => new Date().toLocaleDateString('en-CA').slice(0, 7)\n\n/**\n * 영업 기회 편집 — with whom, for how much, by when and how likely.\n *\n * A person moves an open opportunity through the stages; changing the stage puts that stage's probability in, and the\n * person may change it. An open one is closed as lost with the reason; a lost one is opened again by choosing an open\n * stage. Winning is the application's: it closes the opportunity when the opportunity becomes its contract.\n */\n@customElement('opportunity-editor')\nexport class OpportunityEditor extends localize(i18next)(PageView) {\n static styles = [\n FormFieldStyles,\n ButtonStyles,\n DocumentPageStyles,\n DocumentFormStyles,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n font-variant-numeric: tabular-nums;\n }\n th,\n td {\n text-align: left;\n padding: var(--spacing-small);\n border-bottom: 1px solid var(--ui-line-soft);\n font-size: var(--ui-t-body);\n }\n th.number,\n td.number {\n text-align: right;\n }\n td a {\n color: inherit;\n text-decoration: underline;\n }\n `\n ]\n\n /** The opportunity the address names; none for a new one. */\n @state() private opportunityId = ''\n /** Whether the application's section is this person's to read - asked once, before it is shown. */\n @state() sectionReadable = false\n\n /* The stages with their probabilities and who may own one, and the opportunity the address names (ADR-0190). */\n private choices = new QueryController(\n this,\n gql`\n query {\n opportunityStages { stage probability open }\n opportunityOwners { id name email }\n }\n `\n )\n private record = new QueryController(this, READ, { variables: () => (this.opportunityId ? { id: this.opportunityId } : undefined) })\n\n /* What is typed over the opportunity read - a new one starts blank, at the first stage. */\n private draft = new DraftController<Form>(this, { read: () => (this.opportunityId ? this.opportunity && formOf(this.opportunity) : blank(this.stages)), key: () => this.opportunityId })\n /* The reason a lost one is closed with. */\n private loss = new DraftController<{ reason: string }>(this, { read: () => ({ reason: '' }), key: () => this.opportunityId })\n\n /* Every change reads the opportunity again once it is done. */\n private saves = {\n create: new MutationController(this, gql`mutation ($opportunity: NewOpportunity!) { opportunity: createOpportunity(opportunity: $opportunity) { id } }`),\n update: this.change(gql`mutation ($id: String!, $opportunity: NewOpportunity!) { opportunity: updateOpportunity(id: $id, opportunity: $opportunity) { id } }`),\n lose: this.change(gql`mutation ($id: String!, $reason: String!) { loseOpportunity(id: $id, reason: $reason) { id } }`)\n }\n\n private change(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.record] })\n }\n\n private get opportunity(): any {\n return (this.opportunityId && this.record.data?.opportunity) || null\n }\n\n private get events(): any[] {\n return (this.opportunityId && this.record.data?.opportunityEvents) || []\n }\n\n private get stages(): { stage: string; probability: number; open: boolean }[] {\n return this.choices.data?.opportunityStages ?? []\n }\n\n private get owners(): { id: string; name: string; email?: string }[] {\n return this.choices.data?.opportunityOwners ?? []\n }\n\n /** The form as it shows: each field's edit, else what was read (blank while it is read). */\n private get form(): Form {\n return Object.fromEntries(Object.entries(blank(this.stages)).map(([name, given]) => [name, this.draft.value(name as keyof Form) ?? given])) as Form\n }\n\n private get reason() {\n return this.loss.value('reason') ?? ''\n }\n\n /** A failed read, or an opportunity the address names that is not there. */\n private get error(): unknown {\n if (this.choices.error || this.record.error) return this.choices.error ?? this.record.error\n return this.opportunityId && this.record.data && !this.record.data.opportunity ? new Error(i18next.t('text.opportunity-not-found')) : null\n }\n\n private get loading() {\n return this.choices.loading || this.record.loading\n }\n\n private get busy() {\n return Object.values(this.saves).some(save => save.pending)\n }\n\n private isOpen(stage: string) {\n return this.stages.some(one => one.stage === stage && one.open)\n }\n\n /** Won is final; a lost one is changed only by being opened again. */\n get editable() {\n return !this.busy && this.opportunity?.stage !== 'WON' && this.isOpen(this.form.stage)\n }\n\n get context() {\n const actions: any[] = []\n if (this.editable) actions.push({ title: i18next.t('button.save'), icon: 'save', emphasis: { raised: true }, action: () => this.save() })\n return {\n title: this.opportunity ? `${i18next.t('title.opportunity')} ${this.opportunity.name}` : i18next.t('title.opportunity-new'),\n ...(this.opportunity ? { description: opportunityStageWord(this.opportunity.stage) } : {}),\n frame: 'document',\n /* Opened from the opportunity list; the menu marks it. */\n menu: 'opportunity-list',\n actions: this.error ? [] : actions\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (!this.active || !(changes.active || changes.params)) return\n const section = opportunitySection()\n if (section && !this.sectionReadable) (section.readable?.() ?? Promise.resolve(true)).then(may => (this.sectionReadable = !!may))\n this.opportunityId = lifecycle?.params?.id ?? ''\n }\n\n render() {\n const attached = this.opportunity && this.sectionReadable ? opportunitySection() : undefined\n const editable = this.editable\n const set = (patch: Partial<Form>) => this.edit(patch)\n const stageChoices = this.stages.filter(one => one.open || one.stage === this.opportunity?.stage)\n return html`<ox-page-state .loading=${this.loading} .error=${this.error} @retry=${() => (this.choices.refetch(), this.record.refetch())}>\n <div class=\"page\">\n <section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.opportunity-section-head')}</h3></header>\n <div class=\"form\">\n <label class=\"wide\"\n >${i18next.t('field.opportunity-name')}\n <input .value=${this.form.name} ?disabled=${!editable} @input=${(e: any) => set({ name: e.target.value })}\n /></label>\n ${this.renderParty('counterparty', i18next.t('field.opportunity-counterparty'), editable)}\n ${this.renderParty('endCustomer', i18next.t('field.opportunity-end-customer'), editable)}\n <label\n >${i18next.t('field.opportunity-amount')}\n <input type=\"number\" min=\"0\" .value=${this.form.amount} ?disabled=${!editable} @input=${(e: any) => set({ amount: e.target.value })}\n /></label>\n <label\n >${i18next.t('field.opportunity-currency')}\n <select .value=${this.form.currency} ?disabled=${!editable} @change=${(e: any) => set({ currency: e.target.value })}>\n ${currencyChoices().map((code: string) => html`<option value=${code} ?selected=${code === this.form.currency}>${code}</option>`)}\n </select>\n </label>\n <label\n >${i18next.t('field.opportunity-expected-close-month')}\n <ox-input-date type=\"month\" .value=${this.form.expectedCloseMonth} ?disabled=${!editable} @change=${(e: any) => set({ expectedCloseMonth: e.target.value })}></ox-input-date></label>\n <label\n >${i18next.t('field.opportunity-owner')}\n <select .value=${this.form.ownerId} ?disabled=${!editable} @change=${(e: any) => set({ ownerId: e.target.value })}>\n ${this.form.ownerId ? nothing : html`<option value=\"\" selected>${i18next.t('text.opportunity-owner-me')}</option>`}\n ${this.owners.map(one => html`<option value=${one.id} ?selected=${one.id === this.form.ownerId}>${one.name}</option>`)}\n </select>\n </label>\n <label class=\"wide\"\n >${i18next.t('field.opportunity-description')}\n <textarea .value=${this.form.description} ?disabled=${!editable} @input=${(e: any) => set({ description: e.target.value })}></textarea>\n </label>\n </div>\n </section>\n <section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.opportunity-section-stage')}</h3></header>\n <div class=\"form\">\n <label\n >${i18next.t('field.opportunity-stage')}\n <select .value=${this.form.stage} ?disabled=${this.busy || this.opportunity?.stage === 'WON'} @change=${(e: any) => this.chooseStage(e.target.value)}>\n ${stageChoices.map(one => html`<option value=${one.stage} ?selected=${one.stage === this.form.stage} ?disabled=${!one.open}>${opportunityStageWord(one.stage)}</option>`)}\n </select>\n </label>\n <label\n >${i18next.t('field.opportunity-probability')}\n <input type=\"number\" min=\"0\" max=\"100\" step=\"1\" .value=${this.form.probability} ?disabled=${!editable} @input=${(e: any) => set({ probability: e.target.value })}\n /></label>\n ${this.opportunity?.closedOn\n ? html`<label>${i18next.t('field.opportunity-closed-on')} <strong>${this.opportunity.closedOn}</strong></label>`\n : nothing}\n </div>\n </section>\n ${this.opportunity && this.isOpen(this.opportunity.stage) ? this.renderLose() : nothing}\n ${this.opportunity?.lostReason\n ? html`<section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('field.opportunity-lost-reason')}</h3></header>\n <p>${this.opportunity.lostReason}</p>\n </section>`\n : nothing}\n ${this.opportunity ? this.renderQuotations() : nothing}\n ${attached && this.opportunity\n ? html`<section class=\"page-section\" @opportunity-changed=${() => this.record.refetch()}>\n <header class=\"page-section-header\"><h3>${attached.heading()}</h3></header>\n ${attached.render(this.opportunity)}\n </section>`\n : nothing}\n ${this.events.length ? this.renderEvents() : nothing}\n </div>\n </ox-page-state>`\n }\n\n /** A counterparty of the domain, found as it is typed - or registered there when it is not one yet (ADR-0195). */\n private renderParty(which: 'counterparty' | 'endCustomer', label: string, editable: boolean) {\n return html`<label\n >${label}\n <counterparty-select .party=${this.form[which] ?? null} ?disabled=${!editable} @counterparty=${(e: CustomEvent) => this.edit({ [which]: e.detail })}></counterparty-select>\n </label>`\n }\n\n private renderLose() {\n return html`<section class=\"page-section\">\n <header class=\"page-section-header\">\n <h3>${i18next.t('text.opportunity-section-lose')}</h3>\n <div class=\"page-section-actions\">\n <button ?disabled=${this.busy || !this.reason.trim()} @click=${() => this.lose()}>${i18next.t('button.opportunity-lose')}</button>\n </div>\n </header>\n <div class=\"form\">\n <label class=\"wide\"\n >${i18next.t('field.opportunity-lost-reason')}\n <input .value=${this.reason} ?disabled=${this.busy} @input=${(e: any) => this.loss.set('reason', e.target.value)}\n /></label>\n </div>\n </section>`\n }\n\n /** The quotations that answer this opportunity; a new one is written from here and answers it. */\n private renderQuotations() {\n const quotations: any[] = this.opportunity.quotations ?? []\n return html`<section class=\"page-section\">\n <header class=\"page-section-header\">\n <h3>${i18next.t('text.opportunity-section-quotations')}</h3>\n <div class=\"page-section-actions\">\n <button ?disabled=${this.busy || this.opportunity.stage === 'WON' || this.opportunity.stage === 'LOST'} @click=${() => navigate(`quotation-editor?opportunity=${this.opportunity.id}`)}>\n ${i18next.t('button.opportunity-new-quotation')}\n </button>\n </div>\n </header>\n ${quotations.length\n ? html`<table>\n <thead>\n <tr>\n <th>${i18next.t('field.quotation-number')}</th>\n <th>${i18next.t('field.quotation-version')}</th>\n <th>${i18next.t('field.quotation-status')}</th>\n <th>${i18next.t('field.quotation-issue-date')}</th>\n <th class=\"number\">${i18next.t('field.quotation-total-amount')}</th>\n </tr>\n </thead>\n <tbody>\n ${quotations.map(\n one => html`<tr>\n <td><a href=${`quotation-editor?id=${one.id}`}>${one.number}</a></td>\n <td>v${one.version}</td>\n <td>${quotationStatusWord(one.status)}</td>\n <td>${one.issueDate ?? ''}</td>\n <td class=\"number\">${documentAmount(one.totalAmount, one.currency || 'KRW')}</td>\n </tr>`\n )}\n </tbody>\n </table>`\n : nothing}\n </section>`\n }\n\n private renderEvents() {\n return html`<section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.opportunity-section-history')}</h3></header>\n <table>\n <thead>\n <tr>\n <th>${i18next.t('field.opportunity-event-at')}</th>\n <th>${i18next.t('field.opportunity-event-actor')}</th>\n <th>${i18next.t('field.opportunity-event-action')}</th>\n <th>${i18next.t('field.opportunity-stage')}</th>\n <th class=\"number\">${i18next.t('field.opportunity-probability')}</th>\n </tr>\n </thead>\n <tbody>\n ${this.events.map(\n one => html`<tr>\n <td>${one.createdAt ? new Date(one.createdAt).toLocaleString() : ''}</td>\n <td>${one.actor?.name ?? ''}</td>\n <td>${eventWord(one.action)}${one.reason ? ` · ${one.reason}` : ''}</td>\n <td>${one.fromStage ? `${opportunityStageWord(one.fromStage)} → ` : ''}${opportunityStageWord(one.stage)}</td>\n <td class=\"number\">${one.probability}%</td>\n </tr>`\n )}\n </tbody>\n </table>\n </section>`\n }\n\n private edit(patch: Partial<Form>) {\n for (const [name, value] of Object.entries(patch)) this.draft.set(name as keyof Form, value)\n }\n\n /** The stage's own probability comes in with it; the person may change it afterwards. */\n private chooseStage(stage: string) {\n const given = this.stages.find(one => one.stage === stage)\n this.edit({ stage, probability: given ? String(given.probability) : this.form.probability })\n }\n\n private input() {\n const { name, counterparty, endCustomer, amount, currency, expectedCloseMonth, stage, probability, ownerId, description } = this.form\n return {\n name,\n counterpartyId: counterparty?.id ?? '',\n endCustomerId: endCustomer?.id ?? null,\n amount: Number(amount || 0),\n currency,\n expectedCloseMonth,\n stage,\n probability: probability === '' ? null : Number(probability),\n ownerId: ownerId || null,\n description\n }\n }\n\n /** A new one is opened once it is made; the edits sent are cleared once the save answered. */\n private async save() {\n if (this.busy) return\n const id = this.opportunityId\n const saved = await this.draft.submit(() =>\n id ? this.saves.update.run({ id, opportunity: this.input() }) : this.saves.create.run({ opportunity: this.input() })\n )\n if (saved && !id) navigate(`opportunity-editor?id=${saved.opportunity.id}`)\n }\n\n private async lose() {\n if (this.busy) return\n const id = this.opportunityId\n await this.loss.submit(sent => this.saves.lose.run({ id, reason: (sent.reason ?? '').trim() }))\n }\n}\n\nconst eventWord = (action?: string) =>\n action === 'CREATED'\n ? i18next.t('text.opportunity-event-created')\n : action === 'STAGED'\n ? i18next.t('text.opportunity-event-staged')\n : action === 'WON'\n ? i18next.t('text.opportunity-event-won')\n : action === 'LOST'\n ? i18next.t('text.opportunity-event-lost')\n : action === 'REOPENED'\n ? i18next.t('text.opportunity-event-reopened')\n : i18next.t('text.opportunity-event-updated')\n\n/** The form of an opportunity as read. */\nfunction formOf(opportunity: any): Form {\n return {\n name: opportunity.name,\n counterparty: opportunity.counterparty,\n endCustomer: opportunity.endCustomer,\n amount: String(opportunity.amount ?? 0),\n currency: opportunity.currency,\n expectedCloseMonth: opportunity.expectedCloseMonth,\n stage: opportunity.stage,\n probability: String(opportunity.probability),\n ownerId: opportunity.ownerId ?? '',\n description: opportunity.description ?? ''\n }\n}\n\nfunction blank(stages: { stage: string; probability: number }[] = []): Form {\n const lead = stages.find(one => one.stage === 'LEAD')\n return {\n name: '',\n counterparty: null,\n endCustomer: null,\n amount: '0',\n currency: 'KRW',\n expectedCloseMonth: thisMonth(),\n stage: 'LEAD',\n probability: lead ? String(lead.probability) : '',\n ownerId: '',\n description: ''\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity-list.js","sourceRoot":"","sources":["../../client/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'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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-editor.js","sourceRoot":"","sources":["../../client/pages/quotation-editor.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;AACxC,OAAO,sCAAsC,CAAA;AAC7C,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AAEx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,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAC/K,CAAC","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/list-state/ox-page-state.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport type { PropertyValues } from 'lit'\n\nimport { DataGrist } from '@operato/data-grist'\nimport { client, MutationController, QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { navigate, PageView, DraftController } from '@operato/shell'\nimport { ButtonStyles, CommonGristStyles, DocumentPageStyles, FormFieldStyles, ScrollbarStyles } from '@operato/styles'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\nimport {\n daysAfter,\n documentAmount,\n DocumentFormStyles,\n documentLinesConfig,\n linesOf,\n onLineChange,\n reckonLines,\n renderDocumentHead,\n renderDocumentTotals,\n DOCUMENT_DEFAULTS,\n DOCUMENT_DEFAULTS_READER,\n headFromDefaults,\n nextInvoiceNumber,\n OUR_SIDE_FIELDS,\n oursFromLast,\n partyOfName,\n type DocumentDefaults,\n type DocumentParty,\n type DocumentValue\n} from '@things-factory/invoice/dist-client'\n\nimport '@things-factory/biz-base/dist-client'\n\nimport { quotationSection } from '../quotation-attach'\nimport { previewQuotation } from '../quotation-preview'\nimport '../sales-product-pick'\nimport { lineOfProduct, type PickedProduct } from '../sales-product-pick'\nimport { quotationStatusWord } from '../quotation-words'\n\nconst FIELDS = `\n id number version status validUntil outcomeReason opportunityId opportunity { id name } direction currency language supplierName supplierAddress supplierRegistrationNumber\n buyerName buyerAddress buyerRegistrationNumber issueDate purchaseOrder paymentTerms bankDetails notes sourceReference\n discountAmount lineSupplyAmount supplyAmount taxAmount totalAmount taxRounding currencyDigits\n items { position description quantity unit unitPrice discount taxKind taxRate supplyAmount }\n taxGroups { taxKind taxRate supplyAmount taxAmount }\n`\n\nconst HEAD = [\n 'number',\n 'direction',\n 'currency',\n 'language',\n 'supplierName',\n 'supplierAddress',\n 'supplierRegistrationNumber',\n 'buyerName',\n 'buyerAddress',\n 'buyerRegistrationNumber',\n 'issueDate',\n 'purchaseOrder',\n 'paymentTerms',\n 'bankDetails',\n 'notes',\n 'sourceReference',\n 'validUntil',\n 'opportunityId',\n 'discountAmount'\n]\n\nconst today = () => new Date().toLocaleDateString('en-CA')\n\n/** What an invoice made from a quotation takes of its head as it is. */\nconst INVOICE_HEAD = [\n 'direction',\n 'currency',\n 'language',\n 'supplierName',\n 'supplierAddress',\n 'supplierRegistrationNumber',\n 'buyerName',\n 'buyerAddress',\n 'buyerRegistrationNumber',\n 'paymentTerms',\n 'bankDetails',\n 'notes'\n]\n\n/** A step of a quotation's life - each answers with the quotation it leaves (a revision is a new one). */\nconst step = (name: string, reason = false) =>\n gql(\n reason\n ? `mutation ($id: String!, $reason: String!) { quotation: ${name}(id: $id, reason: $reason) { id } }`\n : `mutation ($id: String!) { quotation: ${name}(id: $id) { id } }`\n )\n\n/** How long an offer holds unless the person writes another last day. */\nconst VALID_DAYS = 30\n\n/** Days an invoice made from a quotation is due unless the company says otherwise - the invoice editor's. */\nconst PAYMENT_DAYS = 30\n\n/** The next quotation number of a year after those given - 「Q2026-001」, 「Q2026-002」 … */\nexport function nextQuotationNumber(numbers: string[], year: number): string {\n const prefix = `Q${year}-`\n const last = Math.max(0, ...numbers.filter(one => one?.startsWith(prefix)).map(one => Number(one.slice(prefix.length)) || 0))\n return `${prefix}${String(last + 1).padStart(3, '0')}`\n}\n\n/**\n * 견적 편집 — the same head, lines and totals as an invoice, valid until a day.\n *\n * A draft is saved and sent; once sent its amounts are fixed, and the buyer's answer is recorded — accepted, or\n * declined with a reason. To change a sent quotation, revise it: the next version keeps the number.\n */\n@customElement('quotation-editor')\nexport class QuotationEditor extends localize(i18next)(PageView) {\n static styles = [\n FormFieldStyles,\n ButtonStyles,\n DocumentPageStyles,\n CommonGristStyles,\n ScrollbarStyles,\n DocumentFormStyles,\n css`\n ox-grist {\n height: calc(var(--form-element-height-medium) * 10);\n }\n /* 상품에서 추가 sits over the lines, as wide as a head field. */\n .pick {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-small);\n max-width: 480px;\n margin-bottom: var(--spacing-medium);\n font-size: var(--ui-t-micro);\n color: var(--ui-muted);\n }\n `\n ]\n\n /** What the address opens: a quotation by id, or a new one - written from an opportunity, it answers that one. */\n @state() private address?: { id?: string; opportunity?: string }\n @state() gristConfig: any\n /** Whether this person may read the company's words - unknown, and nothing read, until asked. */\n @state() private defaultsReadable = false\n /** The totals of the lines as typed - reckoned as the quotation will keep them, shown before it is saved. */\n @state() private typedAmounts: Partial<DocumentValue> | null = null\n /** Whether this person may write invoices - an accepted quotation then makes one. */\n @state() invoiceWriter = false\n /** Whether the application's section is this person's to read - asked once, before it is shown. */\n @state() sectionReadable = false\n /** An invoice being made of this quotation - its look-ups and its save. */\n @state() private making = false\n\n /* The company's words, the open opportunities a draft may answer, the quotation the address names, and what a new one starts from (ADR-0190). */\n private companyDefaults = new QueryController(this, DOCUMENT_DEFAULTS, { variables: () => (this.defaultsReadable ? {} : undefined) })\n private openOpportunities = new QueryController(\n this,\n gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n opportunities(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items { id name counterparty { id name businessNumber } }\n }\n }\n `,\n {\n variables: () => ({\n filters: [{ name: 'stage', operator: 'in', value: ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION'] }],\n pagination: { page: 1, limit: 500 },\n sortings: [{ name: 'name' }]\n })\n }\n )\n private record = new QueryController(this, gql(`query ($id: String!) { quotation(id: $id) { ${FIELDS} } }`), {\n variables: () => (this.quotationId ? { id: this.quotationId } : undefined)\n })\n private starts = new QueryController(\n this,\n gql`\n query ($filters: [Filter!], $sortings: [Sorting!]) {\n numbered: quotations(filters: $filters, pagination: { page: 1, limit: 1000 }) { items { number } }\n last: quotations(pagination: { page: 1, limit: 1 }, sortings: $sortings) { items { direction ${OUR_SIDE_FIELDS.join(' ')} } }\n }\n `,\n {\n variables: () =>\n this.address && !this.address.id ? { filters: [{ name: 'number', operator: 'like', value: `Q${today().slice(0, 4)}-%` }], sortings: [{ name: 'createdAt', desc: true }] } : undefined\n }\n )\n\n /* What is typed over the quotation read, or over what a new one starts with; the lines are the grid's. */\n private draft = new DraftController<DocumentValue>(this, { read: () => this.formRead, key: () => this.address })\n /* The reason the buyer declined with. */\n private decline = new DraftController<{ reason: string }>(this, { read: () => ({ reason: '' }), key: () => this.address })\n\n /* Every change of the quotation reads it again once it is done. */\n private saves = {\n create: new MutationController(this, gql`mutation ($quotation: NewQuotation!) { quotation: createQuotation(quotation: $quotation) { id } }`),\n update: this.saving(gql`mutation ($id: String!, $quotation: NewQuotation!) { quotation: updateQuotation(id: $id, quotation: $quotation) { id } }`),\n sendQuotation: this.saving(step('sendQuotation')),\n expireQuotation: this.saving(step('expireQuotation')),\n acceptQuotation: this.saving(step('acceptQuotation')),\n reviseQuotation: this.saving(step('reviseQuotation')),\n rejectQuotation: this.saving(step('rejectQuotation', true)),\n invoice: new MutationController(\n this,\n gql`\n mutation ($invoice: NewInvoice!) {\n created: createInvoice(invoice: $invoice) { id }\n }\n `\n )\n }\n\n private saving(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.record] })\n }\n\n private get quotationId() {\n return this.address?.id ?? ''\n }\n\n /** The company's words a new quotation starts with, the terms it offers and how long an offer holds (ADR-0170) - none until read. */\n get defaults(): DocumentDefaults | null {\n return this.companyDefaults.data?.documentDefaults ?? null\n }\n\n get quotation(): DocumentValue | null {\n return (this.quotationId && this.record.data?.quotation) || null\n }\n\n private get opportunities(): { id: string; name: string; counterparty?: DocumentParty | null }[] {\n return this.openOpportunities.data?.opportunities?.items ?? []\n }\n\n /** What the form shows unedited: the quotation read, or what a new one starts with. */\n private get formRead(): DocumentValue | undefined {\n if (!this.address) return undefined\n return this.address.id ? (this.quotation ?? undefined) : this.start\n }\n\n /** The form as it shows: each field's edit, else what was read. */\n get form(): DocumentValue {\n return { ...blank(), ...this.formRead, ...this.draft.edits }\n }\n\n /** The totals of the lines as typed, else as the quotation keeps them. */\n get amounts(): Partial<DocumentValue> {\n return this.typedAmounts ?? this.quotation ?? {}\n }\n\n get reason() {\n return this.decline.value('reason') ?? ''\n }\n\n /** A failed read, or a quotation the address names that is not there. */\n get error(): unknown {\n if (this.record.error) return this.record.error\n return this.quotationId && this.record.data && !this.record.data.quotation ? new Error(i18next.t('text.quotation-not-found')) : null\n }\n\n get loading() {\n return this.record.loading\n }\n\n get busy() {\n return this.making || Object.values(this.saves).some(save => save.pending)\n }\n\n @query('ox-grist') private grist?: DataGrist\n\n get editable() {\n return !this.quotation || this.quotation.status === 'DRAFT'\n }\n\n get context() {\n const status = this.quotation?.status\n const actions: any[] = []\n if (this.editable) {\n actions.push({ title: i18next.t('button.save'), icon: 'save', action: () => this.save() })\n actions.push({ title: i18next.t('button.quotation-send'), icon: 'send', emphasis: { raised: true }, action: () => this.send() })\n }\n if (status === 'SENT') {\n if (this.quotation!.validUntil < today()) actions.push({ title: i18next.t('button.quotation-expire'), action: () => this.change('expireQuotation') })\n else actions.push({ title: i18next.t('button.quotation-accept'), emphasis: { raised: true }, action: () => this.change('acceptQuotation') })\n }\n if (status === 'ACCEPTED' && this.invoiceWriter) actions.push({ title: i18next.t('button.quotation-make-invoice'), icon: 'receipt_long', emphasis: { raised: true }, action: () => this.makeInvoice() })\n if (['SENT', 'REJECTED', 'EXPIRED'].includes(status)) actions.push({ title: i18next.t('button.quotation-revise'), icon: 'edit_document', action: () => this.change('reviseQuotation') })\n if (this.quotation) actions.push({ title: i18next.t('button.preview'), icon: 'preview', action: () => this.preview() })\n return {\n title: this.quotation ? `${i18next.t('title.quotation')} ${this.quotation.number} · v${this.quotation.version}` : i18next.t('title.quotation-new'),\n ...(this.quotation ? { description: quotationStatusWord(status) } : {}),\n frame: 'document',\n /* Opened from the quotation list; the menu marks it. */\n menu: 'quotation-list',\n actions: this.error ? [] : actions\n }\n }\n\n pageUpdated(changes: any, lifecycle: any) {\n if (!this.active || !(changes.active || changes.params)) return\n const { id, opportunity } = lifecycle?.params ?? {}\n if (!this.defaultsReadable) hasPrivilege(DOCUMENT_DEFAULTS_READER).then(may => (this.defaultsReadable = !!may))\n const section = quotationSection()\n if (section && !this.sectionReadable) (section.readable?.() ?? Promise.resolve(true)).then(may => (this.sectionReadable = !!may))\n hasPrivilege({ category: 'invoice', privilege: 'mutation', domainOwnerGranted: true }).then(writer => {\n this.invoiceWriter = !!writer\n this.updateContext()\n })\n /* Written from an opportunity, the draft answers it. */\n this.address = id ? { id } : { opportunity: opportunity ?? '' }\n }\n\n /* The lines and their totals are the grid's: a new answer, or another quotation, puts the lines read in it again. */\n private lined?: unknown\n private relined = false\n\n willUpdate(changes: PropertyValues) {\n super.willUpdate(changes)\n const source = this.quotationId ? this.quotation : JSON.stringify(this.address ?? null)\n if (source === this.lined) return\n this.lined = source\n this.typedAmounts = null\n this.configure()\n this.relined = true\n }\n\n updated(changes: PropertyValues) {\n super.updated(changes)\n if (!this.relined) return\n this.relined = false\n this.grist?.fetch()\n }\n\n render() {\n const attached = this.quotation && this.sectionReadable ? quotationSection() : undefined\n const editable = this.editable && !this.busy\n return html`<ox-page-state .loading=${this.loading} .error=${this.error} @retry=${() => this.record.refetch()}>\n <div class=\"page\">\n <section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.quotation-section-head')}</h3></header>\n ${renderDocumentHead(\n this.form,\n editable,\n patch => this.edit(patch),\n html`<label\n >${i18next.t('field.quotation-valid-until')}\n <ox-input-date type=\"date\" .value=${this.form.validUntil ?? ''} ?disabled=${!editable} @change=${(e: any) => this.put({ validUntil: e.target.value })}></ox-input-date></label>\n ${this.renderOpportunity(editable)}`,\n 'field.quotation-number',\n {\n terms: this.defaults?.paymentTerms,\n /* In the group it fills - the buyer's of a sale, the supplier's of a purchase. */\n party: html`<label\n >${i18next.t('field.counterparty')}\n <counterparty-select .party=${this.form.party ?? null} ?disabled=${!editable} @counterparty=${(e: CustomEvent) => this.takeParty(e.detail)}></counterparty-select>\n </label>`\n }\n )}\n </section>\n <section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.quotation-section-lines')}</h3></header>\n ${editable\n ? html`<label class=\"pick\"\n >${i18next.t('field.sales-product-pick')}\n <sales-product-pick .currency=${this.form.currency || 'KRW'} @product=${(e: CustomEvent) => this.addProduct(e.detail)}></sales-product-pick>\n </label>`\n : nothing}\n <ox-grist\n mode=\"GRID\"\n .config=${this.gristConfig}\n .fetchHandler=${() => ({ total: (this.form.items ?? []).length, records: (this.form.items ?? []).map((item: any) => ({ ...item })) })}\n @record-change=${(e: CustomEvent) => (this.typedAmounts = onLineChange(this.grist, e, this.form.currency, false, this.form.discountAmount))}\n ></ox-grist>\n </section>\n <section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('text.quotation-section-totals')}</h3></header>\n ${renderDocumentTotals(\n { ...this.amounts, currency: this.form.currency },\n { value: this.form.discountAmount, editable, change: value => this.discount(value) }\n )}\n </section>\n ${this.quotation?.status === 'SENT' ? this.renderDecline() : nothing}\n ${this.quotation?.outcomeReason\n ? html`<section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${i18next.t('field.quotation-outcome-reason')}</h3></header>\n <p>${this.quotation.outcomeReason}</p>\n </section>`\n : nothing}\n ${attached && this.quotation\n ? html`<section class=\"page-section\">\n <header class=\"page-section-header\"><h3>${attached.heading()}</h3></header>\n ${attached.render(this.quotation as any)}\n </section>`\n : nothing}\n </div>\n </ox-page-state>`\n }\n\n private renderDecline() {\n return html`<section class=\"page-section\">\n <header class=\"page-section-header\">\n <h3>${i18next.t('text.quotation-section-decline')}</h3>\n <div class=\"page-section-actions\">\n <button ?disabled=${this.busy || !this.reason.trim()} @click=${() => this.decline.submit(sent => this.change('rejectQuotation', (sent.reason ?? '').trim()))}>${i18next.t('button.quotation-reject')}</button>\n </div>\n </header>\n <div class=\"form\">\n <label class=\"wide\"\n >${i18next.t('field.quotation-outcome-reason')}\n <input .value=${this.reason} ?disabled=${this.busy} @input=${(e: any) => this.decline.set('reason', e.target.value)}\n /></label>\n </div>\n </section>`\n }\n\n /**\n * A line made from a product, after the lines there are - a copy the person then changes like any line (ADR-0171) -\n * and the totals reckoned with it.\n */\n private async addProduct(product: PickedProduct) {\n const grist = this.grist\n if (!grist || !product) return\n grist.addRecord(lineOfProduct(product))\n await grist.updateComplete\n this.typedAmounts = reckonLines(grist, this.form.currency, false, this.form.discountAmount)\n grist.refresh()\n }\n\n /** The discount of the whole quotation as typed, and the totals after it. */\n private discount(value: string) {\n this.put({ discountAmount: value })\n this.typedAmounts = reckonLines(this.grist, this.form.currency, false, value)\n }\n\n /** Edits of several fields at once. */\n private put(patch: DocumentValue) {\n for (const [name, value] of Object.entries(patch)) this.draft.set(name, value)\n }\n\n /** A change of the head; a new currency reckons the lines in its minor unit; the last day follows a moved issue day. */\n private edit(patch: DocumentValue) {\n const currency = this.form.currency\n const following = patch.issueDate && this.form.validUntil === daysAfter(this.form.issueDate, this.validDays)\n this.put({ ...patch, ...(following ? { validUntil: daysAfter(patch.issueDate, this.validDays) } : {}) })\n if (patch.currency && patch.currency !== currency) {\n this.configure()\n this.typedAmounts = reckonLines(this.grist, this.form.currency, false, this.form.discountAmount)\n }\n }\n\n /** The opportunity it answers - found by typing; choosing one takes its counterparty as the buyer when none is written. */\n private renderOpportunity(editable: boolean) {\n const choices = this.opportunityChoices()\n const chosen = choices.find(one => one.id === this.form.opportunityId)\n const label = (one: { name: string; counterparty?: DocumentParty | null }) => `${one.name}${one.counterparty?.name ? ` · ${one.counterparty.name}` : ''}`\n return html`<label\n >${i18next.t('field.quotation-opportunity')}\n <ox-select\n .value=${this.form.opportunityId ?? ''}\n ?disabled=${!editable}\n aria-label=${i18next.t('field.quotation-opportunity')}\n @change=${(e: CustomEvent) => {\n const id = String(e.detail ?? '')\n if (id === (this.form.opportunityId ?? '')) return\n const opportunity = choices.find(one => one.id === id)\n this.put({ opportunityId: id })\n if (opportunity?.counterparty && !String(this.form.buyerName ?? '').trim()) this.takeParty(opportunity.counterparty)\n }}\n >\n <span slot=\"label\">${chosen ? label(chosen) : '—'}</span>\n <ox-popup-list align-left nowrap with-search>\n <div option value=\"\">—</div>\n ${choices.map(one => html`<div option value=${one.id}>${label(one)}</div>`)}\n </ox-popup-list>\n </ox-select>\n </label>`\n }\n\n /** A counterparty as the other side: the buyer of a sale, the supplier of a purchase. */\n private takeParty(party: DocumentParty | null) {\n this.put(party ? partyFields(this.form, party) : { party: null })\n }\n\n /**\n * What a new quotation starts with, so a person writes only what is new: the next number of the year, the last day an\n * offer holds, the company's own words (ADR-0170), what they leave blank of our side as the last sales quotation\n * wrote it, and the counterparty of the opportunity it answers.\n */\n private get start(): DocumentValue {\n const form: DocumentValue = { ...blank(), opportunityId: this.address?.opportunity ?? '' }\n const started = this.starts.data\n const last = (started?.last?.items ?? []).find((one: any) => one.direction === 'SALES')\n const head = { ...form, ...headFromDefaults(form, this.defaults) }\n const filled = {\n ...head,\n ...oursFromLast(head, last),\n number: started ? nextQuotationNumber((started.numbered?.items ?? []).map((one: any) => one.number), Number(form.issueDate.slice(0, 4))) : '',\n validUntil: daysAfter(form.issueDate, this.validDays)\n }\n const opportunity = this.opportunities.find(one => one.id === form.opportunityId)\n return opportunity?.counterparty ? { ...filled, ...partyFields(filled, opportunity.counterparty) } : filled\n }\n\n /** Days an offer holds - the company's, or thirty. */\n private get validDays() {\n return this.defaults?.validDays || VALID_DAYS\n }\n\n private opportunityChoices() {\n const answered = this.quotation?.opportunity\n return answered && !this.opportunities.some(one => one.id === answered.id) ? [answered, ...this.opportunities] : this.opportunities\n }\n\n private configure() {\n this.gristConfig = documentLinesConfig({ editable: this.editable, currency: this.form.currency || 'KRW' })\n }\n\n private input() {\n const input: DocumentValue = Object.fromEntries(HEAD.map(key => [key, this.form[key] === '' ? null : this.form[key] ?? null]))\n input.items = linesOf(this.grist).map(({ receivedTaxAmount, ...line }: any) => line)\n input.discountAmount = input.discountAmount === null ? 0 : Number(input.discountAmount)\n return input\n }\n\n /** A new one is opened once it is made; the edits sent are cleared once the save answered. Answers the quotation's id. */\n private async save(): Promise<string | undefined> {\n if (this.busy) return undefined\n const id = this.quotationId\n const saved = await this.draft.submit(() => (id ? this.saves.update.run({ id, quotation: this.input() }) : this.saves.create.run({ quotation: this.input() })))\n if (!saved) return undefined\n if (!id) {\n /* The lines went with it: the grid keeps them as saved while the new quotation opens. */\n this.grist?.commit()\n navigate(`quotation-editor?id=${saved.quotation.id}`)\n }\n return saved.quotation.id\n }\n\n /** Asked first - to whom and how much, fixed after - then save what is on screen and send it. */\n private async send() {\n const purchase = this.form.direction === 'PURCHASE'\n const words = {\n party: (purchase ? this.form.supplierName : this.form.buyerName) || '—',\n total: documentAmount(this.amounts.totalAmount ?? 0, this.form.currency || 'KRW')\n }\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.quotation-send'),\n text: purchase ? i18next.t('text.quotation-send-confirm-purchase', words) : i18next.t('text.quotation-send-confirm', words),\n confirmButton: { text: i18next.t('button.quotation-send') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n const saved = await this.save()\n if (saved) await this.change('sendQuotation', undefined, saved)\n }\n\n /** A step of the quotation's life; a revision opens the new version. */\n private async change(name: 'sendQuotation' | 'expireQuotation' | 'acceptQuotation' | 'reviseQuotation' | 'rejectQuotation', reason?: string, id = this.quotationId) {\n if (this.busy) return undefined\n const changed = await this.saves[name].run({ id, ...(reason === undefined ? {} : { reason }) })\n if (changed && changed.quotation.id !== id) navigate(`quotation-editor?id=${changed.quotation.id}`)\n return changed\n }\n\n /**\n * An invoice draft of an accepted quotation (ADR-0170 decision 11): its parties, currency, language, terms, account,\n * notes, discount and lines as the quotation has them, issued today and due the company's days after, the quotation\n * named as its source - then opened to be checked and issued. The counterparty is the one of the other party's name,\n * as the invoice editor links it.\n */\n private async makeInvoice() {\n if (this.busy) return\n const quotation = this.quotation!\n this.making = true\n try {\n /* Looked up for the invoice, shown nowhere: the number after the last sales invoice's, and the counterparty. */\n const last = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n invoices(filters: $filters, pagination: $pagination, sortings: $sortings) { items { number } }\n }\n `,\n variables: { filters: [{ name: 'direction', operator: 'eq', value: 'SALES' }], pagination: { page: 1, limit: 1 }, sortings: [{ name: 'createdAt', desc: true }] },\n fetchPolicy: 'no-cache'\n })\n const issueDate = today()\n const party = await partyOfName(quotation.direction === 'PURCHASE' ? quotation.supplierName : quotation.buyerName)\n const made = await this.saves.invoice.run({\n invoice: {\n number: nextInvoiceNumber(last.data?.invoices?.items?.[0]?.number, Number(issueDate.slice(0, 4))),\n counterpartyId: party?.id ?? null,\n ...Object.fromEntries(INVOICE_HEAD.map(key => [key, quotation[key] ?? null])),\n issueDate,\n dueDate: daysAfter(issueDate, this.defaults?.paymentDays ?? PAYMENT_DAYS),\n sourceReference: i18next.t('text.quotation-invoice-source', { number: quotation.number, version: quotation.version }),\n taxBasis: 'CALCULATED',\n discountAmount: Number(quotation.discountAmount ?? 0),\n items: quotation.items.map(({ description, quantity, unit, unitPrice, discount, taxKind, taxRate }: any) => ({\n description,\n quantity,\n unit: unit ?? null,\n unitPrice,\n discount,\n taxKind,\n taxRate\n }))\n }\n })\n const created = made?.created\n if (created) navigate(`invoice-editor?id=${created.id}`)\n } catch {\n /* The look-up's failure is told by the GraphQL link. */\n } finally {\n this.making = false\n }\n }\n\n private preview() {\n const { id, number, version, language } = this.quotation!\n previewQuotation({ id, number, version, language })\n }\n\n}\n\n/** A counterparty as the other side of `form`: the buyer of a sale, the supplier of a purchase. */\nfunction partyFields(form: DocumentValue, party: DocumentParty): DocumentValue {\n const side = form.direction === 'PURCHASE' ? 'supplier' : 'buyer'\n return { party, [`${side}Name`]: party.name, [`${side}RegistrationNumber`]: party.businessNumber ?? form[`${side}RegistrationNumber`] ?? '' }\n}\n\nfunction blank(): DocumentValue {\n return { number: '', direction: 'SALES', currency: 'KRW', language: 'ko', supplierName: '', buyerName: '', issueDate: today(), validUntil: '', discountAmount: 0, items: [] }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-list.js","sourceRoot":"","sources":["../../client/pages/quotation-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,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,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;AACx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,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AA5JQ;IAAR,KAAK,EAAE;;kDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;4CAAA;AAJjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAgKzB","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 { 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 { counterpartOf, documentAmount, issuePeriodOf } from '@things-factory/invoice/dist-client'\n\nimport { QUOTATION_STATUSES, quotationFilters } from '../list-filters'\nimport { quotationStatusWord } from '../quotation-words'\n\nconst today = () => new Date().toLocaleDateString('en-CA')\n\n/**\n * 견적 — every version of every quotation; the latest of a number is the one still in play. A click or a\n * tap on the row opens its 360 to read; with one row picked, 「수정」 on the bar opens the editor. Rows picked go to the\n * assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).\n *\n * The headroom narrows it by issue period, as the invoice list does, and by status chips, each with how many quotations\n * it holds under the other conditions - counted by the server. With no status pressed every status shows. Both are the\n * grid's own column filters, kept in the address with the search, sort and page (FOOTER-BUTTON-REVIEW G09).\n */\n@customElement('quotation-list')\nexport class QuotationList 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 get context() {\n return {\n title: i18next.t('title.quotation-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n /* The issue period and the statuses narrow it in the headroom, and this folds it. */\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [{ title: i18next.t('button.quotation-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('quotation-editor') }],\n exportable: { name: i18next.t('title.quotation-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(`quotation-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.quotation-list')}\n list=\"quotations\"\n axis=\"quotation\"\n .labelOf=${(row: any) => [row.number && `${row.number} v${row.version}`, counterpartOf(row)].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('quotation', record)\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.quotation-empty'), description: i18next.t('text.quotation-empty-description') },\n list: { fields: ['counterpart', 'number'], details: ['status', 'validUntil', 'totalAmount'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n SELECTION_ROW_PICKER,\n readonly('string', 'counterpart', i18next.t('field.quotation-counterpart'), 200, { sortable: false, record: { renderer: (_v: any, _c: any, record: any) => counterpartOf(record) } }),\n readonly('string', 'number', i18next.t('field.quotation-number'), 140),\n readonly('integer', 'version', i18next.t('field.quotation-version'), 60),\n readonly('string', 'status', i18next.t('field.quotation-status'), 90, {\n record: { renderer: (value: string) => quotationStatusWord(value) },\n /* Chips with their counts; none pressed is every status. */\n filter: { type: 'select-buttons', operator: 'in', options: QUOTATION_STATUSES.map(value => ({ value, display: quotationStatusWord(value) })) }\n }),\n readonly('string', 'issueDate', i18next.t('field.quotation-issue-date'), 110, {\n /* A period named relative to today, as the invoice list narrows by it. */\n filter: {\n type: 'select',\n operator: 'eq',\n options: ['', 'this-month', 'last-month', 'this-year', 'last-year'].map(value => ({ value, display: i18next.t(`text.invoice-period-${value || 'all'}`) }))\n }\n }),\n readonly('string', 'validUntil', i18next.t('field.quotation-valid-until'), 110),\n readonly('float', 'totalAmount', i18next.t('field.quotation-total-amount'), 160, {\n record: { align: 'right', renderer: (value: number, _c: any, record: any) => documentAmount(value, record?.currency || 'KRW') }\n })\n ],\n sorters: [{ name: 'issueDate', desc: true }]\n }\n }\n\n /* The grid's filters as the server reads them - the issue period as its days - and the search. */\n private conditions(filters: any[] = [], search?: string) {\n return { filters: quotationFilters(filters, period => issuePeriodOf(period, today())), search: search?.trim() || undefined }\n }\n\n /* The status chips' numbers, under the list's other conditions - the chips' own left out; a chip keeps its number until the next land. */\n async countHandler({ filters, search, signal }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $search: String) {\n quotationStatusCounts(filters: $filters, search: $search) { value count }\n }\n `,\n variables: (({ filters: all, search: term }) => ({ filters: all.filter(one => one.name !== 'status'), search: term }))(this.conditions(filters, search)),\n fetchPolicy: 'no-cache',\n context: { fetchOptions: { signal }, queryDeduplication: false }\n })\n if (response.errors?.length) throw response.errors[0]\n return { status: Object.fromEntries(response.data.quotationStatusCounts.map((row: { value: string; count: number }) => [row.value, row.count])) }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], ...asked }: FetchOption) {\n const { filters, search } = this.conditions(asked.filters, asked.search)\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: quotations(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id\n number\n version\n status\n direction\n currency\n supplierName\n buyerName\n issueDate\n validUntil\n totalAmount\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sales-product-list.js","sourceRoot":"","sources":["../../client/pages/sales-product-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,mDAAmD,CAAA;AAE1D,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,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,i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,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1D,CAAC;;AAtMQ;IAAR,KAAK,EAAE;;qDAAiB;AAkBE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AArBjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0M5B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@things-factory/ai-assistant/dist-client/index.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, MutationController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { documentNumber } from '@things-factory/invoice/dist-client'\n\nimport { salesProductFilters } from '../list-filters'\nimport { salesProductKindWord } from '../sales-product-words'\n\nconst KINDS = ['GOODS', 'SERVICE', 'LABOR']\n\n/** What a new row starts with - 「행 추가」 and a paste past the last row alike. */\nconst DRAFT = () => ({ kind: 'GOODS', currency: 'KRW', taxKind: 'TAXABLE', active: true })\n\n/** The column layout the name-first order is made on - a person's older column order gives way to it. */\nconst COLUMNS_VERSION = 'lead-2026-11-08'\n\n/** The fields a row writes - all of them for a new row, the changed ones otherwise. */\nconst FIELDS = ['code', 'name', 'kind', 'grade', 'spec', 'unit', 'unitPrice', 'currency', 'taxKind', 'active', 'description']\n\n/**\n * 상품 — what the domain sells and the price it offers it at: goods, a service, or labor by the grade of the people\n * (ADR-0171). Typed like a spreadsheet and saved together. A quotation line chosen from a product copies it at that\n * moment; changing a price here changes no written quotation. The headroom narrows it to the products in use or out of\n * use, each chip with how many it holds under the other conditions - a filter of the grid's 사용 column, so it stays in\n * the address with the search, sort and page (FOOTER-BUTTON-REVIEW G09). Deleting works on the picked rows, from the\n * selection bar over the grid (F06).\n */\n@customElement('sales-product-list')\nexport class SalesProductList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n /* A save or a delete reads the list again, and the chips count with it. */\n private saving = new MutationController(\n this,\n gql`\n mutation ($patches: [SalesProductPatch!]!) {\n updateMultipleSalesProduct(patches: $patches) { id }\n }\n `\n )\n private deleting = new MutationController(\n this,\n gql`\n mutation ($ids: [String!]!) {\n deleteSalesProducts(ids: $ids)\n }\n `\n )\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.sales-product-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [\n { id: 'add-row', title: i18next.t('button.add-row'), icon: 'add', action: () => this.grist.addNewRecord() },\n { id: 'save', title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: i18next.t('title.sales-product-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.sales-product-list')}\n .assistant=${false}\n .actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this.delete() }]}\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\">\n <ox-filters-form without-search autofocus></ox-filters-form>\n </div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const text = (name: string, header: string, width: number, extra: any = {}) => ({ type: 'string', name, header, width, sortable: true, ...extra, record: { editable: true, ...extra.record } })\n this.gristConfig = {\n /* No empty row under the records: 「행 추가」 starts one, and a paste past the last row adds rows with the same draft. */\n rows: { appendable: false, pasteAppendable: true, newRecord: DRAFT, selectable: { multiple: true } },\n columnsVersion: COLUMNS_VERSION,\n pagination: { limit: 100, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.sales-product-empty'), description: i18next.t('text.sales-product-empty-description') },\n list: { fields: ['name', 'code'], details: ['kind', 'unit', 'unitPrice'] },\n columns: [\n /* A row's state (new, changed); a new row's mark removes it until it is saved (data-grist 행 제거). */\n { type: 'gutter', gutterName: 'dirty' },\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n /* The name is the row's identity and stays in view; what a product is offered at comes before how it is described. */\n text('name', i18next.t('field.sales-product-name'), 200, { fixed: true, record: { mandatory: true } }),\n text('code', i18next.t('field.sales-product-code'), 110, { record: { mandatory: true } }),\n {\n type: 'checkbox',\n name: 'active',\n header: i18next.t('field.sales-product-active'),\n width: 60,\n sortable: true,\n record: { editable: true },\n /* In use or out of use as chips, each with its count; none pressed is every product. */\n filter: { type: 'select-buttons', operator: 'eq', options: ['active', 'inactive'].map(value => ({ value, display: i18next.t(`text.sales-product-${value}`) })) }\n },\n {\n type: 'float',\n name: 'unitPrice',\n header: i18next.t('field.sales-product-unit-price'),\n width: 130,\n sortable: true,\n record: { editable: true, align: 'right', renderer: (value: number, _c: any, record: any) => documentNumber(value, record?.currency || 'KRW') }\n },\n text('currency', i18next.t('field.sales-product-currency'), 70, { record: { align: 'center' } }),\n text('unit', i18next.t('field.sales-product-unit'), 70, { record: { align: 'center' } }),\n {\n type: 'select',\n name: 'kind',\n header: i18next.t('field.sales-product-kind'),\n width: 80,\n sortable: true,\n record: { editable: true, options: KINDS.map(kind => ({ value: kind, display: salesProductKindWord(kind) })) },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...KINDS.map(kind => ({ display: salesProductKindWord(kind), value: kind }))] }\n },\n {\n type: 'select',\n name: 'taxKind',\n header: i18next.t('field.sales-product-tax-kind'),\n width: 80,\n record: {\n editable: true,\n options: [\n { value: 'TAXABLE', display: i18next.t('text.tax-kind-taxable') },\n { value: 'ZERO_RATED', display: i18next.t('text.tax-kind-zero-rated') },\n { value: 'EXEMPT', display: i18next.t('text.tax-kind-exempt') }\n ]\n }\n },\n text('grade', i18next.t('field.sales-product-grade'), 110),\n text('spec', i18next.t('field.sales-product-spec'), 160),\n text('description', i18next.t('field.sales-product-description'), 220)\n ],\n sorters: [{ name: 'code' }]\n }\n }\n\n /* The in-use chips' numbers, on the list's other filters - the chip's own left out; a chip keeps its number until the next land. */\n async countHandler({ filters = [], search, signal }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $search: String) {\n salesProductActiveCounts(filters: $filters, search: $search) { value count }\n }\n `,\n variables: { filters: salesProductFilters(filters).filter(one => one.name !== 'active'), 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 { active: Object.fromEntries(response.data.salesProductActiveCounts.map((row: { value: string; count: number }) => [row.value, row.count])) }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n search = search?.trim() || undefined\n const conditions = salesProductFilters(filters)\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: salesProducts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items { id code name kind grade spec unit unitPrice currency taxKind active description }\n total\n }\n }\n `,\n variables: { filters: conditions, pagination: { page, limit }, sortings, search },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n /** New, changed and deleted rows together; a refusal is said in the server's words and nothing is kept. */\n private async save() {\n const patches = this.grist.dirtyRecords.map((record: any) => {\n const changed = record.__dirty__ === '+' ? FIELDS.filter(field => record[field] !== undefined) : Object.keys(record.__dirtyfields__ ?? {}).filter(field => FIELDS.includes(field))\n return { ...(record.id ? { id: record.id } : {}), cuFlag: record.__dirty__, ...Object.fromEntries(changed.map(field => [field, record[field] === '' ? null : record[field]])) }\n })\n if (!patches.length) {\n notify({ level: 'info', message: i18next.t('text.nothing-to-save') })\n return\n }\n if (!(await this.saving.run({ patches }))) return\n notify({ level: 'info', message: i18next.t('text.sales-product-saved') })\n this.grist.fetch()\n }\n\n private async delete() {\n const ids = this.grist.selected.map((record: any) => record.id).filter(Boolean)\n if (!ids.length) {\n notify({ level: 'info', message: i18next.t('text.select-rows-to-delete') })\n return\n }\n const confirmed = await OxPrompt.open({\n title: i18next.t('button.delete'),\n text: i18next.t('text.sales-product-delete-confirm', { count: ids.length }),\n confirmButton: { text: i18next.t('button.delete'), destructive: true },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n if (!confirmed) return\n if (await this.deleting.run({ ids })) this.grist.fetch()\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-attach.js","sourceRoot":"","sources":["../client/quotation-attach.ts"],"names":[],"mappings":"AAmBA,IAAI,OAAqC,CAAA;AAEzC,MAAM,UAAU,yBAAyB,CAAC,GAAqB;IAC7D,OAAO,GAAG,GAAG,CAAA;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { type TemplateResult } from 'lit'\n\n/*\n * Where an application attaches its own work to a quotation — Office turns an accepted quotation into a contract\n * (ADR-0120 decisions 2 and 9). The quotation module knows no application words.\n */\n\nexport type QuotationSection = {\n /** The section's heading, already in the reader's words. */\n heading: () => string\n /** The section's body for one saved quotation; it reads and writes through the application's own API. */\n /**\n * Whether this person may read the section. The application's section reads its own doors; someone who may not\n * open them gets no section at all - no heading, and no query refused on their screen. Left out, everyone sees it.\n */\n readable?: () => Promise<boolean>\n render: (quotation: { id: string; number: string; version: number; status: string; currency: string; totalAmount: number }) => TemplateResult\n}\n\nlet section: QuotationSection | undefined\n\nexport function configureQuotationSection(one: QuotationSection): void {\n section = one\n}\n\nexport function quotationSection(): QuotationSection | undefined {\n return section\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-preview.js","sourceRoot":"","sources":["../client/quotation-preview.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAA2B,MAAM,qCAAqC,CAAA;AAElG;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAA6F;IAC3J,OAAO,mBAAmB,CACxB,KAAK,EAAE,MAA0B,EAAE,GAAW,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;SAIT;YACD,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE;YACxC,WAAW,EAAE,UAAU;SACxB,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,qBAAqB;YAAE,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAA;QACzH,OAAO,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAA;IAC5C,CAAC,EACD,QAAQ,EACR,GAAG,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,MAAM,IAAI,EAAE,OAAO,OAAO,IAAI,EAAE,EAAE,CACtE,CAAA;AACH,CAAC","sourcesContent":["import gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { openDocumentPreview, type DocumentFileFormat } from '@things-factory/invoice/dist-client'\n\n/**\n * The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the\n * quotation's own first, to download as PDF or print. What is on screen and not saved is not in it. The editor and\n * the quotation's 360 open the same preview.\n */\nexport function previewQuotation({ id, number, version, language }: { id: string; number?: string | null; version?: number | null; language?: string | null }) {\n return openDocumentPreview(\n async (format: DocumentFileFormat, lng: string) => {\n const response = await client.query({\n query: gql`\n query ($id: String!, $format: DocumentFileFormat!, $language: String) {\n quotationDocumentFile(id: $id, format: $format, language: $language) { fileName mimeType content }\n }\n `,\n variables: { id, format, language: lng },\n fetchPolicy: 'no-cache'\n })\n if (!response.data?.quotationDocumentFile) throw response.errors?.[0] ?? new Error(i18next.t('text.quotation-not-found'))\n return response.data.quotationDocumentFile\n },\n language,\n `${i18next.t('title.preview')} · ${number ?? ''} · v${version ?? ''}`\n )\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-words.js","sourceRoot":"","sources":["../client/quotation-words.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAe,EAAE,EAAE,CACrD,MAAM,KAAK,MAAM;IACf,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;IACzC,CAAC,CAAC,MAAM,KAAK,UAAU;QACrB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;QAC7C,CAAC,CAAC,MAAM,KAAK,UAAU;YACrB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;YAC7C,CAAC,CAAC,MAAM,KAAK,SAAS;gBACpB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC;gBAC5C,CAAC,CAAC,MAAM,KAAK,YAAY;oBACvB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC;oBAC/C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAA","sourcesContent":["import { i18next } from '@operato/i18n'\n\nexport const quotationStatusWord = (status?: string) =>\n status === 'SENT'\n ? i18next.t('text.quotation-status-sent')\n : status === 'ACCEPTED'\n ? i18next.t('text.quotation-status-accepted')\n : status === 'REJECTED'\n ? i18next.t('text.quotation-status-rejected')\n : status === 'EXPIRED'\n ? i18next.t('text.quotation-status-expired')\n : status === 'SUPERSEDED'\n ? i18next.t('text.quotation-status-superseded')\n : i18next.t('text.quotation-status-draft')\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,gBAAgB;YACnB,MAAM,CAAC,wBAAwB,CAAC,CAAA;YAChC,OAAO,IAAI,CAAA;QAEb,KAAK,kBAAkB;YACrB,MAAM,CAAC,0BAA0B,CAAC,CAAA;YAClC,OAAO,IAAI,CAAA;QAEb,KAAK,kBAAkB;YACrB,MAAM,CAAC,0BAA0B,CAAC,CAAA;YAClC,OAAO,IAAI,CAAA;QAEb,KAAK,oBAAoB;YACvB,MAAM,CAAC,4BAA4B,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;QAEb,KAAK,oBAAoB;YACvB,MAAM,CAAC,4BAA4B,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'quotation-list':\n import('./pages/quotation-list')\n return page\n\n case 'quotation-editor':\n import('./pages/quotation-editor')\n return page\n\n case 'opportunity-list':\n import('./pages/opportunity-list')\n return page\n\n case 'opportunity-editor':\n import('./pages/opportunity-editor')\n return page\n\n case 'sales-product-list':\n import('./pages/sales-product-list')\n return page\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sales-product-pick.js","sourceRoot":"","sources":["../client/sales-product-pick.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAgBpF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAsB;IAClD,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;QAC9E,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC;KACzC,CAAA;AACH,CAAC;AAED,MAAM,OAAO,GAAG,GAAG,CAAA;;;;;;CAMlB,CAAA;AAED;;;GAGG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA5D;;QAgEL,wEAAwE;QAC5D,aAAQ,GAAG,KA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IAEO,MAAM,CAAC,OAAsB;QACnC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACpG,CAAC;;AA3FW;IAAX,QAAQ,EAAE;;kDAAiB;AACC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;kDAAiB;AAE5B;IAAhB,KAAK,EAAE;;gDAAoB;AAEX;IAAhB,KAAK,EAAE;;8CAAqB;AACZ;IAAhB,KAAK,EAAE;;8CAAkB;AACT;IAAhB,KAAK,EAAE;;gDAAmB;AAxEhB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA6J5B","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { defaultTaxRate, documentNumber } from '@things-factory/invoice/dist-client'\n\n/** A product as a quotation line takes it - what it is called and sold in, its price and taxation (ADR-0171). */\nexport type PickedProduct = {\n id: string\n code: string\n name: string\n kind: string\n grade?: string | null\n spec?: string | null\n unit: string\n unitPrice: number\n currency: string\n taxKind: string\n}\n\n/**\n * The line a product makes: its name (and specification), one of its unit at its price, taxed as it is. A copy - the\n * line keeps no tie to the product, so the person changes its price or anything else, and a later price of the\n * product never reaches a written quotation (the user, 2026-10-28).\n */\nexport function lineOfProduct(product: PickedProduct) {\n return {\n description: product.spec ? `${product.name} · ${product.spec}` : product.name,\n quantity: 1,\n unit: product.unit,\n unitPrice: product.unitPrice,\n discount: 0,\n taxKind: product.taxKind,\n taxRate: defaultTaxRate(product.taxKind)\n }\n}\n\nconst CHOICES = gql`\n query ($filters: [Filter!], $search: String, $pagination: Pagination, $sortings: [Sorting!]) {\n products: salesProducts(filters: $filters, search: $search, pagination: $pagination, sortings: $sortings) {\n items { id code name kind grade spec unit unitPrice currency taxKind }\n }\n }\n`\n\n/**\n * Search active domain products in the document currency and emit product when selected. The editor creates\n * an editable copy as a document line, using the same interaction as counterparty-select.\n */\n@customElement('sales-product-pick')\nexport class SalesProductPick extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n position: relative;\n display: block;\n }\n input {\n box-sizing: border-box;\n width: 100%;\n height: var(--form-element-height-medium, 32px);\n padding: 0 var(--spacing-medium, 8px);\n border: var(--input-field-border, 1px solid var(--md-sys-color-outline));\n border-radius: var(--input-field-border-radius, var(--md-sys-shape-corner-small, 4px));\n background: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n font: inherit;\n font-size: var(--ui-t-body, 13px);\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n }\n input:focus-visible {\n outline: none;\n border-color: var(--md-sys-color-primary);\n }\n ul {\n position: absolute;\n z-index: 10;\n left: 0;\n right: 0;\n top: calc(100% + 2px);\n max-height: 260px;\n overflow-y: auto;\n margin: 0;\n padding: var(--spacing-small, 4px) 0;\n list-style: none;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: var(--ui-r, 10px);\n background: var(--md-sys-color-surface-container-lowest);\n box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);\n }\n li {\n display: flex;\n justify-content: space-between;\n gap: var(--spacing-large, 12px);\n padding: 6px var(--spacing-large, 12px);\n cursor: pointer;\n font-size: var(--ui-t-body, 13px);\n color: var(--ui-ink, var(--md-sys-color-on-surface));\n }\n li:hover,\n li[active] {\n background: var(--md-sys-color-surface-container-high);\n }\n li small {\n white-space: nowrap;\n font-variant-numeric: tabular-nums;\n }\n li small,\n li.none {\n color: var(--ui-muted, var(--md-sys-color-on-surface-variant));\n }\n li.none {\n cursor: default;\n }\n `\n\n /** The document's currency - only products priced in it are offered. */\n @property() currency = 'KRW'\n @property({ type: Boolean }) disabled = false\n\n @state() private search = ''\n /* The choices are open, for what was typed when typing last paused. */\n @state() private open = false\n @state() private term = ''\n @state() private active = 0\n\n private timer?: ReturnType<typeof setTimeout>\n\n /* The products offered for the term (ADR-0190); the last ones stay while the next term is read. */\n private choices = new QueryController(\n this,\n CHOICES,\n {\n variables: () =>\n this.open && !this.disabled\n ? {\n filters: [\n { name: 'active', operator: 'eq', value: true },\n { name: 'currency', operator: 'eq', value: this.currency || 'KRW' }\n ],\n search: this.term.trim() || undefined,\n pagination: { page: 1, limit: 30 },\n sortings: [{ name: 'code' }]\n }\n : undefined,\n keepPrevious: true\n }\n )\n\n private get found(): PickedProduct[] | null {\n if (!this.open || this.choices.error) return null\n return this.choices.data?.products?.items ?? null\n }\n\n render() {\n return html`\n <input\n .value=${this.search}\n placeholder=${i18next.t('text.sales-product-search')}\n aria-label=${i18next.t('field.sales-product-pick')}\n ?disabled=${this.disabled}\n @focus=${() => this.find()}\n @input=${(e: any) => ((this.search = e.target.value), this.findSoon())}\n @keydown=${(e: KeyboardEvent) => this.key(e)}\n @blur=${() => setTimeout(() => (this.open = false), 150)}\n />\n ${this.found\n ? html`<ul role=\"listbox\">\n ${this.found.length\n ? this.found.map(\n (one, index) =>\n html`<li role=\"option\" ?active=${index === this.active} @mousedown=${(e: Event) => (e.preventDefault(), this.choose(one))}>\n <span>${one.name}${one.spec ? ` · ${one.spec}` : ''}</span>\n <small>${[one.grade, one.unit, documentNumber(one.unitPrice, one.currency)].filter(Boolean).join(' · ')}</small>\n </li>`\n )\n : html`<li class=\"none\">${i18next.t('text.sales-product-none')}</li>`}\n </ul>`\n : nothing}\n `\n }\n\n private findSoon() {\n clearTimeout(this.timer)\n this.timer = setTimeout(() => this.find(), 250)\n }\n\n private find() {\n if (this.disabled) return\n this.open = true\n this.term = this.search\n this.active = 0\n }\n\n private key(e: KeyboardEvent) {\n if (!this.found?.length || e.isComposing) return\n if (e.key === 'ArrowDown') this.active = Math.min(this.active + 1, this.found.length - 1)\n else if (e.key === 'ArrowUp') this.active = Math.max(this.active - 1, 0)\n else if (e.key === 'Enter') this.choose(this.found[this.active])\n else if (e.key === 'Escape') this.open = false\n else return\n e.preventDefault()\n }\n\n private choose(product: PickedProduct) {\n this.search = ''\n this.open = false\n this.dispatchEvent(new CustomEvent('product', { detail: product, bubbles: true, composed: true }))\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sales-product-words.js","sourceRoot":"","sources":["../client/sales-product-words.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAAE,EAAE,CACpD,IAAI,KAAK,SAAS;IAChB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC;IAC9C,CAAC,CAAC,IAAI,KAAK,OAAO;QAChB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC;QAC5C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAA","sourcesContent":["import { i18next } from '@operato/i18n'\n\n/** What a product's kind reads as - goods, a service, labor. */\nexport const salesProductKindWord = (kind?: string) =>\n kind === 'SERVICE'\n ? i18next.t('text.sales-product-kind-service')\n : kind === 'LABOR'\n ? i18next.t('text.sales-product-kind-labor')\n : i18next.t('text.sales-product-kind-goods')\n"]}