@things-factory/sales 10.1.265 → 10.1.268
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-editor.d.ts +2 -18
- package/dist-client/pages/opportunity-editor.js +4 -70
- package/dist-client/pages/opportunity-editor.js.map +1 -1
- package/dist-client/pages/quotation-editor.d.ts +1 -1
- package/dist-client/pages/quotation-editor.js +2 -2
- package/dist-client/pages/quotation-editor.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/sales-product-pick.d.ts +1 -1
- package/dist-client/sales-product-pick.js +1 -1
- package/dist-client/sales-product-pick.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/translations/en.json +0 -2
- package/translations/es.json +0 -2
- package/translations/ja.json +0 -2
- package/translations/ko.json +0 -2
- package/translations/ms.json +0 -2
- package/translations/zh.json +0 -2
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import '@operato/list-state/ox-page-state.js';
|
|
2
|
+
import '@things-factory/biz-base/dist-client';
|
|
2
3
|
import { PageView } from '@operato/shell';
|
|
3
|
-
type Party = {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
businessNumber?: string;
|
|
7
|
-
};
|
|
8
|
-
type Picker = {
|
|
9
|
-
search: string;
|
|
10
|
-
found: Party[];
|
|
11
|
-
};
|
|
12
4
|
declare const OpportunityEditor_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
13
5
|
/**
|
|
14
6
|
* 영업 기회 편집 — with whom, for how much, by when and how likely.
|
|
@@ -21,7 +13,6 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
21
13
|
static styles: import("lit").CSSResult[];
|
|
22
14
|
/** The opportunity the address names; none for a new one. */
|
|
23
15
|
private opportunityId;
|
|
24
|
-
pickers: Record<'counterparty' | 'endCustomer', Picker>;
|
|
25
16
|
/** Whether the application's section is this person's to read - asked once, before it is shown. */
|
|
26
17
|
sectionReadable: boolean;
|
|
27
18
|
private choices;
|
|
@@ -53,22 +44,15 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
53
44
|
};
|
|
54
45
|
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
55
46
|
render(): import("lit-html").TemplateResult<1>;
|
|
56
|
-
/** A counterparty of the domain, found
|
|
47
|
+
/** A counterparty of the domain, found as it is typed - or registered there when it is not one yet (ADR-0195). */
|
|
57
48
|
private renderParty;
|
|
58
49
|
private renderLose;
|
|
59
50
|
/** The quotations that answer this opportunity; a new one is written from here and answers it. */
|
|
60
51
|
private renderQuotations;
|
|
61
52
|
private renderEvents;
|
|
62
53
|
private edit;
|
|
63
|
-
private setPicker;
|
|
64
|
-
private chooseParty;
|
|
65
54
|
/** The stage's own probability comes in with it; the person may change it afterwards. */
|
|
66
55
|
private chooseStage;
|
|
67
|
-
/**
|
|
68
|
-
* The counterparties the words find - a look-up on asking, not a read the page keeps: one match is taken at once,
|
|
69
|
-
* more are listed to choose from. A failure is told by the GraphQL link.
|
|
70
|
-
*/
|
|
71
|
-
private findParties;
|
|
72
56
|
private input;
|
|
73
57
|
/** A new one is opened once it is made; the edits sent are cleared once the save answered. */
|
|
74
58
|
private save;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/list-state/ox-page-state.js';
|
|
3
|
+
import '@things-factory/biz-base/dist-client';
|
|
3
4
|
import gql from 'graphql-tag';
|
|
4
5
|
import { css, html, nothing } from 'lit';
|
|
5
6
|
import { customElement, state } from 'lit/decorators.js';
|
|
6
|
-
import {
|
|
7
|
+
import { MutationController, QueryController } from '@operato/graphql';
|
|
7
8
|
import { i18next, localize } from '@operato/i18n';
|
|
8
9
|
import { navigate, PageView, DraftController } from '@operato/shell';
|
|
9
10
|
import { ButtonStyles, DocumentPageStyles, FormFieldStyles } from '@operato/styles';
|
|
@@ -35,7 +36,6 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
35
36
|
super(...arguments);
|
|
36
37
|
/** The opportunity the address names; none for a new one. */
|
|
37
38
|
this.opportunityId = '';
|
|
38
|
-
this.pickers = { counterparty: { search: '', found: [] }, endCustomer: { search: '', found: [] } };
|
|
39
39
|
/** Whether the application's section is this person's to read - asked once, before it is shown. */
|
|
40
40
|
this.sectionReadable = false;
|
|
41
41
|
/* The stages with their probabilities and who may own one, and the opportunity the address names (ADR-0190). */
|
|
@@ -63,14 +63,6 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
63
63
|
DocumentPageStyles,
|
|
64
64
|
DocumentFormStyles,
|
|
65
65
|
css `
|
|
66
|
-
.party {
|
|
67
|
-
display: flex;
|
|
68
|
-
gap: var(--spacing-small);
|
|
69
|
-
align-items: center;
|
|
70
|
-
}
|
|
71
|
-
.party input {
|
|
72
|
-
flex: 1;
|
|
73
|
-
}
|
|
74
66
|
table {
|
|
75
67
|
width: 100%;
|
|
76
68
|
border-collapse: collapse;
|
|
@@ -234,29 +226,11 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
234
226
|
</div>
|
|
235
227
|
</ox-page-state>`;
|
|
236
228
|
}
|
|
237
|
-
/** A counterparty of the domain, found
|
|
229
|
+
/** A counterparty of the domain, found as it is typed - or registered there when it is not one yet (ADR-0195). */
|
|
238
230
|
renderParty(which, label, editable) {
|
|
239
|
-
const picker = this.pickers[which];
|
|
240
|
-
const chosen = this.form[which];
|
|
241
231
|
return html `<label
|
|
242
232
|
>${label}
|
|
243
|
-
<
|
|
244
|
-
<input
|
|
245
|
-
.value=${picker.search}
|
|
246
|
-
placeholder=${chosen?.name ?? i18next.t('text.opportunity-counterparty-search')}
|
|
247
|
-
?disabled=${!editable}
|
|
248
|
-
@input=${(e) => this.setPicker(which, { search: e.target.value })}
|
|
249
|
-
@keydown=${(e) => e.key === 'Enter' && this.findParties(which)}
|
|
250
|
-
/>
|
|
251
|
-
<button ?disabled=${!editable} @click=${() => this.findParties(which)}>${i18next.t('button.search')}</button>
|
|
252
|
-
${which === 'endCustomer' && chosen ? html `<button ?disabled=${!editable} @click=${() => this.edit({ endCustomer: null })}>${i18next.t('button.opportunity-clear')}</button>` : nothing}
|
|
253
|
-
</span>
|
|
254
|
-
${picker.found.length
|
|
255
|
-
? html `<select ?disabled=${!editable} @change=${(e) => this.chooseParty(which, picker.found.find(one => one.id === e.target.value) ?? null)}>
|
|
256
|
-
<option value="">${chosen?.name ?? ''}</option>
|
|
257
|
-
${picker.found.map(one => html `<option value=${one.id}>${one.name}${one.businessNumber ? ` (${one.businessNumber})` : ''}</option>`)}
|
|
258
|
-
</select>`
|
|
259
|
-
: nothing}
|
|
233
|
+
<counterparty-select .party=${this.form[which] ?? null} ?disabled=${!editable} @counterparty=${(e) => this.edit({ [which]: e.detail })}></counterparty-select>
|
|
260
234
|
</label>`;
|
|
261
235
|
}
|
|
262
236
|
renderLose() {
|
|
@@ -340,47 +314,11 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
340
314
|
for (const [name, value] of Object.entries(patch))
|
|
341
315
|
this.draft.set(name, value);
|
|
342
316
|
}
|
|
343
|
-
setPicker(which, patch) {
|
|
344
|
-
this.pickers = { ...this.pickers, [which]: { ...this.pickers[which], ...patch } };
|
|
345
|
-
}
|
|
346
|
-
chooseParty(which, party) {
|
|
347
|
-
if (!party)
|
|
348
|
-
return;
|
|
349
|
-
this.edit({ [which]: party });
|
|
350
|
-
this.setPicker(which, { search: '', found: [] });
|
|
351
|
-
}
|
|
352
317
|
/** The stage's own probability comes in with it; the person may change it afterwards. */
|
|
353
318
|
chooseStage(stage) {
|
|
354
319
|
const given = this.stages.find(one => one.stage === stage);
|
|
355
320
|
this.edit({ stage, probability: given ? String(given.probability) : this.form.probability });
|
|
356
321
|
}
|
|
357
|
-
/**
|
|
358
|
-
* The counterparties the words find - a look-up on asking, not a read the page keeps: one match is taken at once,
|
|
359
|
-
* more are listed to choose from. A failure is told by the GraphQL link.
|
|
360
|
-
*/
|
|
361
|
-
async findParties(which) {
|
|
362
|
-
try {
|
|
363
|
-
const response = await client.query({
|
|
364
|
-
query: gql `
|
|
365
|
-
query ($search: String, $pagination: Pagination) {
|
|
366
|
-
counterparties: counterpartyChoices(search: $search, pagination: $pagination) {
|
|
367
|
-
items { id name businessNumber }
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
`,
|
|
371
|
-
variables: { search: this.pickers[which].search.trim() || undefined, pagination: { page: 1, limit: 30 } },
|
|
372
|
-
fetchPolicy: 'no-cache'
|
|
373
|
-
});
|
|
374
|
-
const found = response.data?.counterparties?.items ?? [];
|
|
375
|
-
if (found.length === 1)
|
|
376
|
-
this.chooseParty(which, found[0]);
|
|
377
|
-
else
|
|
378
|
-
this.setPicker(which, { found });
|
|
379
|
-
}
|
|
380
|
-
catch {
|
|
381
|
-
/* Told by the GraphQL link. */
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
322
|
input() {
|
|
385
323
|
const { name, counterparty, endCustomer, amount, currency, expectedCloseMonth, stage, probability, ownerId, description } = this.form;
|
|
386
324
|
return {
|
|
@@ -416,10 +354,6 @@ __decorate([
|
|
|
416
354
|
state(),
|
|
417
355
|
__metadata("design:type", Object)
|
|
418
356
|
], OpportunityEditor.prototype, "opportunityId", void 0);
|
|
419
|
-
__decorate([
|
|
420
|
-
state(),
|
|
421
|
-
__metadata("design:type", Object)
|
|
422
|
-
], OpportunityEditor.prototype, "pickers", void 0);
|
|
423
357
|
__decorate([
|
|
424
358
|
state(),
|
|
425
359
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunity-editor.js","sourceRoot":"","sources":["../../client/pages/opportunity-editor.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAE7C,OAAO,GAAG,MAAM,aAAa,C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jB,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/list-state/ox-page-state.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { client, 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 Picker = { search: string; found: Party[] }\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 .party {\n display: flex;\n gap: var(--spacing-small);\n align-items: center;\n }\n .party input {\n flex: 1;\n }\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 @state() pickers: Record<'counterparty' | 'endCustomer', Picker> = { counterparty: { search: '', found: [] }, endCustomer: { search: '', found: [] } }\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 <input type=\"month\" .value=${this.form.expectedCloseMonth} ?disabled=${!editable} @input=${(e: any) => set({ expectedCloseMonth: e.target.value })}\n /></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 by name or business number. */\n private renderParty(which: 'counterparty' | 'endCustomer', label: string, editable: boolean) {\n const picker = this.pickers[which]\n const chosen = this.form[which]\n return html`<label\n >${label}\n <span class=\"party\">\n <input\n .value=${picker.search}\n placeholder=${chosen?.name ?? i18next.t('text.opportunity-counterparty-search')}\n ?disabled=${!editable}\n @input=${(e: any) => this.setPicker(which, { search: e.target.value })}\n @keydown=${(e: KeyboardEvent) => e.key === 'Enter' && this.findParties(which)}\n />\n <button ?disabled=${!editable} @click=${() => this.findParties(which)}>${i18next.t('button.search')}</button>\n ${which === 'endCustomer' && chosen ? html`<button ?disabled=${!editable} @click=${() => this.edit({ endCustomer: null })}>${i18next.t('button.opportunity-clear')}</button>` : nothing}\n </span>\n ${picker.found.length\n ? html`<select ?disabled=${!editable} @change=${(e: any) => this.chooseParty(which, picker.found.find(one => one.id === e.target.value) ?? null)}>\n <option value=\"\">${chosen?.name ?? ''}</option>\n ${picker.found.map(one => html`<option value=${one.id}>${one.name}${one.businessNumber ? ` (${one.businessNumber})` : ''}</option>`)}\n </select>`\n : nothing}\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 private setPicker(which: 'counterparty' | 'endCustomer', patch: Partial<Picker>) {\n this.pickers = { ...this.pickers, [which]: { ...this.pickers[which], ...patch } }\n }\n\n private chooseParty(which: 'counterparty' | 'endCustomer', party: Party | null) {\n if (!party) return\n this.edit({ [which]: party })\n this.setPicker(which, { search: '', found: [] })\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 /**\n * The counterparties the words find - a look-up on asking, not a read the page keeps: one match is taken at once,\n * more are listed to choose from. A failure is told by the GraphQL link.\n */\n private async findParties(which: 'counterparty' | 'endCustomer') {\n try {\n const response = await client.query({\n query: gql`\n query ($search: String, $pagination: Pagination) {\n counterparties: counterpartyChoices(search: $search, pagination: $pagination) {\n items { id name businessNumber }\n }\n }\n `,\n variables: { search: this.pickers[which].search.trim() || undefined, pagination: { page: 1, limit: 30 } },\n fetchPolicy: 'no-cache'\n })\n const found: Party[] = response.data?.counterparties?.items ?? []\n if (found.length === 1) this.chooseParty(which, found[0])\n else this.setPicker(which, { found })\n } catch {\n /* Told by the GraphQL link. */\n }\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
|
+
{"version":3,"file":"opportunity-editor.js","sourceRoot":"","sources":["../../client/pages/opportunity-editor.ts"],"names":[],"mappings":";AAAA,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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,QAAQ,EAAE,WAAW,CAAC,QAAQ;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/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 <input type=\"month\" .value=${this.form.expectedCloseMonth} ?disabled=${!editable} @input=${(e: any) => set({ expectedCloseMonth: e.target.value })}\n /></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"]}
|
|
@@ -5,7 +5,7 @@ import '@operato/popup/ox-popup-list.js';
|
|
|
5
5
|
import type { PropertyValues } from 'lit';
|
|
6
6
|
import { PageView } from '@operato/shell';
|
|
7
7
|
import { type DocumentDefaults, type DocumentValue } from '@things-factory/invoice/dist-client';
|
|
8
|
-
import '@things-factory/
|
|
8
|
+
import '@things-factory/biz-base/dist-client';
|
|
9
9
|
import '../sales-product-pick';
|
|
10
10
|
/** The next quotation number of a year after those given - 「Q2026-001」, 「Q2026-002」 … */
|
|
11
11
|
export declare function nextQuotationNumber(numbers: string[], year: number): string;
|
|
@@ -14,7 +14,7 @@ import { navigate, PageView, DraftController } from '@operato/shell';
|
|
|
14
14
|
import { ButtonStyles, CommonGristStyles, DocumentPageStyles, FormFieldStyles, ScrollbarStyles } from '@operato/styles';
|
|
15
15
|
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
16
16
|
import { daysAfter, documentAmount, DocumentFormStyles, documentLinesConfig, linesOf, onLineChange, openDocumentPreview, reckonLines, renderDocumentHead, renderDocumentTotals, DOCUMENT_DEFAULTS, DOCUMENT_DEFAULTS_READER, headFromDefaults, nextInvoiceNumber, OUR_SIDE_FIELDS, oursFromLast, partyOfName } from '@things-factory/invoice/dist-client';
|
|
17
|
-
import '@things-factory/
|
|
17
|
+
import '@things-factory/biz-base/dist-client';
|
|
18
18
|
import { quotationSection } from '../quotation-attach';
|
|
19
19
|
import '../sales-product-pick';
|
|
20
20
|
import { lineOfProduct } from '../sales-product-pick';
|
|
@@ -291,7 +291,7 @@ let QuotationEditor = class QuotationEditor extends localize(i18next)(PageView)
|
|
|
291
291
|
/* In the group it fills - the buyer's of a sale, the supplier's of a purchase. */
|
|
292
292
|
party: html `<label
|
|
293
293
|
>${i18next.t('field.counterparty')}
|
|
294
|
-
<
|
|
294
|
+
<counterparty-select .party=${this.form.party ?? null} ?disabled=${!editable} @counterparty=${(e) => this.takeParty(e.detail)}></counterparty-select>
|
|
295
295
|
</label>`
|
|
296
296
|
})}
|
|
297
297
|
</section>
|