react-luminus-components 1.3.51 → 1.3.53

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 (34) hide show
  1. package/README.md +349 -349
  2. package/dist/.vite/manifest.json +71 -71
  3. package/dist/{PrimaryButton-CrSiE8IK.cjs → PrimaryButton-BFR7py-F.cjs} +1 -1
  4. package/dist/{PrimaryButton-BxBrzBkU.js → PrimaryButton-PdGX8VfF.js} +1 -1
  5. package/dist/{SimpleTooltip-C51vatiT.js → SimpleTooltip-Cc3DVmZK.js} +1 -1
  6. package/dist/{SimpleTooltip-BodiP1Zi.cjs → SimpleTooltip-XWVJvT4P.cjs} +1 -1
  7. package/dist/contexts.cjs.js +1 -1
  8. package/dist/contexts.es.js +35 -35
  9. package/dist/{dateUtils-CfSBQG5j.js → dateUtils-C1hdRN9v.js} +1 -1
  10. package/dist/{dateUtils-Cm9L7Twa.cjs → dateUtils-DYvDmQHJ.cjs} +1 -1
  11. package/dist/hooks/useAxios/useAxios.d.ts +1 -0
  12. package/dist/hooks.cjs.js +1 -1
  13. package/dist/hooks.es.js +501 -481
  14. package/dist/layout.cjs.js +1 -1
  15. package/dist/layout.es.js +3 -3
  16. package/dist/main.cjs.js +1 -1
  17. package/dist/main.es.js +1903 -1903
  18. package/dist/{nivo-pie.es-IgQRn4IT.js → nivo-pie.es--oXJjsfy.js} +2262 -2260
  19. package/dist/nivo-pie.es-BehAujJ2.cjs +279 -0
  20. package/dist/{searchUtils-WOZywriZ.cjs → searchUtils-BWbFBdlA.cjs} +1 -1
  21. package/dist/{searchUtils-DLuUjagC.js → searchUtils-DChtbvC9.js} +1 -1
  22. package/dist/style.css +1 -1
  23. package/dist/{useConfirm-D589Ovqm.cjs → useConfirm-C1L3EWPP.cjs} +1 -1
  24. package/dist/{useConfirm-B_khYF2v.js → useConfirm-DKlCFqR6.js} +1 -1
  25. package/dist/{useEmployeePhotoPath-BxaDaY0V.js → useEmployeePhotoPath-DjxgOb6H.js} +3 -3
  26. package/dist/{useLocalStorageState-CbwAFNI7.js → useLocalStorageState-DWbVoRAx.js} +1 -1
  27. package/dist/{useLocalStorageState-CszaoRL9.cjs → useLocalStorageState-DfNJr0hH.cjs} +1 -1
  28. package/dist/{usePermissions-hAZCFtk1.js → usePermissions-BvEz11dh.js} +3 -3
  29. package/dist/{usePermissions-E_Foozgt.cjs → usePermissions-D4uO_uyT.cjs} +1 -1
  30. package/dist/utils.cjs.js +1 -1
  31. package/dist/utils.es.js +6 -6
  32. package/dist/variables.scss +171 -171
  33. package/package.json +108 -108
  34. package/dist/nivo-pie.es-DsuzKV0u.cjs +0 -279
package/dist/main.es.js CHANGED
@@ -1,18 +1,18 @@
1
- import { j as n, c as j, t as ce, a as Je, m as Br, b as Pr, d as Hr, s as Wr, e as zr, f as Vr, g as Ur, h as Gr, i as Yr, k as Kr, l as qr, T as Jn, n as Xn, o as hn, E as Qr, p as es, q as zt, r as ts, u as Zr, v as z, w as be, x as ns, F as Mt, y as Jr, z as Xr, A as eo, B as to, C as no, D as so, G as ro, H as oo, I as Vt, J as ss, K as rs, L as ao, M as Re, N as lo, O as co, P as Le, Q as io, R as kt, S as V, U as ue, V as uo, W as fo, X as os, Y as Ut, Z as Gt, _ as He, $ as we, a0 as as, a1 as Yt, a2 as Ne, a3 as ls, a4 as st, a5 as mo, a6 as cs, a7 as po, a8 as is, a9 as ho, aa as go, ab as ds, ac as xo, ad as jo, ae as yo, af as us, ag as wo, ah as vo, ai as ye, aj as bo, ak as _o, al as fs, am as No, an as Ct, ao as gn, ap as ko } from "./nivo-pie.es-IgQRn4IT.js";
2
- import { aq as Pd } from "./nivo-pie.es-IgQRn4IT.js";
1
+ import { j as n, c as j, t as ce, a as Je, m as Br, b as Pr, d as Hr, s as Wr, e as zr, f as Vr, g as Ur, h as Gr, i as Yr, k as Kr, l as qr, T as Jn, n as Xn, o as hn, E as Qr, p as es, q as zt, r as ts, u as Zr, v as z, w as be, x as ns, F as Mt, y as Jr, z as Xr, A as eo, B as to, C as no, D as so, G as ro, H as oo, I as Vt, J as ss, K as rs, L as ao, M as Re, N as lo, O as co, P as Le, Q as io, R as kt, S as V, U as ue, V as uo, W as fo, X as os, Y as Ut, Z as Gt, _ as mo, $ as as, a0 as po, a1 as ls, a2 as Yt, a3 as ho, a4 as go, a5 as st, a6 as cs, a7 as we, a8 as xo, a9 as jo, aa as yo, ab as is, ac as wo, ad as ds, ae as vo, af as He, ag as us, ah as ye, ai as bo, aj as _o, ak as fs, al as No, am as Ct, an as Ne, ao as gn, ap as ko } from "./nivo-pie.es--oXJjsfy.js";
2
+ import { aq as Pd } from "./nivo-pie.es--oXJjsfy.js";
3
3
  import * as M from "react";
4
- import he, { useCallback as $, useMemo as q, useEffect as O, useRef as Y, useState as I, useReducer as ms, useContext as B, createElement as Co, Component as $o, isValidElement as So, Suspense as Io } from "react";
5
- import { c as $e, d as wt, C as Do, a as ps, u as Fo, q as xn, F as Eo, b as hs, A as Oo, M as To, B as Mo, e as Lo, g as Ro, P as jn, f as ct, L as yn } from "./PrimaryButton-BxBrzBkU.js";
4
+ import he, { useCallback as $, useMemo as q, useEffect as O, useRef as Y, useState as I, useReducer as ms, useContext as B, Component as Co, isValidElement as $o, Suspense as So, createElement as Io } from "react";
5
+ import { c as $e, d as wt, C as Do, a as ps, u as Fo, q as xn, F as Eo, b as hs, A as Oo, M as To, B as Mo, e as Lo, g as Ro, P as jn, f as ct, L as yn } from "./PrimaryButton-PdGX8VfF.js";
6
6
  import { InteractionType as Ao } from "@azure/msal-browser";
7
7
  import { MsalAuthenticationTemplate as Bo } from "@azure/msal-react";
8
8
  import { Link as _e, Navigate as it, generatePath as Lt } from "react-router-dom";
9
9
  import { useFormContext as ke, Controller as gs } from "react-hook-form";
10
- import { s as wn, g as vn, d as ut, a as Se, f as Xe, p as et, t as De, b as Po, c as Ho } from "./dateUtils-CfSBQG5j.js";
11
- import { S as Kt } from "./SimpleTooltip-C51vatiT.js";
12
- import { u as xs, a as js, b as ys, c as Wo, d as zo, e as Vo } from "./useEmployeePhotoPath-BxaDaY0V.js";
10
+ import { s as wn, g as vn, d as ut, a as Se, f as Xe, t as De, b as Po, c as Ho, p as et } from "./dateUtils-C1hdRN9v.js";
11
+ import { S as Kt } from "./SimpleTooltip-Cc3DVmZK.js";
12
+ import { u as xs, a as js, b as ys, c as Wo, d as zo, e as Vo } from "./useEmployeePhotoPath-DjxgOb6H.js";
13
13
  import pt from "react-dom";
