@things-factory/sales 10.1.308 → 10.1.311
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/entity360/opportunity-360.js +4 -3
- package/dist-client/list-filters.d.ts +3 -2
- package/dist-client/list-filters.js +4 -3
- package/dist-client/opportunity-words.d.ts +2 -0
- package/dist-client/opportunity-words.js +11 -1
- package/dist-client/pages/opportunity-editor.d.ts +12 -5
- package/dist-client/pages/opportunity-editor.js +60 -23
- package/dist-client/pages/opportunity-list.js +2 -2
- package/dist-client/route.d.ts +1 -1
- package/dist-server/service/index.d.ts +2 -2
- package/dist-server/service/opportunity/index.d.ts +1 -1
- package/dist-server/service/opportunity/opportunity-event.js +2 -2
- package/dist-server/service/opportunity/opportunity-mutation.d.ts +3 -0
- package/dist-server/service/opportunity/opportunity-mutation.js +47 -1
- package/dist-server/service/opportunity/opportunity-query.js +1 -1
- package/dist-server/service/opportunity/opportunity-rules.d.ts +14 -7
- package/dist-server/service/opportunity/opportunity-rules.js +25 -11
- package/dist-server/service/opportunity/opportunity-service.d.ts +22 -5
- package/dist-server/service/opportunity/opportunity-service.js +60 -14
- package/dist-server/service/opportunity/opportunity-type.d.ts +1 -1
- package/dist-server/service/opportunity/opportunity-type.js +3 -3
- package/dist-server/service/opportunity/opportunity.d.ts +3 -2
- package/dist-server/service/opportunity/opportunity.js +10 -5
- package/dist-server/service/quotation/index.d.ts +2 -2
- package/dist-server/service/sales-read.js +3 -2
- package/package.json +2 -2
- package/translations/en.json +20 -5
- package/translations/es.json +20 -5
- package/translations/ja.json +20 -5
- package/translations/ko.json +20 -5
- package/translations/ms.json +20 -5
- package/translations/zh.json +20 -5
|
@@ -6,7 +6,7 @@ import { QueryController } from '@operato/graphql';
|
|
|
6
6
|
import { i18next } from '@operato/i18n';
|
|
7
7
|
import { entity360Answer, entity360Name, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
|
|
8
8
|
import { documentAmount } from '@things-factory/invoice/dist-client';
|
|
9
|
-
import { opportunityStageWord } from '../opportunity-words';
|
|
9
|
+
import { opportunityReasonLabel, opportunityStageWord } from '../opportunity-words';
|
|
10
10
|
/** An opportunity's 360 (ADR-0067). The module draws the opportunity; an application hangs its own sections on 'opportunity'. */
|
|
11
11
|
export function registerOpportunityKind() {
|
|
12
12
|
registerEntity360Kind({
|
|
@@ -28,7 +28,7 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
|
|
|
28
28
|
this.opportunity = new QueryController(this, gql `
|
|
29
29
|
query ($id: String!) {
|
|
30
30
|
opportunity(id: $id) {
|
|
31
|
-
id name stage probability amount currency expectedCloseMonth closedOn
|
|
31
|
+
id name stage probability amount currency expectedCloseMonth closedOn stageReason heldUntil description
|
|
32
32
|
counterparty { id name } endCustomer { id name } owner { id name }
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -80,7 +80,8 @@ let OpportunityOverviewSection = class OpportunityOverviewSection extends LitEle
|
|
|
80
80
|
<dt>${i18next.t('field.opportunity-owner')}</dt>
|
|
81
81
|
<dd>${one.owner?.name ?? '—'}</dd>
|
|
82
82
|
${one.closedOn ? html `<dt>${i18next.t('field.opportunity-closed-on')}</dt><dd>${one.closedOn}</dd>` : ''}
|
|
83
|
-
${one.
|
|
83
|
+
${one.heldUntil ? html `<dt>${i18next.t('field.opportunity-held-until')}</dt><dd>${one.heldUntil}</dd>` : ''}
|
|
84
|
+
${one.stageReason ? html `<dt>${opportunityReasonLabel(one.stage)}</dt><dd>${one.stageReason}</dd>` : ''}
|
|
84
85
|
${one.description ? html `<dt>${i18next.t('field.opportunity-description')}</dt><dd class="text">${one.description}</dd>` : ''}
|
|
85
86
|
</dl>`
|
|
86
87
|
: ''}
|
|
@@ -5,8 +5,9 @@ export type GridFilter = {
|
|
|
5
5
|
};
|
|
6
6
|
/** 상품: the 사용 chip (`active` / `inactive`) as the boolean condition the server reads. */
|
|
7
7
|
export declare function salesProductFilters(filters: readonly GridFilter[]): GridFilter[];
|
|
8
|
-
/** The opportunity stages a person still moves an opportunity through - the list opens on them,
|
|
9
|
-
|
|
8
|
+
/** The opportunity stages a person still moves an opportunity through, and on hold - the list opens on them, so a held
|
|
9
|
+
* one stays in sight; won, lost and cancelled are left out (ADR-0233 decision 8). */
|
|
10
|
+
export declare const LISTED_STAGES: string[];
|
|
10
11
|
export declare const STAGES: string[];
|
|
11
12
|
/**
|
|
12
13
|
* 영업 기회: the person in charge (the `owner` column, a user id) as `ownerId`, and the expected-close period (the
|
|
@@ -14,9 +14,10 @@ export function salesProductFilters(filters) {
|
|
|
14
14
|
? { name: 'active', operator: one.value === 'active' ? 'is_true' : 'is_not_true', value: null }
|
|
15
15
|
: one);
|
|
16
16
|
}
|
|
17
|
-
/** The opportunity stages a person still moves an opportunity through - the list opens on them,
|
|
18
|
-
|
|
19
|
-
export const
|
|
17
|
+
/** The opportunity stages a person still moves an opportunity through, and on hold - the list opens on them, so a held
|
|
18
|
+
* one stays in sight; won, lost and cancelled are left out (ADR-0233 decision 8). */
|
|
19
|
+
export const LISTED_STAGES = ['LEAD', 'PROPOSAL', 'QUOTED', 'NEGOTIATION', 'ON_HOLD'];
|
|
20
|
+
export const STAGES = [...LISTED_STAGES, 'WON', 'LOST', 'CANCELLED'];
|
|
20
21
|
/**
|
|
21
22
|
* 영업 기회: the person in charge (the `owner` column, a user id) as `ownerId`, and the expected-close period (the
|
|
22
23
|
* `expectedCloseMonth` column, `this-month` … `this-year`) as the months it covers on `today` (`YYYY-MM-DD`). The stages
|
|
@@ -9,5 +9,15 @@ export const opportunityStageWord = (stage) => stage === 'PROPOSAL'
|
|
|
9
9
|
? i18next.t('text.opportunity-stage-won')
|
|
10
10
|
: stage === 'LOST'
|
|
11
11
|
? i18next.t('text.opportunity-stage-lost')
|
|
12
|
-
:
|
|
12
|
+
: stage === 'CANCELLED'
|
|
13
|
+
? i18next.t('text.opportunity-stage-cancelled')
|
|
14
|
+
: stage === 'ON_HOLD'
|
|
15
|
+
? i18next.t('text.opportunity-stage-on-hold')
|
|
16
|
+
: i18next.t('text.opportunity-stage-lead');
|
|
17
|
+
/** What the reason an opportunity carries is called at its stage - lost, cancelled or on hold (ADR-0233). */
|
|
18
|
+
export const opportunityReasonLabel = (stage) => stage === 'CANCELLED'
|
|
19
|
+
? i18next.t('field.opportunity-cancel-reason')
|
|
20
|
+
: stage === 'ON_HOLD'
|
|
21
|
+
? i18next.t('field.opportunity-hold-reason')
|
|
22
|
+
: i18next.t('field.opportunity-lost-reason');
|
|
13
23
|
//# sourceMappingURL=opportunity-words.js.map
|
|
@@ -7,8 +7,8 @@ declare const OpportunityEditor_base: (new (...args: any[]) => import("lit").Lit
|
|
|
7
7
|
* 영업 기회 편집 — with whom, for how much, by when and how likely.
|
|
8
8
|
*
|
|
9
9
|
* A person moves an open opportunity through the stages; changing the stage puts that stage's probability in, and the
|
|
10
|
-
* person may change it. An open one is closed as lost
|
|
11
|
-
* stage. Winning is the application's: it closes the opportunity when the opportunity becomes its contract.
|
|
10
|
+
* person may change it. An open one is closed as lost or cancelled, or put on hold until a review day, each with the
|
|
11
|
+
* reason; a held one is resumed or closed; a lost or cancelled one is opened again by choosing an open stage. Winning is the application's: it closes the opportunity when the opportunity becomes its contract.
|
|
12
12
|
*/
|
|
13
13
|
export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
14
14
|
static styles: import("lit").CSSResult[];
|
|
@@ -19,7 +19,7 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
19
19
|
private choices;
|
|
20
20
|
private record;
|
|
21
21
|
private draft;
|
|
22
|
-
private
|
|
22
|
+
private closing;
|
|
23
23
|
private saves;
|
|
24
24
|
private change;
|
|
25
25
|
private get opportunity();
|
|
@@ -29,6 +29,7 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
29
29
|
/** The form as it shows: each field's edit, else what was read (blank while it is read). */
|
|
30
30
|
private get form();
|
|
31
31
|
private get reason();
|
|
32
|
+
private get heldUntil();
|
|
32
33
|
/** A failed read, or an opportunity the address names that is not there. */
|
|
33
34
|
private get error();
|
|
34
35
|
private get loading();
|
|
@@ -47,7 +48,11 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
47
48
|
render(): import("lit-html").TemplateResult<1>;
|
|
48
49
|
/** A counterparty of the domain, found as it is typed - or registered there when it is not one yet (ADR-0195). */
|
|
49
50
|
private renderParty;
|
|
50
|
-
|
|
51
|
+
/**
|
|
52
|
+
* 종결·보류 (ADR-0233 decision 8): lost, cancelled or on hold, each with the reason; a hold also with its review day. A
|
|
53
|
+
* held one is resumed at the stage it was held from, or closed from the hold.
|
|
54
|
+
*/
|
|
55
|
+
private renderClose;
|
|
51
56
|
/** The quotations that answer this opportunity; a new one is written from here and answers it. */
|
|
52
57
|
private renderQuotations;
|
|
53
58
|
private renderEvents;
|
|
@@ -57,6 +62,8 @@ export declare class OpportunityEditor extends OpportunityEditor_base {
|
|
|
57
62
|
private input;
|
|
58
63
|
/** A new one is opened once it is made; the edits sent are cleared once the save answered. */
|
|
59
64
|
private save;
|
|
60
|
-
private
|
|
65
|
+
private close;
|
|
66
|
+
private hold;
|
|
67
|
+
private resume;
|
|
61
68
|
}
|
|
62
69
|
export {};
|
|
@@ -11,10 +11,10 @@ import { navigate, PageView, DraftController } from '@operato/shell';
|
|
|
11
11
|
import { ButtonStyles, DocumentPageStyles, FormFieldStyles } from '@operato/styles';
|
|
12
12
|
import { currencyChoices, documentAmount, DocumentFormStyles } from '@things-factory/invoice/dist-client';
|
|
13
13
|
import { opportunitySection } from '../opportunity-attach';
|
|
14
|
-
import { opportunityStageWord } from '../opportunity-words';
|
|
14
|
+
import { opportunityReasonLabel, opportunityStageWord } from '../opportunity-words';
|
|
15
15
|
import { quotationStatusWord } from '../quotation-words';
|
|
16
16
|
const FIELDS = `
|
|
17
|
-
id name stage probability amount currency expectedCloseMonth closedOn
|
|
17
|
+
id name stage probability amount currency expectedCloseMonth closedOn stageReason heldUntil description
|
|
18
18
|
counterpartyId endCustomerId ownerId counterparty { id name } endCustomer { id name } owner { id name }
|
|
19
19
|
quotations { id number version status issueDate validUntil totalAmount currency }
|
|
20
20
|
`;
|
|
@@ -29,8 +29,8 @@ const thisMonth = () => new Date().toLocaleDateString('en-CA').slice(0, 7);
|
|
|
29
29
|
* 영업 기회 편집 — with whom, for how much, by when and how likely.
|
|
30
30
|
*
|
|
31
31
|
* A person moves an open opportunity through the stages; changing the stage puts that stage's probability in, and the
|
|
32
|
-
* person may change it. An open one is closed as lost
|
|
33
|
-
* stage. Winning is the application's: it closes the opportunity when the opportunity becomes its contract.
|
|
32
|
+
* person may change it. An open one is closed as lost or cancelled, or put on hold until a review day, each with the
|
|
33
|
+
* reason; a held one is resumed or closed; a lost or cancelled one is opened again by choosing an open stage. Winning is the application's: it closes the opportunity when the opportunity becomes its contract.
|
|
34
34
|
*/
|
|
35
35
|
let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageView) {
|
|
36
36
|
constructor() {
|
|
@@ -49,13 +49,16 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
49
49
|
this.record = new QueryController(this, READ, { variables: () => (this.opportunityId ? { id: this.opportunityId } : undefined) });
|
|
50
50
|
/* What is typed over the opportunity read - a new one starts blank, at the first stage. */
|
|
51
51
|
this.draft = new DraftController(this, { read: () => (this.opportunityId ? this.opportunity && formOf(this.opportunity) : blank(this.stages)), key: () => this.opportunityId });
|
|
52
|
-
/* The reason
|
|
53
|
-
this.
|
|
52
|
+
/* The reason an opportunity is lost, cancelled or held with, and the review day of a hold (ADR-0233). */
|
|
53
|
+
this.closing = new DraftController(this, { read: () => ({ reason: '', heldUntil: '' }), key: () => this.opportunityId });
|
|
54
54
|
/* Every change reads the opportunity again once it is done. */
|
|
55
55
|
this.saves = {
|
|
56
56
|
create: new MutationController(this, gql `mutation ($opportunity: NewOpportunity!) { opportunity: createOpportunity(opportunity: $opportunity) { id } }`),
|
|
57
57
|
update: this.change(gql `mutation ($id: String!, $opportunity: NewOpportunity!) { opportunity: updateOpportunity(id: $id, opportunity: $opportunity) { id } }`),
|
|
58
|
-
lose: this.change(gql `mutation ($id: String!, $reason: String!) { loseOpportunity(id: $id, reason: $reason) { id } }`)
|
|
58
|
+
lose: this.change(gql `mutation ($id: String!, $reason: String!) { loseOpportunity(id: $id, reason: $reason) { id } }`),
|
|
59
|
+
cancel: this.change(gql `mutation ($id: String!, $reason: String!) { cancelOpportunity(id: $id, reason: $reason) { id } }`),
|
|
60
|
+
hold: this.change(gql `mutation ($id: String!, $reason: String!, $heldUntil: String!) { holdOpportunity(id: $id, reason: $reason, heldUntil: $heldUntil) { id } }`),
|
|
61
|
+
resume: this.change(gql `mutation ($id: String!) { resumeOpportunity(id: $id) { id } }`)
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
static { this.styles = [
|
|
@@ -106,7 +109,10 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
106
109
|
return Object.fromEntries(Object.entries(blank(this.stages)).map(([name, given]) => [name, this.draft.value(name) ?? given]));
|
|
107
110
|
}
|
|
108
111
|
get reason() {
|
|
109
|
-
return this.
|
|
112
|
+
return this.closing.value('reason') ?? '';
|
|
113
|
+
}
|
|
114
|
+
get heldUntil() {
|
|
115
|
+
return this.closing.value('heldUntil') ?? '';
|
|
110
116
|
}
|
|
111
117
|
/** A failed read, or an opportunity the address names that is not there. */
|
|
112
118
|
get error() {
|
|
@@ -208,13 +214,14 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
208
214
|
: nothing}
|
|
209
215
|
</div>
|
|
210
216
|
</section>
|
|
211
|
-
${this.opportunity
|
|
212
|
-
${this.opportunity?.lostReason
|
|
217
|
+
${this.opportunity?.stageReason
|
|
213
218
|
? html `<section class="page-section">
|
|
214
|
-
<header class="page-section-header"><h3>${
|
|
215
|
-
<p>${this.opportunity.
|
|
219
|
+
<header class="page-section-header"><h3>${opportunityReasonLabel(this.opportunity.stage)}</h3></header>
|
|
220
|
+
<p>${this.opportunity.stageReason}</p>
|
|
221
|
+
${this.opportunity.heldUntil ? html `<p>${i18next.t('field.opportunity-held-until')} <strong>${this.opportunity.heldUntil}</strong></p>` : nothing}
|
|
216
222
|
</section>`
|
|
217
223
|
: nothing}
|
|
224
|
+
${this.opportunity && (this.isOpen(this.opportunity.stage) || this.opportunity.stage === 'ON_HOLD') ? this.renderClose() : nothing}
|
|
218
225
|
${this.opportunity ? this.renderQuotations() : nothing}
|
|
219
226
|
${attached && this.opportunity
|
|
220
227
|
? html `<section class="page-section" @opportunity-changed=${() => this.record.refetch()}>
|
|
@@ -233,19 +240,32 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
233
240
|
<counterparty-select .party=${this.form[which] ?? null} ?disabled=${!editable} @counterparty=${(e) => this.edit({ [which]: e.detail })}></counterparty-select>
|
|
234
241
|
</label>`;
|
|
235
242
|
}
|
|
236
|
-
|
|
243
|
+
/**
|
|
244
|
+
* 종결·보류 (ADR-0233 decision 8): lost, cancelled or on hold, each with the reason; a hold also with its review day. A
|
|
245
|
+
* held one is resumed at the stage it was held from, or closed from the hold.
|
|
246
|
+
*/
|
|
247
|
+
renderClose() {
|
|
248
|
+
const held = this.opportunity.stage === 'ON_HOLD';
|
|
249
|
+
const reasoned = !this.busy && !!this.reason.trim();
|
|
237
250
|
return html `<section class="page-section">
|
|
238
251
|
<header class="page-section-header">
|
|
239
|
-
<h3>${i18next.t('text.opportunity-section-
|
|
252
|
+
<h3>${i18next.t('text.opportunity-section-close')}</h3>
|
|
240
253
|
<div class="page-section-actions">
|
|
241
|
-
|
|
254
|
+
${held ? html `<button ?disabled=${this.busy} @click=${() => this.resume()}>${i18next.t('button.opportunity-resume')}</button>` : nothing}
|
|
255
|
+
<button ?disabled=${!reasoned || !this.heldUntil} @click=${() => this.hold()}>${i18next.t('button.opportunity-hold')}</button>
|
|
256
|
+
<button ?disabled=${!reasoned} @click=${() => this.close('cancel')}>${i18next.t('button.opportunity-cancel')}</button>
|
|
257
|
+
<button ?disabled=${!reasoned} @click=${() => this.close('lose')}>${i18next.t('button.opportunity-lose')}</button>
|
|
242
258
|
</div>
|
|
243
259
|
</header>
|
|
244
260
|
<div class="form">
|
|
245
261
|
<label class="wide"
|
|
246
|
-
>${i18next.t('field.opportunity-
|
|
247
|
-
<input .value=${this.reason} ?disabled=${this.busy} @input=${(e) => this.
|
|
262
|
+
>${i18next.t('field.opportunity-reason')}
|
|
263
|
+
<input .value=${this.reason} ?disabled=${this.busy} @input=${(e) => this.closing.set('reason', e.target.value)}
|
|
248
264
|
/></label>
|
|
265
|
+
<label
|
|
266
|
+
>${i18next.t('field.opportunity-held-until')}
|
|
267
|
+
<ox-input-date type="date" .value=${this.heldUntil} ?disabled=${this.busy} @change=${(e) => this.closing.set('heldUntil', e.target.value)}></ox-input-date>
|
|
268
|
+
</label>
|
|
249
269
|
</div>
|
|
250
270
|
</section>`;
|
|
251
271
|
}
|
|
@@ -256,7 +276,7 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
256
276
|
<header class="page-section-header">
|
|
257
277
|
<h3>${i18next.t('text.opportunity-section-quotations')}</h3>
|
|
258
278
|
<div class="page-section-actions">
|
|
259
|
-
<button ?disabled=${this.busy || this.
|
|
279
|
+
<button ?disabled=${this.busy || !this.isOpen(this.opportunity.stage)} @click=${() => navigate(`quotation-editor?opportunity=${this.opportunity.id}`)}>
|
|
260
280
|
${i18next.t('button.opportunity-new-quotation')}
|
|
261
281
|
</button>
|
|
262
282
|
</div>
|
|
@@ -343,11 +363,22 @@ let OpportunityEditor = class OpportunityEditor extends localize(i18next)(PageVi
|
|
|
343
363
|
if (saved && !id)
|
|
344
364
|
navigate(`opportunity-editor?id=${saved.opportunity.id}`);
|
|
345
365
|
}
|
|
346
|
-
async
|
|
366
|
+
async close(how) {
|
|
367
|
+
if (this.busy)
|
|
368
|
+
return;
|
|
369
|
+
const id = this.opportunityId;
|
|
370
|
+
await this.closing.submit(sent => this.saves[how].run({ id, reason: (sent.reason ?? '').trim() }));
|
|
371
|
+
}
|
|
372
|
+
async hold() {
|
|
347
373
|
if (this.busy)
|
|
348
374
|
return;
|
|
349
375
|
const id = this.opportunityId;
|
|
350
|
-
await this.
|
|
376
|
+
await this.closing.submit(sent => this.saves.hold.run({ id, reason: (sent.reason ?? '').trim(), heldUntil: sent.heldUntil ?? '' }));
|
|
377
|
+
}
|
|
378
|
+
async resume() {
|
|
379
|
+
if (this.busy)
|
|
380
|
+
return;
|
|
381
|
+
await this.saves.resume.run({ id: this.opportunityId });
|
|
351
382
|
}
|
|
352
383
|
};
|
|
353
384
|
__decorate([
|
|
@@ -370,9 +401,15 @@ const eventWord = (action) => action === 'CREATED'
|
|
|
370
401
|
? i18next.t('text.opportunity-event-won')
|
|
371
402
|
: action === 'LOST'
|
|
372
403
|
? i18next.t('text.opportunity-event-lost')
|
|
373
|
-
: action === '
|
|
374
|
-
? i18next.t('text.opportunity-event-
|
|
375
|
-
:
|
|
404
|
+
: action === 'CANCELLED'
|
|
405
|
+
? i18next.t('text.opportunity-event-cancelled')
|
|
406
|
+
: action === 'HELD'
|
|
407
|
+
? i18next.t('text.opportunity-event-held')
|
|
408
|
+
: action === 'RESUMED'
|
|
409
|
+
? i18next.t('text.opportunity-event-resumed')
|
|
410
|
+
: action === 'REOPENED'
|
|
411
|
+
? i18next.t('text.opportunity-event-reopened')
|
|
412
|
+
: i18next.t('text.opportunity-event-updated');
|
|
376
413
|
/** The form of an opportunity as read. */
|
|
377
414
|
function formOf(opportunity) {
|
|
378
415
|
return {
|
|
@@ -13,7 +13,7 @@ import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePage
|
|
|
13
13
|
import { isMobileDevice } from '@operato/utils';
|
|
14
14
|
import { SELECTION_ROW_PICKER } from '@things-factory/ai-assistant/dist-client/index.js';
|
|
15
15
|
import { documentAmount } from '@things-factory/invoice/dist-client';
|
|
16
|
-
import {
|
|
16
|
+
import { LISTED_STAGES, opportunityFilters, STAGES } from '../list-filters';
|
|
17
17
|
import { opportunityStageWord } from '../opportunity-words';
|
|
18
18
|
const today = () => new Date().toLocaleDateString('en-CA');
|
|
19
19
|
/**
|
|
@@ -123,7 +123,7 @@ let OpportunityList = class OpportunityList extends localize(i18next)(PageView)
|
|
|
123
123
|
readonly('string', 'stage', i18next.t('field.opportunity-stage'), 90, {
|
|
124
124
|
record: { renderer: (value) => opportunityStageWord(value) },
|
|
125
125
|
/* Chips with their counts; the list opens on the open stages, and none pressed is every stage. */
|
|
126
|
-
filter: { type: 'select-buttons', operator: 'in', value:
|
|
126
|
+
filter: { type: 'select-buttons', operator: 'in', value: LISTED_STAGES, options: STAGES.map(stage => ({ value: stage, display: opportunityStageWord(stage) })) }
|
|
127
127
|
}),
|
|
128
128
|
readonly('integer', 'probability', i18next.t('field.opportunity-probability'), 70, { record: { align: 'right', renderer: (value) => `${value ?? 0}%` } }),
|
|
129
129
|
readonly('float', 'amount', i18next.t('field.opportunity-amount'), 150, {
|
package/dist-client/route.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function route(page: string): "
|
|
1
|
+
export default function route(page: string): "opportunity-list" | "quotation-list" | "quotation-editor" | "opportunity-editor" | "sales-product-list" | undefined;
|
|
@@ -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("./quotation/quotation").Quotation | typeof import("./quotation/quotation-item").QuotationItem | typeof import("./quotation/quotation-event").QuotationEvent | typeof import("./opportunity/opportunity").Opportunity | 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("./
|
|
20
|
+
resolverClasses: (typeof import("./quotation/quotation-query").QuotationQuery | typeof import("./quotation/quotation-mutation").QuotationMutation | typeof import("./quotation/quotation-item-query").QuotationItemQuery | typeof import("./quotation/quotation-event-query").QuotationEventQuery | typeof import("./opportunity/opportunity-query").OpportunityQuery | typeof import("./opportunity/opportunity-mutation").OpportunityMutation | typeof import("./opportunity/opportunity-event-query").OpportunityEventQuery | typeof import("./sales-product/sales-product-query").SalesProductQuery | typeof import("./sales-product/sales-product-mutation").SalesProductMutation)[];
|
|
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 OpportunityQuery | typeof OpportunityMutation | typeof OpportunityEventQuery)[];
|
|
8
8
|
export declare const subscribers: any[];
|
|
@@ -37,7 +37,7 @@ tslib_1.__decorate([
|
|
|
37
37
|
], OpportunityEvent.prototype, "opportunityId", void 0);
|
|
38
38
|
tslib_1.__decorate([
|
|
39
39
|
(0, typeorm_1.Column)(),
|
|
40
|
-
(0, type_graphql_1.Field)({ description: 'What happened: CREATED, UPDATED, STAGED, WON, LOST, or REOPENED when the record a win became was undone' }),
|
|
40
|
+
(0, type_graphql_1.Field)({ description: 'What happened: CREATED, UPDATED, STAGED, WON, LOST, CANCELLED, HELD, RESUMED, or REOPENED when the record a win became was undone' }),
|
|
41
41
|
tslib_1.__metadata("design:type", String)
|
|
42
42
|
], OpportunityEvent.prototype, "action", void 0);
|
|
43
43
|
tslib_1.__decorate([
|
|
@@ -57,7 +57,7 @@ tslib_1.__decorate([
|
|
|
57
57
|
], OpportunityEvent.prototype, "probability", void 0);
|
|
58
58
|
tslib_1.__decorate([
|
|
59
59
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
60
|
-
(0, type_graphql_1.Field)({ nullable: true, description: 'Why, when it was lost' }),
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why, when it was lost, cancelled, held, resumed or reopened' }),
|
|
61
61
|
tslib_1.__metadata("design:type", String)
|
|
62
62
|
], OpportunityEvent.prototype, "reason", void 0);
|
|
63
63
|
tslib_1.__decorate([
|
|
@@ -4,4 +4,7 @@ export declare class OpportunityMutation {
|
|
|
4
4
|
createOpportunity(opportunity: NewOpportunity, context: ResolverContext): Promise<Opportunity>;
|
|
5
5
|
updateOpportunity(id: string, opportunity: NewOpportunity, context: ResolverContext): Promise<Opportunity>;
|
|
6
6
|
loseOpportunity(id: string, reason: string, closedOn: string, context: ResolverContext): Promise<Opportunity>;
|
|
7
|
+
cancelOpportunity(id: string, reason: string, closedOn: string, context: ResolverContext): Promise<Opportunity>;
|
|
8
|
+
holdOpportunity(id: string, reason: string, heldUntil: string, context: ResolverContext): Promise<Opportunity>;
|
|
9
|
+
resumeOpportunity(id: string, context: ResolverContext): Promise<Opportunity>;
|
|
7
10
|
}
|
|
@@ -22,6 +22,18 @@ let OpportunityMutation = class OpportunityMutation {
|
|
|
22
22
|
const { tx, domain, user } = context.state;
|
|
23
23
|
return (0, opportunity_service_1.closeOpportunity)(tx, domain, user, id, opportunity_rules_1.OpportunityStage.LOST, { reason, closedOn });
|
|
24
24
|
}
|
|
25
|
+
cancelOpportunity(id, reason, closedOn, context) {
|
|
26
|
+
const { tx, domain, user } = context.state;
|
|
27
|
+
return (0, opportunity_service_1.closeOpportunity)(tx, domain, user, id, opportunity_rules_1.OpportunityStage.CANCELLED, { reason, closedOn });
|
|
28
|
+
}
|
|
29
|
+
holdOpportunity(id, reason, heldUntil, context) {
|
|
30
|
+
const { tx, domain, user } = context.state;
|
|
31
|
+
return (0, opportunity_service_1.holdOpportunity)(tx, domain, user, id, { reason, heldUntil });
|
|
32
|
+
}
|
|
33
|
+
resumeOpportunity(id, context) {
|
|
34
|
+
const { tx, domain, user } = context.state;
|
|
35
|
+
return (0, opportunity_service_1.resumeOpportunity)(tx, domain, user, id);
|
|
36
|
+
}
|
|
25
37
|
};
|
|
26
38
|
exports.OpportunityMutation = OpportunityMutation;
|
|
27
39
|
tslib_1.__decorate([
|
|
@@ -48,7 +60,7 @@ tslib_1.__decorate([
|
|
|
48
60
|
tslib_1.__decorate([
|
|
49
61
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
50
62
|
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
|
|
51
|
-
(0, type_graphql_1.Mutation)(type => opportunity_1.Opportunity, { description: 'To close an open opportunity as lost, with the reason' }),
|
|
63
|
+
(0, type_graphql_1.Mutation)(type => opportunity_1.Opportunity, { description: 'To close an open or held opportunity as lost, with the reason' }),
|
|
52
64
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
53
65
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('reason')),
|
|
54
66
|
tslib_1.__param(2, (0, type_graphql_1.Arg)('closedOn', { nullable: true })),
|
|
@@ -57,6 +69,40 @@ tslib_1.__decorate([
|
|
|
57
69
|
tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
|
|
58
70
|
tslib_1.__metadata("design:returntype", void 0)
|
|
59
71
|
], OpportunityMutation.prototype, "loseOpportunity", null);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
74
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
|
|
75
|
+
(0, type_graphql_1.Mutation)(type => opportunity_1.Opportunity, { description: 'To close an open or held opportunity as cancelled - the customer dropped the work - with the reason' }),
|
|
76
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
77
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('reason')),
|
|
78
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('closedOn', { nullable: true })),
|
|
79
|
+
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
|
80
|
+
tslib_1.__metadata("design:type", Function),
|
|
81
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
|
|
82
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
83
|
+
], OpportunityMutation.prototype, "cancelOpportunity", null);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
86
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
|
|
87
|
+
(0, type_graphql_1.Mutation)(type => opportunity_1.Opportunity, { description: 'To put an open opportunity on hold until a review day, with the reason, or change the reason and day of a held one' }),
|
|
88
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
89
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('reason')),
|
|
90
|
+
tslib_1.__param(2, (0, type_graphql_1.Arg)('heldUntil')),
|
|
91
|
+
tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
|
|
92
|
+
tslib_1.__metadata("design:type", Function),
|
|
93
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
|
|
94
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
95
|
+
], OpportunityMutation.prototype, "holdOpportunity", null);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
98
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
|
|
99
|
+
(0, type_graphql_1.Mutation)(type => opportunity_1.Opportunity, { description: 'To resume a held opportunity at the open stage it was held from' }),
|
|
100
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
101
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
102
|
+
tslib_1.__metadata("design:type", Function),
|
|
103
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
104
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
105
|
+
], OpportunityMutation.prototype, "resumeOpportunity", null);
|
|
60
106
|
exports.OpportunityMutation = OpportunityMutation = tslib_1.__decorate([
|
|
61
107
|
(0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals),
|
|
62
108
|
(0, type_graphql_1.Resolver)(opportunity_1.Opportunity)
|
|
@@ -34,7 +34,7 @@ let OpportunityQuery = class OpportunityQuery {
|
|
|
34
34
|
return (0, shell_1.getRepository)(opportunity_event_1.OpportunityEvent).find({ where: { domain: { id: context.state.domain.id }, opportunity: { id: opportunityId } }, order: { createdAt: 'ASC' } });
|
|
35
35
|
}
|
|
36
36
|
opportunityStages() {
|
|
37
|
-
return Object.values(opportunity_rules_1.OpportunityStage).map(stage => ({ stage, probability: opportunity_rules_1.STAGE_PROBABILITY[stage], open: (0, opportunity_rules_1.isOpen)(stage) }));
|
|
37
|
+
return Object.values(opportunity_rules_1.OpportunityStage).map(stage => ({ stage, probability: opportunity_rules_1.STAGE_PROBABILITY[stage] ?? null, open: (0, opportunity_rules_1.isOpen)(stage) }));
|
|
38
38
|
}
|
|
39
39
|
opportunityOwners(context) {
|
|
40
40
|
return (0, auth_base_1.getDomainAssignees)(context.state.domain);
|
|
@@ -3,20 +3,27 @@ export declare enum OpportunityStage {
|
|
|
3
3
|
PROPOSAL = "PROPOSAL",
|
|
4
4
|
QUOTED = "QUOTED",
|
|
5
5
|
NEGOTIATION = "NEGOTIATION",
|
|
6
|
+
ON_HOLD = "ON_HOLD",
|
|
6
7
|
WON = "WON",
|
|
7
|
-
LOST = "LOST"
|
|
8
|
+
LOST = "LOST",
|
|
9
|
+
CANCELLED = "CANCELLED"
|
|
8
10
|
}
|
|
9
|
-
/** The stages a person moves an opportunity through, in order; the
|
|
11
|
+
/** The stages a person moves an opportunity through, in order; hold pauses it, the three after it close it (ADR-0233). */
|
|
10
12
|
export declare const OPEN_STAGES: OpportunityStage[];
|
|
11
|
-
export declare const
|
|
13
|
+
export declare const CLOSED_STAGES: OpportunityStage[];
|
|
14
|
+
export declare const STAGE_PROBABILITY: Record<Exclude<OpportunityStage, OpportunityStage.ON_HOLD>, number>;
|
|
12
15
|
export declare const isOpen: (stage: string) => boolean;
|
|
16
|
+
export declare const isClosed: (stage: string) => boolean;
|
|
17
|
+
/** The longest a hold runs before its review day, in days (ADR-0233 decision 2). */
|
|
18
|
+
export declare const HOLD_DAYS_MAX = 180;
|
|
13
19
|
/**
|
|
14
|
-
* Whether an opportunity may go from one stage to another. A person moves an open one to any open stage,
|
|
15
|
-
* as lost; a
|
|
16
|
-
*
|
|
20
|
+
* Whether an opportunity may go from one stage to another. A person moves an open one to any open stage, holds it, or
|
|
21
|
+
* closes it as lost or cancelled; a held one is closed as lost or cancelled, or resumed (`resumeOpportunity`, back to
|
|
22
|
+
* the stage it was held from); a lost or cancelled one may be opened again. Winning closes it for good — an application
|
|
23
|
+
* turns the win into its own record (a contract) and only it closes an opportunity as won, from an open stage.
|
|
17
24
|
*/
|
|
18
25
|
export declare function stageMove(from: string, to: string): boolean;
|
|
19
|
-
/** The probability an opportunity keeps after a stage change: the one a person gave, or the stage's own. */
|
|
26
|
+
/** The probability an opportunity keeps after a stage change: the one a person gave, or the stage's own; a hold keeps it. */
|
|
20
27
|
export declare function probabilityAfter(stage: OpportunityStage, given?: number | null): number;
|
|
21
28
|
export declare const validProbability: (value: unknown) => boolean;
|
|
22
29
|
export declare const validMonth: (value: unknown) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validMonth = exports.validProbability = exports.isOpen = exports.STAGE_PROBABILITY = exports.OPEN_STAGES = exports.OpportunityStage = void 0;
|
|
3
|
+
exports.validMonth = exports.validProbability = exports.HOLD_DAYS_MAX = exports.isClosed = exports.isOpen = exports.STAGE_PROBABILITY = exports.CLOSED_STAGES = exports.OPEN_STAGES = exports.OpportunityStage = void 0;
|
|
4
4
|
exports.stageMove = stageMove;
|
|
5
5
|
exports.probabilityAfter = probabilityAfter;
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
@@ -10,19 +10,23 @@ var OpportunityStage;
|
|
|
10
10
|
OpportunityStage["PROPOSAL"] = "PROPOSAL";
|
|
11
11
|
OpportunityStage["QUOTED"] = "QUOTED";
|
|
12
12
|
OpportunityStage["NEGOTIATION"] = "NEGOTIATION";
|
|
13
|
+
OpportunityStage["ON_HOLD"] = "ON_HOLD";
|
|
13
14
|
OpportunityStage["WON"] = "WON";
|
|
14
15
|
OpportunityStage["LOST"] = "LOST";
|
|
16
|
+
OpportunityStage["CANCELLED"] = "CANCELLED";
|
|
15
17
|
})(OpportunityStage || (exports.OpportunityStage = OpportunityStage = {}));
|
|
16
18
|
(0, type_graphql_1.registerEnumType)(OpportunityStage, {
|
|
17
19
|
name: 'OpportunityStage',
|
|
18
|
-
description: 'where a sales opportunity stands — lead, proposal, quoted, negotiation
|
|
20
|
+
description: 'where a sales opportunity stands — lead, proposal, quoted, negotiation; on hold until a review day; then won, lost or cancelled'
|
|
19
21
|
});
|
|
20
|
-
/** The stages a person moves an opportunity through, in order; the
|
|
22
|
+
/** The stages a person moves an opportunity through, in order; hold pauses it, the three after it close it (ADR-0233). */
|
|
21
23
|
exports.OPEN_STAGES = [OpportunityStage.LEAD, OpportunityStage.PROPOSAL, OpportunityStage.QUOTED, OpportunityStage.NEGOTIATION];
|
|
24
|
+
exports.CLOSED_STAGES = [OpportunityStage.WON, OpportunityStage.LOST, OpportunityStage.CANCELLED];
|
|
22
25
|
/*
|
|
23
26
|
* The probability a stage starts an opportunity at, in percent. These are judgements, not measurements: nobody has
|
|
24
27
|
* counted how often a proposal of ours is won. A person changes the probability of one opportunity whenever they know
|
|
25
28
|
* better, and the history (OpportunityEvent) will one day show each stage's real rate beside these (ADR-0138 decision 5).
|
|
29
|
+
* A held one keeps the probability it had, so hold gives none.
|
|
26
30
|
*/
|
|
27
31
|
exports.STAGE_PROBABILITY = {
|
|
28
32
|
[OpportunityStage.LEAD]: 10,
|
|
@@ -30,26 +34,36 @@ exports.STAGE_PROBABILITY = {
|
|
|
30
34
|
[OpportunityStage.QUOTED]: 50,
|
|
31
35
|
[OpportunityStage.NEGOTIATION]: 70,
|
|
32
36
|
[OpportunityStage.WON]: 100,
|
|
33
|
-
[OpportunityStage.LOST]: 0
|
|
37
|
+
[OpportunityStage.LOST]: 0,
|
|
38
|
+
[OpportunityStage.CANCELLED]: 0
|
|
34
39
|
};
|
|
35
40
|
const isOpen = (stage) => exports.OPEN_STAGES.includes(stage);
|
|
36
41
|
exports.isOpen = isOpen;
|
|
42
|
+
const isClosed = (stage) => exports.CLOSED_STAGES.includes(stage);
|
|
43
|
+
exports.isClosed = isClosed;
|
|
44
|
+
/** The longest a hold runs before its review day, in days (ADR-0233 decision 2). */
|
|
45
|
+
exports.HOLD_DAYS_MAX = 180;
|
|
37
46
|
/**
|
|
38
|
-
* Whether an opportunity may go from one stage to another. A person moves an open one to any open stage,
|
|
39
|
-
* as lost; a
|
|
40
|
-
*
|
|
47
|
+
* Whether an opportunity may go from one stage to another. A person moves an open one to any open stage, holds it, or
|
|
48
|
+
* closes it as lost or cancelled; a held one is closed as lost or cancelled, or resumed (`resumeOpportunity`, back to
|
|
49
|
+
* the stage it was held from); a lost or cancelled one may be opened again. Winning closes it for good — an application
|
|
50
|
+
* turns the win into its own record (a contract) and only it closes an opportunity as won, from an open stage.
|
|
41
51
|
*/
|
|
42
52
|
function stageMove(from, to) {
|
|
43
53
|
if (from === to || from === OpportunityStage.WON)
|
|
44
54
|
return false;
|
|
45
55
|
if ((0, exports.isOpen)(to))
|
|
46
|
-
return
|
|
47
|
-
|
|
56
|
+
return from === OpportunityStage.LOST || from === OpportunityStage.CANCELLED || (0, exports.isOpen)(from);
|
|
57
|
+
if (to === OpportunityStage.WON || to === OpportunityStage.ON_HOLD)
|
|
58
|
+
return (0, exports.isOpen)(from);
|
|
59
|
+
return (0, exports.isOpen)(from) || from === OpportunityStage.ON_HOLD;
|
|
48
60
|
}
|
|
49
|
-
/** The probability an opportunity keeps after a stage change: the one a person gave, or the stage's own. */
|
|
61
|
+
/** The probability an opportunity keeps after a stage change: the one a person gave, or the stage's own; a hold keeps it. */
|
|
50
62
|
function probabilityAfter(stage, given) {
|
|
51
|
-
if (
|
|
63
|
+
if ((0, exports.isClosed)(stage))
|
|
52
64
|
return exports.STAGE_PROBABILITY[stage];
|
|
65
|
+
if (stage === OpportunityStage.ON_HOLD)
|
|
66
|
+
return given ?? 0;
|
|
53
67
|
return given ?? exports.STAGE_PROBABILITY[stage];
|
|
54
68
|
}
|
|
55
69
|
const validProbability = (value) => Number.isInteger(value) && value >= 0 && value <= 100;
|
|
@@ -17,18 +17,35 @@ export declare function opportunityStageCounts(tx: EntityManager, domain: Domain
|
|
|
17
17
|
}[]>;
|
|
18
18
|
export declare function opportunityInDomain(tx: EntityManager, domain: Domain, id: string): Promise<Opportunity>;
|
|
19
19
|
/**
|
|
20
|
-
* Create an opportunity, or change one a person may still change. An open one takes any open stage; a lost
|
|
21
|
-
* opened again by giving it an open stage. Closing is `closeOpportunity`'s
|
|
20
|
+
* Create an opportunity, or change one a person may still change. An open one takes any open stage; a lost or cancelled
|
|
21
|
+
* one is opened again by giving it an open stage. Closing is `closeOpportunity`'s, holding `holdOpportunity`'s, and a
|
|
22
|
+
* held one is changed only once it is resumed (`resumeOpportunity`).
|
|
22
23
|
*/
|
|
23
24
|
export declare function saveOpportunity(tx: EntityManager, domain: Domain, user: any, input: NewOpportunity, id?: string): Promise<Opportunity>;
|
|
24
25
|
/**
|
|
25
|
-
* Close an
|
|
26
|
-
* record (Office's contract, ADR-0138 decision 8)
|
|
26
|
+
* Close an opportunity — lost or cancelled, with the reason, by a person, from an open stage or from hold; won by the
|
|
27
|
+
* application that turned it into its own record (Office's contract, ADR-0138 decision 8), from an open stage only.
|
|
28
|
+
* Cancelled is the customer dropping the work: nobody won it, so the win rate leaves it out (ADR-0233 decision 1). The
|
|
29
|
+
* day is the domain's today unless one is given.
|
|
27
30
|
*/
|
|
28
|
-
export declare function closeOpportunity(tx: EntityManager, domain: Domain, user: any, id: string, outcome: OpportunityStage.WON | OpportunityStage.LOST, { closedOn, reason }?: {
|
|
31
|
+
export declare function closeOpportunity(tx: EntityManager, domain: Domain, user: any, id: string, outcome: OpportunityStage.WON | OpportunityStage.LOST | OpportunityStage.CANCELLED, { closedOn, reason }?: {
|
|
29
32
|
closedOn?: string;
|
|
30
33
|
reason?: string;
|
|
31
34
|
}): Promise<Opportunity>;
|
|
35
|
+
/**
|
|
36
|
+
* Put an open opportunity on hold until a review day, with the reason — or change the reason and the day of a held one.
|
|
37
|
+
* A hold is a pause the owner means: it leaves the pipeline and 「no activity」, keeps its probability, and comes back
|
|
38
|
+
* to its owner on the review day, which is after today and at most `HOLD_DAYS_MAX` days ahead (ADR-0233 decision 2).
|
|
39
|
+
*/
|
|
40
|
+
export declare function holdOpportunity(tx: EntityManager, domain: Domain, user: any, id: string, { reason, heldUntil }: {
|
|
41
|
+
reason?: string;
|
|
42
|
+
heldUntil?: string;
|
|
43
|
+
}): Promise<Opportunity>;
|
|
44
|
+
/**
|
|
45
|
+
* A held opportunity resumed: back to the open stage it was held from (the last hold that left an open stage), with the
|
|
46
|
+
* probability it kept. The reason and the review day are cleared; the history keeps them.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resumeOpportunity(tx: EntityManager, domain: Domain, user: any, id: string): Promise<Opportunity>;
|
|
32
49
|
/**
|
|
33
50
|
* A won opportunity opened again, because the record its win became was undone - an application's contract link taken
|
|
34
51
|
* back (the user, 2026-10-30: 「계약 연결을 취소할 수 있어야지」). Only the application that closed it as won undoes it; a
|