@things-factory/sales 10.1.212 → 10.1.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/pages/opportunity-list.d.ts +4 -1
- package/dist-client/pages/opportunity-list.js +15 -3
- package/dist-client/pages/opportunity-list.js.map +1 -1
- package/dist-client/pages/quotation-list.d.ts +4 -1
- package/dist-client/pages/quotation-list.js +15 -3
- package/dist-client/pages/quotation-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.js +2 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -0
- package/dist-server/service/index.js +1 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/quotation/quotation-status.d.ts +8 -0
- package/dist-server/service/quotation/quotation-status.js +19 -0
- package/dist-server/service/quotation/quotation-status.js.map +1 -0
- package/dist-server/service/quotation/quotation.d.ts +2 -8
- package/dist-server/service/quotation/quotation.js +4 -15
- package/dist-server/service/quotation/quotation.js.map +1 -1
- package/dist-server/service/sales-read.d.ts +7 -0
- package/dist-server/service/sales-read.js +76 -0
- package/dist-server/service/sales-read.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
|
@@ -3,7 +3,10 @@ import '@operato/data-grist/ox-filters-form.js';
|
|
|
3
3
|
import { FetchOption } from '@operato/data-grist';
|
|
4
4
|
import { PageView } from '@operato/shell';
|
|
5
5
|
declare const OpportunityList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows
|
|
8
|
+
* picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
9
|
+
*/
|
|
7
10
|
export declare class OpportunityList extends OpportunityList_base {
|
|
8
11
|
static styles: import("lit").CSSResult[];
|
|
9
12
|
gristConfig: any;
|
|
@@ -11,10 +11,14 @@ import { entity360Name } from '@operato/layout';
|
|
|
11
11
|
import { navigate, PageView } from '@operato/shell';
|
|
12
12
|
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
13
13
|
import { isMobileDevice } from '@operato/utils';
|
|
14
|
+
import { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js';
|
|
14
15
|
import { documentAmount } from '@things-factory/invoice/dist-client';
|
|
15
16
|
import { opportunityStageWord } from '../opportunity-words';
|
|
16
17
|
const STAGES = ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION', 'WON', 'LOST'];
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows
|
|
20
|
+
* picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
21
|
+
*/
|
|
18
22
|
let OpportunityList = class OpportunityList extends localize(i18next)(PageView) {
|
|
19
23
|
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
|
|
20
24
|
get context() {
|
|
@@ -37,7 +41,14 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
render() {
|
|
40
|
-
return html `<ox-
|
|
44
|
+
return html `<ox-assistant-selection-bar
|
|
45
|
+
.gridOf=${() => this.grist}
|
|
46
|
+
name=${i18next.t('title.opportunity-list')}
|
|
47
|
+
list="opportunities"
|
|
48
|
+
axis="opportunity"
|
|
49
|
+
.labelOf=${(row) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}
|
|
50
|
+
></ox-assistant-selection-bar>
|
|
51
|
+
<ox-grist
|
|
41
52
|
class="page-fill"
|
|
42
53
|
search-mode="term"
|
|
43
54
|
.mode=${isMobileDevice() ? 'CARD' : 'GRID'}
|
|
@@ -64,12 +75,13 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
64
75
|
record: { editable: false, ...extra.record }
|
|
65
76
|
});
|
|
66
77
|
this.gristConfig = {
|
|
67
|
-
rows: { appendable: false, selectable:
|
|
78
|
+
rows: { appendable: false, selectable: { multiple: true } },
|
|
68
79
|
pagination: { limit: 50, pages: [50, 100, 500] },
|
|
69
80
|
emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },
|
|
70
81
|
list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },
|
|
71
82
|
columns: [
|
|
72
83
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
84
|
+
SELECTION_ROW_PICKER,
|
|
73
85
|
{ type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
74
86
|
readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {
|
|
75
87
|
record: { renderer: (_v, _c, record) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunity-list.js","sourceRoot":"","sources":["../../client/pages/opportunity-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAA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;IACzF,CAAC;;AAzGQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AAJjC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CA6G3B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { opportunityStageWord } from '../opportunity-words'\n\nconst STAGES = ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION', 'WON', 'LOST']\n\n/** 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. */\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 get context() {\n return {\n title: i18next.t('title.opportunity-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n /* Narrowing by stage stays in the headroom, and this folds it. */\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [{ title: i18next.t('button.opportunity-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('opportunity-editor') }],\n exportable: { name: i18next.t('title.opportunity-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-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 >\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 open = (record: any) => record?.id && navigate(`opportunity-editor?id=${record.id}`)\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '')\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: false },\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 { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {\n record: { renderer: (_v: any, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }\n }),\n readonly('string', 'counterparty', i18next.t('field.opportunity-counterparty'), 180, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'endCustomer', i18next.t('field.opportunity-end-customer'), 160, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'stage', i18next.t('field.opportunity-stage'), 90, {\n record: { renderer: (value: string) => opportunityStageWord(value) },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...STAGES.map(stage => ({ display: opportunityStageWord(stage), value: 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 readonly('string', 'owner', i18next.t('field.opportunity-owner'), 110, { sortable: false, record: { renderer: (value: any) => value?.name ?? '' } })\n ],\n sorters: [{ name: 'expectedCloseMonth' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\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: { page, limit }, sortings, search: search?.trim() || undefined },\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
|
+
{"version":3,"file":"opportunity-list.js","sourceRoot":"","sources":["../../client/pages/opportunity-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ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AAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE;YAClG,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AAjHQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AAJjC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAqH3B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { opportunityStageWord } from '../opportunity-words'\n\nconst STAGES = ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION', 'WON', 'LOST']\n\n/**\n * 영업 기회 — every opportunity of the domain, narrowed by stage. The name opens its 360; the edit gutter its editor. Rows\n * picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).\n */\n@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 get context() {\n return {\n title: i18next.t('title.opportunity-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n /* Narrowing by stage stays in the headroom, and this folds it. */\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n actions: [{ title: i18next.t('button.opportunity-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('opportunity-editor') }],\n exportable: { name: i18next.t('title.opportunity-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-assistant-selection-bar\n .gridOf=${() => this.grist}\n name=${i18next.t('title.opportunity-list')}\n list=\"opportunities\"\n axis=\"opportunity\"\n .labelOf=${(row: any) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}\n ></ox-assistant-selection-bar>\n <ox-grist\n class=\"page-fill\"\n search-mode=\"term\"\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n >\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 open = (record: any) => record?.id && navigate(`opportunity-editor?id=${record.id}`)\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '')\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true } },\n pagination: { limit: 50, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },\n list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n SELECTION_ROW_PICKER,\n { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {\n record: { renderer: (_v: any, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }\n }),\n readonly('string', 'counterparty', i18next.t('field.opportunity-counterparty'), 180, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'endCustomer', i18next.t('field.opportunity-end-customer'), 160, { sortable: false, record: { renderer: (value: any) => party(value) } }),\n readonly('string', 'stage', i18next.t('field.opportunity-stage'), 90, {\n record: { renderer: (value: string) => opportunityStageWord(value) },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...STAGES.map(stage => ({ display: opportunityStageWord(stage), value: 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 readonly('string', 'owner', i18next.t('field.opportunity-owner'), 110, { sortable: false, record: { renderer: (value: any) => value?.name ?? '' } })\n ],\n sorters: [{ name: 'expectedCloseMonth' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\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: { page, limit }, sortings, search: search?.trim() || undefined },\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"]}
|
|
@@ -2,7 +2,10 @@ import '@operato/data-grist/ox-grist.js';
|
|
|
2
2
|
import { FetchOption } from '@operato/data-grist';
|
|
3
3
|
import { PageView } from '@operato/shell';
|
|
4
4
|
declare const QuotationList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* 견적 — every version of every quotation; the latest of a number is the one still in play. Rows picked go to the
|
|
7
|
+
* assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).
|
|
8
|
+
*/
|
|
6
9
|
export declare class QuotationList extends QuotationList_base {
|
|
7
10
|
static styles: import("lit").CSSResult[];
|
|
8
11
|
gristConfig: any;
|
|
@@ -9,9 +9,13 @@ import { i18next, localize } from '@operato/i18n';
|
|
|
9
9
|
import { navigate, PageView } from '@operato/shell';
|
|
10
10
|
import { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
11
11
|
import { isMobileDevice } from '@operato/utils';
|
|
12
|
+
import { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js';
|
|
12
13
|
import { counterpartOf, documentAmount } from '@things-factory/invoice/dist-client';
|
|
13
14
|
import { quotationStatusWord } from '../quotation-words';
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* 견적 — every version of every quotation; the latest of a number is the one still in play. Rows picked go to the
|
|
17
|
+
* assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).
|
|
18
|
+
*/
|
|
15
19
|
let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
16
20
|
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, ScrollbarStyles]; }
|
|
17
21
|
get context() {
|
|
@@ -28,7 +32,14 @@ let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
|
28
32
|
};
|
|
29
33
|
}
|
|
30
34
|
render() {
|
|
31
|
-
return html `<ox-
|
|
35
|
+
return html `<ox-assistant-selection-bar
|
|
36
|
+
.gridOf=${() => this.grist}
|
|
37
|
+
name=${i18next.t('title.quotation-list')}
|
|
38
|
+
list="quotations"
|
|
39
|
+
axis="quotation"
|
|
40
|
+
.labelOf=${(row) => [row.number && `${row.number} v${row.version}`, counterpartOf(row)].filter(Boolean).join(' · ')}
|
|
41
|
+
></ox-assistant-selection-bar>
|
|
42
|
+
<ox-grist
|
|
32
43
|
class="page-fill"
|
|
33
44
|
search-mode="term"
|
|
34
45
|
.mode=${isMobileDevice() ? 'CARD' : 'GRID'}
|
|
@@ -48,12 +59,13 @@ let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
|
48
59
|
record: { editable: false, ...extra.record }
|
|
49
60
|
});
|
|
50
61
|
this.gristConfig = {
|
|
51
|
-
rows: { appendable: false, selectable:
|
|
62
|
+
rows: { appendable: false, selectable: { multiple: true } },
|
|
52
63
|
pagination: { limit: 50, pages: [50, 100, 500] },
|
|
53
64
|
emptyNote: { title: i18next.t('text.quotation-empty'), description: i18next.t('text.quotation-empty-description') },
|
|
54
65
|
list: { fields: ['counterpart', 'number'], details: ['status', 'validUntil', 'totalAmount'] },
|
|
55
66
|
columns: [
|
|
56
67
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
68
|
+
SELECTION_ROW_PICKER,
|
|
57
69
|
{ type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
58
70
|
readonly('string', 'counterpart', i18next.t('field.quotation-counterpart'), 200, { sortable: false, record: { renderer: (_v, _c, record) => counterpartOf(record) } }),
|
|
59
71
|
readonly('string', 'number', i18next.t('field.quotation-number'), 140),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotation-list.js","sourceRoot":"","sources":["../../client/pages/quotation-list.ts"],"names":[],"mappings":";AAAA,OA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CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AAvFQ;IAAR,KAAK,EAAE;;kDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;4CAAA;AAJjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA2FzB","sourcesContent":["import '@operato/data-grist/ox-grist.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 { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { counterpartOf, documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { quotationStatusWord } from '../quotation-words'\n\n/** 견적 — every version of every quotation; the latest of a number is the one still in play. */\n@customElement('quotation-list')\nexport class QuotationList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, 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 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 render() {\n return html`<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 ></ox-grist>`\n }\n\n async pageInitialized() {\n const open = (record: any) => record?.id && navigate(`quotation-editor?id=${record.id}`)\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: false },\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 { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\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, { record: { renderer: (value: string) => quotationStatusWord(value) } }),\n readonly('string', 'issueDate', i18next.t('field.quotation-issue-date'), 110),\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 async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\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: search?.trim() || undefined },\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
|
+
{"version":3,"file":"quotation-list.js","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,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;OAmBT;YACD,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE;YAClG,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AA/FQ;IAAR,KAAK,EAAE;;kDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;4CAAA;AAJjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAmGzB","sourcesContent":["import '@operato/data-grist/ox-grist.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 { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, 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 } from '@things-factory/invoice/dist-client'\n\nimport { quotationStatusWord } from '../quotation-words'\n\n/**\n * 견적 — every version of every quotation; the latest of a number is the one still in play. Rows picked go to the\n * assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).\n */\n@customElement('quotation-list')\nexport class QuotationList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, 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 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 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 ></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 ></ox-grist>`\n }\n\n async pageInitialized() {\n const open = (record: any) => record?.id && navigate(`quotation-editor?id=${record.id}`)\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: { multiple: true } },\n pagination: { limit: 50, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.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 { type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\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, { record: { renderer: (value: string) => quotationStatusWord(value) } }),\n readonly('string', 'issueDate', i18next.t('field.quotation-issue-date'), 110),\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 async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\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: search?.trim() || undefined },\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"]}
|