14
- import { u as Uo } from "./useConfirm-B_khYF2v.js";
15
- import { s as Rt } from "./searchUtils-DLuUjagC.js";
14
+ import { u as Uo } from "./useConfirm-DKlCFqR6.js";
15
+ import { s as Rt } from "./searchUtils-DChtbvC9.js";
16
16
  const ed = ({ fileLoader: t, fileName: e, children: s }) => {
17
17
  const r = $(async () => {
18
18
  var i, c;
@@ -1777,7 +1777,7 @@ const td = ({ heading: t, content: e, placement: s, children: r, trigger: o, pop
1777
1777
  /* @__PURE__ */ n.jsx(kt.Body, { children: e })
1778
1778
  ] }), trigger: o ?? "hover", rootClose: !0, show: l.controlled ? l.isOpen : void 0, onToggle: l.controlled ? (i) => l.setIsOpen(i) : void 0, children: r }), za = ({ children: t, onStorno: e, noSpacer: s }) => {
1779
1779
  const { texts: { formSubmit: r } } = B(ue);
1780
- return /* @__PURE__ */ n.jsxs(oi, { noSpacer: s, children: [
1780
+ return /* @__PURE__ */ n.jsxs(Zc, { noSpacer: s, children: [
1781
1781
  /* @__PURE__ */ n.jsxs(jn, { as: "button", color: "primary", size: "lg", type: "submit", children: [
1782
1782
  /* @__PURE__ */ n.jsx(uo, {}),
1783
1783
  t
@@ -1881,2006 +1881,2006 @@ const td = ({ heading: t, content: e, placement: s, children: r, trigger: o, pop
1881
1881
  ] });
1882
1882
  }, el = "_widget_etgh3_1", tl = {
1883
1883
  widget: el
1884
- }, vr = ({ currentSelection: t, selectedItemNavigateTo: e, children: s }) => {
1885
- if (!t || !t.id || !e)
1886
- return /* @__PURE__ */ n.jsx("div", { className: "luminus-input-container position-relative w-100", children: s });
1887
- const r = e(t);
1888
- return /* @__PURE__ */ n.jsx(_e, { to: r, className: "luminus-input-container position-relative w-100 text-decoration-none", children: s });
1889
- }, br = ({ InputContainer: t = He, label: e, value: s, onChange: r, hidden: o, disabled: a, className: l, type: i, withoutLabel: c }) => /* @__PURE__ */ n.jsx(t, { isForCheckInput: !0, hidden: o, label: e ?? "", withoutLabel: c, className: l, children: /* @__PURE__ */ n.jsx(ae.Check, { id: `check-${e}`, type: i ?? "checkbox", label: e ?? "", checked: s, onChange: (d) => {
1890
- var u;
1891
- r && r(((u = d.target) == null ? void 0 : u.checked) ?? !1);
1892
- }, className: l ?? "", hidden: o ?? !1, disabled: a ?? !1 }) }), Pe = ({ InputContainer: t = He, type: e, value: s, onChange: r, debounceMs: o, label: a, withoutLabel: l, placeholder: i, size: c, hidden: d, disabled: u, showClearIcon: m, clearValue: h, list: g, className: x, step: y, noSelectOnFocus: p }) => {
1893
- const w = e === "number", N = $(() => {
1894
- if (!r)
1895
- return;
1896
- const b = h ?? null;
1897
- r(w ? b ? Number(b) : null : (b == null ? void 0 : b.toString()) ?? "");
1898
- }, [h, w, r]), f = Y(null), [k, v] = I((s == null ? void 0 : s.toString()) ?? ""), C = $((b) => {
1899
- const D = b;
1900
- r && (w && r(D == null || D === "" ? null : Number(D)), r(D || null));
1901
- }, [w, r]), _ = $((b) => {
1902
- var R;
1903
- const D = (R = b.target) == null ? void 0 : R.value;
1904
- if (!o) {
1905
- C(D);
1906
- return;
1907
- }
1908
- v(D), f.current !== null && window.clearTimeout(f.current), f.current = window.setTimeout(() => {
1909
- C(D);
1910
- }, o);
1911
- }, [o, C]);
1912
- O(() => {
1913
- v(s === null ? "" : s.toString());
1914
- }, [s]);
1915
- const [E, S] = I(!1), F = xs(e, s ? s.toString() ?? null : null, E);
1916
- return /* @__PURE__ */ n.jsxs(t, { withoutLabel: l, label: a ?? "", hidden: d, className: x, children: [
1917
- /* @__PURE__ */ n.jsx(ae.Control, { type: F, placeholder: i ?? a, size: c, value: o ? k : (s == null ? void 0 : s.toString()) ?? "", onChange: _, className: x ?? "", hidden: d, disabled: u ?? !1, list: g, onFocus: (b) => {
1918
- S(!0), !p && b.target.select();
1919
- }, onBlur: () => S(!1), step: y }),
1920
- m && s !== null && r && !u && /* @__PURE__ */ n.jsx("div", { className: `luminus-input-remove-icon ${e !== "text" ? "inset" : ""}`, children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: N, children: /* @__PURE__ */ n.jsx(we, {}) }) })
1921
- ] });
1922
- }, yt = ({
1923
- InputContainer: t = He,
1924
- value: e,
1925
- options: s,
1926
- onChange: r,
1927
- label: o,
1928
- withoutLabel: a,
1929
- isNumber: l,
1930
- size: i,
1931
- hidden: c,
1932
- disabled: d,
1933
- showClearIcon: u,
1934
- clearValue: m,
1935
- noSortOptions: h,
1936
- className: g,
1937
- noEmptyOption: x
1938
- // it will still add the empty option if there is no value provided or value is empty string or null
1939
- }) => {
1940
- const y = $(() => {
1941
- if (!r)
1942
- return;
1943
- const p = m ?? null;
1944
- r(l ? p ? Number(p) : null : (p == null ? void 0 : p.toString()) ?? "");
1945
- }, [m, l, r]);
1946
- return /* @__PURE__ */ n.jsxs(t, { withoutLabel: a, label: o ?? "", hidden: c, className: g, children: [
1947
- /* @__PURE__ */ n.jsxs(ae.Select, { size: i, value: e ?? "", onChange: (p) => {
1948
- var N;
1949
- if (!r)
1950
- return;
1951
- const w = (N = p.target) == null ? void 0 : N.value;
1952
- l && r(w ? parseInt(w, 10) : null), r(w || null);
1953
- }, className: g ?? "", hidden: c, disabled: d ?? !1, children: [
1954
- x && !(e == null || e === "") ? void 0 : /* @__PURE__ */ n.jsx("option", { value: "" }),
1955
- s == null ? void 0 : s.sort((p, w) => h ? 0 : (p.name ?? "").localeCompare(w.name ?? "")).map((p) => /* @__PURE__ */ n.jsx("option", { value: p.id ?? "", children: p.name }, p.id))
1956
- ] }),
1957
- u && e && r && !d && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon inset", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: y, children: /* @__PURE__ */ n.jsx(we, {}) }) })
1884
+ }, nl = ({ show: t, widgets: e, handleClose: s, onWidgetPicked: r, texts: o }) => /* @__PURE__ */ n.jsxs(ct, { show: t, onHide: () => s(), children: [
1885
+ /* @__PURE__ */ n.jsx(ct.Header, { closeButton: !0, children: /* @__PURE__ */ n.jsx(ct.Title, { children: o.pickWidgetToAdd }) }),
1886
+ /* @__PURE__ */ n.jsx(ct.Body, { children: /* @__PURE__ */ n.jsx("div", { className: "list-group", children: e.filter((a) => a.id >= 0).map((a) => /* @__PURE__ */ n.jsx("div", { role: "button", className: "list-group-item bg-white", onClick: () => r(a.id), children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: a.name }) })) }) })
1887
+ ] }), Mn = ({ availableWidgets: t, onAdd: e, texts: s }) => {
1888
+ const [r, o] = I(!1);
1889
+ return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1890
+ /* @__PURE__ */ n.jsx("div", { className: j("luminus-empty-widget", tl.widget), children: /* @__PURE__ */ n.jsx(U, { onClick: () => o(!0), children: /* @__PURE__ */ n.jsx(mo, {}) }) }),
1891
+ /* @__PURE__ */ n.jsx(nl, { show: r, widgets: t, handleClose: () => o(!1), onWidgetPicked: (a) => {
1892
+ o(!1), e(a);
1893
+ }, texts: s })
1958
1894
  ] });
1959
- }, nd = ({ InputContainer: t = He, items: e, defaultSelection: s, selectedItemNavigateTo: r, onSearchQueryChange: o, texts: a, isLoading: l, isNumber: i, onSelect: c, label: d, withoutLabel: u, size: m, dropdownItemsNameWidth: h, additionalColumns: g, hidden: x, disabled: y, displayIdAsName: p, CustomOnChangeComponent: w, className: N }) => {
1960
- var D, R;
1961
- const [f, k] = I(s), [v, C] = I(!1);
1962
- O(() => {
1963
- k(s);
1964
- }, [s]);
1965
- const _ = $((H) => {
1966
- k(H);
1967
- }, []), E = $((H) => {
1968
- C(!1), _(H);
1969
- }, [_]);
1895
+ }, sl = (t) => {
1896
+ const [e, s] = I({ widgets: [] });
1970
1897
  O(() => {
1971
- c && c(f);
1972
- }, [f, c]);
1973
- const S = Y(null), F = r !== void 0, b = F && f !== null;
1974
- return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { withoutLabel: u, label: d ?? "", hidden: x, inputContainerClassName: j({ "luminus-dropdown-select-open": v }), className: N, children: [
1975
- /* @__PURE__ */ n.jsxs(vr, { currentSelection: f, selectedItemNavigateTo: r, children: [
1976
- p && (f == null ? void 0 : f.name) && /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "d-flex justify-content-end mt-2 luminus-dropdown-selection-name", children: f.name }),
1977
- /* @__PURE__ */ n.jsxs(ae.Select, { ref: S, size: m, value: (f == null ? void 0 : f.id) ?? "", onChange: (H) => k({
1978
- id: i ? Number(H.target.value) ?? null : H.target.value,
1979
- name: ""
1980
- }), onMouseDown: (H) => {
1981
- H.currentTarget.focus(), H.preventDefault();
1982
- }, onClick: () => {
1983
- !F && !y && C(!0);
1984
- }, className: j("w-100", {
1985
- "luminus-dropdown-picker-disabled": y,
1986
- "luminus-dropdown-picker-link": b
1987
- }), hidden: x, children: [
1988
- /* @__PURE__ */ n.jsx("option", { value: "" }),
1989
- s && /* @__PURE__ */ n.jsx("option", { value: s.id ?? void 0, children: s.name && ((D = s.name) == null ? void 0 : D.length) > 0 ? s.name : s.id }),
1990
- f && /* @__PURE__ */ n.jsx("option", { value: f.id ?? void 0, children: f.name && ((R = f.name) == null ? void 0 : R.length) > 0 ? f.name : f.id })
1991
- ] }),
1992
- w || !y && F ? /* @__PURE__ */ n.jsxs("div", { className: "custom-picker-button", children: [
1993
- !w && !y && F && /* @__PURE__ */ n.jsx(U, { size: "sm", color: "secondary", onClick: (H) => {
1994
- H.preventDefault(), H.stopPropagation(), C(!0);
1995
- }, children: /* @__PURE__ */ n.jsx(as, {}) }),
1996
- w ?? null
1997
- ] }) : null
1898
+ const o = localStorage.getItem("dashboardConfig");
1899
+ o ? s(JSON.parse(o)) : t && s(t);
1900
+ }, [t]);
1901
+ const r = $((o) => {
1902
+ s(o), localStorage.setItem("dashboardConfig", JSON.stringify(o));
1903
+ }, []);
1904
+ return { dashboardConfig: e, onChangeDashboardConfig: r };
1905
+ }, rl = "_dashboard_16plm_1", ol = "_widgets-grid_16plm_1", al = "_widget-wrapper_16plm_8", ll = "_full-width_16plm_13", cl = "_widget-edit_16plm_16", il = "_remove-icon_16plm_19", dl = "_full-width-icon_16plm_26", ul = "_widget-edit-overlay_16plm_36", ve = {
1906
+ dashboard: rl,
1907
+ "widgets-grid": "_widgets-grid_16plm_1",
1908
+ widgetsGrid: ol,
1909
+ "widget-wrapper": "_widget-wrapper_16plm_8",
1910
+ widgetWrapper: al,
1911
+ "full-width": "_full-width_16plm_13",
1912
+ fullWidth: ll,
1913
+ "widget-edit": "_widget-edit_16plm_16",
1914
+ widgetEdit: cl,
1915
+ "remove-icon": "_remove-icon_16plm_19",
1916
+ removeIcon: il,
1917
+ "full-width-icon": "_full-width-icon_16plm_26",
1918
+ fullWidthIcon: dl,
1919
+ "widget-edit-overlay": "_widget-edit-overlay_16plm_36",
1920
+ widgetEditOverlay: ul
1921
+ };
1922
+ class fl extends Co {
1923
+ constructor(e) {
1924
+ super(e), this.state = { hasError: !1 }, this.reload = this.reload.bind(this);
1925
+ }
1926
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1927
+ static getDerivedStateFromError(e) {
1928
+ return { hasError: !0 };
1929
+ }
1930
+ componentDidUpdate(e) {
1931
+ this.state.hasError && e.keyForErrorState !== this.props.keyForErrorState && this.setState({ hasError: !1 });
1932
+ }
1933
+ componentDidCatch(e, s) {
1934
+ console.error("Error:", e, s);
1935
+ }
1936
+ reload() {
1937
+ this.setState({ hasError: !1 });
1938
+ }
1939
+ render() {
1940
+ const { fallback: e, children: s, texts: r, reloadButtonDisplay: o = "append-after-child" } = this.props;
1941
+ return this.state.hasError ? o === "inject-to-child" && $o(e) ? he.cloneElement(e, {
1942
+ ...e.props
1943
+ }, /* @__PURE__ */ n.jsxs("div", { className: "translate-middle top-50 start-50 position-absolute d-flex flex-column align-items-center gap-2", children: [
1944
+ ...e.props.children,
1945
+ /* @__PURE__ */ n.jsx(jt, { type: "button", onClick: this.reload, children: r.reloadButtonContent })
1946
+ ] })) : /* @__PURE__ */ n.jsxs("div", { className: "translate-middle top-50 start-50 position-absolute d-flex flex-column align-items-center gap-2", children: [
1947
+ e,
1948
+ o === "none" ? null : /* @__PURE__ */ n.jsx(jt, { type: "button", onClick: this.reload, children: r.reloadButtonContent })
1949
+ ] }) : s;
1950
+ }
1951
+ }
1952
+ const ml = (t) => (s) => {
1953
+ const { texts: { errorBoundary: r } } = B(ue);
1954
+ return /* @__PURE__ */ n.jsx(t, { texts: r, ...s });
1955
+ }, pl = ml(fl), hl = "_widget-card_e9tsb_1", gl = {
1956
+ "widget-card": "_widget-card_e9tsb_1",
1957
+ widgetCard: hl
1958
+ }, Ln = ({ children: t, title: e, headerContent: s }) => /* @__PURE__ */ n.jsx(jc, { className: j(gl.widgetCard, "luminus-widget"), title: e, headerContent: s, contentClassName: "h-100 overflow-auto", children: t }), xl = ({ children: t, title: e }) => {
1959
+ const { texts: { widget: s } } = B(ue);
1960
+ return /* @__PURE__ */ n.jsx(pl, { fallback: /* @__PURE__ */ n.jsx(Ln, { title: e, children: s.fallbackError }), reloadButtonDisplay: "inject-to-child", children: /* @__PURE__ */ n.jsx(So, { fallback: /* @__PURE__ */ n.jsx(Ln, { title: e, children: /* @__PURE__ */ n.jsx(Go, {}) }), children: t }) });
1961
+ }, nd = ({ availableWidgets: t, editMode: e, defaultDashboardConfig: s }) => {
1962
+ var u;
1963
+ const { texts: { homeDashboard: r } } = B(ue), { dashboardConfig: o, onChangeDashboardConfig: a } = sl(s), l = $((m, h) => {
1964
+ var g, x;
1965
+ m === ((g = o.widgets) == null ? void 0 : g.length) ? a({
1966
+ ...o,
1967
+ widgets: [...o.widgets, { widgetId: h, fullWidth: !1 }]
1968
+ }) : a({
1969
+ ...o,
1970
+ widgets: ((x = o.widgets) == null ? void 0 : x.map((y, p) => p === m ? { widgetId: h, fullWidth: !1 } : y)) ?? []
1971
+ });
1972
+ }, [o, a]), i = $((m) => {
1973
+ var h, g;
1974
+ ((h = o.widgets[m]) == null ? void 0 : h.widgetId) === -1 ? a({
1975
+ ...o,
1976
+ widgets: ((g = o.widgets) == null ? void 0 : g.filter((x, y) => y !== m)) ?? []
1977
+ }) : l(m, -1);
1978
+ }, [o, a, l]), c = $((m) => {
1979
+ var h;
1980
+ a({
1981
+ ...o,
1982
+ widgets: ((h = o.widgets) == null ? void 0 : h.map((g, x) => x === m ? { ...g, fullWidth: !g.fullWidth } : g)) ?? []
1983
+ });
1984
+ }, [o, a]), d = $((m, h, g) => m ? /* @__PURE__ */ n.jsxs("div", { className: j(ve.widgetWrapper, {
1985
+ [ve.widgetEdit]: e && m.id !== -1
1986
+ }, { [ve.fullWidth]: g }), children: [
1987
+ e && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1988
+ /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => i(h), className: j(ve.removeIcon), children: /* @__PURE__ */ n.jsx(as, {}) }),
1989
+ /* @__PURE__ */ n.jsx(U, { color: g ? "danger" : "primary", onClick: () => c(h), className: j(ve.fullWidthIcon), children: /* @__PURE__ */ n.jsx(po, {}) })
1998
1990
  ] }),
1999
- S.current && /* @__PURE__ */ n.jsx(on, { show: v, onCancel: () => C(!1), items: e, currentSelection: f, onSelectionChange: E, onSearchQueryChange: o, texts: a, itemsNameWidth: h, additionalColumns: g, isLoading: l, disabled: y, inputRef: S })
1991
+ m.id === -1 ? e && /* @__PURE__ */ n.jsx("div", { className: ve.widgetWrapper, children: /* @__PURE__ */ n.jsx(Mn, { availableWidgets: t, onAdd: (x) => l(h, x), texts: r }) }) : /* @__PURE__ */ n.jsx(xl, { title: m.title, children: /* @__PURE__ */ n.jsx(m.WidgetElement, { title: m.title }) }),
1992
+ m.id > -1 && e && /* @__PURE__ */ n.jsx("div", { className: ve.widgetEditOverlay })
1993
+ ] }, h) : /* @__PURE__ */ n.jsx(n.Fragment, {}), [
1994
+ e,
1995
+ l,
1996
+ i,
1997
+ c,
1998
+ t,
1999
+ r
2000
+ ]);
2001
+ return /* @__PURE__ */ n.jsx("div", { className: ve.dashboard, children: /* @__PURE__ */ n.jsxs("div", { className: ve.widgetsGrid, children: [
2002
+ (u = o.widgets) == null ? void 0 : u.map((m, h) => d(t.find((g) => g.id === m.widgetId), h, m.fullWidth)),
2003
+ e && /* @__PURE__ */ n.jsx(Mn, { availableWidgets: t, onAdd: (m) => {
2004
+ var h;
2005
+ return l((h = o.widgets) == null ? void 0 : h.length, m);
2006
+ }, texts: r })
2000
2007
  ] }) });
2001
- }, sd = ({ InputContainer: t = He, value: e, onChange: s, label: r, size: o, showClearIcon: a, clearValue: l, hidden: i, disabled: c, rows: d, withoutLabel: u, debounceMs: m, className: h }) => {
2002
- const g = $(() => {
2003
- if (!s)
2004
- return;
2005
- const f = l ?? null;
2006
- s((f == null ? void 0 : f.toString()) ?? "");
2007
- }, [l, s]), x = Y(null), [y, p] = I((e == null ? void 0 : e.toString()) ?? ""), w = $((f) => {
2008
- const k = f;
2009
- s && s(k || null);
2010
- }, [s]), N = $((f) => {
2011
- var v;
2012
- const k = (v = f.target) == null ? void 0 : v.value;
2013
- if (!m) {
2014
- w(k);
2015
- return;
2016
- }
2017
- p(k), x.current !== null && window.clearTimeout(x.current), x.current = window.setTimeout(() => {
2018
- w(k);
2019
- }, m);
2020
- }, [m, w]);
2008
+ }, jl = "_badge_nhser_1", yl = "_sm_nhser_1", wl = "_md_nhser_4", vl = "_lg_nhser_7", Rn = {
2009
+ badge: jl,
2010
+ sm: yl,
2011
+ md: wl,
2012
+ lg: vl
2013
+ }, sd = ({ children: t, color: e = "primary", size: s = "md", className: r }) => /* @__PURE__ */ n.jsx("span", { className: j(`luminus-badge badge bg-${e} ${r ?? ""}`, Rn.badge, Rn[s]), children: t }), bl = "_collapse-icon_1ahhn_1", _l = "_collapsed_1ahhn_6", An = {
2014
+ "collapse-icon": "_collapse-icon_1ahhn_1",
2015
+ collapseIcon: bl,
2016
+ collapsed: _l
2017
+ }, Nl = ({ title: t, children: e, className: s, ...r }) => {
2018
+ const o = r.controlled ? !1 : r.defaultOpen ?? !1, [a, l] = I(o), i = r.controlled ? r.isOpen : a;
2021
2019
  return O(() => {
2022
- p(e === null ? "" : e.toString());
2023
- }, [e]), /* @__PURE__ */ n.jsxs(t, { label: r ?? "", hidden: i, withoutLabel: u, className: h, isForTextAreaInput: !0, children: [
2024
- /* @__PURE__ */ n.jsx(ae.Control, { as: "textarea", size: o, value: m ? y : e ?? "", onChange: N, hidden: i, disabled: c, rows: d ?? 2, className: "w-100" }),
2025
- a && e && s && !c && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: g, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2020
+ l(o);
2021
+ }, [o]), /* @__PURE__ */ n.jsxs("div", { className: s ?? "", children: [
2022
+ /* @__PURE__ */ n.jsxs("div", { role: "button", className: "d-flex align-items-center justify-content-between pb-3 pt-2", onClick: () => r.controlled ? r.onToggle(!r.isOpen) : l(!a), children: [
2023
+ /* @__PURE__ */ n.jsx(V, { variant: "h6", children: t }),
2024
+ /* @__PURE__ */ n.jsx(ls, { className: j(An.collapseIcon, {
2025
+ [An.collapsed]: i
2026
+ }) })
2027
+ ] }),
2028
+ /* @__PURE__ */ n.jsx(bs, { in: i, children: /* @__PURE__ */ n.jsx("div", { children: e }) }),
2029
+ /* @__PURE__ */ n.jsx("hr", { className: `my-0 ${i ? "mt-3" : ""}` })
2026
2030
  ] });
2027
- };
2028
- function _r(t) {
2029
- return Yt({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" }, child: [] }] })(t);
2030
- }
2031
- function Nr(t) {
2032
- return Yt({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" }, child: [] }] })(t);
2033
- }
2034
- function nl(t) {
2035
- return Yt({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z" }, child: [] }] })(t);
2036
- }
2037
- const rd = ({ InputContainer: t = He, value: e, onChange: s, debounceMs: r, label: o, withoutLabel: a, placeholder: l, size: i, hidden: c, disabled: d, showClearIcon: u, clearValue: m, className: h, step: g, stepperStep: x = 1 }) => {
2038
- const y = $(() => {
2039
- if (!s)
2040
- return;
2041
- const v = m ?? null;
2042
- s(v ? Number(v) : null);
2043
- }, [m, s]), p = Y(null), [w, N] = I((e == null ? void 0 : e.toString()) ?? ""), f = $((v) => {
2044
- const C = v;
2045
- s && s(C == null || C === "" ? null : Number(C));
2046
- }, [s]), k = $((v) => {
2047
- var _;
2048
- const C = (_ = v.target) == null ? void 0 : _.value;
2049
- if (!r) {
2050
- f(C);
2051
- return;
2052
- }
2053
- N(C), p.current !== null && window.clearTimeout(p.current), p.current = window.setTimeout(() => {
2054
- f(C);
2055
- }, r);
2056
- }, [r, f]);
2057
- return O(() => {
2058
- N(e === null ? "" : e.toString());
2059
- }, [e]), /* @__PURE__ */ n.jsx(t, { withoutLabel: a, label: o ?? "", hidden: c, className: h, children: /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
2060
- /* @__PURE__ */ n.jsx(ae.Control, { type: "number", placeholder: l ?? o, size: i, value: r ? w : e ?? "", onChange: k, className: `luminus-numeric-stepper ${h ?? ""}`, hidden: c, disabled: d ?? !1, step: g }),
2061
- /* @__PURE__ */ n.jsx("div", { className: "stepper-icon left", children: !d && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (v) => {
2062
- v.preventDefault(), v.stopPropagation(), f(((e ?? 0) - x).toString());
2063
- }, children: /* @__PURE__ */ n.jsx(_r, {}) }) }),
2064
- /* @__PURE__ */ n.jsx("div", { className: "stepper-icon right", children: !d && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (v) => {
2065
- v.preventDefault(), v.stopPropagation(), f(((e ?? 0) + x).toString());
2066
- }, children: /* @__PURE__ */ n.jsx(Nr, {}) }) }),
2067
- u && e && s && !d && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: y, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2068
- ] }) });
2069
- }, od = ({ InputContainer: t = Ne, formField: e, label: s, resetsFields: r, type: o, required: a, hidden: l, disabled: i, withoutLabel: c, className: d }) => {
2070
- const { register: u, formState: m, setValue: h } = ke(), [g, x] = I(void 0), [y, p] = I(!1);
2071
- O(() => {
2072
- const N = e.split(".");
2073
- let f = m.errors;
2074
- N.forEach((k) => {
2075
- f !== void 0 && (f = f[k]);
2076
- }), x(f);
2077
- }, [m, e]), O(() => {
2078
- m.isSubmitted && p(!0);
2079
- }, [m]);
2080
- const w = g !== void 0;
2081
- return /* @__PURE__ */ n.jsxs(t, { isForCheckInput: !0, hidden: l, label: `${s}${a ? " *" : ""}`, isInvalid: w, withoutLabel: c, className: d, children: [
2082
- /* @__PURE__ */ n.jsx(ae.Check, { id: `check-${e}`, type: o ?? "checkbox", label: `${s}${a ? " *" : ""}`, ...u(e, {
2083
- onChange: () => {
2084
- r && r.forEach((N) => h(N, null, { shouldDirty: !0, shouldValidate: y }));
2031
+ }, kl = "_feedback_esh1j_1", Cl = "_feedback-spacer_esh1j_8", Bn = {
2032
+ feedback: kl,
2033
+ "feedback-spacer": "_feedback-spacer_esh1j_8",
2034
+ feedbackSpacer: Cl
2035
+ }, Fe = ({ message: t }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2036
+ /* @__PURE__ */ n.jsx("div", { className: j("invalid-feedback luminus-invalid-feedback", Bn.feedback), children: t }),
2037
+ /* @__PURE__ */ n.jsx("div", { className: j("invalid-feedback-spacer", Bn.feedbackSpacer), children: t })
2038
+ ] });
2039
+ function $l(t, e, s) {
2040
+ var r = this, o = Y(null), a = Y(0), l = Y(null), i = Y([]), c = Y(), d = Y(), u = Y(t), m = Y(!0);
2041
+ u.current = t;
2042
+ var h = typeof window < "u", g = !e && e !== 0 && h;
2043
+ if (typeof t != "function") throw new TypeError("Expected a function");
2044
+ e = +e || 0;
2045
+ var x = !!(s = s || {}).leading, y = !("trailing" in s) || !!s.trailing, p = "maxWait" in s, w = "debounceOnServer" in s && !!s.debounceOnServer, N = p ? Math.max(+s.maxWait || 0, e) : null;
2046
+ O(function() {
2047
+ return m.current = !0, function() {
2048
+ m.current = !1;
2049
+ };
2050
+ }, []);
2051
+ var f = q(function() {
2052
+ var k = function(F) {
2053
+ var b = i.current, D = c.current;
2054
+ return i.current = c.current = null, a.current = F, d.current = u.current.apply(D, b);
2055
+ }, v = function(F, b) {
2056
+ g && cancelAnimationFrame(l.current), l.current = g ? requestAnimationFrame(F) : setTimeout(F, b);
2057
+ }, C = function(F) {
2058
+ if (!m.current) return !1;
2059
+ var b = F - o.current;
2060
+ return !o.current || b >= e || b < 0 || p && F - a.current >= N;
2061
+ }, _ = function(F) {
2062
+ return l.current = null, y && i.current ? k(F) : (i.current = c.current = null, d.current);
2063
+ }, E = function F() {
2064
+ var b = Date.now();
2065
+ if (C(b)) return _(b);
2066
+ if (m.current) {
2067
+ var D = e - (b - o.current), R = p ? Math.min(D, N - (b - a.current)) : D;
2068
+ v(F, R);
2085
2069
  }
2086
- }), isInvalid: w, hidden: l, disabled: i, className: "w-100" }),
2087
- g && /* @__PURE__ */ n.jsx(Fe, { message: g.message })
2088
- ] });
2089
- }, ad = ({ InputContainer: t = Ne, label: e, formField: s, options: r, resetsFields: o, required: a, disabled: l, hidden: i, className: c }) => {
2090
- const { register: d, formState: u, setValue: m, watch: h } = ke(), [g, x] = I(void 0), [y, p] = I(!1), w = q(() => r, [r]);
2091
- O(() => {
2092
- const f = s.split(".");
2093
- let k = u.errors;
2094
- f.forEach((v) => {
2095
- k !== void 0 && (k = k[v]);
2096
- }), x(k);
2097
- }, [u, s]), O(() => {
2098
- u.isSubmitted && p(!0);
2099
- }, [u]);
2100
- const N = g !== void 0;
2101
- return /* @__PURE__ */ n.jsxs(t, { isForRadioInput: !0, hidden: i, withoutLabel: !e, label: `${e}${a ? " *" : ""}`, isInvalid: N, className: c, children: [
2102
- w.map((f) => /* @__PURE__ */ n.jsx(ae.Check, { id: `radio-${f.id}`, label: f.name, type: "radio", value: f.id ?? "", checked: h(s) === f.id, ...d(s, {
2103
- onChange: () => {
2104
- o && o.forEach((k) => m(k, null, { shouldDirty: !0, shouldValidate: y }));
2070
+ }, S = function() {
2071
+ if (h || w) {
2072
+ var F = Date.now(), b = C(F);
2073
+ if (i.current = [].slice.call(arguments), c.current = r, o.current = F, b) {
2074
+ if (!l.current && m.current) return a.current = o.current, v(E, e), x ? k(o.current) : d.current;
2075
+ if (p) return v(E, e), k(o.current);
2076
+ }
2077
+ return l.current || v(E, e), d.current;
2105
2078
  }
2106
- }), isInvalid: N, hidden: i, disabled: l, className: "w-100" }, f.id)),
2107
- g && /* @__PURE__ */ n.jsx(Fe, { message: g.message })
2108
- ] });
2109
- }, ld = ({ InputContainer: t = Ne, formField: e, label: s, resetsFields: r, size: o, showClearIcon: a, clearValue: l, required: i, hidden: c, disabled: d, rows: u, withoutLabel: m, customFormControlProps: h, className: g }) => {
2110
- const { register: x, formState: y, setValue: p, watch: w } = ke(), [N, f] = I(void 0), [k, v] = I(!1), C = $(() => {
2111
- const S = l ?? null;
2112
- p(e, (S == null ? void 0 : S.toString()) ?? "", { shouldDirty: !0, shouldValidate: k });
2113
- }, [l, p, e, k]), _ = $(() => {
2114
- const S = e.split(".");
2115
- let F = y.errors;
2116
- S.forEach((b) => {
2117
- F !== void 0 && (F = F[b]);
2118
- }), f(F);
2119
- }, [y, e]);
2079
+ };
2080
+ return S.cancel = function() {
2081
+ l.current && (g ? cancelAnimationFrame(l.current) : clearTimeout(l.current)), a.current = 0, i.current = o.current = c.current = l.current = null;
2082
+ }, S.isPending = function() {
2083
+ return !!l.current;
2084
+ }, S.flush = function() {
2085
+ return l.current ? _(Date.now()) : d.current;
2086
+ }, S;
2087
+ }, [x, p, e, N, y, g, h, w]);
2088
+ return f;
2089
+ }
2090
+ function Sl(t, e) {
2091
+ return t === e;
2092
+ }
2093
+ function Il(t, e) {
2094
+ return e;
2095
+ }
2096
+ function vr(t, e, s) {
2097
+ var r = Sl, o = ms(Il, t), a = o[0], l = o[1], i = $l($(function(d) {
2098
+ return l(d);
2099
+ }, [l]), e, s), c = Y(t);
2100
+ return r(c.current, t) || (i(t), c.current = t), r(a, t) && i.cancel(), [a, i];
2101
+ }
2102
+ const Dl = "_wrapper_uccrb_1", Fl = "_open_uccrb_9", El = "_dropdown_uccrb_13", Ol = "_search-input-container_uccrb_19", Tl = "_search-input_uccrb_19", Ml = "_loading-container_uccrb_25", Ll = "_items-container_uccrb_32", Rl = "_header-row_uccrb_38", Al = "_item_uccrb_32", Bl = "_name_uccrb_57", Pl = "_column-item_uccrb_62", Hl = "_icon_uccrb_66", Wl = "_clear-button_uccrb_74", fe = {
2103
+ wrapper: Dl,
2104
+ open: Fl,
2105
+ dropdown: El,
2106
+ "search-input-container": "_search-input-container_uccrb_19",
2107
+ searchInputContainer: Ol,
2108
+ "search-input": "_search-input_uccrb_19",
2109
+ searchInput: Tl,
2110
+ "loading-container": "_loading-container_uccrb_25",
2111
+ loadingContainer: Ml,
2112
+ "items-container": "_items-container_uccrb_32",
2113
+ itemsContainer: Ll,
2114
+ "header-row": "_header-row_uccrb_38",
2115
+ headerRow: Rl,
2116
+ item: Al,
2117
+ name: Bl,
2118
+ "column-item": "_column-item_uccrb_62",
2119
+ columnItem: Pl,
2120
+ icon: Hl,
2121
+ "clear-button": "_clear-button_uccrb_74",
2122
+ clearButton: Wl
2123
+ }, rn = ({ show: t, onCancel: e, items: s, currentSelection: r, onSelectionChange: o, onSearchQueryChange: a, texts: l, itemsNameWidth: i, additionalColumns: c, displayIdAsName: d = !1, autoHideSearch: u = !1, allItemsLength: m, disabled: h, isLoading: g = !1, inputRef: x }) => {
2124
+ var W;
2125
+ const y = Y(null), p = Y(null), w = Y(null), N = Y(null), [f, k] = I(""), [v] = vr(f, 500), [, C] = I(!1), _ = (W = x.current) == null ? void 0 : W.getBoundingClientRect(), E = (_ == null ? void 0 : _.x) ?? 0, S = ((_ == null ? void 0 : _.x) ?? 0) + ((_ == null ? void 0 : _.width) ?? 0), F = (_ == null ? void 0 : _.y) ?? 0, b = ((_ == null ? void 0 : _.y) ?? 0) + ((_ == null ? void 0 : _.height) ?? 0), D = (_ == null ? void 0 : _.width) ?? 0, R = (_ == null ? void 0 : _.height) ?? 0, H = 5, Q = q(() => E ? E > window.innerWidth / 2 : !1, [E]), X = q(() => F ? F > window.innerHeight / 2 : !1, [F]);
2120
2126
  O(() => {
2121
- _();
2122
- }, [_]), O(() => {
2123
- y.isSubmitted && v(!0);
2124
- }, [y]);
2125
- const E = N !== void 0;
2126
- return /* @__PURE__ */ n.jsxs(t, { label: `${s}${i ? " *" : ""}`, hidden: c, withoutLabel: m, isInvalid: E, className: g, isForTextAreaInput: !0, children: [
2127
- /* @__PURE__ */ n.jsx(ae.Control, { as: "textarea", size: o, ...x(e, {
2128
- setValueAs: (S) => S == null || S === "" ? null : S,
2129
- onChange: () => {
2130
- r && r.forEach((S) => p(S, null, { shouldDirty: !0, shouldValidate: k }));
2131
- }
2132
- }), isInvalid: E, hidden: c, disabled: d, rows: u ?? 2, className: "w-100", ...h }),
2133
- a && w(e) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: C, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
2134
- N && /* @__PURE__ */ n.jsx(Fe, { message: N.message })
2135
- ] });
2136
- }, cd = ({ InputContainer: t = Ne, type: e, formField: s, label: r, placeholder: o, size: a, resetsFields: l, showClearIcon: i, clearValue: c, required: d, hidden: u, disabled: m, withoutLabel: h, list: g, step: x, CustomOnChangeComponent: y, noSelectOnFocus: p, className: w }) => {
2137
- const { register: N, formState: f, setValue: k, watch: v } = ke(), [C, _] = I(void 0), [E, S] = I(!1), F = $(() => {
2138
- const L = c ?? null;
2139
- e === "number" ? k(s, L !== null ? Number(L) : null, {
2140
- shouldDirty: !0,
2141
- shouldValidate: E
2142
- }) : k(s, (L == null ? void 0 : L.toString()) ?? "", { shouldDirty: !0, shouldValidate: E });
2143
- }, [c, e, k, s, E]), b = $(() => {
2144
- const L = s.split(".");
2145
- let Z = f.errors;
2146
- L.forEach((ee) => {
2147
- Z !== void 0 && (Z = Z[ee]);
2148
- }), _(Z);
2149
- }, [f, s]);
2127
+ var A;
2128
+ t && ((A = w.current) == null || A.focus());
2129
+ }, [w, t]), O(() => {
2130
+ t || k("");
2131
+ }, [t]), O(() => {
2132
+ a(v);
2133
+ }, [v, a]);
2134
+ const [L, Z] = I(null);
2150
2135
  O(() => {
2151
- b();
2152
- }, [b]), O(() => {
2153
- f.isSubmitted && S(!0);
2154
- }, [f]);
2155
- const D = C !== void 0, [R, H] = I(!1), Q = v(s), X = xs(e, Q ?? null, R);
2156
- return /* @__PURE__ */ n.jsxs(t, { label: `${r}${d ? " *" : ""}`, hidden: u, withoutLabel: h, isInvalid: D, className: w, children: [
2157
- /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
2158
- /* @__PURE__ */ n.jsx(ae.Control, { type: X, placeholder: o ?? r, size: a, onFocus: (L) => {
2159
- H(!0), !p && L.target.select();
2160
- }, ...N(s, {
2161
- setValueAs: (L) => e === "number" ? L == null || L === "" ? null : Number(L) : L == null || L === "" ? null : L,
2162
- onChange: () => {
2163
- l && l.forEach((L) => k(L, null, { shouldDirty: !0, shouldValidate: E }));
2164
- },
2165
- onBlur: () => H(!1)
2166
- }), isInvalid: D, hidden: u, disabled: m, list: g, className: "w-100", step: x }),
2167
- y && /* @__PURE__ */ n.jsx("div", { className: "custom-picker-button", children: y })
2168
- ] }),
2169
- i && v(s) && /* @__PURE__ */ n.jsx("div", { className: `luminus-input-remove-icon ${e !== "text" ? "inset" : ""}`, children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: F, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
2170
- C && /* @__PURE__ */ n.jsx(Fe, { message: C.message })
2171
- ] });
2172
- }, id = ({ InputContainer: t = Ne, formField: e, label: s, size: r, defaultSelection: o, resetsFields: a, isNumber: l, required: i, hidden: c, disabled: d, items: u, onSearchQueryChange: m, selectedItemNavigateTo: h, texts: g, dropdownItemsNameWidth: x, isLoading: y, withoutLabel: p, additionalColumns: w, CustomOnChangeComponent: N, displayIdAsName: f, onSelect: k, className: v }) => {
2173
- const { formState: C, setValue: _, watch: E, control: S } = ke(), [F, b] = I(void 0), [D, R] = I(!1), [H, Q] = I(!1), X = E(e) ?? null, L = X === (o == null ? void 0 : o.id) ? o == null ? void 0 : o.name : E(`${e}-DropdownName`), Z = q(() => X == null ? null : { id: X ?? null, name: L ?? "" }, [X, L]), ee = $(() => {
2174
- const W = e.split(".");
2175
- let A = C.errors;
2176
- W.forEach((ne) => {
2177
- A !== void 0 && (A = A[ne]);
2178
- }), b(A);
2179
- }, [C, e]), te = $((W) => {
2180
- if ((W == null ? void 0 : W.id) === X)
2181
- return;
2182
- if (k && k(W), a && a.forEach((ne) => _(ne, null, { shouldDirty: !0, shouldValidate: H })), W === null) {
2183
- _(e, null, {
2184
- shouldDirty: !0,
2185
- shouldValidate: H
2186
- }), _(`${e}-DropdownName`, null);
2187
- return;
2136
+ t && s.length > 0 ? Z(0) : Z(null);
2137
+ }, [s, t]);
2138
+ const ee = q(() => L !== null ? s.at(L) ?? null : null, [L, s]), te = $((A, ne) => {
2139
+ var We, ze;
2140
+ const me = document.getElementById(`item-${A}`);
2141
+ if (me) {
2142
+ const Ve = me.clientHeight ?? 0;
2143
+ ne === "down" ? (We = N.current) == null || We.scrollBy({
2144
+ left: 0,
2145
+ top: Ve,
2146
+ behavior: "smooth"
2147
+ }) : (ze = N.current) == null || ze.scrollBy({
2148
+ left: 0,
2149
+ top: -Ve,
2150
+ behavior: "smooth"
2151
+ });
2188
2152
  }
2189
- let A = null;
2190
- l ? A = (W == null ? void 0 : W.id) !== null && (W == null ? void 0 : W.id) !== "" ? parseInt(W.id.toString(), 10) : null : A = W.id === null || W.id === void 0 || W.id === "" ? null : W.id, _(e, A, {
2191
- shouldDirty: !0,
2192
- shouldValidate: H
2193
- }), _(`${e}-DropdownName`, W.name ?? "");
2194
- }, [_, e, H, l, a, X, k]), T = $((W) => {
2195
- R(!1), te(W);
2196
- }, [te]), re = $(() => {
2197
- R(!1);
2153
+ }, []), T = $((A) => {
2154
+ if (L === null || h)
2155
+ return;
2156
+ const ne = L + A;
2157
+ ne < 0 || ne >= s.length || Z((me) => (me !== null && te(me, A > 0 ? "down" : "up"), ne));
2158
+ }, [L, s, h, te]), re = $((A) => {
2159
+ if (t)
2160
+ switch (A.key) {
2161
+ case "Escape":
2162
+ A.stopPropagation(), A.preventDefault(), e();
2163
+ break;
2164
+ case "Enter":
2165
+ A.stopPropagation(), A.preventDefault(), h || o(ee);
2166
+ break;
2167
+ case "ArrowUp":
2168
+ A.stopPropagation(), A.preventDefault(), T(-1);
2169
+ break;
2170
+ case "ArrowDown":
2171
+ A.stopPropagation(), A.preventDefault(), T(1);
2172
+ break;
2173
+ }
2174
+ }, [e, t, T, ee, h, o]), de = $(() => {
2175
+ C((A) => !A);
2198
2176
  }, []);
2199
- O(() => {
2200
- ee();
2201
- }, [ee]), O(() => {
2202
- C.isSubmitted && Q(!0);
2203
- }, [C]);
2204
- const de = Y(null), pe = F !== void 0, le = h !== void 0, xe = le && Z !== null;
2205
- return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { label: `${s}${i ? " *" : ""}`, hidden: c, withoutLabel: p, isInvalid: pe, inputContainerClassName: j({ "luminus-dropdown-select-open": D }), className: v, children: [
2206
- /* @__PURE__ */ n.jsxs(vr, { currentSelection: Z, selectedItemNavigateTo: h, children: [
2207
- f && (Z == null ? void 0 : Z.name) && /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "d-flex justify-content-end mt-2 luminus-dropdown-selection-name", children: Z.name }),
2208
- /* @__PURE__ */ n.jsx(gs, { control: S, name: e, render: () => /* @__PURE__ */ n.jsx(ae.Select, { size: r, onMouseDown: (W) => {
2209
- W.currentTarget.focus(), W.preventDefault();
2210
- }, onClick: () => {
2211
- !le && !d && R(!0);
2212
- }, ref: de, value: X ?? "", onChange: () => {
2213
- }, isInvalid: pe, hidden: c, className: j("w-100", {
2214
- "luminus-dropdown-picker-disabled": d,
2215
- "luminus-dropdown-picker-link": xe
2216
- }), children: /* @__PURE__ */ n.jsx("option", { value: X, children: f ? X : (L == null ? void 0 : L.length) > 0 ? L : X }) }) }),
2217
- N || !d && le ? /* @__PURE__ */ n.jsxs("div", { className: "custom-picker-button", children: [
2218
- !N && !d && le && /* @__PURE__ */ n.jsx(U, { size: "sm", color: "secondary", onClick: (W) => {
2219
- W.preventDefault(), W.stopPropagation(), R(!0);
2220
- }, children: /* @__PURE__ */ n.jsx(as, {}) }),
2221
- N ?? null
2222
- ] }) : null
2223
- ] }),
2224
- F && /* @__PURE__ */ n.jsx(Fe, { message: F.message }),
2225
- de.current && /* @__PURE__ */ n.jsx(on, { show: D, onCancel: re, items: u, currentSelection: Z, onSelectionChange: T, onSearchQueryChange: m, texts: g, itemsNameWidth: x, additionalColumns: w, displayIdAsName: f, isLoading: y, disabled: d, inputRef: de })
2226
- ] }) });
2227
- }, dd = ({ InputContainer: t = Ne, label: e, formField: s, hidden: r, required: o, placeholder: a, disabled: l, showClearIcon: i, resetsFields: c, multiple: d, accept: u, withoutLabel: m, className: h }) => {
2228
- const { watch: g, setValue: x, register: y, formState: p } = ke(), [w, N] = I(!1), [f, k] = I(void 0), v = $(() => {
2229
- x(s, "");
2230
- }, [x, s]), C = $(() => {
2231
- const E = s.split(".");
2232
- let S = p.errors;
2233
- E.forEach((F) => {
2234
- S !== void 0 && (S = S[F]);
2235
- }), k(S);
2236
- }, [p, s]);
2237
- O(C, [C]), O(() => {
2238
- p.isSubmitted && N(!0);
2239
- }, [p]);
2240
- const _ = f !== void 0;
2241
- return /* @__PURE__ */ n.jsxs(t, { label: `${e}${o ? "*" : ""}`, hidden: r, withoutLabel: m, isInvalid: _, className: h, children: [
2242
- /* @__PURE__ */ n.jsx(hs, { type: "file", multiple: d, accept: u.join(", "), placeholder: a ?? e, isInvalid: _, hidden: r, disabled: l, className: "w-100", ...y(s, {
2243
- onChange: () => {
2244
- c && c.forEach((E) => x(E, null, { shouldDirty: !0, shouldValidate: w }));
2245
- }
2246
- }) }),
2247
- i && g(s) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: v, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
2248
- f && /* @__PURE__ */ n.jsx(Fe, { message: f.message })
2249
- ] });
2250
- }, ud = ({ children: t, onStorno: e, noSpacer: s }) => {
2251
- const { formState: r } = ke(), [o, a] = I(!1);
2252
- return O(() => {
2253
- a(Object.keys(r.dirtyFields).length > 0);
2254
- }, [r]), o ? /* @__PURE__ */ n.jsx(za, { onStorno: e, noSpacer: s, children: t }) : null;
2255
- }, fd = ({ InputContainer: t = Ne, options: e, formField: s, label: r, size: o, resetsFields: a, isNumber: l, required: i, hidden: c, disabled: d, withoutLabel: u, noSortOptions: m, suffixIdToName: h, className: g }) => {
2256
- const { texts: { customSelect: x } } = B(ue), { formState: y, setValue: p, watch: w, control: N } = ke(), [f, k] = I(void 0), [v, C] = I(!1), [_, E] = I(!1), [S, F] = I(""), b = w(s), D = q(() => e.find((T) => T.id === b) ?? null, [e, b]), R = $(() => {
2257
- const T = s.split(".");
2258
- let re = y.errors;
2259
- T.forEach((de) => {
2260
- re !== void 0 && (re = re[de]);
2261
- }), k(re);
2262
- }, [y, s]), H = $((T) => {
2263
- if ((T == null ? void 0 : T.id) === b)
2264
- return;
2265
- if (a && a.forEach((de) => p(de, null, { shouldDirty: !0, shouldValidate: _ })), T === null) {
2266
- p(s, null, {
2267
- shouldDirty: !0,
2268
- shouldValidate: _
2269
- });
2270
- return;
2271
- }
2272
- let re = null;
2273
- l ? re = (T == null ? void 0 : T.id) !== null && (T == null ? void 0 : T.id) !== "" ? parseInt(T.id.toString(), 10) : null : re = T.id === null || T.id === void 0 || T.id === "" ? null : T.id, p(s, re, {
2274
- shouldDirty: !0,
2275
- shouldValidate: _
2276
- });
2277
- }, [p, s, l, a, b, _]), Q = $((T) => {
2278
- C(!1), H(T);
2279
- }, [H]), X = $((T) => {
2280
- F(T);
2281
- }, []);
2282
- O(() => {
2283
- R();
2284
- }, [R]), O(() => {
2285
- y.isSubmitted && E(!0);
2286
- }, [y]);
2287
- const L = $((T) => {
2288
- var re;
2289
- return T === null ? "" : !T.name || T.name.length === 0 ? ((re = T.id) == null ? void 0 : re.toString()) ?? "" : h ? `${T.name} (${T.id})` : T.name;
2290
- }, [h]), Z = q(() => e.map((T) => ({
2291
- id: T.id,
2292
- name: L(T)
2293
- })).filter((T) => Rt(T.name, S)).sort((T, re) => m ? 0 : (T.name ?? "").localeCompare(re.name ?? "")), [e, m, S, L]), ee = Y(null), te = f !== void 0;
2294
- return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { label: `${r}${i ? " *" : ""}`, hidden: c, withoutLabel: u, isInvalid: te, inputContainerClassName: j({ "luminus-dropdown-select-open": v }), className: g, children: [
2295
- /* @__PURE__ */ n.jsx(gs, { control: N, name: s, render: () => /* @__PURE__ */ n.jsx(ae.Select, { size: o, onMouseDown: (T) => {
2296
- T.currentTarget.focus(), T.preventDefault();
2297
- }, onClick: () => {
2298
- C(!0);
2299
- }, ref: ee, value: b ?? "", onChange: () => {
2300
- }, isInvalid: te, hidden: c, disabled: d, className: "w-100", children: /* @__PURE__ */ n.jsx("option", { value: (D == null ? void 0 : D.id) ?? "", children: L(D) }) }) }),
2301
- f && /* @__PURE__ */ n.jsx(Fe, { message: f.message }),
2302
- ee.current && /* @__PURE__ */ n.jsx(on, { show: v, onCancel: () => C(!1), items: Z, currentSelection: D ?? null, onSelectionChange: Q, onSearchQueryChange: X, texts: x, disabled: d, inputRef: ee, autoHideSearch: !0, allItemsLength: e.length })
2303
- ] }) });
2304
- }, md = ({ InputContainer: t = Ne, formField: e, label: s, placeholder: r, size: o, resetsFields: a, showClearIcon: l, clearValue: i, required: c, hidden: d, disabled: u, withoutLabel: m, step: h, stepperStep: g = 1, className: x }) => {
2305
- const { register: y, formState: p, setValue: w, watch: N } = ke(), [f, k] = I(void 0), [v, C] = I(!1), _ = $(() => {
2306
- const b = i ?? null;
2307
- w(e, b !== null ? Number(b) : null, {
2308
- shouldDirty: !0,
2309
- shouldValidate: v
2310
- });
2311
- }, [i, w, e, v]), E = $(() => {
2312
- const b = e.split(".");
2313
- let D = p.errors;
2314
- b.forEach((R) => {
2315
- D !== void 0 && (D = D[R]);
2316
- }), k(D);
2317
- }, [p, e]);
2318
- O(() => {
2319
- E();
2320
- }, [E]), O(() => {
2321
- p.isSubmitted && C(!0);
2322
- }, [p]);
2323
- const S = f !== void 0, F = N(e);
2324
- return /* @__PURE__ */ n.jsxs(t, { label: `${s}${c ? " *" : ""}`, hidden: d, withoutLabel: m, isInvalid: S, className: x, children: [
2325
- /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
2326
- /* @__PURE__ */ n.jsx(ae.Control, { type: "number", placeholder: r ?? s, size: o, ...y(e, {
2327
- setValueAs: (b) => b == null || b === "" ? null : Number(b),
2328
- onChange: () => {
2329
- a && a.forEach((b) => w(b, null, { shouldDirty: !0, shouldValidate: v }));
2330
- }
2331
- }), isInvalid: S, hidden: d, disabled: u, className: "w-100 luminus-numeric-stepper", step: h }),
2332
- /* @__PURE__ */ n.jsx("div", { className: "stepper-icon left", children: !u && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (b) => {
2333
- b.preventDefault(), b.stopPropagation(), w(e, ((F ? Number(F) : 0) - g).toString(), { shouldDirty: !0, shouldValidate: v });
2334
- }, children: /* @__PURE__ */ n.jsx(_r, {}) }) }),
2335
- /* @__PURE__ */ n.jsx("div", { className: "stepper-icon right", children: !u && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (b) => {
2336
- b.preventDefault(), b.stopPropagation(), w(e, ((F ? Number(F) : 0) + g).toString(), { shouldDirty: !0, shouldValidate: v });
2337
- }, children: /* @__PURE__ */ n.jsx(Nr, {}) }) })
2338
- ] }),
2339
- l && N(e) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: _, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
2340
- f && /* @__PURE__ */ n.jsx(Fe, { message: f.message })
2177
+ O(() => (window.addEventListener("scroll", de), () => {
2178
+ window.removeEventListener("scroll", de);
2179
+ }), [de]), O(() => (window.addEventListener("resize", de), () => {
2180
+ window.removeEventListener("resize", de);
2181
+ }), [de]), xs(re), js([y, p], e);
2182
+ const pe = i ?? (c && c.length > 0 ? 250 : 0), le = (c == null ? void 0 : c.reduce((A, ne) => A + (ne.width ?? 100), 0)) ?? 0, xe = `calc(max(${D}px, ${pe}px + ${le}px))`;
2183
+ return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2184
+ /* @__PURE__ */ n.jsx(Ir, { show: t, onClick: e }),
2185
+ r && t && !h && /* @__PURE__ */ n.jsx("button", { ref: p, type: "button", className: j("luminus-dropdown-picker-clear-button", fe.clearButton), onClick: () => !h && o(null), style: {
2186
+ top: `calc(${F}px + ${R / 2}px - 12px)`,
2187
+ left: `calc(${E}px - 24px - 8px)`
2188
+ }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "text-danger", children: /* @__PURE__ */ n.jsx(as, { size: 16 }) }) }),
2189
+ /* @__PURE__ */ n.jsx("div", { className: j("luminus-dropdown-picker", fe.wrapper, {
2190
+ [fe.open]: t
2191
+ }), style: {
2192
+ top: X ? `calc(${F}px - 50vh - 8px)` : `calc(${b}px + 8px)`,
2193
+ left: Q ? `calc(${S}px - ${xe})` : E,
2194
+ right: Q ? `${S}px` : `calc(${E}px + ${xe})`,
2195
+ width: xe,
2196
+ justifyContent: X ? "flex-end" : "flex-start"
2197
+ }, children: /* @__PURE__ */ n.jsx("div", { ref: y, className: j("shadow rounded", fe.dropdown), children: !h && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2198
+ u && (m ?? s.length) <= H ? null : /* @__PURE__ */ n.jsx("div", { className: j("search-input-container border-bottom", fe.searchInputContainer), children: /* @__PURE__ */ n.jsx(ae.Control, { ref: w, type: "search", size: "sm", className: fe.searchInput, placeholder: l.searchPlaceholder, value: f, onChange: (A) => {
2199
+ var ne;
2200
+ return k(((ne = A.target) == null ? void 0 : ne.value) ?? "");
2201
+ } }) }),
2202
+ g ? /* @__PURE__ */ n.jsx("div", { className: fe.loadingContainer, children: /* @__PURE__ */ n.jsx(sn, { animation: "border", variant: "primary" }) }) : s.length > 0 && /* @__PURE__ */ n.jsxs("div", { ref: N, className: j("items", fe.itemsContainer), children: [
2203
+ c && c.length > 0 && /* @__PURE__ */ n.jsxs("div", { className: j("header-row border-bottom", fe.headerRow), children: [
2204
+ /* @__PURE__ */ n.jsx("div", { className: fe.name }),
2205
+ c == null ? void 0 : c.map((A) => /* @__PURE__ */ n.jsx("div", { className: fe.columnItem, style: {
2206
+ width: `${A.width ?? 100}px`,
2207
+ minWidth: `${A.width ?? 100}px`,
2208
+ maxWidth: `${A.width ?? 100}px`
2209
+ }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", children: A.name }) }, A.key))
2210
+ ] }),
2211
+ s == null ? void 0 : s.map((A, ne) => /* @__PURE__ */ n.jsxs("button", { id: `item-${ne}`, type: "button", className: j("item cursor-pointer", fe.item, {
2212
+ [fe.focused]: L === ne
2213
+ }, {
2214
+ focused: L === ne
2215
+ }), onClick: () => !h && o(A), onMouseEnter: () => Z(ne), children: [
2216
+ /* @__PURE__ */ n.jsx("div", { className: fe.name, children: /* @__PURE__ */ n.jsx(V, { variant: "body2", children: d ? A.id : A.name }) }),
2217
+ c == null ? void 0 : c.map((me) => /* @__PURE__ */ n.jsx("div", { className: fe.columnItem, style: {
2218
+ width: `${me.width ?? 100}px`,
2219
+ minWidth: `${me.width ?? 100}px`,
2220
+ maxWidth: `${me.width ?? 100}px`
2221
+ }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", className: j("text-muted"), children: A.additionalColumns && A.additionalColumns[me.key] }) }, me.key))
2222
+ ] }, A.id))
2223
+ ] })
2224
+ ] }) }) })
2341
2225
  ] });
