@addsign/moje-agenda-shared-lib 0.0.28 → 0.0.30
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/assets/tailwind.css +1484 -1
- package/dist/components/Button.js +24 -21
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Calendar.js +89 -57
- package/dist/components/Calendar.js.map +1 -0
- package/dist/components/ConfirmationModalDialog.js +52 -47
- package/dist/components/ConfirmationModalDialog.js.map +1 -0
- package/dist/components/DataTable.js +211 -145
- package/dist/components/DataTable.js.map +1 -0
- package/dist/components/Spinner.js +9 -8
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/form/AutocompleteSearchBar.js +323 -239
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -0
- package/dist/components/form/FormField.js +171 -142
- package/dist/components/form/FormField.js.map +1 -0
- package/dist/components/form/PositionsSelectorSingle.js +143 -113
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -0
- package/dist/components/layout/PageTitle.js +9 -8
- package/dist/components/layout/PageTitle.js.map +1 -0
- package/dist/components/layout/SectionTitle.js +9 -8
- package/dist/components/layout/SectionTitle.js.map +1 -0
- package/dist/contexts/FederationContext.js +12 -8
- package/dist/contexts/FederationContext.js.map +1 -0
- package/dist/contexts/useFederationContext.js +5 -4
- package/dist/contexts/useFederationContext.js.map +1 -0
- package/dist/iconBase-BY_L6Cb_.js +144 -0
- package/dist/iconBase-BY_L6Cb_.js.map +1 -0
- package/dist/index-C0yNf1cc.js +48 -0
- package/dist/index-C0yNf1cc.js.map +1 -0
- package/dist/main.js +29 -28
- package/dist/main.js.map +1 -0
- package/dist/types.d.ts +7 -3
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/getFullName.js +9 -3
- package/dist/utils/getFullName.js.map +1 -0
- package/package.json +1 -1
- package/dist/iconBase-DkR9t2l_.js +0 -117
- package/dist/index-CO5g84CR.js +0 -47
|
@@ -1,204 +1,233 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { useState
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
3
|
import '../../assets/tailwind.css';/* empty css */
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { h as
|
|
4
|
+
import Button from "../Button.js";
|
|
5
|
+
import AutocompleteSearchBar from "./AutocompleteSearchBar.js";
|
|
6
|
+
import FormField from "./FormField.js";
|
|
7
|
+
import SectionTitle from "../layout/SectionTitle.js";
|
|
8
|
+
import { h as MdCheck } from "../../index-C0yNf1cc.js";
|
|
9
9
|
import "../../contexts/FederationContext.js";
|
|
10
|
-
import { useFederationContext
|
|
11
|
-
import { getFullName
|
|
12
|
-
import { G as
|
|
13
|
-
function
|
|
14
|
-
return
|
|
10
|
+
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
11
|
+
import { getFullName } from "../../utils/getFullName.js";
|
|
12
|
+
import { G as GenIcon } from "../../iconBase-BY_L6Cb_.js";
|
|
13
|
+
function CiEdit(props) {
|
|
14
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Edit" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "path", "attr": { "d": "M3.548,20.938h16.9a.5.5,0,0,0,0-1H3.548a.5.5,0,0,0,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.71,17.18a2.587,2.587,0,0,0,1.12-.65l9.54-9.54a1.75,1.75,0,0,0,0-2.47l-.94-.93a1.788,1.788,0,0,0-2.47,0L7.42,13.12a2.473,2.473,0,0,0-.64,1.12L6.04,17a.737.737,0,0,0,.19.72.767.767,0,0,0,.53.22Zm.41-1.36a1.468,1.468,0,0,1-.67.39l-.97.26-1-1,.26-.97a1.521,1.521,0,0,1,.39-.67l.38-.37,1.99,1.99Zm1.09-1.08L9.22,12.75l6.73-6.73,1.99,1.99Zm8.45-8.45L18.65,7.3,16.66,5.31l1.01-1.02a.748.748,0,0,1,1.06,0l.93.94A.754.754,0,0,1,19.66,6.29Z" }, "child": [] }] }] }] })(props);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
label
|
|
18
|
-
name
|
|
19
|
-
onInputChange
|
|
20
|
-
initPositionEmployee
|
|
21
|
-
disabled
|
|
22
|
-
initDepartmentId
|
|
16
|
+
function PositionsSelectorSingle({
|
|
17
|
+
label,
|
|
18
|
+
name,
|
|
19
|
+
onInputChange,
|
|
20
|
+
initPositionEmployee,
|
|
21
|
+
disabled,
|
|
22
|
+
initDepartmentId
|
|
23
23
|
}) {
|
|
24
|
-
var
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
const [isModalOpen, setModalOpen] = useState(false);
|
|
26
|
+
const [department, setDepartment] = useState("");
|
|
27
|
+
const [positions, setPositions] = useState([]);
|
|
28
|
+
const [selectedPositionEmployee, setSelectedPositionEmployee] = useState();
|
|
29
|
+
const [storedPositionEmployee, setStoredPositionEmployee] = useState();
|
|
30
|
+
const apiClient = (_a = useFederationContext()) == null ? void 0 : _a.apiClient;
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const handleKeyDown = (event) => {
|
|
33
|
+
if (event.key === "Escape") {
|
|
34
|
+
setModalOpen(false);
|
|
35
|
+
}
|
|
29
36
|
};
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
38
|
+
return () => {
|
|
39
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
32
40
|
};
|
|
33
|
-
}, [])
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (initPositionEmployee) {
|
|
44
|
+
setSelectedPositionEmployee(initPositionEmployee);
|
|
45
|
+
setStoredPositionEmployee(initPositionEmployee);
|
|
46
|
+
setDepartment(initPositionEmployee.departmentId);
|
|
47
|
+
}
|
|
48
|
+
}, [initPositionEmployee]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (initDepartmentId && !initPositionEmployee) {
|
|
51
|
+
setDepartment(initDepartmentId);
|
|
52
|
+
}
|
|
53
|
+
}, [initDepartmentId, initPositionEmployee]);
|
|
54
|
+
const handleSave = (selectedPositionEmployee2) => {
|
|
55
|
+
onInputChange({
|
|
56
|
+
target: { name, value: selectedPositionEmployee2 || null }
|
|
57
|
+
});
|
|
58
|
+
setStoredPositionEmployee(selectedPositionEmployee2);
|
|
59
|
+
setModalOpen(false);
|
|
60
|
+
};
|
|
61
|
+
const handleSelectedPositionEmployee = (position) => {
|
|
43
62
|
console.log(
|
|
44
63
|
"%csrcsharedPositionsSelectorSingle.tsx:54 position",
|
|
45
64
|
"color: #007acc;",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
position,
|
|
66
|
+
selectedPositionEmployee,
|
|
67
|
+
position.id == (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id)
|
|
68
|
+
);
|
|
69
|
+
if (!selectedPositionEmployee || position.id !== (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id)) {
|
|
70
|
+
setSelectedPositionEmployee(position);
|
|
71
|
+
} else {
|
|
72
|
+
setSelectedPositionEmployee(void 0);
|
|
73
|
+
}
|
|
52
74
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const handleDepartmentChange = (e) => {
|
|
76
|
+
console.log("%csrcsharedTransferListModal.tsx:109 e", "color: #007acc;", e);
|
|
77
|
+
setDepartment(e);
|
|
78
|
+
};
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (department && isModalOpen) {
|
|
81
|
+
apiClient.get(
|
|
82
|
+
"os/positions/employees?maxResults=1000&departmentId=" + department
|
|
83
|
+
).then((response) => {
|
|
84
|
+
var _a2;
|
|
85
|
+
setPositions((_a2 = response.data) == null ? void 0 : _a2.content);
|
|
86
|
+
}).catch((error) => {
|
|
87
|
+
console.error(
|
|
88
|
+
"There was an error fetching positions/employees",
|
|
89
|
+
error
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [apiClient, department, isModalOpen]);
|
|
94
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("p", { className: "text-slate-700 text-sm leading-tight font-medium mb-2", children: [
|
|
97
|
+
label,
|
|
69
98
|
":"
|
|
70
99
|
] }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full flex gap-5 ", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
FormField,
|
|
74
103
|
{
|
|
75
104
|
placeholder: "Zatím není určen",
|
|
76
|
-
name
|
|
105
|
+
name,
|
|
77
106
|
onInputChange: () => {
|
|
78
107
|
},
|
|
79
108
|
type: "text",
|
|
80
|
-
disabled:
|
|
81
|
-
value:
|
|
109
|
+
disabled: true,
|
|
110
|
+
value: (storedPositionEmployee == null ? void 0 : storedPositionEmployee.employee) ? getFullName(storedPositionEmployee == null ? void 0 : storedPositionEmployee.employee, true) : ""
|
|
82
111
|
}
|
|
83
112
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
Button,
|
|
86
115
|
{
|
|
87
|
-
className: "text-xl " + (
|
|
116
|
+
className: "text-xl " + (disabled ? "hidden" : ""),
|
|
88
117
|
variant: "primary",
|
|
89
|
-
onClick: () =>
|
|
90
|
-
disabled
|
|
91
|
-
children: /* @__PURE__ */
|
|
118
|
+
onClick: () => setModalOpen(true),
|
|
119
|
+
disabled,
|
|
120
|
+
children: /* @__PURE__ */ jsx(CiEdit, {})
|
|
92
121
|
}
|
|
93
122
|
)
|
|
94
123
|
] })
|
|
95
124
|
] }),
|
|
96
|
-
|
|
125
|
+
isModalOpen && /* @__PURE__ */ jsx(
|
|
97
126
|
"div",
|
|
98
127
|
{
|
|
99
128
|
className: "fixed inset-0 bg-black bg-opacity-25 flex items-center justify-center p-5",
|
|
100
129
|
style: { zIndex: 50 },
|
|
101
|
-
children: /* @__PURE__ */
|
|
130
|
+
children: /* @__PURE__ */ jsx(
|
|
102
131
|
"div",
|
|
103
132
|
{
|
|
104
133
|
className: "bg-white rounded-lg shadow-xl m-4 overflow-auto max-h-full pointer-events-auto ",
|
|
105
134
|
style: { width: "50vw" },
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
135
|
+
children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-13 gap-4 p-5", children: [
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
|
|
137
|
+
/* @__PURE__ */ jsxs(SectionTitle, { children: [
|
|
138
|
+
label,
|
|
110
139
|
" - Výběr pozice"
|
|
111
140
|
] }),
|
|
112
141
|
" "
|
|
113
142
|
] }),
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(
|
|
144
|
+
AutocompleteSearchBar,
|
|
116
145
|
{
|
|
117
146
|
name: "departmentId",
|
|
118
147
|
placeholder: "Vyhledejte útvar",
|
|
119
|
-
fetchUrl: "os/departments?
|
|
148
|
+
fetchUrl: "os/departments?pageSize=5000",
|
|
120
149
|
valueKey: "departmentId",
|
|
121
150
|
labelKey: "nameLong",
|
|
122
151
|
label: "Útvar",
|
|
123
|
-
onChange:
|
|
152
|
+
onChange: handleDepartmentChange,
|
|
124
153
|
onBlur: () => {
|
|
125
154
|
},
|
|
126
155
|
onFocus: () => {
|
|
127
156
|
},
|
|
128
|
-
value:
|
|
129
|
-
showId:
|
|
157
|
+
value: department,
|
|
158
|
+
showId: true
|
|
130
159
|
}
|
|
131
160
|
) }),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
161
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-12 h-[400px]", children: /* @__PURE__ */ jsxs("div", { className: "pt-4 w-full ", children: [
|
|
162
|
+
/* @__PURE__ */ jsx("div", { className: "text-slate-700 text-sm leading-tight font-medium my-4", children: "Nalezené pozice:" }),
|
|
163
|
+
positions.map((position) => /* @__PURE__ */ jsx(
|
|
135
164
|
"div",
|
|
136
165
|
{
|
|
137
166
|
className: "w-1/2 group h-11 px-1.5 py-px justify-start items-center inline-flex cursor-pointer",
|
|
138
|
-
onClick: () =>
|
|
139
|
-
children: /* @__PURE__ */
|
|
167
|
+
onClick: () => handleSelectedPositionEmployee(position),
|
|
168
|
+
children: /* @__PURE__ */ jsxs(
|
|
140
169
|
"div",
|
|
141
170
|
{
|
|
142
|
-
className: `grow shrink basis-0 h-11 pl-2 pr-2.5 py-2.5 rounded-md justify-start items-center gap-2 flex ${
|
|
171
|
+
className: `grow shrink basis-0 h-11 pl-2 pr-2.5 py-2.5 rounded-md justify-start items-center gap-2 flex ${position.id == (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id) ? " bg-gray-100 hover:bg-gray-200 " : "hover:bg-gray-50"} `,
|
|
143
172
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ jsx("div", { className: "grow shrink basis-0 h-6 justify-start items-center gap-2 flex", children: /* @__PURE__ */ jsx("div", { className: "text-gray-900 text-base font-medium font-['Inter'] leading-normal", children: getFullName(position.employee, true) }) }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
146
175
|
"div",
|
|
147
176
|
{
|
|
148
|
-
className: `w-5 h-5 relative group-hover:text-gray-300 ${
|
|
149
|
-
children: /* @__PURE__ */
|
|
177
|
+
className: `w-5 h-5 relative group-hover:text-gray-300 ${position.id == (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id) ? " text-blue-500 group-hover:text-black " : "text-transparent"}`,
|
|
178
|
+
children: /* @__PURE__ */ jsx(MdCheck, {})
|
|
150
179
|
}
|
|
151
180
|
)
|
|
152
181
|
]
|
|
153
182
|
}
|
|
154
183
|
)
|
|
155
184
|
},
|
|
156
|
-
|
|
185
|
+
position.id
|
|
157
186
|
))
|
|
158
187
|
] }) }),
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
|
|
188
|
+
/* @__PURE__ */ jsxs("div", { className: "col-span-12 flex justify-between gap-4", children: [
|
|
189
|
+
/* @__PURE__ */ jsxs("div", { className: " w-1/2 group flex ", children: [
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
FormField,
|
|
163
192
|
{
|
|
164
193
|
placeholder: "Zatím není určen",
|
|
165
|
-
name
|
|
194
|
+
name,
|
|
166
195
|
label: "Zvolená pozice ",
|
|
167
196
|
onInputChange: () => {
|
|
168
197
|
},
|
|
169
198
|
type: "text",
|
|
170
|
-
disabled:
|
|
171
|
-
value:
|
|
199
|
+
disabled: true,
|
|
200
|
+
value: selectedPositionEmployee ? getFullName(selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.employee, true) : ""
|
|
172
201
|
}
|
|
173
202
|
),
|
|
174
|
-
|
|
203
|
+
selectedPositionEmployee && /* @__PURE__ */ jsxs("div", { className: "flex justify-end space-x-5 mt-auto ml-5", children: [
|
|
175
204
|
" ",
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
Button,
|
|
178
207
|
{
|
|
179
208
|
variant: "secondary",
|
|
180
|
-
onClick: () =>
|
|
181
|
-
|
|
209
|
+
onClick: () => handleSelectedPositionEmployee(
|
|
210
|
+
selectedPositionEmployee
|
|
182
211
|
),
|
|
183
212
|
children: "Odebrat přiřazení"
|
|
184
213
|
}
|
|
185
214
|
)
|
|
186
215
|
] })
|
|
187
216
|
] }),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
217
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end space-x-5 mt-auto ", children: [
|
|
218
|
+
/* @__PURE__ */ jsx(
|
|
219
|
+
Button,
|
|
191
220
|
{
|
|
192
221
|
variant: "secondary",
|
|
193
|
-
onClick: () =>
|
|
222
|
+
onClick: () => setModalOpen(false),
|
|
194
223
|
children: "Zrušit"
|
|
195
224
|
}
|
|
196
225
|
),
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
Button,
|
|
199
228
|
{
|
|
200
229
|
variant: "primary",
|
|
201
|
-
onClick: () =>
|
|
230
|
+
onClick: () => handleSave(selectedPositionEmployee),
|
|
202
231
|
children: "Uložit"
|
|
203
232
|
}
|
|
204
233
|
)
|
|
@@ -212,5 +241,6 @@ function X({
|
|
|
212
241
|
] });
|
|
213
242
|
}
|
|
214
243
|
export {
|
|
215
|
-
|
|
244
|
+
PositionsSelectorSingle as default
|
|
216
245
|
};
|
|
246
|
+
//# sourceMappingURL=PositionsSelectorSingle.js.map
|