@cwellt_software/shared-employee 0.0.1
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/AccountingRulesTab-CdYj-dz8.js +84 -0
- package/dist/AccountingRulesTab-DQJ7nD71.cjs +1 -0
- package/dist/AdditionalInfoTab-DW-S373w.cjs +1 -0
- package/dist/AdditionalInfoTab-j-Ixuvog.js +114 -0
- package/dist/App.d.ts +3 -0
- package/dist/ChangeRequestsTab-CFCWKZkt.js +342 -0
- package/dist/ChangeRequestsTab-CY7-qObu.cjs +1 -0
- package/dist/CosmicRadiationTab-6fqnDLH3.cjs +1 -0
- package/dist/CosmicRadiationTab-CLlfjJNA.js +120 -0
- package/dist/DeleteDialog-BqXtjGGi.cjs +1 -0
- package/dist/DeleteDialog-CyRsLr_c.js +21 -0
- package/dist/DetailsTab-DKFAMvlW.cjs +1 -0
- package/dist/DetailsTab-Dh1lfSr2.js +248 -0
- package/dist/DivisionsTab--eEVFupH.cjs +1 -0
- package/dist/DivisionsTab-BfIIZ_ld.js +86 -0
- package/dist/FunctionsTab-BMWoqfK2.js +160 -0
- package/dist/FunctionsTab-DQPsK0rq.cjs +1 -0
- package/dist/HistoryTab-CViMxBYc.cjs +1 -0
- package/dist/HistoryTab-CwCD46f3.js +277 -0
- package/dist/LanguagesTab-BKa7nmoT.cjs +1 -0
- package/dist/LanguagesTab-BznJDDXK.js +181 -0
- package/dist/RelatedPersonsTab-C-6ti_Be.js +260 -0
- package/dist/RelatedPersonsTab-DgoBLK21.cjs +1 -0
- package/dist/VaccinesTab-BGhy3EgY.cjs +1 -0
- package/dist/VaccinesTab-BtdAXAyo.js +171 -0
- package/dist/context/DialogShellContext.d.ts +22 -0
- package/dist/dateUtils-BULQTXVb.cjs +1 -0
- package/dist/dateUtils-CTu1RDq1.js +25 -0
- package/dist/domain/model/ChangeRequest.d.ts +23 -0
- package/dist/domain/model/Dietary.d.ts +24 -0
- package/dist/domain/model/EmployeeDetail.d.ts +89 -0
- package/dist/domain/model/EmployeeDropdowns.d.ts +31 -0
- package/dist/domain/model/EmployeeListItem.d.ts +15 -0
- package/dist/domain/model/EmployeeTabModels.d.ts +91 -0
- package/dist/domain/repository/DietaryRepository.d.ts +8 -0
- package/dist/domain/repository/EmployeeRepository.d.ts +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/infrastructure/DietaryRepositoryImpl.d.ts +20 -0
- package/dist/infrastructure/EmployeeRepositoryImpl.d.ts +74 -0
- package/dist/infrastructure/dto/DietaryDto.d.ts +26 -0
- package/dist/main.d.ts +1 -0
- package/dist/presentation/EmployeeOverview.d.ts +18 -0
- package/dist/presentation/common/DeleteDialog.d.ts +16 -0
- package/dist/presentation/common/EmptyState.d.ts +11 -0
- package/dist/presentation/common/LazyImage.d.ts +15 -0
- package/dist/presentation/common/useLazyTabs.d.ts +14 -0
- package/dist/presentation/comps/modals/AddEmployeeModal.d.ts +10 -0
- package/dist/presentation/comps/modals/EditEmployeeModal.d.ts +13 -0
- package/dist/presentation/comps/tabs/AccountingRulesTab.d.ts +10 -0
- package/dist/presentation/comps/tabs/AdditionalInfoTab.d.ts +12 -0
- package/dist/presentation/comps/tabs/ChangeRequestsTab.d.ts +16 -0
- package/dist/presentation/comps/tabs/CosmicRadiationTab.d.ts +8 -0
- package/dist/presentation/comps/tabs/DetailsTab.d.ts +8 -0
- package/dist/presentation/comps/tabs/DivisionsTab.d.ts +11 -0
- package/dist/presentation/comps/tabs/FunctionsTab.d.ts +13 -0
- package/dist/presentation/comps/tabs/HistoryTab.d.ts +15 -0
- package/dist/presentation/comps/tabs/LanguagesTab.d.ts +13 -0
- package/dist/presentation/comps/tabs/RelatedPersonsTab.d.ts +13 -0
- package/dist/presentation/comps/tabs/VaccinesTab.d.ts +12 -0
- package/dist/presentation/dietary/DietaryPage.d.ts +9 -0
- package/dist/presentation/dietary/comps/DietaryEntryDialog.d.ts +13 -0
- package/dist/presentation/dietary/comps/DietarySection.d.ts +8 -0
- package/dist/presentation/dietary/hooks/useDietary.d.ts +12 -0
- package/dist/presentation/dietary/parsers/catalogSuggestions.d.ts +12 -0
- package/dist/presentation/hooks/data/useChangeRequests.d.ts +17 -0
- package/dist/presentation/hooks/data/useEmployeeData.d.ts +79 -0
- package/dist/presentation/hooks/data/useEmployeeFilters.d.ts +10 -0
- package/dist/presentation/hooks/ui/useEmployeeOverviewUI.d.ts +15 -0
- package/dist/presentation/parsers/dateUtils.d.ts +12 -0
- package/dist/presentation/parsers/employeeParsers.d.ts +3 -0
- package/dist/presentation/parsers/imageUtils.d.ts +1 -0
- package/dist/shared-employee.cjs.js +1 -0
- package/dist/shared-employee.css +2 -0
- package/dist/shared-employee.es.js +2592 -0
- package/package.json +58 -0
|
@@ -0,0 +1,2592 @@
|
|
|
1
|
+
import { a as e, i as t } from "./dateUtils-CTu1RDq1.js";
|
|
2
|
+
import { t as n } from "./DeleteDialog-CyRsLr_c.js";
|
|
3
|
+
import { CwButton as r, CwChip as i, CwDatePicker as a, CwDialog as o, CwDigit as s, CwDisplayMessage as c, CwIcon as l, CwInputImage as u, CwInputText as d, CwLoading as f, CwMasterDetail as p, CwMessageType as m, CwMultiFilter as h, CwNote as g, CwOption as _, CwSelect as v, CwTable as y, CwTabs as b, CwTextArea as x, CwToggle as S } from "@cwellt_software/cwellt-reactjs-lib";
|
|
4
|
+
import { Suspense as C, createContext as w, lazy as T, useCallback as E, useContext as D, useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
|
|
5
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
|
+
var F = Object.defineProperty, I = (e, t) => {
|
|
8
|
+
let n = {};
|
|
9
|
+
for (var r in e) F(n, r, {
|
|
10
|
+
get: e[r],
|
|
11
|
+
enumerable: !0
|
|
12
|
+
});
|
|
13
|
+
return t || F(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
+
}, L = class {
|
|
15
|
+
baseUrl;
|
|
16
|
+
constructor(e = "/api/employee") {
|
|
17
|
+
this.baseUrl = e;
|
|
18
|
+
}
|
|
19
|
+
async get(e) {
|
|
20
|
+
let t = await fetch(`${this.baseUrl}${e}`, { credentials: "include" });
|
|
21
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
22
|
+
return t.json();
|
|
23
|
+
}
|
|
24
|
+
async post(e, t) {
|
|
25
|
+
let n = await fetch(`${this.baseUrl}${e}`, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
credentials: "include",
|
|
28
|
+
headers: t == null ? {} : { "Content-Type": "application/json" },
|
|
29
|
+
body: t == null ? void 0 : JSON.stringify(t)
|
|
30
|
+
});
|
|
31
|
+
if (!n.ok) {
|
|
32
|
+
let e = await n.text();
|
|
33
|
+
try {
|
|
34
|
+
let t = JSON.parse(e);
|
|
35
|
+
throw Error(t.message || t.Message || `HTTP ${n.status}`);
|
|
36
|
+
} catch (t) {
|
|
37
|
+
throw t instanceof SyntaxError ? Error(e || `HTTP ${n.status}`) : t;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return n.json();
|
|
41
|
+
}
|
|
42
|
+
async put(e, t) {
|
|
43
|
+
let n = await fetch(`${this.baseUrl}${e}`, {
|
|
44
|
+
method: "PUT",
|
|
45
|
+
credentials: "include",
|
|
46
|
+
headers: t == null ? {} : { "Content-Type": "application/json" },
|
|
47
|
+
body: t == null ? void 0 : JSON.stringify(t)
|
|
48
|
+
});
|
|
49
|
+
if (!n.ok) {
|
|
50
|
+
let e = await n.text();
|
|
51
|
+
try {
|
|
52
|
+
let t = JSON.parse(e);
|
|
53
|
+
throw Error(t.message || t.Message || `HTTP ${n.status}`);
|
|
54
|
+
} catch (t) {
|
|
55
|
+
throw t instanceof SyntaxError ? Error(e || `HTTP ${n.status}`) : t;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let r = await n.text();
|
|
59
|
+
return r ? JSON.parse(r) : void 0;
|
|
60
|
+
}
|
|
61
|
+
async del(e) {
|
|
62
|
+
let t = await fetch(`${this.baseUrl}${e}`, {
|
|
63
|
+
method: "DELETE",
|
|
64
|
+
credentials: "include"
|
|
65
|
+
});
|
|
66
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
67
|
+
}
|
|
68
|
+
async getEmployeeList() {
|
|
69
|
+
return this.get("/list");
|
|
70
|
+
}
|
|
71
|
+
async getEmployeeById(e) {
|
|
72
|
+
return this.get(`/${e}`);
|
|
73
|
+
}
|
|
74
|
+
async getEmployeeImage(e) {
|
|
75
|
+
return (await this.get(`/${e}/image`)).image;
|
|
76
|
+
}
|
|
77
|
+
async uploadEmployeeImage(e, t) {
|
|
78
|
+
return (await this.post(`/${e}/image`, { image: t })).image;
|
|
79
|
+
}
|
|
80
|
+
async deleteEmployeeImage(e) {
|
|
81
|
+
await this.del(`/${e}/image`);
|
|
82
|
+
}
|
|
83
|
+
async createEmployee(e) {
|
|
84
|
+
return this.post("", e);
|
|
85
|
+
}
|
|
86
|
+
async updateEmployee(e) {
|
|
87
|
+
return this.put("", e);
|
|
88
|
+
}
|
|
89
|
+
async deactivateEmployee(e) {
|
|
90
|
+
await this.put(`/${e}/deactivate`);
|
|
91
|
+
}
|
|
92
|
+
async activateEmployee(e) {
|
|
93
|
+
await this.put(`/${e}/activate`);
|
|
94
|
+
}
|
|
95
|
+
async check3LC(e) {
|
|
96
|
+
return (await this.get(`/check-3lc/${encodeURIComponent(e)}`)).available;
|
|
97
|
+
}
|
|
98
|
+
async getDropdowns() {
|
|
99
|
+
return this.get("/dropdowns");
|
|
100
|
+
}
|
|
101
|
+
async getDivisions(e) {
|
|
102
|
+
return this.get(`/${e}/divisions`);
|
|
103
|
+
}
|
|
104
|
+
async createDivision(e, t) {
|
|
105
|
+
return this.post(`/${e}/divisions/${t}`);
|
|
106
|
+
}
|
|
107
|
+
async deleteDivision(e) {
|
|
108
|
+
await this.del(`/divisions/${e}`);
|
|
109
|
+
}
|
|
110
|
+
async getFunctions(e, t) {
|
|
111
|
+
return this.get(`/${e}/functions?includeInactive=${t}`);
|
|
112
|
+
}
|
|
113
|
+
async createFunction(e) {
|
|
114
|
+
return this.post("/functions", e);
|
|
115
|
+
}
|
|
116
|
+
async updateFunction(e) {
|
|
117
|
+
return this.put("/functions", e);
|
|
118
|
+
}
|
|
119
|
+
async deactivateFunction(e) {
|
|
120
|
+
await this.put(`/functions/${e}/deactivate`);
|
|
121
|
+
}
|
|
122
|
+
async getAdditionalInfo(e) {
|
|
123
|
+
return this.get(`/${e}/additional-info`);
|
|
124
|
+
}
|
|
125
|
+
async createAdditionalInfo(e) {
|
|
126
|
+
return this.post("/additional-info", e);
|
|
127
|
+
}
|
|
128
|
+
async updateAdditionalInfo(e) {
|
|
129
|
+
return this.put("/additional-info", {
|
|
130
|
+
employeeId: e.employeeId,
|
|
131
|
+
contactTypeId: e.contactTypeId,
|
|
132
|
+
value: e.value
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async deleteAdditionalInfo(e, t) {
|
|
136
|
+
await this.del(`/${e}/additional-info/${t}`);
|
|
137
|
+
}
|
|
138
|
+
async getHistory(e) {
|
|
139
|
+
return this.get(`/${e}/history`);
|
|
140
|
+
}
|
|
141
|
+
async createHistory(e) {
|
|
142
|
+
return this.post("/history", e);
|
|
143
|
+
}
|
|
144
|
+
async updateHistory(e) {
|
|
145
|
+
return this.put("/history", e);
|
|
146
|
+
}
|
|
147
|
+
async deleteHistory(e) {
|
|
148
|
+
await this.del(`/history/${e}`);
|
|
149
|
+
}
|
|
150
|
+
async getRelatedPersons(e) {
|
|
151
|
+
return this.get(`/${e}/related-persons`);
|
|
152
|
+
}
|
|
153
|
+
async createRelatedPerson(e) {
|
|
154
|
+
return this.post("/related-persons", e);
|
|
155
|
+
}
|
|
156
|
+
async updateRelatedPerson(e) {
|
|
157
|
+
return this.put("/related-persons", e);
|
|
158
|
+
}
|
|
159
|
+
async deleteRelatedPerson(e) {
|
|
160
|
+
await this.del(`/related-persons/${e}`);
|
|
161
|
+
}
|
|
162
|
+
async confirmRelatedPerson(e) {
|
|
163
|
+
return this.put(`/related-persons/${e}/confirm`, {});
|
|
164
|
+
}
|
|
165
|
+
async getUnconfirmedRelatedPersonsCounts() {
|
|
166
|
+
return this.get("/related-persons/unconfirmed-counts");
|
|
167
|
+
}
|
|
168
|
+
async getAccountingRules(e) {
|
|
169
|
+
return this.get(`/${e}/accounting-rules`);
|
|
170
|
+
}
|
|
171
|
+
async getAvailableRuleSets() {
|
|
172
|
+
return this.get("/accounting-rule-sets");
|
|
173
|
+
}
|
|
174
|
+
async assignAccountingRule(e, t) {
|
|
175
|
+
return this.post(`/${e}/accounting-rules/${t}`);
|
|
176
|
+
}
|
|
177
|
+
async removeAccountingRule(e, t) {
|
|
178
|
+
await this.del(`/${e}/accounting-rules/${t}`);
|
|
179
|
+
}
|
|
180
|
+
async getCosmicRadiation(e) {
|
|
181
|
+
return this.get(`/${e}/cosmic-radiation`);
|
|
182
|
+
}
|
|
183
|
+
async updateCosmicRadiation(e, t) {
|
|
184
|
+
return this.put(`/${e}/cosmic-radiation`, t);
|
|
185
|
+
}
|
|
186
|
+
async getEmployeeVaccines(e) {
|
|
187
|
+
return this.get(`/${e}/vaccines`);
|
|
188
|
+
}
|
|
189
|
+
async createEmployeeVaccine(e) {
|
|
190
|
+
return this.post("/vaccines", e);
|
|
191
|
+
}
|
|
192
|
+
async updateEmployeeVaccine(e) {
|
|
193
|
+
return this.put("/vaccines", e);
|
|
194
|
+
}
|
|
195
|
+
async deleteEmployeeVaccine(e) {
|
|
196
|
+
await this.del(`/vaccines/${e}`);
|
|
197
|
+
}
|
|
198
|
+
async getEmployeeLanguages(e) {
|
|
199
|
+
return this.get(`/${e}/languages`);
|
|
200
|
+
}
|
|
201
|
+
async createEmployeeLanguage(e) {
|
|
202
|
+
return this.post("/languages", e);
|
|
203
|
+
}
|
|
204
|
+
async updateEmployeeLanguage(e) {
|
|
205
|
+
return this.put("/languages", e);
|
|
206
|
+
}
|
|
207
|
+
async deleteEmployeeLanguage(e) {
|
|
208
|
+
await this.del(`/languages/${e}`);
|
|
209
|
+
}
|
|
210
|
+
async getPendingCounts() {
|
|
211
|
+
return this.get("/change-requests/pending-counts");
|
|
212
|
+
}
|
|
213
|
+
async getChangeRequests(e) {
|
|
214
|
+
return this.get(`/${e}/change-requests`);
|
|
215
|
+
}
|
|
216
|
+
async reviewFields(e, t) {
|
|
217
|
+
await this.put(`/change-requests/${e}/review`, {
|
|
218
|
+
changeRequestId: e,
|
|
219
|
+
fieldReviews: t
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async approveAllFields(e) {
|
|
223
|
+
await this.put(`/change-requests/${e}/approve-all`);
|
|
224
|
+
}
|
|
225
|
+
async reviewPhoto(e, t, n) {
|
|
226
|
+
await this.put(`/change-requests/${e}/review-photo`, {
|
|
227
|
+
changeRequestId: e,
|
|
228
|
+
approved: t,
|
|
229
|
+
comment: n
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}, R = 1, z = 2;
|
|
233
|
+
function B(e) {
|
|
234
|
+
return e === z ? "allergy" : "dietaryNeed";
|
|
235
|
+
}
|
|
236
|
+
function ee(e) {
|
|
237
|
+
return e === "allergy" ? z : R;
|
|
238
|
+
}
|
|
239
|
+
function te(e) {
|
|
240
|
+
return {
|
|
241
|
+
id: e.id,
|
|
242
|
+
name: e.name,
|
|
243
|
+
itemType: B(e.itemType)
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function V(e) {
|
|
247
|
+
return {
|
|
248
|
+
id: e.id,
|
|
249
|
+
itemId: e.itemId,
|
|
250
|
+
name: e.name,
|
|
251
|
+
itemType: B(e.itemType),
|
|
252
|
+
isCritical: e.isCritical,
|
|
253
|
+
remarks: e.remarks ?? ""
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function H(e) {
|
|
257
|
+
return {
|
|
258
|
+
itemId: e.itemId,
|
|
259
|
+
name: e.name,
|
|
260
|
+
itemType: ee(e.itemType),
|
|
261
|
+
isCritical: e.isCritical,
|
|
262
|
+
remarks: e.remarks
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/infrastructure/DietaryRepositoryImpl.ts
|
|
267
|
+
var U = class {
|
|
268
|
+
baseUrl;
|
|
269
|
+
target;
|
|
270
|
+
constructor(e, t) {
|
|
271
|
+
this.baseUrl = e, this.target = t;
|
|
272
|
+
}
|
|
273
|
+
entriesUrl() {
|
|
274
|
+
return `${this.baseUrl}/${this.target}`;
|
|
275
|
+
}
|
|
276
|
+
async json(e, t) {
|
|
277
|
+
let n = await fetch(e, {
|
|
278
|
+
credentials: "include",
|
|
279
|
+
...t
|
|
280
|
+
});
|
|
281
|
+
if (!n.ok) throw Error(`HTTP ${n.status}`);
|
|
282
|
+
let r = await n.text();
|
|
283
|
+
return r ? JSON.parse(r) : void 0;
|
|
284
|
+
}
|
|
285
|
+
async getCatalog() {
|
|
286
|
+
return (await this.json(`${this.baseUrl}/catalog`)).map(te);
|
|
287
|
+
}
|
|
288
|
+
async getEntries() {
|
|
289
|
+
return (await this.json(this.entriesUrl())).map(V);
|
|
290
|
+
}
|
|
291
|
+
async createEntry(e) {
|
|
292
|
+
return V(await this.json(this.entriesUrl(), {
|
|
293
|
+
method: "POST",
|
|
294
|
+
headers: { "Content-Type": "application/json" },
|
|
295
|
+
body: JSON.stringify(H(e))
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
async updateEntry(e, t) {
|
|
299
|
+
return V(await this.json(this.entriesUrl(), {
|
|
300
|
+
method: "PUT",
|
|
301
|
+
headers: { "Content-Type": "application/json" },
|
|
302
|
+
body: JSON.stringify({
|
|
303
|
+
...H(t),
|
|
304
|
+
id: e
|
|
305
|
+
})
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
async deleteEntry(e) {
|
|
309
|
+
let t = await fetch(`${this.entriesUrl()}/${e}`, {
|
|
310
|
+
method: "DELETE",
|
|
311
|
+
credentials: "include"
|
|
312
|
+
});
|
|
313
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
314
|
+
}
|
|
315
|
+
}, W = w(null), G = W.Provider;
|
|
316
|
+
function K(e) {
|
|
317
|
+
let t = D(W);
|
|
318
|
+
return t ? /* @__PURE__ */ N(M, { children: t(e) }) : /* @__PURE__ */ N(o, {
|
|
319
|
+
open: e.open,
|
|
320
|
+
headline: e.title,
|
|
321
|
+
width: e.width,
|
|
322
|
+
onClose: e.onClose,
|
|
323
|
+
onSave: e.onSave,
|
|
324
|
+
disableSave: e.disableSave,
|
|
325
|
+
children: e.children
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
var q = {
|
|
329
|
+
emptyState: "_emptyState_1drnx_2",
|
|
330
|
+
transparent: "_transparent_1drnx_17",
|
|
331
|
+
subtitle: "_subtitle_1drnx_23"
|
|
332
|
+
}, ne = ({ content: e, color: t = "neutral", variant: n = "soft", customColor: r, fontSize: i = "huge", icon: a, className: o = "", style: s, subtitle: c, footer: l, children: u }) => {
|
|
333
|
+
let d = t === "transparent", f = [
|
|
334
|
+
q.emptyState,
|
|
335
|
+
d && q.transparent,
|
|
336
|
+
o
|
|
337
|
+
].filter(Boolean).join(" ");
|
|
338
|
+
return /* @__PURE__ */ P(g, {
|
|
339
|
+
color: d ? "neutral" : t,
|
|
340
|
+
variant: n,
|
|
341
|
+
customColor: r,
|
|
342
|
+
fontSize: i,
|
|
343
|
+
icon: a,
|
|
344
|
+
className: f,
|
|
345
|
+
style: s,
|
|
346
|
+
children: [
|
|
347
|
+
u ?? e,
|
|
348
|
+
c && /* @__PURE__ */ N("p", {
|
|
349
|
+
className: q.subtitle,
|
|
350
|
+
children: c
|
|
351
|
+
}),
|
|
352
|
+
l && /* @__PURE__ */ N("footer", { children: l })
|
|
353
|
+
]
|
|
354
|
+
});
|
|
355
|
+
}, J = {
|
|
356
|
+
lazyImage: "_lazyImage_tw8mr_1",
|
|
357
|
+
placeholder: "_placeholder_tw8mr_18"
|
|
358
|
+
};
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/presentation/common/LazyImage.tsx
|
|
361
|
+
function re({ entityKey: e, loadImage: t, placeholder: n, className: r, style: i }) {
|
|
362
|
+
let [a, o] = j(null), s = A(null);
|
|
363
|
+
return O(() => {
|
|
364
|
+
let n = s.current;
|
|
365
|
+
if (!n) return;
|
|
366
|
+
let r = !1, i = new IntersectionObserver(([n]) => {
|
|
367
|
+
n.isIntersecting && (i.disconnect(), t(e).then((e) => {
|
|
368
|
+
r || o(e);
|
|
369
|
+
}).catch(() => {
|
|
370
|
+
r || o(null);
|
|
371
|
+
}));
|
|
372
|
+
}, { rootMargin: "200px" });
|
|
373
|
+
return i.observe(n), () => {
|
|
374
|
+
r = !0, i.disconnect();
|
|
375
|
+
};
|
|
376
|
+
}, [e, t]), /* @__PURE__ */ N("figure", {
|
|
377
|
+
ref: s,
|
|
378
|
+
className: [J.lazyImage, r].filter(Boolean).join(" "),
|
|
379
|
+
style: i,
|
|
380
|
+
children: a ? /* @__PURE__ */ N("img", {
|
|
381
|
+
src: a,
|
|
382
|
+
alt: ""
|
|
383
|
+
}) : /* @__PURE__ */ N("figcaption", {
|
|
384
|
+
className: J.placeholder,
|
|
385
|
+
children: n
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/presentation/common/useLazyTabs.tsx
|
|
391
|
+
function ie({ defaultTab: e, entityKey: t, onTabChange: n }) {
|
|
392
|
+
let [r, i] = j(() => /* @__PURE__ */ new Set([e])), a = A(e);
|
|
393
|
+
return O(() => {
|
|
394
|
+
t !== void 0 && i(/* @__PURE__ */ new Set([e, a.current]));
|
|
395
|
+
}, [t, e]), {
|
|
396
|
+
activatedTabs: r,
|
|
397
|
+
handleTabClick: E((e) => {
|
|
398
|
+
a.current = e.key, i((t) => {
|
|
399
|
+
if (t.has(e.key)) return t;
|
|
400
|
+
let n = new Set(t);
|
|
401
|
+
return n.add(e.key), n;
|
|
402
|
+
}), n?.(e.key);
|
|
403
|
+
}, [n]),
|
|
404
|
+
renderTab: E((e, t) => r.has(e) ? /* @__PURE__ */ N(C, {
|
|
405
|
+
fallback: /* @__PURE__ */ N(f, {}),
|
|
406
|
+
children: t
|
|
407
|
+
}) : null, [r])
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
var Y = {
|
|
411
|
+
container: "_container_1gsem_3",
|
|
412
|
+
topBar: "_topBar_1gsem_12",
|
|
413
|
+
masterContent: "_masterContent_1gsem_32",
|
|
414
|
+
masterHeader: "_masterHeader_1gsem_43",
|
|
415
|
+
detailPanel: "_detailPanel_1gsem_50",
|
|
416
|
+
detailHeaderInfo: "_detailHeaderInfo_1gsem_88",
|
|
417
|
+
tabBody: "_tabBody_1gsem_112",
|
|
418
|
+
listAvatar: "_listAvatar_1gsem_131"
|
|
419
|
+
};
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/presentation/comps/modals/AddEmployeeModal.tsx
|
|
422
|
+
function ae() {
|
|
423
|
+
let e = /* @__PURE__ */ new Date();
|
|
424
|
+
return e.setMonth(e.getMonth() + 1, 1), t(e);
|
|
425
|
+
}
|
|
426
|
+
function oe({ dropdowns: n, onClose: r, onCheck3LC: i, onCreate: o }) {
|
|
427
|
+
let [l, u] = j({
|
|
428
|
+
letterCode: "",
|
|
429
|
+
empNr: "",
|
|
430
|
+
lastName: "",
|
|
431
|
+
firstName: "",
|
|
432
|
+
gender: 1,
|
|
433
|
+
birthdate: null,
|
|
434
|
+
nationality: "CH",
|
|
435
|
+
licenseNo: "",
|
|
436
|
+
socialNo: "",
|
|
437
|
+
maritalStatusId: null,
|
|
438
|
+
countryBirth: "CH",
|
|
439
|
+
placeBirth: "",
|
|
440
|
+
entryDate: ae(),
|
|
441
|
+
exitDate: null,
|
|
442
|
+
active: !0,
|
|
443
|
+
functionId: null,
|
|
444
|
+
employment: 100,
|
|
445
|
+
flightDuty: 100,
|
|
446
|
+
contractType: "FC",
|
|
447
|
+
holidaysPerYear: 25,
|
|
448
|
+
officeDays: 0,
|
|
449
|
+
dutyRegId: null,
|
|
450
|
+
frmsConfigId: null,
|
|
451
|
+
homeBaseId: null,
|
|
452
|
+
travelBaseId: null,
|
|
453
|
+
myIdTravelBlock: !1,
|
|
454
|
+
loginMethod: 1,
|
|
455
|
+
mobile: "",
|
|
456
|
+
telephone2: "",
|
|
457
|
+
email: "",
|
|
458
|
+
street: "",
|
|
459
|
+
zipCode: "",
|
|
460
|
+
city: "",
|
|
461
|
+
homeCountry: "CH",
|
|
462
|
+
winUser: "",
|
|
463
|
+
privateEmail: "",
|
|
464
|
+
remark: "",
|
|
465
|
+
emergencyContact: "",
|
|
466
|
+
passengerTypeCode: ""
|
|
467
|
+
}), [f, p] = j(""), [h, g] = j(!1), [y, b] = j(!1), [C, w] = j(!1), T = A(null), E = A(0), D = (e, t) => u((n) => ({
|
|
468
|
+
...n,
|
|
469
|
+
[e]: t
|
|
470
|
+
})), O = (e) => {
|
|
471
|
+
let t = e.toUpperCase();
|
|
472
|
+
if (D("letterCode", t), g(!1), p(""), T.current && clearTimeout(T.current), t.length < 3) {
|
|
473
|
+
b(!1);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
b(!0);
|
|
477
|
+
let n = ++E.current;
|
|
478
|
+
T.current = setTimeout(async () => {
|
|
479
|
+
try {
|
|
480
|
+
let e = await i(t);
|
|
481
|
+
if (n !== E.current) return;
|
|
482
|
+
g(e), p(e ? "" : "Letter Code already in use");
|
|
483
|
+
} catch {
|
|
484
|
+
if (n !== E.current) return;
|
|
485
|
+
p("Check failed");
|
|
486
|
+
} finally {
|
|
487
|
+
n === E.current && b(!1);
|
|
488
|
+
}
|
|
489
|
+
}, 300);
|
|
490
|
+
}, k = async () => {
|
|
491
|
+
if (!l.letterCode || !l.lastName || !l.email) {
|
|
492
|
+
c("Letter Code, Last Name and Email are required", m.WARN, 5e3);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (!f) {
|
|
496
|
+
w(!0);
|
|
497
|
+
try {
|
|
498
|
+
await o(l);
|
|
499
|
+
} finally {
|
|
500
|
+
w(!1);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}, M = e, F = t;
|
|
504
|
+
return /* @__PURE__ */ N(K, {
|
|
505
|
+
open: !0,
|
|
506
|
+
title: "Add Employee",
|
|
507
|
+
onClose: r,
|
|
508
|
+
onSave: k,
|
|
509
|
+
width: "75rem",
|
|
510
|
+
disableSave: C || y || !!f,
|
|
511
|
+
children: /* @__PURE__ */ P("div", {
|
|
512
|
+
className: "cw-grid-base-auto",
|
|
513
|
+
children: [
|
|
514
|
+
/* @__PURE__ */ P("fieldset", {
|
|
515
|
+
className: "cw-fieldset cw-flex-column",
|
|
516
|
+
children: [
|
|
517
|
+
/* @__PURE__ */ N("legend", { children: "General" }),
|
|
518
|
+
/* @__PURE__ */ P("div", {
|
|
519
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
520
|
+
children: [/* @__PURE__ */ N(d, {
|
|
521
|
+
alignProps: { flexDirection: "column" },
|
|
522
|
+
labelProps: { text: "Letter Code" },
|
|
523
|
+
value: l.letterCode,
|
|
524
|
+
onChange: (e) => O(e.currentTarget.value),
|
|
525
|
+
required: !0,
|
|
526
|
+
feedback: y ? {
|
|
527
|
+
message: "Checking…",
|
|
528
|
+
type: "info"
|
|
529
|
+
} : f ? {
|
|
530
|
+
message: f,
|
|
531
|
+
type: "danger"
|
|
532
|
+
} : h ? {
|
|
533
|
+
message: "Available",
|
|
534
|
+
type: "success"
|
|
535
|
+
} : void 0,
|
|
536
|
+
"data-testid": "employee-form-letter-code"
|
|
537
|
+
}), /* @__PURE__ */ N(d, {
|
|
538
|
+
alignProps: { flexDirection: "column" },
|
|
539
|
+
labelProps: { text: "Employee No" },
|
|
540
|
+
value: l.empNr,
|
|
541
|
+
onChange: (e) => D("empNr", e.currentTarget.value)
|
|
542
|
+
})]
|
|
543
|
+
}),
|
|
544
|
+
/* @__PURE__ */ N(d, {
|
|
545
|
+
alignProps: { flexDirection: "column" },
|
|
546
|
+
labelProps: { text: "Last Name" },
|
|
547
|
+
"data-testid": "employee-form-last-name",
|
|
548
|
+
value: l.lastName,
|
|
549
|
+
onChange: (e) => D("lastName", e.currentTarget.value),
|
|
550
|
+
required: !0
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ N(d, {
|
|
553
|
+
alignProps: { flexDirection: "column" },
|
|
554
|
+
labelProps: { text: "First Name" },
|
|
555
|
+
"data-testid": "employee-form-first-name",
|
|
556
|
+
value: l.firstName,
|
|
557
|
+
onChange: (e) => D("firstName", e.currentTarget.value)
|
|
558
|
+
}),
|
|
559
|
+
/* @__PURE__ */ P("div", {
|
|
560
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
561
|
+
children: [
|
|
562
|
+
/* @__PURE__ */ N(v, {
|
|
563
|
+
alignProps: { flexDirection: "column" },
|
|
564
|
+
labelProps: { text: "Gender" },
|
|
565
|
+
value: String(l.gender),
|
|
566
|
+
onChange: (e) => D("gender", Number(e.currentTarget.value)),
|
|
567
|
+
children: n.genders.map((e) => /* @__PURE__ */ N(_, {
|
|
568
|
+
value: e.id,
|
|
569
|
+
children: e.name
|
|
570
|
+
}, e.id))
|
|
571
|
+
}),
|
|
572
|
+
/* @__PURE__ */ N(a, {
|
|
573
|
+
alignProps: { flexDirection: "column" },
|
|
574
|
+
labelProps: { text: "Birthdate" },
|
|
575
|
+
value: M(l.birthdate),
|
|
576
|
+
onChange: (e) => D("birthdate", F(e))
|
|
577
|
+
}),
|
|
578
|
+
/* @__PURE__ */ N(v, {
|
|
579
|
+
alignProps: { flexDirection: "column" },
|
|
580
|
+
labelProps: { text: "Nationality" },
|
|
581
|
+
value: l.nationality,
|
|
582
|
+
onChange: (e) => D("nationality", e.currentTarget.value),
|
|
583
|
+
children: n.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
584
|
+
value: e.id,
|
|
585
|
+
children: e.name
|
|
586
|
+
}, e.id))
|
|
587
|
+
}),
|
|
588
|
+
/* @__PURE__ */ N(v, {
|
|
589
|
+
alignProps: { flexDirection: "column" },
|
|
590
|
+
labelProps: { text: "Marital Status" },
|
|
591
|
+
value: l.maritalStatusId == null ? "" : String(l.maritalStatusId),
|
|
592
|
+
onChange: (e) => D("maritalStatusId", e.currentTarget.value ? Number(e.currentTarget.value) : null),
|
|
593
|
+
placeholder: "Select...",
|
|
594
|
+
children: n.maritalStatuses.map((e) => /* @__PURE__ */ N(_, {
|
|
595
|
+
value: e.id,
|
|
596
|
+
children: e.name
|
|
597
|
+
}, e.id))
|
|
598
|
+
}),
|
|
599
|
+
/* @__PURE__ */ N(d, {
|
|
600
|
+
alignProps: { flexDirection: "column" },
|
|
601
|
+
labelProps: { text: "License No" },
|
|
602
|
+
value: l.licenseNo,
|
|
603
|
+
onChange: (e) => D("licenseNo", e.currentTarget.value)
|
|
604
|
+
}),
|
|
605
|
+
/* @__PURE__ */ N(d, {
|
|
606
|
+
alignProps: { flexDirection: "column" },
|
|
607
|
+
labelProps: { text: "Social No" },
|
|
608
|
+
value: l.socialNo,
|
|
609
|
+
onChange: (e) => D("socialNo", e.currentTarget.value)
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ N(v, {
|
|
612
|
+
alignProps: { flexDirection: "column" },
|
|
613
|
+
labelProps: { text: "Country of Birth" },
|
|
614
|
+
value: l.countryBirth,
|
|
615
|
+
onChange: (e) => D("countryBirth", e.currentTarget.value),
|
|
616
|
+
children: n.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
617
|
+
value: e.id,
|
|
618
|
+
children: e.name
|
|
619
|
+
}, e.id))
|
|
620
|
+
}),
|
|
621
|
+
/* @__PURE__ */ N(d, {
|
|
622
|
+
alignProps: { flexDirection: "column" },
|
|
623
|
+
labelProps: { text: "Place of Birth" },
|
|
624
|
+
value: l.placeBirth,
|
|
625
|
+
onChange: (e) => D("placeBirth", e.currentTarget.value)
|
|
626
|
+
})
|
|
627
|
+
]
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ P("fieldset", {
|
|
632
|
+
className: "cw-fieldset cw-flex-column",
|
|
633
|
+
children: [
|
|
634
|
+
/* @__PURE__ */ N("legend", { children: "Company" }),
|
|
635
|
+
/* @__PURE__ */ N(S, {
|
|
636
|
+
checked: l.active,
|
|
637
|
+
labelText: "Active",
|
|
638
|
+
onChange: () => D("active", !l.active)
|
|
639
|
+
}),
|
|
640
|
+
/* @__PURE__ */ P("div", {
|
|
641
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
642
|
+
children: [
|
|
643
|
+
/* @__PURE__ */ N(a, {
|
|
644
|
+
alignProps: { flexDirection: "column" },
|
|
645
|
+
labelProps: { text: "Entry Date" },
|
|
646
|
+
value: M(l.entryDate),
|
|
647
|
+
onChange: (e) => D("entryDate", F(e))
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ N(a, {
|
|
650
|
+
alignProps: { flexDirection: "column" },
|
|
651
|
+
labelProps: { text: "Exit Date" },
|
|
652
|
+
value: M(l.exitDate),
|
|
653
|
+
onChange: (e) => D("exitDate", F(e)),
|
|
654
|
+
showClear: !0
|
|
655
|
+
}),
|
|
656
|
+
/* @__PURE__ */ N(v, {
|
|
657
|
+
alignProps: { flexDirection: "column" },
|
|
658
|
+
labelProps: { text: "Function" },
|
|
659
|
+
value: l.functionId == null ? "" : String(l.functionId),
|
|
660
|
+
onChange: (e) => D("functionId", e.currentTarget.value ? Number(e.currentTarget.value) : null),
|
|
661
|
+
placeholder: "Select...",
|
|
662
|
+
children: n.functions.map((e) => /* @__PURE__ */ N(_, {
|
|
663
|
+
value: e.id,
|
|
664
|
+
children: e.name
|
|
665
|
+
}, e.id))
|
|
666
|
+
}),
|
|
667
|
+
/* @__PURE__ */ N(s, {
|
|
668
|
+
alignProps: { flexDirection: "column" },
|
|
669
|
+
labelProps: { text: "Employment %" },
|
|
670
|
+
value: String(l.employment),
|
|
671
|
+
onChange: (e) => D("employment", Number(e.currentTarget.value))
|
|
672
|
+
}),
|
|
673
|
+
/* @__PURE__ */ N(s, {
|
|
674
|
+
alignProps: { flexDirection: "column" },
|
|
675
|
+
labelProps: { text: "Flight Duty %" },
|
|
676
|
+
value: String(l.flightDuty),
|
|
677
|
+
onChange: (e) => D("flightDuty", Number(e.currentTarget.value))
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ N(v, {
|
|
680
|
+
alignProps: { flexDirection: "column" },
|
|
681
|
+
labelProps: { text: "Contract Type" },
|
|
682
|
+
value: l.contractType,
|
|
683
|
+
onChange: (e) => D("contractType", e.currentTarget.value),
|
|
684
|
+
children: n.contractTypes.map((e) => /* @__PURE__ */ N(_, {
|
|
685
|
+
value: e.id,
|
|
686
|
+
children: e.name
|
|
687
|
+
}, e.id))
|
|
688
|
+
}),
|
|
689
|
+
/* @__PURE__ */ N(s, {
|
|
690
|
+
alignProps: { flexDirection: "column" },
|
|
691
|
+
labelProps: { text: "Holidays p.a." },
|
|
692
|
+
value: l.holidaysPerYear == null ? "" : String(l.holidaysPerYear),
|
|
693
|
+
onChange: (e) => {
|
|
694
|
+
let t = e.currentTarget.value;
|
|
695
|
+
D("holidaysPerYear", t ? Number(t) : null);
|
|
696
|
+
}
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ N(s, {
|
|
699
|
+
alignProps: { flexDirection: "column" },
|
|
700
|
+
labelProps: { text: "Office Days" },
|
|
701
|
+
value: l.officeDays == null ? "" : String(l.officeDays),
|
|
702
|
+
onChange: (e) => {
|
|
703
|
+
let t = e.currentTarget.value;
|
|
704
|
+
D("officeDays", t ? Number(t) : null);
|
|
705
|
+
}
|
|
706
|
+
})
|
|
707
|
+
]
|
|
708
|
+
}),
|
|
709
|
+
/* @__PURE__ */ N(v, {
|
|
710
|
+
alignProps: { flexDirection: "column" },
|
|
711
|
+
labelProps: { text: "Duty Regulation" },
|
|
712
|
+
value: l.dutyRegId == null ? "" : String(l.dutyRegId),
|
|
713
|
+
onChange: (e) => D("dutyRegId", e.currentTarget.value ? Number(e.currentTarget.value) : null),
|
|
714
|
+
placeholder: "Select...",
|
|
715
|
+
children: n.dutyRegulations.map((e) => /* @__PURE__ */ N(_, {
|
|
716
|
+
value: e.id,
|
|
717
|
+
children: e.name
|
|
718
|
+
}, e.id))
|
|
719
|
+
}),
|
|
720
|
+
/* @__PURE__ */ N(v, {
|
|
721
|
+
alignProps: { flexDirection: "column" },
|
|
722
|
+
labelProps: { text: "FRMS" },
|
|
723
|
+
value: l.frmsConfigId == null ? "" : String(l.frmsConfigId),
|
|
724
|
+
onChange: (e) => D("frmsConfigId", e.currentTarget.value || null),
|
|
725
|
+
placeholder: "Select...",
|
|
726
|
+
children: n.frmsConfigs.map((e) => /* @__PURE__ */ N(_, {
|
|
727
|
+
value: e.id,
|
|
728
|
+
children: e.name
|
|
729
|
+
}, e.id))
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ N(v, {
|
|
732
|
+
alignProps: { flexDirection: "column" },
|
|
733
|
+
labelProps: { text: "Login Method" },
|
|
734
|
+
value: String(l.loginMethod),
|
|
735
|
+
onChange: (e) => D("loginMethod", Number(e.currentTarget.value)),
|
|
736
|
+
children: n.loginMethods.map((e) => /* @__PURE__ */ N(_, {
|
|
737
|
+
value: e.id,
|
|
738
|
+
children: e.name
|
|
739
|
+
}, e.id))
|
|
740
|
+
}),
|
|
741
|
+
/* @__PURE__ */ N(S, {
|
|
742
|
+
checked: l.myIdTravelBlock,
|
|
743
|
+
labelText: "MyIDTravel block",
|
|
744
|
+
onChange: () => D("myIdTravelBlock", !l.myIdTravelBlock)
|
|
745
|
+
})
|
|
746
|
+
]
|
|
747
|
+
}),
|
|
748
|
+
/* @__PURE__ */ P("fieldset", {
|
|
749
|
+
className: "cw-fieldset cw-flex-column",
|
|
750
|
+
style: { "--cw-size-large": "1rem" },
|
|
751
|
+
children: [
|
|
752
|
+
/* @__PURE__ */ N("legend", { children: "Contact" }),
|
|
753
|
+
/* @__PURE__ */ P("div", {
|
|
754
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
755
|
+
children: [/* @__PURE__ */ N(d, {
|
|
756
|
+
alignProps: { flexDirection: "column" },
|
|
757
|
+
labelProps: { text: "Mobile" },
|
|
758
|
+
value: l.mobile,
|
|
759
|
+
onChange: (e) => D("mobile", e.currentTarget.value)
|
|
760
|
+
}), /* @__PURE__ */ N(d, {
|
|
761
|
+
alignProps: { flexDirection: "column" },
|
|
762
|
+
labelProps: { text: "Telephone 2" },
|
|
763
|
+
value: l.telephone2,
|
|
764
|
+
onChange: (e) => D("telephone2", e.currentTarget.value)
|
|
765
|
+
})]
|
|
766
|
+
}),
|
|
767
|
+
/* @__PURE__ */ N(d, {
|
|
768
|
+
alignProps: { flexDirection: "column" },
|
|
769
|
+
labelProps: { text: "Email" },
|
|
770
|
+
"data-testid": "employee-form-email",
|
|
771
|
+
value: l.email,
|
|
772
|
+
onChange: (e) => D("email", e.currentTarget.value),
|
|
773
|
+
required: !0
|
|
774
|
+
}),
|
|
775
|
+
/* @__PURE__ */ N(x, {
|
|
776
|
+
alignProps: { flexDirection: "column" },
|
|
777
|
+
labelProps: { text: "Street" },
|
|
778
|
+
value: l.street,
|
|
779
|
+
onChange: (e) => D("street", e.currentTarget.value),
|
|
780
|
+
rows: 3
|
|
781
|
+
}),
|
|
782
|
+
/* @__PURE__ */ P("div", {
|
|
783
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
784
|
+
children: [/* @__PURE__ */ N(d, {
|
|
785
|
+
alignProps: { flexDirection: "column" },
|
|
786
|
+
labelProps: { text: "Zip Code" },
|
|
787
|
+
value: l.zipCode,
|
|
788
|
+
onChange: (e) => D("zipCode", e.currentTarget.value)
|
|
789
|
+
}), /* @__PURE__ */ N(d, {
|
|
790
|
+
alignProps: { flexDirection: "column" },
|
|
791
|
+
labelProps: { text: "City" },
|
|
792
|
+
value: l.city,
|
|
793
|
+
onChange: (e) => D("city", e.currentTarget.value)
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ N(v, {
|
|
797
|
+
alignProps: { flexDirection: "column" },
|
|
798
|
+
labelProps: { text: "Country" },
|
|
799
|
+
value: l.homeCountry,
|
|
800
|
+
onChange: (e) => D("homeCountry", e.currentTarget.value),
|
|
801
|
+
children: n.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
802
|
+
value: e.id,
|
|
803
|
+
children: e.name
|
|
804
|
+
}, e.id))
|
|
805
|
+
}),
|
|
806
|
+
/* @__PURE__ */ N(d, {
|
|
807
|
+
alignProps: { flexDirection: "column" },
|
|
808
|
+
labelProps: { text: "Windows User" },
|
|
809
|
+
value: l.winUser,
|
|
810
|
+
onChange: (e) => D("winUser", e.currentTarget.value)
|
|
811
|
+
}),
|
|
812
|
+
/* @__PURE__ */ N(d, {
|
|
813
|
+
alignProps: { flexDirection: "column" },
|
|
814
|
+
labelProps: { text: "Private Email" },
|
|
815
|
+
value: l.privateEmail,
|
|
816
|
+
onChange: (e) => D("privateEmail", e.currentTarget.value)
|
|
817
|
+
}),
|
|
818
|
+
/* @__PURE__ */ N(x, {
|
|
819
|
+
alignProps: { flexDirection: "column" },
|
|
820
|
+
labelProps: { text: "Remark" },
|
|
821
|
+
value: l.remark,
|
|
822
|
+
onChange: (e) => D("remark", e.currentTarget.value),
|
|
823
|
+
rows: 4
|
|
824
|
+
}),
|
|
825
|
+
/* @__PURE__ */ N(x, {
|
|
826
|
+
alignProps: { flexDirection: "column" },
|
|
827
|
+
labelProps: { text: "Emergency Contact" },
|
|
828
|
+
value: l.emergencyContact,
|
|
829
|
+
onChange: (e) => D("emergencyContact", e.currentTarget.value),
|
|
830
|
+
rows: 3
|
|
831
|
+
})
|
|
832
|
+
]
|
|
833
|
+
})
|
|
834
|
+
]
|
|
835
|
+
})
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
var se = {
|
|
839
|
+
editAvatarImg: "_editAvatarImg_14zk5_3",
|
|
840
|
+
editAvatarPlaceholder: "_editAvatarPlaceholder_14zk5_11 _lazyImage_tw8mr_1"
|
|
841
|
+
};
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/presentation/parsers/imageUtils.ts
|
|
844
|
+
function ce(e) {
|
|
845
|
+
let [t, n] = e.split(","), r = t.match(/:(.*?);/)?.[1] ?? "image/png", i = atob(n), a = new Uint8Array(i.length);
|
|
846
|
+
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
847
|
+
let o = new Blob([a], { type: r });
|
|
848
|
+
window.open(URL.createObjectURL(o), "_blank");
|
|
849
|
+
}
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/presentation/comps/modals/EditEmployeeModal.tsx
|
|
852
|
+
function le({ employee: n, dropdowns: i, currentImage: o, onClose: p, onSave: h, onUploadImage: g, onDeleteImage: y }) {
|
|
853
|
+
let [b, C] = j(() => ({
|
|
854
|
+
id: n.id,
|
|
855
|
+
letterCode: n.letterCode,
|
|
856
|
+
empNr: n.empNr,
|
|
857
|
+
lastName: n.lastName,
|
|
858
|
+
firstName: n.firstName,
|
|
859
|
+
gender: n.gender,
|
|
860
|
+
birthdate: n.birthdate,
|
|
861
|
+
nationality: n.nationality,
|
|
862
|
+
licenseNo: n.licenseNo,
|
|
863
|
+
socialNo: n.socialNo,
|
|
864
|
+
maritalStatusId: n.maritalStatusId,
|
|
865
|
+
countryBirth: n.countryBirth,
|
|
866
|
+
placeBirth: n.placeBirth,
|
|
867
|
+
entryDate: n.entryDate,
|
|
868
|
+
exitDate: n.exitDate,
|
|
869
|
+
active: n.active,
|
|
870
|
+
functionId: n.functionId,
|
|
871
|
+
employment: n.employment,
|
|
872
|
+
flightDuty: n.flightDuty,
|
|
873
|
+
contractType: n.contractType,
|
|
874
|
+
holidaysPerYear: n.holidaysPerYear,
|
|
875
|
+
officeDays: n.officeDays,
|
|
876
|
+
dutyRegId: n.dutyRegId,
|
|
877
|
+
frmsConfigId: n.frmsConfigId,
|
|
878
|
+
homeBaseId: n.homeBaseId,
|
|
879
|
+
travelBaseId: n.travelBaseId,
|
|
880
|
+
myIdTravelBlock: n.myIdTravelBlock,
|
|
881
|
+
loginMethod: n.loginMethod,
|
|
882
|
+
mobile: n.mobile,
|
|
883
|
+
telephone2: n.telephone2,
|
|
884
|
+
email: n.email,
|
|
885
|
+
street: n.street,
|
|
886
|
+
zipCode: n.zipCode,
|
|
887
|
+
city: n.city,
|
|
888
|
+
homeCountry: n.homeCountry,
|
|
889
|
+
winUser: n.winUser,
|
|
890
|
+
privateEmail: n.privateEmail,
|
|
891
|
+
remark: n.remark,
|
|
892
|
+
emergencyContact: n.emergencyContact,
|
|
893
|
+
passengerTypeCode: n.passengerTypeCode
|
|
894
|
+
})), [w, T] = j(!1), [E, D] = j(!1), O = (e, t) => C((n) => ({
|
|
895
|
+
...n,
|
|
896
|
+
[e]: t
|
|
897
|
+
})), k = async () => {
|
|
898
|
+
if (!b.lastName || !b.email) {
|
|
899
|
+
c("Last Name and Email are required", m.WARN, 5e3);
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
T(!0);
|
|
903
|
+
try {
|
|
904
|
+
await h(b);
|
|
905
|
+
} finally {
|
|
906
|
+
T(!1);
|
|
907
|
+
}
|
|
908
|
+
}, A = e, F = t;
|
|
909
|
+
return /* @__PURE__ */ N(K, {
|
|
910
|
+
open: !0,
|
|
911
|
+
title: `Edit: ${n.firstName} ${n.lastName}`,
|
|
912
|
+
onClose: p,
|
|
913
|
+
onSave: k,
|
|
914
|
+
width: "75rem",
|
|
915
|
+
disableSave: w,
|
|
916
|
+
children: /* @__PURE__ */ P("div", {
|
|
917
|
+
className: "cw-grid-base-auto",
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ P("fieldset", {
|
|
920
|
+
className: "cw-fieldset cw-flex-column",
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ N("legend", { children: "General" }),
|
|
923
|
+
/* @__PURE__ */ P("div", {
|
|
924
|
+
className: "cw-flex-row cw-align-left-top",
|
|
925
|
+
children: [/* @__PURE__ */ N("figure", { children: o ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("img", {
|
|
926
|
+
src: o,
|
|
927
|
+
alt: "Employee",
|
|
928
|
+
className: se.editAvatarImg,
|
|
929
|
+
onClick: () => ce(o)
|
|
930
|
+
}), /* @__PURE__ */ N(r, {
|
|
931
|
+
variant: "icon",
|
|
932
|
+
icon: "delete",
|
|
933
|
+
color: "danger",
|
|
934
|
+
onClick: async () => {
|
|
935
|
+
try {
|
|
936
|
+
await y(n.id);
|
|
937
|
+
} catch {
|
|
938
|
+
c("Failed to remove image", m.ERROR, 5e3);
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
title: "Remove image"
|
|
942
|
+
})] }) : /* @__PURE__ */ N("div", {
|
|
943
|
+
className: se.editAvatarPlaceholder,
|
|
944
|
+
children: /* @__PURE__ */ N(l, {
|
|
945
|
+
iconId: "user-solid",
|
|
946
|
+
size: "large"
|
|
947
|
+
})
|
|
948
|
+
}) }), E ? /* @__PURE__ */ N(f, {
|
|
949
|
+
isLoading: !0,
|
|
950
|
+
size: "small",
|
|
951
|
+
text: "Uploading…"
|
|
952
|
+
}) : /* @__PURE__ */ N(u, { onChange: async (e) => {
|
|
953
|
+
if (e) {
|
|
954
|
+
D(!0);
|
|
955
|
+
try {
|
|
956
|
+
let t = await (await fetch(e)).blob(), r = new FileReader();
|
|
957
|
+
r.onloadend = async () => {
|
|
958
|
+
try {
|
|
959
|
+
let e = r.result;
|
|
960
|
+
await g(n.id, e);
|
|
961
|
+
} catch {
|
|
962
|
+
c("Failed to upload image", m.ERROR, 5e3);
|
|
963
|
+
} finally {
|
|
964
|
+
D(!1);
|
|
965
|
+
}
|
|
966
|
+
}, r.readAsDataURL(t);
|
|
967
|
+
} catch {
|
|
968
|
+
c("Failed to upload image", m.ERROR, 5e3), D(!1);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
} })]
|
|
972
|
+
}),
|
|
973
|
+
/* @__PURE__ */ P("div", {
|
|
974
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
975
|
+
children: [/* @__PURE__ */ N(d, {
|
|
976
|
+
alignProps: { flexDirection: "column" },
|
|
977
|
+
labelProps: { text: "Lettercode" },
|
|
978
|
+
value: b.letterCode,
|
|
979
|
+
disabled: !0,
|
|
980
|
+
title: "Lettercode is not editable"
|
|
981
|
+
}), /* @__PURE__ */ N(d, {
|
|
982
|
+
alignProps: { flexDirection: "column" },
|
|
983
|
+
labelProps: { text: "Employee No" },
|
|
984
|
+
value: b.empNr,
|
|
985
|
+
onChange: (e) => O("empNr", e.currentTarget.value)
|
|
986
|
+
})]
|
|
987
|
+
}),
|
|
988
|
+
/* @__PURE__ */ N(d, {
|
|
989
|
+
alignProps: { flexDirection: "column" },
|
|
990
|
+
labelProps: { text: "Last Name" },
|
|
991
|
+
value: b.lastName,
|
|
992
|
+
onChange: (e) => O("lastName", e.currentTarget.value),
|
|
993
|
+
required: !0
|
|
994
|
+
}),
|
|
995
|
+
/* @__PURE__ */ N(d, {
|
|
996
|
+
alignProps: { flexDirection: "column" },
|
|
997
|
+
labelProps: { text: "First Name" },
|
|
998
|
+
value: b.firstName,
|
|
999
|
+
onChange: (e) => O("firstName", e.currentTarget.value)
|
|
1000
|
+
}),
|
|
1001
|
+
/* @__PURE__ */ P("div", {
|
|
1002
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ N(v, {
|
|
1005
|
+
alignProps: { flexDirection: "column" },
|
|
1006
|
+
labelProps: { text: "Gender" },
|
|
1007
|
+
value: String(b.gender),
|
|
1008
|
+
onChange: (e) => O("gender", Number(e.currentTarget.value)),
|
|
1009
|
+
children: i.genders.map((e) => /* @__PURE__ */ N(_, {
|
|
1010
|
+
value: e.id,
|
|
1011
|
+
children: e.name
|
|
1012
|
+
}, e.id))
|
|
1013
|
+
}),
|
|
1014
|
+
/* @__PURE__ */ N(a, {
|
|
1015
|
+
alignProps: { flexDirection: "column" },
|
|
1016
|
+
labelProps: { text: "Birthdate" },
|
|
1017
|
+
value: A(b.birthdate),
|
|
1018
|
+
onChange: (e) => O("birthdate", F(e))
|
|
1019
|
+
}),
|
|
1020
|
+
/* @__PURE__ */ N(v, {
|
|
1021
|
+
alignProps: { flexDirection: "column" },
|
|
1022
|
+
labelProps: { text: "Nationality" },
|
|
1023
|
+
value: b.nationality,
|
|
1024
|
+
onChange: (e) => O("nationality", e.currentTarget.value),
|
|
1025
|
+
children: i.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
1026
|
+
value: e.id,
|
|
1027
|
+
children: e.name
|
|
1028
|
+
}, e.id))
|
|
1029
|
+
}),
|
|
1030
|
+
/* @__PURE__ */ N(v, {
|
|
1031
|
+
alignProps: { flexDirection: "column" },
|
|
1032
|
+
labelProps: { text: "Marital Status" },
|
|
1033
|
+
value: b.maritalStatusId == null ? "" : String(b.maritalStatusId),
|
|
1034
|
+
onChange: (e) => O("maritalStatusId", e.currentTarget.value ? Number(e.currentTarget.value) : null),
|
|
1035
|
+
placeholder: "Select...",
|
|
1036
|
+
children: i.maritalStatuses.map((e) => /* @__PURE__ */ N(_, {
|
|
1037
|
+
value: e.id,
|
|
1038
|
+
children: e.name
|
|
1039
|
+
}, e.id))
|
|
1040
|
+
}),
|
|
1041
|
+
/* @__PURE__ */ N(d, {
|
|
1042
|
+
alignProps: { flexDirection: "column" },
|
|
1043
|
+
labelProps: { text: "License No" },
|
|
1044
|
+
value: b.licenseNo,
|
|
1045
|
+
onChange: (e) => O("licenseNo", e.currentTarget.value)
|
|
1046
|
+
}),
|
|
1047
|
+
/* @__PURE__ */ N(d, {
|
|
1048
|
+
alignProps: { flexDirection: "column" },
|
|
1049
|
+
labelProps: { text: "Social No" },
|
|
1050
|
+
value: b.socialNo,
|
|
1051
|
+
onChange: (e) => O("socialNo", e.currentTarget.value)
|
|
1052
|
+
}),
|
|
1053
|
+
/* @__PURE__ */ N(v, {
|
|
1054
|
+
alignProps: { flexDirection: "column" },
|
|
1055
|
+
labelProps: { text: "Country of Birth" },
|
|
1056
|
+
value: b.countryBirth,
|
|
1057
|
+
onChange: (e) => O("countryBirth", e.currentTarget.value),
|
|
1058
|
+
children: i.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
1059
|
+
value: e.id,
|
|
1060
|
+
children: e.name
|
|
1061
|
+
}, e.id))
|
|
1062
|
+
}),
|
|
1063
|
+
/* @__PURE__ */ N(d, {
|
|
1064
|
+
alignProps: { flexDirection: "column" },
|
|
1065
|
+
labelProps: { text: "Place of Birth" },
|
|
1066
|
+
value: b.placeBirth,
|
|
1067
|
+
onChange: (e) => O("placeBirth", e.currentTarget.value)
|
|
1068
|
+
})
|
|
1069
|
+
]
|
|
1070
|
+
})
|
|
1071
|
+
]
|
|
1072
|
+
}),
|
|
1073
|
+
/* @__PURE__ */ P("fieldset", {
|
|
1074
|
+
className: "cw-fieldset cw-flex-column",
|
|
1075
|
+
children: [
|
|
1076
|
+
/* @__PURE__ */ N("legend", { children: "Company" }),
|
|
1077
|
+
/* @__PURE__ */ N(S, {
|
|
1078
|
+
checked: b.active,
|
|
1079
|
+
labelText: "Active",
|
|
1080
|
+
onChange: () => {
|
|
1081
|
+
b.active ? (O("active", !1), (!b.exitDate || b.exitDate.startsWith("2099")) && O("exitDate", t(/* @__PURE__ */ new Date()))) : (O("active", !0), O("exitDate", null));
|
|
1082
|
+
}
|
|
1083
|
+
}),
|
|
1084
|
+
/* @__PURE__ */ P("div", {
|
|
1085
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
1086
|
+
children: [
|
|
1087
|
+
/* @__PURE__ */ N(a, {
|
|
1088
|
+
alignProps: { flexDirection: "column" },
|
|
1089
|
+
labelProps: { text: "Entry Date" },
|
|
1090
|
+
value: A(b.entryDate),
|
|
1091
|
+
onChange: (e) => O("entryDate", F(e))
|
|
1092
|
+
}),
|
|
1093
|
+
/* @__PURE__ */ N(a, {
|
|
1094
|
+
alignProps: { flexDirection: "column" },
|
|
1095
|
+
labelProps: { text: "Exit Date" },
|
|
1096
|
+
value: A(b.exitDate),
|
|
1097
|
+
onChange: (e) => O("exitDate", F(e)),
|
|
1098
|
+
showClear: !0
|
|
1099
|
+
}),
|
|
1100
|
+
/* @__PURE__ */ N(d, {
|
|
1101
|
+
alignProps: { flexDirection: "column" },
|
|
1102
|
+
labelProps: { text: "Function" },
|
|
1103
|
+
value: n.functionName,
|
|
1104
|
+
disabled: !0,
|
|
1105
|
+
title: "Managed via History tab"
|
|
1106
|
+
}),
|
|
1107
|
+
/* @__PURE__ */ N(d, {
|
|
1108
|
+
alignProps: { flexDirection: "column" },
|
|
1109
|
+
labelProps: { text: "Employment %" },
|
|
1110
|
+
value: String(b.employment),
|
|
1111
|
+
disabled: !0,
|
|
1112
|
+
title: "Managed via History tab"
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ N(d, {
|
|
1115
|
+
alignProps: { flexDirection: "column" },
|
|
1116
|
+
labelProps: { text: "Flight Duty %" },
|
|
1117
|
+
value: String(b.flightDuty),
|
|
1118
|
+
disabled: !0,
|
|
1119
|
+
title: "Managed via History tab"
|
|
1120
|
+
}),
|
|
1121
|
+
/* @__PURE__ */ N(d, {
|
|
1122
|
+
alignProps: { flexDirection: "column" },
|
|
1123
|
+
labelProps: { text: "Contract Type" },
|
|
1124
|
+
value: b.contractType,
|
|
1125
|
+
disabled: !0,
|
|
1126
|
+
title: "Managed via History tab"
|
|
1127
|
+
}),
|
|
1128
|
+
/* @__PURE__ */ N(s, {
|
|
1129
|
+
alignProps: { flexDirection: "column" },
|
|
1130
|
+
labelProps: { text: "Holidays p.a." },
|
|
1131
|
+
value: b.holidaysPerYear == null ? "" : String(b.holidaysPerYear),
|
|
1132
|
+
onChange: (e) => {
|
|
1133
|
+
let t = e.currentTarget.value;
|
|
1134
|
+
O("holidaysPerYear", t ? Number(t) : null);
|
|
1135
|
+
}
|
|
1136
|
+
}),
|
|
1137
|
+
/* @__PURE__ */ N(d, {
|
|
1138
|
+
alignProps: { flexDirection: "column" },
|
|
1139
|
+
labelProps: { text: "Office Days" },
|
|
1140
|
+
value: b.officeDays == null ? "" : String(b.officeDays),
|
|
1141
|
+
disabled: !0,
|
|
1142
|
+
title: "Managed via History tab"
|
|
1143
|
+
})
|
|
1144
|
+
]
|
|
1145
|
+
}),
|
|
1146
|
+
/* @__PURE__ */ N(v, {
|
|
1147
|
+
alignProps: { flexDirection: "column" },
|
|
1148
|
+
labelProps: { text: "Duty Regulation" },
|
|
1149
|
+
value: b.dutyRegId == null ? "" : String(b.dutyRegId),
|
|
1150
|
+
onChange: (e) => O("dutyRegId", e.currentTarget.value ? Number(e.currentTarget.value) : null),
|
|
1151
|
+
placeholder: "Select...",
|
|
1152
|
+
children: i.dutyRegulations.map((e) => /* @__PURE__ */ N(_, {
|
|
1153
|
+
value: e.id,
|
|
1154
|
+
children: e.name
|
|
1155
|
+
}, e.id))
|
|
1156
|
+
}),
|
|
1157
|
+
/* @__PURE__ */ N(v, {
|
|
1158
|
+
alignProps: { flexDirection: "column" },
|
|
1159
|
+
labelProps: { text: "FRMS" },
|
|
1160
|
+
value: b.frmsConfigId == null ? "" : String(b.frmsConfigId),
|
|
1161
|
+
onChange: (e) => O("frmsConfigId", e.currentTarget.value || null),
|
|
1162
|
+
placeholder: "Select...",
|
|
1163
|
+
children: i.frmsConfigs.map((e) => /* @__PURE__ */ N(_, {
|
|
1164
|
+
value: e.id,
|
|
1165
|
+
children: e.name
|
|
1166
|
+
}, e.id))
|
|
1167
|
+
}),
|
|
1168
|
+
/* @__PURE__ */ N(v, {
|
|
1169
|
+
alignProps: { flexDirection: "column" },
|
|
1170
|
+
labelProps: { text: "Login Method" },
|
|
1171
|
+
value: String(b.loginMethod),
|
|
1172
|
+
onChange: (e) => O("loginMethod", Number(e.currentTarget.value)),
|
|
1173
|
+
children: i.loginMethods.map((e) => /* @__PURE__ */ N(_, {
|
|
1174
|
+
value: e.id,
|
|
1175
|
+
children: e.name
|
|
1176
|
+
}, e.id))
|
|
1177
|
+
}),
|
|
1178
|
+
/* @__PURE__ */ N(S, {
|
|
1179
|
+
checked: b.myIdTravelBlock,
|
|
1180
|
+
labelText: "MyIDTravel block",
|
|
1181
|
+
onChange: () => O("myIdTravelBlock", !b.myIdTravelBlock)
|
|
1182
|
+
})
|
|
1183
|
+
]
|
|
1184
|
+
}),
|
|
1185
|
+
/* @__PURE__ */ P("fieldset", {
|
|
1186
|
+
className: "cw-fieldset cw-flex-column",
|
|
1187
|
+
style: { "--cw-size-large": "1rem" },
|
|
1188
|
+
children: [
|
|
1189
|
+
/* @__PURE__ */ N("legend", { children: "Contact" }),
|
|
1190
|
+
/* @__PURE__ */ P("div", {
|
|
1191
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
1192
|
+
children: [/* @__PURE__ */ N(d, {
|
|
1193
|
+
alignProps: { flexDirection: "column" },
|
|
1194
|
+
labelProps: { text: "Mobile" },
|
|
1195
|
+
value: b.mobile,
|
|
1196
|
+
onChange: (e) => O("mobile", e.currentTarget.value)
|
|
1197
|
+
}), /* @__PURE__ */ N(d, {
|
|
1198
|
+
alignProps: { flexDirection: "column" },
|
|
1199
|
+
labelProps: { text: "Telephone 2" },
|
|
1200
|
+
value: b.telephone2,
|
|
1201
|
+
onChange: (e) => O("telephone2", e.currentTarget.value)
|
|
1202
|
+
})]
|
|
1203
|
+
}),
|
|
1204
|
+
/* @__PURE__ */ N(d, {
|
|
1205
|
+
alignProps: { flexDirection: "column" },
|
|
1206
|
+
labelProps: { text: "Company Email" },
|
|
1207
|
+
value: b.email,
|
|
1208
|
+
onChange: (e) => O("email", e.currentTarget.value),
|
|
1209
|
+
required: !0
|
|
1210
|
+
}),
|
|
1211
|
+
/* @__PURE__ */ N(x, {
|
|
1212
|
+
alignProps: { flexDirection: "column" },
|
|
1213
|
+
labelProps: { text: "Street" },
|
|
1214
|
+
value: b.street,
|
|
1215
|
+
onChange: (e) => O("street", e.currentTarget.value)
|
|
1216
|
+
}),
|
|
1217
|
+
/* @__PURE__ */ P("div", {
|
|
1218
|
+
className: "cw-grid-base-auto cw-columns-smaller",
|
|
1219
|
+
children: [/* @__PURE__ */ N(d, {
|
|
1220
|
+
alignProps: { flexDirection: "column" },
|
|
1221
|
+
labelProps: { text: "Zip Code" },
|
|
1222
|
+
value: b.zipCode,
|
|
1223
|
+
onChange: (e) => O("zipCode", e.currentTarget.value)
|
|
1224
|
+
}), /* @__PURE__ */ N(d, {
|
|
1225
|
+
alignProps: { flexDirection: "column" },
|
|
1226
|
+
labelProps: { text: "City" },
|
|
1227
|
+
value: b.city,
|
|
1228
|
+
onChange: (e) => O("city", e.currentTarget.value)
|
|
1229
|
+
})]
|
|
1230
|
+
}),
|
|
1231
|
+
/* @__PURE__ */ N(v, {
|
|
1232
|
+
alignProps: { flexDirection: "column" },
|
|
1233
|
+
labelProps: { text: "Country" },
|
|
1234
|
+
value: b.homeCountry,
|
|
1235
|
+
onChange: (e) => O("homeCountry", e.currentTarget.value),
|
|
1236
|
+
children: i.countries.map((e) => /* @__PURE__ */ N(_, {
|
|
1237
|
+
value: e.id,
|
|
1238
|
+
children: e.name
|
|
1239
|
+
}, e.id))
|
|
1240
|
+
}),
|
|
1241
|
+
/* @__PURE__ */ N(d, {
|
|
1242
|
+
alignProps: { flexDirection: "column" },
|
|
1243
|
+
labelProps: { text: "Private Email" },
|
|
1244
|
+
value: b.privateEmail,
|
|
1245
|
+
onChange: (e) => O("privateEmail", e.currentTarget.value)
|
|
1246
|
+
}),
|
|
1247
|
+
/* @__PURE__ */ N(x, {
|
|
1248
|
+
alignProps: { flexDirection: "column" },
|
|
1249
|
+
labelProps: { text: "Remark" },
|
|
1250
|
+
"data-testid": "employee-edit-form-remark",
|
|
1251
|
+
value: b.remark,
|
|
1252
|
+
onChange: (e) => O("remark", e.currentTarget.value)
|
|
1253
|
+
}),
|
|
1254
|
+
/* @__PURE__ */ N(x, {
|
|
1255
|
+
alignProps: { flexDirection: "column" },
|
|
1256
|
+
labelProps: { text: "Emergency Contact" },
|
|
1257
|
+
value: b.emergencyContact,
|
|
1258
|
+
onChange: (e) => O("emergencyContact", e.currentTarget.value)
|
|
1259
|
+
})
|
|
1260
|
+
]
|
|
1261
|
+
})
|
|
1262
|
+
]
|
|
1263
|
+
})
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region src/presentation/hooks/data/useChangeRequests.ts
|
|
1268
|
+
function ue(e) {
|
|
1269
|
+
let [t, n] = j({}), [r, i] = j([]), [a, o] = j(!1), s = A(e);
|
|
1270
|
+
s.current = e;
|
|
1271
|
+
let c = E(async () => {
|
|
1272
|
+
try {
|
|
1273
|
+
let e = await s.current.getPendingCounts();
|
|
1274
|
+
n(e);
|
|
1275
|
+
} catch {}
|
|
1276
|
+
}, []), l = E(async (e) => {
|
|
1277
|
+
o(!0);
|
|
1278
|
+
try {
|
|
1279
|
+
let t = await s.current.getChangeRequests(e);
|
|
1280
|
+
i(t);
|
|
1281
|
+
} catch {
|
|
1282
|
+
i([]);
|
|
1283
|
+
} finally {
|
|
1284
|
+
o(!1);
|
|
1285
|
+
}
|
|
1286
|
+
}, []);
|
|
1287
|
+
return {
|
|
1288
|
+
pendingCounts: t,
|
|
1289
|
+
changeRequests: r,
|
|
1290
|
+
loading: a,
|
|
1291
|
+
loadPendingCounts: c,
|
|
1292
|
+
loadChangeRequests: l,
|
|
1293
|
+
reviewFields: E(async (e, t, n) => {
|
|
1294
|
+
await s.current.reviewFields(e, t), await l(n), await c();
|
|
1295
|
+
}, [l, c]),
|
|
1296
|
+
approveAllFields: E(async (e, t) => {
|
|
1297
|
+
await s.current.approveAllFields(e), await l(t), await c();
|
|
1298
|
+
}, [l, c]),
|
|
1299
|
+
reviewPhoto: E(async (e, t, n, r) => {
|
|
1300
|
+
await s.current.reviewPhoto(e, t, r), await l(n), await c();
|
|
1301
|
+
}, [l, c]),
|
|
1302
|
+
getPendingCount: E((e) => t[e] ?? 0, [t])
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/presentation/hooks/data/useEmployeeData.ts
|
|
1307
|
+
function de(e) {
|
|
1308
|
+
let [t, n] = j({
|
|
1309
|
+
employeeList: [],
|
|
1310
|
+
dropdowns: null,
|
|
1311
|
+
selectedEmployeeId: null,
|
|
1312
|
+
selectedEmployee: null,
|
|
1313
|
+
employeeImage: null,
|
|
1314
|
+
divisions: [],
|
|
1315
|
+
functions: [],
|
|
1316
|
+
additionalInfo: [],
|
|
1317
|
+
history: [],
|
|
1318
|
+
relatedPersons: [],
|
|
1319
|
+
accountingRules: [],
|
|
1320
|
+
availableRuleSets: [],
|
|
1321
|
+
cosmicRadiation: null,
|
|
1322
|
+
vaccines: [],
|
|
1323
|
+
languages: [],
|
|
1324
|
+
loading: !0,
|
|
1325
|
+
detailLoading: !1
|
|
1326
|
+
}), [r, i] = j({}), a = A(e);
|
|
1327
|
+
a.current = e;
|
|
1328
|
+
let o = A(/* @__PURE__ */ new Set()), s = A(!1), c = A(/* @__PURE__ */ new Map()), l = E(async () => {
|
|
1329
|
+
n((e) => ({
|
|
1330
|
+
...e,
|
|
1331
|
+
loading: !0
|
|
1332
|
+
}));
|
|
1333
|
+
try {
|
|
1334
|
+
let e = await a.current.getEmployeeList();
|
|
1335
|
+
n((t) => ({
|
|
1336
|
+
...t,
|
|
1337
|
+
employeeList: e,
|
|
1338
|
+
loading: !1
|
|
1339
|
+
}));
|
|
1340
|
+
} catch {
|
|
1341
|
+
n((e) => ({
|
|
1342
|
+
...e,
|
|
1343
|
+
loading: !1
|
|
1344
|
+
}));
|
|
1345
|
+
}
|
|
1346
|
+
}, []);
|
|
1347
|
+
O(() => {
|
|
1348
|
+
l();
|
|
1349
|
+
}, [l]);
|
|
1350
|
+
let u = E(async () => {
|
|
1351
|
+
try {
|
|
1352
|
+
let e = await a.current.getUnconfirmedRelatedPersonsCounts();
|
|
1353
|
+
i(e);
|
|
1354
|
+
} catch {}
|
|
1355
|
+
}, []);
|
|
1356
|
+
O(() => {
|
|
1357
|
+
u();
|
|
1358
|
+
}, [u]);
|
|
1359
|
+
let d = E(async () => {
|
|
1360
|
+
if (!s.current) {
|
|
1361
|
+
s.current = !0;
|
|
1362
|
+
try {
|
|
1363
|
+
let e = await a.current.getDropdowns();
|
|
1364
|
+
n((t) => ({
|
|
1365
|
+
...t,
|
|
1366
|
+
dropdowns: e
|
|
1367
|
+
}));
|
|
1368
|
+
} catch {}
|
|
1369
|
+
}
|
|
1370
|
+
}, []);
|
|
1371
|
+
O(() => {
|
|
1372
|
+
d();
|
|
1373
|
+
}, [d]);
|
|
1374
|
+
let f = E(async (e) => {
|
|
1375
|
+
n((t) => ({
|
|
1376
|
+
...t,
|
|
1377
|
+
detailLoading: !0,
|
|
1378
|
+
selectedEmployeeId: e,
|
|
1379
|
+
employeeImage: null,
|
|
1380
|
+
selectedEmployee: null,
|
|
1381
|
+
divisions: [],
|
|
1382
|
+
functions: [],
|
|
1383
|
+
additionalInfo: [],
|
|
1384
|
+
history: [],
|
|
1385
|
+
relatedPersons: [],
|
|
1386
|
+
accountingRules: [],
|
|
1387
|
+
availableRuleSets: [],
|
|
1388
|
+
cosmicRadiation: null,
|
|
1389
|
+
vaccines: [],
|
|
1390
|
+
languages: []
|
|
1391
|
+
})), o.current = /* @__PURE__ */ new Set(), await d(), n((e) => ({
|
|
1392
|
+
...e,
|
|
1393
|
+
detailLoading: !1
|
|
1394
|
+
}));
|
|
1395
|
+
let t = c.current.get(e);
|
|
1396
|
+
t === void 0 ? a.current.getEmployeeImage(e).then((t) => {
|
|
1397
|
+
c.current.set(e, t), n((n) => n.selectedEmployeeId === e ? {
|
|
1398
|
+
...n,
|
|
1399
|
+
employeeImage: t
|
|
1400
|
+
} : n);
|
|
1401
|
+
}).catch(() => {}) : n((n) => n.selectedEmployeeId === e ? {
|
|
1402
|
+
...n,
|
|
1403
|
+
employeeImage: t
|
|
1404
|
+
} : n), a.current.getEmployeeById(e).then((t) => {
|
|
1405
|
+
n((n) => n.selectedEmployeeId === e ? {
|
|
1406
|
+
...n,
|
|
1407
|
+
selectedEmployee: t
|
|
1408
|
+
} : n);
|
|
1409
|
+
}).catch(() => {});
|
|
1410
|
+
}, [d]), p = A(!1);
|
|
1411
|
+
O(() => {
|
|
1412
|
+
if (p.current) return;
|
|
1413
|
+
let e = new URLSearchParams(window.location.search).get("employeeId"), n = e == null ? NaN : Number(e);
|
|
1414
|
+
if (!Number.isFinite(n)) {
|
|
1415
|
+
p.current = !0;
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
t.employeeList.some((e) => e.id === n) && (p.current = !0, f(n));
|
|
1419
|
+
}, [t.employeeList, f]);
|
|
1420
|
+
let m = E(async (e) => {
|
|
1421
|
+
let t = c.current.get(e);
|
|
1422
|
+
if (t !== void 0) return t;
|
|
1423
|
+
try {
|
|
1424
|
+
let t = await a.current.getEmployeeImage(e);
|
|
1425
|
+
return c.current.set(e, t), t;
|
|
1426
|
+
} catch {
|
|
1427
|
+
return null;
|
|
1428
|
+
}
|
|
1429
|
+
}, []), h = E(async (e, t) => {
|
|
1430
|
+
if (!o.current.has(e)) {
|
|
1431
|
+
o.current.add(e);
|
|
1432
|
+
try {
|
|
1433
|
+
switch (e) {
|
|
1434
|
+
case "divisions": {
|
|
1435
|
+
let e = await a.current.getDivisions(t);
|
|
1436
|
+
n((t) => ({
|
|
1437
|
+
...t,
|
|
1438
|
+
divisions: e
|
|
1439
|
+
}));
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
case "functions": {
|
|
1443
|
+
let e = await a.current.getFunctions(t, !1);
|
|
1444
|
+
n((t) => ({
|
|
1445
|
+
...t,
|
|
1446
|
+
functions: e
|
|
1447
|
+
}));
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
case "additionalInfo": {
|
|
1451
|
+
let e = await a.current.getAdditionalInfo(t);
|
|
1452
|
+
n((t) => ({
|
|
1453
|
+
...t,
|
|
1454
|
+
additionalInfo: e
|
|
1455
|
+
}));
|
|
1456
|
+
break;
|
|
1457
|
+
}
|
|
1458
|
+
case "history": {
|
|
1459
|
+
let e = await a.current.getHistory(t);
|
|
1460
|
+
n((t) => ({
|
|
1461
|
+
...t,
|
|
1462
|
+
history: e
|
|
1463
|
+
}));
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
case "relatedPersons": {
|
|
1467
|
+
let e = await a.current.getRelatedPersons(t);
|
|
1468
|
+
n((t) => ({
|
|
1469
|
+
...t,
|
|
1470
|
+
relatedPersons: e
|
|
1471
|
+
}));
|
|
1472
|
+
break;
|
|
1473
|
+
}
|
|
1474
|
+
case "accountingRules": {
|
|
1475
|
+
let [e, r] = await Promise.all([a.current.getAccountingRules(t), a.current.getAvailableRuleSets()]);
|
|
1476
|
+
n((t) => ({
|
|
1477
|
+
...t,
|
|
1478
|
+
accountingRules: e,
|
|
1479
|
+
availableRuleSets: r
|
|
1480
|
+
}));
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
case "cosmicRadiation": {
|
|
1484
|
+
let e = await a.current.getCosmicRadiation(t);
|
|
1485
|
+
n((t) => ({
|
|
1486
|
+
...t,
|
|
1487
|
+
cosmicRadiation: e
|
|
1488
|
+
}));
|
|
1489
|
+
break;
|
|
1490
|
+
}
|
|
1491
|
+
case "vaccines": {
|
|
1492
|
+
let e = await a.current.getEmployeeVaccines(t);
|
|
1493
|
+
n((t) => ({
|
|
1494
|
+
...t,
|
|
1495
|
+
vaccines: e
|
|
1496
|
+
}));
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
case "languages": {
|
|
1500
|
+
let e = await a.current.getEmployeeLanguages(t);
|
|
1501
|
+
n((t) => ({
|
|
1502
|
+
...t,
|
|
1503
|
+
languages: e
|
|
1504
|
+
}));
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
} catch {}
|
|
1509
|
+
}
|
|
1510
|
+
}, []), g = E(async () => {
|
|
1511
|
+
let e = await a.current.getEmployeeList();
|
|
1512
|
+
n((t) => ({
|
|
1513
|
+
...t,
|
|
1514
|
+
employeeList: e
|
|
1515
|
+
}));
|
|
1516
|
+
}, []), _ = E(async (e) => {
|
|
1517
|
+
let t = await a.current.createEmployee(e);
|
|
1518
|
+
return n((e) => ({
|
|
1519
|
+
...e,
|
|
1520
|
+
employeeList: [...e.employeeList, t]
|
|
1521
|
+
})), t;
|
|
1522
|
+
}, []), v = E(async (e) => {
|
|
1523
|
+
let t = await a.current.updateEmployee(e);
|
|
1524
|
+
return n((e) => ({
|
|
1525
|
+
...e,
|
|
1526
|
+
selectedEmployee: t,
|
|
1527
|
+
employeeList: e.employeeList.map((e) => e.id === t.id ? {
|
|
1528
|
+
...e,
|
|
1529
|
+
firstName: t.firstName,
|
|
1530
|
+
lastName: t.lastName,
|
|
1531
|
+
letterCode: t.letterCode,
|
|
1532
|
+
active: t.active
|
|
1533
|
+
} : e)
|
|
1534
|
+
})), t;
|
|
1535
|
+
}, []), y = E(async (e) => {
|
|
1536
|
+
await a.current.deactivateEmployee(e);
|
|
1537
|
+
let [, t] = await Promise.all([g(), a.current.getEmployeeById(e)]);
|
|
1538
|
+
n((n) => n.selectedEmployeeId === e ? {
|
|
1539
|
+
...n,
|
|
1540
|
+
selectedEmployee: t
|
|
1541
|
+
} : n);
|
|
1542
|
+
}, [g]), b = E(async (e) => {
|
|
1543
|
+
await a.current.activateEmployee(e);
|
|
1544
|
+
let [, t] = await Promise.all([g(), a.current.getEmployeeById(e)]);
|
|
1545
|
+
n((n) => n.selectedEmployeeId === e ? {
|
|
1546
|
+
...n,
|
|
1547
|
+
selectedEmployee: t
|
|
1548
|
+
} : n);
|
|
1549
|
+
}, [g]), x = E(async (e, t) => {
|
|
1550
|
+
let r = await a.current.uploadEmployeeImage(e, t);
|
|
1551
|
+
return c.current.set(e, r), n((t) => t.selectedEmployeeId === e ? {
|
|
1552
|
+
...t,
|
|
1553
|
+
employeeImage: r
|
|
1554
|
+
} : t), r;
|
|
1555
|
+
}, []), S = E(async (e) => {
|
|
1556
|
+
await a.current.deleteEmployeeImage(e), c.current.set(e, null), n((t) => t.selectedEmployeeId === e ? {
|
|
1557
|
+
...t,
|
|
1558
|
+
employeeImage: null
|
|
1559
|
+
} : t);
|
|
1560
|
+
}, []), C = E(async (e, t) => {
|
|
1561
|
+
let r = await a.current.createDivision(e, t);
|
|
1562
|
+
n((e) => ({
|
|
1563
|
+
...e,
|
|
1564
|
+
divisions: [...e.divisions, r]
|
|
1565
|
+
}));
|
|
1566
|
+
}, []), w = E(async (e) => {
|
|
1567
|
+
await a.current.deleteDivision(e), n((t) => ({
|
|
1568
|
+
...t,
|
|
1569
|
+
divisions: t.divisions.filter((t) => t.id !== e)
|
|
1570
|
+
}));
|
|
1571
|
+
}, []), T = E(async (e, t) => {
|
|
1572
|
+
let r = await a.current.getFunctions(e, t);
|
|
1573
|
+
n((e) => ({
|
|
1574
|
+
...e,
|
|
1575
|
+
functions: r
|
|
1576
|
+
}));
|
|
1577
|
+
}, []), D = E(async (e) => {
|
|
1578
|
+
let t = await a.current.createFunction(e);
|
|
1579
|
+
n((e) => ({
|
|
1580
|
+
...e,
|
|
1581
|
+
functions: [...e.functions, t]
|
|
1582
|
+
}));
|
|
1583
|
+
}, []), k = E(async (e) => {
|
|
1584
|
+
let t = await a.current.updateFunction(e);
|
|
1585
|
+
n((e) => ({
|
|
1586
|
+
...e,
|
|
1587
|
+
functions: e.functions.map((e) => e.id === t.id ? t : e)
|
|
1588
|
+
}));
|
|
1589
|
+
}, []), M = E(async (e) => {
|
|
1590
|
+
await a.current.deactivateFunction(e);
|
|
1591
|
+
let t = /* @__PURE__ */ new Date(), r = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
1592
|
+
n((t) => ({
|
|
1593
|
+
...t,
|
|
1594
|
+
functions: t.functions.map((t) => t.id === e ? {
|
|
1595
|
+
...t,
|
|
1596
|
+
active: !1,
|
|
1597
|
+
functionEnd: r
|
|
1598
|
+
} : t)
|
|
1599
|
+
}));
|
|
1600
|
+
}, []), N = E(async (e) => {
|
|
1601
|
+
let t = await a.current.createAdditionalInfo(e);
|
|
1602
|
+
n((e) => ({
|
|
1603
|
+
...e,
|
|
1604
|
+
additionalInfo: [...e.additionalInfo, t]
|
|
1605
|
+
}));
|
|
1606
|
+
}, []), P = E(async (e) => {
|
|
1607
|
+
let t = await a.current.updateAdditionalInfo(e);
|
|
1608
|
+
n((e) => ({
|
|
1609
|
+
...e,
|
|
1610
|
+
additionalInfo: e.additionalInfo.map((e) => e.id === t.id ? t : e)
|
|
1611
|
+
}));
|
|
1612
|
+
}, []), F = E(async (e, t) => {
|
|
1613
|
+
await a.current.deleteAdditionalInfo(e, t), n((e) => ({
|
|
1614
|
+
...e,
|
|
1615
|
+
additionalInfo: e.additionalInfo.filter((e) => e.contactTypeId !== t)
|
|
1616
|
+
}));
|
|
1617
|
+
}, []), I = E(async (e) => {
|
|
1618
|
+
let t = await a.current.createHistory(e);
|
|
1619
|
+
n((e) => ({
|
|
1620
|
+
...e,
|
|
1621
|
+
history: t
|
|
1622
|
+
}));
|
|
1623
|
+
}, []), L = E(async (e) => {
|
|
1624
|
+
let t = await a.current.updateHistory(e);
|
|
1625
|
+
n((e) => ({
|
|
1626
|
+
...e,
|
|
1627
|
+
history: e.history.map((e) => e.id === t.id ? t : e)
|
|
1628
|
+
}));
|
|
1629
|
+
}, []), R = E(async (e) => {
|
|
1630
|
+
await a.current.deleteHistory(e), n((t) => ({
|
|
1631
|
+
...t,
|
|
1632
|
+
history: t.history.filter((t) => t.id !== e)
|
|
1633
|
+
}));
|
|
1634
|
+
}, []), z = E(async (e) => {
|
|
1635
|
+
let t = await a.current.createRelatedPerson(e);
|
|
1636
|
+
n((e) => ({
|
|
1637
|
+
...e,
|
|
1638
|
+
relatedPersons: [...e.relatedPersons, t]
|
|
1639
|
+
})), await u();
|
|
1640
|
+
}, [u]), B = E(async (e) => {
|
|
1641
|
+
let t = await a.current.updateRelatedPerson(e);
|
|
1642
|
+
n((e) => ({
|
|
1643
|
+
...e,
|
|
1644
|
+
relatedPersons: e.relatedPersons.map((e) => e.id === t.id ? t : e)
|
|
1645
|
+
})), await u();
|
|
1646
|
+
}, [u]), ee = E(async (e) => {
|
|
1647
|
+
await a.current.deleteRelatedPerson(e), n((t) => ({
|
|
1648
|
+
...t,
|
|
1649
|
+
relatedPersons: t.relatedPersons.filter((t) => t.id !== e)
|
|
1650
|
+
})), await u();
|
|
1651
|
+
}, [u]), te = E(async (e) => {
|
|
1652
|
+
let t = await a.current.confirmRelatedPerson(e);
|
|
1653
|
+
n((e) => ({
|
|
1654
|
+
...e,
|
|
1655
|
+
relatedPersons: e.relatedPersons.map((e) => e.id === t.id ? t : e)
|
|
1656
|
+
})), await u();
|
|
1657
|
+
}, [u]), V = E(async (e, t) => {
|
|
1658
|
+
let r = await a.current.assignAccountingRule(e, t);
|
|
1659
|
+
n((e) => ({
|
|
1660
|
+
...e,
|
|
1661
|
+
accountingRules: [...e.accountingRules, r]
|
|
1662
|
+
}));
|
|
1663
|
+
}, []), H = E(async (e, t) => {
|
|
1664
|
+
await a.current.removeAccountingRule(e, t), n((e) => ({
|
|
1665
|
+
...e,
|
|
1666
|
+
accountingRules: e.accountingRules.filter((e) => e.ruleId !== t)
|
|
1667
|
+
}));
|
|
1668
|
+
}, []), U = E(async (e, t) => {
|
|
1669
|
+
let r = await a.current.updateCosmicRadiation(e, t);
|
|
1670
|
+
n((e) => ({
|
|
1671
|
+
...e,
|
|
1672
|
+
cosmicRadiation: r
|
|
1673
|
+
}));
|
|
1674
|
+
}, []), W = E(async (e) => {
|
|
1675
|
+
let t = await a.current.createEmployeeVaccine(e);
|
|
1676
|
+
n((e) => ({
|
|
1677
|
+
...e,
|
|
1678
|
+
vaccines: [...e.vaccines, t]
|
|
1679
|
+
}));
|
|
1680
|
+
}, []), G = E(async (e) => {
|
|
1681
|
+
let t = await a.current.updateEmployeeVaccine(e);
|
|
1682
|
+
n((e) => ({
|
|
1683
|
+
...e,
|
|
1684
|
+
vaccines: e.vaccines.map((e) => e.id === t.id ? t : e)
|
|
1685
|
+
}));
|
|
1686
|
+
}, []), K = E(async (e) => {
|
|
1687
|
+
await a.current.deleteEmployeeVaccine(e), n((t) => ({
|
|
1688
|
+
...t,
|
|
1689
|
+
vaccines: t.vaccines.filter((t) => t.id !== e)
|
|
1690
|
+
}));
|
|
1691
|
+
}, []), q = E(async (e) => {
|
|
1692
|
+
let t = await a.current.createEmployeeLanguage(e);
|
|
1693
|
+
n((e) => ({
|
|
1694
|
+
...e,
|
|
1695
|
+
languages: [...e.languages, t]
|
|
1696
|
+
}));
|
|
1697
|
+
}, []), ne = E(async (e) => {
|
|
1698
|
+
let t = await a.current.updateEmployeeLanguage(e);
|
|
1699
|
+
n((e) => ({
|
|
1700
|
+
...e,
|
|
1701
|
+
languages: e.languages.map((e) => e.id === t.id ? t : e)
|
|
1702
|
+
}));
|
|
1703
|
+
}, []), J = E(async (e) => {
|
|
1704
|
+
await a.current.deleteEmployeeLanguage(e), n((t) => ({
|
|
1705
|
+
...t,
|
|
1706
|
+
languages: t.languages.filter((t) => t.id !== e)
|
|
1707
|
+
}));
|
|
1708
|
+
}, []);
|
|
1709
|
+
return {
|
|
1710
|
+
...t,
|
|
1711
|
+
selectEmployee: f,
|
|
1712
|
+
getEmployeeImageCached: m,
|
|
1713
|
+
ensureTabData: h,
|
|
1714
|
+
refreshEmployeeList: g,
|
|
1715
|
+
createEmployee: _,
|
|
1716
|
+
updateEmployee: v,
|
|
1717
|
+
deactivateEmployee: y,
|
|
1718
|
+
activateEmployee: b,
|
|
1719
|
+
uploadEmployeeImage: x,
|
|
1720
|
+
deleteEmployeeImage: S,
|
|
1721
|
+
createDivision: C,
|
|
1722
|
+
deleteDivision: w,
|
|
1723
|
+
refreshFunctions: T,
|
|
1724
|
+
createFunction: D,
|
|
1725
|
+
updateFunction: k,
|
|
1726
|
+
deactivateFunction: M,
|
|
1727
|
+
createAdditionalInfo: N,
|
|
1728
|
+
updateAdditionalInfo: P,
|
|
1729
|
+
deleteAdditionalInfo: F,
|
|
1730
|
+
createHistory: I,
|
|
1731
|
+
updateHistory: L,
|
|
1732
|
+
deleteHistory: R,
|
|
1733
|
+
createRelatedPerson: z,
|
|
1734
|
+
updateRelatedPerson: B,
|
|
1735
|
+
deleteRelatedPerson: ee,
|
|
1736
|
+
confirmRelatedPerson: te,
|
|
1737
|
+
assignAccountingRule: V,
|
|
1738
|
+
removeAccountingRule: H,
|
|
1739
|
+
updateCosmicRadiation: U,
|
|
1740
|
+
createVaccine: W,
|
|
1741
|
+
updateVaccine: G,
|
|
1742
|
+
deleteVaccine: K,
|
|
1743
|
+
createLanguage: q,
|
|
1744
|
+
updateLanguage: ne,
|
|
1745
|
+
deleteLanguage: J,
|
|
1746
|
+
unconfirmedRelatedPersonsCounts: r
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
//#endregion
|
|
1750
|
+
//#region src/presentation/hooks/data/useEmployeeFilters.ts
|
|
1751
|
+
var X = (e) => ({
|
|
1752
|
+
r: parseInt(e.slice(1, 3), 16),
|
|
1753
|
+
g: parseInt(e.slice(3, 5), 16),
|
|
1754
|
+
b: parseInt(e.slice(5, 7), 16)
|
|
1755
|
+
}), Z = {
|
|
1756
|
+
Function: X("#cedcff"),
|
|
1757
|
+
"Contract Type": X("#ffddb3"),
|
|
1758
|
+
Division: X("#c8e6c9"),
|
|
1759
|
+
Homebase: X("#f3e5f5"),
|
|
1760
|
+
"Change Request": X("#ffe0b2"),
|
|
1761
|
+
Vaccination: X("#e0f7fa"),
|
|
1762
|
+
Language: X("#f1f8e9")
|
|
1763
|
+
};
|
|
1764
|
+
function fe(e, t, n) {
|
|
1765
|
+
let [r, i] = j(/* @__PURE__ */ new Set());
|
|
1766
|
+
return {
|
|
1767
|
+
allTags: k(() => {
|
|
1768
|
+
if (!e) return /* @__PURE__ */ new Set();
|
|
1769
|
+
let r = /* @__PURE__ */ new Set();
|
|
1770
|
+
for (let t of e.functions) r.add({
|
|
1771
|
+
ID: `Function_${t.id}`,
|
|
1772
|
+
Name: t.name,
|
|
1773
|
+
Value: t.name,
|
|
1774
|
+
Category: "Function",
|
|
1775
|
+
PrimaryColor: Z.Function
|
|
1776
|
+
});
|
|
1777
|
+
for (let t of e.contractTypes) r.add({
|
|
1778
|
+
ID: `ContractType_${t.id}`,
|
|
1779
|
+
Name: t.name,
|
|
1780
|
+
Value: t.id,
|
|
1781
|
+
Category: "Contract Type",
|
|
1782
|
+
PrimaryColor: Z["Contract Type"]
|
|
1783
|
+
});
|
|
1784
|
+
for (let t of e.divisions) r.add({
|
|
1785
|
+
ID: `Division_${t.id}`,
|
|
1786
|
+
Name: t.name,
|
|
1787
|
+
Value: t.name,
|
|
1788
|
+
Category: "Division",
|
|
1789
|
+
PrimaryColor: Z.Division
|
|
1790
|
+
});
|
|
1791
|
+
let i = new Set(t.map((e) => e.homebaseIcao).filter(Boolean));
|
|
1792
|
+
for (let e of [...i].sort()) r.add({
|
|
1793
|
+
ID: `Homebase_${e}`,
|
|
1794
|
+
Name: e,
|
|
1795
|
+
Value: e,
|
|
1796
|
+
Category: "Homebase",
|
|
1797
|
+
PrimaryColor: Z.Homebase
|
|
1798
|
+
});
|
|
1799
|
+
let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1800
|
+
for (let e of t) {
|
|
1801
|
+
if (e.vaccineIds) for (let t of e.vaccineIds) a.add(t);
|
|
1802
|
+
if (e.languageIds) for (let t of e.languageIds) o.add(t);
|
|
1803
|
+
}
|
|
1804
|
+
for (let t of e.vaccines) a.has(t.id) && r.add({
|
|
1805
|
+
ID: `Vaccination_${t.id}`,
|
|
1806
|
+
Name: t.name,
|
|
1807
|
+
Value: t.id,
|
|
1808
|
+
Category: "Vaccination",
|
|
1809
|
+
PrimaryColor: Z.Vaccination
|
|
1810
|
+
});
|
|
1811
|
+
for (let t of e.languages) o.has(t.id) && r.add({
|
|
1812
|
+
ID: `Language_${t.id}`,
|
|
1813
|
+
Name: t.name,
|
|
1814
|
+
Value: t.id,
|
|
1815
|
+
Category: "Language",
|
|
1816
|
+
PrimaryColor: Z.Language
|
|
1817
|
+
});
|
|
1818
|
+
return Object.keys(n).length > 0 && r.add({
|
|
1819
|
+
ID: "ChangeRequest_Pending",
|
|
1820
|
+
Name: "Pending Changes",
|
|
1821
|
+
Value: "Pending",
|
|
1822
|
+
Category: "Change Request",
|
|
1823
|
+
PrimaryColor: Z["Change Request"]
|
|
1824
|
+
}), r;
|
|
1825
|
+
}, [
|
|
1826
|
+
e,
|
|
1827
|
+
t,
|
|
1828
|
+
n
|
|
1829
|
+
]),
|
|
1830
|
+
selectedTags: r,
|
|
1831
|
+
handleChangeSelectedTags: E((e) => {
|
|
1832
|
+
i(e);
|
|
1833
|
+
}, []),
|
|
1834
|
+
selectedFilters: k(() => {
|
|
1835
|
+
let e = {};
|
|
1836
|
+
for (let t of r) e[t.Category] || (e[t.Category] = /* @__PURE__ */ new Set()), e[t.Category].add(t.Value);
|
|
1837
|
+
return e;
|
|
1838
|
+
}, [r])
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
//#endregion
|
|
1842
|
+
//#region src/presentation/hooks/ui/useEmployeeOverviewUI.ts
|
|
1843
|
+
function pe() {
|
|
1844
|
+
let [e, t] = j("details"), [n, r] = j(""), [i, a] = j(!1), [o, s] = j(!1), [c, l] = j(!1);
|
|
1845
|
+
return {
|
|
1846
|
+
activeTab: e,
|
|
1847
|
+
setActiveTab: t,
|
|
1848
|
+
searchQuery: n,
|
|
1849
|
+
setSearchQuery: r,
|
|
1850
|
+
showInactive: i,
|
|
1851
|
+
setShowInactive: a,
|
|
1852
|
+
addModalOpen: o,
|
|
1853
|
+
openAddModal: E(() => s(!0), []),
|
|
1854
|
+
closeAddModal: E(() => s(!1), []),
|
|
1855
|
+
editModalOpen: c,
|
|
1856
|
+
openEditModal: E(() => l(!0), []),
|
|
1857
|
+
closeEditModal: E(() => l(!1), [])
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region src/presentation/parsers/employeeParsers.ts
|
|
1862
|
+
function me(e, t, n, r, i) {
|
|
1863
|
+
let a = e;
|
|
1864
|
+
if (n || (a = a.filter((e) => e.active)), t.trim()) {
|
|
1865
|
+
let e = t.toLowerCase();
|
|
1866
|
+
a = a.filter((t) => t.lastName?.toLowerCase().includes(e) || t.firstName?.toLowerCase().includes(e) || t.letterCode?.toLowerCase().includes(e) || t.empNr?.toLowerCase().includes(e));
|
|
1867
|
+
}
|
|
1868
|
+
for (let [e, t] of Object.entries(r)) if (t.size !== 0) switch (e) {
|
|
1869
|
+
case "Function":
|
|
1870
|
+
a = a.filter((e) => e.currentFunctions.some((e) => t.has(e)));
|
|
1871
|
+
break;
|
|
1872
|
+
case "Contract Type":
|
|
1873
|
+
a = a.filter((e) => t.has(e.contractType));
|
|
1874
|
+
break;
|
|
1875
|
+
case "Division":
|
|
1876
|
+
a = a.filter((e) => e.divisions.some((e) => t.has(e)));
|
|
1877
|
+
break;
|
|
1878
|
+
case "Homebase":
|
|
1879
|
+
a = a.filter((e) => t.has(e.homebaseIcao));
|
|
1880
|
+
break;
|
|
1881
|
+
case "Vaccination":
|
|
1882
|
+
a = a.filter((e) => e.vaccineIds?.some((e) => t.has(e)));
|
|
1883
|
+
break;
|
|
1884
|
+
case "Language":
|
|
1885
|
+
a = a.filter((e) => e.languageIds?.some((e) => t.has(e)));
|
|
1886
|
+
break;
|
|
1887
|
+
case "Change Request":
|
|
1888
|
+
t.has("Pending") && i && (a = a.filter((e) => (i[e.id] ?? 0) > 0));
|
|
1889
|
+
break;
|
|
1890
|
+
}
|
|
1891
|
+
return a;
|
|
1892
|
+
}
|
|
1893
|
+
//#endregion
|
|
1894
|
+
//#region src/presentation/EmployeeOverview.tsx
|
|
1895
|
+
var he = T(() => import("./DetailsTab-Dh1lfSr2.js").then((e) => ({ default: e.DetailsTab }))), ge = T(() => import("./AdditionalInfoTab-j-Ixuvog.js").then((e) => ({ default: e.AdditionalInfoTab }))), _e = T(() => import("./DivisionsTab-BfIIZ_ld.js").then((e) => ({ default: e.DivisionsTab }))), ve = T(() => import("./HistoryTab-CwCD46f3.js").then((e) => ({ default: e.HistoryTab }))), ye = T(() => import("./FunctionsTab-BMWoqfK2.js").then((e) => ({ default: e.FunctionsTab }))), be = T(() => import("./RelatedPersonsTab-C-6ti_Be.js").then((e) => ({ default: e.RelatedPersonsTab }))), xe = T(() => import("./AccountingRulesTab-CdYj-dz8.js").then((e) => ({ default: e.AccountingRulesTab }))), Se = T(() => import("./CosmicRadiationTab-CLlfjJNA.js").then((e) => ({ default: e.CosmicRadiationTab }))), Ce = T(() => import("./LanguagesTab-BznJDDXK.js").then((e) => ({ default: e.LanguagesTab }))), we = T(() => import("./VaccinesTab-BtdAXAyo.js").then((e) => ({ default: e.VaccinesTab }))), Te = T(() => import("./ChangeRequestsTab-CFCWKZkt.js").then((e) => ({ default: e.ChangeRequestsTab }))), Ee = T(() => Promise.resolve().then(() => Ie).then((e) => ({ default: e.DietaryPageWithParams })));
|
|
1896
|
+
function De({ employee: e, getImage: t }) {
|
|
1897
|
+
let n = `${e.firstName?.[0] ?? ""}${e.lastName?.[0] ?? ""}`.toUpperCase();
|
|
1898
|
+
return /* @__PURE__ */ P("div", {
|
|
1899
|
+
className: "cw-flex-row cw-gap-dense cw-align-left-center",
|
|
1900
|
+
children: [/* @__PURE__ */ N(re, {
|
|
1901
|
+
entityKey: e.id,
|
|
1902
|
+
loadImage: t,
|
|
1903
|
+
placeholder: n,
|
|
1904
|
+
className: Y.listAvatar
|
|
1905
|
+
}), /* @__PURE__ */ P("div", {
|
|
1906
|
+
className: "cw-flex-column cw-gap-tiny cw-flex-grow",
|
|
1907
|
+
children: [
|
|
1908
|
+
/* @__PURE__ */ P("p", {
|
|
1909
|
+
style: { fontWeight: 600 },
|
|
1910
|
+
children: [
|
|
1911
|
+
e.lastName,
|
|
1912
|
+
", ",
|
|
1913
|
+
e.firstName
|
|
1914
|
+
]
|
|
1915
|
+
}),
|
|
1916
|
+
/* @__PURE__ */ P("p", {
|
|
1917
|
+
className: "cw-color-neutral cw-font-size-small",
|
|
1918
|
+
children: [
|
|
1919
|
+
e.letterCode,
|
|
1920
|
+
" · ",
|
|
1921
|
+
e.empNr
|
|
1922
|
+
]
|
|
1923
|
+
}),
|
|
1924
|
+
/* @__PURE__ */ P("p", {
|
|
1925
|
+
className: "cw-flex-row cw-align-left-center cw-gap-tiny cw-flex-wrap",
|
|
1926
|
+
children: [
|
|
1927
|
+
e.homebaseIcao && /* @__PURE__ */ N(i, {
|
|
1928
|
+
label: e.homebaseIcao,
|
|
1929
|
+
colorScheme: "neutral"
|
|
1930
|
+
}),
|
|
1931
|
+
e.currentFunctions.slice(0, 3).map((e, t) => /* @__PURE__ */ N(i, {
|
|
1932
|
+
label: e,
|
|
1933
|
+
colorScheme: "info"
|
|
1934
|
+
}, `${e}-${t}`)),
|
|
1935
|
+
e.currentFunctions.length > 3 && /* @__PURE__ */ P("span", {
|
|
1936
|
+
className: "cw-color-neutral cw-font-size-small",
|
|
1937
|
+
children: ["+", e.currentFunctions.length - 3]
|
|
1938
|
+
}),
|
|
1939
|
+
!e.active && /* @__PURE__ */ N(i, {
|
|
1940
|
+
label: "Inactive",
|
|
1941
|
+
colorScheme: "danger"
|
|
1942
|
+
})
|
|
1943
|
+
]
|
|
1944
|
+
})
|
|
1945
|
+
]
|
|
1946
|
+
})]
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function Oe({ api: e, enabledTabs: t, airportConfig: n, dietaryBaseUrl: a, renderFiles: o, renderReminders: s, renderHistoryTrack: l }) {
|
|
1950
|
+
let u = de(e), d = pe(), g = ue(e), _ = fe(u.dropdowns, u.employeeList, g.pendingCounts);
|
|
1951
|
+
O(() => {
|
|
1952
|
+
g.loadPendingCounts();
|
|
1953
|
+
}, [g.loadPendingCounts]);
|
|
1954
|
+
let v = k(() => me(u.employeeList, d.searchQuery, d.showInactive, _.selectedFilters, g.pendingCounts), [
|
|
1955
|
+
u.employeeList,
|
|
1956
|
+
d.searchQuery,
|
|
1957
|
+
d.showInactive,
|
|
1958
|
+
_.selectedFilters,
|
|
1959
|
+
g.pendingCounts
|
|
1960
|
+
]), y = k(() => v.map((e) => {
|
|
1961
|
+
let t = g.getPendingCount(e.id) + (u.unconfirmedRelatedPersonsCounts[e.id] ?? 0);
|
|
1962
|
+
return {
|
|
1963
|
+
key: String(e.id),
|
|
1964
|
+
content: /* @__PURE__ */ P("div", {
|
|
1965
|
+
className: "cw-flex-row cw-gap-dense cw-align-left-center",
|
|
1966
|
+
style: { width: "100%" },
|
|
1967
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1968
|
+
style: { flex: 1 },
|
|
1969
|
+
children: /* @__PURE__ */ N(De, {
|
|
1970
|
+
employee: e,
|
|
1971
|
+
getImage: u.getEmployeeImageCached
|
|
1972
|
+
})
|
|
1973
|
+
}), t > 0 && /* @__PURE__ */ N(i, {
|
|
1974
|
+
label: String(t),
|
|
1975
|
+
colorScheme: "warning"
|
|
1976
|
+
})]
|
|
1977
|
+
})
|
|
1978
|
+
};
|
|
1979
|
+
}), [
|
|
1980
|
+
v,
|
|
1981
|
+
u.getEmployeeImageCached,
|
|
1982
|
+
g.getPendingCount,
|
|
1983
|
+
u.unconfirmedRelatedPersonsCounts
|
|
1984
|
+
]), x = E((e) => {
|
|
1985
|
+
u.selectEmployee(Number(e)), d.setActiveTab("details");
|
|
1986
|
+
}, [u.selectEmployee, d.setActiveTab]), C = k(() => u.employeeList.find((e) => e.id === u.selectedEmployeeId) ?? null, [u.employeeList, u.selectedEmployeeId]), w = v.filter((e) => e.active).length, { handleTabClick: T, renderTab: D } = ie({
|
|
1987
|
+
defaultTab: "details",
|
|
1988
|
+
entityKey: u.selectedEmployeeId,
|
|
1989
|
+
onTabChange: (e) => d.setActiveTab(e)
|
|
1990
|
+
});
|
|
1991
|
+
O(() => {
|
|
1992
|
+
C && (u.ensureTabData(d.activeTab, C.id), d.activeTab === "changeRequests" && g.loadChangeRequests(C.id));
|
|
1993
|
+
}, [C?.id, d.activeTab]);
|
|
1994
|
+
let A = k(() => {
|
|
1995
|
+
if (!C) return [];
|
|
1996
|
+
let e = C.id, r = g.getPendingCount(e), i = (u.unconfirmedRelatedPersonsCounts[e] ?? 0) > 0, c = [
|
|
1997
|
+
{
|
|
1998
|
+
key: "details",
|
|
1999
|
+
title: "Details",
|
|
2000
|
+
content: D("details", /* @__PURE__ */ N(he, {
|
|
2001
|
+
employee: u.selectedEmployee,
|
|
2002
|
+
dropdowns: u.dropdowns
|
|
2003
|
+
}))
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
key: "additionalInfo",
|
|
2007
|
+
title: "Additional Info",
|
|
2008
|
+
content: D("additionalInfo", /* @__PURE__ */ N(ge, {
|
|
2009
|
+
items: u.additionalInfo,
|
|
2010
|
+
employeeId: e,
|
|
2011
|
+
contactTypes: u.dropdowns?.contactTypes ?? [],
|
|
2012
|
+
onCreate: u.createAdditionalInfo,
|
|
2013
|
+
onUpdate: u.updateAdditionalInfo,
|
|
2014
|
+
onDelete: u.deleteAdditionalInfo
|
|
2015
|
+
}))
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
key: "divisions",
|
|
2019
|
+
title: "Divisions",
|
|
2020
|
+
content: D("divisions", /* @__PURE__ */ N(_e, {
|
|
2021
|
+
items: u.divisions,
|
|
2022
|
+
employeeId: e,
|
|
2023
|
+
availableDivisions: u.dropdowns?.divisions ?? [],
|
|
2024
|
+
onCreate: u.createDivision,
|
|
2025
|
+
onDelete: u.deleteDivision
|
|
2026
|
+
}))
|
|
2027
|
+
},
|
|
2028
|
+
{
|
|
2029
|
+
key: "history",
|
|
2030
|
+
title: "History",
|
|
2031
|
+
content: D("history", /* @__PURE__ */ N(ve, {
|
|
2032
|
+
items: u.history,
|
|
2033
|
+
employeeId: e,
|
|
2034
|
+
functions: u.dropdowns?.functionsNonTraining ?? [],
|
|
2035
|
+
contractTypes: u.dropdowns?.contractTypes ?? [],
|
|
2036
|
+
airportConfig: n,
|
|
2037
|
+
onCreate: u.createHistory,
|
|
2038
|
+
onUpdate: u.updateHistory,
|
|
2039
|
+
onDelete: u.deleteHistory
|
|
2040
|
+
}))
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
key: "functions",
|
|
2044
|
+
title: "Functions",
|
|
2045
|
+
content: D("functions", /* @__PURE__ */ N(ye, {
|
|
2046
|
+
items: u.functions,
|
|
2047
|
+
employeeId: e,
|
|
2048
|
+
availableFunctions: u.dropdowns?.functionsNonTraining ?? [],
|
|
2049
|
+
onCreate: u.createFunction,
|
|
2050
|
+
onUpdate: u.updateFunction,
|
|
2051
|
+
onDeactivate: u.deactivateFunction,
|
|
2052
|
+
onRefresh: u.refreshFunctions
|
|
2053
|
+
}))
|
|
2054
|
+
},
|
|
2055
|
+
...o ? [{
|
|
2056
|
+
key: "files",
|
|
2057
|
+
title: "Files",
|
|
2058
|
+
content: D("files", o(e))
|
|
2059
|
+
}] : [],
|
|
2060
|
+
...s ? [{
|
|
2061
|
+
key: "reminders",
|
|
2062
|
+
title: "Reminders",
|
|
2063
|
+
content: D("reminders", s(e))
|
|
2064
|
+
}] : [],
|
|
2065
|
+
{
|
|
2066
|
+
key: "relatedPersons",
|
|
2067
|
+
title: "Related Persons",
|
|
2068
|
+
badgeColor: i ? "var(--cw-color-warn, #ed6c02)" : void 0,
|
|
2069
|
+
content: D("relatedPersons", /* @__PURE__ */ N(be, {
|
|
2070
|
+
items: u.relatedPersons,
|
|
2071
|
+
employeeId: e,
|
|
2072
|
+
relationTypes: u.dropdowns?.relationTypes ?? [],
|
|
2073
|
+
onCreate: u.createRelatedPerson,
|
|
2074
|
+
onUpdate: u.updateRelatedPerson,
|
|
2075
|
+
onDelete: u.deleteRelatedPerson,
|
|
2076
|
+
onConfirm: u.confirmRelatedPerson
|
|
2077
|
+
}))
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
key: "accountingRules",
|
|
2081
|
+
title: "Accounting Rules",
|
|
2082
|
+
content: D("accountingRules", /* @__PURE__ */ N(xe, {
|
|
2083
|
+
items: u.accountingRules,
|
|
2084
|
+
employeeId: e,
|
|
2085
|
+
availableRuleSets: u.availableRuleSets,
|
|
2086
|
+
onAssign: u.assignAccountingRule,
|
|
2087
|
+
onRemove: u.removeAccountingRule
|
|
2088
|
+
}))
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
key: "cosmicRadiation",
|
|
2092
|
+
title: "Cosmic Radiation",
|
|
2093
|
+
content: D("cosmicRadiation", /* @__PURE__ */ N(Se, {
|
|
2094
|
+
data: u.cosmicRadiation,
|
|
2095
|
+
employeeId: e,
|
|
2096
|
+
onUpdate: u.updateCosmicRadiation
|
|
2097
|
+
}))
|
|
2098
|
+
},
|
|
2099
|
+
...l ? [{
|
|
2100
|
+
key: "historyTrack",
|
|
2101
|
+
title: "History Track",
|
|
2102
|
+
content: D("historyTrack", l(e))
|
|
2103
|
+
}] : [],
|
|
2104
|
+
{
|
|
2105
|
+
key: "languages",
|
|
2106
|
+
title: "Languages",
|
|
2107
|
+
content: D("languages", /* @__PURE__ */ N(Ce, {
|
|
2108
|
+
items: u.languages,
|
|
2109
|
+
employeeId: e,
|
|
2110
|
+
languages: u.dropdowns?.languages ?? [],
|
|
2111
|
+
levels: u.dropdowns?.languageLevels ?? [],
|
|
2112
|
+
onCreate: u.createLanguage,
|
|
2113
|
+
onUpdate: u.updateLanguage,
|
|
2114
|
+
onDelete: u.deleteLanguage
|
|
2115
|
+
}))
|
|
2116
|
+
},
|
|
2117
|
+
{
|
|
2118
|
+
key: "vaccines",
|
|
2119
|
+
title: "Vaccines",
|
|
2120
|
+
content: D("vaccines", /* @__PURE__ */ N(we, {
|
|
2121
|
+
items: u.vaccines,
|
|
2122
|
+
employeeId: e,
|
|
2123
|
+
vaccines: u.dropdowns?.vaccineOptions ?? [],
|
|
2124
|
+
onCreate: u.createVaccine,
|
|
2125
|
+
onUpdate: u.updateVaccine,
|
|
2126
|
+
onDelete: u.deleteVaccine
|
|
2127
|
+
}))
|
|
2128
|
+
},
|
|
2129
|
+
...a ? [{
|
|
2130
|
+
key: "dietary",
|
|
2131
|
+
title: "Dietary",
|
|
2132
|
+
content: D("dietary", /* @__PURE__ */ N(Ee, {
|
|
2133
|
+
baseUrl: a,
|
|
2134
|
+
employeeId: e
|
|
2135
|
+
}))
|
|
2136
|
+
}] : []
|
|
2137
|
+
];
|
|
2138
|
+
if (t) {
|
|
2139
|
+
let e = new Set(t);
|
|
2140
|
+
c = c.filter((t) => e.has(t.key));
|
|
2141
|
+
}
|
|
2142
|
+
return r > 0 && c.splice(1, 0, {
|
|
2143
|
+
key: "changeRequests",
|
|
2144
|
+
title: "Change Requests",
|
|
2145
|
+
badgeColor: "var(--cw-color-warn, #ed6c02)",
|
|
2146
|
+
content: D("changeRequests", /* @__PURE__ */ N(Te, {
|
|
2147
|
+
requests: g.changeRequests,
|
|
2148
|
+
employeeId: e,
|
|
2149
|
+
loading: g.loading,
|
|
2150
|
+
onReviewFields: g.reviewFields,
|
|
2151
|
+
onApproveAll: g.approveAllFields,
|
|
2152
|
+
onReviewPhoto: g.reviewPhoto,
|
|
2153
|
+
currentImage: u.employeeImage
|
|
2154
|
+
}))
|
|
2155
|
+
}), c;
|
|
2156
|
+
}, [
|
|
2157
|
+
C,
|
|
2158
|
+
u,
|
|
2159
|
+
g,
|
|
2160
|
+
D,
|
|
2161
|
+
t,
|
|
2162
|
+
n,
|
|
2163
|
+
a,
|
|
2164
|
+
o,
|
|
2165
|
+
s,
|
|
2166
|
+
l
|
|
2167
|
+
]), j = C ? `${C.firstName?.[0] ?? ""}${C.lastName?.[0] ?? ""}`.toUpperCase() : "", F = C ? /* @__PURE__ */ P("article", {
|
|
2168
|
+
className: Y.detailPanel,
|
|
2169
|
+
children: [/* @__PURE__ */ P("header", { children: [
|
|
2170
|
+
/* @__PURE__ */ N("figure", { children: u.employeeImage ? /* @__PURE__ */ N("img", {
|
|
2171
|
+
src: u.employeeImage,
|
|
2172
|
+
alt: `${C.firstName} ${C.lastName}`,
|
|
2173
|
+
style: { cursor: "pointer" },
|
|
2174
|
+
onClick: () => ce(u.employeeImage)
|
|
2175
|
+
}) : j }),
|
|
2176
|
+
/* @__PURE__ */ P("div", {
|
|
2177
|
+
className: Y.detailHeaderInfo,
|
|
2178
|
+
children: [/* @__PURE__ */ P("h3", {
|
|
2179
|
+
"data-testid": "employee-detail-name",
|
|
2180
|
+
children: [
|
|
2181
|
+
C.lastName,
|
|
2182
|
+
", ",
|
|
2183
|
+
C.firstName
|
|
2184
|
+
]
|
|
2185
|
+
}), /* @__PURE__ */ P("p", {
|
|
2186
|
+
"data-testid": "employee-detail-summary",
|
|
2187
|
+
children: [
|
|
2188
|
+
C.letterCode,
|
|
2189
|
+
" · ",
|
|
2190
|
+
C.empNr,
|
|
2191
|
+
" · ",
|
|
2192
|
+
C.functionName,
|
|
2193
|
+
C.homebaseIcao && /* @__PURE__ */ P(M, { children: [" · ", C.homebaseIcao] }),
|
|
2194
|
+
!C.active && /* @__PURE__ */ P(M, { children: [" · ", /* @__PURE__ */ N(i, {
|
|
2195
|
+
label: "Inactive",
|
|
2196
|
+
colorScheme: "danger"
|
|
2197
|
+
})] })
|
|
2198
|
+
]
|
|
2199
|
+
})]
|
|
2200
|
+
}),
|
|
2201
|
+
/* @__PURE__ */ P("div", {
|
|
2202
|
+
className: "cw-flex-row cw-gap-small",
|
|
2203
|
+
children: [/* @__PURE__ */ N(r, {
|
|
2204
|
+
variant: "outline",
|
|
2205
|
+
color: "primary",
|
|
2206
|
+
text: "Edit",
|
|
2207
|
+
onClick: d.openEditModal,
|
|
2208
|
+
"data-testid": "employee-edit-button"
|
|
2209
|
+
}), /* @__PURE__ */ N(r, {
|
|
2210
|
+
variant: "solid",
|
|
2211
|
+
color: C.active ? "danger" : "primary",
|
|
2212
|
+
"data-testid": "employee-toggle-active-button",
|
|
2213
|
+
text: C.active ? "Deactivate" : "Activate",
|
|
2214
|
+
onClick: async () => {
|
|
2215
|
+
try {
|
|
2216
|
+
C.active ? await u.deactivateEmployee(C.id) : await u.activateEmployee(C.id);
|
|
2217
|
+
} catch {
|
|
2218
|
+
c("Failed to update employee status", m.ERROR, 5e3);
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
})]
|
|
2222
|
+
})
|
|
2223
|
+
] }), /* @__PURE__ */ N("div", {
|
|
2224
|
+
className: Y.tabBody,
|
|
2225
|
+
children: u.detailLoading ? /* @__PURE__ */ N(f, {}) : /* @__PURE__ */ N(b, {
|
|
2226
|
+
tabs: A,
|
|
2227
|
+
defaultActiveKey: d.activeTab,
|
|
2228
|
+
onTabClick: T
|
|
2229
|
+
}, C.id)
|
|
2230
|
+
})]
|
|
2231
|
+
}) : void 0, I = /* @__PURE__ */ N(ne, {
|
|
2232
|
+
icon: "user-solid",
|
|
2233
|
+
color: "transparent",
|
|
2234
|
+
content: "Select an employee to view details",
|
|
2235
|
+
subtitle: "Choose from the list on the left"
|
|
2236
|
+
});
|
|
2237
|
+
return u.loading ? /* @__PURE__ */ N(f, {}) : /* @__PURE__ */ P("div", {
|
|
2238
|
+
className: Y.container,
|
|
2239
|
+
children: [
|
|
2240
|
+
/* @__PURE__ */ P("header", {
|
|
2241
|
+
className: Y.topBar,
|
|
2242
|
+
children: [/* @__PURE__ */ N("h2", { children: "Employees" }), /* @__PURE__ */ N("div", { children: /* @__PURE__ */ N(r, {
|
|
2243
|
+
text: "Add Employee",
|
|
2244
|
+
onClick: d.openAddModal,
|
|
2245
|
+
icon: "plus",
|
|
2246
|
+
"data-testid": "employee-add-button"
|
|
2247
|
+
}) })]
|
|
2248
|
+
}),
|
|
2249
|
+
/* @__PURE__ */ N("div", {
|
|
2250
|
+
className: Y.masterContent,
|
|
2251
|
+
children: /* @__PURE__ */ N(p, {
|
|
2252
|
+
items: y,
|
|
2253
|
+
selectedKey: C ? String(C.id) : void 0,
|
|
2254
|
+
onSelect: x,
|
|
2255
|
+
detailContent: F,
|
|
2256
|
+
emptyDetail: I,
|
|
2257
|
+
searchPlaceholder: "Search name, code, employee no...",
|
|
2258
|
+
onSearch: d.setSearchQuery,
|
|
2259
|
+
masterHeader: /* @__PURE__ */ P("div", {
|
|
2260
|
+
className: Y.masterHeader,
|
|
2261
|
+
children: [/* @__PURE__ */ N("div", { children: /* @__PURE__ */ N(S, {
|
|
2262
|
+
checked: d.showInactive,
|
|
2263
|
+
labelText: "Show Inactive",
|
|
2264
|
+
onChange: () => d.setShowInactive((e) => !e)
|
|
2265
|
+
}) }), _.allTags.size > 0 && /* @__PURE__ */ N("div", { children: /* @__PURE__ */ N(h, {
|
|
2266
|
+
id: "employee-filter",
|
|
2267
|
+
allTags: _.allTags,
|
|
2268
|
+
selectedTags: _.selectedTags,
|
|
2269
|
+
onChangeSelectedTags: _.handleChangeSelectedTags
|
|
2270
|
+
}) })]
|
|
2271
|
+
}),
|
|
2272
|
+
masterFooter: /* @__PURE__ */ P(M, { children: [
|
|
2273
|
+
v.length,
|
|
2274
|
+
" employees · ",
|
|
2275
|
+
w,
|
|
2276
|
+
" active"
|
|
2277
|
+
] })
|
|
2278
|
+
})
|
|
2279
|
+
}),
|
|
2280
|
+
d.addModalOpen && u.dropdowns && /* @__PURE__ */ N(oe, {
|
|
2281
|
+
dropdowns: u.dropdowns,
|
|
2282
|
+
onClose: d.closeAddModal,
|
|
2283
|
+
onCheck3LC: e.check3LC.bind(e),
|
|
2284
|
+
onCreate: async (e) => {
|
|
2285
|
+
try {
|
|
2286
|
+
let t = await u.createEmployee(e);
|
|
2287
|
+
d.closeAddModal(), u.selectEmployee(t.id);
|
|
2288
|
+
} catch {
|
|
2289
|
+
c("Failed to create employee", m.ERROR, 5e3);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
}),
|
|
2293
|
+
d.editModalOpen && C && u.selectedEmployee && u.dropdowns && /* @__PURE__ */ N(le, {
|
|
2294
|
+
employee: u.selectedEmployee,
|
|
2295
|
+
dropdowns: u.dropdowns,
|
|
2296
|
+
currentImage: u.employeeImage,
|
|
2297
|
+
onClose: d.closeEditModal,
|
|
2298
|
+
onSave: async (e) => {
|
|
2299
|
+
try {
|
|
2300
|
+
await u.updateEmployee(e), d.closeEditModal();
|
|
2301
|
+
} catch (e) {
|
|
2302
|
+
c(e instanceof Error ? e.message : "Failed to save employee", m.ERROR, 5e3);
|
|
2303
|
+
}
|
|
2304
|
+
},
|
|
2305
|
+
onUploadImage: u.uploadEmployeeImage,
|
|
2306
|
+
onDeleteImage: u.deleteEmployeeImage
|
|
2307
|
+
})
|
|
2308
|
+
]
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
//#endregion
|
|
2312
|
+
//#region src/presentation/dietary/parsers/catalogSuggestions.ts
|
|
2313
|
+
var ke = 6;
|
|
2314
|
+
function Ae(e, t, n, r, i = ke) {
|
|
2315
|
+
let a = n.trim().toLowerCase();
|
|
2316
|
+
return a.length === 0 ? [] : e.filter((e) => e.itemType === t && !r.includes(e.id) && e.name.toLowerCase().includes(a)).slice(0, i);
|
|
2317
|
+
}
|
|
2318
|
+
function je(e, t, n) {
|
|
2319
|
+
let r = n.trim().toLowerCase();
|
|
2320
|
+
return e.find((e) => e.itemType === t && e.name.toLowerCase() === r)?.id ?? null;
|
|
2321
|
+
}
|
|
2322
|
+
//#endregion
|
|
2323
|
+
//#region src/presentation/dietary/comps/DietaryEntryDialog.tsx
|
|
2324
|
+
var Me = {
|
|
2325
|
+
name: "",
|
|
2326
|
+
isCritical: !1,
|
|
2327
|
+
remarks: ""
|
|
2328
|
+
};
|
|
2329
|
+
function Ne({ open: e, itemType: t, catalog: n, assignedItemIds: i, editing: a, saving: s, onSave: c, onClose: l }) {
|
|
2330
|
+
let [u, f] = j(Me), p = (e) => f((t) => ({
|
|
2331
|
+
...t,
|
|
2332
|
+
...e
|
|
2333
|
+
}));
|
|
2334
|
+
O(() => {
|
|
2335
|
+
e && f(a ? {
|
|
2336
|
+
name: a.name,
|
|
2337
|
+
isCritical: a.isCritical,
|
|
2338
|
+
remarks: a.remarks
|
|
2339
|
+
} : Me);
|
|
2340
|
+
}, [e, a]);
|
|
2341
|
+
let m = t === "allergy", h = m ? "Allergy" : "Dietary need", g = Ae(n, t, u.name, i.filter((e) => e !== a?.itemId));
|
|
2342
|
+
return /* @__PURE__ */ N(o, {
|
|
2343
|
+
open: e,
|
|
2344
|
+
headline: a ? `Edit ${h}` : `Add ${h}`,
|
|
2345
|
+
width: "30rem",
|
|
2346
|
+
onClose: l,
|
|
2347
|
+
onSave: async () => {
|
|
2348
|
+
let e = u.name.trim();
|
|
2349
|
+
await c({
|
|
2350
|
+
itemId: je(n, t, e),
|
|
2351
|
+
name: e,
|
|
2352
|
+
itemType: t,
|
|
2353
|
+
isCritical: m ? u.isCritical : !1,
|
|
2354
|
+
remarks: u.remarks
|
|
2355
|
+
}) && l();
|
|
2356
|
+
},
|
|
2357
|
+
disableSave: s || u.name.trim().length === 0,
|
|
2358
|
+
"data-testid": "dietary-form-dialog",
|
|
2359
|
+
children: /* @__PURE__ */ P("div", {
|
|
2360
|
+
className: "cw-flex-column",
|
|
2361
|
+
"data-label-width": "7rem",
|
|
2362
|
+
children: [
|
|
2363
|
+
/* @__PURE__ */ N(d, {
|
|
2364
|
+
labelProps: { text: "Name" },
|
|
2365
|
+
value: u.name,
|
|
2366
|
+
onChange: (e) => p({ name: e.currentTarget.value }),
|
|
2367
|
+
feedback: {
|
|
2368
|
+
type: "neutral",
|
|
2369
|
+
message: `Pick an existing ${h.toLowerCase()} from the suggestions or type a new one.`
|
|
2370
|
+
},
|
|
2371
|
+
"data-testid": "dietary-form-name"
|
|
2372
|
+
}),
|
|
2373
|
+
g.length > 0 && /* @__PURE__ */ N("div", {
|
|
2374
|
+
className: "cw-flex-row cw-align-left-center",
|
|
2375
|
+
"data-testid": "dietary-form-suggestions",
|
|
2376
|
+
children: g.map((e) => /* @__PURE__ */ N(r, {
|
|
2377
|
+
variant: "outline",
|
|
2378
|
+
color: "neutral",
|
|
2379
|
+
text: e.name,
|
|
2380
|
+
onClick: () => p({ name: e.name }),
|
|
2381
|
+
"data-testid": `dietary-form-suggestion-${e.id}`
|
|
2382
|
+
}, e.id))
|
|
2383
|
+
}),
|
|
2384
|
+
m && /* @__PURE__ */ N(S, {
|
|
2385
|
+
labelProps: { text: "Critical" },
|
|
2386
|
+
checked: u.isCritical,
|
|
2387
|
+
onChange: (e) => p({ isCritical: e.currentTarget.checked }),
|
|
2388
|
+
"data-testid": "dietary-form-critical"
|
|
2389
|
+
}),
|
|
2390
|
+
/* @__PURE__ */ N(x, {
|
|
2391
|
+
labelProps: { text: "Remarks" },
|
|
2392
|
+
value: u.remarks,
|
|
2393
|
+
onChange: (e) => p({ remarks: e.currentTarget.value })
|
|
2394
|
+
})
|
|
2395
|
+
]
|
|
2396
|
+
})
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
//#endregion
|
|
2400
|
+
//#region src/presentation/dietary/comps/DietarySection.tsx
|
|
2401
|
+
function Pe({ itemType: e, title: t, dietary: a }) {
|
|
2402
|
+
let [o, s] = j(!1), [c, l] = j(null), [u, d] = j(null), f = e === "allergy", p = f ? "dietary-allergies" : "dietary-needs", m = f ? "allergy" : "dietary need", h = a.entries.filter((t) => t.itemType === e).sort((e, t) => Number(t.isCritical) - Number(e.isCritical) || e.name.localeCompare(t.name)), g = () => {
|
|
2403
|
+
l(null), s(!0);
|
|
2404
|
+
}, _ = (e) => {
|
|
2405
|
+
l(e), s(!0);
|
|
2406
|
+
};
|
|
2407
|
+
return /* @__PURE__ */ P("section", {
|
|
2408
|
+
"data-testid": p,
|
|
2409
|
+
children: [
|
|
2410
|
+
/* @__PURE__ */ P("header", {
|
|
2411
|
+
className: "cw-flex-row cw-align-left-center cw-margin-bottom-regular",
|
|
2412
|
+
children: [/* @__PURE__ */ N("h5", {
|
|
2413
|
+
className: "cw-flex-grow cw-margin-none",
|
|
2414
|
+
children: t
|
|
2415
|
+
}), /* @__PURE__ */ N(r, {
|
|
2416
|
+
text: `Add ${m}`,
|
|
2417
|
+
icon: "plus",
|
|
2418
|
+
onClick: g,
|
|
2419
|
+
"data-testid": `${p}-add-button`
|
|
2420
|
+
})]
|
|
2421
|
+
}),
|
|
2422
|
+
/* @__PURE__ */ N(y, {
|
|
2423
|
+
testId: `grid-${p}`,
|
|
2424
|
+
columns: [
|
|
2425
|
+
{
|
|
2426
|
+
key: "actions",
|
|
2427
|
+
title: "",
|
|
2428
|
+
className: "cw-table-col-action cw-table-col-buttons",
|
|
2429
|
+
render: (e) => /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(r, {
|
|
2430
|
+
variant: "icon",
|
|
2431
|
+
icon: "edit",
|
|
2432
|
+
onClick: () => _(e),
|
|
2433
|
+
"data-testid": `${p}-row-${e.id}-edit`
|
|
2434
|
+
}), /* @__PURE__ */ N(r, {
|
|
2435
|
+
variant: "icon",
|
|
2436
|
+
icon: "delete",
|
|
2437
|
+
color: "danger",
|
|
2438
|
+
onClick: () => d(e),
|
|
2439
|
+
"data-testid": `${p}-row-${e.id}-delete`
|
|
2440
|
+
})] })
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
key: "name",
|
|
2444
|
+
title: "Name",
|
|
2445
|
+
dataIndex: "name",
|
|
2446
|
+
className: "cw-table-col-medium",
|
|
2447
|
+
render: (e) => /* @__PURE__ */ P("span", {
|
|
2448
|
+
className: "cw-flex-row cw-align-left-center cw-gap-small",
|
|
2449
|
+
"data-testid": `${p}-row-${e.id}`,
|
|
2450
|
+
children: [e.name, e.isCritical && /* @__PURE__ */ N(i, {
|
|
2451
|
+
label: "Critical",
|
|
2452
|
+
colorScheme: "danger"
|
|
2453
|
+
})]
|
|
2454
|
+
})
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
key: "remarks",
|
|
2458
|
+
title: "Remarks",
|
|
2459
|
+
dataIndex: "remarks",
|
|
2460
|
+
className: "cw-table-col-grow"
|
|
2461
|
+
}
|
|
2462
|
+
],
|
|
2463
|
+
data: h,
|
|
2464
|
+
rowKey: "id"
|
|
2465
|
+
}),
|
|
2466
|
+
/* @__PURE__ */ N(Ne, {
|
|
2467
|
+
open: o,
|
|
2468
|
+
itemType: e,
|
|
2469
|
+
catalog: a.catalog,
|
|
2470
|
+
assignedItemIds: a.entries.map((e) => e.itemId),
|
|
2471
|
+
editing: c,
|
|
2472
|
+
saving: a.saving,
|
|
2473
|
+
onSave: (e) => c ? a.update(c.id, e) : a.create(e),
|
|
2474
|
+
onClose: () => s(!1)
|
|
2475
|
+
}),
|
|
2476
|
+
u && /* @__PURE__ */ N(n, {
|
|
2477
|
+
open: !0,
|
|
2478
|
+
headline: `Delete ${m}`,
|
|
2479
|
+
message: `Delete "${u.name}"?`,
|
|
2480
|
+
onDelete: async () => {
|
|
2481
|
+
await a.remove(u.id), d(null);
|
|
2482
|
+
},
|
|
2483
|
+
onClose: () => d(null)
|
|
2484
|
+
})
|
|
2485
|
+
]
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
//#endregion
|
|
2489
|
+
//#region src/presentation/dietary/hooks/useDietary.ts
|
|
2490
|
+
function Q(e) {
|
|
2491
|
+
return e instanceof Error ? e.message : "Operation failed";
|
|
2492
|
+
}
|
|
2493
|
+
function Fe(e) {
|
|
2494
|
+
let [t, n] = j([]), [r, i] = j([]), [a, o] = j(!1), [s, l] = j(0);
|
|
2495
|
+
O(() => {
|
|
2496
|
+
let t = !1;
|
|
2497
|
+
return (async () => {
|
|
2498
|
+
try {
|
|
2499
|
+
o(!0);
|
|
2500
|
+
let [r, a] = await Promise.all([e.getEntries(), e.getCatalog()]);
|
|
2501
|
+
t || (n(r), i(a));
|
|
2502
|
+
} catch (e) {
|
|
2503
|
+
t || (n([]), i([]), c(Q(e), m.ERROR, 3e3));
|
|
2504
|
+
} finally {
|
|
2505
|
+
t || o(!1);
|
|
2506
|
+
}
|
|
2507
|
+
})(), () => {
|
|
2508
|
+
t = !0;
|
|
2509
|
+
};
|
|
2510
|
+
}, [e]);
|
|
2511
|
+
let u = E((e) => {
|
|
2512
|
+
i((t) => t.some((t) => t.id === e.itemId) ? t : [...t, {
|
|
2513
|
+
id: e.itemId,
|
|
2514
|
+
name: e.name,
|
|
2515
|
+
itemType: e.itemType
|
|
2516
|
+
}]);
|
|
2517
|
+
}, []), d = E(async (t) => {
|
|
2518
|
+
try {
|
|
2519
|
+
l((e) => e + 1);
|
|
2520
|
+
let r = await e.createEntry(t);
|
|
2521
|
+
return n((e) => [...e, r]), u(r), c("Saved successfully", m.SUCCESS), !0;
|
|
2522
|
+
} catch (e) {
|
|
2523
|
+
return c(Q(e), m.ERROR, 3e3), !1;
|
|
2524
|
+
} finally {
|
|
2525
|
+
l((e) => Math.max(0, e - 1));
|
|
2526
|
+
}
|
|
2527
|
+
}, [e, u]), f = E(async (t, r) => {
|
|
2528
|
+
try {
|
|
2529
|
+
l((e) => e + 1);
|
|
2530
|
+
let i = await e.updateEntry(t, r);
|
|
2531
|
+
return n((e) => e.map((e) => e.id === t ? i : e)), u(i), c("Saved successfully", m.SUCCESS), !0;
|
|
2532
|
+
} catch (e) {
|
|
2533
|
+
return c(Q(e), m.ERROR, 3e3), !1;
|
|
2534
|
+
} finally {
|
|
2535
|
+
l((e) => Math.max(0, e - 1));
|
|
2536
|
+
}
|
|
2537
|
+
}, [e, u]), p = E(async (t) => {
|
|
2538
|
+
try {
|
|
2539
|
+
l((e) => e + 1), await e.deleteEntry(t), n((e) => e.filter((e) => e.id !== t)), c("Deleted", m.SUCCESS);
|
|
2540
|
+
} catch (e) {
|
|
2541
|
+
c(Q(e), m.ERROR, 3e3);
|
|
2542
|
+
} finally {
|
|
2543
|
+
l((e) => Math.max(0, e - 1));
|
|
2544
|
+
}
|
|
2545
|
+
}, [e]);
|
|
2546
|
+
return {
|
|
2547
|
+
entries: t,
|
|
2548
|
+
catalog: r,
|
|
2549
|
+
loading: a,
|
|
2550
|
+
saving: s > 0,
|
|
2551
|
+
create: d,
|
|
2552
|
+
update: f,
|
|
2553
|
+
remove: p
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
//#endregion
|
|
2557
|
+
//#region src/presentation/dietary/DietaryPage.tsx
|
|
2558
|
+
var Ie = /* @__PURE__ */ I({
|
|
2559
|
+
DietaryPage: () => Le,
|
|
2560
|
+
DietaryPageWithParams: () => $
|
|
2561
|
+
});
|
|
2562
|
+
function $({ baseUrl: e, employeeId: t }) {
|
|
2563
|
+
let n = Fe(k(() => new U(e, t ?? "me"), [e, t]));
|
|
2564
|
+
return /* @__PURE__ */ N("section", {
|
|
2565
|
+
className: "cw-flex-column",
|
|
2566
|
+
"data-testid": "dietary-page",
|
|
2567
|
+
children: n.loading ? /* @__PURE__ */ N(f, { size: "small" }) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(Pe, {
|
|
2568
|
+
itemType: "dietaryNeed",
|
|
2569
|
+
title: "Dietary needs",
|
|
2570
|
+
dietary: n
|
|
2571
|
+
}), /* @__PURE__ */ N(Pe, {
|
|
2572
|
+
itemType: "allergy",
|
|
2573
|
+
title: "Allergies",
|
|
2574
|
+
dietary: n
|
|
2575
|
+
})] })
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
function Le({ baseUrl: e, employeeId: t }) {
|
|
2579
|
+
return /* @__PURE__ */ N("div", {
|
|
2580
|
+
className: "cw-page-container-react cw-flex-column",
|
|
2581
|
+
"data-testid": "dietary-page-container",
|
|
2582
|
+
children: /* @__PURE__ */ N($, {
|
|
2583
|
+
baseUrl: e,
|
|
2584
|
+
employeeId: t
|
|
2585
|
+
})
|
|
2586
|
+
});
|
|
2587
|
+
}
|
|
2588
|
+
//#endregion
|
|
2589
|
+
//#region src/index.ts
|
|
2590
|
+
var Re = "0.0.1";
|
|
2591
|
+
//#endregion
|
|
2592
|
+
export { G as DialogShellProvider, Le as DietaryPage, $ as DietaryPageWithParams, U as DietaryRepositoryImpl, Oe as EmployeeOverview, L as EmployeeRepositoryImpl, Re as SHARED_EMPLOYEE_VERSION };
|