2342
- }, sl = "_item_1dy8x_1", kr = {
2343
- item: sl
2344
- }, rn = ({
2226
+ };
2227
+ function br(t) {
2228
+ return Yt({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" }, child: [] }] })(t);
2229
+ }
2230
+ function _r(t) {
2231
+ return Yt({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" }, child: [] }] })(t);
2232
+ }
2233
+ function zl(t) {
2234
+ return Yt({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z" }, child: [] }] })(t);
2235
+ }
2236
+ const Vl = "_item_1dy8x_1", Nr = {
2237
+ item: Vl
2238
+ }, on = ({
2345
2239
  color: t = "primary",
2346
2240
  // icon = <MdOutlineArrowOutward />,
2347
2241
  icon: e,
2348
2242
  className: s,
2349
2243
  children: r,
2350
2244
  ...o
2351
- }) => /* @__PURE__ */ n.jsxs(nt.Item, { className: j(`btn luminus-dropdown-item text-nowrap rounded text-${t} ${s ?? ""}`, kr.item), ...o, children: [
2245
+ }) => /* @__PURE__ */ n.jsxs(nt.Item, { className: j(`btn luminus-dropdown-item text-nowrap rounded text-${t} ${s ?? ""}`, Nr.item), ...o, children: [
2352
2246
  e,
2353
2247
  r
2354
- ] }), Cr = (t) => /* @__PURE__ */ n.jsx(nt.Toggle, { ...t }), pd = ({ color: t = "primary", icon: e = /* @__PURE__ */ n.jsx(os, { size: 12 }), inputId: s = "context-file-input", accept: r = "*", onUpload: o, multiple: a, className: l, children: i, ...c }) => {
2248
+ ] }), kr = (t) => /* @__PURE__ */ n.jsx(nt.Toggle, { ...t }), rd = ({ color: t = "primary", icon: e = /* @__PURE__ */ n.jsx(os, { size: 12 }), inputId: s = "context-file-input", accept: r = "*", onUpload: o, multiple: a, className: l, children: i, ...c }) => {
2355
2249
  const d = (u) => {
2356
2250
  u.target.files && (o(u.target.files), u.target.value = "");
2357
2251
  };
2358
2252
  return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2359
- /* @__PURE__ */ n.jsxs("label", { htmlFor: s, className: j(`btn luminus-dropdown-item text-nowrap rounded text-${t} ${l ?? ""}`, kr.item), ...c, children: [
2253
+ /* @__PURE__ */ n.jsxs("label", { htmlFor: s, className: j(`btn luminus-dropdown-item text-nowrap rounded text-${t} ${l ?? ""}`, Nr.item), ...c, children: [
2360
2254
  e,
2361
2255
  i
2362
2256
  ] }),
2363
2257
  /* @__PURE__ */ n.jsx("input", { id: s, type: "file", accept: r, onChange: d, hidden: !0, multiple: a })
2364
2258
  ] });
2365
- }, rl = "_divider_1e6rk_1", ol = {
2366
- divider: rl
2367
- }, hd = ({ className: t }) => /* @__PURE__ */ n.jsx(nt.Divider, { className: j("luminus-dropdown-divider", t, ol.divider) }), al = "_dropdown_1lk66_1", ll = {
2368
- dropdown: al
2369
- }, $r = ({ toggle: t, children: e, ...s }) => /* @__PURE__ */ n.jsxs(nt, { ...s, children: [
2259
+ }, Ul = "_divider_1e6rk_1", Gl = {
2260
+ divider: Ul
2261
+ }, od = ({ className: t }) => /* @__PURE__ */ n.jsx(nt.Divider, { className: j("luminus-dropdown-divider", t, Gl.divider) }), Yl = "_dropdown_1lk66_1", Kl = {
2262
+ dropdown: Yl
2263
+ }, Cr = ({ toggle: t, children: e, ...s }) => /* @__PURE__ */ n.jsxs(nt, { ...s, children: [
2370
2264
  t,
2371
- /* @__PURE__ */ n.jsx(nt.Menu, { className: j("luminus-dropdown rounded shadow", ll.dropdown), children: e })
2372
- ] }), gd = ({ cell: { value: t } }) => /* @__PURE__ */ n.jsx(n.Fragment, { children: t ? /* @__PURE__ */ n.jsx(ls, { name: t, size: 21, fontSize: 12 }) : /* @__PURE__ */ n.jsx(n.Fragment, {}) }), cl = ({ typeFilter: t, onChangeTypeFilter: e }) => {
2373
- const s = ["info", "warning", "danger"];
2374
- return /* @__PURE__ */ n.jsx("div", { className: "mb-1 d-flex justify-content-center gap-2", children: s.map((r) => /* @__PURE__ */ n.jsx("div", { role: "button", style: {
2375
- height: "14px",
2376
- width: "14px",
2377
- borderRadius: "50%",
2378
- border: "2px solid transparent",
2379
- backgroundColor: "transparent"
2380
- }, className: j(`border-${r}`, r === t && `bg-${r}`), onClick: () => {
2381
- e(t === r ? null : r);
2382
- } }, r)) });
2383
- }, il = ({ linksTo: t, onClick: e, children: s }) => t ? /* @__PURE__ */ n.jsx(_e, { to: t, className: "text-decoration-none", onClick: e, children: s }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: s }), dl = ({ message: t, onDeleteMessage: e, onClickMessage: s, getIcon: r, getLinksTo: o }) => {
2384
- const { ProjectIconComponent: a, localizationContext: l } = B(ue), { dateFnsLocale: i } = B(l), c = t.dateTime ? et(t.dateTime) : null, d = c ? qo(new Date(Date.now()), c) : 0;
2385
- return /* @__PURE__ */ n.jsxs("div", { children: [
2386
- c && /* @__PURE__ */ n.jsx("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ n.jsx(Kt, { text: Xe(c, "dd.MM.yyyy HH:mm"), placement: "left", children: /* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsx(V, { variant: "caption", children: d > 2 ? Xe(c, "dd.MM.yyyy") : Zo(c, new Date(Date.now()), {
2387
- locale: i.code
2388
- }) }) }) }) }),
2389
- /* @__PURE__ */ n.jsx(il, { linksTo: o(t) ?? void 0, onClick: s, children: /* @__PURE__ */ n.jsx(ni, { level: t.type, noIcon: !0, children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-start gap-2", children: [
2390
- r(t),
2391
- /* @__PURE__ */ n.jsxs("div", { className: "d-flex flex-column gap-1 w-100", children: [
2392
- /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-start justify-content-between gap-3", children: [
2393
- /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "fw-bold", children: t.subject }),
2394
- /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (u) => {
2395
- u.preventDefault(), u.stopPropagation(), e(t.id);
2396
- }, children: /* @__PURE__ */ n.jsx(a, { icon: "delete" }) })
2397
- ] }),
2398
- /* @__PURE__ */ n.jsx(V, { variant: "body2", children: t.text })
2399
- ] })
2400
- ] }) }) })
2401
- ] });
2402
- }, Mn = ({ messages: t, isLoading: e, onDeleteMessage: s, onClickMessage: r, getIcon: o, getLinksTo: a }) => {
2403
- const { texts: { messageBoard: l } } = B(ue), [i, c] = I(null), d = q(() => t.filter((u) => i ? u.type === i : !0), [i, t]);
2404
- return /* @__PURE__ */ n.jsxs("div", { className: "h-100 d-flex flex-column overflow-hidden", children: [
2405
- /* @__PURE__ */ n.jsx(cl, { typeFilter: i, onChangeTypeFilter: (u) => c(u) }),
2406
- e && /* @__PURE__ */ n.jsxs("div", { className: "p-3 w-100", children: [
2407
- /* @__PURE__ */ n.jsx(Ie, { as: In.Title, animation: "glow", children: /* @__PURE__ */ n.jsx(Ie, { xs: 6 }) }),
2408
- /* @__PURE__ */ n.jsxs(Ie, { as: In.Text, animation: "glow", children: [
2409
- /* @__PURE__ */ n.jsx(Ie, { xs: 7 }),
2410
- " ",
2411
- /* @__PURE__ */ n.jsx(Ie, { xs: 4 }),
2412
- " ",
2413
- /* @__PURE__ */ n.jsx(Ie, { xs: 4 }),
2414
- " ",
2415
- /* @__PURE__ */ n.jsx(Ie, { xs: 6 }),
2416
- " ",
2417
- /* @__PURE__ */ n.jsx(Ie, { xs: 8 })
2418
- ] })
2419
- ] }),
2420
- !e && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2421
- t.length === 0 && /* @__PURE__ */ n.jsx(Or, { variant: "info", size: "sm", className: "mt-2", children: l.noMessages }),
2422
- /* @__PURE__ */ n.jsx("div", { className: "h-100 overflow-y-auto d-flex flex-column gap-2 luminus-thin-scrollbar", children: d.map((u) => /* @__PURE__ */ n.jsx(dl, { message: u, onDeleteMessage: s, onClickMessage: r, getIcon: o, getLinksTo: a }, u.id)) })
2423
- ] })
2424
- ] });
2425
- }, Et = {
2426
- apiGet: "/messageBoard",
2427
- apiDelete: "/messageBoard/"
2428
- }, xd = ({ renderAsNotifPanel: t, notifIcon: e, apiUrls: { apiGet: s = Et.apiGet, apiDelete: r = Et.apiDelete } = Et, getIcon: o, getLinksTo: a }) => {
2429
- const i = st(), [c, d] = I([]), [u, m] = I(!1), [h, g] = I(!1), [x, y] = I(!1), p = $(async () => {
2430
- g(!0), await i.get(s).then(({ data: v }) => {
2431
- d(v), m(!0), g(!1);
2432
- }).catch(() => {
2433
- d([]), g(!1);
2434
- });
2435
- }, [s, i]), w = $(async (v) => i.delete(`${r}${v}`).then(() => !0).catch(() => !1), [r, i]), N = $((v) => {
2436
- w(v).then((C) => {
2437
- C && d(c.filter((_) => _.id !== v));
2438
- });
2439
- }, [w, c]);
2440
- O(() => {
2441
- p();
2442
- const v = setInterval(() => p(), 60 * 1e3);
2443
- return () => {
2444
- clearInterval(v);
2445
- };
2446
- }, [p]);
2447
- const f = c.filter((v) => v.type === "danger").length, k = u ? !1 : h;
2448
- return t ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2449
- /* @__PURE__ */ n.jsxs("div", { className: "position-relative", children: [
2450
- /* @__PURE__ */ n.jsx(U, { size: "md", onClick: () => y(!x), children: e }),
2451
- f > 0 && /* @__PURE__ */ n.jsx("div", { className: "badge rounded-pill bg-danger p-1 px-2 text-white", style: { position: "absolute", top: "-6px", right: "-10px", fontSize: "10px" }, children: f })
2452
- ] }),
2453
- /* @__PURE__ */ n.jsx(Tn, { show: x, onHide: () => y(!1), placement: "end", children: /* @__PURE__ */ n.jsx(Tn.Body, { children: /* @__PURE__ */ n.jsx(Mn, { messages: c, isLoading: k, onDeleteMessage: N, onClickMessage: () => y(!1), getIcon: o, getLinksTo: a }) }) })
2454
- ] }) : /* @__PURE__ */ n.jsx(Mn, { messages: c, isLoading: k, onDeleteMessage: N, getIcon: o, getLinksTo: a });
2455
- }, ul = "_tab-panel_d8l8q_1", fl = "_full-height-no-overflow_d8l8q_5", ml = "_disabled_d8l8q_12", Ot = {
2456
- "tab-panel": "_tab-panel_d8l8q_1",
2457
- tabPanel: ul,
2458
- "full-height-no-overflow": "_full-height-no-overflow_d8l8q_5",
2459
- fullHeightNoOverflow: fl,
2460
- disabled: ml
2461
- }, jd = ({ eventKey: t, activeTab: e, fullHeightNoOverflow: s, disabled: r, className: o, children: a }) => t !== e ? null : /* @__PURE__ */ n.jsx("div", { className: j("luminus-tab-panel", Ot.tabPanel, { [Ot.fullHeightNoOverflow]: s }, { disabled: r }, { [Ot.disabled]: r }, o), children: a }), yd = ({ activeTab: t, onSelect: e, children: s }) => /* @__PURE__ */ n.jsx("div", { className: j("luminus-tabs d-flex gap-1 mb-2"), children: s.map((r) => {
2462
- const o = r.type, a = r.props;
2463
- if (!a)
2464
- return null;
2465
- const l = a.eventKey, i = a.children, c = a.className, d = a.onClick;
2466
- return /* @__PURE__ */ Co(o, { ...a, key: a.eventKey, className: j({ active: t === l }, c), onClick: () => {
2467
- e(l), d && d(l);
2468
- } }, i);
2469
- }) }), pl = "_tab_1hdhk_1", hl = "_disabled_1hdhk_8", Ln = {
2470
- tab: pl,
2471
- disabled: hl
2472
- }, wd = ({ eventKey: t, className: e, onClick: s, disabled: r, children: o }) => /* @__PURE__ */ n.jsx("div", { role: "button", className: j("luminus-tab text-primary rounded", Ln.tab, e, {
2473
- disabled: r
2474
- }, { [Ln.disabled]: r }), onClick: () => s && !r && s(t), children: typeof o == "string" ? /* @__PURE__ */ n.jsx(V, { variant: "h6", className: "text-primary", children: o }) : o }), gl = ({ show: t, widgets: e, handleClose: s, onWidgetPicked: r, texts: o }) => /* @__PURE__ */ n.jsxs(ct, { show: t, onHide: () => s(), children: [
2475
- /* @__PURE__ */ n.jsx(ct.Header, { closeButton: !0, children: /* @__PURE__ */ n.jsx(ct.Title, { children: o.pickWidgetToAdd }) }),
2476
- /* @__PURE__ */ n.jsx(ct.Body, { children: /* @__PURE__ */ n.jsx("div", { className: "list-group", children: e.filter((a) => a.id >= 0).map((a) => /* @__PURE__ */ n.jsx("div", { role: "button", className: "list-group-item bg-white", onClick: () => r(a.id), children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: a.name }) })) }) })
2477
- ] }), Rn = ({ availableWidgets: t, onAdd: e, texts: s }) => {
2478
- const [r, o] = I(!1);
2479
- return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2480
- /* @__PURE__ */ n.jsx("div", { className: j("luminus-empty-widget", tl.widget), children: /* @__PURE__ */ n.jsx(U, { onClick: () => o(!0), children: /* @__PURE__ */ n.jsx(mo, {}) }) }),
2481
- /* @__PURE__ */ n.jsx(gl, { show: r, widgets: t, handleClose: () => o(!1), onWidgetPicked: (a) => {
2482
- o(!1), e(a);
2483
- }, texts: s })
2484
- ] });
2485
- }, xl = (t) => {
2486
- const [e, s] = I({ widgets: [] });
2487
- O(() => {
2488
- const o = localStorage.getItem("dashboardConfig");
2489
- o ? s(JSON.parse(o)) : t && s(t);
2490
- }, [t]);
2491
- const r = $((o) => {
2492
- s(o), localStorage.setItem("dashboardConfig", JSON.stringify(o));
2493
- }, []);
2494
- return { dashboardConfig: e, onChangeDashboardConfig: r };
2495
- }, jl = "_dashboard_16plm_1", yl = "_widgets-grid_16plm_1", wl = "_widget-wrapper_16plm_8", vl = "_full-width_16plm_13", bl = "_widget-edit_16plm_16", _l = "_remove-icon_16plm_19", Nl = "_full-width-icon_16plm_26", kl = "_widget-edit-overlay_16plm_36", ve = {
2496
- dashboard: jl,
2497
- "widgets-grid": "_widgets-grid_16plm_1",
2498
- widgetsGrid: yl,
2499
- "widget-wrapper": "_widget-wrapper_16plm_8",
2500
- widgetWrapper: wl,
2501
- "full-width": "_full-width_16plm_13",
2502
- fullWidth: vl,
2503
- "widget-edit": "_widget-edit_16plm_16",
2504
- widgetEdit: bl,
2505
- "remove-icon": "_remove-icon_16plm_19",
2506
- removeIcon: _l,
2507
- "full-width-icon": "_full-width-icon_16plm_26",
2508
- fullWidthIcon: Nl,
2509
- "widget-edit-overlay": "_widget-edit-overlay_16plm_36",
2510
- widgetEditOverlay: kl
2511
- };
2512
- class Cl extends $o {
2513
- constructor(e) {
2514
- super(e), this.state = { hasError: !1 }, this.reload = this.reload.bind(this);
2515
- }
2516
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2517
- static getDerivedStateFromError(e) {
2518
- return { hasError: !0 };
2519
- }
2520
- componentDidUpdate(e) {
2521
- this.state.hasError && e.keyForErrorState !== this.props.keyForErrorState && this.setState({ hasError: !1 });
2522
- }
2523
- componentDidCatch(e, s) {
2524
- console.error("Error:", e, s);
2525
- }
2526
- reload() {
2527
- this.setState({ hasError: !1 });
2528
- }
2529
- render() {
2530
- const { fallback: e, children: s, texts: r, reloadButtonDisplay: o = "append-after-child" } = this.props;
2531
- return this.state.hasError ? o === "inject-to-child" && So(e) ? he.cloneElement(e, {
2532
- ...e.props
2533
- }, /* @__PURE__ */ n.jsxs("div", { className: "translate-middle top-50 start-50 position-absolute d-flex flex-column align-items-center gap-2", children: [
2534
- ...e.props.children,
2535
- /* @__PURE__ */ n.jsx(jt, { type: "button", onClick: this.reload, children: r.reloadButtonContent })
2536
- ] })) : /* @__PURE__ */ n.jsxs("div", { className: "translate-middle top-50 start-50 position-absolute d-flex flex-column align-items-center gap-2", children: [
2537
- e,
2538
- o === "none" ? null : /* @__PURE__ */ n.jsx(jt, { type: "button", onClick: this.reload, children: r.reloadButtonContent })
2539
- ] }) : s;
2540
- }
2541
- }
2542
- const $l = (t) => (s) => {
2543
- const { texts: { errorBoundary: r } } = B(ue);
2544
- return /* @__PURE__ */ n.jsx(t, { texts: r, ...s });
2545
- }, Sl = $l(Cl), Il = "_widget-card_e9tsb_1", Dl = {
2546
- "widget-card": "_widget-card_e9tsb_1",
2547
- widgetCard: Il
2548
- }, An = ({ children: t, title: e, headerContent: s }) => /* @__PURE__ */ n.jsx(Cc, { className: j(Dl.widgetCard, "luminus-widget"), title: e, headerContent: s, contentClassName: "h-100 overflow-auto", children: t }), Fl = ({ children: t, title: e }) => {
2549
- const { texts: { widget: s } } = B(ue);
2550
- return /* @__PURE__ */ n.jsx(Sl, { fallback: /* @__PURE__ */ n.jsx(An, { title: e, children: s.fallbackError }), reloadButtonDisplay: "inject-to-child", children: /* @__PURE__ */ n.jsx(Io, { fallback: /* @__PURE__ */ n.jsx(An, { title: e, children: /* @__PURE__ */ n.jsx(Go, {}) }), children: t }) });
2551
- }, vd = ({ availableWidgets: t, editMode: e, defaultDashboardConfig: s }) => {
2552
- var u;
2553
- const { texts: { homeDashboard: r } } = B(ue), { dashboardConfig: o, onChangeDashboardConfig: a } = xl(s), l = $((m, h) => {
2554
- var g, x;
2555
- m === ((g = o.widgets) == null ? void 0 : g.length) ? a({
2556
- ...o,
2557
- widgets: [...o.widgets, { widgetId: h, fullWidth: !1 }]
2558
- }) : a({
2559
- ...o,
2560
- widgets: ((x = o.widgets) == null ? void 0 : x.map((y, p) => p === m ? { widgetId: h, fullWidth: !1 } : y)) ?? []
2561
- });
2562
- }, [o, a]), i = $((m) => {
2563
- var h, g;
2564
- ((h = o.widgets[m]) == null ? void 0 : h.widgetId) === -1 ? a({
2565
- ...o,
2566
- widgets: ((g = o.widgets) == null ? void 0 : g.filter((x, y) => y !== m)) ?? []
2567
- }) : l(m, -1);
2568
- }, [o, a, l]), c = $((m) => {
2569
- var h;
2570
- a({
2571
- ...o,
2572
- widgets: ((h = o.widgets) == null ? void 0 : h.map((g, x) => x === m ? { ...g, fullWidth: !g.fullWidth } : g)) ?? []
2265
+ /* @__PURE__ */ n.jsx(nt.Menu, { className: j("luminus-dropdown rounded shadow", Kl.dropdown), children: e })
2266
+ ] }), ql = ({ searchTypes: t, selectedType: e, setSelectedType: s }) => /* @__PURE__ */ n.jsx(Cr, { toggle: /* @__PURE__ */ n.jsx(kr, { as: ho, icon: null, text: e == null ? void 0 : e.text }), children: t.map((r) => /* @__PURE__ */ n.jsx(on, { icon: null, onClick: () => s(r.key), children: r.text }, r.key)) }), Ql = "_dropdown_1ddrg_1", Zl = "_open_1ddrg_12", Jl = "_loading-container_1ddrg_15", Xl = "_groups-container_1ddrg_22", ec = "_group_1ddrg_22", tc = "_header_1ddrg_26", nc = "_item_1ddrg_33", Ee = {
2267
+ dropdown: Ql,
2268
+ open: Zl,
2269
+ "loading-container": "_loading-container_1ddrg_15",
2270
+ loadingContainer: Jl,
2271
+ "groups-container": "_groups-container_1ddrg_22",
2272
+ groupsContainer: Xl,
2273
+ group: ec,
2274
+ header: tc,
2275
+ item: nc
2276
+ }, sc = ({ show: t, query: e, onCancel: s, groups: r, isLoading: o, searchTypes: a }) => {
2277
+ const { texts: { appSearch: l } } = B(ue), i = Y(null), c = $((d) => {
2278
+ var m;
2279
+ const u = (m = a.find((h) => h.key === d.type)) == null ? void 0 : m.toPath;
2280
+ return u ? `${u}/${d.searchKey}` : "/not-found";
2281
+ }, [a]);
2282
+ return js([i], s), /* @__PURE__ */ n.jsx("div", { ref: i, className: j("luminus-app-search-dropdown shadow rounded", Ee.dropdown, {
2283
+ [Ee.open]: t
2284
+ }), children: o ? /* @__PURE__ */ n.jsx("div", { className: Ee.loadingContainer, children: /* @__PURE__ */ n.jsx(sn, { animation: "border", variant: "primary" }) }) : /* @__PURE__ */ n.jsx("div", { className: Ee.groupsContainer, children: r == null ? void 0 : r.map((d) => {
2285
+ var u;
2286
+ return /* @__PURE__ */ n.jsxs("div", { className: j(Ee.group), children: [
2287
+ /* @__PURE__ */ n.jsxs(_e, { to: `/search?query=${e}&type=${d.key.category}`, className: j("group-header", Ee.header), onClick: s, children: [
2288
+ /* @__PURE__ */ n.jsx(V, { variant: "body", className: "text-primary", children: d.key.categoryName }),
2289
+ /* @__PURE__ */ n.jsxs(V, { variant: "caption", children: [
2290
+ d.items.length,
2291
+ " ",
2292
+ l.amountFrom,
2293
+ " ",
2294
+ d.key.totalCount
2295
+ ] })
2296
+ ] }),
2297
+ (u = d.items) == null ? void 0 : u.map((m, h) => /* @__PURE__ */ n.jsxs(
2298
+ _e,
2299
+ {
2300
+ to: c(m),
2301
+ className: j("search-item d-flex gap-3 align-items-center justify-content-between", Ee.item),
2302
+ onClick: s,
2303
+ children: [
2304
+ /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "text-nowrap text-truncate", children: m.name }),
2305
+ /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "text-primary", children: /* @__PURE__ */ n.jsx(go, {}) })
2306
+ ]
2307
+ },
2308
+ h
2309
+ ))
2310
+ ] }, d.key.category);
2311
+ }) }) });
2312
+ }, rc = "_input-group_1lkfy_1", oc = "_input-group-text_1lkfy_5", ac = "_left_1lkfy_9", lc = "_right_1lkfy_13", cc = "_input_1lkfy_1", ic = "_submit-button_1lkfy_20", Oe = {
2313
+ "input-group": "_input-group_1lkfy_1",
2314
+ inputGroup: rc,
2315
+ "input-group-text": "_input-group-text_1lkfy_5",
2316
+ inputGroupText: oc,
2317
+ left: ac,
2318
+ right: lc,
2319
+ input: cc,
2320
+ "submit-button": "_submit-button_1lkfy_20",
2321
+ submitButton: ic
2322
+ }, dc = (t, e) => {
2323
+ const s = st(), [r, o] = I(!1), [a, l] = I([]), i = !t || !t.key, c = $(() => {
2324
+ if (e.length < 3) {
2325
+ l([]);
2326
+ return;
2327
+ }
2328
+ o(!0), s.get(`/search/${e}?count=${i ? 5 : 20}${i ? "" : `&type=${t.key}`}`).then(({ data: d }) => {
2329
+ l(d), o(!1);
2330
+ }).catch(() => {
2331
+ o(!1);
2573
2332
  });
2574
- }, [o, a]), d = $((m, h, g) => m ? /* @__PURE__ */ n.jsxs("div", { className: j(ve.widgetWrapper, {
2575
- [ve.widgetEdit]: e && m.id !== -1
2576
- }, { [ve.fullWidth]: g }), children: [
2577
- e && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2578
- /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => i(h), className: j(ve.removeIcon), children: /* @__PURE__ */ n.jsx(cs, {}) }),
2579
- /* @__PURE__ */ n.jsx(U, { color: g ? "danger" : "primary", onClick: () => c(h), className: j(ve.fullWidthIcon), children: /* @__PURE__ */ n.jsx(po, {}) })
2580
- ] }),
2581
- m.id === -1 ? e && /* @__PURE__ */ n.jsx("div", { className: ve.widgetWrapper, children: /* @__PURE__ */ n.jsx(Rn, { availableWidgets: t, onAdd: (x) => l(h, x), texts: r }) }) : /* @__PURE__ */ n.jsx(Fl, { title: m.title, children: /* @__PURE__ */ n.jsx(m.WidgetElement, { title: m.title }) }),
2582
- m.id > -1 && e && /* @__PURE__ */ n.jsx("div", { className: ve.widgetEditOverlay })
2583
- ] }, h) : /* @__PURE__ */ n.jsx(n.Fragment, {}), [
2584
- e,
2585
- l,
2586
- i,
2587
- c,
2588
- t,
2589
- r
2590
- ]);
2591
- return /* @__PURE__ */ n.jsx("div", { className: ve.dashboard, children: /* @__PURE__ */ n.jsxs("div", { className: ve.widgetsGrid, children: [
2592
- (u = o.widgets) == null ? void 0 : u.map((m, h) => d(t.find((g) => g.id === m.widgetId), h, m.fullWidth)),
2593
- e && /* @__PURE__ */ n.jsx(Rn, { availableWidgets: t, onAdd: (m) => {
2594
- var h;
2595
- return l((h = o.widgets) == null ? void 0 : h.length, m);
2596
- }, texts: r })
2333
+ }, [t, e, s, i]);
2334
+ return O(() => {
2335
+ c();
2336
+ }, [c]), { isLoading: r, searchItems: a };
2337
+ }, ad = ({ searchTypes: t, navigateFunction: e, currentPath: s }) => {
2338
+ var y;
2339
+ const { texts: { appSearch: r } } = B(ue), [o, a] = I(t.length > 0 ? ((y = t.at(0)) == null ? void 0 : y.key) ?? null : null), l = q(() => t.find((p) => p.key === o) ?? null, [t, o]), [i, c] = I(""), [d, u] = vr(i, 500), { isLoading: m, searchItems: h } = dc(l, d), [g, x] = I(!1);
2340
+ return O(() => {
2341
+ (h.length > 0 || m) && x(!0);
2342
+ }, [h, m]), O(() => {
2343
+ c("");
2344
+ }, [s]), /* @__PURE__ */ n.jsx(ae, { onSubmit: (p) => {
2345
+ p.preventDefault(), p.stopPropagation(), u.flush(), x(!1), i.length > 2 && e(`/search?query=${i}${l && l.key && `&type=${l == null ? void 0 : l.key}`}`);
2346
+ }, children: /* @__PURE__ */ n.jsxs(ft, { className: Oe.inputGroup, children: [
2347
+ /* @__PURE__ */ n.jsx(ft.Text, { className: j("p-1 rounded", Oe.inputGroupText, Oe.left), children: /* @__PURE__ */ n.jsx(ql, { searchTypes: t, selectedType: l, setSelectedType: a }) }),
2348
+ /* @__PURE__ */ n.jsx(ae.Control, { placeholder: r.searchPlaceholder, type: "text", size: "sm", className: j("luminus-app-search-input", Oe.input), value: i, onChange: (p) => {
2349
+ var w;
2350
+ return c(((w = p.target) == null ? void 0 : w.value) ?? "");
2351
+ }, onFocus: () => h.length > 0 && x(!0) }),
2352
+ /* @__PURE__ */ n.jsx(ft.Text, { className: j("p-0 rounded", Oe.inputGroupText, Oe.right), children: /* @__PURE__ */ n.jsx("button", { type: "submit", className: j("text-primary", Oe.submitButton), children: /* @__PURE__ */ n.jsx(zl, {}) }) }),
2353
+ /* @__PURE__ */ n.jsx(sc, { query: d, searchTypes: t, show: g, onCancel: () => x(!1), groups: h, isLoading: m })
2597
2354
  ] }) });
2598
- }, El = "_badge_nhser_1", Ol = "_sm_nhser_1", Tl = "_md_nhser_4", Ml = "_lg_nhser_7", Bn = {
2599
- badge: El,
2600
- sm: Ol,
2601
- md: Tl,
2602
- lg: Ml
2603
- }, bd = ({ children: t, color: e = "primary", size: s = "md", className: r }) => /* @__PURE__ */ n.jsx("span", { className: j(`luminus-badge badge bg-${e} ${r ?? ""}`, Bn.badge, Bn[s]), children: t }), Ll = "_collapse-icon_1ahhn_1", Rl = "_collapsed_1ahhn_6", Pn = {
2604
- "collapse-icon": "_collapse-icon_1ahhn_1",
2605
- collapseIcon: Ll,
2606
- collapsed: Rl
2607
- }, Al = ({ title: t, children: e, className: s, ...r }) => {
2608
- const o = r.controlled ? !1 : r.defaultOpen ?? !1, [a, l] = I(o), i = r.controlled ? r.isOpen : a;
2355
+ }, uc = "_card_19733_1", fc = "_header_19733_6", mc = "_header-content_19733_13", pc = "_title_19733_19", hc = "_collapse-icon_19733_22", gc = "_collapsed_19733_27", xc = "_content_19733_30", Te = {
2356
+ card: uc,
2357
+ header: fc,
2358
+ "header-content": "_header-content_19733_13",
2359
+ headerContent: mc,
2360
+ title: pc,
2361
+ "collapse-icon": "_collapse-icon_19733_22",
2362
+ collapseIcon: hc,
2363
+ collapsed: gc,
2364
+ content: xc
2365
+ }, jc = ({ title: t, headerContent: e, children: s, className: r, headerClassName: o, contentClassName: a, ...l }) => {
2366
+ const i = l.collapsible ? l.controlled ? !1 : l.defaultOpen ?? !1 : !0, [c, d] = I(i), u = l.collapsible ? l.controlled ? l.isOpen : c : !0;
2609
2367
  return O(() => {
2610
- l(o);
2611
- }, [o]), /* @__PURE__ */ n.jsxs("div", { className: s ?? "", children: [
2612
- /* @__PURE__ */ n.jsxs("div", { role: "button", className: "d-flex align-items-center justify-content-between pb-3 pt-2", onClick: () => r.controlled ? r.onToggle(!r.isOpen) : l(!a), children: [
2613
- /* @__PURE__ */ n.jsx(V, { variant: "h6", children: t }),
2614
- /* @__PURE__ */ n.jsx(is, { className: j(Pn.collapseIcon, {
2615
- [Pn.collapsed]: i
2368
+ d(i);
2369
+ }, [i]), /* @__PURE__ */ n.jsxs("div", { className: j("luminus-card rounded shadow-sm", Te.card, {
2370
+ [r ?? ""]: r
2371
+ }), children: [
2372
+ /* @__PURE__ */ n.jsxs("div", { role: l.collapsible ? "button" : void 0, className: j("header", Te.header, {
2373
+ [o ?? ""]: o
2374
+ }), onClick: () => {
2375
+ l.collapsible && (l.controlled ? l.onToggle(!l.isOpen) : d(!c));
2376
+ }, children: [
2377
+ /* @__PURE__ */ n.jsxs("div", { className: j("header-content", Te.headerContent), children: [
2378
+ /* @__PURE__ */ n.jsx(V, { variant: "h6", className: j("text-primary", Te.title), children: t }),
2379
+ e ?? null
2380
+ ] }),
2381
+ l.collapsible && /* @__PURE__ */ n.jsx(ls, { className: j(Te.collapseIcon, {
2382
+ [Te.collapsed]: u
2616
2383
  }) })
2617
2384
  ] }),
2618
- /* @__PURE__ */ n.jsx(bs, { in: i, children: /* @__PURE__ */ n.jsx("div", { children: e }) }),
2619
- /* @__PURE__ */ n.jsx("hr", { className: `my-0 ${i ? "mt-3" : ""}` })
2385
+ /* @__PURE__ */ n.jsx(bs, { in: u, children: /* @__PURE__ */ n.jsx("div", { className: j("card-content border-top border-primary", Te.content, {
2386
+ [a ?? ""]: a
2387
+ }), children: s }) })
2620
2388
  ] });
2621
- }, Bl = "_feedback_esh1j_1", Pl = "_feedback-spacer_esh1j_8", Hn = {
2622
- feedback: Bl,
2623
- "feedback-spacer": "_feedback-spacer_esh1j_8",
2624
- feedbackSpacer: Pl
2625
- }, Fe = ({ message: t }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2626
- /* @__PURE__ */ n.jsx("div", { className: j("invalid-feedback luminus-invalid-feedback", Hn.feedback), children: t }),
2627
- /* @__PURE__ */ n.jsx("div", { className: j("invalid-feedback-spacer", Hn.feedbackSpacer), children: t })
2628
- ] });
2629
- function Hl(t, e, s) {
2630
- var r = this, o = Y(null), a = Y(0), l = Y(null), i = Y([]), c = Y(), d = Y(), u = Y(t), m = Y(!0);
2631
- u.current = t;
2632
- var h = typeof window < "u", g = !e && e !== 0 && h;
2633
- if (typeof t != "function") throw new TypeError("Expected a function");
2634
- e = +e || 0;
2635
- var x = !!(s = s || {}).leading, y = !("trailing" in s) || !!s.trailing, p = "maxWait" in s, w = "debounceOnServer" in s && !!s.debounceOnServer, N = p ? Math.max(+s.maxWait || 0, e) : null;
2636
- O(function() {
2637
- return m.current = !0, function() {
2638
- m.current = !1;
2639
- };
2640
- }, []);
2641
- var f = q(function() {
2642
- var k = function(F) {
2643
- var b = i.current, D = c.current;
2644
- return i.current = c.current = null, a.current = F, d.current = u.current.apply(D, b);
2645
- }, v = function(F, b) {
2646
- g && cancelAnimationFrame(l.current), l.current = g ? requestAnimationFrame(F) : setTimeout(F, b);
2647
- }, C = function(F) {
2648
- if (!m.current) return !1;
2649
- var b = F - o.current;
2650
- return !o.current || b >= e || b < 0 || p && F - a.current >= N;
2651
- }, _ = function(F) {
2652
- return l.current = null, y && i.current ? k(F) : (i.current = c.current = null, d.current);
2653
- }, E = function F() {
2654
- var b = Date.now();
2655
- if (C(b)) return _(b);
2656
- if (m.current) {
2657
- var D = e - (b - o.current), R = p ? Math.min(D, N - (b - a.current)) : D;
2658
- v(F, R);
2659
- }
2660
- }, S = function() {
2661
- if (h || w) {
2662
- var F = Date.now(), b = C(F);
2663
- if (i.current = [].slice.call(arguments), c.current = r, o.current = F, b) {
2664
- if (!l.current && m.current) return a.current = o.current, v(E, e), x ? k(o.current) : d.current;
2665
- if (p) return v(E, e), k(o.current);
2666
- }
2667
- return l.current || v(E, e), d.current;
2668
- }
2669
- };
2670
- return S.cancel = function() {
2671
- l.current && (g ? cancelAnimationFrame(l.current) : clearTimeout(l.current)), a.current = 0, i.current = o.current = c.current = l.current = null;
2672
- }, S.isPending = function() {
2673
- return !!l.current;
2674
- }, S.flush = function() {
2675
- return l.current ? _(Date.now()) : d.current;
2676
- }, S;
2677
- }, [x, p, e, N, y, g, h, w]);
2678
- return f;
2389
+ };
2390
+ var yc = !!(typeof window < "u" && window.document && window.document.createElement), wc = /* @__PURE__ */ function() {
2391
+ function t(e, s) {
2392
+ for (var r = 0; r < s.length; r++) {
2393
+ var o = s[r];
2394
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
2395
+ }
2396
+ }
2397
+ return function(e, s, r) {
2398
+ return s && t(e.prototype, s), r && t(e, r), e;
2399
+ };
2400
+ }();
2401
+ function vc(t, e) {
2402
+ if (!(t instanceof e))
2403
+ throw new TypeError("Cannot call a class as a function");
2679
2404
  }
2680
- function Wl(t, e) {
2681
- return t === e;
2405
+ function bc(t, e) {
2406
+ if (!t)
2407
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2408
+ return e && (typeof e == "object" || typeof e == "function") ? e : t;
2682
2409
  }
2683
- function zl(t, e) {
2684
- return e;
2410
+ function _c(t, e) {
2411
+ if (typeof e != "function" && e !== null)
2412
+ throw new TypeError("Super expression must either be null or a function, not " + typeof e);
2413
+ t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);
2685
2414
  }
2686
- function Sr(t, e, s) {
2687
- var r = Wl, o = ms(zl, t), a = o[0], l = o[1], i = Hl($(function(d) {
2688
- return l(d);
2689
- }, [l]), e, s), c = Y(t);
2690
- return r(c.current, t) || (i(t), c.current = t), r(a, t) && i.cancel(), [a, i];
2415
+ var $r = function(t) {
2416
+ _c(e, t);
2417
+ function e() {
2418
+ return vc(this, e), bc(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments));
2419
+ }
2420
+ return wc(e, [{
2421
+ key: "componentWillUnmount",
2422
+ value: function() {
2423
+ this.defaultNode && document.body.removeChild(this.defaultNode), this.defaultNode = null;
2424
+ }
2425
+ }, {
2426
+ key: "render",
2427
+ value: function() {
2428
+ return yc ? (!this.props.node && !this.defaultNode && (this.defaultNode = document.createElement("div"), document.body.appendChild(this.defaultNode)), pt.createPortal(this.props.children, this.props.node || this.defaultNode)) : null;
2429
+ }
2430
+ }]), e;
2431
+ }(he.Component);
2432
+ $r.propTypes = {
2433
+ children: Le.node.isRequired,
2434
+ node: Le.any
2435
+ };
2436
+ var Nc = /* @__PURE__ */ function() {
2437
+ function t(e, s) {
2438
+ for (var r = 0; r < s.length; r++) {
2439
+ var o = s[r];
2440
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
2441
+ }
2442
+ }
2443
+ return function(e, s, r) {
2444
+ return s && t(e.prototype, s), r && t(e, r), e;
2445
+ };
2446
+ }();
2447
+ function kc(t, e) {
2448
+ if (!(t instanceof e))
2449
+ throw new TypeError("Cannot call a class as a function");
2691
2450
  }
2692
- const Vl = "_wrapper_uccrb_1", Ul = "_open_uccrb_9", Gl = "_dropdown_uccrb_13", Yl = "_search-input-container_uccrb_19", Kl = "_search-input_uccrb_19", ql = "_loading-container_uccrb_25", Ql = "_items-container_uccrb_32", Zl = "_header-row_uccrb_38", Jl = "_item_uccrb_32", Xl = "_name_uccrb_57", ec = "_column-item_uccrb_62", tc = "_icon_uccrb_66", nc = "_clear-button_uccrb_74", fe = {
2693
- wrapper: Vl,
2694
- open: Ul,
2695
- dropdown: Gl,
2696
- "search-input-container": "_search-input-container_uccrb_19",
2697
- searchInputContainer: Yl,
2698
- "search-input": "_search-input_uccrb_19",
2699
- searchInput: Kl,
2700
- "loading-container": "_loading-container_uccrb_25",
2701
- loadingContainer: ql,
2702
- "items-container": "_items-container_uccrb_32",
2703
- itemsContainer: Ql,
2704
- "header-row": "_header-row_uccrb_38",
2705
- headerRow: Zl,
2706
- item: Jl,
2707
- name: Xl,
2708
- "column-item": "_column-item_uccrb_62",
2709
- columnItem: ec,
2710
- icon: tc,
2711
- "clear-button": "_clear-button_uccrb_74",
2712
- clearButton: nc
2713
- }, on = ({ show: t, onCancel: e, items: s, currentSelection: r, onSelectionChange: o, onSearchQueryChange: a, texts: l, itemsNameWidth: i, additionalColumns: c, displayIdAsName: d = !1, autoHideSearch: u = !1, allItemsLength: m, disabled: h, isLoading: g = !1, inputRef: x }) => {
2714
- var W;
2715
- const y = Y(null), p = Y(null), w = Y(null), N = Y(null), [f, k] = I(""), [v] = Sr(f, 500), [, C] = I(!1), _ = (W = x.current) == null ? void 0 : W.getBoundingClientRect(), E = (_ == null ? void 0 : _.x) ?? 0, S = ((_ == null ? void 0 : _.x) ?? 0) + ((_ == null ? void 0 : _.width) ?? 0), F = (_ == null ? void 0 : _.y) ?? 0, b = ((_ == null ? void 0 : _.y) ?? 0) + ((_ == null ? void 0 : _.height) ?? 0), D = (_ == null ? void 0 : _.width) ?? 0, R = (_ == null ? void 0 : _.height) ?? 0, H = 5, Q = q(() => E ? E > window.innerWidth / 2 : !1, [E]), X = q(() => F ? F > window.innerHeight / 2 : !1, [F]);
2716
- O(() => {
2717
- var A;
2718
- t && ((A = w.current) == null || A.focus());
2719
- }, [w, t]), O(() => {
2720
- t || k("");
2721
- }, [t]), O(() => {
2722
- a(v);
2723
- }, [v, a]);
2724
- const [L, Z] = I(null);
2451
+ function Cc(t, e) {
2452
+ if (!t)
2453
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2454
+ return e && (typeof e == "object" || typeof e == "function") ? e : t;
2455
+ }
2456
+ function $c(t, e) {
2457
+ if (typeof e != "function" && e !== null)
2458
+ throw new TypeError("Super expression must either be null or a function, not " + typeof e);
2459
+ t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);
2460
+ }
2461
+ var Sr = function(t) {
2462
+ $c(e, t);
2463
+ function e() {
2464
+ return kc(this, e), Cc(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments));
2465
+ }
2466
+ return Nc(e, [{
2467
+ key: "componentDidMount",
2468
+ value: function() {
2469
+ this.renderPortal();
2470
+ }
2471
+ }, {
2472
+ key: "componentDidUpdate",
2473
+ value: function(r) {
2474
+ this.renderPortal();
2475
+ }
2476
+ }, {
2477
+ key: "componentWillUnmount",
2478
+ value: function() {
2479
+ pt.unmountComponentAtNode(this.defaultNode || this.props.node), this.defaultNode && document.body.removeChild(this.defaultNode), this.defaultNode = null, this.portal = null;
2480
+ }
2481
+ }, {
2482
+ key: "renderPortal",
2483
+ value: function(r) {
2484
+ !this.props.node && !this.defaultNode && (this.defaultNode = document.createElement("div"), document.body.appendChild(this.defaultNode));
2485
+ var o = this.props.children;
2486
+ typeof this.props.children.type == "function" && (o = he.cloneElement(this.props.children)), this.portal = pt.unstable_renderSubtreeIntoContainer(this, o, this.props.node || this.defaultNode);
2487
+ }
2488
+ }, {
2489
+ key: "render",
2490
+ value: function() {
2491
+ return null;
2492
+ }
2493
+ }]), e;
2494
+ }(he.Component);
2495
+ Sr.propTypes = {
2496
+ children: Le.node.isRequired,
2497
+ node: Le.any
2498
+ };
2499
+ var Wt = void 0;
2500
+ pt.createPortal ? Wt = $r : Wt = Sr;
2501
+ const Sc = "_lightbox_14acg_1", Ic = "_show_14acg_16", Dc = "_header_14acg_20", Fc = "_photo-actions_14acg_26", Ec = "_photo-container_14acg_31", Oc = "_photo_14acg_26", Tc = "_nav-button_14acg_41", Mc = "_photos-preview_14acg_49", Lc = "_selected_14acg_62", Rc = "_default-indicator_14acg_66", ge = {
2502
+ lightbox: Sc,
2503
+ show: Ic,
2504
+ header: Dc,
2505
+ "photo-actions": "_photo-actions_14acg_26",
2506
+ photoActions: Fc,
2507
+ "photo-container": "_photo-container_14acg_31",
2508
+ photoContainer: Ec,
2509
+ photo: Oc,
2510
+ "nav-button": "_nav-button_14acg_41",
2511
+ navButton: Tc,
2512
+ "photos-preview": "_photos-preview_14acg_49",
2513
+ photosPreview: Mc,
2514
+ selected: Lc,
2515
+ "default-indicator": "_default-indicator_14acg_66",
2516
+ defaultIndicator: Rc
2517
+ }, Ac = "_backdrop_3huvf_1", Bc = "_show_3huvf_11", Pn = {
2518
+ backdrop: Ac,
2519
+ show: Bc
2520
+ }, Ir = ({ show: t, onClick: e }) => /* @__PURE__ */ n.jsx("div", { className: j("luminus-backdrop", Pn.backdrop, {
2521
+ [Pn.show]: t
2522
+ }), onClick: () => e && e() }), Dr = ({ src: t, alt: e, baseUrl: s, customToken: r, placeholder: o, ...a }) => /* @__PURE__ */ n.jsx("img", { ...a, alt: e ?? "", src: t ?? o }), Pc = ({ show: t, onClose: e, photos: s, defaultIndex: r, uploadPhotosText: o, noPhotosText: a, onUploadPhotos: l, photoActions: i, baseUrl: c, customToken: d, placeholder: u, ImgComponent: m = Dr }) => {
2523
+ const h = Y(null), [g, x] = I(r), y = s.at(g), p = g > 0, w = g < s.length - 1;
2725
2524
  O(() => {
2726
- t && s.length > 0 ? Z(0) : Z(null);
2727
- }, [s, t]);
2728
- const ee = q(() => L !== null ? s.at(L) ?? null : null, [L, s]), te = $((A, ne) => {
2729
- var We, ze;
2730
- const me = document.getElementById(`item-${A}`);
2731
- if (me) {
2732
- const Ve = me.clientHeight ?? 0;
2733
- ne === "down" ? (We = N.current) == null || We.scrollBy({
2734
- left: 0,
2735
- top: Ve,
2736
- behavior: "smooth"
2737
- }) : (ze = N.current) == null || ze.scrollBy({
2738
- left: 0,
2739
- top: -Ve,
2740
- behavior: "smooth"
2741
- });
2525
+ t && x(r);
2526
+ }, [r, t]), O(() => {
2527
+ g >= s.length && x(s.length - 1);
2528
+ }, [s, g]);
2529
+ const N = $((f) => {
2530
+ switch (f.key) {
2531
+ case "ArrowLeft":
2532
+ f.stopPropagation(), p && x((k) => k - 1);
2533
+ break;
2534
+ case "ArrowRight":
2535
+ f.stopPropagation(), w && x((k) => k + 1);
2536
+ break;
2537
+ case "Escape":
2538
+ f.stopPropagation(), e();
2539
+ break;
2540
+ }
2541
+ }, [w, p, e]);
2542
+ return xs(N), /* @__PURE__ */ n.jsxs(Wt, { children: [
2543
+ /* @__PURE__ */ n.jsx(Ir, { show: t, onClick: e }),
2544
+ /* @__PURE__ */ n.jsxs("div", { ref: h, className: j("luminus-lightbox rounded shadow", ge.lightbox, {
2545
+ [ge.show]: t
2546
+ }), children: [
2547
+ /* @__PURE__ */ n.jsxs("div", { className: ge.header, children: [
2548
+ /* @__PURE__ */ n.jsxs("div", { className: j("rounded", ge.photoActions), children: [
2549
+ l && /* @__PURE__ */ n.jsx(wr, { accept: ".jpg,.jpeg,.png", onUpload: (f) => {
2550
+ f.length > 0 && l(Array.from(f));
2551
+ }, icon: /* @__PURE__ */ n.jsx(cs, { style: { fontSize: 18 } }), multiple: !0, className: "me-3", children: o ?? null }),
2552
+ y && (i == null ? void 0 : i.map(({ label: f, onClick: k, ...v }, C) => /* @__PURE__ */ n.jsx(
2553
+ jt,
2554
+ {
2555
+ onClick: () => k(y.id),
2556
+ ...v,
2557
+ children: f
2558
+ },
2559
+ `action-${C}`
2560
+ )))
2561
+ ] }),
2562
+ /* @__PURE__ */ n.jsx("div", { role: "button", onClick: e, children: /* @__PURE__ */ n.jsx(we, { style: { fontSize: "32px" } }) })
2563
+ ] }),
2564
+ s.length === 0 && /* @__PURE__ */ n.jsx("div", { className: "w-100 h-100 d-flex align-items-center justify-content-center", children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: a ?? "No photos available" }) }),
2565
+ y && /* @__PURE__ */ n.jsxs("div", { className: ge.photoContainer, children: [
2566
+ /* @__PURE__ */ n.jsx("div", { role: p ? "button" : void 0, className: j("align-items-start", ge.navButton), onClick: () => p && x((f) => f - 1), children: p && /* @__PURE__ */ n.jsx(Ut, { style: { fontSize: "40px" } }) }),
2567
+ /* @__PURE__ */ n.jsx(m, { src: y.lgSrc, alt: y.alt, className: j("rounded", ge.photo), baseUrl: c, customToken: d, placeholder: u }),
2568
+ /* @__PURE__ */ n.jsx("div", { role: w ? "button" : void 0, className: j("align-items-end", ge.navButton), onClick: () => w && x((f) => f + 1), children: w && /* @__PURE__ */ n.jsx(Gt, { style: { fontSize: "40px" } }) })
2569
+ ] }),
2570
+ /* @__PURE__ */ n.jsx("div", { className: ge.photosPreview, children: s.map((f, k) => /* @__PURE__ */ n.jsxs("div", { role: "button", onClick: () => x(k), className: "position-relative", children: [
2571
+ /* @__PURE__ */ n.jsx(m, { role: k !== g ? "button" : void 0, src: f.smSrc, alt: f.alt, className: j("rounded", ge.photo, {
2572
+ [ge.selected]: k === g
2573
+ }), baseUrl: c, customToken: d, placeholder: u }, f.id),
2574
+ f.isDefault && /* @__PURE__ */ n.jsx("div", { className: j("text-primary", ge.defaultIndicator), children: /* @__PURE__ */ n.jsx(xo, {}) })
2575
+ ] })) })
2576
+ ] })
2577
+ ] });
2578
+ }, Hc = ({ photos: t, onUploadPhotos: e, uploadPhotosText: s, photoActions: r, baseUrl: o, customToken: a, placeholder: l, ImgComponent: i = Dr }) => {
2579
+ const [c, d] = I(null), u = c !== null ? t[c] : null, [m, h] = I(!1);
2580
+ return O(() => {
2581
+ if (t.length === 0) {
2582
+ d(null), h(!1);
2583
+ return;
2584
+ }
2585
+ const g = t.findIndex((x) => x.isDefault);
2586
+ d(g > -1 ? g : 0);
2587
+ }, [t]), u ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2588
+ /* @__PURE__ */ n.jsx(i, { role: "button", src: u.smSrc, alt: u.alt, className: "rounded w-100", onClick: () => h(!0), baseUrl: o, customToken: a, placeholder: l }),
2589
+ /* @__PURE__ */ n.jsx(Pc, { show: m, onClose: () => h(!1), photos: t, defaultIndex: c ?? 0, uploadPhotosText: s, onUploadPhotos: e, photoActions: r, baseUrl: o, customToken: a, placeholder: l, ImgComponent: i })
2590
+ ] }) : e ? /* @__PURE__ */ n.jsx(wr, { accept: ".jpg,.jpeg,.png", onUpload: (g) => {
2591
+ g.length > 0 && e(Array.from(g));
2592
+ }, icon: /* @__PURE__ */ n.jsx(cs, { style: { fontSize: 18 } }), multiple: !0, children: s ?? null }) : null;
2593
+ }, ld = ({ children: t }) => {
2594
+ var i, c, d;
2595
+ const { useMsal: e, msalScopes: s } = B(jo), { isAuthenticated: r } = yo(), { userLoginState: o } = B(is), a = o.state === wo.LOGGING_IN, l = o.user && ((i = o.user) == null ? void 0 : i.permissions) && ((d = (c = o.user) == null ? void 0 : c.permissions) == null ? void 0 : d.length) > 0;
2596
+ return e ? /* @__PURE__ */ n.jsx(Bo, { interactionType: Ao.Redirect, authenticationRequest: { scopes: s }, children: a || !r() ? /* @__PURE__ */ n.jsx(yn, {}) : o.user ? l ? /* @__PURE__ */ n.jsx(n.Fragment, { children: t }) : /* @__PURE__ */ n.jsx(it, { to: "/user-not-permitted", replace: !0 }) : /* @__PURE__ */ n.jsx(it, { to: "/no-user-login", replace: !0 }) }) : a ? /* @__PURE__ */ n.jsx(yn, {}) : !r() || !o.user ? /* @__PURE__ */ n.jsx(it, { to: "/login", replace: !0 }) : l ? t : /* @__PURE__ */ n.jsx(it, { to: "/user-not-permitted", replace: !0 });
2597
+ }, Fr = (t) => {
2598
+ const { variant: e, children: s, className: r, size: o = "md", typographyVariant: a = o === "sm" ? "body2" : "body", ...l } = { ...t };
2599
+ return /* @__PURE__ */ n.jsx(ua, { variant: e, className: `text-center ${o === "sm" ? "p-1" : o === "md" ? "p-3" : "p-4"} bg-${e} bg-opacity-10 border-none ${r ?? ""}`, ...l, children: /* @__PURE__ */ n.jsx(V, { variant: a, children: s }) });
2600
+ }, Wc = "_item_1lf6j_1", zc = "_level-success_1lf6j_4", Vc = "_level-info_1lf6j_10", Uc = "_level-warning_1lf6j_16", Gc = "_level-danger_1lf6j_22", Yc = "_type-icon_1lf6j_28", Et = {
2601
+ item: Wc,
2602
+ "level-success": "_level-success_1lf6j_4",
2603
+ levelSuccess: zc,
2604
+ "level-info": "_level-info_1lf6j_10",
2605
+ levelInfo: Vc,
2606
+ "level-warning": "_level-warning_1lf6j_16",
2607
+ levelWarning: Uc,
2608
+ "level-danger": "_level-danger_1lf6j_22",
2609
+ levelDanger: Gc,
2610
+ "type-icon": "_type-icon_1lf6j_28",
2611
+ typeIcon: Yc
2612
+ }, Kc = ({ level: t, children: e, customIcon: s, noIcon: r }) => {
2613
+ const { ProjectIconComponent: o } = B(ue), a = $(() => {
2614
+ switch (t) {
2615
+ case "info":
2616
+ return /* @__PURE__ */ n.jsx(o, { icon: "info" });
2617
+ case "warning":
2618
+ return /* @__PURE__ */ n.jsx(o, { icon: "warning" });
2619
+ case "danger":
2620
+ return /* @__PURE__ */ n.jsx(o, { icon: "danger" });
2621
+ default:
2622
+ return /* @__PURE__ */ n.jsx(o, { icon: "check" });
2623
+ }
2624
+ }, [o, t]);
2625
+ return /* @__PURE__ */ n.jsxs("div", { className: j("p-2 rounded d-flex gap-1 align-items-center justify-content-between", { "ps-1": !r }, Et.item, Et[`level-${t}`]), children: [
2626
+ !r && /* @__PURE__ */ n.jsx("div", { className: j(Et.typeIcon), children: s ?? a() }),
2627
+ /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "w-100", children: e })
2628
+ ] });
2629
+ }, cd = ({ version: t }) => /* @__PURE__ */ n.jsx("div", { className: "rounded", style: {
2630
+ position: "fixed",
2631
+ right: "0px",
2632
+ bottom: "0px",
2633
+ zIndex: "10000",
2634
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
2635
+ padding: "4px",
2636
+ pointerEvents: "all"
2637
+ }, children: /* @__PURE__ */ n.jsxs(V, { variant: "caption", className: "w-100 text-end", children: [
2638
+ "verze ",
2639
+ t
2640
+ ] }) }), qc = "_submit-container_a9slg_1", Qc = "_spacer_a9slg_14", Hn = {
2641
+ "submit-container": "_submit-container_a9slg_1",
2642
+ submitContainer: qc,
2643
+ spacer: Qc
2644
+ }, Zc = ({ children: t, noSpacer: e = !1 }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2645
+ !e && /* @__PURE__ */ n.jsx("div", { className: Hn.spacer }),
2646
+ /* @__PURE__ */ n.jsx("div", { className: j("luminus-floating-action-container shadow", Hn.submitContainer), children: t })
2647
+ ] }), Jc = "_timeline_g1754_1", Xc = "_step-container_g1754_1", ei = "_step-date_g1754_1", ti = "_step-content_g1754_4", ni = "_content-header_g1754_8", si = "_content-text_g1754_11", ri = "_step-icon_g1754_14", Me = {
2648
+ timeline: Jc,
2649
+ "step-container": "_step-container_g1754_1",
2650
+ stepContainer: Xc,
2651
+ "step-date": "_step-date_g1754_1",
2652
+ stepDate: ei,
2653
+ "step-content": "_step-content_g1754_4",
2654
+ stepContent: ti,
2655
+ "content-header": "_content-header_g1754_8",
2656
+ contentHeader: ni,
2657
+ "content-text": "_content-text_g1754_11",
2658
+ contentText: si,
2659
+ "step-icon": "_step-icon_g1754_14",
2660
+ stepIcon: ri
2661
+ }, id = ({ steps: t }) => /* @__PURE__ */ n.jsx("div", { className: Me.timeline, children: t.sort((e, s) => Ko(e.date ?? /* @__PURE__ */ new Date(), s.date ?? /* @__PURE__ */ new Date())).map((e, s) => /* @__PURE__ */ n.jsxs("div", { className: j("row g-0 gx-3", Me.stepContainer), children: [
2662
+ /* @__PURE__ */ n.jsx("div", { className: "col-3", children: e.date && /* @__PURE__ */ n.jsxs(V, { variant: "caption", className: j("h-100 d-flex flex-column align-items-end justify-content-center gap-0", Me.stepDate), children: [
2663
+ /* @__PURE__ */ n.jsx("div", { children: Xe(e.date, "dd.MM.yyyy") }),
2664
+ /* @__PURE__ */ n.jsx("div", { children: Xe(e.date, "HH:mm") })
2665
+ ] }) }),
2666
+ /* @__PURE__ */ n.jsx("div", { className: "col-9", children: /* @__PURE__ */ n.jsxs("div", { className: j("h-100 d-flex flex-column gap-1 border-start border-2 p-3", Me.stepContent), children: [
2667
+ /* @__PURE__ */ n.jsxs("div", { className: j("d-flex gap-2 align-items-center", Me.contentHeader), children: [
2668
+ e.person && /* @__PURE__ */ n.jsx(ds, { name: e.person.name ?? "", size: 22, fontSize: 12 }),
2669
+ typeof e.title == "string" ? /* @__PURE__ */ n.jsx(V, { variant: "body", className: "fw-bold", children: e.title }) : e.title
2670
+ ] }),
2671
+ e.text && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: Me.contentText, children: e.text }),
2672
+ /* @__PURE__ */ n.jsx("div", { className: j("text-primary", Me.stepIcon), children: e.icon ?? /* @__PURE__ */ n.jsx(vo, {}) })
2673
+ ] }) })
2674
+ ] }, s)) }), oi = (t, e, s, r = !0) => {
2675
+ const o = st({ silent: r, differentBaseUrl: e, customToken: s }), [a, l] = I(!1), [i, c] = I(null), d = $(async (u) => {
2676
+ l(!0), c(null), o.get(t, {
2677
+ signal: u,
2678
+ responseType: "blob"
2679
+ }).then((m) => {
2680
+ l(!1), c(m.data);
2681
+ }).catch(() => {
2682
+ l(!1), c(null);
2683
+ });
2684
+ }, [o, t]);
2685
+ return O(() => {
2686
+ const u = new AbortController();
2687
+ return d(u.signal), () => {
2688
+ u.abort();
2689
+ };
2690
+ }, [d]), { data: i, setData: c, reloadData: d, isLoading: a };
2691
+ }, Wn = ({ src: t, alt: e, baseUrl: s, customToken: r, placeholder: o, ...a }) => {
2692
+ const { data: l } = oi(t, s, r), [i, c] = I(null);
2693
+ return O(() => {
2694
+ let d = null;
2695
+ return l !== null ? (d = URL.createObjectURL(l), c(d)) : c(null), () => {
2696
+ d !== null && URL.revokeObjectURL(d);
2697
+ };
2698
+ }, [l]), i === null && !o ? null : /* @__PURE__ */ n.jsx("img", { ...a, alt: e ?? "", src: i ?? o });
2699
+ }, Er = ({ currentSelection: t, selectedItemNavigateTo: e, children: s }) => {
2700
+ if (!t || !t.id || !e)
2701
+ return /* @__PURE__ */ n.jsx("div", { className: "luminus-input-container position-relative w-100", children: s });
2702
+ const r = e(t);
2703
+ return /* @__PURE__ */ n.jsx(_e, { to: r, className: "luminus-input-container position-relative w-100 text-decoration-none", children: s });
2704
+ }, Or = ({ InputContainer: t = He, label: e, value: s, onChange: r, hidden: o, disabled: a, className: l, type: i, withoutLabel: c }) => /* @__PURE__ */ n.jsx(t, { isForCheckInput: !0, hidden: o, label: e ?? "", withoutLabel: c, className: l, children: /* @__PURE__ */ n.jsx(ae.Check, { id: `check-${e}`, type: i ?? "checkbox", label: e ?? "", checked: s, onChange: (d) => {
2705
+ var u;
2706
+ r && r(((u = d.target) == null ? void 0 : u.checked) ?? !1);
2707
+ }, className: l ?? "", hidden: o ?? !1, disabled: a ?? !1 }) }), Pe = ({ InputContainer: t = He, type: e, value: s, onChange: r, debounceMs: o, label: a, withoutLabel: l, placeholder: i, size: c, hidden: d, disabled: u, showClearIcon: m, clearValue: h, list: g, className: x, step: y, noSelectOnFocus: p }) => {
2708
+ const w = e === "number", N = $(() => {
2709
+ if (!r)
2710
+ return;
2711
+ const b = h ?? null;
2712
+ r(w ? b ? Number(b) : null : (b == null ? void 0 : b.toString()) ?? "");
2713
+ }, [h, w, r]), f = Y(null), [k, v] = I((s == null ? void 0 : s.toString()) ?? ""), C = $((b) => {
2714
+ const D = b;
2715
+ r && (w && r(D == null || D === "" ? null : Number(D)), r(D || null));
2716
+ }, [w, r]), _ = $((b) => {
2717
+ var R;
2718
+ const D = (R = b.target) == null ? void 0 : R.value;
2719
+ if (!o) {
2720
+ C(D);
2721
+ return;
2742
2722
  }
2743
- }, []), T = $((A) => {
2744
- if (L === null || h)
2723
+ v(D), f.current !== null && window.clearTimeout(f.current), f.current = window.setTimeout(() => {
2724
+ C(D);
2725
+ }, o);
2726
+ }, [o, C]);
2727
+ O(() => {
2728
+ v(s === null ? "" : s.toString());
2729
+ }, [s]);
2730
+ const [E, S] = I(!1), F = ys(e, s ? s.toString() ?? null : null, E);
2731
+ return /* @__PURE__ */ n.jsxs(t, { withoutLabel: l, label: a ?? "", hidden: d, className: x, children: [
2732
+ /* @__PURE__ */ n.jsx(ae.Control, { type: F, placeholder: i ?? a, size: c, value: o ? k : (s == null ? void 0 : s.toString()) ?? "", onChange: _, className: x ?? "", hidden: d, disabled: u ?? !1, list: g, onFocus: (b) => {
2733
+ S(!0), !p && b.target.select();
2734
+ }, onBlur: () => S(!1), step: y }),
2735
+ m && s !== null && r && !u && /* @__PURE__ */ n.jsx("div", { className: `luminus-input-remove-icon ${e !== "text" ? "inset" : ""}`, children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: N, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2736
+ ] });
2737
+ }, yt = ({
2738
+ InputContainer: t = He,
2739
+ value: e,
2740
+ options: s,
2741
+ onChange: r,
2742
+ label: o,
2743
+ withoutLabel: a,
2744
+ isNumber: l,
2745
+ size: i,
2746
+ hidden: c,
2747
+ disabled: d,
2748
+ showClearIcon: u,
2749
+ clearValue: m,
2750
+ noSortOptions: h,
2751
+ className: g,
2752
+ noEmptyOption: x
2753
+ // it will still add the empty option if there is no value provided or value is empty string or null
2754
+ }) => {
2755
+ const y = $(() => {
2756
+ if (!r)
2745
2757
  return;
2746
- const ne = L + A;
2747
- ne < 0 || ne >= s.length || Z((me) => (me !== null && te(me, A > 0 ? "down" : "up"), ne));
2748
- }, [L, s, h, te]), re = $((A) => {
2749
- if (t)
2750
- switch (A.key) {
2751
- case "Escape":
2752
- A.stopPropagation(), A.preventDefault(), e();
2753
- break;
2754
- case "Enter":
2755
- A.stopPropagation(), A.preventDefault(), h || o(ee);
2756
- break;
2757
- case "ArrowUp":
2758
- A.stopPropagation(), A.preventDefault(), T(-1);
2759
- break;
2760
- case "ArrowDown":
2761
- A.stopPropagation(), A.preventDefault(), T(1);
2762
- break;
2763
- }
2764
- }, [e, t, T, ee, h, o]), de = $(() => {
2765
- C((A) => !A);
2766
- }, []);
2767
- O(() => (window.addEventListener("scroll", de), () => {
2768
- window.removeEventListener("scroll", de);
2769
- }), [de]), O(() => (window.addEventListener("resize", de), () => {
2770
- window.removeEventListener("resize", de);
2771
- }), [de]), js(re), ys([y, p], e);
2772
- const pe = i ?? (c && c.length > 0 ? 250 : 0), le = (c == null ? void 0 : c.reduce((A, ne) => A + (ne.width ?? 100), 0)) ?? 0, xe = `calc(max(${D}px, ${pe}px + ${le}px))`;
2773
- return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2774
- /* @__PURE__ */ n.jsx(Fr, { show: t, onClick: e }),
2775
- r && t && !h && /* @__PURE__ */ n.jsx("button", { ref: p, type: "button", className: j("luminus-dropdown-picker-clear-button", fe.clearButton), onClick: () => !h && o(null), style: {
2776
- top: `calc(${F}px + ${R / 2}px - 12px)`,
2777
- left: `calc(${E}px - 24px - 8px)`
2778
- }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "text-danger", children: /* @__PURE__ */ n.jsx(cs, { size: 16 }) }) }),
2779
- /* @__PURE__ */ n.jsx("div", { className: j("luminus-dropdown-picker", fe.wrapper, {
2780
- [fe.open]: t
2781
- }), style: {
2782
- top: X ? `calc(${F}px - 50vh - 8px)` : `calc(${b}px + 8px)`,
2783
- left: Q ? `calc(${S}px - ${xe})` : E,
2784
- right: Q ? `${S}px` : `calc(${E}px + ${xe})`,
2785
- width: xe,
2786
- justifyContent: X ? "flex-end" : "flex-start"
2787
- }, children: /* @__PURE__ */ n.jsx("div", { ref: y, className: j("shadow rounded", fe.dropdown), children: !h && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2788
- u && (m ?? s.length) <= H ? null : /* @__PURE__ */ n.jsx("div", { className: j("search-input-container border-bottom", fe.searchInputContainer), children: /* @__PURE__ */ n.jsx(ae.Control, { ref: w, type: "search", size: "sm", className: fe.searchInput, placeholder: l.searchPlaceholder, value: f, onChange: (A) => {
2789
- var ne;
2790
- return k(((ne = A.target) == null ? void 0 : ne.value) ?? "");
2791
- } }) }),
2792
- g ? /* @__PURE__ */ n.jsx("div", { className: fe.loadingContainer, children: /* @__PURE__ */ n.jsx(sn, { animation: "border", variant: "primary" }) }) : s.length > 0 && /* @__PURE__ */ n.jsxs("div", { ref: N, className: j("items", fe.itemsContainer), children: [
2793
- c && c.length > 0 && /* @__PURE__ */ n.jsxs("div", { className: j("header-row border-bottom", fe.headerRow), children: [
2794
- /* @__PURE__ */ n.jsx("div", { className: fe.name }),
2795
- c == null ? void 0 : c.map((A) => /* @__PURE__ */ n.jsx("div", { className: fe.columnItem, style: {
2796
- width: `${A.width ?? 100}px`,
2797
- minWidth: `${A.width ?? 100}px`,
2798
- maxWidth: `${A.width ?? 100}px`
2799
- }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", children: A.name }) }, A.key))
2800
- ] }),
2801
- s == null ? void 0 : s.map((A, ne) => /* @__PURE__ */ n.jsxs("button", { id: `item-${ne}`, type: "button", className: j("item cursor-pointer", fe.item, {
2802
- [fe.focused]: L === ne
2803
- }, {
2804
- focused: L === ne
2805
- }), onClick: () => !h && o(A), onMouseEnter: () => Z(ne), children: [
2806
- /* @__PURE__ */ n.jsx("div", { className: fe.name, children: /* @__PURE__ */ n.jsx(V, { variant: "body2", children: d ? A.id : A.name }) }),
2807
- c == null ? void 0 : c.map((me) => /* @__PURE__ */ n.jsx("div", { className: fe.columnItem, style: {
2808
- width: `${me.width ?? 100}px`,
2809
- minWidth: `${me.width ?? 100}px`,
2810
- maxWidth: `${me.width ?? 100}px`
2811
- }, children: /* @__PURE__ */ n.jsx(V, { variant: "caption", className: j("text-muted"), children: A.additionalColumns && A.additionalColumns[me.key] }) }, me.key))
2812
- ] }, A.id))
2813
- ] })
2814
- ] }) }) })
2758
+ const p = m ?? null;
2759
+ r(l ? p ? Number(p) : null : (p == null ? void 0 : p.toString()) ?? "");
2760
+ }, [m, l, r]);
2761
+ return /* @__PURE__ */ n.jsxs(t, { withoutLabel: a, label: o ?? "", hidden: c, className: g, children: [
2762
+ /* @__PURE__ */ n.jsxs(ae.Select, { size: i, value: e ?? "", onChange: (p) => {
2763
+ var N;
2764
+ if (!r)
2765
+ return;
2766
+ const w = (N = p.target) == null ? void 0 : N.value;
2767
+ l && r(w ? parseInt(w, 10) : null), r(w || null);
2768
+ }, className: g ?? "", hidden: c, disabled: d ?? !1, children: [
2769
+ x && !(e == null || e === "") ? void 0 : /* @__PURE__ */ n.jsx("option", { value: "" }),
2770
+ s == null ? void 0 : s.sort((p, w) => h ? 0 : (p.name ?? "").localeCompare(w.name ?? "")).map((p) => /* @__PURE__ */ n.jsx("option", { value: p.id ?? "", children: p.name }, p.id))
2771
+ ] }),
2772
+ u && e && r && !d && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon inset", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: y, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2815
2773
  ] });
