@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.
Files changed (75) hide show
  1. package/dist/AccountingRulesTab-CdYj-dz8.js +84 -0
  2. package/dist/AccountingRulesTab-DQJ7nD71.cjs +1 -0
  3. package/dist/AdditionalInfoTab-DW-S373w.cjs +1 -0
  4. package/dist/AdditionalInfoTab-j-Ixuvog.js +114 -0
  5. package/dist/App.d.ts +3 -0
  6. package/dist/ChangeRequestsTab-CFCWKZkt.js +342 -0
  7. package/dist/ChangeRequestsTab-CY7-qObu.cjs +1 -0
  8. package/dist/CosmicRadiationTab-6fqnDLH3.cjs +1 -0
  9. package/dist/CosmicRadiationTab-CLlfjJNA.js +120 -0
  10. package/dist/DeleteDialog-BqXtjGGi.cjs +1 -0
  11. package/dist/DeleteDialog-CyRsLr_c.js +21 -0
  12. package/dist/DetailsTab-DKFAMvlW.cjs +1 -0
  13. package/dist/DetailsTab-Dh1lfSr2.js +248 -0
  14. package/dist/DivisionsTab--eEVFupH.cjs +1 -0
  15. package/dist/DivisionsTab-BfIIZ_ld.js +86 -0
  16. package/dist/FunctionsTab-BMWoqfK2.js +160 -0
  17. package/dist/FunctionsTab-DQPsK0rq.cjs +1 -0
  18. package/dist/HistoryTab-CViMxBYc.cjs +1 -0
  19. package/dist/HistoryTab-CwCD46f3.js +277 -0
  20. package/dist/LanguagesTab-BKa7nmoT.cjs +1 -0
  21. package/dist/LanguagesTab-BznJDDXK.js +181 -0
  22. package/dist/RelatedPersonsTab-C-6ti_Be.js +260 -0
  23. package/dist/RelatedPersonsTab-DgoBLK21.cjs +1 -0
  24. package/dist/VaccinesTab-BGhy3EgY.cjs +1 -0
  25. package/dist/VaccinesTab-BtdAXAyo.js +171 -0
  26. package/dist/context/DialogShellContext.d.ts +22 -0
  27. package/dist/dateUtils-BULQTXVb.cjs +1 -0
  28. package/dist/dateUtils-CTu1RDq1.js +25 -0
  29. package/dist/domain/model/ChangeRequest.d.ts +23 -0
  30. package/dist/domain/model/Dietary.d.ts +24 -0
  31. package/dist/domain/model/EmployeeDetail.d.ts +89 -0
  32. package/dist/domain/model/EmployeeDropdowns.d.ts +31 -0
  33. package/dist/domain/model/EmployeeListItem.d.ts +15 -0
  34. package/dist/domain/model/EmployeeTabModels.d.ts +91 -0
  35. package/dist/domain/repository/DietaryRepository.d.ts +8 -0
  36. package/dist/domain/repository/EmployeeRepository.d.ts +62 -0
  37. package/dist/index.d.ts +18 -0
  38. package/dist/infrastructure/DietaryRepositoryImpl.d.ts +20 -0
  39. package/dist/infrastructure/EmployeeRepositoryImpl.d.ts +74 -0
  40. package/dist/infrastructure/dto/DietaryDto.d.ts +26 -0
  41. package/dist/main.d.ts +1 -0
  42. package/dist/presentation/EmployeeOverview.d.ts +18 -0
  43. package/dist/presentation/common/DeleteDialog.d.ts +16 -0
  44. package/dist/presentation/common/EmptyState.d.ts +11 -0
  45. package/dist/presentation/common/LazyImage.d.ts +15 -0
  46. package/dist/presentation/common/useLazyTabs.d.ts +14 -0
  47. package/dist/presentation/comps/modals/AddEmployeeModal.d.ts +10 -0
  48. package/dist/presentation/comps/modals/EditEmployeeModal.d.ts +13 -0
  49. package/dist/presentation/comps/tabs/AccountingRulesTab.d.ts +10 -0
  50. package/dist/presentation/comps/tabs/AdditionalInfoTab.d.ts +12 -0
  51. package/dist/presentation/comps/tabs/ChangeRequestsTab.d.ts +16 -0
  52. package/dist/presentation/comps/tabs/CosmicRadiationTab.d.ts +8 -0
  53. package/dist/presentation/comps/tabs/DetailsTab.d.ts +8 -0
  54. package/dist/presentation/comps/tabs/DivisionsTab.d.ts +11 -0
  55. package/dist/presentation/comps/tabs/FunctionsTab.d.ts +13 -0
  56. package/dist/presentation/comps/tabs/HistoryTab.d.ts +15 -0
  57. package/dist/presentation/comps/tabs/LanguagesTab.d.ts +13 -0
  58. package/dist/presentation/comps/tabs/RelatedPersonsTab.d.ts +13 -0
  59. package/dist/presentation/comps/tabs/VaccinesTab.d.ts +12 -0
  60. package/dist/presentation/dietary/DietaryPage.d.ts +9 -0
  61. package/dist/presentation/dietary/comps/DietaryEntryDialog.d.ts +13 -0
  62. package/dist/presentation/dietary/comps/DietarySection.d.ts +8 -0
  63. package/dist/presentation/dietary/hooks/useDietary.d.ts +12 -0
  64. package/dist/presentation/dietary/parsers/catalogSuggestions.d.ts +12 -0
  65. package/dist/presentation/hooks/data/useChangeRequests.d.ts +17 -0
  66. package/dist/presentation/hooks/data/useEmployeeData.d.ts +79 -0
  67. package/dist/presentation/hooks/data/useEmployeeFilters.d.ts +10 -0
  68. package/dist/presentation/hooks/ui/useEmployeeOverviewUI.d.ts +15 -0
  69. package/dist/presentation/parsers/dateUtils.d.ts +12 -0
  70. package/dist/presentation/parsers/employeeParsers.d.ts +3 -0
  71. package/dist/presentation/parsers/imageUtils.d.ts +1 -0
  72. package/dist/shared-employee.cjs.js +1 -0
  73. package/dist/shared-employee.css +2 -0
  74. package/dist/shared-employee.es.js +2592 -0
  75. package/package.json +58 -0
