@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,120 @@
1
+ import { a as e, i as t, r as n } from "./dateUtils-CTu1RDq1.js";
2
+ import { CwButton as r, CwDatePicker as i, CwDialog as a, CwDigit as o, CwDisplayMessage as s, CwInputText as c, CwKeyValueList as l, CwMessageType as u } from "@cwellt_software/cwellt-reactjs-lib";
3
+ import { useState as d } from "react";
4
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
5
+ //#region src/presentation/comps/tabs/CosmicRadiationTab.tsx
6
+ function m({ data: m, employeeId: h, onUpdate: g }) {
7
+ let [_, v] = d(!1), [y, b] = d(m ?? {
8
+ maidenName: "",
9
+ ssrNumber: "",
10
+ pregnantFrom: null,
11
+ radiationSincePregnant: null
12
+ }), x = () => {
13
+ b(m ?? {
14
+ maidenName: "",
15
+ ssrNumber: "",
16
+ pregnantFrom: null,
17
+ radiationSincePregnant: null
18
+ }), v(!0);
19
+ }, S = async () => {
20
+ try {
21
+ await g(h, y), v(!1), s("Saved", u.SUCCESS, 3e3);
22
+ } catch {
23
+ s("Failed to save", u.ERROR, 5e3);
24
+ }
25
+ }, C = e, w = t;
26
+ return /* @__PURE__ */ p("section", { children: [
27
+ /* @__PURE__ */ f("header", {
28
+ className: "cw-flex-row cw-margin-bottom-small",
29
+ children: /* @__PURE__ */ f(r, {
30
+ text: "Edit",
31
+ icon: "edit",
32
+ onClick: x,
33
+ "data-testid": "tab-cosmicRadiation-edit-button"
34
+ })
35
+ }),
36
+ /* @__PURE__ */ f(l, {
37
+ direction: "column",
38
+ items: [
39
+ {
40
+ key: "maidenName",
41
+ label: "Maiden Name",
42
+ value: m?.maidenName
43
+ },
44
+ {
45
+ key: "ssrNumber",
46
+ label: "SSR Number",
47
+ value: m?.ssrNumber
48
+ },
49
+ {
50
+ key: "pregnantFrom",
51
+ label: "Pregnant From",
52
+ value: ((e) => n(e, "-"))(m?.pregnantFrom ?? null)
53
+ },
54
+ {
55
+ key: "radiationSincePregnant",
56
+ label: "Radiation Since Pregnant",
57
+ value: m?.radiationSincePregnant
58
+ }
59
+ ]
60
+ }),
61
+ _ && /* @__PURE__ */ f(a, {
62
+ open: !0,
63
+ headline: "Edit Cosmic Radiation",
64
+ onClose: () => v(!1),
65
+ onSave: S,
66
+ width: "30rem",
67
+ children: /* @__PURE__ */ p("div", {
68
+ className: "cw-flex-column",
69
+ "data-label-width": "15rem",
70
+ children: [
71
+ /* @__PURE__ */ f(c, {
72
+ labelProps: { text: "Maiden Name" },
73
+ value: y.maidenName,
74
+ onChange: (e) => {
75
+ let t = e.currentTarget.value;
76
+ b((e) => ({
77
+ ...e,
78
+ maidenName: t
79
+ }));
80
+ },
81
+ "data-testid": "tab-cosmicRadiation-form-maidenName"
82
+ }),
83
+ /* @__PURE__ */ f(c, {
84
+ labelProps: { text: "SSR Number" },
85
+ value: y.ssrNumber,
86
+ onChange: (e) => {
87
+ let t = e.currentTarget.value;
88
+ b((e) => ({
89
+ ...e,
90
+ ssrNumber: t
91
+ }));
92
+ }
93
+ }),
94
+ /* @__PURE__ */ f(i, {
95
+ labelProps: { text: "Pregnant From" },
96
+ value: C(y.pregnantFrom),
97
+ onChange: (e) => b((t) => ({
98
+ ...t,
99
+ pregnantFrom: w(e)
100
+ })),
101
+ showClear: !0
102
+ }),
103
+ /* @__PURE__ */ f(o, {
104
+ labelProps: { text: "Radiation Since Pregnant" },
105
+ value: y.radiationSincePregnant == null ? "" : String(y.radiationSincePregnant),
106
+ onChange: (e) => {
107
+ let t = e.currentTarget.value;
108
+ b((e) => ({
109
+ ...e,
110
+ radiationSincePregnant: t ? Number(t) : null
111
+ }));
112
+ }
113
+ })
114
+ ]
115
+ })
116
+ })
117
+ ] });
118
+ }
119
+ //#endregion
120
+ export { m as CosmicRadiationTab };
@@ -0,0 +1 @@
1
+ let e=require("@cwellt_software/cwellt-reactjs-lib"),t=require("react/jsx-runtime");var n=`Are you sure you want to delete this item? This action cannot be undone.`,r=({message:r,customContent:i,onDelete:a,...o})=>(0,t.jsx)(e.CwDialog,{...o,width:450,customFooter:[(0,t.jsx)(e.CwButton,{color:`danger`,onClick:a,variant:`icon`,icon:`delete`,title:`Confirm delete`,"data-testid":`delete-dialog-confirm`},`delete`)],children:i||(0,t.jsx)(e.CwNote,{content:r||n,color:`danger`})});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
@@ -0,0 +1,21 @@
1
+ import { CwButton as e, CwDialog as t, CwNote as n } from "@cwellt_software/cwellt-reactjs-lib";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ //#region src/presentation/common/DeleteDialog.tsx
4
+ var i = "Are you sure you want to delete this item? This action cannot be undone.", a = ({ message: a, customContent: o, onDelete: s, ...c }) => /* @__PURE__ */ r(t, {
5
+ ...c,
6
+ width: 450,
7
+ customFooter: [/* @__PURE__ */ r(e, {
8
+ color: "danger",
9
+ onClick: s,
10
+ variant: "icon",
11
+ icon: "delete",
12
+ title: "Confirm delete",
13
+ "data-testid": "delete-dialog-confirm"
14
+ }, "delete")],
15
+ children: o || /* @__PURE__ */ r(n, {
16
+ content: a || i,
17
+ color: "danger"
18
+ })
19
+ });
20
+ //#endregion
21
+ export { a as t };
@@ -0,0 +1 @@
1
+ const e=require("./dateUtils-BULQTXVb.cjs");let t=require("@cwellt_software/cwellt-reactjs-lib"),n=require("react/jsx-runtime");function r({employee:r,dropdowns:i}){if(!r)return(0,n.jsx)(t.CwLoading,{});let a=(e,t)=>e?.find(e=>e.id===t)?.name??``,o=a(i?.genders,r.gender),s=a(i?.maritalStatuses,r.maritalStatusId),c=a(i?.countries,r.nationality)||r.nationality,l=a(i?.countries,r.countryBirth)||r.countryBirth,u=a(i?.countries,r.homeCountry)||r.homeCountry,d=a(i?.dutyRegulations,r.dutyRegId),f=a(i?.frmsConfigs,r.frmsConfigId),p=a(i?.loginMethods,r.loginMethod),m=a(i?.contractTypes,r.contractType)||r.contractType,h=t=>e.r(t,`-`);return(0,n.jsxs)(`div`,{className:`cw-grid-base-auto cw-font-size-regular`,"data-label-width":`8rem`,style:{"--auto-columns":`400px`},children:[(0,n.jsx)(t.CwCard,{title:`Personal`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`letterCode`,label:`Letter Code`,value:r.letterCode},{key:`empNr`,label:`Employee No`,value:r.empNr},{key:`lastName`,label:`Last Name`,value:r.lastName},{key:`firstName`,label:`First Name`,value:r.firstName},{key:`gender`,label:`Gender`,value:o},{key:`birthdate`,label:`Birthdate`,value:h(r.birthdate)},{key:`nationality`,label:`Nationality`,value:c},{key:`maritalStatus`,label:`Marital Status`,value:s},{key:`countryBirth`,label:`Country of Birth`,value:l},{key:`placeBirth`,label:`Place of Birth`,value:r.placeBirth}],direction:`row`})}),(0,n.jsx)(t.CwCard,{title:`Employment`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`entryDate`,label:`Entry Date`,value:h(r.entryDate)},{key:`exitDate`,label:`Exit Date`,value:h(r.exitDate)},{key:`active`,label:`Active`,value:r.active?`Yes`:`No`},{key:`function`,label:`Function`,value:r.functionName},{key:`contractType`,label:`Contract Type`,value:m},{key:`employment`,label:`Employment %`,value:r.employment},{key:`flightDuty`,label:`Flight Duty %`,value:r.flightDuty},{key:`holidaysPerYear`,label:`Holidays p.a.`,value:r.holidaysPerYear},{key:`officeDays`,label:`Office Days`,value:r.officeDays}],direction:`row`})}),(0,n.jsx)(t.CwCard,{title:`Operations`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`dutyReg`,label:`Duty Regulation`,value:d},{key:`frms`,label:`FRMS`,value:f},{key:`homeBase`,label:`Homebase`,value:r.homeBaseIcao},{key:`travelBase`,label:`Travelbase`,value:r.travelBaseIcao},{key:`loginMethod`,label:`Login Method`,value:p},{key:`licenseNo`,label:`License No`,value:r.licenseNo},{key:`socialNo`,label:`Social No`,value:r.socialNo}],direction:`row`})}),(0,n.jsx)(t.CwCard,{title:`Contact`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`mobile`,label:`Mobile`,value:r.mobile},{key:`telephone2`,label:`Telephone 2`,value:r.telephone2},{key:`email`,label:`Email`,value:r.email},{key:`privateEmail`,label:`Private Email`,value:r.privateEmail},{key:`winUser`,label:`Windows User`,value:r.winUser},{key:`emergencyContact`,label:`Emergency Contact`,value:r.emergencyContact}],direction:`row`})}),(0,n.jsx)(t.CwCard,{title:`Address`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`street`,label:`Street`,value:r.street},{key:`zipCode`,label:`Zip Code`,value:r.zipCode},{key:`city`,label:`City`,value:r.city},{key:`country`,label:`Country`,value:u}],direction:`row`})}),(0,n.jsx)(t.CwCard,{title:`Notes`,children:(0,n.jsx)(t.CwKeyValueList,{items:[{key:`remark`,label:`Remark`,value:r.remark}],direction:`column`})})]})}exports.DetailsTab=r;
@@ -0,0 +1,248 @@
1
+ import { r as e } from "./dateUtils-CTu1RDq1.js";
2
+ import { CwCard as t, CwKeyValueList as n, CwLoading as r } from "@cwellt_software/cwellt-reactjs-lib";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ //#region src/presentation/comps/tabs/DetailsTab.tsx
5
+ function o({ employee: o, dropdowns: s }) {
6
+ if (!o) return /* @__PURE__ */ i(r, {});
7
+ let c = (e, t) => e?.find((e) => e.id === t)?.name ?? "", l = c(s?.genders, o.gender), u = c(s?.maritalStatuses, o.maritalStatusId), d = c(s?.countries, o.nationality) || o.nationality, f = c(s?.countries, o.countryBirth) || o.countryBirth, p = c(s?.countries, o.homeCountry) || o.homeCountry, m = c(s?.dutyRegulations, o.dutyRegId), h = c(s?.frmsConfigs, o.frmsConfigId), g = c(s?.loginMethods, o.loginMethod), _ = c(s?.contractTypes, o.contractType) || o.contractType, v = (t) => e(t, "-");
8
+ return /* @__PURE__ */ a("div", {
9
+ className: "cw-grid-base-auto cw-font-size-regular",
10
+ "data-label-width": "8rem",
11
+ style: { "--auto-columns": "400px" },
12
+ children: [
13
+ /* @__PURE__ */ i(t, {
14
+ title: "Personal",
15
+ children: /* @__PURE__ */ i(n, {
16
+ items: [
17
+ {
18
+ key: "letterCode",
19
+ label: "Letter Code",
20
+ value: o.letterCode
21
+ },
22
+ {
23
+ key: "empNr",
24
+ label: "Employee No",
25
+ value: o.empNr
26
+ },
27
+ {
28
+ key: "lastName",
29
+ label: "Last Name",
30
+ value: o.lastName
31
+ },
32
+ {
33
+ key: "firstName",
34
+ label: "First Name",
35
+ value: o.firstName
36
+ },
37
+ {
38
+ key: "gender",
39
+ label: "Gender",
40
+ value: l
41
+ },
42
+ {
43
+ key: "birthdate",
44
+ label: "Birthdate",
45
+ value: v(o.birthdate)
46
+ },
47
+ {
48
+ key: "nationality",
49
+ label: "Nationality",
50
+ value: d
51
+ },
52
+ {
53
+ key: "maritalStatus",
54
+ label: "Marital Status",
55
+ value: u
56
+ },
57
+ {
58
+ key: "countryBirth",
59
+ label: "Country of Birth",
60
+ value: f
61
+ },
62
+ {
63
+ key: "placeBirth",
64
+ label: "Place of Birth",
65
+ value: o.placeBirth
66
+ }
67
+ ],
68
+ direction: "row"
69
+ })
70
+ }),
71
+ /* @__PURE__ */ i(t, {
72
+ title: "Employment",
73
+ children: /* @__PURE__ */ i(n, {
74
+ items: [
75
+ {
76
+ key: "entryDate",
77
+ label: "Entry Date",
78
+ value: v(o.entryDate)
79
+ },
80
+ {
81
+ key: "exitDate",
82
+ label: "Exit Date",
83
+ value: v(o.exitDate)
84
+ },
85
+ {
86
+ key: "active",
87
+ label: "Active",
88
+ value: o.active ? "Yes" : "No"
89
+ },
90
+ {
91
+ key: "function",
92
+ label: "Function",
93
+ value: o.functionName
94
+ },
95
+ {
96
+ key: "contractType",
97
+ label: "Contract Type",
98
+ value: _
99
+ },
100
+ {
101
+ key: "employment",
102
+ label: "Employment %",
103
+ value: o.employment
104
+ },
105
+ {
106
+ key: "flightDuty",
107
+ label: "Flight Duty %",
108
+ value: o.flightDuty
109
+ },
110
+ {
111
+ key: "holidaysPerYear",
112
+ label: "Holidays p.a.",
113
+ value: o.holidaysPerYear
114
+ },
115
+ {
116
+ key: "officeDays",
117
+ label: "Office Days",
118
+ value: o.officeDays
119
+ }
120
+ ],
121
+ direction: "row"
122
+ })
123
+ }),
124
+ /* @__PURE__ */ i(t, {
125
+ title: "Operations",
126
+ children: /* @__PURE__ */ i(n, {
127
+ items: [
128
+ {
129
+ key: "dutyReg",
130
+ label: "Duty Regulation",
131
+ value: m
132
+ },
133
+ {
134
+ key: "frms",
135
+ label: "FRMS",
136
+ value: h
137
+ },
138
+ {
139
+ key: "homeBase",
140
+ label: "Homebase",
141
+ value: o.homeBaseIcao
142
+ },
143
+ {
144
+ key: "travelBase",
145
+ label: "Travelbase",
146
+ value: o.travelBaseIcao
147
+ },
148
+ {
149
+ key: "loginMethod",
150
+ label: "Login Method",
151
+ value: g
152
+ },
153
+ {
154
+ key: "licenseNo",
155
+ label: "License No",
156
+ value: o.licenseNo
157
+ },
158
+ {
159
+ key: "socialNo",
160
+ label: "Social No",
161
+ value: o.socialNo
162
+ }
163
+ ],
164
+ direction: "row"
165
+ })
166
+ }),
167
+ /* @__PURE__ */ i(t, {
168
+ title: "Contact",
169
+ children: /* @__PURE__ */ i(n, {
170
+ items: [
171
+ {
172
+ key: "mobile",
173
+ label: "Mobile",
174
+ value: o.mobile
175
+ },
176
+ {
177
+ key: "telephone2",
178
+ label: "Telephone 2",
179
+ value: o.telephone2
180
+ },
181
+ {
182
+ key: "email",
183
+ label: "Email",
184
+ value: o.email
185
+ },
186
+ {
187
+ key: "privateEmail",
188
+ label: "Private Email",
189
+ value: o.privateEmail
190
+ },
191
+ {
192
+ key: "winUser",
193
+ label: "Windows User",
194
+ value: o.winUser
195
+ },
196
+ {
197
+ key: "emergencyContact",
198
+ label: "Emergency Contact",
199
+ value: o.emergencyContact
200
+ }
201
+ ],
202
+ direction: "row"
203
+ })
204
+ }),
205
+ /* @__PURE__ */ i(t, {
206
+ title: "Address",
207
+ children: /* @__PURE__ */ i(n, {
208
+ items: [
209
+ {
210
+ key: "street",
211
+ label: "Street",
212
+ value: o.street
213
+ },
214
+ {
215
+ key: "zipCode",
216
+ label: "Zip Code",
217
+ value: o.zipCode
218
+ },
219
+ {
220
+ key: "city",
221
+ label: "City",
222
+ value: o.city
223
+ },
224
+ {
225
+ key: "country",
226
+ label: "Country",
227
+ value: p
228
+ }
229
+ ],
230
+ direction: "row"
231
+ })
232
+ }),
233
+ /* @__PURE__ */ i(t, {
234
+ title: "Notes",
235
+ children: /* @__PURE__ */ i(n, {
236
+ items: [{
237
+ key: "remark",
238
+ label: "Remark",
239
+ value: o.remark
240
+ }],
241
+ direction: "column"
242
+ })
243
+ })
244
+ ]
245
+ });
246
+ }
247
+ //#endregion
248
+ export { o as DetailsTab };
@@ -0,0 +1 @@
1
+ const e=require("./DeleteDialog-BqXtjGGi.cjs");let t=require("@cwellt_software/cwellt-reactjs-lib"),n=require("react"),r=require("react/jsx-runtime");function i({items:i,employeeId:a,availableDivisions:o,onCreate:s,onDelete:c}){let[l,u]=(0,n.useState)(!1),[d,f]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),h=new Set(i.map(e=>e.divisionId)),g=o.filter(e=>!h.has(e.id));return(0,r.jsxs)(`section`,{children:[(0,r.jsx)(`header`,{className:`cw-flex-row cw-margin-bottom-small`,children:(0,r.jsx)(t.CwButton,{text:`Add Division`,icon:`plus`,onClick:()=>{m(null),u(!0)},disabled:g.length===0,"data-testid":`tab-divisions-add-button`})}),(0,r.jsx)(t.CwTable,{columns:[{key:`actions`,title:``,className:`cw-table-col-action cw-table-col-buttons`,render:e=>(0,r.jsx)(t.CwButton,{variant:`icon`,icon:`delete`,color:`danger`,onClick:()=>f(e),"data-testid":`tab-divisions-row-${e.id}-delete`})},{key:`divisionName`,title:`Division`,dataIndex:`divisionName`,render:e=>(0,r.jsx)(`span`,{"data-testid":`tab-divisions-row-${e.id}`,children:e.divisionName})}],data:i,rowKey:`id`}),l&&(0,r.jsx)(t.CwDialog,{open:!0,headline:`Add Division`,onClose:()=>u(!1),onSave:async()=>{if(p)try{await s(a,p),u(!1)}catch{(0,t.CwDisplayMessage)(`Failed to add division`,t.CwMessageType.ERROR,5e3)}},disableSave:!p,width:`30rem`,children:(0,r.jsx)(t.CwSelect,{labelProps:{text:`Division`},value:p==null?``:String(p),onChange:e=>m(e.currentTarget.value?Number(e.currentTarget.value):null),placeholder:`Select...`,"data-testid":`tab-divisions-form-division`,children:g.map(e=>(0,r.jsx)(t.CwOption,{value:e.id,children:e.name},e.id))})}),d&&(0,r.jsx)(e.t,{open:!0,headline:`Remove Division`,message:`Remove "${d.divisionName}" from this employee?`,onDelete:async()=>{try{await c(d.id),f(null)}catch(e){(0,t.CwDisplayMessage)(`Failed to remove division: ${e instanceof Error?e.message:`Unknown error`}`,t.CwMessageType.ERROR,5e3)}},onClose:()=>f(null)})]})}exports.DivisionsTab=i;
@@ -0,0 +1,86 @@
1
+ import { t as e } from "./DeleteDialog-CyRsLr_c.js";
2
+ import { CwButton as t, CwDialog as n, CwDisplayMessage as r, CwMessageType as i, CwOption as a, CwSelect as o, CwTable as s } from "@cwellt_software/cwellt-reactjs-lib";
3
+ import { useState as c } from "react";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ //#region src/presentation/comps/tabs/DivisionsTab.tsx
6
+ function d({ items: d, employeeId: f, availableDivisions: p, onCreate: m, onDelete: h }) {
7
+ let [g, _] = c(!1), [v, y] = c(null), [b, x] = c(null), S = new Set(d.map((e) => e.divisionId)), C = p.filter((e) => !S.has(e.id));
8
+ return /* @__PURE__ */ u("section", { children: [
9
+ /* @__PURE__ */ l("header", {
10
+ className: "cw-flex-row cw-margin-bottom-small",
11
+ children: /* @__PURE__ */ l(t, {
12
+ text: "Add Division",
13
+ icon: "plus",
14
+ onClick: () => {
15
+ x(null), _(!0);
16
+ },
17
+ disabled: C.length === 0,
18
+ "data-testid": "tab-divisions-add-button"
19
+ })
20
+ }),
21
+ /* @__PURE__ */ l(s, {
22
+ columns: [{
23
+ key: "actions",
24
+ title: "",
25
+ className: "cw-table-col-action cw-table-col-buttons",
26
+ render: (e) => /* @__PURE__ */ l(t, {
27
+ variant: "icon",
28
+ icon: "delete",
29
+ color: "danger",
30
+ onClick: () => y(e),
31
+ "data-testid": `tab-divisions-row-${e.id}-delete`
32
+ })
33
+ }, {
34
+ key: "divisionName",
35
+ title: "Division",
36
+ dataIndex: "divisionName",
37
+ render: (e) => /* @__PURE__ */ l("span", {
38
+ "data-testid": `tab-divisions-row-${e.id}`,
39
+ children: e.divisionName
40
+ })
41
+ }],
42
+ data: d,
43
+ rowKey: "id"
44
+ }),
45
+ g && /* @__PURE__ */ l(n, {
46
+ open: !0,
47
+ headline: "Add Division",
48
+ onClose: () => _(!1),
49
+ onSave: async () => {
50
+ if (b) try {
51
+ await m(f, b), _(!1);
52
+ } catch {
53
+ r("Failed to add division", i.ERROR, 5e3);
54
+ }
55
+ },
56
+ disableSave: !b,
57
+ width: "30rem",
58
+ children: /* @__PURE__ */ l(o, {
59
+ labelProps: { text: "Division" },
60
+ value: b == null ? "" : String(b),
61
+ onChange: (e) => x(e.currentTarget.value ? Number(e.currentTarget.value) : null),
62
+ placeholder: "Select...",
63
+ "data-testid": "tab-divisions-form-division",
64
+ children: C.map((e) => /* @__PURE__ */ l(a, {
65
+ value: e.id,
66
+ children: e.name
67
+ }, e.id))
68
+ })
69
+ }),
70
+ v && /* @__PURE__ */ l(e, {
71
+ open: !0,
72
+ headline: "Remove Division",
73
+ message: `Remove "${v.divisionName}" from this employee?`,
74
+ onDelete: async () => {
75
+ try {
76
+ await h(v.id), y(null);
77
+ } catch (e) {
78
+ r(`Failed to remove division: ${e instanceof Error ? e.message : "Unknown error"}`, i.ERROR, 5e3);
79
+ }
80
+ },
81
+ onClose: () => y(null)
82
+ })
83
+ ] });
84
+ }
85
+ //#endregion
86
+ export { d as DivisionsTab };
@@ -0,0 +1,160 @@
1
+ import { a as e, i as t, n, r } from "./dateUtils-CTu1RDq1.js";
2
+ import { CwButton as i, CwDatePicker as a, CwDialog as o, CwDisplayMessage as s, CwMessageType as c, CwOption as l, CwSelect as u, CwTable as d, CwToggle as f } from "@cwellt_software/cwellt-reactjs-lib";
3
+ import { useState as p } from "react";
4
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ //#region src/presentation/comps/tabs/FunctionsTab.tsx
6
+ function _({ items: _, employeeId: v, availableFunctions: y, onCreate: b, onUpdate: x, onDeactivate: S, onRefresh: C }) {
7
+ let [w, T] = p(!1), [E, D] = p(null), [O, k] = p(!1), [A, j] = p({
8
+ functionId: null,
9
+ startDate: "",
10
+ endDate: ""
11
+ }), M = [..._].sort((e, t) => {
12
+ let n = e.functionStart ?? "";
13
+ return (t.functionStart ?? "").localeCompare(n);
14
+ }), N = () => {
15
+ D(null), j({
16
+ functionId: null,
17
+ startDate: "",
18
+ endDate: ""
19
+ }), T(!0);
20
+ }, P = (e) => {
21
+ D(e), j({
22
+ functionId: e.functionId,
23
+ startDate: e.functionStart ?? "",
24
+ endDate: n(e.functionEnd)
25
+ }), T(!0);
26
+ }, F = () => {
27
+ let e = !O;
28
+ k(e), C(v, e);
29
+ }, I = async () => {
30
+ if (A.functionId) try {
31
+ E ? await x({
32
+ ...E,
33
+ functionId: A.functionId,
34
+ functionStart: A.startDate || null,
35
+ functionEnd: A.endDate || null
36
+ }) : await b({
37
+ functionId: A.functionId,
38
+ functionStart: A.startDate || null,
39
+ functionEnd: A.endDate || null,
40
+ employeeId: v
41
+ }), T(!1);
42
+ } catch {
43
+ s("Failed to save function", c.ERROR, 5e3);
44
+ }
45
+ }, L = async (e) => {
46
+ try {
47
+ await S(e), await C(v, O);
48
+ } catch (e) {
49
+ s(e instanceof Error ? e.message : "Failed to deactivate function", c.ERROR, 5e3);
50
+ }
51
+ }, R = e, z = (e) => t(e) ?? "";
52
+ return /* @__PURE__ */ g("section", { children: [
53
+ /* @__PURE__ */ g("header", {
54
+ className: "cw-flex-row cw-align-left-center cw-margin-bottom-small",
55
+ children: [/* @__PURE__ */ h(i, {
56
+ text: "Add Function",
57
+ icon: "plus",
58
+ onClick: N,
59
+ "data-testid": "tab-functions-add-button"
60
+ }), /* @__PURE__ */ h(f, {
61
+ checked: O,
62
+ labelText: "Show Inactive",
63
+ onChange: F
64
+ })]
65
+ }),
66
+ /* @__PURE__ */ h(d, {
67
+ columns: [
68
+ {
69
+ key: "actions",
70
+ title: "",
71
+ className: "cw-table-col-action cw-table-col-buttons",
72
+ render: (e) => /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(i, {
73
+ variant: "icon",
74
+ icon: "edit",
75
+ onClick: () => P(e),
76
+ "data-testid": `tab-functions-row-${e.id}-edit`
77
+ }), e.active && /* @__PURE__ */ h(i, {
78
+ variant: "icon",
79
+ icon: "delete",
80
+ color: "danger",
81
+ onClick: () => L(e.id),
82
+ "data-testid": `tab-functions-row-${e.id}-delete`
83
+ })] })
84
+ },
85
+ {
86
+ key: "functionName",
87
+ title: "Function",
88
+ dataIndex: "functionName",
89
+ render: (e) => /* @__PURE__ */ h("span", {
90
+ "data-testid": `tab-functions-row-${e.id}`,
91
+ children: e.functionName
92
+ })
93
+ },
94
+ {
95
+ key: "functionStart",
96
+ title: "Start",
97
+ dataIndex: "functionStart",
98
+ render: (e) => r(e.functionStart)
99
+ },
100
+ {
101
+ key: "functionEnd",
102
+ title: "End",
103
+ dataIndex: "functionEnd",
104
+ render: (e) => r(e.functionEnd)
105
+ }
106
+ ],
107
+ data: M,
108
+ rowKey: "id"
109
+ }),
110
+ w && /* @__PURE__ */ h(o, {
111
+ open: !0,
112
+ headline: E ? "Edit Function" : "Add Function",
113
+ onClose: () => T(!1),
114
+ onSave: I,
115
+ disableSave: !A.functionId,
116
+ width: "30rem",
117
+ children: /* @__PURE__ */ g("div", {
118
+ className: "cw-flex-column",
119
+ "data-label-width": "8rem",
120
+ children: [
121
+ /* @__PURE__ */ h(u, {
122
+ labelProps: { text: "Function" },
123
+ value: A.functionId == null ? "" : String(A.functionId),
124
+ onChange: (e) => {
125
+ let t = e.currentTarget.value;
126
+ j((e) => ({
127
+ ...e,
128
+ functionId: t ? Number(t) : null
129
+ }));
130
+ },
131
+ placeholder: "Select...",
132
+ "data-testid": "tab-functions-form-function",
133
+ children: y.map((e) => /* @__PURE__ */ h(l, {
134
+ value: e.id,
135
+ children: e.name
136
+ }, e.id))
137
+ }),
138
+ /* @__PURE__ */ h(a, {
139
+ labelProps: { text: "Start Date" },
140
+ value: R(A.startDate),
141
+ onChange: (e) => j((t) => ({
142
+ ...t,
143
+ startDate: z(e)
144
+ }))
145
+ }),
146
+ /* @__PURE__ */ h(a, {
147
+ labelProps: { text: "End Date" },
148
+ value: R(A.endDate),
149
+ onChange: (e) => j((t) => ({
150
+ ...t,
151
+ endDate: z(e)
152
+ }))
153
+ })
154
+ ]
155
+ })
156
+ })
157
+ ] });
158
+ }
159
+ //#endregion
160
+ export { _ as FunctionsTab };
@@ -0,0 +1 @@
1
+ const e=require("./dateUtils-BULQTXVb.cjs");let t=require("@cwellt_software/cwellt-reactjs-lib"),n=require("react"),r=require("react/jsx-runtime");function i({items:i,employeeId:a,availableFunctions:o,onCreate:s,onUpdate:c,onDeactivate:l,onRefresh:u}){let[d,f]=(0,n.useState)(!1),[p,m]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)({functionId:null,startDate:``,endDate:``}),y=[...i].sort((e,t)=>{let n=e.functionStart??``;return(t.functionStart??``).localeCompare(n)}),b=()=>{m(null),v({functionId:null,startDate:``,endDate:``}),f(!0)},x=t=>{m(t),v({functionId:t.functionId,startDate:t.functionStart??``,endDate:e.n(t.functionEnd)}),f(!0)},S=()=>{let e=!h;g(e),u(a,e)},C=async()=>{if(_.functionId)try{p?await c({...p,functionId:_.functionId,functionStart:_.startDate||null,functionEnd:_.endDate||null}):await s({functionId:_.functionId,functionStart:_.startDate||null,functionEnd:_.endDate||null,employeeId:a}),f(!1)}catch{(0,t.CwDisplayMessage)(`Failed to save function`,t.CwMessageType.ERROR,5e3)}},w=async e=>{try{await l(e),await u(a,h)}catch(e){(0,t.CwDisplayMessage)(e instanceof Error?e.message:`Failed to deactivate function`,t.CwMessageType.ERROR,5e3)}},T=e.a,E=t=>e.i(t)??``;return(0,r.jsxs)(`section`,{children:[(0,r.jsxs)(`header`,{className:`cw-flex-row cw-align-left-center cw-margin-bottom-small`,children:[(0,r.jsx)(t.CwButton,{text:`Add Function`,icon:`plus`,onClick:b,"data-testid":`tab-functions-add-button`}),(0,r.jsx)(t.CwToggle,{checked:h,labelText:`Show Inactive`,onChange:S})]}),(0,r.jsx)(t.CwTable,{columns:[{key:`actions`,title:``,className:`cw-table-col-action cw-table-col-buttons`,render:e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.CwButton,{variant:`icon`,icon:`edit`,onClick:()=>x(e),"data-testid":`tab-functions-row-${e.id}-edit`}),e.active&&(0,r.jsx)(t.CwButton,{variant:`icon`,icon:`delete`,color:`danger`,onClick:()=>w(e.id),"data-testid":`tab-functions-row-${e.id}-delete`})]})},{key:`functionName`,title:`Function`,dataIndex:`functionName`,render:e=>(0,r.jsx)(`span`,{"data-testid":`tab-functions-row-${e.id}`,children:e.functionName})},{key:`functionStart`,title:`Start`,dataIndex:`functionStart`,render:t=>e.r(t.functionStart)},{key:`functionEnd`,title:`End`,dataIndex:`functionEnd`,render:t=>e.r(t.functionEnd)}],data:y,rowKey:`id`}),d&&(0,r.jsx)(t.CwDialog,{open:!0,headline:p?`Edit Function`:`Add Function`,onClose:()=>f(!1),onSave:C,disableSave:!_.functionId,width:`30rem`,children:(0,r.jsxs)(`div`,{className:`cw-flex-column`,"data-label-width":`8rem`,children:[(0,r.jsx)(t.CwSelect,{labelProps:{text:`Function`},value:_.functionId==null?``:String(_.functionId),onChange:e=>{let t=e.currentTarget.value;v(e=>({...e,functionId:t?Number(t):null}))},placeholder:`Select...`,"data-testid":`tab-functions-form-function`,children:o.map(e=>(0,r.jsx)(t.CwOption,{value:e.id,children:e.name},e.id))}),(0,r.jsx)(t.CwDatePicker,{labelProps:{text:`Start Date`},value:T(_.startDate),onChange:e=>v(t=>({...t,startDate:E(e)}))}),(0,r.jsx)(t.CwDatePicker,{labelProps:{text:`End Date`},value:T(_.endDate),onChange:e=>v(t=>({...t,endDate:E(e)}))})]})})]})}exports.FunctionsTab=i;
@@ -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,functions:s,contractTypes:c,airportConfig:l,onCreate:u,onUpdate:d,onDelete:f}){let[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)(null),[y,b]=(0,r.useState)({startDate:``,endDate:``,functionId:null,homeBaseId:null,travelBaseId:null,percentage:100,flightPercentage:100,officeDays:0,contractType:`FC`}),x=[...a].sort((e,t)=>{let n=e.endDate??`9999`;return(t.endDate??`9999`).localeCompare(n)}),S=()=>{let e=a.find(e=>!e.endDate||e.endDate>=`2099`);g(null),b({startDate:``,endDate:``,functionId:null,homeBaseId:e?.homeBaseId??null,travelBaseId:e?.travelBaseId??null,percentage:100,flightPercentage:100,officeDays:0,contractType:`FC`}),m(!0)},C=t=>{g(t),b({startDate:t.startDate??``,endDate:e.n(t.endDate),functionId:t.functionId,homeBaseId:t.homeBaseId,travelBaseId:t.travelBaseId,percentage:t.percentage??100,flightPercentage:t.flightPercentage??100,officeDays:t.officeDays??0,contractType:t.contractType}),m(!0)},w=async()=>{try{h?await d({...h,startDate:y.startDate||null,endDate:y.endDate||null,functionId:y.functionId,homeBaseId:y.homeBaseId,travelBaseId:y.travelBaseId,percentage:y.percentage,flightPercentage:y.flightPercentage,officeDays:y.officeDays,contractType:y.contractType}):await u({startDate:y.startDate||null,endDate:y.endDate||null,functionId:y.functionId,homeBaseId:y.homeBaseId,travelBaseId:y.travelBaseId,percentage:y.percentage,flightPercentage:y.flightPercentage,officeDays:y.officeDays,contractType:y.contractType,employeeId:o}),m(!1)}catch{(0,n.CwDisplayMessage)(`Failed to save`,n.CwMessageType.ERROR,5e3)}},T=e.a,E=t=>e.i(t)??``;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:S})}),(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:()=>C(e)}),(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`delete`,color:`danger`,onClick:()=>v(e)})]})},{key:`startDate`,title:`Start`,dataIndex:`startDate`,render:t=>e.r(t.startDate)},{key:`endDate`,title:`End`,dataIndex:`endDate`,render:t=>t.endDate?e.r(t.endDate):`Current`},{key:`functionName`,title:`Function`,dataIndex:`functionName`},{key:`homeBaseIcao`,title:`Home Base`,dataIndex:`homeBaseIcao`},{key:`travelBaseIcao`,title:`Travel Base`,dataIndex:`travelBaseIcao`},{key:`percentage`,title:`%`,dataIndex:`percentage`,render:e=>e.percentage==null?``:`${e.percentage}%`},{key:`contractType`,title:`Contract`,dataIndex:`contractType`}],data:x,rowKey:`id`}),p&&(0,i.jsx)(n.CwDialog,{open:!0,headline:h?`Edit History`:`Add History`,onClose:()=>m(!1),width:`35rem`,customFooter:[(0,i.jsx)(n.CwButton,{variant:`icon`,icon:`save`,onMouseDown:e=>e.preventDefault(),onClick:w},`save`)],children:(0,i.jsxs)(`div`,{className:`cw-flex-column`,"data-label-width":`10rem`,children:[(0,i.jsx)(n.CwDatePicker,{labelProps:{text:`Start Date`},value:T(y.startDate),onChange:e=>b(t=>({...t,startDate:E(e)}))}),(0,i.jsx)(n.CwDatePicker,{labelProps:{text:`End Date`},value:T(y.endDate),onChange:e=>b(t=>({...t,endDate:E(e)}))}),(0,i.jsx)(n.CwSelect,{labelProps:{text:`Function`},value:y.functionId==null?``:String(y.functionId),onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,functionId:t?Number(t):null}))},placeholder:`Select...`,children:s.map(e=>(0,i.jsx)(n.CwOption,{value:e.id,children:e.name},e.id))}),(0,i.jsx)(n.CwSelect,{labelProps:{text:`Contract`},value:y.contractType,onChange:e=>{let t=e.currentTarget.value;b(e=>({...e,contractType:t}))},children:c.map(e=>(0,i.jsx)(n.CwOption,{value:e.id,children:e.name},e.id))}),(0,i.jsx)(n.CwFindAirport,{labelProps:{text:`Home Base`},value:y.homeBaseId??void 0,handleChange:e=>b(t=>({...t,homeBaseId:e||null})),cblConfig:l??``,searchType:`OnlyDatabase`,displayMode:`icao-only`,placeHolder:`Search airport...`}),(0,i.jsx)(n.CwFindAirport,{labelProps:{text:`Travel Base`},value:y.travelBaseId??void 0,handleChange:e=>b(t=>({...t,travelBaseId:e||null})),cblConfig:l??``,searchType:`OnlyDatabase`,displayMode:`icao-only`,placeHolder:`Search airport...`}),(0,i.jsx)(n.CwDigit,{labelProps:{text:`Employment %`},value:String(y.percentage),onChange:e=>{let t=Number(e.currentTarget.value);b(e=>({...e,percentage:t}))}}),(0,i.jsx)(n.CwDigit,{labelProps:{text:`Flight Duty %`},value:String(y.flightPercentage),onChange:e=>{let t=Number(e.currentTarget.value);b(e=>({...e,flightPercentage:t}))}}),(0,i.jsx)(n.CwDigit,{labelProps:{text:`Office Days`},value:String(y.officeDays),onChange:e=>{let t=Number(e.currentTarget.value);b(e=>({...e,officeDays:t}))}})]})}),_&&(0,i.jsx)(t.t,{open:!0,headline:`Delete History Entry`,message:`Delete this history entry?`,onDelete:async()=>{await f(_.id),v(null)},onClose:()=>v(null)})]})}exports.HistoryTab=a;