2816
- }, sc = ({ searchTypes: t, selectedType: e, setSelectedType: s }) => /* @__PURE__ */ n.jsx($r, { toggle: /* @__PURE__ */ n.jsx(Cr, { as: ho, icon: null, text: e == null ? void 0 : e.text }), children: t.map((r) => /* @__PURE__ */ n.jsx(rn, { icon: null, onClick: () => s(r.key), children: r.text }, r.key)) }), rc = "_dropdown_1ddrg_1", oc = "_open_1ddrg_12", ac = "_loading-container_1ddrg_15", lc = "_groups-container_1ddrg_22", cc = "_group_1ddrg_22", ic = "_header_1ddrg_26", dc = "_item_1ddrg_33", Ee = {
2817
- dropdown: rc,
2818
- open: oc,
2819
- "loading-container": "_loading-container_1ddrg_15",
2820
- loadingContainer: ac,
2821
- "groups-container": "_groups-container_1ddrg_22",
2822
- groupsContainer: lc,
2823
- group: cc,
2824
- header: ic,
2825
- item: dc
2826
- }, uc = ({ show: t, query: e, onCancel: s, groups: r, isLoading: o, searchTypes: a }) => {
2827
- const { texts: { appSearch: l } } = B(ue), i = Y(null), c = $((d) => {
2828
- var m;
2829
- const u = (m = a.find((h) => h.key === d.type)) == null ? void 0 : m.toPath;
2830
- return u ? `${u}/${d.searchKey}` : "/not-found";
2831
- }, [a]);
2832
- return ys([i], s), /* @__PURE__ */ n.jsx("div", { ref: i, className: j("luminus-app-search-dropdown shadow rounded", Ee.dropdown, {
2833
- [Ee.open]: t
2834
- }), children: o ? /* @__PURE__ */ n.jsx("div", { className: Ee.loadingContainer, children: /* @__PURE__ */ n.jsx(sn, { animation: "border", variant: "primary" }) }) : /* @__PURE__ */ n.jsx("div", { className: Ee.groupsContainer, children: r == null ? void 0 : r.map((d) => {
2835
- var u;
2836
- return /* @__PURE__ */ n.jsxs("div", { className: j(Ee.group), children: [
2837
- /* @__PURE__ */ n.jsxs(_e, { to: `/search?query=${e}&type=${d.key.category}`, className: j("group-header", Ee.header), onClick: s, children: [
2838
- /* @__PURE__ */ n.jsx(V, { variant: "body", className: "text-primary", children: d.key.categoryName }),
2839
- /* @__PURE__ */ n.jsxs(V, { variant: "caption", children: [
2840
- d.items.length,
2841
- " ",
2842
- l.amountFrom,
2843
- " ",
2844
- d.key.totalCount
2845
- ] })
2774
+ }, dd = ({ InputContainer: t = He, items: e, defaultSelection: s, selectedItemNavigateTo: r, onSearchQueryChange: o, texts: a, isLoading: l, isNumber: i, onSelect: c, label: d, withoutLabel: u, size: m, dropdownItemsNameWidth: h, additionalColumns: g, hidden: x, disabled: y, displayIdAsName: p, CustomOnChangeComponent: w, className: N }) => {
2775
+ var D, R;
2776
+ const [f, k] = I(s), [v, C] = I(!1);
2777
+ O(() => {
2778
+ k(s);
2779
+ }, [s]);
2780
+ const _ = $((H) => {
2781
+ k(H);
2782
+ }, []), E = $((H) => {
2783
+ C(!1), _(H);
2784
+ }, [_]);
2785
+ O(() => {
2786
+ c && c(f);
2787
+ }, [f, c]);
2788
+ const S = Y(null), F = r !== void 0, b = F && f !== null;
2789
+ return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { withoutLabel: u, label: d ?? "", hidden: x, inputContainerClassName: j({ "luminus-dropdown-select-open": v }), className: N, children: [
2790
+ /* @__PURE__ */ n.jsxs(Er, { currentSelection: f, selectedItemNavigateTo: r, children: [
2791
+ p && (f == null ? void 0 : f.name) && /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "d-flex justify-content-end mt-2 luminus-dropdown-selection-name", children: f.name }),
2792
+ /* @__PURE__ */ n.jsxs(ae.Select, { ref: S, size: m, value: (f == null ? void 0 : f.id) ?? "", onChange: (H) => k({
2793
+ id: i ? Number(H.target.value) ?? null : H.target.value,
2794
+ name: ""
2795
+ }), onMouseDown: (H) => {
2796
+ H.currentTarget.focus(), H.preventDefault();
2797
+ }, onClick: () => {
2798
+ !F && !y && C(!0);
2799
+ }, className: j("w-100", {
2800
+ "luminus-dropdown-picker-disabled": y,
2801
+ "luminus-dropdown-picker-link": b
2802
+ }), hidden: x, children: [
2803
+ /* @__PURE__ */ n.jsx("option", { value: "" }),
2804
+ s && /* @__PURE__ */ n.jsx("option", { value: s.id ?? void 0, children: s.name && ((D = s.name) == null ? void 0 : D.length) > 0 ? s.name : s.id }),
2805
+ f && /* @__PURE__ */ n.jsx("option", { value: f.id ?? void 0, children: f.name && ((R = f.name) == null ? void 0 : R.length) > 0 ? f.name : f.id })
2846
2806
  ] }),
2847
- (u = d.items) == null ? void 0 : u.map((m, h) => /* @__PURE__ */ n.jsxs(
2848
- _e,
2849
- {
2850
- to: c(m),
2851
- className: j("search-item d-flex gap-3 align-items-center justify-content-between", Ee.item),
2852
- onClick: s,
2853
- children: [
2854
- /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "text-nowrap text-truncate", children: m.name }),
2855
- /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "text-primary", children: /* @__PURE__ */ n.jsx(go, {}) })
2856
- ]
2857
- },
2858
- h
2859
- ))
2860
- ] }, d.key.category);
2861
- }) }) });
2862
- }, fc = "_input-group_1lkfy_1", mc = "_input-group-text_1lkfy_5", pc = "_left_1lkfy_9", hc = "_right_1lkfy_13", gc = "_input_1lkfy_1", xc = "_submit-button_1lkfy_20", Oe = {
2863
- "input-group": "_input-group_1lkfy_1",
2864
- inputGroup: fc,
2865
- "input-group-text": "_input-group-text_1lkfy_5",
2866
- inputGroupText: mc,
2867
- left: pc,
2868
- right: hc,
2869
- input: gc,
2870
- "submit-button": "_submit-button_1lkfy_20",
2871
- submitButton: xc
2872
- }, jc = (t, e) => {
2873
- const s = st(), [r, o] = I(!1), [a, l] = I([]), i = !t || !t.key, c = $(() => {
2874
- if (e.length < 3) {
2875
- l([]);
2807
+ w || !y && F ? /* @__PURE__ */ n.jsxs("div", { className: "custom-picker-button", children: [
2808
+ !w && !y && F && /* @__PURE__ */ n.jsx(U, { size: "sm", color: "secondary", onClick: (H) => {
2809
+ H.preventDefault(), H.stopPropagation(), C(!0);
2810
+ }, children: /* @__PURE__ */ n.jsx(us, {}) }),
2811
+ w ?? null
2812
+ ] }) : null
2813
+ ] }),
2814
+ S.current && /* @__PURE__ */ n.jsx(rn, { show: v, onCancel: () => C(!1), items: e, currentSelection: f, onSelectionChange: E, onSearchQueryChange: o, texts: a, itemsNameWidth: h, additionalColumns: g, isLoading: l, disabled: y, inputRef: S })
2815
+ ] }) });
2816
+ }, ud = ({ InputContainer: t = He, value: e, onChange: s, label: r, size: o, showClearIcon: a, clearValue: l, hidden: i, disabled: c, rows: d, withoutLabel: u, debounceMs: m, className: h }) => {
2817
+ const g = $(() => {
2818
+ if (!s)
2819
+ return;
2820
+ const f = l ?? null;
2821
+ s((f == null ? void 0 : f.toString()) ?? "");
2822
+ }, [l, s]), x = Y(null), [y, p] = I((e == null ? void 0 : e.toString()) ?? ""), w = $((f) => {
2823
+ const k = f;
2824
+ s && s(k || null);
2825
+ }, [s]), N = $((f) => {
2826
+ var v;
2827
+ const k = (v = f.target) == null ? void 0 : v.value;
2828
+ if (!m) {
2829
+ w(k);
2876
2830
  return;
2877
2831
  }
2878
- o(!0), s.get(`/search/${e}?count=${i ? 5 : 20}${i ? "" : `&type=${t.key}`}`).then(({ data: d }) => {
2879
- l(d), o(!1);
2880
- }).catch(() => {
2881
- o(!1);
2882
- });
2883
- }, [t, e, s, i]);
2832
+ p(k), x.current !== null && window.clearTimeout(x.current), x.current = window.setTimeout(() => {
2833
+ w(k);
2834
+ }, m);
2835
+ }, [m, w]);
2884
2836
  return O(() => {
2885
- c();
2886
- }, [c]), { isLoading: r, searchItems: a };
2887
- }, _d = ({ searchTypes: t, navigateFunction: e, currentPath: s }) => {
2888
- var y;
2889
- const { texts: { appSearch: r } } = B(ue), [o, a] = I(t.length > 0 ? ((y = t.at(0)) == null ? void 0 : y.key) ?? null : null), l = q(() => t.find((p) => p.key === o) ?? null, [t, o]), [i, c] = I(""), [d, u] = Sr(i, 500), { isLoading: m, searchItems: h } = jc(l, d), [g, x] = I(!1);
2837
+ p(e === null ? "" : e.toString());
2838
+ }, [e]), /* @__PURE__ */ n.jsxs(t, { label: r ?? "", hidden: i, withoutLabel: u, className: h, isForTextAreaInput: !0, children: [
2839
+ /* @__PURE__ */ n.jsx(ae.Control, { as: "textarea", size: o, value: m ? y : e ?? "", onChange: N, hidden: i, disabled: c, rows: d ?? 2, className: "w-100" }),
2840
+ a && e && s && !c && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: g, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2841
+ ] });
2842
+ }, fd = ({ InputContainer: t = He, value: e, onChange: s, debounceMs: r, label: o, withoutLabel: a, placeholder: l, size: i, hidden: c, disabled: d, showClearIcon: u, clearValue: m, className: h, step: g, stepperStep: x = 1 }) => {
2843
+ const y = $(() => {
2844
+ if (!s)
2845
+ return;
2846
+ const v = m ?? null;
2847
+ s(v ? Number(v) : null);
2848
+ }, [m, s]), p = Y(null), [w, N] = I((e == null ? void 0 : e.toString()) ?? ""), f = $((v) => {
2849
+ const C = v;
2850
+ s && s(C == null || C === "" ? null : Number(C));
2851
+ }, [s]), k = $((v) => {
2852
+ var _;
2853
+ const C = (_ = v.target) == null ? void 0 : _.value;
2854
+ if (!r) {
2855
+ f(C);
2856
+ return;
2857
+ }
2858
+ N(C), p.current !== null && window.clearTimeout(p.current), p.current = window.setTimeout(() => {
2859
+ f(C);
2860
+ }, r);
2861
+ }, [r, f]);
2890
2862
  return O(() => {
2891
- (h.length > 0 || m) && x(!0);
2892
- }, [h, m]), O(() => {
2893
- c("");
2894
- }, [s]), /* @__PURE__ */ n.jsx(ae, { onSubmit: (p) => {
2895
- p.preventDefault(), p.stopPropagation(), u.flush(), x(!1), i.length > 2 && e(`/search?query=${i}${l && l.key && `&type=${l == null ? void 0 : l.key}`}`);
2896
- }, children: /* @__PURE__ */ n.jsxs(ft, { className: Oe.inputGroup, children: [
2897
- /* @__PURE__ */ n.jsx(ft.Text, { className: j("p-1 rounded", Oe.inputGroupText, Oe.left), children: /* @__PURE__ */ n.jsx(sc, { searchTypes: t, selectedType: l, setSelectedType: a }) }),
2898
- /* @__PURE__ */ n.jsx(ae.Control, { placeholder: r.searchPlaceholder, type: "text", size: "sm", className: j("luminus-app-search-input", Oe.input), value: i, onChange: (p) => {
2899
- var w;
2900
- return c(((w = p.target) == null ? void 0 : w.value) ?? "");
2901
- }, onFocus: () => h.length > 0 && x(!0) }),
2902
- /* @__PURE__ */ n.jsx(ft.Text, { className: j("p-0 rounded", Oe.inputGroupText, Oe.right), children: /* @__PURE__ */ n.jsx("button", { type: "submit", className: j("text-primary", Oe.submitButton), children: /* @__PURE__ */ n.jsx(nl, {}) }) }),
2903
- /* @__PURE__ */ n.jsx(uc, { query: d, searchTypes: t, show: g, onCancel: () => x(!1), groups: h, isLoading: m })
2863
+ N(e === null ? "" : e.toString());
2864
+ }, [e]), /* @__PURE__ */ n.jsx(t, { withoutLabel: a, label: o ?? "", hidden: c, className: h, children: /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
2865
+ /* @__PURE__ */ n.jsx(ae.Control, { type: "number", placeholder: l ?? o, size: i, value: r ? w : e ?? "", onChange: k, className: `luminus-numeric-stepper ${h ?? ""}`, hidden: c, disabled: d ?? !1, step: g }),
2866
+ /* @__PURE__ */ n.jsx("div", { className: "stepper-icon left", children: !d && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (v) => {
2867
+ v.preventDefault(), v.stopPropagation(), f(((e ?? 0) - x).toString());
2868
+ }, children: /* @__PURE__ */ n.jsx(br, {}) }) }),
2869
+ /* @__PURE__ */ n.jsx("div", { className: "stepper-icon right", children: !d && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (v) => {
2870
+ v.preventDefault(), v.stopPropagation(), f(((e ?? 0) + x).toString());
2871
+ }, children: /* @__PURE__ */ n.jsx(_r, {}) }) }),
2872
+ u && e && s && !d && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: y, children: /* @__PURE__ */ n.jsx(we, {}) }) })
2904
2873
  ] }) });