@@ -0,0 +1,260 @@
1
+ import { a as e, i as t, r as n } from "./dateUtils-CTu1RDq1.js";
2
+ import { t as r } from "./DeleteDialog-CyRsLr_c.js";
3
+ import { CwButton as i, CwChip as a, CwDatePicker as o, CwDialog as s, CwDisplayMessage as c, CwInputText as l, CwMessageType as u, CwOption as d, CwSelect as f, CwTable as p } from "@cwellt_software/cwellt-reactjs-lib";
4
+ import { useState as m } from "react";
5
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
6
+ //#region src/presentation/comps/tabs/RelatedPersonsTab.tsx
7
+ var v = [
8
+ "MR",
9
+ "MRS",
10
+ "MS",
11
+ "CHD",
12
+ "INF"
13
+ ];
14
+ function y({ items: y, employeeId: b, relationTypes: x, onCreate: S, onUpdate: C, onDelete: w, onConfirm: T }) {
15
+ let [E, D] = m(!1), [O, k] = m(null), [A, j] = m(null), [M, N] = m({
16
+ salutation: "MR",
17
+ firstName: "",
18
+ middleName: "",
19
+ lastName: "",
20
+ gender: "M",
21
+ relationTypeId: null,
22
+ birthdate: void 0,
23
+ confirmed: !1
24
+ }), P = () => {
25
+ k(null), N({
26
+ salutation: "MR",
27
+ firstName: "",
28
+ middleName: "",
29
+ lastName: "",
30
+ gender: "M",
31
+ relationTypeId: null,
32
+ birthdate: void 0,
33
+ confirmed: !1
34
+ }), D(!0);
35
+ }, F = (t) => {
36
+ k(t), N({
37
+ salutation: t.salutation,
38
+ firstName: t.firstName,
39
+ middleName: t.middleName,
40
+ lastName: t.lastName,
41
+ gender: t.gender,
42
+ relationTypeId: t.relationTypeId,
43
+ birthdate: e(t.birthdate),
44
+ confirmed: t.confirmed
45
+ }), D(!0);
46
+ }, I = async () => {
47
+ if (!M.firstName || !M.lastName || !M.relationTypeId) {
48
+ c("First Name, Last Name and Relation Type are required", u.WARN, 5e3);
49
+ return;
50
+ }
51
+ try {
52
+ let e = t(M.birthdate);
53
+ O ? await C({
54
+ ...O,
55
+ ...M,
56
+ birthdate: e,
57
+ relationTypeId: M.relationTypeId
58
+ }) : await S({
59
+ ...M,
60
+ birthdate: e,
61
+ relationTypeId: M.relationTypeId,
62
+ employeeId: b
63
+ }), D(!1);
64
+ } catch {
65
+ c("Failed to save", u.ERROR, 5e3);
66
+ }
67
+ }, L = async (e) => {
68
+ try {
69
+ await T(e);
70
+ } catch {
71
+ c("Failed to confirm", u.ERROR, 5e3);
72
+ }
73
+ };
74
+ return /* @__PURE__ */ _("section", { children: [
75
+ /* @__PURE__ */ g("header", {
76
+ className: "cw-flex-row cw-margin-bottom-small",
77
+ children: /* @__PURE__ */ g(i, {
78
+ text: "Add",
79
+ icon: "plus",
80
+ onClick: P,
81
+ "data-testid": "tab-related-persons-add-button"
82
+ })
83
+ }),
84
+ /* @__PURE__ */ g(p, {
85
+ columns: [
86
+ {
87
+ key: "actions",
88
+ title: "",
89
+ className: "cw-table-col-action cw-table-col-buttons",
90
+ render: (e) => /* @__PURE__ */ _(h, { children: [
91
+ !e.confirmed && /* @__PURE__ */ g(i, {
92
+ variant: "icon",
93
+ icon: "check-small",
94
+ color: "primary",
95
+ title: "Confirm",
96
+ onClick: () => L(e.id),
97
+ "data-testid": `tab-related-persons-row-${e.id}-confirm`
98
+ }),
99
+ /* @__PURE__ */ g(i, {
100
+ variant: "icon",
101
+ icon: "edit",
102
+ onClick: () => F(e),
103
+ "data-testid": `tab-related-persons-row-${e.id}-edit`
104
+ }),
105
+ /* @__PURE__ */ g(i, {
106
+ variant: "icon",
107
+ icon: "delete",
108
+ color: "danger",
109
+ onClick: () => j(e),
110
+ "data-testid": `tab-related-persons-row-${e.id}-delete`
111
+ })
112
+ ] })
113
+ },
114
+ {
115
+ key: "salutation",
116
+ title: "Salutation",
117
+ dataIndex: "salutation"
118
+ },
119
+ {
120
+ key: "firstName",
121
+ title: "First Name",
122
+ dataIndex: "firstName"
123
+ },
124
+ {
125
+ key: "lastName",
126
+ title: "Last Name",
127
+ dataIndex: "lastName",
128
+ render: (e) => /* @__PURE__ */ g("span", {
129
+ "data-testid": `tab-related-persons-row-${e.id}`,
130
+ children: e.lastName
131
+ })
132
+ },
133
+ {
134
+ key: "relationTypeName",
135
+ title: "Relation",
136
+ dataIndex: "relationTypeName"
137
+ },
138
+ {
139
+ key: "birthdate",
140
+ title: "Birthdate",
141
+ dataIndex: "birthdate",
142
+ render: (e) => n(e.birthdate)
143
+ },
144
+ {
145
+ key: "confirmed",
146
+ title: "Confirmed",
147
+ dataIndex: "confirmed",
148
+ render: (e) => /* @__PURE__ */ g(a, {
149
+ label: e.confirmed ? "Yes" : "No",
150
+ colorScheme: e.confirmed ? "success" : "danger"
151
+ })
152
+ }
153
+ ],
154
+ data: y,
155
+ rowKey: "id"
156
+ }),
157
+ /* @__PURE__ */ g(s, {
158
+ open: E,
159
+ headline: O ? "Edit Related Person" : "Add Related Person",
160
+ onClose: () => D(!1),
161
+ onSave: I,
162
+ disableSave: !M.firstName || !M.lastName || !M.relationTypeId,
163
+ width: "30rem",
164
+ children: /* @__PURE__ */ _("div", {
165
+ className: "cw-flex-column",
166
+ "data-label-width": "8rem",
167
+ children: [
168
+ /* @__PURE__ */ g(f, {
169
+ labelProps: { text: "Salutation" },
170
+ value: M.salutation,
171
+ onChange: (e) => {
172
+ let t = e.currentTarget.value;
173
+ N((e) => ({
174
+ ...e,
175
+ salutation: t
176
+ }));
177
+ },
178
+ children: v.map((e) => /* @__PURE__ */ g(d, {
179
+ value: e,
180
+ children: e
181
+ }, e))
182
+ }),
183
+ /* @__PURE__ */ g(l, {
184
+ labelProps: { text: "First Name" },
185
+ value: M.firstName,
186
+ onChange: (e) => {
187
+ let t = e.currentTarget.value;
188
+ N((e) => ({
189
+ ...e,
190
+ firstName: t
191
+ }));
192
+ },
193
+ required: !0,
194
+ "data-testid": "tab-related-persons-form-first-name"
195
+ }),
196
+ /* @__PURE__ */ g(l, {
197
+ labelProps: { text: "Middle Name" },
198
+ value: M.middleName,
199
+ onChange: (e) => {
200
+ let t = e.currentTarget.value;
201
+ N((e) => ({
202
+ ...e,
203
+ middleName: t
204
+ }));
205
+ }
206
+ }),
207
+ /* @__PURE__ */ g(l, {
208
+ labelProps: { text: "Last Name" },
209
+ value: M.lastName,
210
+ onChange: (e) => {
211
+ let t = e.currentTarget.value;
212
+ N((e) => ({
213
+ ...e,
214
+ lastName: t
215
+ }));
216
+ },
217
+ required: !0,
218
+ "data-testid": "tab-related-persons-form-last-name"
219
+ }),
220
+ /* @__PURE__ */ g(f, {
221
+ labelProps: { text: "Relation Type" },
222
+ value: M.relationTypeId == null ? "" : String(M.relationTypeId),
223
+ onChange: (e) => {
224
+ let t = e.currentTarget.value;
225
+ N((e) => ({
226
+ ...e,
227
+ relationTypeId: t ? Number(t) : null
228
+ }));
229
+ },
230
+ placeholder: "Select...",
231
+ "data-testid": "tab-related-persons-form-relation-type",
232
+ children: x.map((e) => /* @__PURE__ */ g(d, {
233
+ value: e.id,
234
+ children: e.name
235
+ }, e.id))
236
+ }),
237
+ /* @__PURE__ */ g(o, {
238
+ labelProps: { text: "Birthdate" },
239
+ value: M.birthdate,
240
+ onChange: (e) => N((t) => ({
241
+ ...t,
242
+ birthdate: e
243
+ }))
244
+ })
245
+ ]
246
+ })
247
+ }),
248
+ /* @__PURE__ */ g(r, {
249
+ open: A != null,
250
+ headline: "Delete Related Person",
251
+ message: `Delete "${A?.firstName} ${A?.lastName}"?`,
252
+ onDelete: async () => {
253
+ await w(A.id), j(null);
254
+ },
255
+ onClose: () => j(null)
256
+ })
257
+ ] });
258
+ }
259
+ //#endregion
260
+ export { y as RelatedPersonsTab };
@@ -0,0 +1 @@
1
+ const e=require("./dateUtils-BULQTXVb.cjs"),t=require("./DeleteDialog-BqXtjGGi.cjs");let n=require("@cwellt_software/cwellt-reactjs-lib"),r=require("react"),i=require("react/jsx-runtime");var a=[`MR`,`MRS`,`MS`,`CHD`,`INF`];function o({items:o,employeeId:s,relationTypes:c,onCreate:l,onUpdate:u,onDelete:d,onConfirm:f}){let[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)(null),[y,b]=(0,r.useState)({salutation:`MR`,firstName:``,middleName:``,lastName:``,gender:`M`,relationTypeId:null,birthdate:void 0,confirmed:!1}),x=()=>{g(null),b({salutation:`MR`,firstName:``,middleName:``,lastName:``,gender:`M`,relationTypeId:null,birthdate:void 0,confirmed:!1}),m(!0)},S=t=>{g(t),b({salutation:t.salutation,firstName:t.firstName,middleName:t.middleName,lastName:t.lastName,gender:t.gender,relationTypeId:t.relationTypeId,birthdate:e.a(t.birthdate),confirmed:t.confirmed}),m(!0)},C=async()=>{if(!y.firstName||!y.lastName||!y.relationTypeId){(0,n.CwDisplayMessage)(`First Name, Last Name and Relation Type are required`,n.CwMessageType.WARN,5e3);return}try{let t=e.i(y.birthdate);h?await u({...h,...y,birthdate:t,relationTypeId:y.relationTypeId}):await l({...y,birthdate:t,relationTypeId:y.relationTypeId,employeeId:s}),m(!1)}catch{(0,n.CwDisplayMessage)(`Failed to save`,n.CwMessageType.ERROR,5e3)}},w=async e=>{try{await f(e)}catch{(0,n.CwDisplayMessage)(`Failed to confirm`,n.CwMessageType.ERROR,5e3)}};return(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`header`,{className:`cw-flex-row cw-margin-bottom-small`,children:(0,i.jsx)(n.CwButton,{text:`Add`,icon:`plus`,onClick:x,"data-testid":`tab-related-persons-add-button`})}),(0,i.jsx)(n.CwTable,{columns:[{key:`actions`,title:``,className:`cw-table-col-action cw-table-col-buttons`,render:e=>(0,i.jsxs)(i.Fragment,{children:[!e.confirmed&&(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`check-small`,color:`primary`,title:`Confirm`,onClick:()=>w(e.id),"data-testid":`tab-related-persons-row-${e.id}-confirm`}),(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`edit`,onClick:()=>S(e),"data-testid":`tab-related-persons-row-${e.id}-edit`}),(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`delete`,color:`danger`,onClick:()=>v(e),"data-testid":`tab-related-persons-row-${e.id}-delete`})]})},{key:`salutation`,title:`Salutation`,dataIndex:`salutation`},{key:`firstName`,title:`First Name`,dataIndex:`firstName`},{key:`lastName`,title:`Last Name`,dataIndex:`lastName`,render:e=>(0,i.jsx)(`span`,{"data-testid":`tab-related-persons-row-${e.id}`,children:e.lastName})},{key:`relationTypeName`,title:`Relation`,dataIndex:`relationTypeName`},{key:`birthdate`,title:`Birthdate`,dataIndex:`birthdate`,render:t=>e.r(t.birthdate)},{key:`confirmed`,title:`Confirmed`,dataIndex:`confirmed`,render:e=>(0,i.jsx)(n.CwChip,{label:e.confirmed?`Yes`:`No`,colorScheme:e.confirmed?`success`:`danger`})}],data:o,rowKey:`id`}),(0,i.jsx)(n.CwDialog,{open:p,headline:h?`Edit Related Person`:`Add Related Person`,onClose:()=>m(!1),onSave:C,disableSave:!y.firstName||!y.lastName||!y.relationTypeId,width:`30rem`,children:(0,i.jsxs)(`div`,{className:`cw-flex-column`,"data-label-width":`8rem`,children:[(0,i.jsx)(n.CwSelect,{labelProps:{text:`Salutation`},value:y.salutation,onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,salutation:t}))},children:a.map(e=>(0,i.jsx)(n.CwOption,{value:e,children:e},e))}),(0,i.jsx)(n.CwInputText,{labelProps:{text:`First Name`},value:y.firstName,onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,firstName:t}))},required:!0,"data-testid":`tab-related-persons-form-first-name`}),(0,i.jsx)(n.CwInputText,{labelProps:{text:`Middle Name`},value:y.middleName,onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,middleName:t}))}}),(0,i.jsx)(n.CwInputText,{labelProps:{text:`Last Name`},value:y.lastName,onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,lastName:t}))},required:!0,"data-testid":`tab-related-persons-form-last-name`}),(0,i.jsx)(n.CwSelect,{labelProps:{text:`Relation Type`},value:y.relationTypeId==null?``:String(y.relationTypeId),onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,relationTypeId:t?Number(t):null}))},placeholder:`Select...`,"data-testid":`tab-related-persons-form-relation-type`,children:c.map(e=>(0,i.jsx)(n.CwOption,{value:e.id,children:e.name},e.id))}),(0,i.jsx)(n.CwDatePicker,{labelProps:{text:`Birthdate`},value:y.birthdate,onChange:e=>b(t=>({...t,birthdate:e}))})]})}),(0,i.jsx)(t.t,{open:_!=null,headline:`Delete Related Person`,message:`Delete "${_?.firstName} ${_?.lastName}"?`,onDelete:async()=>{await d(_.id),v(null)},onClose:()=>v(null)})]})}exports.RelatedPersonsTab=o;
@@ -0,0 +1 @@
1
+ const e=require("./dateUtils-BULQTXVb.cjs"),t=require("./DeleteDialog-BqXtjGGi.cjs");let n=require("@cwellt_software/cwellt-reactjs-lib"),r=require("react"),i=require("react/jsx-runtime");function a({items:a,employeeId:o,vaccines:s,onCreate:c,onUpdate:l,onDelete:u}){let[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)({vaccineId:null,startDate:void 0,endDate:void 0,endDateManuallyEdited:!1}),y=[...a].sort((e,t)=>(e.vaccineName??``).localeCompare(t.vaccineName??``)),b=t=>{if(t.endDateManuallyEdited)return t;let n=s.find(e=>e.id===t.vaccineId)?.validityYears??null;return n===null||!t.startDate?t:{...t,endDate:e.t(t.startDate,n)}},x=()=>{m(null),v({vaccineId:null,startDate:void 0,endDate:void 0,endDateManuallyEdited:!1}),f(!0)},S=t=>{m(t),v({vaccineId:t.vaccineId,startDate:e.a(t.startDate),endDate:e.a(t.endDate),endDateManuallyEdited:!0}),f(!0)};return(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`header`,{className:`cw-flex-row cw-margin-bottom-small`,children:(0,i.jsx)(n.CwButton,{text:`Add Vaccine`,icon:`plus`,onClick:x,"data-testid":`tab-vaccines-add-button`})}),(0,i.jsx)(n.CwTable,{columns:[{key:`actions`,title:``,className:`cw-table-col-action cw-table-col-buttons`,render:e=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`edit`,onClick:()=>S(e),"data-testid":`tab-vaccines-row-${e.id}-edit`}),(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`delete`,color:`danger`,onClick:()=>g(e),"data-testid":`tab-vaccines-row-${e.id}-delete`})]})},{key:`vaccineName`,title:`Vaccine`,dataIndex:`vaccineName`,render:e=>(0,i.jsx)(`span`,{"data-testid":`tab-vaccines-row-${e.id}`,children:e.vaccineName})},{key:`startDate`,title:`Start Date`,dataIndex:`startDate`,render:t=>e.r(t.startDate)},{key:`endDate`,title:`End Date`,dataIndex:`endDate`,render:t=>e.r(t.endDate)}],data:y,rowKey:`id`}),d&&(0,i.jsx)(n.CwDialog,{open:!0,headline:p?`Edit Vaccine`:`Add Vaccine`,onClose:()=>f(!1),onSave:async()=>{if(_.vaccineId)try{let t=e.i(_.startDate),n=e.i(_.endDate);if(p){let e=s.find(e=>e.id===_.vaccineId)?.name??p.vaccineName;await l({...p,vaccineId:_.vaccineId,startDate:t,endDate:n,vaccineName:e})}else await c({vaccineId:_.vaccineId,startDate:t,endDate:n,employeeId:o});f(!1)}catch{(0,n.CwDisplayMessage)(`Failed to save`,n.CwMessageType.ERROR,5e3)}},disableSave:!_.vaccineId,width:`30rem`,children:(0,i.jsxs)(`div`,{className:`cw-flex-column`,"data-label-width":`8rem`,children:[(0,i.jsx)(n.CwSelect,{labelProps:{text:`Vaccine`},value:_.vaccineId??``,onChange:e=>{let t=e.currentTarget.value;v(e=>b({...e,vaccineId:t||null}))},placeholder:`Select...`,"data-testid":`tab-vaccines-form-vaccine`,children:s.map(e=>(0,i.jsx)(n.CwOption,{value:e.id,children:e.name},e.id))}),(0,i.jsx)(n.CwDatePicker,{labelProps:{text:`Start Date`},value:_.startDate,onChange:e=>v(t=>b({...t,startDate:e}))}),(0,i.jsx)(n.CwDatePicker,{labelProps:{text:`End Date`},value:_.endDate,onChange:e=>v(t=>({...t,endDate:e,endDateManuallyEdited:!0}))})]})}),h&&(0,i.jsx)(t.t,{open:!0,headline:`Delete Vaccine`,message:`Delete "${h.vaccineName}"?`,onDelete:async()=>{await u(h.id),g(null)},onClose:()=>g(null)})]})}exports.VaccinesTab=a;
@@ -0,0 +1,171 @@
1
+ import { a as e, i as t, r as n, t as r } from "./dateUtils-CTu1RDq1.js";
2
+ import { t as i } from "./DeleteDialog-CyRsLr_c.js";
3
+ import { CwButton as a, CwDatePicker as o, CwDialog as s, CwDisplayMessage as c, CwMessageType as l, CwOption as u, CwSelect as d, CwTable as f } from "@cwellt_software/cwellt-reactjs-lib";
4
+ import { useState as p } from "react";
5
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
6
+ //#region src/presentation/comps/tabs/VaccinesTab.tsx
7
+ function _({ items: _, employeeId: v, vaccines: y, onCreate: b, onUpdate: x, onDelete: S }) {
8
+ let [C, w] = p(!1), [T, E] = p(null), [D, O] = p(null), [k, A] = p({
9
+ vaccineId: null,
10
+ startDate: void 0,
11
+ endDate: void 0,
12
+ endDateManuallyEdited: !1
13
+ }), j = [..._].sort((e, t) => (e.vaccineName ?? "").localeCompare(t.vaccineName ?? "")), M = (e) => {
14
+ if (e.endDateManuallyEdited) return e;
15
+ let t = y.find((t) => t.id === e.vaccineId)?.validityYears ?? null;
16
+ return t === null || !e.startDate ? e : {
17
+ ...e,
18
+ endDate: r(e.startDate, t)
19
+ };
20
+ }, N = () => {
21
+ E(null), A({
22
+ vaccineId: null,
23
+ startDate: void 0,
24
+ endDate: void 0,
25
+ endDateManuallyEdited: !1
26
+ }), w(!0);
27
+ }, P = (t) => {
28
+ E(t), A({
29
+ vaccineId: t.vaccineId,
30
+ startDate: e(t.startDate),
31
+ endDate: e(t.endDate),
32
+ endDateManuallyEdited: !0
33
+ }), w(!0);
34
+ };
35
+ return /* @__PURE__ */ g("section", { children: [
36
+ /* @__PURE__ */ h("header", {
37
+ className: "cw-flex-row cw-margin-bottom-small",
38
+ children: /* @__PURE__ */ h(a, {
39
+ text: "Add Vaccine",
40
+ icon: "plus",
41
+ onClick: N,
42
+ "data-testid": "tab-vaccines-add-button"
43
+ })
44
+ }),
45
+ /* @__PURE__ */ h(f, {
46
+ columns: [
47
+ {
48
+ key: "actions",
49
+ title: "",
50
+ className: "cw-table-col-action cw-table-col-buttons",
51
+ render: (e) => /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(a, {
52
+ variant: "icon",
53
+ icon: "edit",
54
+ onClick: () => P(e),
55
+ "data-testid": `tab-vaccines-row-${e.id}-edit`
56
+ }), /* @__PURE__ */ h(a, {
57
+ variant: "icon",
58
+ icon: "delete",
59
+ color: "danger",
60
+ onClick: () => O(e),
61
+ "data-testid": `tab-vaccines-row-${e.id}-delete`
62
+ })] })
63
+ },
64
+ {
65
+ key: "vaccineName",
66
+ title: "Vaccine",
67
+ dataIndex: "vaccineName",
68
+ render: (e) => /* @__PURE__ */ h("span", {
69
+ "data-testid": `tab-vaccines-row-${e.id}`,
70
+ children: e.vaccineName
71
+ })
72
+ },
73
+ {
74
+ key: "startDate",
75
+ title: "Start Date",
76
+ dataIndex: "startDate",
77
+ render: (e) => n(e.startDate)
78
+ },
79
+ {
80
+ key: "endDate",
81
+ title: "End Date",
82
+ dataIndex: "endDate",
83
+ render: (e) => n(e.endDate)
84
+ }
85
+ ],
86
+ data: j,
87
+ rowKey: "id"
88
+ }),
89
+ C && /* @__PURE__ */ h(s, {
90
+ open: !0,
91
+ headline: T ? "Edit Vaccine" : "Add Vaccine",
92
+ onClose: () => w(!1),
93
+ onSave: async () => {
94
+ if (k.vaccineId) try {
95
+ let e = t(k.startDate), n = t(k.endDate);
96
+ if (T) {
97
+ let t = y.find((e) => e.id === k.vaccineId)?.name ?? T.vaccineName;
98
+ await x({
99
+ ...T,
100
+ vaccineId: k.vaccineId,
101
+ startDate: e,
102
+ endDate: n,
103
+ vaccineName: t
104
+ });
105
+ } else await b({
106
+ vaccineId: k.vaccineId,
107
+ startDate: e,
108
+ endDate: n,
109
+ employeeId: v
110
+ });
111
+ w(!1);
112
+ } catch {
113
+ c("Failed to save", l.ERROR, 5e3);
114
+ }
115
+ },
116
+ disableSave: !k.vaccineId,
117
+ width: "30rem",
118
+ children: /* @__PURE__ */ g("div", {
119
+ className: "cw-flex-column",
120
+ "data-label-width": "8rem",
121
+ children: [
122
+ /* @__PURE__ */ h(d, {
123
+ labelProps: { text: "Vaccine" },
124
+ value: k.vaccineId ?? "",
125
+ onChange: (e) => {
126
+ let t = e.currentTarget.value;
127
+ A((e) => M({
128
+ ...e,
129
+ vaccineId: t || null
130
+ }));
131
+ },
132
+ placeholder: "Select...",
133
+ "data-testid": "tab-vaccines-form-vaccine",
134
+ children: y.map((e) => /* @__PURE__ */ h(u, {
135
+ value: e.id,
136
+ children: e.name
137
+ }, e.id))
138
+ }),
139
+ /* @__PURE__ */ h(o, {
140
+ labelProps: { text: "Start Date" },
141
+ value: k.startDate,
142
+ onChange: (e) => A((t) => M({
143
+ ...t,
144
+ startDate: e
145
+ }))
146
+ }),
147
+ /* @__PURE__ */ h(o, {
148
+ labelProps: { text: "End Date" },
149
+ value: k.endDate,
150
+ onChange: (e) => A((t) => ({
151
+ ...t,
152
+ endDate: e,
153
+ endDateManuallyEdited: !0
154
+ }))
155
+ })
156
+ ]
157
+ })
158
+ }),
159
+ D && /* @__PURE__ */ h(i, {
160
+ open: !0,
161
+ headline: "Delete Vaccine",
162
+ message: `Delete "${D.vaccineName}"?`,
163
+ onDelete: async () => {
164
+ await S(D.id), O(null);
165
+ },
166
+ onClose: () => O(null)
167
+ })
168
+ ] });
169
+ }
170
+ //#endregion
171
+ export { _ as VaccinesTab };
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface DialogShellProps {
3
+ open: boolean;
4
+ title: string;
5
+ /** Hint for the fallback CwDialog; the host shell decides its own sizing. */
6
+ width?: number | string;
7
+ onClose: () => void;
8
+ /** When set, the shell shows a save action. */
9
+ onSave?: () => void;
10
+ /** Disables the save action (e.g. while saving or when the form is invalid). */
11
+ disableSave?: boolean;
12
+ children?: ReactNode;
13
+ }
14
+ /**
15
+ * Renders one editing surface. A host (e.g. Improve) can provide its own drawer here — its native
16
+ * look for create/edit flows; without a provider the dialogs fall back to the standalone CwDialog
17
+ * popup from the shared component library. Same pattern as SharedTraining's DialogShell.
18
+ */
19
+ export type DialogShellRenderer = (props: DialogShellProps) => ReactNode;
20
+ export declare const DialogShellProvider: import("react").Provider<DialogShellRenderer | null>;
21
+ /** The employee module's dialog surface: host drawer when provided, CwDialog otherwise. */
22
+ export declare function DialogShell(props: DialogShellProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ function e(e){if(!e)return;let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)}function t(e){return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:null}function n(e,t){if(e)return new Date(e.getFullYear()+t,e.getMonth(),e.getDate())}function r(e){return e===`2099-12-31`}function i(e){return!e||r(e)?``:e}function a(e,t=``){if(!e||r(e))return t;let[n,i,a]=e.split(`-`).map(Number);return new Date(n,i-1,a).toLocaleDateString()}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
@@ -0,0 +1,25 @@
1
+ //#region src/presentation/parsers/dateUtils.ts
2
+ function e(e) {
3
+ if (!e) return;
4
+ let [t, n, r] = e.split("-").map(Number);
5
+ return new Date(t, n - 1, r);
6
+ }
7
+ function t(e) {
8
+ return e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : null;
9
+ }
10
+ function n(e, t) {
11
+ if (e) return new Date(e.getFullYear() + t, e.getMonth(), e.getDate());
12
+ }
13
+ function r(e) {
14
+ return e === "2099-12-31";
15
+ }
16
+ function i(e) {
17
+ return !e || r(e) ? "" : e;
18
+ }
19
+ function a(e, t = "") {
20
+ if (!e || r(e)) return t;
21
+ let [n, i, a] = e.split("-").map(Number);
22
+ return new Date(n, i - 1, a).toLocaleDateString();
23
+ }
24
+ //#endregion
25
+ export { e as a, t as i, i as n, a as r, n as t };
@@ -0,0 +1,23 @@
1
+ export interface FieldChange {
2
+ changeFieldId: number;
3
+ fieldName: string;
4
+ oldValue: string | null;
5
+ newValue: string | null;
6
+ status: string;
7
+ reviewedBy: string | null;
8
+ reviewedAt: string | null;
9
+ reviewComment: string | null;
10
+ }
11
+ export interface ChangeRequest {
12
+ id: number;
13
+ employeeId: number;
14
+ employeeName: string;
15
+ letterCode: string;
16
+ requestedBy: string;
17
+ requestedAt: string;
18
+ status: string;
19
+ changeType: string;
20
+ fields: FieldChange[];
21
+ photoPreviewBase64: string | null;
22
+ }
23
+ export type PendingCounts = Record<number, number>;
@@ -0,0 +1,24 @@
1
+ export type DietaryItemType = "dietaryNeed" | "allergy";
2
+ /** Shared catalog entry — reused across employees to avoid duplicated free text. */
3
+ export interface DietaryCatalogItem {
4
+ id: string;
5
+ name: string;
6
+ itemType: DietaryItemType;
7
+ }
8
+ /** One dietary need / allergy assigned to an employee. */
9
+ export interface DietaryEntry {
10
+ id: string;
11
+ itemId: string;
12
+ name: string;
13
+ itemType: DietaryItemType;
14
+ isCritical: boolean;
15
+ remarks: string;
16
+ }
17
+ /** Create/update payload. `itemId` null means "resolve by name" (reuse or create catalog entry). */
18
+ export interface SaveDietaryEntry {
19
+ itemId: string | null;
20
+ name: string;
21
+ itemType: DietaryItemType;
22
+ isCritical: boolean;
23
+ remarks: string;
24
+ }
@@ -0,0 +1,89 @@
1
+ export interface EmployeeDetail {
2
+ id: number;
3
+ letterCode: string;
4
+ empNr: string;
5
+ lastName: string;
6
+ firstName: string;
7
+ gender: number;
8
+ birthdate: string | null;
9
+ nationality: string;
10
+ licenseNo: string;
11
+ socialNo: string;
12
+ maritalStatusId: number | null;
13
+ countryBirth: string;
14
+ placeBirth: string;
15
+ entryDate: string | null;
16
+ exitDate: string | null;
17
+ active: boolean;
18
+ functionId: number | null;
19
+ functionName: string;
20
+ employment: number;
21
+ flightDuty: number;
22
+ contractType: string;
23
+ holidaysPerYear: number | null;
24
+ officeDays: number | null;
25
+ dutyRegId: number | null;
26
+ frmsConfigId: string | null;
27
+ homeBaseId: number | null;
28
+ homeBaseIcao: string;
29
+ travelBaseId: number | null;
30
+ travelBaseIcao: string;
31
+ myIdTravelBlock: boolean;
32
+ loginMethod: number;
33
+ mobile: string;
34
+ telephone2: string;
35
+ email: string;
36
+ street: string;
37
+ zipCode: string;
38
+ city: string;
39
+ homeCountry: string;
40
+ winUser: string;
41
+ privateEmail: string;
42
+ remark: string;
43
+ emergencyContact: string;
44
+ passengerTypeCode: string;
45
+ }
46
+ export interface CreateEmployeeRequest {
47
+ letterCode: string;
48
+ empNr: string;
49
+ lastName: string;
50
+ firstName: string;
51
+ gender: number;
52
+ birthdate: string | null;
53
+ nationality: string;
54
+ licenseNo: string;
55
+ socialNo: string;
56
+ maritalStatusId: number | null;
57
+ countryBirth: string;
58
+ placeBirth: string;
59
+ entryDate: string | null;
60
+ exitDate: string | null;
61
+ active: boolean;
62
+ functionId: number | null;
63
+ employment: number;
64
+ flightDuty: number;
65
+ contractType: string;
66
+ holidaysPerYear: number | null;
67
+ officeDays: number | null;
68
+ dutyRegId: number | null;
69
+ frmsConfigId: string | null;
70
+ homeBaseId: number | null;
71
+ travelBaseId: number | null;
72
+ myIdTravelBlock: boolean;
73
+ loginMethod: number;
74
+ mobile: string;
75
+ telephone2: string;
76
+ email: string;
77
+ street: string;
78
+ zipCode: string;
79
+ city: string;
80
+ homeCountry: string;
81
+ winUser: string;
82
+ privateEmail: string;
83
+ remark: string;
84
+ emergencyContact: string;
85
+ passengerTypeCode: string;
86
+ }
87
+ export type UpdateEmployeeRequest = CreateEmployeeRequest & {
88
+ id: number;
89
+ };
@@ -0,0 +1,31 @@
1
+ export interface DropdownOption {
2
+ id: number;
3
+ name: string;
4
+ }
5
+ export interface StringDropdownOption {
6
+ id: string;
7
+ name: string;
8
+ }
9
+ export interface VaccineDropdownOption {
10
+ id: string;
11
+ name: string;
12
+ validityYears: number | null;
13
+ }
14
+ export interface EmployeeDropdowns {
15
+ functions: DropdownOption[];
16
+ functionsNonTraining: DropdownOption[];
17
+ contractTypes: StringDropdownOption[];
18
+ countries: StringDropdownOption[];
19
+ genders: DropdownOption[];
20
+ maritalStatuses: DropdownOption[];
21
+ relationTypes: DropdownOption[];
22
+ dutyRegulations: DropdownOption[];
23
+ loginMethods: DropdownOption[];
24
+ frmsConfigs: StringDropdownOption[];
25
+ contactTypes: DropdownOption[];
26
+ divisions: DropdownOption[];
27
+ vaccines: StringDropdownOption[];
28
+ vaccineOptions: VaccineDropdownOption[];
29
+ languages: StringDropdownOption[];
30
+ languageLevels: StringDropdownOption[];
31
+ }
@@ -0,0 +1,15 @@
1
+ export interface EmployeeListItem {
2
+ id: number;
3
+ letterCode: string;
4
+ empNr: string;
5
+ firstName: string;
6
+ lastName: string;
7
+ functionName: string;
8
+ currentFunctions: string[];
9
+ contractType: string;
10
+ active: boolean;
11
+ homebaseIcao: string;
12
+ divisions: string[];
13
+ vaccineIds: string[];
14
+ languageIds: string[];
15
+ }