@things-factory/sales 10.1.277 → 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.
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/entity360/opportunity-360.js +5 -0
- package/dist-client/entity360/quotation-360.d.ts +15 -0
- package/dist-client/entity360/quotation-360.js +101 -0
- package/dist-client/pages/opportunity-list.d.ts +3 -2
- package/dist-client/pages/opportunity-list.js +25 -6
- package/dist-client/pages/quotation-editor.d.ts +0 -4
- package/dist-client/pages/quotation-editor.js +3 -19
- package/dist-client/pages/quotation-list.d.ts +3 -1
- package/dist-client/pages/quotation-list.js +25 -4
- package/dist-client/quotation-preview.d.ts +11 -0
- package/dist-client/quotation-preview.js +26 -0
- package/dist-client/sales-product-pick.d.ts +2 -3
- package/dist-client/sales-product-pick.js +2 -3
- package/dist-server/service/index.d.ts +2 -2
- package/dist-server/service/opportunity/index.d.ts +1 -1
- package/package.json +23 -7
- package/CHANGELOG.md +0 -8
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/close-months.js.map +0 -1
- package/dist-client/entity360/opportunity-360.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/list-filters.js.map +0 -1
- package/dist-client/opportunity-attach.js.map +0 -1
- package/dist-client/opportunity-words.js.map +0 -1
- package/dist-client/pages/opportunity-editor.js.map +0 -1
- package/dist-client/pages/opportunity-list.js.map +0 -1
- package/dist-client/pages/quotation-editor.js.map +0 -1
- package/dist-client/pages/quotation-list.js.map +0 -1
- package/dist-client/pages/sales-product-list.js.map +0 -1
- package/dist-client/quotation-attach.js.map +0 -1
- package/dist-client/quotation-words.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/sales-product-pick.js.map +0 -1
- package/dist-client/sales-product-words.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/middlewares/index.js.map +0 -1
- package/dist-server/migrations/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/routes.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/service/opportunity/index.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-event-query.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-event.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-mutation.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-query.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-rules.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-service.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-subject.js.map +0 -1
- package/dist-server/service/opportunity/opportunity-type.js.map +0 -1
- package/dist-server/service/opportunity/opportunity.js.map +0 -1
- package/dist-server/service/quotation/index.js.map +0 -1
- package/dist-server/service/quotation/quotation-event-query.js.map +0 -1
- package/dist-server/service/quotation/quotation-event.js.map +0 -1
- package/dist-server/service/quotation/quotation-item-query.js.map +0 -1
- package/dist-server/service/quotation/quotation-item.js.map +0 -1
- package/dist-server/service/quotation/quotation-mutation.js.map +0 -1
- package/dist-server/service/quotation/quotation-query.js.map +0 -1
- package/dist-server/service/quotation/quotation-rules.js.map +0 -1
- package/dist-server/service/quotation/quotation-service.js.map +0 -1
- package/dist-server/service/quotation/quotation-status.js.map +0 -1
- package/dist-server/service/quotation/quotation-type.js.map +0 -1
- package/dist-server/service/quotation/quotation.js.map +0 -1
- package/dist-server/service/sales-event.js.map +0 -1
- package/dist-server/service/sales-product/index.js.map +0 -1
- package/dist-server/service/sales-product/sales-product-mutation.js.map +0 -1
- package/dist-server/service/sales-product/sales-product-query.js.map +0 -1
- package/dist-server/service/sales-product/sales-product-rules.js.map +0 -1
- package/dist-server/service/sales-product/sales-product-service.js.map +0 -1
- package/dist-server/service/sales-product/sales-product-type.js.map +0 -1
- package/dist-server/service/sales-product/sales-product.js.map +0 -1
- package/dist-server/service/sales-read.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/dist-server/work-doors.js.map +0 -1
package/dist-client/bootstrap.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { registerOpportunityKind } from './entity360/opportunity-360.js';
|
|
2
|
+
import { registerQuotationKind } from './entity360/quotation-360.js';
|
|
2
3
|
export default function bootstrap() {
|
|
3
4
|
registerOpportunityKind();
|
|
5
|
+
registerQuotationKind();
|
|
4
6
|
}
|
|
5
7
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -53,6 +53,10 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
|
|
|
53
53
|
overflow-wrap: anywhere;
|
|
54
54
|
font-variant-numeric: tabular-nums;
|
|
55
55
|
}
|
|
56
|
+
/* The opportunity's own words keep their lines. */
|
|
57
|
+
dd.text {
|
|
58
|
+
white-space: pre-line;
|
|
59
|
+
}
|
|
56
60
|
`; }
|
|
57
61
|
get answer() {
|
|
58
62
|
return entity360Answer(this.opportunity, data => data?.opportunity);
|
|
@@ -77,6 +81,7 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
|
|
|
77
81
|
<dd>${one.owner?.name ?? '—'}</dd>
|
|
78
82
|
${one.closedOn ? html `<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}
|
|
79
83
|
${one.lostReason ? html `<dt>${i18next.t('field.opportunity-lost-reason')}</dt><dd>${one.lostReason}</dd>` : ''}
|
|
84
|
+
${one.description ? html `<dt>${i18next.t('field.opportunity-description')}</dt><dd class="text">${one.description}</dd>` : ''}
|
|
80
85
|
</dl>`
|
|
81
86
|
: ''}
|
|
82
87
|
</ox-entity360-section>`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { type Entity360Subject } from '@operato/layout';
|
|
3
|
+
/**
|
|
4
|
+
* A quotation's 360 (ADR-0067) - what the quotation list opens to read, as the opportunity and invoice lists open
|
|
5
|
+
* theirs (the user, 2026-11-13: 「팝업 보다는 360이 일관성있는 UX가 될 것 같다」). The module draws the quotation; the
|
|
6
|
+
* quotation itself, lines and terms, is read in its preview.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerQuotationKind(): void;
|
|
9
|
+
export declare class QuotationOverviewSection extends LitElement {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
subject?: Entity360Subject;
|
|
12
|
+
private quotation;
|
|
13
|
+
get answer(): import("@operato/layout").Entity360DoorAnswer<any> | undefined;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import { QueryController } from '@operato/graphql';
|
|
6
|
+
import { i18next } from '@operato/i18n';
|
|
7
|
+
import { entity360Answer, entity360Link, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
|
|
8
|
+
import { ButtonStyles } from '@operato/styles';
|
|
9
|
+
import { counterpartOf, DocumentFormStyles, renderDocumentTotals } from '@things-factory/invoice/dist-client';
|
|
10
|
+
import { previewQuotation } from '../quotation-preview';
|
|
11
|
+
import { quotationStatusWord } from '../quotation-words';
|
|
12
|
+
/**
|
|
13
|
+
* A quotation's 360 (ADR-0067) - what the quotation list opens to read, as the opportunity and invoice lists open
|
|
14
|
+
* theirs (the user, 2026-11-13: 「팝업 보다는 360이 일관성있는 UX가 될 것 같다」). The module draws the quotation; the
|
|
15
|
+
* quotation itself, lines and terms, is read in its preview.
|
|
16
|
+
*/
|
|
17
|
+
export function registerQuotationKind() {
|
|
18
|
+
registerEntity360Kind({
|
|
19
|
+
kind: 'quotation',
|
|
20
|
+
typenames: ['Quotation'],
|
|
21
|
+
assistantSubject: true,
|
|
22
|
+
title: ({ value }) => `${i18next.t('title.quotation')} · ${counterpartOf(value) || value.number || ''}`,
|
|
23
|
+
context: ({ value }) => [value.number && `${value.number} v${value.version ?? ''}`, value.issueDate, value.status ? quotationStatusWord(value.status) : ''].filter(Boolean).join(' · ')
|
|
24
|
+
});
|
|
25
|
+
registerEntity360Section('quotation', {
|
|
26
|
+
name: 'overview',
|
|
27
|
+
order: 10,
|
|
28
|
+
render: subject => html `<quotation-overview-section .subject=${subject}></quotation-overview-section>`
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
let QuotationOverviewSection = class QuotationOverviewSection extends LitElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/* The quotation of the subject shown (ADR-0190). */
|
|
35
|
+
this.quotation = new QueryController(this, gql `
|
|
36
|
+
query ($id: String!) {
|
|
37
|
+
quotation(id: $id) {
|
|
38
|
+
id number version status direction currency language issueDate validUntil supplierName buyerName opportunity { id name }
|
|
39
|
+
supplyAmount taxAmount totalAmount taxGroups { taxKind taxRate supplyAmount taxAmount }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`, { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) });
|
|
43
|
+
}
|
|
44
|
+
static { this.styles = [
|
|
45
|
+
ButtonStyles,
|
|
46
|
+
DocumentFormStyles,
|
|
47
|
+
css `
|
|
48
|
+
:host {
|
|
49
|
+
font-size: var(--ui-t-body);
|
|
50
|
+
line-height: 1.5;
|
|
51
|
+
}
|
|
52
|
+
dl {
|
|
53
|
+
margin: 0 0 var(--spacing-large);
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: max-content 1fr;
|
|
56
|
+
gap: var(--spacing-small) var(--spacing-large);
|
|
57
|
+
}
|
|
58
|
+
dt {
|
|
59
|
+
color: var(--ui-muted);
|
|
60
|
+
}
|
|
61
|
+
dd {
|
|
62
|
+
margin: 0;
|
|
63
|
+
overflow-wrap: anywhere;
|
|
64
|
+
font-variant-numeric: tabular-nums;
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
]; }
|
|
68
|
+
get answer() {
|
|
69
|
+
return entity360Answer(this.quotation, data => data?.quotation);
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
const one = this.answer?.data;
|
|
73
|
+
return html `<ox-entity360-section .heading=${i18next.t('title.quotation')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>
|
|
74
|
+
${one ? html `<button slot="actions" quiet small @click=${() => previewQuotation(one)}>${i18next.t('button.preview')}</button>` : ''}
|
|
75
|
+
${one
|
|
76
|
+
? html `<dl>
|
|
77
|
+
<dt>${i18next.t('field.quotation-number')}</dt>
|
|
78
|
+
<dd>${one.number} v${one.version} · ${quotationStatusWord(one.status)}</dd>
|
|
79
|
+
<dt>${i18next.t('field.quotation-counterpart')}</dt>
|
|
80
|
+
<dd>${counterpartOf(one) || '—'}</dd>
|
|
81
|
+
<dt>${i18next.t('field.quotation-opportunity')}</dt>
|
|
82
|
+
<dd>${one.opportunity ? entity360Link('opportunity', one.opportunity.id, one.opportunity.name) : '—'}</dd>
|
|
83
|
+
<dt>${i18next.t('field.quotation-issue-date')}</dt>
|
|
84
|
+
<dd>${one.issueDate ?? '—'}</dd>
|
|
85
|
+
<dt>${i18next.t('field.quotation-valid-until')}</dt>
|
|
86
|
+
<dd>${one.validUntil ?? '—'}</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
${renderDocumentTotals(one)}`
|
|
89
|
+
: ''}
|
|
90
|
+
</ox-entity360-section>`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ attribute: false }),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], QuotationOverviewSection.prototype, "subject", void 0);
|
|
97
|
+
QuotationOverviewSection = __decorate([
|
|
98
|
+
customElement('quotation-overview-section')
|
|
99
|
+
], QuotationOverviewSection);
|
|
100
|
+
export { QuotationOverviewSection };
|
|
101
|
+
//# sourceMappingURL=quotation-360.js.map
|
|
@@ -4,8 +4,8 @@ import { FetchOption } from '@operato/data-grist';
|
|
|
4
4
|
import { PageView } from '@operato/shell';
|
|
5
5
|
declare const OpportunityList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
6
6
|
/**
|
|
7
|
-
* 영업 기회 — every opportunity of the domain, narrowed by stage.
|
|
8
|
-
* picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
7
|
+
* 영업 기회 — every opportunity of the domain, narrowed by stage. A click or a tap on the row opens its 360 to read; with one
|
|
8
|
+
* row picked, 「수정」 on the bar opens the editor. Rows picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
9
9
|
*
|
|
10
10
|
* The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow
|
|
11
11
|
* the list, each with how many opportunities it holds under the other conditions — counted by the server, so the
|
|
@@ -40,6 +40,7 @@ export declare class OpportunityList extends OpportunityList_base {
|
|
|
40
40
|
data: () => any[];
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
+
private editAction;
|
|
43
44
|
render(): import("lit-html").TemplateResult<1>;
|
|
44
45
|
pageInitialized(): Promise<void>;
|
|
45
46
|
fetchHandler({ page, limit, sortings, filters, search }: FetchOption): Promise<{
|
|
@@ -7,7 +7,7 @@ import { customElement, query, state } from 'lit/decorators.js';
|
|
|
7
7
|
import { DataGrist } from '@operato/data-grist';
|
|
8
8
|
import { client } from '@operato/graphql';
|
|
9
9
|
import { i18next, localize } from '@operato/i18n';
|
|
10
|
-
import { entity360Name } from '@operato/layout';
|
|
10
|
+
import { entity360Name, openEntity360Kind } from '@operato/layout';
|
|
11
11
|
import { navigate, PageView } from '@operato/shell';
|
|
12
12
|
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
13
13
|
import { isMobileDevice } from '@operato/utils';
|
|
@@ -17,8 +17,8 @@ import { OPEN_STAGES, opportunityFilters, STAGES } from '../list-filters';
|
|
|
17
17
|
import { opportunityStageWord } from '../opportunity-words';
|
|
18
18
|
const today = () => new Date().toLocaleDateString('en-CA');
|
|
19
19
|
/**
|
|
20
|
-
* 영업 기회 — every opportunity of the domain, narrowed by stage.
|
|
21
|
-
* picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
20
|
+
* 영업 기회 — every opportunity of the domain, narrowed by stage. A click or a tap on the row opens its 360 to read; with one
|
|
21
|
+
* row picked, 「수정」 on the bar opens the editor. Rows picked go to the assistant (「AI와 작업」) as `opportunity:<uuid>`, read by the opportunity list's read (sales-read.ts).
|
|
22
22
|
*
|
|
23
23
|
* The person in charge and the expected-close period narrow it from the headroom. The stages are chips that narrow
|
|
24
24
|
* the list, each with how many opportunities it holds under the other conditions — counted by the server, so the
|
|
@@ -27,6 +27,20 @@ const today = () => new Date().toLocaleDateString('en-CA');
|
|
|
27
27
|
* with the search, sort and page, and a change reads page 1 (FOOTER-BUTTON-REVIEW G09).
|
|
28
28
|
*/
|
|
29
29
|
let OpportunityList = class OpportunityList extends localize(i18next)(PageView) {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
/* Changing it is apart from reading it: one picked row, 「수정」 on the bar over the list (the user, 2026-11-13). */
|
|
33
|
+
this.editAction = {
|
|
34
|
+
title: i18next.t('button.edit'),
|
|
35
|
+
icon: 'edit',
|
|
36
|
+
single: true,
|
|
37
|
+
action: () => {
|
|
38
|
+
const row = this.grist.selected?.[0];
|
|
39
|
+
if (row?.id)
|
|
40
|
+
navigate(`opportunity-editor?id=${row.id}`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
30
44
|
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
|
|
31
45
|
/* The people an opportunity may be put in the charge of - the editor's choices, read when the filter opens. */
|
|
32
46
|
async owners() {
|
|
@@ -59,6 +73,7 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
59
73
|
list="opportunities"
|
|
60
74
|
axis="opportunity"
|
|
61
75
|
.labelOf=${(row) => [row.name, row.counterparty?.name].filter(Boolean).join(' · ')}
|
|
76
|
+
.actions=${[this.editAction]}
|
|
62
77
|
></ox-assistant-selection-bar>
|
|
63
78
|
<ox-grist
|
|
64
79
|
class="page-fill"
|
|
@@ -75,7 +90,7 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
75
90
|
</ox-grist>`;
|
|
76
91
|
}
|
|
77
92
|
async pageInitialized() {
|
|
78
|
-
const open = (record) => record?.id &&
|
|
93
|
+
const open = (record) => record?.id && openEntity360Kind('opportunity', record);
|
|
79
94
|
const party = (value) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '');
|
|
80
95
|
const readonly = (type, name, header, width, extra = {}) => ({
|
|
81
96
|
type,
|
|
@@ -87,14 +102,18 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
87
102
|
record: { editable: false, ...extra.record }
|
|
88
103
|
});
|
|
89
104
|
this.gristConfig = {
|
|
90
|
-
|
|
105
|
+
/* The row's picker (a gutter) picks it for the bar; the rest of the row opens its 360 to read. */
|
|
106
|
+
rows: {
|
|
107
|
+
appendable: false,
|
|
108
|
+
selectable: { multiple: true },
|
|
109
|
+
handlers: { click: (_c, _d, column, record) => column?.type !== 'gutter' && open(record) }
|
|
110
|
+
},
|
|
91
111
|
pagination: { limit: 50, pages: [50, 100, 500] },
|
|
92
112
|
emptyNote: { title: i18next.t('text.opportunity-empty'), description: i18next.t('text.opportunity-empty-description') },
|
|
93
113
|
list: { fields: ['name', 'counterparty'], details: ['stage', 'expectedCloseMonth', 'amount'] },
|
|
94
114
|
columns: [
|
|
95
115
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
96
116
|
SELECTION_ROW_PICKER,
|
|
97
|
-
{ type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
98
117
|
readonly('string', 'name', i18next.t('field.opportunity-name'), 220, {
|
|
99
118
|
record: { renderer: (_v, _c, record) => (record?.id ? entity360Name({ __typename: 'Opportunity', ...record }, record.name) : '') }
|
|
100
119
|
}),
|
|
@@ -111,10 +111,6 @@ export declare class QuotationEditor extends QuotationEditor_base {
|
|
|
111
111
|
* as the invoice editor links it.
|
|
112
112
|
*/
|
|
113
113
|
private makeInvoice;
|
|
114
|
-
/**
|
|
115
|
-
* The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
|
|
116
|
-
* quotation's own first, to download as PDF or print. What is on screen and not saved is not in it.
|
|
117
|
-
*/
|
|
118
114
|
private preview;
|
|
119
115
|
}
|
|
120
116
|
export {};
|
|
@@ -14,9 +14,10 @@ import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
|
14
14
|
import { navigate, PageView, DraftController } from '@operato/shell';
|
|
15
15
|
import { ButtonStyles, CommonGristStyles, DocumentPageStyles, FormFieldStyles, ScrollbarStyles } from '@operato/styles';
|
|
16
16
|
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
17
|
-
import { daysAfter, documentAmount, DocumentFormStyles, documentLinesConfig, linesOf, onLineChange,
|
|
17
|
+
import { daysAfter, documentAmount, DocumentFormStyles, documentLinesConfig, linesOf, onLineChange, reckonLines, renderDocumentHead, renderDocumentTotals, DOCUMENT_DEFAULTS, DOCUMENT_DEFAULTS_READER, headFromDefaults, nextInvoiceNumber, OUR_SIDE_FIELDS, oursFromLast, partyOfName } from '@things-factory/invoice/dist-client';
|
|
18
18
|
import '@things-factory/biz-base/dist-client';
|
|
19
19
|
import { quotationSection } from '../quotation-attach';
|
|
20
|
+
import { previewQuotation } from '../quotation-preview';
|
|
20
21
|
import '../sales-product-pick';
|
|
21
22
|
import { lineOfProduct } from '../sales-product-pick';
|
|
22
23
|
import { quotationStatusWord } from '../quotation-words';
|
|
@@ -547,26 +548,9 @@ let QuotationEditor = class QuotationEditor extends localize(i18next)(PageView)
|
|
|
547
548
|
this.making = false;
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
|
-
/**
|
|
551
|
-
* The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
|
|
552
|
-
* quotation's own first, to download as PDF or print. What is on screen and not saved is not in it.
|
|
553
|
-
*/
|
|
554
551
|
preview() {
|
|
555
552
|
const { id, number, version, language } = this.quotation;
|
|
556
|
-
|
|
557
|
-
const response = await client.query({
|
|
558
|
-
query: gql `
|
|
559
|
-
query ($id: String!, $format: DocumentFileFormat!, $language: String) {
|
|
560
|
-
quotationDocumentFile(id: $id, format: $format, language: $language) { fileName mimeType content }
|
|
561
|
-
}
|
|
562
|
-
`,
|
|
563
|
-
variables: { id, format, language: lng },
|
|
564
|
-
fetchPolicy: 'no-cache'
|
|
565
|
-
});
|
|
566
|
-
if (!response.data?.quotationDocumentFile)
|
|
567
|
-
throw response.errors?.[0] ?? new Error(i18next.t('text.quotation-not-found'));
|
|
568
|
-
return response.data.quotationDocumentFile;
|
|
569
|
-
}, language, `${i18next.t('title.preview')} · ${number} · v${version}`);
|
|
553
|
+
previewQuotation({ id, number, version, language });
|
|
570
554
|
}
|
|
571
555
|
};
|
|
572
556
|
__decorate([
|
|
@@ -4,7 +4,8 @@ import { FetchOption } from '@operato/data-grist';
|
|
|
4
4
|
import { PageView } from '@operato/shell';
|
|
5
5
|
declare const QuotationList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
6
6
|
/**
|
|
7
|
-
* 견적 — every version of every quotation; the latest of a number is the one still in play.
|
|
7
|
+
* 견적 — every version of every quotation; the latest of a number is the one still in play. A click or a
|
|
8
|
+
* tap on the row opens its 360 to read; with one row picked, 「수정」 on the bar opens the editor. Rows picked go to the
|
|
8
9
|
* assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).
|
|
9
10
|
*
|
|
10
11
|
* The headroom narrows it by issue period, as the invoice list does, and by status chips, each with how many quotations
|
|
@@ -37,6 +38,7 @@ export declare class QuotationList extends QuotationList_base {
|
|
|
37
38
|
data: () => any[];
|
|
38
39
|
};
|
|
39
40
|
};
|
|
41
|
+
private editAction;
|
|
40
42
|
render(): import("lit-html").TemplateResult<1>;
|
|
41
43
|
pageInitialized(): Promise<void>;
|
|
42
44
|
private conditions;
|
|
@@ -7,6 +7,7 @@ import { customElement, query, state } from 'lit/decorators.js';
|
|
|
7
7
|
import { DataGrist } from '@operato/data-grist';
|
|
8
8
|
import { client } from '@operato/graphql';
|
|
9
9
|
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { openEntity360Kind } from '@operato/layout';
|
|
10
11
|
import { navigate, PageView } from '@operato/shell';
|
|
11
12
|
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
12
13
|
import { isMobileDevice } from '@operato/utils';
|
|
@@ -16,7 +17,8 @@ import { QUOTATION_STATUSES, quotationFilters } from '../list-filters';
|
|
|
16
17
|
import { quotationStatusWord } from '../quotation-words';
|
|
17
18
|
const today = () => new Date().toLocaleDateString('en-CA');
|
|
18
19
|
/**
|
|
19
|
-
* 견적 — every version of every quotation; the latest of a number is the one still in play.
|
|
20
|
+
* 견적 — every version of every quotation; the latest of a number is the one still in play. A click or a
|
|
21
|
+
* tap on the row opens its 360 to read; with one row picked, 「수정」 on the bar opens the editor. Rows picked go to the
|
|
20
22
|
* assistant (「AI와 작업」) as `quotation:<uuid>`, read by the quotation list's read (sales-read.ts).
|
|
21
23
|
*
|
|
22
24
|
* The headroom narrows it by issue period, as the invoice list does, and by status chips, each with how many quotations
|
|
@@ -24,6 +26,20 @@ const today = () => new Date().toLocaleDateString('en-CA');
|
|
|
24
26
|
* grid's own column filters, kept in the address with the search, sort and page (FOOTER-BUTTON-REVIEW G09).
|
|
25
27
|
*/
|
|
26
28
|
let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
/* Changing it is apart from reading it: one picked row, 「수정」 on the bar over the list (the user, 2026-11-13). */
|
|
32
|
+
this.editAction = {
|
|
33
|
+
title: i18next.t('button.edit'),
|
|
34
|
+
icon: 'edit',
|
|
35
|
+
single: true,
|
|
36
|
+
action: () => {
|
|
37
|
+
const row = this.grist.selected?.[0];
|
|
38
|
+
if (row?.id)
|
|
39
|
+
navigate(`quotation-editor?id=${row.id}`);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
27
43
|
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
|
|
28
44
|
get context() {
|
|
29
45
|
return {
|
|
@@ -51,6 +67,7 @@ let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
|
51
67
|
list="quotations"
|
|
52
68
|
axis="quotation"
|
|
53
69
|
.labelOf=${(row) => [row.number && `${row.number} v${row.version}`, counterpartOf(row)].filter(Boolean).join(' · ')}
|
|
70
|
+
.actions=${[this.editAction]}
|
|
54
71
|
></ox-assistant-selection-bar>
|
|
55
72
|
<ox-grist
|
|
56
73
|
class="page-fill"
|
|
@@ -67,7 +84,7 @@ let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
|
67
84
|
</ox-grist>`;
|
|
68
85
|
}
|
|
69
86
|
async pageInitialized() {
|
|
70
|
-
const open = (record) => record?.id &&
|
|
87
|
+
const open = (record) => record?.id && openEntity360Kind('quotation', record);
|
|
71
88
|
const readonly = (type, name, header, width, extra = {}) => ({
|
|
72
89
|
type,
|
|
73
90
|
name,
|
|
@@ -78,14 +95,18 @@ let QuotationList = class QuotationList extends localize(i18next)(PageView) {
|
|
|
78
95
|
record: { editable: false, ...extra.record }
|
|
79
96
|
});
|
|
80
97
|
this.gristConfig = {
|
|
81
|
-
|
|
98
|
+
/* The row's picker (a gutter) picks it for the bar; the rest of the row opens its 360 to read. */
|
|
99
|
+
rows: {
|
|
100
|
+
appendable: false,
|
|
101
|
+
selectable: { multiple: true },
|
|
102
|
+
handlers: { click: (_c, _d, column, record) => column?.type !== 'gutter' && open(record) }
|
|
103
|
+
},
|
|
82
104
|
pagination: { limit: 50, pages: [50, 100, 500] },
|
|
83
105
|
emptyNote: { title: i18next.t('text.quotation-empty'), description: i18next.t('text.quotation-empty-description') },
|
|
84
106
|
list: { fields: ['counterpart', 'number'], details: ['status', 'validUntil', 'totalAmount'] },
|
|
85
107
|
columns: [
|
|
86
108
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
87
109
|
SELECTION_ROW_PICKER,
|
|
88
|
-
{ type: 'gutter', gutterName: 'button', icon: 'edit_note', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
89
110
|
readonly('string', 'counterpart', i18next.t('field.quotation-counterpart'), 200, { sortable: false, record: { renderer: (_v, _c, record) => counterpartOf(record) } }),
|
|
90
111
|
readonly('string', 'number', i18next.t('field.quotation-number'), 140),
|
|
91
112
|
readonly('integer', 'version', i18next.t('field.quotation-version'), 60),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
|
|
3
|
+
* quotation's own first, to download as PDF or print. What is on screen and not saved is not in it. The editor and
|
|
4
|
+
* the quotation's 360 open the same preview.
|
|
5
|
+
*/
|
|
6
|
+
export declare function previewQuotation({ id, number, version, language }: {
|
|
7
|
+
id: string;
|
|
8
|
+
number?: string | null;
|
|
9
|
+
version?: number | null;
|
|
10
|
+
language?: string | null;
|
|
11
|
+
}): import("@operato/popup").PopupHandle<unknown>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
import { client } from '@operato/graphql';
|
|
3
|
+
import { i18next } from '@operato/i18n';
|
|
4
|
+
import { openDocumentPreview } from '@things-factory/invoice/dist-client';
|
|
5
|
+
/**
|
|
6
|
+
* The saved quotation as it goes out (ADR-0170 decision 10) - the server's page in the language chosen there, the
|
|
7
|
+
* quotation's own first, to download as PDF or print. What is on screen and not saved is not in it. The editor and
|
|
8
|
+
* the quotation's 360 open the same preview.
|
|
9
|
+
*/
|
|
10
|
+
export function previewQuotation({ id, number, version, language }) {
|
|
11
|
+
return openDocumentPreview(async (format, lng) => {
|
|
12
|
+
const response = await client.query({
|
|
13
|
+
query: gql `
|
|
14
|
+
query ($id: String!, $format: DocumentFileFormat!, $language: String) {
|
|
15
|
+
quotationDocumentFile(id: $id, format: $format, language: $language) { fileName mimeType content }
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
variables: { id, format, language: lng },
|
|
19
|
+
fetchPolicy: 'no-cache'
|
|
20
|
+
});
|
|
21
|
+
if (!response.data?.quotationDocumentFile)
|
|
22
|
+
throw response.errors?.[0] ?? new Error(i18next.t('text.quotation-not-found'));
|
|
23
|
+
return response.data.quotationDocumentFile;
|
|
24
|
+
}, language, `${i18next.t('title.preview')} · ${number ?? ''} · v${version ?? ''}`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=quotation-preview.js.map
|
|
@@ -28,9 +28,8 @@ export declare function lineOfProduct(product: PickedProduct): {
|
|
|
28
28
|
};
|
|
29
29
|
declare const SalesProductPick_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* like any line. The interaction is the counterparty picker's (biz-base `counterparty-select`).
|
|
31
|
+
* Search active domain products in the document currency and emit product when selected. The editor creates
|
|
32
|
+
* an editable copy as a document line, using the same interaction as counterparty-select.
|
|
34
33
|
*/
|
|
35
34
|
export declare class SalesProductPick extends SalesProductPick_base {
|
|
36
35
|
static styles: import("lit").CSSResult;
|
|
@@ -29,9 +29,8 @@ const CHOICES = gql `
|
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* like any line. The interaction is the counterparty picker's (biz-base `counterparty-select`).
|
|
32
|
+
* Search active domain products in the document currency and emit product when selected. The editor creates
|
|
33
|
+
* an editable copy as a document line, using the same interaction as counterparty-select.
|
|
35
34
|
*/
|
|
36
35
|
let SalesProductPick = class SalesProductPick extends localize(i18next)(LitElement) {
|
|
37
36
|
constructor() {
|
|
@@ -14,8 +14,8 @@ export * from './sales-product/sales-product-rules';
|
|
|
14
14
|
export * from './sales-product/sales-product-service';
|
|
15
15
|
export * from './sales-product/sales-product-type';
|
|
16
16
|
export * from './sales-read';
|
|
17
|
-
export declare const entities: (typeof import("./
|
|
17
|
+
export declare const entities: (typeof import("./opportunity/opportunity").Opportunity | typeof import("./quotation/quotation-item").QuotationItem | typeof import("./quotation/quotation").Quotation | typeof import("./quotation/quotation-event").QuotationEvent | typeof import("./opportunity/opportunity-event").OpportunityEvent | typeof import("./sales-product/sales-product").SalesProduct)[];
|
|
18
18
|
export declare const subscribers: any[];
|
|
19
19
|
export declare const schema: {
|
|
20
|
-
resolverClasses: (typeof import("./opportunity/opportunity-
|
|
20
|
+
resolverClasses: (typeof import("./opportunity/opportunity-event-query").OpportunityEventQuery | typeof import("./opportunity/opportunity-mutation").OpportunityMutation | typeof import("./opportunity/opportunity-query").OpportunityQuery | typeof import("./quotation/quotation-event-query").QuotationEventQuery | typeof import("./quotation/quotation-item-query").QuotationItemQuery | typeof import("./quotation/quotation-mutation").QuotationMutation | typeof import("./quotation/quotation-query").QuotationQuery | typeof import("./sales-product/sales-product-mutation").SalesProductMutation | typeof import("./sales-product/sales-product-query").SalesProductQuery)[];
|
|
21
21
|
};
|
|
@@ -4,5 +4,5 @@ import { OpportunityEventQuery } from './opportunity-event-query';
|
|
|
4
4
|
import { OpportunityMutation } from './opportunity-mutation';
|
|
5
5
|
import { OpportunityQuery } from './opportunity-query';
|
|
6
6
|
export declare const entities: (typeof Opportunity | typeof OpportunityEvent)[];
|
|
7
|
-
export declare const resolvers: (typeof
|
|
7
|
+
export declare const resolvers: (typeof OpportunityEventQuery | typeof OpportunityMutation | typeof OpportunityQuery)[];
|
|
8
8
|
export declare const subscribers: any[];
|
package/package.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/sales",
|
|
3
|
-
"version": "10.1.
|
|
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.
|
|
44
|
-
"@things-factory/auth-base": "^10.1.
|
|
45
|
-
"@things-factory/biz-base": "^10.1.
|
|
46
|
-
"@things-factory/invoice": "^10.1.
|
|
47
|
-
"@things-factory/shell": "^10.1.
|
|
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": "
|
|
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;AAExE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,uBAAuB,EAAE,CAAA;AAC3B,CAAC","sourcesContent":["import { registerOpportunityKind } from './entity360/opportunity-360.js'\n\nexport default function bootstrap() {\n registerOpportunityKind()\n}\n"]}
|
|
@@ -1 +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,CAAA;AACxI,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE3D,iIAAiI;AACjI,MAAM,UAAU,uBAAuB;IACrC,qBAAqB,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,CAAC,aAAa,CAAC;QAC1B,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE;QAC/E,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC/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,CAAC,CAAC,IAAI,CAAA;kBACI,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;kBACpC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,WAAW;kBACpD,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;kBAC3C,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC;kBACvB,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC;kBAC3C,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;kBACtB,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;kBACrC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC;kBACjD,OAAO,CAAC,CAAC,CAAC,wCAAwC,CAAC;kBACnD,GAAG,CAAC,kBAAkB;kBACtB,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;kBACpC,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,GAAG;cAC1B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,YAAY,GAAG,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,EAAE;cACtG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,YAAY,GAAG,CAAC,UAAU,OAAO,CAAC,CAAC,CAAC,EAAE;gBAC1G;YACR,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AAzC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;2DAA2B;AAtB/C,0BAA0B;IADtC,aAAa,CAAC,8BAA8B,CAAC;GACjC,0BAA0B,CAgEtC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Answer, entity360Name, registerEntity360Kind, registerEntity360Section, type Entity360Subject } from '@operato/layout'\nimport { documentAmount } from '@things-factory/invoice/dist-client'\n\nimport { opportunityStageWord } from '../opportunity-words'\n\n/** An opportunity's 360 (ADR-0067). The module draws the opportunity; an application hangs its own sections on 'opportunity'. */\nexport function registerOpportunityKind() {\n registerEntity360Kind({\n kind: 'opportunity',\n typenames: ['Opportunity'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.opportunity')} · ${value.name || ''}`,\n context: ({ value }) => [value.counterparty?.name, value.stage ? opportunityStageWord(value.stage) : '', value.expectedCloseMonth].filter(Boolean).join(' · ')\n })\n registerEntity360Section('opportunity', {\n name: 'overview',\n order: 10,\n render: subject => html`<opportunity-overview-section .subject=${subject}></opportunity-overview-section>`\n })\n}\n\n@customElement('opportunity-overview-section')\nexport class OpportunityOverviewSection extends LitElement {\n static styles = css`\n :host {\n font-size: var(--ui-t-body);\n line-height: 1.5;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small) var(--spacing-large);\n }\n dt {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n private opportunity = new QueryController(\n this,\n gql`\n query ($id: String!) {\n opportunity(id: $id) {\n id name stage probability amount currency expectedCloseMonth closedOn lostReason description\n counterparty { id name } endCustomer { id name } owner { id name }\n }\n }\n `,\n { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) }\n )\n\n get answer() {\n return entity360Answer(this.opportunity, data => data?.opportunity)\n }\n\n render() {\n const one = this.answer?.data\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '—')\n return html`<ox-entity360-section .heading=${i18next.t('title.opportunity')} .state=${this.answer?.state ?? 'loading'} .message=${this.answer?.message ?? ''}>\n ${one\n ? html`<dl>\n <dt>${i18next.t('field.opportunity-stage')}</dt>\n <dd>${opportunityStageWord(one.stage)} · ${one.probability}%</dd>\n <dt>${i18next.t('field.opportunity-counterparty')}</dt>\n <dd>${party(one.counterparty)}</dd>\n <dt>${i18next.t('field.opportunity-end-customer')}</dt>\n <dd>${party(one.endCustomer)}</dd>\n <dt>${i18next.t('field.opportunity-amount')}</dt>\n <dd>${documentAmount(one.amount, one.currency || 'KRW')}</dd>\n <dt>${i18next.t('field.opportunity-expected-close-month')}</dt>\n <dd>${one.expectedCloseMonth}</dd>\n <dt>${i18next.t('field.opportunity-owner')}</dt>\n <dd>${one.owner?.name ?? '—'}</dd>\n ${one.closedOn ? html`<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}\n ${one.lostReason ? html`<dt>${i18next.t('field.opportunity-lost-reason')}</dt><dd>${one.lostReason}</dd>` : ''}\n </dl>`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
|
package/dist-client/index.js.map
DELETED
|
@@ -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":"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W,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"]}
|