2905
- }, yc = "_card_19733_1", wc = "_header_19733_6", vc = "_header-content_19733_13", bc = "_title_19733_19", _c = "_collapse-icon_19733_22", Nc = "_collapsed_19733_27", kc = "_content_19733_30", Te = {
2906
- card: yc,
2907
- header: wc,
2908
- "header-content": "_header-content_19733_13",
2909
- headerContent: vc,
2910
- title: bc,
2911
- "collapse-icon": "_collapse-icon_19733_22",
2912
- collapseIcon: _c,
2913
- collapsed: Nc,
2914
- content: kc
2915
- }, Cc = ({ title: t, headerContent: e, children: s, className: r, headerClassName: o, contentClassName: a, ...l }) => {
2916
- const i = l.collapsible ? l.controlled ? !1 : l.defaultOpen ?? !1 : !0, [c, d] = I(i), u = l.collapsible ? l.controlled ? l.isOpen : c : !0;
2917
- return O(() => {
2918
- d(i);
2919
- }, [i]), /* @__PURE__ */ n.jsxs("div", { className: j("luminus-card rounded shadow-sm", Te.card, {
2920
- [r ?? ""]: r
2921
- }), children: [
2922
- /* @__PURE__ */ n.jsxs("div", { role: l.collapsible ? "button" : void 0, className: j("header", Te.header, {
2923
- [o ?? ""]: o
2924
- }), onClick: () => {
2925
- l.collapsible && (l.controlled ? l.onToggle(!l.isOpen) : d(!c));
2926
- }, children: [
2927
- /* @__PURE__ */ n.jsxs("div", { className: j("header-content", Te.headerContent), children: [
2928
- /* @__PURE__ */ n.jsx(V, { variant: "h6", className: j("text-primary", Te.title), children: t }),
2929
- e ?? null
2930
- ] }),
2931
- l.collapsible && /* @__PURE__ */ n.jsx(is, { className: j(Te.collapseIcon, {
2932
- [Te.collapsed]: u
2933
- }) })
2934
- ] }),
2935
- /* @__PURE__ */ n.jsx(bs, { in: u, children: /* @__PURE__ */ n.jsx("div", { className: j("card-content border-top border-primary", Te.content, {
2936
- [a ?? ""]: a
2937
- }), children: s }) })
2938
- ] });
2939
- };
2940
- var $c = !!(typeof window < "u" && window.document && window.document.createElement), Sc = /* @__PURE__ */ function() {
2941
- function t(e, s) {
2942
- for (var r = 0; r < s.length; r++) {
2943
- var o = s[r];
2944
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
2874
+ }, zn = [
2875
+ ["D", "day"],
2876
+ // ['W', 'week'],
2877
+ ["M", "month"],
2878
+ ["Y", "year"],
2879
+ ["C", "custom"]
2880
+ ], ai = "_wrapper_qfqux_1", li = "_lg_qfqux_7", ci = "_sm_qfqux_11", ii = "_md_qfqux_14", Vn = {
2881
+ wrapper: ai,
2882
+ lg: li,
2883
+ sm: ci,
2884
+ md: ii
2885
+ }, mt = (t) => {
2886
+ const e = new Date(t), s = De(e.toISOString());
2887
+ e.setMonth(e.getMonth() + 1), e.setDate(e.getDate() - 1);
2888
+ const r = De(e.toISOString());
2889
+ return { from: s, to: r };
2890
+ }, Ze = (t) => {
2891
+ const e = new Date(t), s = De(e.toISOString());
2892
+ e.setFullYear(e.getFullYear() + 1), e.setDate(e.getDate() - 1);
2893
+ const r = De(e.toISOString());
2894
+ return { from: s, to: r };
2895
+ }, di = (t, e) => {
2896
+ if (t === null || e === null)
2897
+ return "C";
2898
+ if (t === e)
2899
+ return "D";
2900
+ const s = new Date(t);
2901
+ return mt(s).to === e ? "M" : Ze(s).to === e ? "Y" : (console.log(Ze(s), e), "C");
2902
+ }, ui = (t, e, s) => {
2903
+ const r = $((l, i) => {
2904
+ if (t === "C") {
2905
+ s((c) => ({ ...c, [l]: i }));
2906
+ return;
2945
2907
  }
2946
- }
2947
- return function(e, s, r) {
2948
- return s && t(e.prototype, s), r && t(e, r), e;
2949
- };
2950
- }();
2951
- function Ic(t, e) {
2952
- if (!(t instanceof e))
2953
- throw new TypeError("Cannot call a class as a function");
2954
- }
2955
- function Dc(t, e) {
2956
- if (!t)
2957
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2958
- return e && (typeof e == "object" || typeof e == "function") ? e : t;
2959
- }
2960
- function Fc(t, e) {
2961
- if (typeof e != "function" && e !== null)
2962
- throw new TypeError("Super expression must either be null or a function, not " + typeof e);
2963
- t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);
2964
- }
2965
- var Ir = function(t) {
2966
- Fc(e, t);
2967
- function e() {
2968
- return Ic(this, e), Dc(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments));
2969
- }
2970
- return Sc(e, [{
2971
- key: "componentWillUnmount",
2972
- value: function() {
2973
- this.defaultNode && document.body.removeChild(this.defaultNode), this.defaultNode = null;
2908
+ switch (l) {
2909
+ case "from":
2910
+ s((c) => {
2911
+ if (i === null)
2912
+ return c;
2913
+ const d = new Date(i);
2914
+ if (t === "D") {
2915
+ const u = De(d.toISOString());
2916
+ return {
2917
+ from: u,
2918
+ to: u
2919
+ };
2920
+ }
2921
+ return t === "M" ? mt(d) : t === "Y" ? Ze(d) : c;
2922
+ });
2923
+ break;
2924
+ case "to":
2925
+ e("C"), s((c) => ({ ...c, [l]: i }));
2926
+ break;
2974
2927
  }
2975
- }, {
2976
- key: "render",
2977
- value: function() {
2978
- return $c ? (!this.props.node && !this.defaultNode && (this.defaultNode = document.createElement("div"), document.body.appendChild(this.defaultNode)), pt.createPortal(this.props.children, this.props.node || this.defaultNode)) : null;
2928
+ }, [t, s, e]), o = $((l) => {
2929
+ s((i) => {
2930
+ if (i.from === null || i.to === null)
2931
+ return i;
2932
+ const c = new Date(i.from);
2933
+ c.setHours(c.getHours() - c.getTimezoneOffset() / 60);
2934
+ const d = new Date(i.to);
2935
+ if (t === "D") {
2936
+ c.setDate(c.getDate() + l);
2937
+ const u = De(c.toISOString());
2938
+ return {
2939
+ from: u,
2940
+ to: u
2941
+ };
2942
+ }
2943
+ return t === "M" ? (c.setMonth(c.getMonth() + l), mt(c)) : t === "Y" ? (c.setFullYear(c.getFullYear() + l), Ze(c)) : {
2944
+ from: De(c.toISOString()),
2945
+ to: De(d.toISOString())
2946
+ };
2947
+ });
2948
+ }, [t, s]), a = $((l) => {
2949
+ l === "D" ? s((i) => ({ from: i.from, to: i.from })) : l === "M" ? s((i) => {
2950
+ if (i.from === null)
2951
+ return i;
2952
+ const c = Po(i.from);
2953
+ return mt(c);
2954
+ }) : l === "Y" && s((i) => {
2955
+ if (i.from === null)
2956
+ return i;
2957
+ const c = Ho(new Date(i.from).getFullYear());
2958
+ return Ze(c);
2959
+ }), e(l);
2960
+ }, [s, e]);
2961
+ return { setFromToProp: r, handleArrowClick: o, handleRangeChange: a };
2962
+ }, md = ({ fromtoState: [t, e], className: s, size: r }) => {
2963
+ const { texts: { date: o }, ProjectIconComponent: a } = B(ue), [l, i] = I("C"), { handleArrowClick: c, handleRangeChange: d, setFromToProp: u } = ui(l, i, e), m = q(() => l === "C", [l]), h = Y(!0);
2964
+ return O(() => {
2965
+ if (h.current) {
2966
+ const g = di(t.from, t.to);
2967
+ i(g), h.current = !1;
2979
2968
  }
2980
- }]), e;
2981
- }(he.Component);
2982
- Ir.propTypes = {
2983
- children: Le.node.isRequired,
2984
- node: Le.any
2985
- };
2986
- var Ec = /* @__PURE__ */ function() {
2987
- function t(e, s) {
2988
- for (var r = 0; r < s.length; r++) {
2989
- var o = s[r];
2990
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
2969
+ }, [t.from, t.to]), /* @__PURE__ */ n.jsxs("div", { className: j("d-inline-flex align-items-center gap-1", Vn.wrapper, Vn[r ?? "md"], s), children: [
2970
+ /* @__PURE__ */ n.jsx(U, { disabled: m, onClick: () => {
2971
+ c(-1);
2972
+ }, children: /* @__PURE__ */ n.jsx(a, { icon: "chevron-left" }) }),
2973
+ /* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-center gap-1", children: [
2974
+ /* @__PURE__ */ n.jsx(Pe, { type: "date", value: t.from, onChange: (g) => u("from", g === null ? null : g.toString()), InputContainer: ye, size: r }),
2975
+ /* @__PURE__ */ n.jsx(Cr, { toggle: /* @__PURE__ */ n.jsx(kr, { text: o[zn.find((g) => g[0] === l)[1]].substring(0, 1), as: bo }), children: zn.map((g) => /* @__PURE__ */ n.jsx(on, { disabled: g[0] === l, className: j(g[0] === l ? "text-black-50" : ""), onClick: () => d(g[0]), role: "button", children: o[g[1]] }, g[0])) }),
2976
+ /* @__PURE__ */ n.jsx(Pe, { type: "date", value: t.to, onChange: (g) => u("to", g === null ? null : g.toString()), InputContainer: ye, size: r })
2977
+ ] }) }),
2978
+ /* @__PURE__ */ n.jsx(U, { disabled: m, onClick: () => {
2979
+ c(1);
2980
+ }, children: /* @__PURE__ */ n.jsx(a, { icon: "chevron-right" }) })
2981
+ ] });
2982
+ }, pd = ({ defaultMonth: t, searchKey: e = "monthFrom", yearMin: s, yearMax: r }) => {
2983
+ const { localizationContext: o } = B(ue), { dateFnsLocale: a } = B(o), { searchParams: l, setSearch: i } = Wo(), c = l.get(e), d = c ? et(c) : t, u = $((m) => {
2984
+ i(e, At(m, { representation: "date" }));
2985
+ }, [e, i]);
2986
+ return /* @__PURE__ */ n.jsx(Qa, { month: d, onChangeMonth: u, locale: a, yearMin: s, yearMax: r });
2987
+ }, hd = ({ defaultYear: t, searchKey: e = "yearFrom", optionMin: s, optionMax: r, className: o }) => {
2988
+ const [a, l] = zo(e, At(t, { representation: "date" })), i = a ? et(a) : t, c = $((d) => {
2989
+ l(At(d, { representation: "date" }));
2990
+ }, [l]);
2991
+ return /* @__PURE__ */ n.jsx(Xa, { year: i, onChangeYear: c, optionMin: s, optionMax: r, className: o });
2992
+ }, gd = ({ data: t, showLegend: e = !1, legendPosition: s = "left" }) => {
2993
+ const { chartColorPalette: r } = B(ue);
2994
+ return /* @__PURE__ */ n.jsx(_o, { data: t, margin: {
2995
+ top: 50,
2996
+ right: e && s === "right" ? 200 : 100,
2997
+ bottom: 50,
2998
+ left: e && s === "left" ? 200 : 100
2999
+ }, innerRadius: 0.4, padAngle: 4, cornerRadius: 2, activeOuterRadiusOffset: 10, borderWidth: 2, borderColor: {
3000
+ from: "color",
3001
+ modifiers: [["darker", 0.5]]
3002
+ }, colors: r, arcLinkLabelsSkipAngle: 10, arcLinkLabelsTextColor: { from: "color", modifiers: [["darker", 0.5]] }, arcLinkLabelsThickness: 2, arcLinkLabelsColor: { from: "color" }, enableArcLabels: !1, legends: e ? [
3003
+ {
3004
+ anchor: s,
3005
+ direction: s === "left" || s === "right" ? "column" : "row",
3006
+ justify: !1,
3007
+ translateX: s === "left" ? -200 : s === "right" ? 200 : 0,
3008
+ translateY: s === "top" ? -50 : s === "bottom" ? 50 : 0,
3009
+ itemsSpacing: 4,
3010
+ itemWidth: 120,
3011
+ itemHeight: 18,
3012
+ itemTextColor: "#1e2832",
3013
+ itemDirection: "left-to-right",
3014
+ itemOpacity: 1,
3015
+ symbolSize: 18,
3016
+ symbolShape: "circle",
3017
+ padding: 10
2991
3018
  }
2992
- }
2993
- return function(e, s, r) {
2994
- return s && t(e.prototype, s), r && t(e, r), e;
3019
+ ] : [] });
3020
+ }, fi = ({ errors: t, schema: e }) => {
3021
+ const s = (r) => {
3022
+ var o, a;
3023
+ return r.toLowerCase() === "others" ? "Obecné" : ((a = (o = e.columns) == null ? void 0 : o.find((l) => l.field === r)) == null ? void 0 : a.caption) ?? r;
2995
3024
  };
2996
- }();
2997
- function Oc(t, e) {
2998
- if (!(t instanceof e))
2999
- throw new TypeError("Cannot call a class as a function");
3000
- }
3001
- function Tc(t, e) {
3002
- if (!t)
3003
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3004
- return e && (typeof e == "object" || typeof e == "function") ? e : t;
3005
- }
3006
- function Mc(t, e) {
3007
- if (typeof e != "function" && e !== null)
3008
- throw new TypeError("Super expression must either be null or a function, not " + typeof e);
3009
- t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);
3010
- }
3011
- var Dr = function(t) {
3012
- Mc(e, t);
3013
- function e() {
3014
- return Oc(this, e), Tc(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments));
3015
- }
3016
- return Ec(e, [{
3017
- key: "componentDidMount",
3018
- value: function() {
3019
- this.renderPortal();
3020
- }
3021
- }, {
3022
- key: "componentDidUpdate",
3023
- value: function(r) {
3024
- this.renderPortal();
3025
- }
3026
- }, {
3027
- key: "componentWillUnmount",
3028
- value: function() {
3029
- pt.unmountComponentAtNode(this.defaultNode || this.props.node), this.defaultNode && document.body.removeChild(this.defaultNode), this.defaultNode = null, this.portal = null;
3030
- }
3031
- }, {
3032
- key: "renderPortal",
3033
- value: function(r) {
3034
- !this.props.node && !this.defaultNode && (this.defaultNode = document.createElement("div"), document.body.appendChild(this.defaultNode));
3035
- var o = this.props.children;
3036
- typeof this.props.children.type == "function" && (o = he.cloneElement(this.props.children)), this.portal = pt.unstable_renderSubtreeIntoContainer(this, o, this.props.node || this.defaultNode);
3025
+ return /* @__PURE__ */ n.jsx("div", { className: "alert alert-danger w-100 m-0 p-2", children: /* @__PURE__ */ n.jsx("table", { children: /* @__PURE__ */ n.jsx("tbody", { children: t.map((r) => /* @__PURE__ */ n.jsxs("tr", { children: [
3026
+ /* @__PURE__ */ n.jsx("td", { className: "fw-bold pe-2", children: /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3027
+ s(r.name),
3028
+ ":"
3029
+ ] }) }),
3030
+ /* @__PURE__ */ n.jsx("td", { className: "", children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: r.errors }) })
3031
+ ] }, r.name)) }) }) });
3032
+ }, Tr = (t) => {
3033
+ const e = {};
3034
+ return Object.keys(t).forEach((s) => {
3035
+ if (t[s].value === !0) {
3036
+ e[s] = 1;
3037
+ return;
3037
3038
  }
3038
- }, {
3039
- key: "render",
3040
- value: function() {
3041
- return null;
3039
+ if (t[s].value === !1) {
3040
+ e[s] = 0;
3041
+ return;
3042
3042
  }
3043
- }]), e;
3044
- }(he.Component);
3045
- Dr.propTypes = {
3046
- children: Le.node.isRequired,
3047
- node: Le.any
3048
- };
3049
- var Wt = void 0;
3050
- pt.createPortal ? Wt = Ir : Wt = Dr;
3051
- const Lc = "_lightbox_14acg_1", Rc = "_show_14acg_16", Ac = "_header_14acg_20", Bc = "_photo-actions_14acg_26", Pc = "_photo-container_14acg_31", Hc = "_photo_14acg_26", Wc = "_nav-button_14acg_41", zc = "_photos-preview_14acg_49", Vc = "_selected_14acg_62", Uc = "_default-indicator_14acg_66", ge = {
3052
- lightbox: Lc,
3053
- show: Rc,
3054
- header: Ac,
3055
- "photo-actions": "_photo-actions_14acg_26",
3056
- photoActions: Bc,
3057
- "photo-container": "_photo-container_14acg_31",
3058
- photoContainer: Pc,
3059
- photo: Hc,
3060
- "nav-button": "_nav-button_14acg_41",
3061
- navButton: Wc,
3062
- "photos-preview": "_photos-preview_14acg_49",
3063
- photosPreview: zc,
3064
- selected: Vc,
3065
- "default-indicator": "_default-indicator_14acg_66",
3066
- defaultIndicator: Uc
3067
- }, Gc = "_backdrop_3huvf_1", Yc = "_show_3huvf_11", Wn = {
3068
- backdrop: Gc,
3069
- show: Yc
3070
- }, Fr = ({ show: t, onClick: e }) => /* @__PURE__ */ n.jsx("div", { className: j("luminus-backdrop", Wn.backdrop, {
3071
- [Wn.show]: t
3072
- }), onClick: () => e && e() }), Er = ({ src: t, alt: e, baseUrl: s, customToken: r, placeholder: o, ...a }) => /* @__PURE__ */ n.jsx("img", { ...a, alt: e ?? "", src: t ?? o }), Kc = ({ show: t, onClose: e, photos: s, defaultIndex: r, uploadPhotosText: o, noPhotosText: a, onUploadPhotos: l, photoActions: i, baseUrl: c, customToken: d, placeholder: u, ImgComponent: m = Er }) => {
3073
- const h = Y(null), [g, x] = I(r), y = s.at(g), p = g > 0, w = g < s.length - 1;
3074
- O(() => {
3075
- t && x(r);
3076
- }, [r, t]), O(() => {
3077
- g >= s.length && x(s.length - 1);
3078
- }, [s, g]);
3079
- const N = $((f) => {
3080
- switch (f.key) {
3081
- case "ArrowLeft":
3082
- f.stopPropagation(), p && x((k) => k - 1);
3083
- break;
3084
- case "ArrowRight":
3085
- f.stopPropagation(), w && x((k) => k + 1);
3086
- break;
3087
- case "Escape":
3088
- f.stopPropagation(), e();
3089
- break;
3043
+ e[s] = t[s].value;
3044
+ }), e;
3045
+ }, Un = (t, e) => {
3046
+ const s = {};
3047
+ return Object.keys(t).forEach((r) => {
3048
+ var l;
3049
+ const o = t[r], a = (l = e.columns) == null ? void 0 : l.find((i) => i.field === r);
3050
+ if ((a == null ? void 0 : a.type) === "BIT" && (o === 1 || o === 0)) {
3051
+ s[r] = { value: o === 1, defaultValue: o === 1 };
3052
+ return;
3090
3053
  }
3091
- }, [w, p, e]);
3092
- return js(N), /* @__PURE__ */ n.jsxs(Wt, { children: [
3093
- /* @__PURE__ */ n.jsx(Fr, { show: t, onClick: e }),
3094
- /* @__PURE__ */ n.jsxs("div", { ref: h, className: j("luminus-lightbox rounded shadow", ge.lightbox, {
3095
- [ge.show]: t
3096
- }), children: [
3097
- /* @__PURE__ */ n.jsxs("div", { className: ge.header, children: [
3098
- /* @__PURE__ */ n.jsxs("div", { className: j("rounded", ge.photoActions), children: [
3099
- l && /* @__PURE__ */ n.jsx(wr, { accept: ".jpg,.jpeg,.png", onUpload: (f) => {
3100
- f.length > 0 && l(Array.from(f));
3101
- }, icon: /* @__PURE__ */ n.jsx(ds, { style: { fontSize: 18 } }), multiple: !0, className: "me-3", children: o ?? null }),
3102
- y && (i == null ? void 0 : i.map(({ label: f, onClick: k, ...v }, C) => /* @__PURE__ */ n.jsx(
3103
- jt,
3104
- {
3105
- onClick: () => k(y.id),
3106
- ...v,
3107
- children: f
3108
- },
3109
- `action-${C}`
3110
- )))
3111
- ] }),
3112
- /* @__PURE__ */ n.jsx("div", { role: "button", onClick: e, children: /* @__PURE__ */ n.jsx(we, { style: { fontSize: "32px" } }) })
3113
- ] }),
3114
- s.length === 0 && /* @__PURE__ */ n.jsx("div", { className: "w-100 h-100 d-flex align-items-center justify-content-center", children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: a ?? "No photos available" }) }),
3115
- y && /* @__PURE__ */ n.jsxs("div", { className: ge.photoContainer, children: [
3116
- /* @__PURE__ */ n.jsx("div", { role: p ? "button" : void 0, className: j("align-items-start", ge.navButton), onClick: () => p && x((f) => f - 1), children: p && /* @__PURE__ */ n.jsx(Ut, { style: { fontSize: "40px" } }) }),
3117
- /* @__PURE__ */ n.jsx(m, { src: y.lgSrc, alt: y.alt, className: j("rounded", ge.photo), baseUrl: c, customToken: d, placeholder: u }),
3118
- /* @__PURE__ */ n.jsx("div", { role: w ? "button" : void 0, className: j("align-items-end", ge.navButton), onClick: () => w && x((f) => f + 1), children: w && /* @__PURE__ */ n.jsx(Gt, { style: { fontSize: "40px" } }) })
3054
+ s[r] = { value: o, defaultValue: o };
3055
+ }), s;
3056
+ }, mi = "_table_1klfy_1", pi = "_table-header_1klfy_10", hi = "_table-row_1klfy_10", gi = "_table-head_1klfy_10", xi = "_filters-row_1klfy_19", ji = "_table-body_1klfy_30", yi = "_table-cell_1klfy_30", wi = "_action-column_1klfy_43", vi = "_sticky-top_1klfy_47", bi = "_sticky-first_1klfy_54", _i = "_sticky-last_1klfy_61", Ni = "_sticky-bottom_1klfy_68", J = {
3057
+ table: mi,
3058
+ "table-header": "_table-header_1klfy_10",
3059
+ tableHeader: pi,
3060
+ "table-row": "_table-row_1klfy_10",
3061
+ tableRow: hi,
3062
+ "table-head": "_table-head_1klfy_10",
3063
+ tableHead: gi,
3064
+ "filters-row": "_filters-row_1klfy_19",
3065
+ filtersRow: xi,
3066
+ "table-body": "_table-body_1klfy_30",
3067
+ tableBody: ji,
3068
+ "table-cell": "_table-cell_1klfy_30",
3069
+ tableCell: yi,
3070
+ "action-column": "_action-column_1klfy_43",
3071
+ actionColumn: wi,
3072
+ "sticky-top": "_sticky-top_1klfy_47",
3073
+ stickyTop: vi,
3074
+ "sticky-first": "_sticky-first_1klfy_54",
3075
+ stickyFirst: bi,
3076
+ "sticky-last": "_sticky-last_1klfy_61",
3077
+ stickyLast: _i,
3078
+ "sticky-bottom": "_sticky-bottom_1klfy_68",
3079
+ stickyBottom: Ni
3080
+ }, ki = "_input_13mhy_1", Ae = {
3081
+ input: ki
3082
+ }, Mr = ({ type: t, value: e, field: s, isPrimary: r, isReadonly: o, primaryEditable: a = !1, valuesForSelect: l, onChangeHandler: i, hideClearIcon: c, clearValue: d }) => {
3083
+ switch (t) {
3084
+ case "NUM":
3085
+ return l && l.length > 0 ? /* @__PURE__ */ n.jsx(yt, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, u === null ? null : Number(u)), options: l, disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d }) : /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "number", value: e === null ? null : Number(e), onChange: (u) => i(s, u === null ? null : Number(u)), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3086
+ case "STR":
3087
+ return l && l.length > 0 ? /* @__PURE__ */ n.jsx(yt, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), options: l, disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d }) : /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "text", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3088
+ case "BIT":
3089
+ return /* @__PURE__ */ n.jsx(Or, { InputContainer: ye, className: Ae.input, value: e === !0, onChange: (u) => i(s, u), disabled: o || a ? !1 : r });
3090
+ case "DT":
3091
+ return /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "date", value: e ? e.toString().split("T")[0] ?? "" : "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3092
+ default:
3093
+ return /* @__PURE__ */ n.jsx("div", { className: "alert alert-warning p-1 m-0", children: /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3094
+ "Neznámý typ ",
3095
+ t
3096
+ ] }) });
3097
+ }
3098
+ }, Ci = ({ schema: t, columns: e, initialItem: s, onEdit: r, onDelete: o }) => {
3099
+ const { ProjectIconComponent: a } = B(ue), [l, i] = I(s), c = $((m, h) => {
3100
+ console.log("changeValue", m, h), i((g) => ({
3101
+ ...g,
3102
+ [m]: {
3103
+ ...g[m],
3104
+ value: h
3105
+ }
3106
+ }));
3107
+ }, []), d = (m) => (m == null ? void 0 : m.value) !== (m == null ? void 0 : m.defaultValue), u = $(() => Object.keys(l).some((m) => d(l[m])), [l]);
3108
+ return O(() => {
3109
+ i(s);
3110
+ }, [s]), /* @__PURE__ */ n.jsxs("tr", { className: j("table-row", J.tableRow), children: [
3111
+ /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell, J.stickyFirst), children: u() && /* @__PURE__ */ n.jsx(U, { color: "success", onClick: () => r(Tr(l)), children: /* @__PURE__ */ n.jsx(a, { icon: "check" }) }) }),
3112
+ e.map((m) => {
3113
+ var h, g;
3114
+ return /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell), children: /* @__PURE__ */ n.jsx(Mr, { type: m.type, value: (h = l[m.field ?? ""]) == null ? void 0 : h.value, field: m.field, isReadonly: m.readOnly, isPrimary: t.primaryKey === m.field, valuesForSelect: m.valuesForSelect, onChangeHandler: c, hideClearIcon: !d(l[m.field ?? ""]), clearValue: (g = l[m.field ?? ""].defaultValue) == null ? void 0 : g.toString() }) }, `${t.id}-${m.field}`);
3115
+ }),
3116
+ /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell, J.stickyLast), children: /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => o(l[t.primaryKey ?? ""].value), children: /* @__PURE__ */ n.jsx(a, { icon: "delete" }) }) })
3117
+ ] });
3118
+ }, $i = ({ schema: t, columns: e, onCreate: s }) => {
3119
+ const { ProjectIconComponent: r } = B(ue), [o, a] = I(null), l = $(() => {
3120
+ var d;
3121
+ const c = {};
3122
+ (d = t.columns) == null || d.forEach((u) => {
3123
+ const m = u.type === "BIT" ? !1 : u.type === "NUM" ? 0 : u.type === "STR" ? "" : null;
3124
+ c[u.field ?? ""] = {
3125
+ value: m,
3126
+ defaultValue: m
3127
+ };
3128
+ }), a(c);
3129
+ }, [t]), i = $((c, d) => {
3130
+ a((u) => u && {
3131
+ ...u,
3132
+ [c]: {
3133
+ ...u[c],
3134
+ value: d
3135
+ }
3136
+ });
3137
+ }, []);
3138
+ return o ? /* @__PURE__ */ n.jsxs("tr", { className: "sticky-bottom shadow", children: [
3139
+ /* @__PURE__ */ n.jsx("td", { className: "sticky-first", children: /* @__PURE__ */ n.jsx(U, { color: "success", onClick: async () => {
3140
+ const c = Tr(o);
3141
+ c && await s(c) && a(null);
3142
+ }, children: /* @__PURE__ */ n.jsx(r, { icon: "check" }) }) }),
3143
+ e.map((c) => /* @__PURE__ */ n.jsx("td", { children: /* @__PURE__ */ n.jsx(Mr, { type: c.type, value: o[c.field ?? ""].value, field: c.field, isReadonly: c.readOnly, isPrimary: t.primaryKey === c.field, valuesForSelect: c.valuesForSelect, onChangeHandler: i, primaryEditable: !0 }) }, `${t.id}-${c.field}`)),
3144
+ /* @__PURE__ */ n.jsx("td", { className: "sticky-last", children: /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => a(null), children: /* @__PURE__ */ n.jsx(r, { icon: "cancel" }) }) })
3145
+ ] }) : /* @__PURE__ */ n.jsxs("tr", { className: "sticky-bottom shadow", children: [
3146
+ /* @__PURE__ */ n.jsx("td", { className: "sticky-first", children: /* @__PURE__ */ n.jsx(U, { onClick: l, children: /* @__PURE__ */ n.jsx(r, { icon: "add" }) }) }),
3147
+ /* @__PURE__ */ n.jsx("td", { colSpan: e.length + 1 })
3148
+ ] });
3149
+ }, Si = ({ column: t, children: e }) => t.description ? /* @__PURE__ */ n.jsx(Kt, { placement: "bottom", text: t.description ?? "", children: /* @__PURE__ */ n.jsx("div", { children: e }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: e }), Ii = ({ schema: t, items: e, onEditItem: s, onDeleteItem: r, onCreateItem: o, filters: a, setFilter: l, sortByField: i, sortByType: c, setSortBy: d }) => {
3150
+ const { texts: { dynamicForms: u }, ProjectIconComponent: m } = B(ue), [h, g] = I([]);
3151
+ return O(() => {
3152
+ var x, y, p;
3153
+ g([
3154
+ ...((p = (y = (x = t.columns) == null ? void 0 : x.filter((w) => !w.hidden)) == null ? void 0 : y.filter((w) => t.masterReference ? w.field !== t.masterReferenceColumn : !0)) == null ? void 0 : p.map((w) => ({
3155
+ label: w.caption ?? "",
3156
+ description: w.description ?? null,
3157
+ field: w.field ?? "",
3158
+ type: w.type,
3159
+ readOnly: w.readOnly,
3160
+ valuesForSelect: w.values ?? void 0
3161
+ }))) ?? []
3162
+ ]);
3163
+ }, [t]), /* @__PURE__ */ n.jsxs("table", { id: `dynamic-table-${t.id}`, className: j("table table-borderless luminus-df-table", J.table), children: [
3164
+ /* @__PURE__ */ n.jsxs("thead", { className: j("text-nowrap table-header", J.stickyTop, J.tableHeader), children: [
3165
+ /* @__PURE__ */ n.jsxs("tr", { className: j("table-row", J.tableRow), children: [
3166
+ /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyFirst) }),
3167
+ h.map((x) => /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead), onClick: () => {
3168
+ const y = i === x.field ? c : null;
3169
+ if (y === "asc") {
3170
+ d(x.field, "desc");
3171
+ return;
3172
+ }
3173
+ if (y === "desc") {
3174
+ d(x.field, null);
3175
+ return;
3176
+ }
3177
+ d(x.field, "asc");
3178
+ }, children: /* @__PURE__ */ n.jsx(Si, { column: x, children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
3179
+ x.label,
3180
+ i === x.field && /* @__PURE__ */ n.jsx(m, { icon: c === "asc" ? "chevron-up" : "chevron-down" })
3181
+ ] }) }) }, `${t.id}-${x.field}`)),
3182
+ /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyLast) })
3119
3183
  ] }),
