@getsoren/shared-module 2.69.0 → 2.71.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/README.md +10 -0
- package/dist/documentImport.js +102 -98
- package/dist/events.js +1 -1
- package/dist/hourSheets.js +2 -2
- package/dist/main.d.ts +6 -6
- package/dist/main.js +371 -371
- package/dist/{context → modules/chat/context}/ChatProvider.d.ts +1 -1
- package/dist/{hooks → modules/chat/hooks}/useChat.d.ts +1 -1
- package/dist/{documentImport → modules/documentImport}/types.d.ts +14 -0
- package/dist/{documentImport → modules/documentImport}/utils/reading/reading.d.ts +7 -2
- package/dist/{hourSheets → modules/hourSheets}/types.d.ts +5 -0
- package/dist/{hourSheets → modules/hourSheets}/utils/sheetLines/sheetLines.d.ts +5 -1
- package/dist/{sheetLines-DzQEyJOO.js → sheetLines-BP86eHw_.js} +26 -9
- package/package.json +4 -4
- /package/dist/{chat → modules/chat}/ChatClient.d.ts +0 -0
- /package/dist/{chat → modules/chat}/tests/ChatClient.test.d.ts +0 -0
- /package/dist/{chat → modules/chat}/types.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/index.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/utils/matching/matching.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/utils/matching/matching.test.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/utils/proposals/proposals.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/utils/proposals/proposals.test.d.ts +0 -0
- /package/dist/{documentImport → modules/documentImport}/utils/reading/reading.test.d.ts +0 -0
- /package/dist/{events → modules/events}/catalog/clientEvents.d.ts +0 -0
- /package/dist/{events → modules/events}/catalog/supplierEvents.d.ts +0 -0
- /package/dist/{events → modules/events}/constants.d.ts +0 -0
- /package/dist/{events → modules/events}/hooks/useEventDeclaration/useEventDeclaration.d.ts +0 -0
- /package/dist/{events → modules/events}/hooks/useEventDeclaration/useEventDeclaration.test.d.ts +0 -0
- /package/dist/{events → modules/events}/index.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/ar.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/de.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/en.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/es.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/fr.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/it.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/locales.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/pt.d.ts +0 -0
- /package/dist/{events → modules/events}/tenants/bouygues/bouygues.d.ts +0 -0
- /package/dist/{events → modules/events}/tenants/index.d.ts +0 -0
- /package/dist/{events → modules/events}/tenants/tenants.test.d.ts +0 -0
- /package/dist/{events → modules/events}/types.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/amounts/amounts.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/amounts/amounts.test.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/credits/credits.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/credits/credits.test.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/lineFunnel/lineFunnel.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/lineFunnel/lineFunnel.test.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/payload/payload.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/payload/payload.test.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/readEvent/readEvent.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/readEvent/readEvent.test.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/steps/steps.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/steps/steps.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/constants.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/index.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/billingReferences/billingReferences.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/billingReferences/billingReferences.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/imputation/imputation.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/imputation/imputation.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/readCostCentres/readCostCentres.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/readCostCentres/readCostCentres.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/sheetBlocker/sheetBlocker.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/sheetBlocker/sheetBlocker.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/sheetDays/sheetDays.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/sheetDays/sheetDays.test.d.ts +0 -0
- /package/dist/{hourSheets → modules/hourSheets}/utils/sheetLines/sheetLines.test.d.ts +0 -0
package/README.md
CHANGED
|
@@ -225,6 +225,16 @@ import { extendedRentalOf, sheetLinesOf } from "@getsoren/shared-module/hourShee
|
|
|
225
225
|
import { candidateOf, factsOfAnalysis, matchesOf } from "@getsoren/shared-module/documentImport";
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
A sheet's overtime is read apart from its day's hours, never added to them: the reading sends it as a line of the same
|
|
229
|
+
day labelled `overtime`, and it is billed at a rate of its own.
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { daysOfAnalysis, overtimesOfAnalysis } from "@getsoren/shared-module/documentImport";
|
|
233
|
+
import { sheetOfReadDays } from "@getsoren/shared-module/hourSheets";
|
|
234
|
+
|
|
235
|
+
const sheet = sheetOfReadDays(daysOfAnalysis(analysis), readCostCentres, overtimesOfAnalysis(analysis));
|
|
236
|
+
```
|
|
237
|
+
|
|
228
238
|
## Utils function
|
|
229
239
|
| Module | Description |
|
|
230
240
|
|---------------------|----------------------------------------------------------------------------------------|
|
package/dist/documentImport.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { s as e } from "./operator-Cj1X_Zg5.js";
|
|
2
|
-
import {
|
|
3
|
-
import { normalizeSearch as
|
|
4
|
-
import
|
|
5
|
-
//#region src/documentImport/utils/matching/matching.ts
|
|
6
|
-
var
|
|
2
|
+
import { D as t, s as n } from "./sheetLines-BP86eHw_.js";
|
|
3
|
+
import { normalizeSearch as r, roundToHundredths as i, toNumberOrNull as a } from "@getsoren/react-utils";
|
|
4
|
+
import o from "dayjs";
|
|
5
|
+
//#region src/modules/documentImport/utils/matching/matching.ts
|
|
6
|
+
var s = {
|
|
7
7
|
dateMet: 2,
|
|
8
8
|
machineFamily: 1,
|
|
9
9
|
machineMet: 3,
|
|
@@ -13,7 +13,7 @@ var o = {
|
|
|
13
13
|
supplierMismatch: -4,
|
|
14
14
|
worksiteMet: 2,
|
|
15
15
|
worksiteMismatch: -3
|
|
16
|
-
},
|
|
16
|
+
}, c = 6, l = /^(livraison|reprise|transport|enlevement)\b/, u = [
|
|
17
17
|
"acces industrie",
|
|
18
18
|
"boels",
|
|
19
19
|
"hertz",
|
|
@@ -22,7 +22,7 @@ var o = {
|
|
|
22
22
|
"mediaco",
|
|
23
23
|
"ramirent",
|
|
24
24
|
"salti"
|
|
25
|
-
],
|
|
25
|
+
], ee = [
|
|
26
26
|
["miniExcavator", /\b(mini ?pelles?|minipelles?)\b/],
|
|
27
27
|
["backhoeLoader", /\btractopelles?\b/],
|
|
28
28
|
["excavator", /\bpelles?\b/],
|
|
@@ -34,31 +34,31 @@ var o = {
|
|
|
34
34
|
["crane", /\bgrues?\b/],
|
|
35
35
|
["truck", /\b(camions?|porteurs?)\b/],
|
|
36
36
|
["generator", /\bgroupes? electrogenes?\b/]
|
|
37
|
-
],
|
|
38
|
-
let t = e.items.find(({ articleName: e }) => !
|
|
37
|
+
], d = (e) => r(e ?? "").replace(/[^a-z0-9]+/g, " ").trim(), f = (e) => e?.slice(0, 10) || void 0, te = (e) => {
|
|
38
|
+
let t = e.items.find(({ articleName: e }) => !l.test(d(e))) ?? e.items[0];
|
|
39
39
|
return {
|
|
40
40
|
articleImage: t?.image,
|
|
41
41
|
articleName: t?.articleName,
|
|
42
|
-
fromDate:
|
|
42
|
+
fromDate: f(e.fromDate ?? t?.fromDate),
|
|
43
43
|
id: e.id,
|
|
44
44
|
supplierLogo: t?.supplier?.logo,
|
|
45
45
|
supplierName: t?.supplier?.name,
|
|
46
|
-
toDate:
|
|
46
|
+
toDate: f(e.toDate ?? t?.toDate),
|
|
47
47
|
worksiteName: e.worksite?.name
|
|
48
48
|
};
|
|
49
|
-
},
|
|
49
|
+
}, p = ({ fromDate: e, id: t, items: n, toDate: r }) => ({
|
|
50
50
|
articleImage: n[0]?.image,
|
|
51
51
|
articleName: n[0]?.name ?? void 0,
|
|
52
|
-
fromDate:
|
|
52
|
+
fromDate: f(e),
|
|
53
53
|
id: t,
|
|
54
|
-
toDate:
|
|
55
|
-
}),
|
|
56
|
-
let t =
|
|
57
|
-
if (t) return
|
|
58
|
-
},
|
|
54
|
+
toDate: f(r)
|
|
55
|
+
}), m = (e) => e.split(/\s[-–]\s/)[0], h = (e) => {
|
|
56
|
+
let t = d(m(e ?? ""));
|
|
57
|
+
if (t) return u.find((e) => t === e || t.startsWith(`${e} `)) ?? t.split(" ")[0];
|
|
58
|
+
}, g = (e) => [...new Set([e.trim(), e.split(/\s[-–]\s/)[0].trim()])].filter(Boolean), ne = (e, t) => {
|
|
59
59
|
let n = t.filter((e, n) => t.findIndex(({ id: t }) => t === e.id) === n);
|
|
60
|
-
return
|
|
61
|
-
},
|
|
60
|
+
return g(e).flatMap((e) => n.filter((t) => d(t.name) === d(e)))[0] ?? (n.length === 1 ? n[0] : void 0);
|
|
61
|
+
}, re = /\b(s a r l|sarl|s a s u|sasu|s a s|sas|e u r l|eurl|s c i|sci|s n c|snc|soc(?:iete)?(?: a responsabilite limitee| anonyme| par actions simplifiee)?|ste|ets|etablissements?)\b/g, _ = [
|
|
62
62
|
"btp",
|
|
63
63
|
"groupe",
|
|
64
64
|
"loc",
|
|
@@ -70,133 +70,137 @@ var o = {
|
|
|
70
70
|
"transport",
|
|
71
71
|
"transports",
|
|
72
72
|
"travaux"
|
|
73
|
-
],
|
|
74
|
-
let n =
|
|
73
|
+
], v = (e) => d(m(e ?? "")).replace(re, " ").split(" ").filter(Boolean), ie = (e) => [...v(e)].filter((e) => !_.includes(e)).sort((e, t) => t.length - e.length)[0] ?? e.trim(), y = (e, t) => {
|
|
74
|
+
let n = v(e), r = v(t);
|
|
75
75
|
if (n.length === 0 || r.length === 0) return;
|
|
76
|
-
let i = [n, r].map((e) =>
|
|
76
|
+
let i = [n, r].map((e) => u.find((t) => e.join(" ").startsWith(t)));
|
|
77
77
|
if (i[0] || i[1]) return i[0] === i[1];
|
|
78
78
|
let [a, o] = n.length <= r.length ? [n, r] : [r, n];
|
|
79
|
-
return a.every((e) => o.includes(e)) && a.some((e) => !
|
|
80
|
-
},
|
|
81
|
-
let n =
|
|
79
|
+
return a.every((e) => o.includes(e)) && a.some((e) => !_.includes(e));
|
|
80
|
+
}, b = (e) => ee.find(([, t]) => t.test(d(e)))?.[0], x = (e) => a((e ?? "").toLowerCase().replace(/(\d),(\d)/g, "$1.$2").match(/(\d+(?:\.\d+)?)\s*(?:t|tonnes?)\b/)?.[1]) ?? void 0, S = (e, t) => {
|
|
81
|
+
let n = b(e), r = b(t);
|
|
82
82
|
if (!(n && r)) return "unknown";
|
|
83
83
|
if (n !== r) return "different";
|
|
84
|
-
let i =
|
|
84
|
+
let i = x(e), a = x(t);
|
|
85
85
|
return i !== void 0 && a !== void 0 && Math.abs(i - a) > 1 ? "family" : "same";
|
|
86
|
-
},
|
|
87
|
-
let n =
|
|
86
|
+
}, C = (e, t) => {
|
|
87
|
+
let n = d(e).split(" ").filter(Boolean), r = t.flatMap((e) => d(e).split(" ")).filter((e) => e.length > 2);
|
|
88
88
|
return n.length > 0 && r.length > 0 && !n.some((e) => r.includes(e));
|
|
89
|
+
}, w = (e, t) => {
|
|
90
|
+
let n = S(e, t);
|
|
91
|
+
return n === "same" || n === "unknown" && !!d(e) && d(e) === d(t);
|
|
89
92
|
}, T = (e, t) => {
|
|
90
|
-
let n =
|
|
91
|
-
return
|
|
93
|
+
let n = d(e.clientName), r = d(t.clientName);
|
|
94
|
+
return y(D(e), D(t)) === !0 && w(e.machine, t.machine) && !(n && r && n !== r);
|
|
92
95
|
}, E = (e, t) => {
|
|
93
|
-
let n =
|
|
94
|
-
return b(O(e), O(t)) === !0 && T(e.machine, t.machine) && !(n && r && n !== r);
|
|
95
|
-
}, D = (e, t) => {
|
|
96
|
-
let n = new Set(u(e).split(" ").filter(Boolean)), r = new Set(u(t).split(" ").filter(Boolean));
|
|
96
|
+
let n = new Set(d(e).split(" ").filter(Boolean)), r = new Set(d(t).split(" ").filter(Boolean));
|
|
97
97
|
return [...n].filter((e) => r.has(e)).length / Math.max(1, new Set([...n, ...r]).size);
|
|
98
|
-
},
|
|
98
|
+
}, ae = ({ from: e, to: t }, n) => {
|
|
99
99
|
if (!(e && t && n.fromDate)) return;
|
|
100
100
|
let r = n.toDate ?? n.fromDate;
|
|
101
|
-
return t < n.fromDate ?
|
|
102
|
-
},
|
|
103
|
-
different:
|
|
104
|
-
family:
|
|
105
|
-
same:
|
|
101
|
+
return t < n.fromDate ? o(n.fromDate).diff(t, "day") : e > r ? o(e).diff(r, "day") : 0;
|
|
102
|
+
}, oe = {
|
|
103
|
+
different: s.machineMismatch,
|
|
104
|
+
family: s.machineFamily,
|
|
105
|
+
same: s.machineMet,
|
|
106
106
|
unknown: 0
|
|
107
|
-
},
|
|
108
|
-
let r =
|
|
109
|
-
return n || r && r === i ?
|
|
110
|
-
},
|
|
111
|
-
let n =
|
|
112
|
-
return n === void 0 ? 0 : n ?
|
|
113
|
-
},
|
|
114
|
-
let r =
|
|
107
|
+
}, se = ({ worksiteName: e }, t, n) => {
|
|
108
|
+
let r = d(e), i = d(t.worksiteName);
|
|
109
|
+
return n || r && r === i ? s.worksiteMet : r && i ? s.worksiteMismatch : 0;
|
|
110
|
+
}, D = ({ supplierName: e, orderSupplier: t }) => t?.name || e?.trim(), ce = (e, t) => {
|
|
111
|
+
let n = y(D(e), t.supplierName);
|
|
112
|
+
return n === void 0 ? 0 : n ? s.supplierMet : s.supplierMismatch;
|
|
113
|
+
}, le = 7, O = (e) => e === 0 ? s.dateMet : e === void 0 || e <= le ? 0 : s.periodMismatch, k = (e, t, { worksiteId: n }) => {
|
|
114
|
+
let r = ae(e, t);
|
|
115
115
|
return {
|
|
116
116
|
candidate: t,
|
|
117
117
|
distanceDays: r ?? Infinity,
|
|
118
|
-
machineLikeness: e.machine && t.articleName ?
|
|
119
|
-
score:
|
|
118
|
+
machineLikeness: e.machine && t.articleName ? E(e.machine, t.articleName) : 0,
|
|
119
|
+
score: se(e, t, n) + ce(e, t) + oe[S(e.machine, t.articleName)] + O(r)
|
|
120
120
|
};
|
|
121
|
-
},
|
|
121
|
+
}, A = (e, t, n) => t.map((t) => k(e, t, n)).filter(({ score: e }) => e >= 6).sort((e, t) => t.score - e.score || t.machineLikeness - e.machineLikeness || e.distanceDays - t.distanceDays || (t.candidate.fromDate ?? "").localeCompare(e.candidate.fromDate ?? "")), j = (e, t) => {
|
|
122
122
|
let n = e.find(({ candidate: e }) => e.id === t?.candidate.id);
|
|
123
123
|
return n ? e.filter((e) => e.candidate.id !== n.candidate.id && e.score === n.score && e.machineLikeness === n.machineLikeness && e.distanceDays === n.distanceDays) : [];
|
|
124
|
-
},
|
|
125
|
-
let i =
|
|
126
|
-
let a = e(r), o = i !== void 0 &&
|
|
127
|
-
return (a === n ? 4 : 0) + (o ? 2 : 0) +
|
|
124
|
+
}, M = (e, t, n) => A(e, t, n)[0], N = (e) => d(e).replace(/\b\d+(?:[ .]\d+)?\s*(?:t|tonnes?)\b/g, "").replace(/\s+/g, " ").trim(), P = (t, n, r) => {
|
|
125
|
+
let i = x(t), a = (r) => {
|
|
126
|
+
let a = e(r), o = i !== void 0 && x(r.name) === i;
|
|
127
|
+
return (a === n ? 4 : 0) + (o ? 2 : 0) + E(t, r.name);
|
|
128
128
|
};
|
|
129
129
|
return [...r].sort((e, t) => a(t) - a(e))[0];
|
|
130
|
-
},
|
|
130
|
+
}, F = (e, t) => t && !e.some(({ candidate: e }) => e.id === t.id) ? [...e, { candidate: t }] : e, I = "YYYY-MM-DD", L = /^\d{4}-\d{2}-\d{2}$/, R = (e) => typeof e == "string" && L.test(e) && o(e).format(I) === e, z = ["machine_delivery", "machine_retrieval"], B = "lines", V = (e) => e?.trim() || void 0, H = (e) => a(/^(\d+(?:\.\d+)?) hour$/.exec(e?.trim() ?? "")?.[1]) ?? void 0, U = (e) => {
|
|
131
131
|
let t = e?.trim();
|
|
132
|
-
return
|
|
133
|
-
},
|
|
134
|
-
let [t, n, ...r] = e?.split("/").map((e) =>
|
|
132
|
+
return R(t) ? t : void 0;
|
|
133
|
+
}, W = (e) => {
|
|
134
|
+
let [t, n, ...r] = e?.split("/").map((e) => U(e)) ?? [];
|
|
135
135
|
return t && n && r.length === 0 && t <= n ? {
|
|
136
136
|
from: t,
|
|
137
137
|
to: n
|
|
138
138
|
} : void 0;
|
|
139
|
-
},
|
|
140
|
-
let
|
|
141
|
-
let t =
|
|
139
|
+
}, G = ({ tables: e }) => e?.[B] ?? [], K = (e) => V(e.label) === t, q = (e) => {
|
|
140
|
+
let t = e.flatMap((e) => {
|
|
141
|
+
let t = U(e.date), n = H(e.quantity);
|
|
142
142
|
return t && n !== void 0 && n <= 24 ? [{
|
|
143
|
-
costCentre:
|
|
143
|
+
costCentre: V(e.cost_centre),
|
|
144
144
|
date: t,
|
|
145
145
|
hours: n
|
|
146
146
|
}] : [];
|
|
147
|
-
}),
|
|
148
|
-
return
|
|
147
|
+
}), r = (e, t) => e.date === t.date && e.costCentre === t.costCentre;
|
|
148
|
+
return t.filter((e, n) => t.findIndex((t) => r(t, e)) === n).map((e) => ({
|
|
149
149
|
...e,
|
|
150
|
-
hours:
|
|
150
|
+
hours: i(n(t.filter((t) => r(t, e))))
|
|
151
151
|
})).sort((e, t) => e.date.localeCompare(t.date));
|
|
152
|
-
}, Y = (e) => q(e).flatMap((e) => {
|
|
153
|
-
let t =
|
|
154
|
-
return
|
|
155
|
-
costCentre:
|
|
156
|
-
equipment:
|
|
152
|
+
}, J = (e) => q(G(e).filter((e) => !K(e))), Y = (e) => q(G(e).filter(K)).filter(({ hours: e }) => e > 0), X = (e) => G(e).flatMap((e) => {
|
|
153
|
+
let t = H(e.quantity);
|
|
154
|
+
return V(e.date) || t === void 0 ? [] : [{
|
|
155
|
+
costCentre: V(e.cost_centre),
|
|
156
|
+
equipment: V(e.equipment),
|
|
157
157
|
hours: t,
|
|
158
|
-
orderNumber:
|
|
159
|
-
period:
|
|
160
|
-
place:
|
|
161
|
-
taskCode:
|
|
158
|
+
orderNumber: V(e.order_number),
|
|
159
|
+
period: W(e.period),
|
|
160
|
+
place: V(e.place),
|
|
161
|
+
taskCode: V(e.task_code)
|
|
162
162
|
}];
|
|
163
|
-
}),
|
|
164
|
-
let
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
}), ue = (e) => {
|
|
164
|
+
let t = H(e.fields?.written_total), r = [
|
|
165
|
+
...J(e),
|
|
166
|
+
...Y(e),
|
|
167
|
+
...X(e)
|
|
168
|
+
];
|
|
169
|
+
return t === void 0 ? r.length > 0 ? n(r) : void 0 : t;
|
|
170
|
+
}, Z = (e) => e.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim(), de = (e, t) => {
|
|
171
|
+
let n = Z(e), r = Z(t);
|
|
168
172
|
return n.includes(r) || r.includes(n);
|
|
169
|
-
},
|
|
170
|
-
let t =
|
|
171
|
-
return
|
|
172
|
-
}, $ = (e) => [e.fields?.equipment, ...
|
|
173
|
-
let t = $(e).filter((e) => Q(e).length === 0), n = t.filter((e, n) => t.findIndex((t) =>
|
|
173
|
+
}, fe = /\b(livraison|amenee|aller|acheminement|delivery)\b/, pe = /\b(reprise|repli|retour|enlevement|pickup|pick up|collection)\b/, me = /\b(transport|transports|transfert)\b/, Q = (e) => {
|
|
174
|
+
let t = Z(e), n = fe.test(t), r = pe.test(t), i = !(n || r) && me.test(t);
|
|
175
|
+
return z.filter((e) => e === "machine_delivery" ? n || i : r || i);
|
|
176
|
+
}, $ = (e) => [e.fields?.equipment, ...G(e).map((e) => e.equipment)].flatMap((e) => V(e) ?? []), he = (e) => {
|
|
177
|
+
let t = $(e).filter((e) => Q(e).length === 0), n = t.filter((e, n) => t.findIndex((t) => de(t, e)) === n), r = V([e.fields?.machine_brand, e.fields?.model].filter(Boolean).join(" "));
|
|
174
178
|
return n.length > 0 ? n : r ? [r] : [];
|
|
175
|
-
},
|
|
176
|
-
let t = e.fields ?? {}, n =
|
|
177
|
-
let t =
|
|
179
|
+
}, ge = (e) => {
|
|
180
|
+
let t = e.fields ?? {}, n = G(e).flatMap((e) => {
|
|
181
|
+
let t = W(e.period);
|
|
178
182
|
return [
|
|
179
|
-
|
|
183
|
+
U(e.date),
|
|
180
184
|
t?.from,
|
|
181
185
|
t?.to
|
|
182
186
|
].flatMap((e) => e ?? []);
|
|
183
|
-
}).sort(), r =
|
|
187
|
+
}).sort(), r = W(t.period), i = U(t.issue_date), [a, ...o] = he(e), s = z.filter((t) => $(e).some((e) => Q(e).includes(t)));
|
|
184
188
|
return {
|
|
185
|
-
clientName:
|
|
189
|
+
clientName: V(t.client),
|
|
186
190
|
from: n[0] ?? r?.from ?? i,
|
|
187
|
-
hours:
|
|
191
|
+
hours: ue(e),
|
|
188
192
|
machine: a,
|
|
189
|
-
operatorName:
|
|
193
|
+
operatorName: V(t.driver),
|
|
190
194
|
otherLines: o.length > 0 ? o.map((e, t) => ({
|
|
191
195
|
id: `read-${t + 1}`,
|
|
192
196
|
machine: e
|
|
193
197
|
})) : void 0,
|
|
194
|
-
supplierName:
|
|
198
|
+
supplierName: V(t.supplier),
|
|
195
199
|
to: n.at(-1) ?? r?.to ?? i,
|
|
196
200
|
transports: s.length > 0 ? s : void 0,
|
|
197
|
-
worksiteName:
|
|
198
|
-
writtenHours:
|
|
201
|
+
worksiteName: V(t.worksite),
|
|
202
|
+
writtenHours: H(t.written_total)
|
|
199
203
|
};
|
|
200
204
|
};
|
|
201
205
|
//#endregion
|
|
202
|
-
export {
|
|
206
|
+
export { c as MIN_MATCH_SCORE, z as TRANSPORT_TYPES, M as bestMatchOf, h as brandOf, te as candidateOf, p as candidateOfSearch, m as companyNameOf, J as daysOfAnalysis, ge as factsOfAnalysis, C as isAddressedElsewhere, T as isSameRental, y as isSameSupplier, N as machineSearchOf, A as matchesOf, Y as overtimesOfAnalysis, F as proposalsOf, P as rentalArticleFor, j as rivalsOf, k as scoreOf, ie as supplierSearchOf, v as supplierWordsOf, x as tonnageOf, Q as transportTypesOf, X as undatedHoursOfAnalysis, ne as worksiteOfName, g as worksiteSearchesOf };
|
package/dist/events.js
CHANGED
package/dist/hourSheets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C, w, x as T, y as E } from "./sheetLines-
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C, w, x as T, y as E } from "./sheetLines-BP86eHw_.js";
|
|
2
2
|
import D from "dayjs";
|
|
3
|
-
//#region src/hourSheets/utils/billingReferences/billingReferences.ts
|
|
3
|
+
//#region src/modules/hourSheets/utils/billingReferences/billingReferences.ts
|
|
4
4
|
var O = "active", k = (e) => e.filter(({ status: e }) => e === O).map(({ id: e, reference: t }) => ({
|
|
5
5
|
label: t,
|
|
6
6
|
value: e
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { default as ChatClient } from './chat/ChatClient';
|
|
2
|
-
export * from './chat/types';
|
|
3
1
|
export * from './components/Inputs/MaskTextField';
|
|
4
2
|
export { default as MaskTextField } from './components/Inputs/MaskTextField';
|
|
5
3
|
export * from './components/Utils/AutoReloadOnNewVersion';
|
|
@@ -23,8 +21,6 @@ export { default as RequireAuth } from './components/Utils/RequireAuth';
|
|
|
23
21
|
export * from './components/Utils/ShowHubSpotBubble';
|
|
24
22
|
export { default as ShowHubSpotBubble } from './components/Utils/ShowHubSpotBubble';
|
|
25
23
|
export * from './constants/sentry';
|
|
26
|
-
export * from './context/ChatProvider';
|
|
27
|
-
export { default as ChatProvider } from './context/ChatProvider';
|
|
28
24
|
export * from './context/InjectDependenciesProvider';
|
|
29
25
|
export { default as InjectDependenciesProvider } from './context/InjectDependenciesProvider';
|
|
30
26
|
export { default as QueryProvider } from './context/QueryProvider';
|
|
@@ -34,8 +30,6 @@ export * from './hooks/useAmplitude';
|
|
|
34
30
|
export { default as useAmplitude } from './hooks/useAmplitude';
|
|
35
31
|
export * from './hooks/useAuth';
|
|
36
32
|
export { default as useAuth } from './hooks/useAuth';
|
|
37
|
-
export * from './hooks/useChat';
|
|
38
|
-
export { default as useChat } from './hooks/useChat';
|
|
39
33
|
export * from './hooks/useCurrentLanguage/useCurrentLanguage';
|
|
40
34
|
export { default as useCurrentLanguage } from './hooks/useCurrentLanguage/useCurrentLanguage';
|
|
41
35
|
export * from './hooks/useFilters';
|
|
@@ -46,6 +40,12 @@ export * from './hooks/useInfiniteDataGrid';
|
|
|
46
40
|
export { default as useInfiniteDataGrid } from './hooks/useInfiniteDataGrid';
|
|
47
41
|
export * from './hooks/useResponseError/useResponseError';
|
|
48
42
|
export { default as useResponseError } from './hooks/useResponseError/useResponseError';
|
|
43
|
+
export { default as ChatClient } from './modules/chat/ChatClient';
|
|
44
|
+
export * from './modules/chat/context/ChatProvider';
|
|
45
|
+
export { default as ChatProvider } from './modules/chat/context/ChatProvider';
|
|
46
|
+
export * from './modules/chat/hooks/useChat';
|
|
47
|
+
export { default as useChat } from './modules/chat/hooks/useChat';
|
|
48
|
+
export * from './modules/chat/types';
|
|
49
49
|
export { default as getOrvalConfig } from './orval/orval';
|
|
50
50
|
export * from './utils/adapter/articleNameAdapter/articleNameAdapter';
|
|
51
51
|
export { default as articleNameAdapter } from './utils/adapter/articleNameAdapter/articleNameAdapter';
|