@getsoren/shared-module 2.58.0 → 2.60.0
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/events/catalog/clientEvents.d.ts +3 -1
- package/dist/events/hooks/useEventDeclaration/useEventDeclaration.d.ts +5 -1
- package/dist/events/index.d.ts +2 -0
- package/dist/events/locales/fr.d.ts +3 -3
- package/dist/events/types.d.ts +4 -0
- package/dist/events/utils/amounts/amounts.d.ts +6 -0
- package/dist/events/utils/credits/credits.d.ts +41 -0
- package/dist/events/utils/credits/credits.test.d.ts +1 -0
- package/dist/events/utils/lineFunnel/lineFunnel.d.ts +16 -0
- package/dist/events/utils/lineFunnel/lineFunnel.test.d.ts +1 -0
- package/dist/events/utils/readEvent/readEvent.d.ts +10 -1
- package/dist/events.js +142 -123
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export declare const CLIENT_EVENTS: {
|
|
|
8
8
|
amountGate: "known";
|
|
9
9
|
dates: "single";
|
|
10
10
|
dayHint: "breakage";
|
|
11
|
+
defaultsToToday: true;
|
|
11
12
|
hasIntervention: true;
|
|
12
13
|
id: string;
|
|
13
14
|
price: "amount";
|
|
@@ -17,9 +18,10 @@ export declare const CLIENT_EVENTS: {
|
|
|
17
18
|
reason: string;
|
|
18
19
|
};
|
|
19
20
|
breakdown: {
|
|
20
|
-
amountGate: "known";
|
|
21
21
|
dates: "range";
|
|
22
|
+
defaultsToToday: true;
|
|
22
23
|
hasIntervention: true;
|
|
24
|
+
hasOptionalAmount: true;
|
|
23
25
|
id: string;
|
|
24
26
|
price: "credit";
|
|
25
27
|
questions: {
|
|
@@ -10,9 +10,13 @@ export interface UseEventDeclarationParams {
|
|
|
10
10
|
lastReBillRatio?: string;
|
|
11
11
|
/** An edit asks every question again, the reason included. */
|
|
12
12
|
isEditing?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Today (YYYY-MM-DD) when the order's calendar offers it: an event declared the day it happens starts on it.
|
|
15
|
+
*/
|
|
16
|
+
today?: string;
|
|
13
17
|
}
|
|
14
18
|
/** The declaration of an event, step by step, whatever renders it. */
|
|
15
|
-
declare const useEventDeclaration: ({ funnel, countBillableDays, dailyPrice, lastReBillRatio, isEditing, }: UseEventDeclarationParams) => {
|
|
19
|
+
declare const useEventDeclaration: ({ funnel, countBillableDays, dailyPrice, lastReBillRatio, isEditing, today, }: UseEventDeclarationParams) => {
|
|
16
20
|
amounts: import('../../utils/amounts/amounts').EventAmounts;
|
|
17
21
|
answers: EventAnswers;
|
|
18
22
|
asksAmount: boolean;
|
package/dist/events/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { EVENT_LOCALES } from './locales/locales';
|
|
|
12
12
|
export * from './tenants';
|
|
13
13
|
export type * from './types';
|
|
14
14
|
export * from './utils/amounts/amounts';
|
|
15
|
+
export * from './utils/credits/credits';
|
|
16
|
+
export * from './utils/lineFunnel/lineFunnel';
|
|
15
17
|
export * from './utils/payload/payload';
|
|
16
18
|
export { default as buildEventPayload } from './utils/payload/payload';
|
|
17
19
|
export * from './utils/readEvent/readEvent';
|
|
@@ -61,7 +61,7 @@ declare const EVENTS_FR: {
|
|
|
61
61
|
readonly quantity: "Nombre d'heures effectuées";
|
|
62
62
|
readonly serial_number: "Numéro de série";
|
|
63
63
|
readonly site_escort: "Accompagnateur chantier";
|
|
64
|
-
readonly supplier_reference: "Référence interne du
|
|
64
|
+
readonly supplier_reference: "Référence interne du fournisseur";
|
|
65
65
|
};
|
|
66
66
|
readonly groupQuestions: {
|
|
67
67
|
readonly controls: "Quel contrôle ?";
|
|
@@ -105,7 +105,7 @@ declare const EVENTS_FR: {
|
|
|
105
105
|
readonly newEnd: "Jusqu'à quand prolonger ?";
|
|
106
106
|
readonly period: "Sur quels jours ?";
|
|
107
107
|
readonly photos: "Quelles photos joindre ?";
|
|
108
|
-
readonly priceKnown: "Avez-vous déjà le montant du
|
|
108
|
+
readonly priceKnown: "Avez-vous déjà le montant du fournisseur ?";
|
|
109
109
|
readonly robberyDay: "Quand avez-vous constaté le vol ?";
|
|
110
110
|
readonly robberyKind: "Qu'est-ce qui a été volé ?";
|
|
111
111
|
readonly stoppageKind: "Pourquoi la machine est-elle arrêtée ?";
|
|
@@ -151,7 +151,7 @@ declare const EVENTS_FR: {
|
|
|
151
151
|
readonly description: "Commentaire";
|
|
152
152
|
readonly document_type: "Type de document";
|
|
153
153
|
readonly final_toDate: "Dernier jour d'utilisation";
|
|
154
|
-
readonly intervention: "Le
|
|
154
|
+
readonly intervention: "Le fournisseur doit intervenir sur place";
|
|
155
155
|
readonly inventory_type: "Type d'état des lieux";
|
|
156
156
|
readonly new_toDate: "Nouvelle date de fin";
|
|
157
157
|
readonly re_bill_ratio: "Refacturation";
|
package/dist/events/types.d.ts
CHANGED
|
@@ -50,6 +50,10 @@ export interface EventDefinition {
|
|
|
50
50
|
amountGate?: EventAmountGate;
|
|
51
51
|
/** The amount asked can be left empty: the event is then declared without one. */
|
|
52
52
|
hasOptionalAmount?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Most often declared the day it happens: its dates start on today, when the app proposes it.
|
|
55
|
+
*/
|
|
56
|
+
defaultsToToday?: boolean;
|
|
53
57
|
/** Bills hours over the period instead of days. */
|
|
54
58
|
billingType?: "DELTA";
|
|
55
59
|
/** Photos are the point of the event (`focus`), asked first (`first`) or not asked (`none`); optional otherwise. */
|
|
@@ -19,3 +19,9 @@ export declare const getUnitPrice: (event: EventDefinition, answers: Pick<EventA
|
|
|
19
19
|
* A period of one day counts one whatever the calendar, as the backend bills it, and so does an event without a period.
|
|
20
20
|
*/
|
|
21
21
|
export declare const getEventAmounts: (event: EventDefinition | undefined, answers: EventAnswers, billableDays: number) => EventAmounts;
|
|
22
|
+
/**
|
|
23
|
+
* Whether an event still waits for its amount: it has a price and none goes with it, though its days are billed and
|
|
24
|
+
* nobody answered that there was nothing to bill. `isSent` is false for a user who sees no price, whose amount on
|
|
25
|
+
* hand (a credit starts from the daily price) is not sent.
|
|
26
|
+
*/
|
|
27
|
+
export declare const isAmountToComplete: (event: EventDefinition, { hasNothingToBill, unitPrice }: Pick<EventAmounts, "hasNothingToBill" | "unitPrice">, isSent?: boolean) => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EventDates } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A line of an order's timeline, as each app's generated client types it: only what the credit rule reads.
|
|
4
|
+
*/
|
|
5
|
+
export interface TimelineLine {
|
|
6
|
+
id?: string | null;
|
|
7
|
+
lineType?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The first and last days the event bills.
|
|
10
|
+
*/
|
|
11
|
+
dates?: readonly string[] | null;
|
|
12
|
+
/**
|
|
13
|
+
* Typed loosely by some clients: read defensively.
|
|
14
|
+
*/
|
|
15
|
+
workflowValues?: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An event line of the timeline.
|
|
19
|
+
*/
|
|
20
|
+
export type TimelineEventLine<Line extends TimelineLine> = Extract<Line, {
|
|
21
|
+
lineType: "booking_events";
|
|
22
|
+
}>;
|
|
23
|
+
export interface CreditedPeriod<Line> extends EventDates {
|
|
24
|
+
/**
|
|
25
|
+
* The credit that takes these days off the invoice.
|
|
26
|
+
*/
|
|
27
|
+
line: Line;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The days the order's credits already take off the invoice, whatever their status: a credit still open is billed at
|
|
31
|
+
* its closing. The event being edited is left out, since its own days are the ones it changes.
|
|
32
|
+
*/
|
|
33
|
+
export declare const getCreditedPeriods: <Line extends TimelineLine>(lines?: readonly Line[], editedEventId?: string | null) => CreditedPeriod<TimelineEventLine<Line>>[];
|
|
34
|
+
/**
|
|
35
|
+
* The credit that already takes this day (YYYY-MM-DD) off the invoice.
|
|
36
|
+
*/
|
|
37
|
+
export declare const findCreditOfDay: <Period extends EventDates>(day: string, periods: readonly Period[]) => Period | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The first credit that already takes off one of these days: a day is never credited twice.
|
|
40
|
+
*/
|
|
41
|
+
export declare const findCreditOverlap: <Period extends EventDates>({ fromDate, toDate }: EventDates, periods: readonly Period[]) => Period | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventDefinition, EventFunnel } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* An order line, as each app's generated client types it: only the unit it is priced in.
|
|
4
|
+
*/
|
|
5
|
+
export interface BilledLine {
|
|
6
|
+
qtyUnit?: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether the order line can bill the event: hours replace the hours of a line priced by the hour, and on any other
|
|
10
|
+
* line they would be billed as that many more days.
|
|
11
|
+
*/
|
|
12
|
+
export declare const billsOnLine: (event: EventDefinition, line?: BilledLine | null) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The funnel without the events the order line cannot bill.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getLineFunnel: (funnel: EventFunnel, line?: BilledLine | null) => EventFunnel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeclaredEvent, EventFunnel } from '../../types';
|
|
1
|
+
import { DeclaredEvent, EventAnswers, EventDefinition, EventFunnel } from '../../types';
|
|
2
2
|
/** A stored value, as each app's generated client types it. */
|
|
3
3
|
export interface StoredWorkflowValue {
|
|
4
4
|
name?: string | null;
|
|
@@ -16,4 +16,13 @@ interface StoredEvent {
|
|
|
16
16
|
* team's, a client's read by a supplier, a proof read by the other side). Undefined for a Treege event.
|
|
17
17
|
*/
|
|
18
18
|
declare const readEvent: ({ workflow, workflowValues }: StoredEvent, readerFunnel: EventFunnel) => DeclaredEvent | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Whether an event declared natively is named as its declaration names it rather than by its stored reason: a typed
|
|
21
|
+
* title, or an event with no reason to pick ("Casse", where the stored reason reads "Casses importantes"). An event
|
|
22
|
+
* whose reason was picked keeps the name the timeline has always given it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isNamedByDeclaration: ({ answers, event }: {
|
|
25
|
+
answers: Pick<EventAnswers, "title">;
|
|
26
|
+
event: EventDefinition;
|
|
27
|
+
}) => boolean;
|
|
19
28
|
export default readEvent;
|
package/dist/events.js
CHANGED
|
@@ -13,6 +13,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
13
13
|
amountGate: "known",
|
|
14
14
|
dates: "single",
|
|
15
15
|
dayHint: "breakage",
|
|
16
|
+
defaultsToToday: !0,
|
|
16
17
|
hasIntervention: !0,
|
|
17
18
|
id: "breakage",
|
|
18
19
|
price: "amount",
|
|
@@ -20,9 +21,10 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
20
21
|
reason: "break_repair"
|
|
21
22
|
},
|
|
22
23
|
breakdown: {
|
|
23
|
-
amountGate: "known",
|
|
24
24
|
dates: "range",
|
|
25
|
+
defaultsToToday: !0,
|
|
25
26
|
hasIntervention: !0,
|
|
27
|
+
hasOptionalAmount: !0,
|
|
26
28
|
id: "breakdown",
|
|
27
29
|
price: "credit",
|
|
28
30
|
questions: {
|
|
@@ -442,23 +444,23 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
442
444
|
total: a === null ? null : a * o,
|
|
443
445
|
unitPrice: a
|
|
444
446
|
};
|
|
445
|
-
}, h = ({ groups: e, events: t }) => e.flatMap((e) => {
|
|
447
|
+
}, h = (e, { hasNothingToBill: t, unitPrice: n }, r = !0) => !!e.price && !(r && n !== null) && !t && e.amountGate !== "billed", g = ({ groups: e, events: t }) => e.flatMap((e) => {
|
|
446
448
|
let n = t.filter(({ id: t }) => e.events.includes(t));
|
|
447
449
|
return n.length ? [{
|
|
448
450
|
...e,
|
|
449
451
|
events: n
|
|
450
452
|
}] : [];
|
|
451
|
-
}),
|
|
453
|
+
}), _ = (e, t) => e.endDates?.[t], v = (e, t, n, r) => [
|
|
452
454
|
"kind",
|
|
453
455
|
...(e?.events.length ?? 0) > 1 ? ["event"] : [],
|
|
454
456
|
...t?.reasons?.length ? ["reason"] : [],
|
|
455
|
-
...t?.dates || t &&
|
|
457
|
+
...t?.dates || t && _(t, n.reason) ? ["dates"] : [],
|
|
456
458
|
...t?.checks?.length ? ["checks"] : [],
|
|
457
459
|
...t?.hasTitle || t?.fields?.length ? ["fields"] : [],
|
|
458
460
|
...r && t?.price && t.amountGate ? ["amountGate"] : [],
|
|
459
461
|
...r && t?.price && (!t.amountGate || n.amountGate) ? ["amount"] : [],
|
|
460
462
|
...t ? ["details"] : []
|
|
461
|
-
],
|
|
463
|
+
], y = (e, t, n = !1) => e.find((e) => e !== "kind" && e !== "event" && (n || e !== "reason" || !t.reason)) ?? "details", b = (e, t, n) => {
|
|
462
464
|
switch (e) {
|
|
463
465
|
case "reason": return !!n.reason;
|
|
464
466
|
case "dates": return !!(n.dates.fromDate && n.dates.toDate);
|
|
@@ -467,8 +469,8 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
467
469
|
case "amount": return !!t.hasOptionalAmount || p(t, n) !== null;
|
|
468
470
|
default: return !0;
|
|
469
471
|
}
|
|
470
|
-
},
|
|
471
|
-
let r =
|
|
472
|
+
}, x = (e, t) => e.hasTitle ? t.title.trim() : e.reasonDetail ? e.reason ?? "" : t.reason || (e.reason ?? ""), S = (e, t, n) => {
|
|
473
|
+
let r = x(e, t);
|
|
472
474
|
if (e.hasTitle) return {
|
|
473
475
|
label: n("values.title"),
|
|
474
476
|
name: a.reason,
|
|
@@ -487,8 +489,8 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
487
489
|
value: r
|
|
488
490
|
}
|
|
489
491
|
};
|
|
490
|
-
},
|
|
491
|
-
let o =
|
|
492
|
+
}, C = (e, { dates: { fromDate: t, toDate: n }, reason: r }, i) => {
|
|
493
|
+
let o = _(e, r);
|
|
492
494
|
return t && n ? o ? [{
|
|
493
495
|
label: i(`values.${o.name}`),
|
|
494
496
|
name: o.name,
|
|
@@ -505,18 +507,18 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
505
507
|
type: "date",
|
|
506
508
|
value: t
|
|
507
509
|
}] : [] : [];
|
|
508
|
-
},
|
|
510
|
+
}, w = (e, t) => {
|
|
509
511
|
let n = e === "number" ? f(t) : null;
|
|
510
512
|
return n === null ? t.trim() : String(n);
|
|
511
|
-
},
|
|
513
|
+
}, T = "dedicated", E = (e, t) => ({
|
|
512
514
|
eventId: t,
|
|
513
|
-
funnel:
|
|
515
|
+
funnel: T,
|
|
514
516
|
side: e,
|
|
515
517
|
source: r,
|
|
516
518
|
version: 2
|
|
517
|
-
}),
|
|
519
|
+
}), D = (e) => typeof e == "object" && !!e && "source" in e && e.source === "soren-event" && "eventId" in e && typeof e.eventId == "string", O = ({ funnel: e, event: t, answers: n, translate: i, bookingItemId: o, withPrice: s, billableDays: c, withReBillRatio: l = e.pricing.asksReBillRatio }) => {
|
|
518
520
|
let { fromDate: u, toDate: d } = n.dates, m = !!(t.dates && u && d) && c !== 0, h = s ? p(t, n) : null, g = f(n.reBillRatio), _ = n.description.trim(), v = t.billingType === "DELTA", y = f(n.fields.quantity ?? ""), b = [
|
|
519
|
-
|
|
521
|
+
S(t, n, i),
|
|
520
522
|
...t.reasonDetail && n.reason ? [{
|
|
521
523
|
label: i(`values.${t.reasonDetail}`),
|
|
522
524
|
name: t.reasonDetail,
|
|
@@ -526,7 +528,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
526
528
|
value: n.reason
|
|
527
529
|
}
|
|
528
530
|
}] : [],
|
|
529
|
-
...
|
|
531
|
+
...C(t, n, i),
|
|
530
532
|
..._ ? [{
|
|
531
533
|
label: i("values.description"),
|
|
532
534
|
name: a.description,
|
|
@@ -544,7 +546,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
544
546
|
label: i(`fields.${e}`),
|
|
545
547
|
name: e,
|
|
546
548
|
type: t,
|
|
547
|
-
value:
|
|
549
|
+
value: w(t, n.fields[e])
|
|
548
550
|
})),
|
|
549
551
|
...t.hasIntervention ? [{
|
|
550
552
|
label: i("values.intervention"),
|
|
@@ -584,7 +586,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
584
586
|
quantity: y
|
|
585
587
|
}
|
|
586
588
|
};
|
|
587
|
-
},
|
|
589
|
+
}, k = {
|
|
588
590
|
amount: "",
|
|
589
591
|
checks: {},
|
|
590
592
|
dates: {
|
|
@@ -597,95 +599,99 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
597
599
|
reason: "",
|
|
598
600
|
reBillRatio: "",
|
|
599
601
|
title: ""
|
|
600
|
-
},
|
|
601
|
-
let [
|
|
602
|
+
}, A = ({ funnel: n, countBillableDays: r, dailyPrice: i, lastReBillRatio: a = "", isEditing: o = !1, today: s }) => {
|
|
603
|
+
let [c, l] = t(), [u, d] = t(), [f, p] = t("kind"), [h, _] = t(k), [x, S] = t(!1), C = e(() => g(n), [n]), w = C.find(({ id: e }) => e === c), T = w?.events.find(({ id: e }) => e === u), { showsPrice: E, asksReBillRatio: D } = n.pricing, A = m(T, h, T?.dates === "range" ? r(h.dates) : 1), j = E && !!T?.price, M = j && !A.hasNothingToBill, N = v(w, T, h, M), P = N[N.indexOf(f) - 1], F = (e) => _((t) => ({
|
|
602
604
|
...t,
|
|
603
605
|
...e
|
|
604
|
-
})),
|
|
605
|
-
let n =
|
|
606
|
+
})), I = (e) => e.price === "credit" && i ? String(Math.abs(i)) : "", L = (e, t) => {
|
|
607
|
+
let n = v(w, T, t, M);
|
|
606
608
|
return n[n.indexOf(e) + 1] ?? "details";
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
},
|
|
609
|
+
}, R = () => {
|
|
610
|
+
l(void 0), d(void 0), p("kind"), _(k), S(!1);
|
|
611
|
+
}, z = (e, t, n = {}) => {
|
|
610
612
|
let r = {
|
|
611
|
-
...
|
|
612
|
-
amount:
|
|
613
|
+
...k,
|
|
614
|
+
amount: I(t),
|
|
615
|
+
dates: t.defaultsToToday && s ? {
|
|
616
|
+
fromDate: s,
|
|
617
|
+
toDate: s
|
|
618
|
+
} : k.dates,
|
|
613
619
|
reason: t.reasons?.length ? "" : t.reason ?? "",
|
|
614
|
-
reBillRatio:
|
|
620
|
+
reBillRatio: D ? a : "",
|
|
615
621
|
...n
|
|
616
622
|
};
|
|
617
|
-
|
|
618
|
-
},
|
|
619
|
-
let n =
|
|
620
|
-
return n && r ? (
|
|
621
|
-
},
|
|
623
|
+
l(e.id), d(t.id), _(r), p(y(v(e, t, r, E && !!t.price), r, o));
|
|
624
|
+
}, B = ({ eventId: e, answers: t }) => {
|
|
625
|
+
let n = C.find(({ events: t }) => t.some(({ id: t }) => t === e)), r = n?.events.find(({ id: t }) => t === e);
|
|
626
|
+
return n && r ? (z(n, r, t), S(!0), !0) : !1;
|
|
627
|
+
}, V = (e, t) => {
|
|
622
628
|
if (e.events.length === 1) {
|
|
623
|
-
|
|
629
|
+
z(e, e.events[0], t);
|
|
624
630
|
return;
|
|
625
631
|
}
|
|
626
|
-
|
|
627
|
-
},
|
|
628
|
-
|
|
629
|
-
},
|
|
630
|
-
let t =
|
|
631
|
-
dates:
|
|
632
|
+
l(e.id), d(void 0), p("event");
|
|
633
|
+
}, H = (e) => {
|
|
634
|
+
w && z(w, e);
|
|
635
|
+
}, U = () => p(L(f, h)), W = (e) => {
|
|
636
|
+
let t = T?.endDates && e !== h.reason ? {
|
|
637
|
+
dates: k.dates,
|
|
632
638
|
reason: e
|
|
633
639
|
} : { reason: e }, n = {
|
|
634
|
-
...
|
|
640
|
+
...h,
|
|
635
641
|
...t
|
|
636
642
|
};
|
|
637
|
-
|
|
638
|
-
},
|
|
643
|
+
F(t), p(L("reason", n));
|
|
644
|
+
}, G = (e) => {
|
|
639
645
|
let t = {
|
|
640
|
-
amount: e &&
|
|
646
|
+
amount: e && T ? h.amount || I(T) : "",
|
|
641
647
|
amountGate: e
|
|
642
648
|
};
|
|
643
|
-
|
|
644
|
-
...
|
|
649
|
+
F(t), p(L("amountGate", {
|
|
650
|
+
...h,
|
|
645
651
|
...t
|
|
646
652
|
}));
|
|
647
|
-
},
|
|
648
|
-
if (!
|
|
649
|
-
|
|
653
|
+
}, K = () => {
|
|
654
|
+
if (!P || P === "kind") {
|
|
655
|
+
R();
|
|
650
656
|
return;
|
|
651
657
|
}
|
|
652
|
-
|
|
653
|
-
},
|
|
658
|
+
p(P);
|
|
659
|
+
}, q = !!T && N.every((e) => b(e, T, h)), J = o && !E && !A.hasNothingToBill;
|
|
654
660
|
return {
|
|
655
|
-
amounts:
|
|
656
|
-
answers:
|
|
657
|
-
asksAmount:
|
|
658
|
-
buildPayload: (e, t) =>
|
|
659
|
-
answers:
|
|
660
|
-
billableDays:
|
|
661
|
+
amounts: A,
|
|
662
|
+
answers: h,
|
|
663
|
+
asksAmount: M,
|
|
664
|
+
buildPayload: (e, t) => T && q ? O({
|
|
665
|
+
answers: h,
|
|
666
|
+
billableDays: A.billableDays,
|
|
661
667
|
bookingItemId: t,
|
|
662
|
-
event:
|
|
668
|
+
event: T,
|
|
663
669
|
funnel: n,
|
|
664
670
|
translate: e,
|
|
665
|
-
withPrice:
|
|
666
|
-
withReBillRatio:
|
|
671
|
+
withPrice: M || J,
|
|
672
|
+
withReBillRatio: D || o
|
|
667
673
|
}) : void 0,
|
|
668
|
-
canGoBack:
|
|
669
|
-
canGoNext: !!
|
|
670
|
-
event:
|
|
671
|
-
goBack:
|
|
672
|
-
goNext:
|
|
673
|
-
group:
|
|
674
|
-
groups:
|
|
675
|
-
isComplete:
|
|
676
|
-
isPriced:
|
|
677
|
-
reset:
|
|
678
|
-
selectAmountGate:
|
|
679
|
-
selectEvent:
|
|
680
|
-
selectGroup:
|
|
681
|
-
selectReason:
|
|
682
|
-
setAnswers:
|
|
683
|
-
showsReBillRatio:
|
|
684
|
-
startPrefill:
|
|
685
|
-
step:
|
|
686
|
-
steps:
|
|
674
|
+
canGoBack: f !== "kind" && !(x && (P === "kind" || P === "event")),
|
|
675
|
+
canGoNext: !!T && b(f, T, h),
|
|
676
|
+
event: T,
|
|
677
|
+
goBack: K,
|
|
678
|
+
goNext: U,
|
|
679
|
+
group: w,
|
|
680
|
+
groups: C,
|
|
681
|
+
isComplete: q,
|
|
682
|
+
isPriced: j,
|
|
683
|
+
reset: R,
|
|
684
|
+
selectAmountGate: G,
|
|
685
|
+
selectEvent: H,
|
|
686
|
+
selectGroup: V,
|
|
687
|
+
selectReason: W,
|
|
688
|
+
setAnswers: F,
|
|
689
|
+
showsReBillRatio: D && j,
|
|
690
|
+
startPrefill: B,
|
|
691
|
+
step: f,
|
|
692
|
+
steps: N
|
|
687
693
|
};
|
|
688
|
-
},
|
|
694
|
+
}, j = {
|
|
689
695
|
ar: {
|
|
690
696
|
checks: {
|
|
691
697
|
ce_conformity: "تم التحقق من شهادة أو إقرار CE",
|
|
@@ -749,7 +755,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
749
755
|
quantity: "عدد الساعات المنجزة",
|
|
750
756
|
serial_number: "الرقم التسلسلي",
|
|
751
757
|
site_escort: "مرافق الموقع",
|
|
752
|
-
supplier_reference: "المرجع الداخلي
|
|
758
|
+
supplier_reference: "المرجع الداخلي للمورد"
|
|
753
759
|
},
|
|
754
760
|
groupQuestions: {
|
|
755
761
|
controls: "أي فحص؟",
|
|
@@ -793,7 +799,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
793
799
|
newEnd: "حتى متى التمديد؟",
|
|
794
800
|
period: "أي أيام؟",
|
|
795
801
|
photos: "ما الصور التي تريد إرفاقها؟",
|
|
796
|
-
priceKnown: "هل لديك مبلغ
|
|
802
|
+
priceKnown: "هل لديك مبلغ المورد بالفعل؟",
|
|
797
803
|
robberyDay: "متى لاحظت السرقة؟",
|
|
798
804
|
robberyKind: "ما الذي سُرق؟",
|
|
799
805
|
stoppageKind: "لماذا توقفت الآلة؟",
|
|
@@ -839,7 +845,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
839
845
|
description: "تعليق",
|
|
840
846
|
document_type: "نوع المستند",
|
|
841
847
|
final_toDate: "آخر يوم استخدام",
|
|
842
|
-
intervention: "يجب أن يتدخل
|
|
848
|
+
intervention: "يجب أن يتدخل المورد في الموقع",
|
|
843
849
|
inventory_type: "نوع محضر الحالة",
|
|
844
850
|
new_toDate: "تاريخ النهاية الجديد",
|
|
845
851
|
re_bill_ratio: "إعادة الفوترة",
|
|
@@ -910,7 +916,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
910
916
|
quantity: "Geleistete Stunden",
|
|
911
917
|
serial_number: "Seriennummer",
|
|
912
918
|
site_escort: "Begleitung auf der Baustelle",
|
|
913
|
-
supplier_reference: "Interne Referenz des
|
|
919
|
+
supplier_reference: "Interne Referenz des Lieferanten"
|
|
914
920
|
},
|
|
915
921
|
groupQuestions: {
|
|
916
922
|
controls: "Welche Prüfung?",
|
|
@@ -954,7 +960,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
954
960
|
newEnd: "Bis wann verlängern?",
|
|
955
961
|
period: "An welchen Tagen?",
|
|
956
962
|
photos: "Welche Fotos anhängen?",
|
|
957
|
-
priceKnown: "Haben Sie den Betrag des
|
|
963
|
+
priceKnown: "Haben Sie den Betrag des Lieferanten schon?",
|
|
958
964
|
robberyDay: "Wann haben Sie den Diebstahl bemerkt?",
|
|
959
965
|
robberyKind: "Was wurde gestohlen?",
|
|
960
966
|
stoppageKind: "Warum steht die Maschine still?",
|
|
@@ -1000,7 +1006,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1000
1006
|
description: "Kommentar",
|
|
1001
1007
|
document_type: "Dokumententyp",
|
|
1002
1008
|
final_toDate: "Letzter Nutzungstag",
|
|
1003
|
-
intervention: "Der
|
|
1009
|
+
intervention: "Der Lieferant muss vor Ort eingreifen",
|
|
1004
1010
|
inventory_type: "Art des Zustandsprotokolls",
|
|
1005
1011
|
new_toDate: "Neues Enddatum",
|
|
1006
1012
|
re_bill_ratio: "Weiterberechnung",
|
|
@@ -1393,7 +1399,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1393
1399
|
quantity: "Nombre d'heures effectuées",
|
|
1394
1400
|
serial_number: "Numéro de série",
|
|
1395
1401
|
site_escort: "Accompagnateur chantier",
|
|
1396
|
-
supplier_reference: "Référence interne du
|
|
1402
|
+
supplier_reference: "Référence interne du fournisseur"
|
|
1397
1403
|
},
|
|
1398
1404
|
groupQuestions: {
|
|
1399
1405
|
controls: "Quel contrôle ?",
|
|
@@ -1437,7 +1443,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1437
1443
|
newEnd: "Jusqu'à quand prolonger ?",
|
|
1438
1444
|
period: "Sur quels jours ?",
|
|
1439
1445
|
photos: "Quelles photos joindre ?",
|
|
1440
|
-
priceKnown: "Avez-vous déjà le montant du
|
|
1446
|
+
priceKnown: "Avez-vous déjà le montant du fournisseur ?",
|
|
1441
1447
|
robberyDay: "Quand avez-vous constaté le vol ?",
|
|
1442
1448
|
robberyKind: "Qu'est-ce qui a été volé ?",
|
|
1443
1449
|
stoppageKind: "Pourquoi la machine est-elle arrêtée ?",
|
|
@@ -1483,7 +1489,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1483
1489
|
description: "Commentaire",
|
|
1484
1490
|
document_type: "Type de document",
|
|
1485
1491
|
final_toDate: "Dernier jour d'utilisation",
|
|
1486
|
-
intervention: "Le
|
|
1492
|
+
intervention: "Le fournisseur doit intervenir sur place",
|
|
1487
1493
|
inventory_type: "Type d'état des lieux",
|
|
1488
1494
|
new_toDate: "Nouvelle date de fin",
|
|
1489
1495
|
re_bill_ratio: "Refacturation",
|
|
@@ -1554,7 +1560,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1554
1560
|
quantity: "Ore lavorate",
|
|
1555
1561
|
serial_number: "Numero di serie",
|
|
1556
1562
|
site_escort: "Accompagnatore in cantiere",
|
|
1557
|
-
supplier_reference: "Riferimento interno del
|
|
1563
|
+
supplier_reference: "Riferimento interno del fornitore"
|
|
1558
1564
|
},
|
|
1559
1565
|
groupQuestions: {
|
|
1560
1566
|
controls: "Quale controllo?",
|
|
@@ -1598,7 +1604,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1598
1604
|
newEnd: "Fino a quando prolungare?",
|
|
1599
1605
|
period: "Quali giorni?",
|
|
1600
1606
|
photos: "Quali foto allegare?",
|
|
1601
|
-
priceKnown: "Ha già l'importo del
|
|
1607
|
+
priceKnown: "Ha già l'importo del fornitore?",
|
|
1602
1608
|
robberyDay: "Quando ha notato il furto?",
|
|
1603
1609
|
robberyKind: "Che cosa è stato rubato?",
|
|
1604
1610
|
stoppageKind: "Perché la macchina è ferma?",
|
|
@@ -1644,7 +1650,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1644
1650
|
description: "Commento",
|
|
1645
1651
|
document_type: "Tipo di documento",
|
|
1646
1652
|
final_toDate: "Ultimo giorno di utilizzo",
|
|
1647
|
-
intervention: "Il
|
|
1653
|
+
intervention: "Il fornitore deve intervenire in cantiere",
|
|
1648
1654
|
inventory_type: "Tipo di verbale di stato",
|
|
1649
1655
|
new_toDate: "Nuova data di fine",
|
|
1650
1656
|
re_bill_ratio: "Rifatturazione",
|
|
@@ -1813,7 +1819,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1813
1819
|
title: "Título do evento"
|
|
1814
1820
|
}
|
|
1815
1821
|
}
|
|
1816
|
-
},
|
|
1822
|
+
}, M = ["companion", "operative"], N = {
|
|
1817
1823
|
...s,
|
|
1818
1824
|
breakage: {
|
|
1819
1825
|
...s.breakage,
|
|
@@ -1851,7 +1857,7 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1851
1857
|
...s.robbery,
|
|
1852
1858
|
reasons: ["robbery_machine", "robbery_option"]
|
|
1853
1859
|
}
|
|
1854
|
-
},
|
|
1860
|
+
}, P = [
|
|
1855
1861
|
"n1_control",
|
|
1856
1862
|
"other_request",
|
|
1857
1863
|
"breakdown",
|
|
@@ -1869,13 +1875,13 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1869
1875
|
"hours_record",
|
|
1870
1876
|
"robbery",
|
|
1871
1877
|
"other"
|
|
1872
|
-
],
|
|
1878
|
+
], F = [
|
|
1873
1879
|
"n1_control",
|
|
1874
1880
|
"n3_control",
|
|
1875
1881
|
"machine_assignment",
|
|
1876
1882
|
"operator_change",
|
|
1877
1883
|
"hours_record"
|
|
1878
|
-
],
|
|
1884
|
+
], I = [
|
|
1879
1885
|
c.controls,
|
|
1880
1886
|
c.admin_request,
|
|
1881
1887
|
c.machine_problem,
|
|
@@ -1884,68 +1890,81 @@ var n = "eventDeclaration", r = "soren-event", i = 2, a = {
|
|
|
1884
1890
|
c.delivery,
|
|
1885
1891
|
c.documents,
|
|
1886
1892
|
c.other
|
|
1887
|
-
],
|
|
1888
|
-
events:
|
|
1889
|
-
groups:
|
|
1893
|
+
], L = {
|
|
1894
|
+
events: P.map((e) => N[e]),
|
|
1895
|
+
groups: I,
|
|
1890
1896
|
id: "bouygues",
|
|
1891
1897
|
pricing: {
|
|
1892
1898
|
asksReBillRatio: !0,
|
|
1893
1899
|
showsPrice: !0
|
|
1894
1900
|
},
|
|
1895
1901
|
side: "client"
|
|
1896
|
-
},
|
|
1897
|
-
events:
|
|
1898
|
-
groups:
|
|
1902
|
+
}, R = {
|
|
1903
|
+
events: P.filter((e) => !F.includes(e)).map((e) => N[e]),
|
|
1904
|
+
groups: I,
|
|
1899
1905
|
id: "bouyguesField",
|
|
1900
1906
|
pricing: {
|
|
1901
1907
|
asksReBillRatio: !1,
|
|
1902
1908
|
showsPrice: !1
|
|
1903
1909
|
},
|
|
1904
1910
|
side: "client"
|
|
1905
|
-
},
|
|
1906
|
-
funnels: [
|
|
1907
|
-
getFunnel: (e) =>
|
|
1911
|
+
}, z = [{
|
|
1912
|
+
funnels: [L, R],
|
|
1913
|
+
getFunnel: (e) => M.includes(e ?? "") ? R : L,
|
|
1908
1914
|
tenants: ["bouygues"]
|
|
1909
|
-
}],
|
|
1915
|
+
}], B = [
|
|
1910
1916
|
l,
|
|
1911
1917
|
u,
|
|
1912
|
-
...
|
|
1913
|
-
],
|
|
1914
|
-
let
|
|
1918
|
+
...z.flatMap(({ funnels: e }) => e)
|
|
1919
|
+
], V = ({ side: e, tenantName: t, roleName: n }) => e === "supplier" ? u : z.find(({ tenants: e }) => e.includes(t ?? ""))?.getFunnel(n) ?? l, H = (e) => B.find((t) => t.id === e), U = 10, W = (e) => e.slice(0, U), G = (e) => e.lineType === "booking_events", K = ({ workflowValues: e }) => {
|
|
1920
|
+
let t = Array.isArray(e) ? e.find((e) => typeof e == "object" && !!e && e.name === a.unitPrice)?.value : void 0;
|
|
1921
|
+
return typeof t == "string" || typeof t == "number" ? f(String(t)) : null;
|
|
1922
|
+
}, q = (e = [], t) => e.filter(G).flatMap((e) => {
|
|
1923
|
+
let [n, r] = e.dates ?? [], i = K(e);
|
|
1924
|
+
return e.id !== t && n && r && i !== null && i < 0 ? [{
|
|
1925
|
+
fromDate: W(n),
|
|
1926
|
+
line: e,
|
|
1927
|
+
toDate: W(r)
|
|
1928
|
+
}] : [];
|
|
1929
|
+
}), J = (e, t) => t.find(({ fromDate: t, toDate: n }) => W(t) <= W(e) && W(e) <= W(n)), Y = ({ fromDate: e, toDate: t }, n) => e && t ? n.find((n) => W(e) <= W(n.toDate) && W(n.fromDate) <= W(t)) : void 0, X = (e, t) => e.billingType !== "DELTA" || t?.qtyUnit === "HOURS", ee = (e, t) => ({
|
|
1930
|
+
...e,
|
|
1931
|
+
events: e.events.filter((e) => X(e, t))
|
|
1932
|
+
}), Z = 10, Q = (e) => typeof e == "object" && e && "value" in e ? Q(e.value) : typeof e == "string" || typeof e == "number" ? String(e) : "", $ = (e) => e === !0 || e === "true", te = (e, t) => {
|
|
1933
|
+
let n = (e) => t.find((t) => t.name === e)?.value, r = Q(t.find(({ tag: e }) => e === "reason")?.value), i = t.find(({ tag: e }) => e === "description")?.value ?? n(a.description), o = e.hasTitle ? "" : Q(e.reasonDetail ? n(e.reasonDetail) : r), s = n(a.dates), [c = "", l = ""] = Array.isArray(s) ? s.map(Q) : [], u = Q(n(_(e, o)?.name ?? a.date)), d = Number(Q(n(a.unitPrice)) || NaN), f = Number.isFinite(d);
|
|
1915
1934
|
return {
|
|
1916
1935
|
amount: f ? String(e.price === "credit" ? Math.abs(d) : d) : "",
|
|
1917
1936
|
...e.amountGate && { amountGate: f },
|
|
1918
|
-
checks: Object.fromEntries((e.checks ?? []).map((e) => [e,
|
|
1937
|
+
checks: Object.fromEntries((e.checks ?? []).map((e) => [e, $(n(e))])),
|
|
1919
1938
|
dates: {
|
|
1920
|
-
fromDate: (c || u).slice(0,
|
|
1921
|
-
toDate: (l || u).slice(0,
|
|
1939
|
+
fromDate: (c || u).slice(0, Z),
|
|
1940
|
+
toDate: (l || u).slice(0, Z)
|
|
1922
1941
|
},
|
|
1923
|
-
description:
|
|
1924
|
-
fields: Object.fromEntries((e.fields ?? []).map(({ name: e }) => [e,
|
|
1925
|
-
intervention:
|
|
1942
|
+
description: Q(i),
|
|
1943
|
+
fields: Object.fromEntries((e.fields ?? []).map(({ name: e }) => [e, Q(n(e))])),
|
|
1944
|
+
intervention: $(n(a.intervention)),
|
|
1926
1945
|
reason: o,
|
|
1927
|
-
reBillRatio:
|
|
1946
|
+
reBillRatio: Q(n(a.reBillRatio)),
|
|
1928
1947
|
title: e.hasTitle ? r : ""
|
|
1929
1948
|
};
|
|
1930
|
-
},
|
|
1931
|
-
if (!
|
|
1932
|
-
let r =
|
|
1949
|
+
}, ne = (e, t, { reason: n }) => e.reasonDetail === t.reasonDetail && !!e.hasTitle == !!t.hasTitle && (!!e.hasTitle || !!e.reasonDetail || (e.reasons?.includes(n) ?? n === e.reason)), re = (e, t) => e === "client" && t === "supplier", ie = ({ workflow: e, workflowValues: t }, n) => {
|
|
1950
|
+
if (!D(e)) return;
|
|
1951
|
+
let r = H(e.funnel), i = n.side === e.side ? n.events.find(({ id: t }) => t === e.eventId) : void 0, a = r?.events.find(({ id: t }) => t === e.eventId) ?? i;
|
|
1933
1952
|
if (!a) return;
|
|
1934
|
-
let o =
|
|
1935
|
-
return i &&
|
|
1953
|
+
let o = te(a, t ?? []);
|
|
1954
|
+
return i && ne(i, a, o) ? {
|
|
1936
1955
|
answers: o,
|
|
1937
1956
|
editFunnel: n,
|
|
1938
1957
|
event: i,
|
|
1939
1958
|
side: e.side
|
|
1940
1959
|
} : {
|
|
1941
1960
|
answers: o,
|
|
1942
|
-
editFunnel: r && !a.isProof &&
|
|
1961
|
+
editFunnel: r && !a.isProof && re(n.side, e.side) ? {
|
|
1943
1962
|
...r,
|
|
1944
1963
|
pricing: n.pricing
|
|
1945
1964
|
} : void 0,
|
|
1946
1965
|
event: a,
|
|
1947
1966
|
side: e.side
|
|
1948
1967
|
};
|
|
1949
|
-
};
|
|
1968
|
+
}, ae = ({ answers: e, event: t }) => !!t.hasTitle && !!e.title || !t.reasons?.length;
|
|
1950
1969
|
//#endregion
|
|
1951
|
-
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS,
|
|
1970
|
+
export { s as CLIENT_EVENTS, c as CLIENT_GROUPS, T as DEDICATED_FUNNEL, l as DEFAULT_CLIENT_FUNNEL, j as EVENT_LOCALES, n as EVENT_NAMESPACE, o as INVENTORY_ID, r as NATIVE_EVENT_SOURCE, i as NATIVE_EVENT_VERSION, u as SUPPLIER_FUNNEL, a as VALUE_NAMES, X as billsOnLine, O as buildEventPayload, J as findCreditOfDay, Y as findCreditOverlap, H as findEventFunnel, q as getCreditedPeriods, E as getDedicatedEventWorkflow, _ as getEndDate, m as getEventAmounts, V as getEventFunnel, y as getFirstQuestion, g as getFunnelGroups, ee as getLineFunnel, x as getReason, v as getSteps, p as getUnitPrice, h as isAmountToComplete, ae as isNamedByDeclaration, D as isNativeEventWorkflow, b as isStepAnswered, ie as readEvent, f as toDecimal, A as useEventDeclaration };
|