3120
- /* @__PURE__ */ n.jsx("div", { className: ge.photosPreview, children: s.map((f, k) => /* @__PURE__ */ n.jsxs("div", { role: "button", onClick: () => x(k), className: "position-relative", children: [
3121
- /* @__PURE__ */ n.jsx(m, { role: k !== g ? "button" : void 0, src: f.smSrc, alt: f.alt, className: j("rounded", ge.photo, {
3122
- [ge.selected]: k === g
3123
- }), baseUrl: c, customToken: d, placeholder: u }, f.id),
3124
- f.isDefault && /* @__PURE__ */ n.jsx("div", { className: j("text-primary", ge.defaultIndicator), children: /* @__PURE__ */ n.jsx(xo, {}) })
3125
- ] })) })
3184
+ /* @__PURE__ */ n.jsxs("tr", { className: j("table-row filters-row", J.tableRow, J.filtersRow), children: [
3185
+ /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyFirst) }),
3186
+ h.map((x) => /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead), children: x.valuesForSelect && x.valuesForSelect.length > 0 || x.type === "BIT" ? /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx(yt, { InputContainer: ye, withoutLabel: !0, size: "sm", value: a[x.field] ?? "", onChange: (y) => l(x.field, (y == null ? void 0 : y.toString()) ?? null), options: x.type === "BIT" ? [
3187
+ { id: 1, name: u.yes },
3188
+ { id: 0, name: u.no }
3189
+ ] : x.valuesForSelect ?? [], isNumber: x.type === "BIT", showClearIcon: !0 }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx(Pe, { InputContainer: ye, withoutLabel: !0, size: "sm", type: x.type === "NUM" ? "number" : x.type === "DT" ? "date" : "text", value: a[x.field] ?? "", onChange: (y) => l(x.field, (y == null ? void 0 : y.toString()) ?? null) }) }) }, `${t.id}-${x.field}`)),
3190
+ /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyLast) })
3191
+ ] })
3192
+ ] }),
3193
+ /* @__PURE__ */ n.jsxs("tbody", { className: j("table-body", J.tableBody), children: [
3194
+ e.filter((x) => x[t.primaryKey ?? ""]).map((x) => /* @__PURE__ */ n.jsx(Ci, { schema: t, columns: h, initialItem: x, onEdit: s, onDelete: r }, `${t.id}-${x[t.primaryKey ?? ""].value}`)),
3195
+ /* @__PURE__ */ n.jsx($i, { schema: t, columns: h, onCreate: o })
3126
3196
  ] })
3127
3197
  ] });
3128
- }, qc = ({ photos: t, onUploadPhotos: e, uploadPhotosText: s, photoActions: r, baseUrl: o, customToken: a, placeholder: l, ImgComponent: i = Er }) => {
3129
- const [c, d] = I(null), u = c !== null ? t[c] : null, [m, h] = I(!1);
3130
- return O(() => {
3131
- if (t.length === 0) {
3132
- d(null), h(!1);
3198
+ }, Di = ({ master: t, onChange: e, options: s, label: r }) => /* @__PURE__ */ n.jsx(yt, { label: r, value: t, onChange: (o) => e(o ? o.toString() : null), options: s, size: "sm" }), Fi = "_pagination_gujwe_1", Gn = {
3199
+ pagination: Fi
3200
+ }, Yn = {
3201
+ appDetail: "/settings/:id"
3202
+ }, Be = {
3203
+ apiSchemaGet: "/dynamicForms/schema",
3204
+ apiDataGet: "/dynamicForms/data",
3205
+ apiItemPost: "/dynamicForms/update",
3206
+ apiItemDelete: "/dynamicForms/delete",
3207
+ apiItemCreate: "/dynamicForms/insert"
3208
+ }, xd = ({ id: t, page: e, setPage: s, filters: r, setFilter: o, sortByField: a, sortByType: l, setSortBy: i, appUrls: { appDetail: c = Yn.appDetail } = Yn, apiUrls: { apiSchemaGet: d = Be.apiSchemaGet, apiDataGet: u = Be.apiDataGet, apiItemPost: m = Be.apiItemPost, apiItemDelete: h = Be.apiItemDelete, apiItemCreate: g = Be.apiItemCreate } = Be }) => {
3209
+ var cn, dn, un, fn, mn, pn;
3210
+ const { texts: { dynamicForms: x }, ProjectIconComponent: y } = B(ue), p = st(), { startLoading: w, stopLoading: N } = B(fs), [f, k] = I(null), [v, C] = I(null), [_, E] = I(null), [S, F] = I(null), [b, D] = I(!1), { addNotification: R } = No(), [H, Q] = I([]), { confirm: X } = Uo(), L = 20, Z = L + 1, ee = S ? Math.ceil(S.length / L) : 1, te = e ? e > 1 : !1, T = e ? e < ee : !1, re = e ? (e - 1) * L : 0, de = e ? e * L : L, [pe, le] = I(!1), xe = pe ? S == null ? void 0 : S.slice(re, de) : S, [W, A] = I(null);
3211
+ O(() => {
3212
+ k(null), C(null), D(!1), Q([]), A(null);
3213
+ }, [t]);
3214
+ const ne = $(async () => {
3215
+ w("dynamicFormSchema"), await p.get(`${d}?id=${t}`).then(({ data: P }) => {
3216
+ k(P), N("dynamicFormSchema");
3217
+ }).catch(() => N("dynamicFormSchema"));
3218
+ }, [p, t, w, N, d]), me = $(async () => {
3219
+ var P;
3220
+ if (!(f === null || ((P = f.id) == null ? void 0 : P.toString()) !== t)) {
3221
+ if (f.masterReference && !W) {
3222
+ C([]);
3223
+ return;
3224
+ }
3225
+ w("dynamicFormData"), await p.get(`${u}?id=${t}&showArchive=${b}${f.masterReference ? `&master=${W}` : ""}`).then(({ data: K }) => {
3226
+ const se = K.map((G) => {
3227
+ var oe;
3228
+ return Object.fromEntries(((oe = f.columns) == null ? void 0 : oe.filter((ie) => ie.field).map((ie) => [
3229
+ ie.field,
3230
+ { value: G[ie.field ?? ""], defaultValue: G[ie.field ?? ""] }
3231
+ ])) ?? []);
3232
+ });
3233
+ C(se), N("dynamicFormData");
3234
+ }).catch(() => N("dynamicFormData"));
3235
+ }
3236
+ }, [p, t, f, w, N, b, W, u]), We = $(async (P) => (w("dynamicFormEdit"), p.post(`${m}?id=${t}`, P).then(() => (N("dynamicFormEdit"), Q([]), !0)).catch((K) => (N("dynamicFormEdit"), Q(Ct(K)), !1))), [p, t, w, N, m]), ze = $(async (P) => (w("dynamicFormDelete"), p.delete(`${h}?id=${t}&pk=${P}`).then(() => (N("dynamicFormDelete"), Q([]), !0)).catch((K) => (N("dynamicFormDelete"), Q(Ct(K)), !1))), [p, t, w, N, h]), Ve = $(async (P) => (w("dynamicFormCreate"), p.post(`${g}?id=${t}`, P).then(({ data: K }) => (N("dynamicFormCreate"), Q([]), K)).catch((K) => (N("dynamicFormCreate"), Q(Ct(K)), null))), [p, t, w, N, g]), Lr = $(async (P) => {
3237
+ f && await We(f.masterReference ? { ...P, [f.masterReferenceColumn ?? ""]: W } : P) && (R(x.editSuccess, "success"), C((K) => K && K.map((se) => {
3238
+ var G;
3239
+ return ((G = se[(f == null ? void 0 : f.primaryKey) ?? ""]) == null ? void 0 : G.value) === P[(f == null ? void 0 : f.primaryKey) ?? ""] ? Un(P, f) : se;
3240
+ })));
3241
+ }, [R, We, f, W, x]), Rr = $(async (P) => {
3242
+ await X(x.deleteConfirm) && await ze(P) && (R(x.deleteSuccess, "success"), C((K) => K && K.filter((se) => {
3243
+ var G;
3244
+ return ((G = se[(f == null ? void 0 : f.primaryKey) ?? ""]) == null ? void 0 : G.value) !== P;
3245
+ })));
3246
+ }, [R, ze, x, X, f]), Ar = $(async (P) => {
3247
+ if (!f)
3248
+ return !1;
3249
+ const K = await Ve(f.masterReference ? { ...P, [f.masterReferenceColumn ?? ""]: W } : P);
3250
+ if (K !== null) {
3251
+ R(x.createSuccess, "success");
3252
+ const se = Un(P, f);
3253
+ return se[(f == null ? void 0 : f.primaryKey) ?? ""] = { value: K, defaultValue: K }, C((G) => [...G ?? [], se]), !0;
3254
+ }
3255
+ return !1;
3256
+ }, [R, Ve, x, f, W]), at = (P) => {
3257
+ P > ee ? s(ee) : P < 1 && s(1), s(P);
3258
+ }, an = $(() => {
3259
+ if (!v || !f) {
3260
+ E(null);
3133
3261
  return;
3134
3262
  }
3135
- const g = t.findIndex((x) => x.isDefault);
3136
- d(g > -1 ? g : 0);
3137
- }, [t]), u ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3138
- /* @__PURE__ */ n.jsx(i, { role: "button", src: u.smSrc, alt: u.alt, className: "rounded w-100", onClick: () => h(!0), baseUrl: o, customToken: a, placeholder: l }),
3139
- /* @__PURE__ */ n.jsx(Kc, { show: m, onClose: () => h(!1), photos: t, defaultIndex: c ?? 0, uploadPhotosText: s, onUploadPhotos: e, photoActions: r, baseUrl: o, customToken: a, placeholder: l, ImgComponent: i })
3140
- ] }) : e ? /* @__PURE__ */ n.jsx(wr, { accept: ".jpg,.jpeg,.png", onUpload: (g) => {
3141
- g.length > 0 && e(Array.from(g));
3142
- }, icon: /* @__PURE__ */ n.jsx(ds, { style: { fontSize: 18 } }), multiple: !0, children: s ?? null }) : null;
3143
- }, Nd = ({ children: t }) => {
3144
- var i, c, d;
3145
- const { useMsal: e, msalScopes: s } = B(jo), { isAuthenticated: r } = yo(), { userLoginState: o } = B(us), a = o.state === wo.LOGGING_IN, l = o.user && ((i = o.user) == null ? void 0 : i.permissions) && ((d = (c = o.user) == null ? void 0 : c.permissions) == null ? void 0 : d.length) > 0;
3146
- return e ? /* @__PURE__ */ n.jsx(Bo, { interactionType: Ao.Redirect, authenticationRequest: { scopes: s }, children: a || !r() ? /* @__PURE__ */ n.jsx(yn, {}) : o.user ? l ? /* @__PURE__ */ n.jsx(n.Fragment, { children: t }) : /* @__PURE__ */ n.jsx(it, { to: "/user-not-permitted", replace: !0 }) : /* @__PURE__ */ n.jsx(it, { to: "/no-user-login", replace: !0 }) }) : a ? /* @__PURE__ */ n.jsx(yn, {}) : !r() || !o.user ? /* @__PURE__ */ n.jsx(it, { to: "/login", replace: !0 }) : l ? t : /* @__PURE__ */ n.jsx(it, { to: "/user-not-permitted", replace: !0 });
3147
- }, Or = (t) => {
3148
- const { variant: e, children: s, className: r, size: o = "md", typographyVariant: a = o === "sm" ? "body2" : "body", ...l } = { ...t };
3149
- return /* @__PURE__ */ n.jsx(ua, { variant: e, className: `text-center ${o === "sm" ? "p-1" : o === "md" ? "p-3" : "p-4"} bg-${e} bg-opacity-10 border-none ${r ?? ""}`, ...l, children: /* @__PURE__ */ n.jsx(V, { variant: a, children: s }) });
3150
- }, Qc = "_item_1lf6j_1", Zc = "_level-success_1lf6j_4", Jc = "_level-info_1lf6j_10", Xc = "_level-warning_1lf6j_16", ei = "_level-danger_1lf6j_22", ti = "_type-icon_1lf6j_28", Tt = {
3151
- item: Qc,
3152
- "level-success": "_level-success_1lf6j_4",
3153
- levelSuccess: Zc,
3154
- "level-info": "_level-info_1lf6j_10",
3155
- levelInfo: Jc,
3156
- "level-warning": "_level-warning_1lf6j_16",
3157
- levelWarning: Xc,
3158
- "level-danger": "_level-danger_1lf6j_22",
3159
- levelDanger: ei,
3160
- "type-icon": "_type-icon_1lf6j_28",
3161
- typeIcon: ti
3162
- }, ni = ({ level: t, children: e, customIcon: s, noIcon: r }) => {
3163
- const { ProjectIconComponent: o } = B(ue), a = $(() => {
3164
- switch (t) {
3165
- case "info":
3166
- return /* @__PURE__ */ n.jsx(o, { icon: "info" });
3167
- case "warning":
3168
- return /* @__PURE__ */ n.jsx(o, { icon: "warning" });
3169
- case "danger":
3170
- return /* @__PURE__ */ n.jsx(o, { icon: "danger" });
3171
- default:
3172
- return /* @__PURE__ */ n.jsx(o, { icon: "check" });
3173
- }
3174
- }, [o, t]);
3175
- return /* @__PURE__ */ n.jsxs("div", { className: j("p-2 rounded d-flex gap-1 align-items-center justify-content-between", { "ps-1": !r }, Tt.item, Tt[`level-${t}`]), children: [
3176
- !r && /* @__PURE__ */ n.jsx("div", { className: j(Tt.typeIcon), children: s ?? a() }),
3177
- /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "w-100", children: e })
3178
- ] });
3179
- }, kd = ({ version: t }) => /* @__PURE__ */ n.jsx("div", { className: "rounded", style: {
3180
- position: "fixed",
3181
- right: "0px",
3182
- bottom: "0px",
3183
- zIndex: "10000",
3184
- backgroundColor: "rgba(255, 255, 255, 0.5)",
3185
- padding: "4px",
3186
- pointerEvents: "all"
3187
- }, children: /* @__PURE__ */ n.jsxs(V, { variant: "caption", className: "w-100 text-end", children: [
3188
- "verze ",
3189
- t
3190
- ] }) }), si = "_submit-container_a9slg_1", ri = "_spacer_a9slg_14", zn = {
3191
- "submit-container": "_submit-container_a9slg_1",
3192
- submitContainer: si,
3193
- spacer: ri
3194
- }, oi = ({ children: t, noSpacer: e = !1 }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3195
- !e && /* @__PURE__ */ n.jsx("div", { className: zn.spacer }),
3196
- /* @__PURE__ */ n.jsx("div", { className: j("luminus-floating-action-container shadow", zn.submitContainer), children: t })
3197
- ] }), ai = "_timeline_g1754_1", li = "_step-container_g1754_1", ci = "_step-date_g1754_1", ii = "_step-content_g1754_4", di = "_content-header_g1754_8", ui = "_content-text_g1754_11", fi = "_step-icon_g1754_14", Me = {
3198
- timeline: ai,
3199
- "step-container": "_step-container_g1754_1",
3200
- stepContainer: li,
3201
- "step-date": "_step-date_g1754_1",
3202
- stepDate: ci,
3203
- "step-content": "_step-content_g1754_4",
3204
- stepContent: ii,
3205
- "content-header": "_content-header_g1754_8",
3206
- contentHeader: di,
3207
- "content-text": "_content-text_g1754_11",
3208
- contentText: ui,
3209
- "step-icon": "_step-icon_g1754_14",
3210
- stepIcon: fi
3211
- }, Cd = ({ steps: t }) => /* @__PURE__ */ n.jsx("div", { className: Me.timeline, children: t.sort((e, s) => Ko(e.date ?? /* @__PURE__ */ new Date(), s.date ?? /* @__PURE__ */ new Date())).map((e, s) => /* @__PURE__ */ n.jsxs("div", { className: j("row g-0 gx-3", Me.stepContainer), children: [
3212
- /* @__PURE__ */ n.jsx("div", { className: "col-3", children: e.date && /* @__PURE__ */ n.jsxs(V, { variant: "caption", className: j("h-100 d-flex flex-column align-items-end justify-content-center gap-0", Me.stepDate), children: [
3213
- /* @__PURE__ */ n.jsx("div", { children: Xe(e.date, "dd.MM.yyyy") }),
3214
- /* @__PURE__ */ n.jsx("div", { children: Xe(e.date, "HH:mm") })
3215
- ] }) }),
3216
- /* @__PURE__ */ n.jsx("div", { className: "col-9", children: /* @__PURE__ */ n.jsxs("div", { className: j("h-100 d-flex flex-column gap-1 border-start border-2 p-3", Me.stepContent), children: [
3217
- /* @__PURE__ */ n.jsxs("div", { className: j("d-flex gap-2 align-items-center", Me.contentHeader), children: [
3218
- e.person && /* @__PURE__ */ n.jsx(ls, { name: e.person.name ?? "", size: 22, fontSize: 12 }),
3219
- typeof e.title == "string" ? /* @__PURE__ */ n.jsx(V, { variant: "body", className: "fw-bold", children: e.title }) : e.title
3220
- ] }),
3221
- e.text && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: Me.contentText, children: e.text }),
3222
- /* @__PURE__ */ n.jsx("div", { className: j("text-primary", Me.stepIcon), children: e.icon ?? /* @__PURE__ */ n.jsx(vo, {}) })
3223
- ] }) })
3224
- ] }, s)) }), mi = (t, e, s, r = !0) => {
3225
- const o = st({ silent: r, differentBaseUrl: e, customToken: s }), [a, l] = I(!1), [i, c] = I(null), d = $(async (u) => {
3226
- l(!0), c(null), o.get(t, {
3227
- signal: u,
3228
- responseType: "blob"
3229
- }).then((m) => {
3230
- l(!1), c(m.data);
3231
- }).catch(() => {
3232
- l(!1), c(null);
3233
- });
3234
- }, [o, t]);
3235
- return O(() => {
3236
- const u = new AbortController();
3237
- return d(u.signal), () => {
3238
- u.abort();
3239
- };
3240
- }, [d]), { data: i, setData: c, reloadData: d, isLoading: a };
3241
- }, Vn = ({ src: t, alt: e, baseUrl: s, customToken: r, placeholder: o, ...a }) => {
3242
- const { data: l } = mi(t, s, r), [i, c] = I(null);
3243
- return O(() => {
3244
- let d = null;
3245
- return l !== null ? (d = URL.createObjectURL(l), c(d)) : c(null), () => {
3246
- d !== null && URL.revokeObjectURL(d);
3247
- };
3248
- }, [l]), i === null && !o ? null : /* @__PURE__ */ n.jsx("img", { ...a, alt: e ?? "", src: i ?? o });
3249
- }, Un = [
3250
- ["D", "day"],
3251
- // ['W', 'week'],
3252
- ["M", "month"],
3253
- ["Y", "year"],
3254
- ["C", "custom"]
3255
- ], pi = "_wrapper_qfqux_1", hi = "_lg_qfqux_7", gi = "_sm_qfqux_11", xi = "_md_qfqux_14", Gn = {
3256
- wrapper: pi,
3257
- lg: hi,
3258
- sm: gi,
3259
- md: xi
3260
- }, mt = (t) => {
3261
- const e = new Date(t), s = De(e.toISOString());
3262
- e.setMonth(e.getMonth() + 1), e.setDate(e.getDate() - 1);
3263
- const r = De(e.toISOString());
3264
- return { from: s, to: r };
3265
- }, Ze = (t) => {
3266
- const e = new Date(t), s = De(e.toISOString());
3267
- e.setFullYear(e.getFullYear() + 1), e.setDate(e.getDate() - 1);
3268
- const r = De(e.toISOString());
3269
- return { from: s, to: r };
3270
- }, ji = (t, e) => {
3271
- if (t === null || e === null)
3272
- return "C";
3273
- if (t === e)
3274
- return "D";
3275
- const s = new Date(t);
3276
- return mt(s).to === e ? "M" : Ze(s).to === e ? "Y" : (console.log(Ze(s), e), "C");
3277
- }, yi = (t, e, s) => {
3278
- const r = $((l, i) => {
3279
- if (t === "C") {
3280
- s((c) => ({ ...c, [l]: i }));
3263
+ const P = v.filter((K) => Object.entries(r).every(([se, G]) => {
3264
+ var Ye, Ke, qe;
3265
+ if (G === null)
3266
+ return !0;
3267
+ const oe = (Ye = K[se]) == null ? void 0 : Ye.value;
3268
+ if (oe == null)
3269
+ return !1;
3270
+ const ie = (Ke = f.columns) == null ? void 0 : Ke.find((lt) => lt.field === se), Ue = ie == null ? void 0 : ie.type, Ge = (ie == null ? void 0 : ie.values) && ((qe = ie == null ? void 0 : ie.values) == null ? void 0 : qe.length) > 0;
3271
+ if (!Ue)
3272
+ return !1;
3273
+ switch (Ue) {
3274
+ case "STR":
3275
+ return Ge ? oe === G : oe.toString().toLowerCase().includes(G.toLowerCase());
3276
+ case "NUM":
3277
+ return Ge ? Number(oe) === Number(G) : oe.toString().toLowerCase().includes(G.toLowerCase());
3278
+ case "DT":
3279
+ return oe.toString().toLowerCase().includes(G.toLowerCase());
3280
+ case "BIT":
3281
+ return Number(oe) === Number(G);
3282
+ default:
3283
+ return oe.toString().toLowerCase().includes(G.toLowerCase());
3284
+ }
3285
+ }));
3286
+ E(P);
3287
+ }, [v, r, f]), ln = $(() => {
3288
+ if (!_ || !f) {
3289
+ F([]);
3281
3290
  return;
3282
3291
  }
3283
- switch (l) {
3284
- case "from":
3285
- s((c) => {
3286
- if (i === null)
3287
- return c;
3288
- const d = new Date(i);
3289
- if (t === "D") {
3290
- const u = De(d.toISOString());
3291
- return {
3292
- from: u,
3293
- to: u
3294
- };
3295
- }
3296
- return t === "M" ? mt(d) : t === "Y" ? Ze(d) : c;
3297
- });
3298
- break;
3299
- case "to":
3300
- e("C"), s((c) => ({ ...c, [l]: i }));
3301
- break;
3292
+ if (!a) {
3293
+ F(_);
3294
+ return;
3302
3295
  }
3303
- }, [t, s, e]), o = $((l) => {
3304
- s((i) => {
3305
- if (i.from === null || i.to === null)
3306
- return i;
3307
- const c = new Date(i.from);
3308
- c.setHours(c.getHours() - c.getTimezoneOffset() / 60);
3309
- const d = new Date(i.to);
3310
- if (t === "D") {
3311
- c.setDate(c.getDate() + l);
3312
- const u = De(c.toISOString());
3313
- return {
3314
- from: u,
3315
- to: u
3316
- };
3296
+ F([..._].sort((P, K) => {
3297
+ var Ue, Ge, Ye, Ke, qe, lt;
3298
+ const se = ((Ge = (Ue = P[a]) == null ? void 0 : Ue.value) == null ? void 0 : Ge.toString()) ?? "", G = ((Ke = (Ye = K[a]) == null ? void 0 : Ye.value) == null ? void 0 : Ke.toString()) ?? "", oe = f.columns.find((je) => je.field === a), ie = oe == null ? void 0 : oe.type;
3299
+ if (!oe || !ie || !se && !G)
3300
+ return 0;
3301
+ if (!se)
3302
+ return 1;
3303
+ if (!G)
3304
+ return -1;
3305
+ if (oe.values && oe.values.length > 0) {
3306
+ const je = ((qe = oe.values.find((Nt) => Nt.id.toString() === se)) == null ? void 0 : qe.name) ?? "", Ce = ((lt = oe.values.find((Nt) => Nt.id.toString() === G)) == null ? void 0 : lt.name) ?? "";
3307
+ return l === "asc" ? je.localeCompare(Ce) : Ce.localeCompare(je);
3317
3308
  }
3318
- return t === "M" ? (c.setMonth(c.getMonth() + l), mt(c)) : t === "Y" ? (c.setFullYear(c.getFullYear() + l), Ze(c)) : {
3319
- from: De(c.toISOString()),
3320
- to: De(d.toISOString())
3321
- };
3322
- });
3323
- }, [t, s]), a = $((l) => {
3324
- l === "D" ? s((i) => ({ from: i.from, to: i.from })) : l === "M" ? s((i) => {
3325
- if (i.from === null)
3326
- return i;
3327
- const c = Po(i.from);
3328
- return mt(c);
3329
- }) : l === "Y" && s((i) => {
3330
- if (i.from === null)
3331
- return i;
3332
- const c = Ho(new Date(i.from).getFullYear());
3333
- return Ze(c);
3334
- }), e(l);
3335
- }, [s, e]);
3336
- return { setFromToProp: r, handleArrowClick: o, handleRangeChange: a };
3337
- }, $d = ({ fromtoState: [t, e], className: s, size: r }) => {
3338
- const { texts: { date: o }, ProjectIconComponent: a } = B(ue), [l, i] = I("C"), { handleArrowClick: c, handleRangeChange: d, setFromToProp: u } = yi(l, i, e), m = q(() => l === "C", [l]), h = Y(!0);
3309
+ if (ie === "NUM") {
3310
+ const je = Number(se), Ce = Number(G);
3311
+ return l === "asc" ? je - Ce : Ce - je;
3312
+ }
3313
+ if (ie === "DT") {
3314
+ const je = et(se == null ? void 0 : se.toString()).getTime(), Ce = et(G == null ? void 0 : G.toString()).getTime();
3315
+ return l === "asc" ? je - Ce : Ce - je;
3316
+ }
3317
+ return l === "asc" ? se.toString().localeCompare(G.toString()) : G.toString().localeCompare(se.toString());
3318
+ }));
3319
+ }, [_, f, a, l]);
3339
3320
  return O(() => {
3340
- if (h.current) {
3341
- const g = ji(t.from, t.to);
3342
- i(g), h.current = !1;
3343
- }
3344
- }, [t.from, t.to]), /* @__PURE__ */ n.jsxs("div", { className: j("d-inline-flex align-items-center gap-1", Gn.wrapper, Gn[r ?? "md"], s), children: [
3345
- /* @__PURE__ */ n.jsx(U, { disabled: m, onClick: () => {
3346
- c(-1);
3347
- }, children: /* @__PURE__ */ n.jsx(a, { icon: "chevron-left" }) }),
3348
- /* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-center gap-1", children: [
3349
- /* @__PURE__ */ n.jsx(Pe, { type: "date", value: t.from, onChange: (g) => u("from", g === null ? null : g.toString()), InputContainer: ye, size: r }),
3350
- /* @__PURE__ */ n.jsx($r, { toggle: /* @__PURE__ */ n.jsx(Cr, { text: o[Un.find((g) => g[0] === l)[1]].substring(0, 1), as: bo }), children: Un.map((g) => /* @__PURE__ */ n.jsx(rn, { disabled: g[0] === l, className: j(g[0] === l ? "text-black-50" : ""), onClick: () => d(g[0]), role: "button", children: o[g[1]] }, g[0])) }),
3351
- /* @__PURE__ */ n.jsx(Pe, { type: "date", value: t.to, onChange: (g) => u("to", g === null ? null : g.toString()), InputContainer: ye, size: r })
3352
- ] }) }),
3353
- /* @__PURE__ */ n.jsx(U, { disabled: m, onClick: () => {
3354
- c(1);
3355
- }, children: /* @__PURE__ */ n.jsx(a, { icon: "chevron-right" }) })
3321
+ ne();
3322
+ }, [ne]), O(() => {
3323
+ me();
3324
+ }, [me]), O(() => {
3325
+ an();
3326
+ }, [an]), O(() => {
3327
+ ln();
3328
+ }, [ln]), O(() => {
3329
+ S && S.length > Z ? (le(!0), e || s(1)) : (le(!1), S && s(null));
3330
+ }, [S, s, e, Z]), O(() => {
3331
+ !pe || !e || (e > ee && s(ee), e < 1 && s(1));
3332
+ }, [e, pe, ee, s]), /* @__PURE__ */ n.jsxs("div", { className: "h-100 w-100 d-flex flex-column", children: [
3333
+ /* @__PURE__ */ n.jsxs("div", { className: "mb-3 d-flex justify-content-between align-items-center", children: [
3334
+ /* @__PURE__ */ n.jsx(V, { variant: "h3", children: (f == null ? void 0 : f.name) ?? "" }),
3335
+ /* @__PURE__ */ n.jsx(Or, { label: x.showArchived, value: b === !0, onChange: (P) => D(P) })
3336
+ ] }),
3337
+ (f == null ? void 0 : f.description) && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "mb-3", children: f == null ? void 0 : f.description }),
3338
+ (f == null ? void 0 : f.masterReference) && /* @__PURE__ */ n.jsx("div", { className: "mb-3 d-flex", children: /* @__PURE__ */ n.jsx(Di, { label: ((dn = (cn = f.columns) == null ? void 0 : cn.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : dn.caption) ?? "", options: ((fn = (un = f.columns) == null ? void 0 : un.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : fn.values) ?? [], master: W, onChange: (P) => A(P) }) }),
3339
+ (f == null ? void 0 : f.slaves) && f.slaves.length > 0 && /* @__PURE__ */ n.jsx("div", { className: "mb-3 d-flex align-items-center flex-start", children: f.slaves.map((P) => {
3340
+ var K;
3341
+ return /* @__PURE__ */ n.jsx(jt, { as: "link", href: `${Lt(c, { id: (K = P.id) == null ? void 0 : K.toString() })}?type=dynamic-form`, children: P.name }, P.id);
3342
+ }) }),
3343
+ f != null && f.masterReference && !W ? /* @__PURE__ */ n.jsx(Fr, { variant: "warning", children: x.selectMaster(((pn = (mn = f.columns) == null ? void 0 : mn.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : pn.caption) ?? "").toLowerCase() }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3344
+ f && H.length > 0 && /* @__PURE__ */ n.jsx("div", { className: "mb-2", children: /* @__PURE__ */ n.jsx(fi, { errors: H, schema: f }) }),
3345
+ f && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3346
+ /* @__PURE__ */ n.jsx("div", { className: j("rounded border overflow-auto", Gn.tableContainer), children: /* @__PURE__ */ n.jsx(Ii, { schema: f, items: (pe ? xe : S) ?? [], onEditItem: Lr, onDeleteItem: Rr, onCreateItem: Ar, filters: r, setFilter: o, sortByField: a, sortByType: l, setSortBy: i }) }),
3347
+ pe && e && /* @__PURE__ */ n.jsxs("div", { className: j(Gn.pagination, "d-flex align-items-center gap-3 p-1 border-bottom border-start border-end rounded"), children: [
3348
+ /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-center gap-1", children: [
3349
+ /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(1), disabled: !te, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-double-left" }) }),
3350
+ /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(e - 1), disabled: !te, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-left" }) }),
3351
+ /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(e + 1), disabled: !T, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-right" }) }),
3352
+ /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(ee), disabled: !T, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-double-right" }) })
3353
+ ] }),
3354
+ /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3355
+ x.tablePage,
3356
+ " ",
3357
+ e,
3358
+ " ",
3359
+ x.tablePageFrom,
3360
+ " ",
3361
+ ee
3362
+ ] })
3363
+ ] })
3364
+ ] })
3365
+ ] })
3356
3366
  ] });
3357
- }, Sd = ({ defaultMonth: t, searchKey: e = "monthFrom", yearMin: s, yearMax: r }) => {
3358
- const { localizationContext: o } = B(ue), { dateFnsLocale: a } = B(o), { searchParams: l, setSearch: i } = Wo(), c = l.get(e), d = c ? et(c) : t, u = $((m) => {
3359
- i(e, At(m, { representation: "date" }));
3360
- }, [e, i]);
3361
- return /* @__PURE__ */ n.jsx(Qa, { month: d, onChangeMonth: u, locale: a, yearMin: s, yearMax: r });
3362
- }, Id = ({ defaultYear: t, searchKey: e = "yearFrom", optionMin: s, optionMax: r, className: o }) => {
3363
- const [a, l] = zo(e, At(t, { representation: "date" })), i = a ? et(a) : t, c = $((d) => {
3364
- l(At(d, { representation: "date" }));
3365
- }, [l]);
3366
- return /* @__PURE__ */ n.jsx(Xa, { year: i, onChangeYear: c, optionMin: s, optionMax: r, className: o });
3367
- }, Dd = ({ data: t, showLegend: e = !1, legendPosition: s = "left" }) => {
3368
- const { chartColorPalette: r } = B(ue);
3369
- return /* @__PURE__ */ n.jsx(_o, { data: t, margin: {
3370
- top: 50,
3371
- right: e && s === "right" ? 200 : 100,
3372
- bottom: 50,
3373
- left: e && s === "left" ? 200 : 100
3374
- }, innerRadius: 0.4, padAngle: 4, cornerRadius: 2, activeOuterRadiusOffset: 10, borderWidth: 2, borderColor: {
3375
- from: "color",
3376
- modifiers: [["darker", 0.5]]
3377
- }, colors: r, arcLinkLabelsSkipAngle: 10, arcLinkLabelsTextColor: { from: "color", modifiers: [["darker", 0.5]] }, arcLinkLabelsThickness: 2, arcLinkLabelsColor: { from: "color" }, enableArcLabels: !1, legends: e ? [
3367
+ }, Kn = {
3368
+ appDetail: "/settings/:id"
3369
+ }, qn = {
3370
+ apiDynamicFormsGet: "/dynamicForms"
3371
+ }, Ei = ({ item: t, children: e }) => t.description ? /* @__PURE__ */ n.jsx(Kt, { placement: "left", text: t.description ?? "", children: /* @__PURE__ */ n.jsx("div", { children: e }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: e }), jd = ({ activeId: t, otherForms: e = [], groupsDefs: s = [], searchQuery: r, fullSize: o, appUrls: { appDetail: a = Kn.appDetail } = Kn, apiUrls: { apiDynamicFormsGet: l = qn.apiDynamicFormsGet } = qn }) => {
3372
+ const i = st(), { startLoading: c, stopLoading: d } = B(fs), [u, m] = I(null), h = q(() => [
3373
+ ...(u == null ? void 0 : u.map((y) => ({
3374
+ ...y,
3375
+ type: "dynamic-form"
3376
+ }))) ?? [],
3377
+ ...e
3378
+ ].filter((y) => Rt(y.name, r) || Rt(y.description, r)).sort((y, p) => (y.name ?? "").localeCompare(p.name ?? "")) ?? [], [u, e, r]), g = q(() => s.map((y) => ({
3379
+ id: y.id,
3380
+ name: y.name ?? "",
3381
+ items: h.filter((p) => p.group === y.id)
3382
+ })).filter((y) => y.items.length > 0), [s, h]), x = $(async () => {
3383
+ c("dynamicForms"), await i.get(l).then(({ data: y }) => {
3384
+ m(y), d("dynamicForms");
3385
+ }).catch(() => d("dynamicForms"));
3386
+ }, [i, c, d, l]);
3387
+ return O(() => {
3388
+ !u && x();
3389
+ }, [x, u]), h.length > 0 ? /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx("div", { className: "w-auto list-group forms-items overflow-x-hidden", children: g.map((y) => /* @__PURE__ */ n.jsx(Nl, { title: y.name, defaultOpen: !0, children: y.items.map((p) => {
3390
+ var w, N, f, k;
3391
+ return o ? /* @__PURE__ */ n.jsxs(_e, { to: `${Lt(a, { id: (w = p.id) == null ? void 0 : w.toString() })}?type=${p.type}`, className: `text-nowrap list-group-item list-group-item-action ${(t == null ? void 0 : t.toString()) === ((N = p.id) == null ? void 0 : N.toString()) ? "active" : ""}`, children: [
3392
+ /* @__PURE__ */ n.jsx(V, { variant: "body", children: p.name }),
3393
+ p.description && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "text-muted mt-2", children: p.description })
3394
+ ] }, p.id) : /* @__PURE__ */ n.jsx(Ei, { item: p, children: /* @__PURE__ */ n.jsx(_e, { to: `${Lt(a, { id: (f = p.id) == null ? void 0 : f.toString() })}?type=${p.type}`, className: `text-nowrap list-group-item list-group-item-action ${(t == null ? void 0 : t.toString()) === ((k = p.id) == null ? void 0 : k.toString()) ? "active" : ""}`, children: /* @__PURE__ */ n.jsx(V, { variant: "body2", children: p.name }) }) }, p.id);
3395
+ }) }, y.id)) }) }) : null;
3396
+ }, yd = ({ label: t, to: e, value: s }) => /* @__PURE__ */ n.jsxs(Ne, { label: t, children: [
3397
+ /* @__PURE__ */ n.jsx("input", { disabled: !0, className: "form-control d-none" }),
3398
+ e ? /* @__PURE__ */ n.jsx(_e, { to: e, className: "border-bottom luminus-dropdown-picker-link form-control d-flex justify-content-end align-items-center", children: s }) : /* @__PURE__ */ n.jsx("div", { className: "luminus-dropdown-picker-link form-control d-flex justify-content-end align-items-center", children: s })
3399
+ ] }), wd = () => {
3400
+ const { localizationContext: t } = B(ue), { language: e, setLanguage: s } = B(t), r = (o) => {
3401
+ s(o);
3402
+ };
3403
+ return /* @__PURE__ */ n.jsx(on, { onClick: (o) => {
3404
+ r(e === "cz" ? "en" : "cz"), o.stopPropagation();
3405
+ }, children: e === "cz" ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3406
+ /* @__PURE__ */ n.jsx("strong", { children: "CZ" }),
3407
+ /* @__PURE__ */ n.jsx(gn, {}),
3408
+ /* @__PURE__ */ n.jsx("span", { children: "EN" })
3409
+ ] }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3410
+ /* @__PURE__ */ n.jsx("strong", { children: "EN" }),
3411
+ /* @__PURE__ */ n.jsx(gn, {}),
3412
+ /* @__PURE__ */ n.jsx("span", { children: "CZ" })
3413
+ ] }) });
3414
+ }, vd = ({ controlId: t, ...e }) => /* @__PURE__ */ n.jsx(ae.Group, { controlId: t, ...e }), bd = ({ employeeId: t, alt: e, noPhotoImage: s, cafmApiUrl: r, showLargeInLightBox: o = !1 }) => {
3415
+ const { user: a } = B(is), { photoPath: l, photoPathSm: i } = Vo(t);
3416
+ return /* @__PURE__ */ n.jsx(n.Fragment, { children: t && /* @__PURE__ */ n.jsx(n.Fragment, { children: o ? /* @__PURE__ */ n.jsx(Hc, { baseUrl: r, customToken: a.cafmToken ?? void 0, photos: [
3378
3417
  {
3379
- anchor: s,
3380
- direction: s === "left" || s === "right" ? "column" : "row",
3381
- justify: !1,
3382
- translateX: s === "left" ? -200 : s === "right" ? 200 : 0,
3383
- translateY: s === "top" ? -50 : s === "bottom" ? 50 : 0,
3384
- itemsSpacing: 4,
3385
- itemWidth: 120,
3386
- itemHeight: 18,
3387
- itemTextColor: "#1e2832",
3388
- itemDirection: "left-to-right",
3389
- itemOpacity: 1,
3390
- symbolSize: 18,
3391
- symbolShape: "circle",
3392
- padding: 10
3418
+ id: t.toString(),
3419
+ alt: e ?? "",
3420
+ isDefault: !0,
3421
+ smSrc: i,
3422
+ lgSrc: l
3393
3423
  }
3394
- ] : [] });
3395
- }, wi = ({ errors: t, schema: e }) => {
3396
- const s = (r) => {
3397
- var o, a;
3398
- return r.toLowerCase() === "others" ? "Obecné" : ((a = (o = e.columns) == null ? void 0 : o.find((l) => l.field === r)) == null ? void 0 : a.caption) ?? r;
3424
+ ], placeholder: s, ImgComponent: Wn }) : /* @__PURE__ */ n.jsx(Wn, { baseUrl: r, customToken: a.cafmToken ?? void 0, src: i, alt: e, placeholder: s, className: "rounded w-100" }) }) });
3425
+ }, _d = ({ text: t, setText: e, onSearchButtonClick: s, className: r }) => {
3426
+ const o = (a) => {
3427
+ e(a);
3399
3428
  };
3400
- return /* @__PURE__ */ n.jsx("div", { className: "alert alert-danger w-100 m-0 p-2", children: /* @__PURE__ */ n.jsx("table", { children: /* @__PURE__ */ n.jsx("tbody", { children: t.map((r) => /* @__PURE__ */ n.jsxs("tr", { children: [
3401
- /* @__PURE__ */ n.jsx("td", { className: "fw-bold pe-2", children: /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3402
- s(r.name),
3403
- ":"
3404
- ] }) }),
3405
- /* @__PURE__ */ n.jsx("td", { className: "", children: /* @__PURE__ */ n.jsx(V, { variant: "body", children: r.errors }) })
3406
- ] }, r.name)) }) }) });
3407
- }, Tr = (t) => {
3408
- const e = {};
3409
- return Object.keys(t).forEach((s) => {
3410
- if (t[s].value === !0) {
3411
- e[s] = 1;
3429
+ return /* @__PURE__ */ n.jsxs(ft, { className: `${r}`, children: [
3430
+ /* @__PURE__ */ n.jsx(ae.Control, { value: t, onChange: (a) => e(a.target.value) }),
3431
+ t && /* @__PURE__ */ n.jsx(tt, { onClick: () => o(""), variant: "link", className: "border text-muted", children: /* @__PURE__ */ n.jsx(we, {}) }),
3432
+ /* @__PURE__ */ n.jsx(tt, { onClick: () => s && s(t), variant: "link", className: "border", children: /* @__PURE__ */ n.jsx(ko, {}) })
3433
+ ] });
3434
+ }, Nd = ({ InputContainer: t = Ne, formField: e, label: s, resetsFields: r, type: o, required: a, hidden: l, disabled: i, withoutLabel: c, className: d }) => {
3435
+ const { register: u, formState: m, setValue: h } = ke(), [g, x] = I(void 0), [y, p] = I(!1);
3436
+ O(() => {
3437
+ const N = e.split(".");
3438
+ let f = m.errors;
3439
+ N.forEach((k) => {
3440
+ f !== void 0 && (f = f[k]);
3441
+ }), x(f);
3442
+ }, [m, e]), O(() => {
3443
+ m.isSubmitted && p(!0);
3444
+ }, [m]);
3445
+ const w = g !== void 0;
3446
+ return /* @__PURE__ */ n.jsxs(t, { isForCheckInput: !0, hidden: l, label: `${s}${a ? " *" : ""}`, isInvalid: w, withoutLabel: c, className: d, children: [
3447
+ /* @__PURE__ */ n.jsx(ae.Check, { id: `check-${e}`, type: o ?? "checkbox", label: `${s}${a ? " *" : ""}`, ...u(e, {
3448
+ onChange: () => {
3449
+ r && r.forEach((N) => h(N, null, { shouldDirty: !0, shouldValidate: y }));
3450
+ }
3451
+ }), isInvalid: w, hidden: l, disabled: i, className: "w-100" }),
3452
+ g && /* @__PURE__ */ n.jsx(Fe, { message: g.message })
3453
+ ] });
3454
+ }, kd = ({ InputContainer: t = Ne, label: e, formField: s, options: r, resetsFields: o, required: a, disabled: l, hidden: i, className: c }) => {
3455
+ const { register: d, formState: u, setValue: m, watch: h } = ke(), [g, x] = I(void 0), [y, p] = I(!1), w = q(() => r, [r]);
3456
+ O(() => {
3457
+ const f = s.split(".");
3458
+ let k = u.errors;
3459
+ f.forEach((v) => {
3460
+ k !== void 0 && (k = k[v]);
3461
+ }), x(k);
3462
+ }, [u, s]), O(() => {
3463
+ u.isSubmitted && p(!0);
3464
+ }, [u]);
3465
+ const N = g !== void 0;
3466
+ return /* @__PURE__ */ n.jsxs(t, { isForRadioInput: !0, hidden: i, withoutLabel: !e, label: `${e}${a ? " *" : ""}`, isInvalid: N, className: c, children: [
3467
+ w.map((f) => /* @__PURE__ */ n.jsx(ae.Check, { id: `radio-${f.id}`, label: f.name, type: "radio", value: f.id ?? "", checked: h(s) === f.id, ...d(s, {
3468
+ onChange: () => {
3469
+ o && o.forEach((k) => m(k, null, { shouldDirty: !0, shouldValidate: y }));
3470
+ }
3471
+ }), isInvalid: N, hidden: i, disabled: l, className: "w-100" }, f.id)),
3472
+ g && /* @__PURE__ */ n.jsx(Fe, { message: g.message })
3473
+ ] });
3474
+ }, Cd = ({ InputContainer: t = Ne, formField: e, label: s, resetsFields: r, size: o, showClearIcon: a, clearValue: l, required: i, hidden: c, disabled: d, rows: u, withoutLabel: m, customFormControlProps: h, className: g }) => {
3475
+ const { register: x, formState: y, setValue: p, watch: w } = ke(), [N, f] = I(void 0), [k, v] = I(!1), C = $(() => {
3476
+ const S = l ?? null;
3477
+ p(e, (S == null ? void 0 : S.toString()) ?? "", { shouldDirty: !0, shouldValidate: k });
3478
+ }, [l, p, e, k]), _ = $(() => {
3479
+ const S = e.split(".");
3480
+ let F = y.errors;
3481
+ S.forEach((b) => {
3482
+ F !== void 0 && (F = F[b]);
3483
+ }), f(F);
3484
+ }, [y, e]);
3485
+ O(() => {
3486
+ _();
3487
+ }, [_]), O(() => {
3488
+ y.isSubmitted && v(!0);
3489
+ }, [y]);
3490
+ const E = N !== void 0;
3491
+ return /* @__PURE__ */ n.jsxs(t, { label: `${s}${i ? " *" : ""}`, hidden: c, withoutLabel: m, isInvalid: E, className: g, isForTextAreaInput: !0, children: [
3492
+ /* @__PURE__ */ n.jsx(ae.Control, { as: "textarea", size: o, ...x(e, {
3493
+ setValueAs: (S) => S == null || S === "" ? null : S,
3494
+ onChange: () => {
3495
+ r && r.forEach((S) => p(S, null, { shouldDirty: !0, shouldValidate: k }));
3496
+ }
3497
+ }), isInvalid: E, hidden: c, disabled: d, rows: u ?? 2, className: "w-100", ...h }),
3498
+ a && w(e) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: C, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
3499
+ N && /* @__PURE__ */ n.jsx(Fe, { message: N.message })
3500
+ ] });
3501
+ }, $d = ({ InputContainer: t = Ne, type: e, formField: s, label: r, placeholder: o, size: a, resetsFields: l, showClearIcon: i, clearValue: c, required: d, hidden: u, disabled: m, withoutLabel: h, list: g, step: x, CustomOnChangeComponent: y, noSelectOnFocus: p, className: w }) => {
3502
+ const { register: N, formState: f, setValue: k, watch: v } = ke(), [C, _] = I(void 0), [E, S] = I(!1), F = $(() => {
3503
+ const L = c ?? null;
3504
+ e === "number" ? k(s, L !== null ? Number(L) : null, {
3505
+ shouldDirty: !0,
3506
+ shouldValidate: E
3507
+ }) : k(s, (L == null ? void 0 : L.toString()) ?? "", { shouldDirty: !0, shouldValidate: E });
3508
+ }, [c, e, k, s, E]), b = $(() => {
3509
+ const L = s.split(".");
3510
+ let Z = f.errors;
3511
+ L.forEach((ee) => {
3512
+ Z !== void 0 && (Z = Z[ee]);
3513
+ }), _(Z);
3514
+ }, [f, s]);
3515
+ O(() => {
3516
+ b();
3517
+ }, [b]), O(() => {
3518
+ f.isSubmitted && S(!0);
3519
+ }, [f]);
3520
+ const D = C !== void 0, [R, H] = I(!1), Q = v(s), X = ys(e, Q ?? null, R);
3521
+ return /* @__PURE__ */ n.jsxs(t, { label: `${r}${d ? " *" : ""}`, hidden: u, withoutLabel: h, isInvalid: D, className: w, children: [
3522
+ /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
3523
+ /* @__PURE__ */ n.jsx(ae.Control, { type: X, placeholder: o ?? r, size: a, onFocus: (L) => {
3524
+ H(!0), !p && L.target.select();
3525
+ }, ...N(s, {
3526
+ setValueAs: (L) => e === "number" ? L == null || L === "" ? null : Number(L) : L == null || L === "" ? null : L,
3527
+ onChange: () => {
3528
+ l && l.forEach((L) => k(L, null, { shouldDirty: !0, shouldValidate: E }));
3529
+ },
3530
+ onBlur: () => H(!1)
3531
+ }), isInvalid: D, hidden: u, disabled: m, list: g, className: "w-100", step: x }),
3532
+ y && /* @__PURE__ */ n.jsx("div", { className: "custom-picker-button", children: y })
3533
+ ] }),
3534
+ i && v(s) && /* @__PURE__ */ n.jsx("div", { className: `luminus-input-remove-icon ${e !== "text" ? "inset" : ""}`, children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: F, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
3535
+ C && /* @__PURE__ */ n.jsx(Fe, { message: C.message })
3536
+ ] });
3537
+ }, Sd = ({ InputContainer: t = Ne, formField: e, label: s, size: r, defaultSelection: o, resetsFields: a, isNumber: l, required: i, hidden: c, disabled: d, items: u, onSearchQueryChange: m, selectedItemNavigateTo: h, texts: g, dropdownItemsNameWidth: x, isLoading: y, withoutLabel: p, additionalColumns: w, CustomOnChangeComponent: N, displayIdAsName: f, onSelect: k, className: v }) => {
3538
+ const { formState: C, setValue: _, watch: E, control: S } = ke(), [F, b] = I(void 0), [D, R] = I(!1), [H, Q] = I(!1), X = E(e) ?? null, L = X === (o == null ? void 0 : o.id) ? o == null ? void 0 : o.name : E(`${e}-DropdownName`), Z = q(() => X == null ? null : { id: X ?? null, name: L ?? "" }, [X, L]), ee = $(() => {
3539
+ const W = e.split(".");
3540
+ let A = C.errors;
3541
+ W.forEach((ne) => {
3542
+ A !== void 0 && (A = A[ne]);
3543
+ }), b(A);
3544
+ }, [C, e]), te = $((W) => {
3545
+ if ((W == null ? void 0 : W.id) === X)
3546
+ return;
3547
+ if (k && k(W), a && a.forEach((ne) => _(ne, null, { shouldDirty: !0, shouldValidate: H })), W === null) {
3548
+ _(e, null, {
3549
+ shouldDirty: !0,
3550
+ shouldValidate: H
3551
+ }), _(`${e}-DropdownName`, null);
3412
3552
  return;
3413
3553
  }
3414
- if (t[s].value === !1) {
3415
- e[s] = 0;
3554
+ let A = null;
3555
+ l ? A = (W == null ? void 0 : W.id) !== null && (W == null ? void 0 : W.id) !== "" ? parseInt(W.id.toString(), 10) : null : A = W.id === null || W.id === void 0 || W.id === "" ? null : W.id, _(e, A, {
3556
+ shouldDirty: !0,
3557
+ shouldValidate: H
3558
+ }), _(`${e}-DropdownName`, W.name ?? "");
3559
+ }, [_, e, H, l, a, X, k]), T = $((W) => {
3560
+ R(!1), te(W);
3561
+ }, [te]), re = $(() => {
3562
+ R(!1);
3563
+ }, []);
3564
+ O(() => {
3565
+ ee();
3566
+ }, [ee]), O(() => {
3567
+ C.isSubmitted && Q(!0);
3568
+ }, [C]);
3569
+ const de = Y(null), pe = F !== void 0, le = h !== void 0, xe = le && Z !== null;
3570
+ return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { label: `${s}${i ? " *" : ""}`, hidden: c, withoutLabel: p, isInvalid: pe, inputContainerClassName: j({ "luminus-dropdown-select-open": D }), className: v, children: [
3571
+ /* @__PURE__ */ n.jsxs(Er, { currentSelection: Z, selectedItemNavigateTo: h, children: [
3572
+ f && (Z == null ? void 0 : Z.name) && /* @__PURE__ */ n.jsx(V, { variant: "caption", className: "d-flex justify-content-end mt-2 luminus-dropdown-selection-name", children: Z.name }),
3573
+ /* @__PURE__ */ n.jsx(gs, { control: S, name: e, render: () => /* @__PURE__ */ n.jsx(ae.Select, { size: r, onMouseDown: (W) => {
3574
+ W.currentTarget.focus(), W.preventDefault();
3575
+ }, onClick: () => {
3576
+ !le && !d && R(!0);
3577
+ }, ref: de, value: X ?? "", onChange: () => {
3578
+ }, isInvalid: pe, hidden: c, className: j("w-100", {
3579
+ "luminus-dropdown-picker-disabled": d,
3580
+ "luminus-dropdown-picker-link": xe
3581
+ }), children: /* @__PURE__ */ n.jsx("option", { value: X, children: f ? X : (L == null ? void 0 : L.length) > 0 ? L : X }) }) }),
3582
+ N || !d && le ? /* @__PURE__ */ n.jsxs("div", { className: "custom-picker-button", children: [
3583
+ !N && !d && le && /* @__PURE__ */ n.jsx(U, { size: "sm", color: "secondary", onClick: (W) => {
3584
+ W.preventDefault(), W.stopPropagation(), R(!0);
3585
+ }, children: /* @__PURE__ */ n.jsx(us, {}) }),
3586
+ N ?? null
3587
+ ] }) : null
3588
+ ] }),
3589
+ F && /* @__PURE__ */ n.jsx(Fe, { message: F.message }),
3590
+ de.current && /* @__PURE__ */ n.jsx(rn, { show: D, onCancel: re, items: u, currentSelection: Z, onSelectionChange: T, onSearchQueryChange: m, texts: g, itemsNameWidth: x, additionalColumns: w, displayIdAsName: f, isLoading: y, disabled: d, inputRef: de })
3591
+ ] }) });
3592
+ }, Id = ({ InputContainer: t = Ne, label: e, formField: s, hidden: r, required: o, placeholder: a, disabled: l, showClearIcon: i, resetsFields: c, multiple: d, accept: u, withoutLabel: m, className: h }) => {
3593
+ const { watch: g, setValue: x, register: y, formState: p } = ke(), [w, N] = I(!1), [f, k] = I(void 0), v = $(() => {
3594
+ x(s, "");
3595
+ }, [x, s]), C = $(() => {
3596
+ const E = s.split(".");
3597
+ let S = p.errors;
3598
+ E.forEach((F) => {
3599
+ S !== void 0 && (S = S[F]);
3600
+ }), k(S);
3601
+ }, [p, s]);
3602
+ O(C, [C]), O(() => {
3603
+ p.isSubmitted && N(!0);
3604
+ }, [p]);
3605
+ const _ = f !== void 0;
3606
+ return /* @__PURE__ */ n.jsxs(t, { label: `${e}${o ? "*" : ""}`, hidden: r, withoutLabel: m, isInvalid: _, className: h, children: [
3607
+ /* @__PURE__ */ n.jsx(hs, { type: "file", multiple: d, accept: u.join(", "), placeholder: a ?? e, isInvalid: _, hidden: r, disabled: l, className: "w-100", ...y(s, {
3608
+ onChange: () => {
3609
+ c && c.forEach((E) => x(E, null, { shouldDirty: !0, shouldValidate: w }));
3610
+ }
3611
+ }) }),
3612
+ i && g(s) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: v, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
3613
+ f && /* @__PURE__ */ n.jsx(Fe, { message: f.message })
3614
+ ] });
3615
+ }, Dd = ({ children: t, onStorno: e, noSpacer: s }) => {
3616
+ const { formState: r } = ke(), [o, a] = I(!1);
3617
+ return O(() => {
3618
+ a(Object.keys(r.dirtyFields).length > 0);
3619
+ }, [r]), o ? /* @__PURE__ */ n.jsx(za, { onStorno: e, noSpacer: s, children: t }) : null;
3620
+ }, Fd = ({ InputContainer: t = Ne, options: e, formField: s, label: r, size: o, resetsFields: a, isNumber: l, required: i, hidden: c, disabled: d, withoutLabel: u, noSortOptions: m, suffixIdToName: h, className: g }) => {
3621
+ const { texts: { customSelect: x } } = B(ue), { formState: y, setValue: p, watch: w, control: N } = ke(), [f, k] = I(void 0), [v, C] = I(!1), [_, E] = I(!1), [S, F] = I(""), b = w(s), D = q(() => e.find((T) => T.id === b) ?? null, [e, b]), R = $(() => {
3622
+ const T = s.split(".");
3623
+ let re = y.errors;
3624
+ T.forEach((de) => {
3625
+ re !== void 0 && (re = re[de]);
3626
+ }), k(re);
3627
+ }, [y, s]), H = $((T) => {
3628
+ if ((T == null ? void 0 : T.id) === b)
3416
3629
  return;
3417
- }
3418
- e[s] = t[s].value;
3419
- }), e;
3420
- }, Yn = (t, e) => {
3421
- const s = {};
3422
- return Object.keys(t).forEach((r) => {
3423
- var l;
3424
- const o = t[r], a = (l = e.columns) == null ? void 0 : l.find((i) => i.field === r);
3425
- if ((a == null ? void 0 : a.type) === "BIT" && (o === 1 || o === 0)) {
3426
- s[r] = { value: o === 1, defaultValue: o === 1 };
3630
+ if (a && a.forEach((de) => p(de, null, { shouldDirty: !0, shouldValidate: _ })), T === null) {
3631
+ p(s, null, {
3632
+ shouldDirty: !0,
3633
+ shouldValidate: _
3634
+ });
3427
3635
  return;
3428
3636
  }
3429
- s[r] = { value: o, defaultValue: o };
3430
- }), s;
3431
- }, vi = "_table_1klfy_1", bi = "_table-header_1klfy_10", _i = "_table-row_1klfy_10", Ni = "_table-head_1klfy_10", ki = "_filters-row_1klfy_19", Ci = "_table-body_1klfy_30", $i = "_table-cell_1klfy_30", Si = "_action-column_1klfy_43", Ii = "_sticky-top_1klfy_47", Di = "_sticky-first_1klfy_54", Fi = "_sticky-last_1klfy_61", Ei = "_sticky-bottom_1klfy_68", J = {
3432
- table: vi,
3433
- "table-header": "_table-header_1klfy_10",
3434
- tableHeader: bi,
3435
- "table-row": "_table-row_1klfy_10",
3436
- tableRow: _i,
3437
- "table-head": "_table-head_1klfy_10",
3438
- tableHead: Ni,
3439
- "filters-row": "_filters-row_1klfy_19",
3440
- filtersRow: ki,
3441
- "table-body": "_table-body_1klfy_30",
3442
- tableBody: Ci,
3443
- "table-cell": "_table-cell_1klfy_30",
3444
- tableCell: $i,
3445
- "action-column": "_action-column_1klfy_43",
3446
- actionColumn: Si,
3447
- "sticky-top": "_sticky-top_1klfy_47",
3448
- stickyTop: Ii,
3449
- "sticky-first": "_sticky-first_1klfy_54",
3450
- stickyFirst: Di,
3451
- "sticky-last": "_sticky-last_1klfy_61",
3452
- stickyLast: Fi,
3453
- "sticky-bottom": "_sticky-bottom_1klfy_68",
3454
- stickyBottom: Ei
3455
- }, Oi = "_input_13mhy_1", Ae = {
3456
- input: Oi
3457
- }, Mr = ({ type: t, value: e, field: s, isPrimary: r, isReadonly: o, primaryEditable: a = !1, valuesForSelect: l, onChangeHandler: i, hideClearIcon: c, clearValue: d }) => {
3458
- switch (t) {
3459
- case "NUM":
3460
- return l && l.length > 0 ? /* @__PURE__ */ n.jsx(yt, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, u === null ? null : Number(u)), options: l, disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d }) : /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "number", value: e === null ? null : Number(e), onChange: (u) => i(s, u === null ? null : Number(u)), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3461
- case "STR":
3462
- return l && l.length > 0 ? /* @__PURE__ */ n.jsx(yt, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), options: l, disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d }) : /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "text", value: (e == null ? void 0 : e.toString()) ?? "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3463
- case "BIT":
3464
- return /* @__PURE__ */ n.jsx(br, { InputContainer: ye, className: Ae.input, value: e === !0, onChange: (u) => i(s, u), disabled: o || a ? !1 : r });
3465
- case "DT":
3466
- return /* @__PURE__ */ n.jsx(Pe, { withoutLabel: !0, InputContainer: ye, className: Ae.input, size: "sm", type: "date", value: e ? e.toString().split("T")[0] ?? "" : "", onChange: (u) => i(s, (u == null ? void 0 : u.toString()) ?? null), disabled: o || a ? !1 : r, showClearIcon: !c, clearValue: d });
3467
- default:
3468
- return /* @__PURE__ */ n.jsx("div", { className: "alert alert-warning p-1 m-0", children: /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3469
- "Neznámý typ ",
3470
- t
3471
- ] }) });
3472
- }
3473
- }, Ti = ({ schema: t, columns: e, initialItem: s, onEdit: r, onDelete: o }) => {
3474
- const { ProjectIconComponent: a } = B(ue), [l, i] = I(s), c = $((m, h) => {
3475
- console.log("changeValue", m, h), i((g) => ({
3476
- ...g,
3477
- [m]: {
3478
- ...g[m],
3479
- value: h
3480
- }
3481
- }));
3482
- }, []), d = (m) => (m == null ? void 0 : m.value) !== (m == null ? void 0 : m.defaultValue), u = $(() => Object.keys(l).some((m) => d(l[m])), [l]);
3483
- return O(() => {
3484
- i(s);
3485
- }, [s]), /* @__PURE__ */ n.jsxs("tr", { className: j("table-row", J.tableRow), children: [
3486
- /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell, J.stickyFirst), children: u() && /* @__PURE__ */ n.jsx(U, { color: "success", onClick: () => r(Tr(l)), children: /* @__PURE__ */ n.jsx(a, { icon: "check" }) }) }),
3487
- e.map((m) => {
3488
- var h, g;
3489
- return /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell), children: /* @__PURE__ */ n.jsx(Mr, { type: m.type, value: (h = l[m.field ?? ""]) == null ? void 0 : h.value, field: m.field, isReadonly: m.readOnly, isPrimary: t.primaryKey === m.field, valuesForSelect: m.valuesForSelect, onChangeHandler: c, hideClearIcon: !d(l[m.field ?? ""]), clearValue: (g = l[m.field ?? ""].defaultValue) == null ? void 0 : g.toString() }) }, `${t.id}-${m.field}`);
3490
- }),
3491
- /* @__PURE__ */ n.jsx("td", { className: j("table-cell", J.tableCell, J.stickyLast), children: /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => o(l[t.primaryKey ?? ""].value), children: /* @__PURE__ */ n.jsx(a, { icon: "delete" }) }) })
3492
- ] });
3493
- }, Mi = ({ schema: t, columns: e, onCreate: s }) => {
3494
- const { ProjectIconComponent: r } = B(ue), [o, a] = I(null), l = $(() => {
3495
- var d;
3496
- const c = {};
3497
- (d = t.columns) == null || d.forEach((u) => {
3498
- const m = u.type === "BIT" ? !1 : u.type === "NUM" ? 0 : u.type === "STR" ? "" : null;
3499
- c[u.field ?? ""] = {
3500
- value: m,
3501
- defaultValue: m
3502
- };
3503
- }), a(c);
3504
- }, [t]), i = $((c, d) => {
3505
- a((u) => u && {
3506
- ...u,
3507
- [c]: {
3508
- ...u[c],
3509
- value: d
3510
- }
3637
+ let re = null;
3638
+ l ? re = (T == null ? void 0 : T.id) !== null && (T == null ? void 0 : T.id) !== "" ? parseInt(T.id.toString(), 10) : null : re = T.id === null || T.id === void 0 || T.id === "" ? null : T.id, p(s, re, {
3639
+ shouldDirty: !0,
3640
+ shouldValidate: _
3511
3641
  });
3642
+ }, [p, s, l, a, b, _]), Q = $((T) => {
3643
+ C(!1), H(T);
3644
+ }, [H]), X = $((T) => {
3645
+ F(T);
3512
3646
  }, []);
3513
- return o ? /* @__PURE__ */ n.jsxs("tr", { className: "sticky-bottom shadow", children: [
3514
- /* @__PURE__ */ n.jsx("td", { className: "sticky-first", children: /* @__PURE__ */ n.jsx(U, { color: "success", onClick: async () => {
3515
- const c = Tr(o);
3516
- c && await s(c) && a(null);
3517
- }, children: /* @__PURE__ */ n.jsx(r, { icon: "check" }) }) }),
3518
- e.map((c) => /* @__PURE__ */ n.jsx("td", { children: /* @__PURE__ */ n.jsx(Mr, { type: c.type, value: o[c.field ?? ""].value, field: c.field, isReadonly: c.readOnly, isPrimary: t.primaryKey === c.field, valuesForSelect: c.valuesForSelect, onChangeHandler: i, primaryEditable: !0 }) }, `${t.id}-${c.field}`)),
3519
- /* @__PURE__ */ n.jsx("td", { className: "sticky-last", children: /* @__PURE__ */ n.jsx(U, { color: "danger", onClick: () => a(null), children: /* @__PURE__ */ n.jsx(r, { icon: "cancel" }) }) })
3520
- ] }) : /* @__PURE__ */ n.jsxs("tr", { className: "sticky-bottom shadow", children: [
3521
- /* @__PURE__ */ n.jsx("td", { className: "sticky-first", children: /* @__PURE__ */ n.jsx(U, { onClick: l, children: /* @__PURE__ */ n.jsx(r, { icon: "add" }) }) }),
3522
- /* @__PURE__ */ n.jsx("td", { colSpan: e.length + 1 })
3647
+ O(() => {
3648
+ R();
3649
+ }, [R]), O(() => {
3650
+ y.isSubmitted && E(!0);
3651
+ }, [y]);
3652
+ const L = $((T) => {
3653
+ var re;
3654
+ return T === null ? "" : !T.name || T.name.length === 0 ? ((re = T.id) == null ? void 0 : re.toString()) ?? "" : h ? `${T.name} (${T.id})` : T.name;
3655
+ }, [h]), Z = q(() => e.map((T) => ({
3656
+ id: T.id,
3657
+ name: L(T)
3658
+ })).filter((T) => Rt(T.name, S)).sort((T, re) => m ? 0 : (T.name ?? "").localeCompare(re.name ?? "")), [e, m, S, L]), ee = Y(null), te = f !== void 0;
3659
+ return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs(t, { label: `${r}${i ? " *" : ""}`, hidden: c, withoutLabel: u, isInvalid: te, inputContainerClassName: j({ "luminus-dropdown-select-open": v }), className: g, children: [
3660
+ /* @__PURE__ */ n.jsx(gs, { control: N, name: s, render: () => /* @__PURE__ */ n.jsx(ae.Select, { size: o, onMouseDown: (T) => {
3661
+ T.currentTarget.focus(), T.preventDefault();
3662
+ }, onClick: () => {
3663
+ C(!0);
3664
+ }, ref: ee, value: b ?? "", onChange: () => {
3665
+ }, isInvalid: te, hidden: c, disabled: d, className: "w-100", children: /* @__PURE__ */ n.jsx("option", { value: (D == null ? void 0 : D.id) ?? "", children: L(D) }) }) }),
3666
+ f && /* @__PURE__ */ n.jsx(Fe, { message: f.message }),
3667
+ ee.current && /* @__PURE__ */ n.jsx(rn, { show: v, onCancel: () => C(!1), items: Z, currentSelection: D ?? null, onSelectionChange: Q, onSearchQueryChange: X, texts: x, disabled: d, inputRef: ee, autoHideSearch: !0, allItemsLength: e.length })
3668
+ ] }) });
3669
+ }, Ed = ({ InputContainer: t = Ne, formField: e, label: s, placeholder: r, size: o, resetsFields: a, showClearIcon: l, clearValue: i, required: c, hidden: d, disabled: u, withoutLabel: m, step: h, stepperStep: g = 1, className: x }) => {
3670
+ const { register: y, formState: p, setValue: w, watch: N } = ke(), [f, k] = I(void 0), [v, C] = I(!1), _ = $(() => {
3671
+ const b = i ?? null;
3672
+ w(e, b !== null ? Number(b) : null, {
3673
+ shouldDirty: !0,
3674
+ shouldValidate: v
3675
+ });
3676
+ }, [i, w, e, v]), E = $(() => {
3677
+ const b = e.split(".");
3678
+ let D = p.errors;
3679
+ b.forEach((R) => {
3680
+ D !== void 0 && (D = D[R]);
3681
+ }), k(D);
3682
+ }, [p, e]);
3683
+ O(() => {
3684
+ E();
3685
+ }, [E]), O(() => {
3686
+ p.isSubmitted && C(!0);
3687
+ }, [p]);
3688
+ const S = f !== void 0, F = N(e);
3689
+ return /* @__PURE__ */ n.jsxs(t, { label: `${s}${c ? " *" : ""}`, hidden: d, withoutLabel: m, isInvalid: S, className: x, children: [
3690
+ /* @__PURE__ */ n.jsxs("div", { className: "luminus-input-container position-relative w-100", children: [
3691
+ /* @__PURE__ */ n.jsx(ae.Control, { type: "number", placeholder: r ?? s, size: o, ...y(e, {
3692
+ setValueAs: (b) => b == null || b === "" ? null : Number(b),
3693
+ onChange: () => {
3694
+ a && a.forEach((b) => w(b, null, { shouldDirty: !0, shouldValidate: v }));
3695
+ }
3696
+ }), isInvalid: S, hidden: d, disabled: u, className: "w-100 luminus-numeric-stepper", step: h }),
3697
+ /* @__PURE__ */ n.jsx("div", { className: "stepper-icon left", children: !u && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (b) => {
3698
+ b.preventDefault(), b.stopPropagation(), w(e, ((F ? Number(F) : 0) - g).toString(), { shouldDirty: !0, shouldValidate: v });
3699
+ }, children: /* @__PURE__ */ n.jsx(br, {}) }) }),
3700
+ /* @__PURE__ */ n.jsx("div", { className: "stepper-icon right", children: !u && /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (b) => {
3701
+ b.preventDefault(), b.stopPropagation(), w(e, ((F ? Number(F) : 0) + g).toString(), { shouldDirty: !0, shouldValidate: v });
3702
+ }, children: /* @__PURE__ */ n.jsx(_r, {}) }) })
3703
+ ] }),
3704
+ l && N(e) && /* @__PURE__ */ n.jsx("div", { className: "luminus-input-remove-icon", children: /* @__PURE__ */ n.jsx(U, { color: "secondary", size: "sm", onClick: _, children: /* @__PURE__ */ n.jsx(we, {}) }) }),
3705
+ f && /* @__PURE__ */ n.jsx(Fe, { message: f.message })
3523
3706
  ] });
3524
- }, Li = ({ column: t, children: e }) => t.description ? /* @__PURE__ */ n.jsx(Kt, { placement: "bottom", text: t.description ?? "", children: /* @__PURE__ */ n.jsx("div", { children: e }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: e }), Ri = ({ schema: t, items: e, onEditItem: s, onDeleteItem: r, onCreateItem: o, filters: a, setFilter: l, sortByField: i, sortByType: c, setSortBy: d }) => {
3525
- const { texts: { dynamicForms: u }, ProjectIconComponent: m } = B(ue), [h, g] = I([]);
3526
- return O(() => {
3527
- var x, y, p;
3528
- g([
3529
- ...((p = (y = (x = t.columns) == null ? void 0 : x.filter((w) => !w.hidden)) == null ? void 0 : y.filter((w) => t.masterReference ? w.field !== t.masterReferenceColumn : !0)) == null ? void 0 : p.map((w) => ({
3530
- label: w.caption ?? "",
3531
- description: w.description ?? null,
3532
- field: w.field ?? "",
3533
- type: w.type,
3534
- readOnly: w.readOnly,
3535
- valuesForSelect: w.values ?? void 0
3536
- }))) ?? []
3537
- ]);
3538
- }, [t]), /* @__PURE__ */ n.jsxs("table", { id: `dynamic-table-${t.id}`, className: j("table table-borderless luminus-df-table", J.table), children: [
3539
- /* @__PURE__ */ n.jsxs("thead", { className: j("text-nowrap table-header", J.stickyTop, J.tableHeader), children: [
3540
- /* @__PURE__ */ n.jsxs("tr", { className: j("table-row", J.tableRow), children: [
3541
- /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyFirst) }),
3542
- h.map((x) => /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead), onClick: () => {
3543
- const y = i === x.field ? c : null;
3544
- if (y === "asc") {
3545
- d(x.field, "desc");
3546
- return;
3547
- }
3548
- if (y === "desc") {
3549
- d(x.field, null);
3550
- return;
3551
- }
3552
- d(x.field, "asc");
3553
- }, children: /* @__PURE__ */ n.jsx(Li, { column: x, children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
3554
- x.label,
3555
- i === x.field && /* @__PURE__ */ n.jsx(m, { icon: c === "asc" ? "chevron-up" : "chevron-down" })
3556
- ] }) }) }, `${t.id}-${x.field}`)),
3557
- /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyLast) })
3558
- ] }),
3559
- /* @__PURE__ */ n.jsxs("tr", { className: j("table-row filters-row", J.tableRow, J.filtersRow), children: [
3560
- /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyFirst) }),
3561
- h.map((x) => /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead), children: x.valuesForSelect && x.valuesForSelect.length > 0 || x.type === "BIT" ? /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx(yt, { InputContainer: ye, withoutLabel: !0, size: "sm", value: a[x.field] ?? "", onChange: (y) => l(x.field, (y == null ? void 0 : y.toString()) ?? null), options: x.type === "BIT" ? [
3562
- { id: 1, name: u.yes },
3563
- { id: 0, name: u.no }
3564
- ] : x.valuesForSelect ?? [], isNumber: x.type === "BIT", showClearIcon: !0 }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx(Pe, { InputContainer: ye, withoutLabel: !0, size: "sm", type: x.type === "NUM" ? "number" : x.type === "DT" ? "date" : "text", value: a[x.field] ?? "", onChange: (y) => l(x.field, (y == null ? void 0 : y.toString()) ?? null) }) }) }, `${t.id}-${x.field}`)),
3565
- /* @__PURE__ */ n.jsx("th", { className: j("table-head", J.tableHead, J.actionColumn, J.stickyLast) })
3707
+ }, Od = ({ cell: { value: t } }) => /* @__PURE__ */ n.jsx(n.Fragment, { children: t ? /* @__PURE__ */ n.jsx(ds, { name: t, size: 21, fontSize: 12 }) : /* @__PURE__ */ n.jsx(n.Fragment, {}) }), Oi = ({ typeFilter: t, onChangeTypeFilter: e }) => {
3708
+ const s = ["info", "warning", "danger"];
3709
+ return /* @__PURE__ */ n.jsx("div", { className: "mb-1 d-flex justify-content-center gap-2", children: s.map((r) => /* @__PURE__ */ n.jsx("div", { role: "button", style: {
3710
+ height: "14px",
3711
+ width: "14px",
3712
+ borderRadius: "50%",
3713
+ border: "2px solid transparent",
3714
+ backgroundColor: "transparent"
3715
+ }, className: j(`border-${r}`, r === t && `bg-${r}`), onClick: () => {
3716
+ e(t === r ? null : r);
3717
+ } }, r)) });
3718
+ }, Ti = ({ linksTo: t, onClick: e, children: s }) => t ? /* @__PURE__ */ n.jsx(_e, { to: t, className: "text-decoration-none", onClick: e, children: s }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: s }), Mi = ({ message: t, onDeleteMessage: e, onClickMessage: s, getIcon: r, getLinksTo: o }) => {
3719
+ const { ProjectIconComponent: a, localizationContext: l } = B(ue), { dateFnsLocale: i } = B(l), c = t.dateTime ? et(t.dateTime) : null, d = c ? qo(new Date(Date.now()), c) : 0;
3720
+ return /* @__PURE__ */ n.jsxs("div", { children: [
3721
+ c && /* @__PURE__ */ n.jsx("div", { className: "d-flex justify-content-end", children: /* @__PURE__ */ n.jsx(Kt, { text: Xe(c, "dd.MM.yyyy HH:mm"), placement: "left", children: /* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsx(V, { variant: "caption", children: d > 2 ? Xe(c, "dd.MM.yyyy") : Zo(c, new Date(Date.now()), {
3722
+ locale: i.code
3723
+ }) }) }) }) }),
3724
+ /* @__PURE__ */ n.jsx(Ti, { linksTo: o(t) ?? void 0, onClick: s, children: /* @__PURE__ */ n.jsx(Kc, { level: t.type, noIcon: !0, children: /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-start gap-2", children: [
3725
+ r(t),
3726
+ /* @__PURE__ */ n.jsxs("div", { className: "d-flex flex-column gap-1 w-100", children: [
3727
+ /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-start justify-content-between gap-3", children: [
3728
+ /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "fw-bold", children: t.subject }),
3729
+ /* @__PURE__ */ n.jsx(U, { size: "sm", onClick: (u) => {
3730
+ u.preventDefault(), u.stopPropagation(), e(t.id);
3731
+ }, children: /* @__PURE__ */ n.jsx(a, { icon: "delete" }) })
3732
+ ] }),
3733
+ /* @__PURE__ */ n.jsx(V, { variant: "body2", children: t.text })
3734
+ ] })
3735
+ ] }) }) })
3736
+ ] });
3737
+ }, Qn = ({ messages: t, isLoading: e, onDeleteMessage: s, onClickMessage: r, getIcon: o, getLinksTo: a }) => {
3738
+ const { texts: { messageBoard: l } } = B(ue), [i, c] = I(null), d = q(() => t.filter((u) => i ? u.type === i : !0), [i, t]);
3739
+ return /* @__PURE__ */ n.jsxs("div", { className: "h-100 d-flex flex-column overflow-hidden", children: [
3740
+ /* @__PURE__ */ n.jsx(Oi, { typeFilter: i, onChangeTypeFilter: (u) => c(u) }),
3741
+ e && /* @__PURE__ */ n.jsxs("div", { className: "p-3 w-100", children: [
3742
+ /* @__PURE__ */ n.jsx(Ie, { as: In.Title, animation: "glow", children: /* @__PURE__ */ n.jsx(Ie, { xs: 6 }) }),
3743
+ /* @__PURE__ */ n.jsxs(Ie, { as: In.Text, animation: "glow", children: [
3744
+ /* @__PURE__ */ n.jsx(Ie, { xs: 7 }),
3745
+ " ",
3746
+ /* @__PURE__ */ n.jsx(Ie, { xs: 4 }),
3747
+ " ",
3748
+ /* @__PURE__ */ n.jsx(Ie, { xs: 4 }),
3749
+ " ",
3750
+ /* @__PURE__ */ n.jsx(Ie, { xs: 6 }),
3751
+ " ",
3752
+ /* @__PURE__ */ n.jsx(Ie, { xs: 8 })
3566
3753
  ] })
3567
3754
  ] }),
3568
- /* @__PURE__ */ n.jsxs("tbody", { className: j("table-body", J.tableBody), children: [
3569
- e.filter((x) => x[t.primaryKey ?? ""]).map((x) => /* @__PURE__ */ n.jsx(Ti, { schema: t, columns: h, initialItem: x, onEdit: s, onDelete: r }, `${t.id}-${x[t.primaryKey ?? ""].value}`)),
3570
- /* @__PURE__ */ n.jsx(Mi, { schema: t, columns: h, onCreate: o })
3755
+ !e && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3756
+ t.length === 0 && /* @__PURE__ */ n.jsx(Fr, { variant: "info", size: "sm", className: "mt-2", children: l.noMessages }),
3757
+ /* @__PURE__ */ n.jsx("div", { className: "h-100 overflow-y-auto d-flex flex-column gap-2 luminus-thin-scrollbar", children: d.map((u) => /* @__PURE__ */ n.jsx(Mi, { message: u, onDeleteMessage: s, onClickMessage: r, getIcon: o, getLinksTo: a }, u.id)) })
3571
3758
  ] })
3572
3759
  ] });
3573
- }, Ai = ({ master: t, onChange: e, options: s, label: r }) => /* @__PURE__ */ n.jsx(yt, { label: r, value: t, onChange: (o) => e(o ? o.toString() : null), options: s, size: "sm" }), Bi = "_pagination_gujwe_1", Kn = {
3574
- pagination: Bi
3575
- }, qn = {
3576
- appDetail: "/settings/:id"
3577
- }, Be = {
3578
- apiSchemaGet: "/dynamicForms/schema",
3579
- apiDataGet: "/dynamicForms/data",
3580
- apiItemPost: "/dynamicForms/update",
3581
- apiItemDelete: "/dynamicForms/delete",
3582
- apiItemCreate: "/dynamicForms/insert"
3583
- }, Fd = ({ id: t, page: e, setPage: s, filters: r, setFilter: o, sortByField: a, sortByType: l, setSortBy: i, appUrls: { appDetail: c = qn.appDetail } = qn, apiUrls: { apiSchemaGet: d = Be.apiSchemaGet, apiDataGet: u = Be.apiDataGet, apiItemPost: m = Be.apiItemPost, apiItemDelete: h = Be.apiItemDelete, apiItemCreate: g = Be.apiItemCreate } = Be }) => {
3584
- var cn, dn, un, fn, mn, pn;
3585
- const { texts: { dynamicForms: x }, ProjectIconComponent: y } = B(ue), p = st(), { startLoading: w, stopLoading: N } = B(fs), [f, k] = I(null), [v, C] = I(null), [_, E] = I(null), [S, F] = I(null), [b, D] = I(!1), { addNotification: R } = No(), [H, Q] = I([]), { confirm: X } = Uo(), L = 20, Z = L + 1, ee = S ? Math.ceil(S.length / L) : 1, te = e ? e > 1 : !1, T = e ? e < ee : !1, re = e ? (e - 1) * L : 0, de = e ? e * L : L, [pe, le] = I(!1), xe = pe ? S == null ? void 0 : S.slice(re, de) : S, [W, A] = I(null);
3760
+ }, Ot = {
3761
+ apiGet: "/messageBoard",
3762
+ apiDelete: "/messageBoard/"
3763
+ }, Td = ({ renderAsNotifPanel: t, notifIcon: e, apiUrls: { apiGet: s = Ot.apiGet, apiDelete: r = Ot.apiDelete } = Ot, getIcon: o, getLinksTo: a }) => {
3764
+ const i = st(), [c, d] = I([]), [u, m] = I(!1), [h, g] = I(!1), [x, y] = I(!1), p = $(async () => {
3765
+ g(!0), await i.get(s).then(({ data: v }) => {
3766
+ d(v), m(!0), g(!1);
3767
+ }).catch(() => {
3768
+ d([]), g(!1);
3769
+ });
3770
+ }, [s, i]), w = $(async (v) => i.delete(`${r}${v}`).then(() => !0).catch(() => !1), [r, i]), N = $((v) => {
3771
+ w(v).then((C) => {
3772
+ C && d(c.filter((_) => _.id !== v));
3773
+ });
3774
+ }, [w, c]);
3586
3775
  O(() => {
3587
- k(null), C(null), D(!1), Q([]), A(null);
3588
- }, [t]);
3589
- const ne = $(async () => {
3590
- w("dynamicFormSchema"), await p.get(`${d}?id=${t}`).then(({ data: P }) => {
3591
- k(P), N("dynamicFormSchema");
3592
- }).catch(() => N("dynamicFormSchema"));
3593
- }, [p, t, w, N, d]), me = $(async () => {
3594
- var P;
3595
- if (!(f === null || ((P = f.id) == null ? void 0 : P.toString()) !== t)) {
3596
- if (f.masterReference && !W) {
3597
- C([]);
3598
- return;
3599
- }
3600
- w("dynamicFormData"), await p.get(`${u}?id=${t}&showArchive=${b}${f.masterReference ? `&master=${W}` : ""}`).then(({ data: K }) => {
3601
- const se = K.map((G) => {
3602
- var oe;
3603
- return Object.fromEntries(((oe = f.columns) == null ? void 0 : oe.filter((ie) => ie.field).map((ie) => [
3604
- ie.field,
3605
- { value: G[ie.field ?? ""], defaultValue: G[ie.field ?? ""] }
3606
- ])) ?? []);
3607
- });
3608
- C(se), N("dynamicFormData");
3609
- }).catch(() => N("dynamicFormData"));
3610
- }
3611
- }, [p, t, f, w, N, b, W, u]), We = $(async (P) => (w("dynamicFormEdit"), p.post(`${m}?id=${t}`, P).then(() => (N("dynamicFormEdit"), Q([]), !0)).catch((K) => (N("dynamicFormEdit"), Q(Ct(K)), !1))), [p, t, w, N, m]), ze = $(async (P) => (w("dynamicFormDelete"), p.delete(`${h}?id=${t}&pk=${P}`).then(() => (N("dynamicFormDelete"), Q([]), !0)).catch((K) => (N("dynamicFormDelete"), Q(Ct(K)), !1))), [p, t, w, N, h]), Ve = $(async (P) => (w("dynamicFormCreate"), p.post(`${g}?id=${t}`, P).then(({ data: K }) => (N("dynamicFormCreate"), Q([]), K)).catch((K) => (N("dynamicFormCreate"), Q(Ct(K)), null))), [p, t, w, N, g]), Lr = $(async (P) => {
3612
- f && await We(f.masterReference ? { ...P, [f.masterReferenceColumn ?? ""]: W } : P) && (R(x.editSuccess, "success"), C((K) => K && K.map((se) => {
3613
- var G;
3614
- return ((G = se[(f == null ? void 0 : f.primaryKey) ?? ""]) == null ? void 0 : G.value) === P[(f == null ? void 0 : f.primaryKey) ?? ""] ? Yn(P, f) : se;
3615
- })));
3616
- }, [R, We, f, W, x]), Rr = $(async (P) => {
3617
- await X(x.deleteConfirm) && await ze(P) && (R(x.deleteSuccess, "success"), C((K) => K && K.filter((se) => {
3618
- var G;
3619
- return ((G = se[(f == null ? void 0 : f.primaryKey) ?? ""]) == null ? void 0 : G.value) !== P;
3620
- })));
3621
- }, [R, ze, x, X, f]), Ar = $(async (P) => {
3622
- if (!f)
3623
- return !1;
3624
- const K = await Ve(f.masterReference ? { ...P, [f.masterReferenceColumn ?? ""]: W } : P);
3625
- if (K !== null) {
3626
- R(x.createSuccess, "success");
3627
- const se = Yn(P, f);
3628
- return se[(f == null ? void 0 : f.primaryKey) ?? ""] = { value: K, defaultValue: K }, C((G) => [...G ?? [], se]), !0;
3629
- }
3630
- return !1;
3631
- }, [R, Ve, x, f, W]), at = (P) => {
3632
- P > ee ? s(ee) : P < 1 && s(1), s(P);
3633
- }, an = $(() => {
3634
- if (!v || !f) {
3635
- E(null);
3636
- return;
3637
- }
3638
- const P = v.filter((K) => Object.entries(r).every(([se, G]) => {
3639
- var Ye, Ke, qe;
3640
- if (G === null)
3641
- return !0;
3642
- const oe = (Ye = K[se]) == null ? void 0 : Ye.value;
3643
- if (oe == null)
3644
- return !1;
3645
- const ie = (Ke = f.columns) == null ? void 0 : Ke.find((lt) => lt.field === se), Ue = ie == null ? void 0 : ie.type, Ge = (ie == null ? void 0 : ie.values) && ((qe = ie == null ? void 0 : ie.values) == null ? void 0 : qe.length) > 0;
3646
- if (!Ue)
3647
- return !1;
3648
- switch (Ue) {
3649
- case "STR":
3650
- return Ge ? oe === G : oe.toString().toLowerCase().includes(G.toLowerCase());
3651
- case "NUM":
3652
- return Ge ? Number(oe) === Number(G) : oe.toString().toLowerCase().includes(G.toLowerCase());
3653
- case "DT":
3654
- return oe.toString().toLowerCase().includes(G.toLowerCase());
3655
- case "BIT":
3656
- return Number(oe) === Number(G);
3657
- default:
3658
- return oe.toString().toLowerCase().includes(G.toLowerCase());
3659
- }
3660
- }));
3661
- E(P);
3662
- }, [v, r, f]), ln = $(() => {
3663
- if (!_ || !f) {
3664
- F([]);
3665
- return;
3666
- }
3667
- if (!a) {
3668
- F(_);
3669
- return;
3670
- }
3671
- F([..._].sort((P, K) => {
3672
- var Ue, Ge, Ye, Ke, qe, lt;
3673
- const se = ((Ge = (Ue = P[a]) == null ? void 0 : Ue.value) == null ? void 0 : Ge.toString()) ?? "", G = ((Ke = (Ye = K[a]) == null ? void 0 : Ye.value) == null ? void 0 : Ke.toString()) ?? "", oe = f.columns.find((je) => je.field === a), ie = oe == null ? void 0 : oe.type;
3674
- if (!oe || !ie || !se && !G)
3675
- return 0;
3676
- if (!se)
3677
- return 1;
3678
- if (!G)
3679
- return -1;
3680
- if (oe.values && oe.values.length > 0) {
3681
- const je = ((qe = oe.values.find((Nt) => Nt.id.toString() === se)) == null ? void 0 : qe.name) ?? "", Ce = ((lt = oe.values.find((Nt) => Nt.id.toString() === G)) == null ? void 0 : lt.name) ?? "";
3682
- return l === "asc" ? je.localeCompare(Ce) : Ce.localeCompare(je);
3683
- }
3684
- if (ie === "NUM") {
3685
- const je = Number(se), Ce = Number(G);
3686
- return l === "asc" ? je - Ce : Ce - je;
3687
- }
3688
- if (ie === "DT") {
3689
- const je = et(se == null ? void 0 : se.toString()).getTime(), Ce = et(G == null ? void 0 : G.toString()).getTime();
3690
- return l === "asc" ? je - Ce : Ce - je;
3691
- }
3692
- return l === "asc" ? se.toString().localeCompare(G.toString()) : G.toString().localeCompare(se.toString());
3693
- }));
3694
- }, [_, f, a, l]);
3695
- return O(() => {
3696
- ne();
3697
- }, [ne]), O(() => {
3698
- me();
3699
- }, [me]), O(() => {
3700
- an();
3701
- }, [an]), O(() => {
3702
- ln();
3703
- }, [ln]), O(() => {
3704
- S && S.length > Z ? (le(!0), e || s(1)) : (le(!1), S && s(null));
3705
- }, [S, s, e, Z]), O(() => {
3706
- !pe || !e || (e > ee && s(ee), e < 1 && s(1));
3707
- }, [e, pe, ee, s]), /* @__PURE__ */ n.jsxs("div", { className: "h-100 w-100 d-flex flex-column", children: [
3708
- /* @__PURE__ */ n.jsxs("div", { className: "mb-3 d-flex justify-content-between align-items-center", children: [
3709
- /* @__PURE__ */ n.jsx(V, { variant: "h3", children: (f == null ? void 0 : f.name) ?? "" }),
3710
- /* @__PURE__ */ n.jsx(br, { label: x.showArchived, value: b === !0, onChange: (P) => D(P) })
3776
+ p();
3777
+ const v = setInterval(() => p(), 60 * 1e3);
3778
+ return () => {
3779
+ clearInterval(v);
3780
+ };
3781
+ }, [p]);
3782
+ const f = c.filter((v) => v.type === "danger").length, k = u ? !1 : h;
3783
+ return t ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3784
+ /* @__PURE__ */ n.jsxs("div", { className: "position-relative", children: [
3785
+ /* @__PURE__ */ n.jsx(U, { size: "md", onClick: () => y(!x), children: e }),
3786
+ f > 0 && /* @__PURE__ */ n.jsx("div", { className: "badge rounded-pill bg-danger p-1 px-2 text-white", style: { position: "absolute", top: "-6px", right: "-10px", fontSize: "10px" }, children: f })
3711
3787
  ] }),
3712
- (f == null ? void 0 : f.description) && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "mb-3", children: f == null ? void 0 : f.description }),
3713
- (f == null ? void 0 : f.masterReference) && /* @__PURE__ */ n.jsx("div", { className: "mb-3 d-flex", children: /* @__PURE__ */ n.jsx(Ai, { label: ((dn = (cn = f.columns) == null ? void 0 : cn.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : dn.caption) ?? "", options: ((fn = (un = f.columns) == null ? void 0 : un.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : fn.values) ?? [], master: W, onChange: (P) => A(P) }) }),
3714
- (f == null ? void 0 : f.slaves) && f.slaves.length > 0 && /* @__PURE__ */ n.jsx("div", { className: "mb-3 d-flex align-items-center flex-start", children: f.slaves.map((P) => {
3715
- var K;
3716
- return /* @__PURE__ */ n.jsx(jt, { as: "link", href: `${Lt(c, { id: (K = P.id) == null ? void 0 : K.toString() })}?type=dynamic-form`, children: P.name }, P.id);
3717
- }) }),
3718
- f != null && f.masterReference && !W ? /* @__PURE__ */ n.jsx(Or, { variant: "warning", children: x.selectMaster(((pn = (mn = f.columns) == null ? void 0 : mn.find((P) => P.field === f.masterReferenceColumn)) == null ? void 0 : pn.caption) ?? "").toLowerCase() }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3719
- f && H.length > 0 && /* @__PURE__ */ n.jsx("div", { className: "mb-2", children: /* @__PURE__ */ n.jsx(wi, { errors: H, schema: f }) }),
3720
- f && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3721
- /* @__PURE__ */ n.jsx("div", { className: j("rounded border overflow-auto", Kn.tableContainer), children: /* @__PURE__ */ n.jsx(Ri, { schema: f, items: (pe ? xe : S) ?? [], onEditItem: Lr, onDeleteItem: Rr, onCreateItem: Ar, filters: r, setFilter: o, sortByField: a, sortByType: l, setSortBy: i }) }),
3722
- pe && e && /* @__PURE__ */ n.jsxs("div", { className: j(Kn.pagination, "d-flex align-items-center gap-3 p-1 border-bottom border-start border-end rounded"), children: [
3723
- /* @__PURE__ */ n.jsxs("div", { className: "d-flex align-items-center gap-1", children: [
3724
- /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(1), disabled: !te, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-double-left" }) }),
3725
- /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(e - 1), disabled: !te, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-left" }) }),
3726
- /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(e + 1), disabled: !T, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-right" }) }),
3727
- /* @__PURE__ */ n.jsx(U, { color: "primary", onClick: () => at(ee), disabled: !T, children: /* @__PURE__ */ n.jsx(y, { icon: "chevron-double-right" }) })
3728
- ] }),
3729
- /* @__PURE__ */ n.jsxs(V, { variant: "body", children: [
3730
- x.tablePage,
3731
- " ",
3732
- e,
3733
- " ",
3734
- x.tablePageFrom,
3735
- " ",
3736
- ee
3737
- ] })
3738
- ] })
3739
- ] })
3740
- ] })
3741
- ] });
3742
- }, Qn = {
3743
- appDetail: "/settings/:id"
3744
- }, Zn = {
3745
- apiDynamicFormsGet: "/dynamicForms"
3746
- }, Pi = ({ item: t, children: e }) => t.description ? /* @__PURE__ */ n.jsx(Kt, { placement: "left", text: t.description ?? "", children: /* @__PURE__ */ n.jsx("div", { children: e }) }) : /* @__PURE__ */ n.jsx(n.Fragment, { children: e }), Ed = ({ activeId: t, otherForms: e = [], groupsDefs: s = [], searchQuery: r, fullSize: o, appUrls: { appDetail: a = Qn.appDetail } = Qn, apiUrls: { apiDynamicFormsGet: l = Zn.apiDynamicFormsGet } = Zn }) => {
3747
- const i = st(), { startLoading: c, stopLoading: d } = B(fs), [u, m] = I(null), h = q(() => [
3748
- ...(u == null ? void 0 : u.map((y) => ({
3749
- ...y,
3750
- type: "dynamic-form"
3751
- }))) ?? [],
3752
- ...e
3753
- ].filter((y) => Rt(y.name, r) || Rt(y.description, r)).sort((y, p) => (y.name ?? "").localeCompare(p.name ?? "")) ?? [], [u, e, r]), g = q(() => s.map((y) => ({
3754
- id: y.id,
3755
- name: y.name ?? "",
3756
- items: h.filter((p) => p.group === y.id)
3757
- })).filter((y) => y.items.length > 0), [s, h]), x = $(async () => {
3758
- c("dynamicForms"), await i.get(l).then(({ data: y }) => {
3759
- m(y), d("dynamicForms");
3760
- }).catch(() => d("dynamicForms"));
3761
- }, [i, c, d, l]);
3762
- return O(() => {
3763
- !u && x();
3764
- }, [x, u]), h.length > 0 ? /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx("div", { className: "w-auto list-group forms-items overflow-x-hidden", children: g.map((y) => /* @__PURE__ */ n.jsx(Al, { title: y.name, defaultOpen: !0, children: y.items.map((p) => {
3765
- var w, N, f, k;
3766
- return o ? /* @__PURE__ */ n.jsxs(_e, { to: `${Lt(a, { id: (w = p.id) == null ? void 0 : w.toString() })}?type=${p.type}`, className: `text-nowrap list-group-item list-group-item-action ${(t == null ? void 0 : t.toString()) === ((N = p.id) == null ? void 0 : N.toString()) ? "active" : ""}`, children: [
3767
- /* @__PURE__ */ n.jsx(V, { variant: "body", children: p.name }),
3768
- p.description && /* @__PURE__ */ n.jsx(V, { variant: "body2", className: "text-muted mt-2", children: p.description })
3769
- ] }, p.id) : /* @__PURE__ */ n.jsx(Pi, { item: p, children: /* @__PURE__ */ n.jsx(_e, { to: `${Lt(a, { id: (f = p.id) == null ? void 0 : f.toString() })}?type=${p.type}`, className: `text-nowrap list-group-item list-group-item-action ${(t == null ? void 0 : t.toString()) === ((k = p.id) == null ? void 0 : k.toString()) ? "active" : ""}`, children: /* @__PURE__ */ n.jsx(V, { variant: "body2", children: p.name }) }) }, p.id);
3770
- }) }, y.id)) }) }) : null;
3771
- }, Od = ({ label: t, to: e, value: s }) => /* @__PURE__ */ n.jsxs(Ne, { label: t, children: [
3772
- /* @__PURE__ */ n.jsx("input", { disabled: !0, className: "form-control d-none" }),
3773
- e ? /* @__PURE__ */ n.jsx(_e, { to: e, className: "border-bottom luminus-dropdown-picker-link form-control d-flex justify-content-end align-items-center", children: s }) : /* @__PURE__ */ n.jsx("div", { className: "luminus-dropdown-picker-link form-control d-flex justify-content-end align-items-center", children: s })
3774
- ] }), Td = () => {
3775
- const { localizationContext: t } = B(ue), { language: e, setLanguage: s } = B(t), r = (o) => {
3776
- s(o);
3777
- };
3778
- return /* @__PURE__ */ n.jsx(rn, { onClick: (o) => {
3779
- r(e === "cz" ? "en" : "cz"), o.stopPropagation();
3780
- }, children: e === "cz" ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3781
- /* @__PURE__ */ n.jsx("strong", { children: "CZ" }),
3782
- /* @__PURE__ */ n.jsx(gn, {}),
3783
- /* @__PURE__ */ n.jsx("span", { children: "EN" })
3784
- ] }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3785
- /* @__PURE__ */ n.jsx("strong", { children: "EN" }),
3786
- /* @__PURE__ */ n.jsx(gn, {}),
3787
- /* @__PURE__ */ n.jsx("span", { children: "CZ" })
3788
- ] }) });
3789
- }, Md = ({ controlId: t, ...e }) => /* @__PURE__ */ n.jsx(ae.Group, { controlId: t, ...e }), Ld = ({ employeeId: t, alt: e, noPhotoImage: s, cafmApiUrl: r, showLargeInLightBox: o = !1 }) => {
3790
- const { user: a } = B(us), { photoPath: l, photoPathSm: i } = Vo(t);
3791
- return /* @__PURE__ */ n.jsx(n.Fragment, { children: t && /* @__PURE__ */ n.jsx(n.Fragment, { children: o ? /* @__PURE__ */ n.jsx(qc, { baseUrl: r, customToken: a.cafmToken ?? void 0, photos: [
3792
- {
3793
- id: t.toString(),
3794
- alt: e ?? "",
3795
- isDefault: !0,
3796
- smSrc: i,
3797
- lgSrc: l
3798
- }
3799
- ], placeholder: s, ImgComponent: Vn }) : /* @__PURE__ */ n.jsx(Vn, { baseUrl: r, customToken: a.cafmToken ?? void 0, src: i, alt: e, placeholder: s, className: "rounded w-100" }) }) });
3800
- }, Rd = ({ text: t, setText: e, onSearchButtonClick: s, className: r }) => {
3801
- const o = (a) => {
3802
- e(a);
3803
- };
3804
- return /* @__PURE__ */ n.jsxs(ft, { className: `${r}`, children: [
3805
- /* @__PURE__ */ n.jsx(ae.Control, { value: t, onChange: (a) => e(a.target.value) }),
3806
- t && /* @__PURE__ */ n.jsx(tt, { onClick: () => o(""), variant: "link", className: "border text-muted", children: /* @__PURE__ */ n.jsx(we, {}) }),
3807
- /* @__PURE__ */ n.jsx(tt, { onClick: () => s && s(t), variant: "link", className: "border", children: /* @__PURE__ */ n.jsx(ko, {}) })
3808
- ] });
3809
- };
3788
+ /* @__PURE__ */ n.jsx(Tn, { show: x, onHide: () => y(!1), placement: "end", children: /* @__PURE__ */ n.jsx(Tn.Body, { children: /* @__PURE__ */ n.jsx(Qn, { messages: c, isLoading: k, onDeleteMessage: N, onClickMessage: () => y(!1), getIcon: o, getLinksTo: a }) }) })
3789
+ ] }) : /* @__PURE__ */ n.jsx(Qn, { messages: c, isLoading: k, onDeleteMessage: N, getIcon: o, getLinksTo: a });
3790
+ }, Li = "_tab-panel_d8l8q_1", Ri = "_full-height-no-overflow_d8l8q_5", Ai = "_disabled_d8l8q_12", Tt = {
3791
+ "tab-panel": "_tab-panel_d8l8q_1",
3792
+ tabPanel: Li,
3793
+ "full-height-no-overflow": "_full-height-no-overflow_d8l8q_5",
3794
+ fullHeightNoOverflow: Ri,
3795
+ disabled: Ai
3796
+ }, Md = ({ eventKey: t, activeTab: e, fullHeightNoOverflow: s, disabled: r, className: o, children: a }) => t !== e ? null : /* @__PURE__ */ n.jsx("div", { className: j("luminus-tab-panel", Tt.tabPanel, { [Tt.fullHeightNoOverflow]: s }, { disabled: r }, { [Tt.disabled]: r }, o), children: a }), Ld = ({ activeTab: t, onSelect: e, children: s }) => /* @__PURE__ */ n.jsx("div", { className: j("luminus-tabs d-flex gap-1 mb-2"), children: s.map((r) => {
3797
+ const o = r.type, a = r.props;
3798
+ if (!a)
3799
+ return null;
3800
+ const l = a.eventKey, i = a.children, c = a.className, d = a.onClick;
3801
+ return /* @__PURE__ */ Io(o, { ...a, key: a.eventKey, className: j({ active: t === l }, c), onClick: () => {
3802
+ e(l), d && d(l);
3803
+ } }, i);
3804
+ }) }), Bi = "_tab_1hdhk_1", Pi = "_disabled_1hdhk_8", Zn = {
3805
+ tab: Bi,
3806
+ disabled: Pi
3807
+ }, Rd = ({ eventKey: t, className: e, onClick: s, disabled: r, children: o }) => /* @__PURE__ */ n.jsx("div", { role: "button", className: j("luminus-tab text-primary rounded", Zn.tab, e, {
3808
+ disabled: r
3809
+ }, { [Zn.disabled]: r }), onClick: () => s && !r && s(t), children: typeof o == "string" ? /* @__PURE__ */ n.jsx(V, { variant: "h6", className: "text-primary", children: o }) : o });
3810
3810
  export {
3811
- Or as Alert,
3812
- ni as AlertItem,
3811
+ Fr as Alert,
3812
+ Kc as AlertItem,
3813
3813
  ed as ApiFileDownloadButton,
3814
- _d as AppSearch,
3815
- Nd as AuthTemplate,
3816
- ls as AvatarIcon,
3817
- Fr as Backdrop,
3818
- bd as Badge,
3819
- Cc as Card,
3820
- br as CheckInput,
3821
- Al as Collapse,
3814
+ ad as AppSearch,
3815
+ ld as AuthTemplate,
3816
+ ds as AvatarIcon,
3817
+ Ir as Backdrop,
3818
+ sd as Badge,
3819
+ jc as Card,
3820
+ Or as CheckInput,
3821
+ Nl as Collapse,
3822
3822
  jt as ContextButton,
3823
- Od as DisabledRowLabelLink,
3824
- $r as Dropdown,
3825
- hd as DropdownDivider,
3826
- rn as DropdownItem,
3827
- nd as DropdownPicker,
3828
- Cr as DropdownToggle,
3829
- Fd as DynamicForm,
3830
- Ld as EmployeeSmallPhoto,
3831
- Sl as ErrorBoundary,
3823
+ yd as DisabledRowLabelLink,
3824
+ Cr as Dropdown,
3825
+ od as DropdownDivider,
3826
+ on as DropdownItem,
3827
+ dd as DropdownPicker,
3828
+ kr as DropdownToggle,
3829
+ xd as DynamicForm,
3830
+ bd as EmployeeSmallPhoto,
3831
+ pl as ErrorBoundary,
3832
3832
  wr as FileUploadContextButton,
3833
- pd as FileUploadDropdownItem,
3834
- oi as FloatingActionContainer,
3833
+ rd as FileUploadDropdownItem,
3834
+ Zc as FloatingActionContainer,
3835
3835
  za as FloatingFormSubmit,
3836
3836
  He as FloatingLabelInput,
3837
- $d as FromToDatePicker,
3838
- vd as HomeDashboard,
3839
- od as HookFormCheckInput,
3840
- id as HookFormDropdownPicker,
3841
- dd as HookFormFileInput,
3842
- ud as HookFormFloatingSubmit,
3843
- md as HookFormNumericStepperInput,
3844
- ad as HookFormRadioInput,
3845
- fd as HookFormSelectInput,
3846
- ld as HookFormTextAreaInput,
3847
- cd as HookFormTextInput,
3837
+ md as FromToDatePicker,
3838
+ nd as HomeDashboard,
3839
+ Nd as HookFormCheckInput,
3840
+ Sd as HookFormDropdownPicker,
3841
+ Id as HookFormFileInput,
3842
+ Dd as HookFormFloatingSubmit,
3843
+ Ed as HookFormNumericStepperInput,
3844
+ kd as HookFormRadioInput,
3845
+ Fd as HookFormSelectInput,
3846
+ Cd as HookFormTextAreaInput,
3847
+ $d as HookFormTextInput,
3848
3848
  td as HtmlTooltip,
3849
3849
  U as IconButton,
3850
- Vn as ImgApi,
3851
- Er as ImgDirect,
3850
+ Wn as ImgApi,
3851
+ Dr as ImgDirect,
3852
3852
  Fe as InvalidFeedback,
3853
- Td as LanguageSwitch,
3853
+ wd as LanguageSwitch,
3854
3854
  yn as Loading,
3855
3855
  Go as LoadingBlock,
3856
- xd as MessageBoard,
3856
+ Td as MessageBoard,
3857
3857
  Qa as MonthPicker,
3858
- Sd as MonthPickerSearchParams,
3858
+ pd as MonthPickerSearchParams,
3859
3859
  ye as NoInputContainer,
3860
- rd as NumericStepperInput,
3861
- qc as PhotoLibrary,
3862
- Kc as PhotoLightbox,
3863
- Dd as PieChart,
3860
+ fd as NumericStepperInput,
3861
+ Hc as PhotoLibrary,
3862
+ Pc as PhotoLightbox,
3863
+ gd as PieChart,
3864
3864
  jn as PrimaryButton,
3865
3865
  Ne as RowLabelInput,
3866
- Rd as SearchBox,
3866
+ _d as SearchBox,
3867
3867
  yt as SelectInput,
3868
- Ed as SettingsFormPicker,
3869
- on as SimplePicker,
3868
+ jd as SettingsFormPicker,
3869
+ rn as SimplePicker,
3870
3870
  ho as SimpleToggle,
3871
3871
  Kt as SimpleTooltip,
3872
- wd as Tab,
3873
- jd as TabPanel,
3874
- yd as Tabs,
3875
- sd as TextAreaInput,
3872
+ Rd as Tab,
3873
+ Md as TabPanel,
3874
+ Ld as Tabs,
3875
+ ud as TextAreaInput,
3876
3876
  Pe as TextInput,
3877
- Cd as Timeline,
3878
- Md as TypedFormGroup,
3877
+ id as Timeline,
3878
+ vd as TypedFormGroup,
3879
3879
  V as Typography,
3880
3880
  Pd as UserAvatarToggle,
3881
- gd as UserAvatarValueFormat,
3882
- kd as VersionInfo,
3883
- An as WidgetCard,
3881
+ Od as UserAvatarValueFormat,
3882
+ cd as VersionInfo,
3883
+ Ln as WidgetCard,
3884
3884
  Xa as YearPicker,
3885
- Id as YearPickerSearchParams
3885
+ hd as YearPickerSearchParams
3886
3886
  };