@erpsquad/common 1.10.29 → 1.10.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/chunks/{ERPUIProvider-CLg_Yo12.esm.js → ERPUIProvider-CIzXMsuV.esm.js} +8 -8
  2. package/dist/chunks/{ERPUIProvider-CLg_Yo12.esm.js.map → ERPUIProvider-CIzXMsuV.esm.js.map} +1 -1
  3. package/dist/chunks/{actionCreator-C8cLIOap.esm.js → actionCreator-BzPZv2rR.esm.js} +2 -2
  4. package/dist/chunks/{actionCreator-C8cLIOap.esm.js.map → actionCreator-BzPZv2rR.esm.js.map} +1 -1
  5. package/dist/chunks/{android-12-switch-DM9s0XTb.js → android-12-switch-BILQvv4G.js} +170 -5
  6. package/dist/chunks/android-12-switch-BILQvv4G.js.map +1 -0
  7. package/dist/chunks/{android-12-switch-eTZOAHAa.esm.js → android-12-switch-DpJE56Wi.esm.js} +212 -47
  8. package/dist/chunks/android-12-switch-DpJE56Wi.esm.js.map +1 -0
  9. package/dist/chunks/{appbar-DtROOKgm.esm.js → appbar-5rP5iXcS.esm.js} +4 -4
  10. package/dist/chunks/{appbar-DtROOKgm.esm.js.map → appbar-5rP5iXcS.esm.js.map} +1 -1
  11. package/dist/chunks/{common-Nn4SUfK7.esm.js → common-D59u5rE6.esm.js} +2 -2
  12. package/dist/chunks/{common-Nn4SUfK7.esm.js.map → common-D59u5rE6.esm.js.map} +1 -1
  13. package/dist/chunks/{custom-editor-B-mleFzm.esm.js → custom-editor-UhZu0Svw.esm.js} +2 -2
  14. package/dist/chunks/{custom-editor-B-mleFzm.esm.js.map → custom-editor-UhZu0Svw.esm.js.map} +1 -1
  15. package/dist/chunks/{default-data-BjzCfuoR.js → default-data-B2-JPE4u.js} +9 -11
  16. package/dist/chunks/{default-data-BjzCfuoR.js.map → default-data-B2-JPE4u.js.map} +1 -1
  17. package/dist/chunks/{default-data-C8B-fYa8.esm.js → default-data-DLCnpyaM.esm.js} +19 -21
  18. package/dist/chunks/{default-data-C8B-fYa8.esm.js.map → default-data-DLCnpyaM.esm.js.map} +1 -1
  19. package/dist/chunks/{form-builder-conversion-yi03Elpa.esm.js → form-builder-conversion-gLJCNqSQ.esm.js} +2 -2
  20. package/dist/chunks/{form-builder-conversion-yi03Elpa.esm.js.map → form-builder-conversion-gLJCNqSQ.esm.js.map} +1 -1
  21. package/dist/chunks/{form-builder-deconversion-CFtHF1hm.esm.js → form-builder-deconversion-DNGMsAEj.esm.js} +3 -3
  22. package/dist/chunks/{form-builder-deconversion-CFtHF1hm.esm.js.map → form-builder-deconversion-DNGMsAEj.esm.js.map} +1 -1
  23. package/dist/chunks/{fullScreen-Xv8AR914.esm.js → fullScreen-C8Qnoyrr.esm.js} +2 -2
  24. package/dist/chunks/{fullScreen-Xv8AR914.esm.js.map → fullScreen-C8Qnoyrr.esm.js.map} +1 -1
  25. package/dist/chunks/{languageContext-cweJTzn0.esm.js → languageContext-ffrxXJkr.esm.js} +3 -3
  26. package/dist/chunks/{languageContext-cweJTzn0.esm.js.map → languageContext-ffrxXJkr.esm.js.map} +1 -1
  27. package/dist/chunks/{migration-utils-llqrdBh8.esm.js → migration-utils-BJsX1G2n.esm.js} +2 -2
  28. package/dist/chunks/{migration-utils-llqrdBh8.esm.js.map → migration-utils-BJsX1G2n.esm.js.map} +1 -1
  29. package/dist/chunks/{page-context-BbQNncGA.esm.js → page-context-BlGcwtdZ.esm.js} +3 -3
  30. package/dist/chunks/{page-context-BbQNncGA.esm.js.map → page-context-BlGcwtdZ.esm.js.map} +1 -1
  31. package/dist/chunks/{reducer-DRkUwBHb.esm.js → reducer-D6_f0R4C.esm.js} +2 -2
  32. package/dist/chunks/{reducer-DRkUwBHb.esm.js.map → reducer-D6_f0R4C.esm.js.map} +1 -1
  33. package/dist/chunks/{shareSlice-H0nwzQZv.esm.js → shareSlice-Bxrgfv7o.esm.js} +2 -2
  34. package/dist/chunks/{shareSlice-H0nwzQZv.esm.js.map → shareSlice-Bxrgfv7o.esm.js.map} +1 -1
  35. package/dist/chunks/{sidebar-CdhW0PKj.esm.js → sidebar-n5_ky6G7.esm.js} +4 -4
  36. package/dist/chunks/{sidebar-CdhW0PKj.esm.js.map → sidebar-n5_ky6G7.esm.js.map} +1 -1
  37. package/dist/chunks/{sidebarScreen-DbfP32Xx.esm.js → sidebarScreen-BwkiIBud.esm.js} +5 -6
  38. package/dist/chunks/sidebarScreen-BwkiIBud.esm.js.map +1 -0
  39. package/dist/chunks/{sidebarScreen-figZp_Ln.js → sidebarScreen-Cm763s1P.js} +1 -2
  40. package/dist/chunks/sidebarScreen-Cm763s1P.js.map +1 -0
  41. package/dist/chunks/{store-C2XaFCA_.esm.js → store-OqHSsVaz.esm.js} +3 -3
  42. package/dist/chunks/{store-C2XaFCA_.esm.js.map → store-OqHSsVaz.esm.js.map} +1 -1
  43. package/dist/chunks/{translations-DJZgOpfH.esm.js → translations-GFvlFdi5.esm.js} +2 -2
  44. package/dist/chunks/{translations-DJZgOpfH.esm.js.map → translations-GFvlFdi5.esm.js.map} +1 -1
  45. package/dist/chunks/{uom-field-wrapper-DKN31prP.esm.js → uom-field-wrapper-CgYTONsG.esm.js} +33 -158
  46. package/dist/chunks/uom-field-wrapper-CgYTONsG.esm.js.map +1 -0
  47. package/dist/chunks/{uom-field-wrapper-NNhtGgqI.js → uom-field-wrapper-DoyshtE9.js} +2 -127
  48. package/dist/chunks/uom-field-wrapper-DoyshtE9.js.map +1 -0
  49. package/dist/chunks/{useAccountSetting-CAUDy8rg.esm.js → useAccountSetting-D1Ze8r-T.esm.js} +3 -3
  50. package/dist/chunks/{useAccountSetting-CAUDy8rg.esm.js.map → useAccountSetting-D1Ze8r-T.esm.js.map} +1 -1
  51. package/dist/chunks/{useAdditionalDiscountAutoCalc-DbyTG80U.esm.js → useAdditionalDiscountAutoCalc-PhSfzd5X.esm.js} +5 -5
  52. package/dist/chunks/{useAdditionalDiscountAutoCalc-DbyTG80U.esm.js.map → useAdditionalDiscountAutoCalc-PhSfzd5X.esm.js.map} +1 -1
  53. package/dist/chunks/{useAuth-BaUSGWbL.esm.js → useAuth-DhzbULWV.esm.js} +2 -2
  54. package/dist/chunks/{useAuth-BaUSGWbL.esm.js.map → useAuth-DhzbULWV.esm.js.map} +1 -1
  55. package/dist/chunks/{useLangauge-BUF4epYu.esm.js → useLangauge-CbMaEsdS.esm.js} +2 -2
  56. package/dist/chunks/{useLangauge-BUF4epYu.esm.js.map → useLangauge-CbMaEsdS.esm.js.map} +1 -1
  57. package/dist/components/index.esm.js +53 -53
  58. package/dist/components/index.js +4 -4
  59. package/dist/contexts/index.esm.js +3 -3
  60. package/dist/hooks/index.esm.js +5 -5
  61. package/dist/index.esm.js +90 -90
  62. package/dist/index.js +6 -6
  63. package/dist/layout/index.esm.js +2 -2
  64. package/dist/layout/index.js +1 -1
  65. package/dist/redux/index.esm.js +4 -4
  66. package/dist/utils/index.esm.js +7 -7
  67. package/dist/views/index.esm.js +9 -9
  68. package/dist/views/index.js +2 -2
  69. package/package.json +1 -1
  70. package/dist/chunks/android-12-switch-DM9s0XTb.js.map +0 -1
  71. package/dist/chunks/android-12-switch-eTZOAHAa.esm.js.map +0 -1
  72. package/dist/chunks/sidebarScreen-DbfP32Xx.esm.js.map +0 -1
  73. package/dist/chunks/sidebarScreen-figZp_Ln.js.map +0 -1
  74. package/dist/chunks/uom-field-wrapper-DKN31prP.esm.js.map +0 -1
  75. package/dist/chunks/uom-field-wrapper-NNhtGgqI.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { j as jsxRuntimeExports } from "./jsx-runtime-ClFauRgV.esm.js";
2
2
  import { t as internal_processStyles, a as _objectWithoutPropertiesLoose, E as styled$1, _ as _extends, d as capitalize, i as createTheme, w as isPlainObject, u as internal_serializeStyles, D as styleFunctionSx, B as resolveProps, p as formatMuiErrorMessage, e as clamp, P as PropTypes, s as handleBreakpoints, A as resolveBreakpointValues, j as createUnarySpacing, l as deepmerge, y as mergeBreakpointsInOrder, q as generateUtilityClass, r as getValue, n as defaultTheme$1, T as THEME_ID, v as interopRequireDefaultExports, I as useDefaultProps, b as alpha_1, x as lighten_1, k as darken_1 } from "./identifier-CEPqgYF0.esm.js";
3
- import { I as default_1$a, d as Button$1, p as Modal, S as SearchBar, w as Typography$1, _ as _inheritsLoose, Q as forceReflow, u as Transition, z as classNamesShape, e as ButtonBase, y as chainPropTypes, a6 as useTheme$4, a5 as useSlotProps, P as Paper, F as Fade, q as Modal$1, B as Backdrop, r as Portal, a1 as refType, H as HTMLElementType, G as Grow, h as FocusTrap, L as List, k as ListItem, v as TransitionGroup, Y as isHostComponent, N as elementTypeAcceptingRef, M as Menu$1, V as getReactElementRef, a3 as resolveComponentProps, a0 as o, a4 as useRtl, n as MenuItem$1, o as MenuList, D as Divider$1, T as TextField$2, t as Tooltip$1, J as default_1$c, E as default_1$d, f as ConfirmPopUp, g as DynamicInput, s as Toast, K as elementAcceptingRef, O as exactProp, c as Box$1, b as Avatar } from "./appbar-DtROOKgm.esm.js";
4
- import { l as useEnhancedEffect, r as requireCreateSvgIcon, T as Typography, e as default_1$b, q as useId, o as ownerDocument, p as useForkRef, m as useEventCallback, k as useControlled, u as unsupportedProp, f as ownerWindow, d as debounce$1, i as isMuiElement, j as useAuth } from "./useAuth-BaUSGWbL.esm.js";
3
+ import { I as default_1$a, d as Button$1, p as Modal, S as SearchBar, w as Typography$1, _ as _inheritsLoose, Q as forceReflow, u as Transition, z as classNamesShape, e as ButtonBase, y as chainPropTypes, a6 as useTheme$4, a5 as useSlotProps, P as Paper, F as Fade, q as Modal$1, B as Backdrop, r as Portal, a1 as refType, H as HTMLElementType, G as Grow, h as FocusTrap, L as List, k as ListItem, v as TransitionGroup, Y as isHostComponent, N as elementTypeAcceptingRef, M as Menu$1, V as getReactElementRef, a3 as resolveComponentProps, a0 as o, a4 as useRtl, n as MenuItem$1, o as MenuList, D as Divider$1, T as TextField$2, t as Tooltip$1, J as default_1$c, E as default_1$d, f as ConfirmPopUp, g as DynamicInput, s as Toast, K as elementAcceptingRef, O as exactProp, c as Box$1, b as Avatar } from "./appbar-5rP5iXcS.esm.js";
4
+ import { l as useEnhancedEffect, r as requireCreateSvgIcon, T as Typography, e as default_1$b, q as useId, o as ownerDocument, p as useForkRef, m as useEventCallback, k as useControlled, u as unsupportedProp, f as ownerWindow, d as debounce$1, i as isMuiElement, j as useAuth } from "./useAuth-DhzbULWV.esm.js";
5
5
  import { AccordionSummary, AccordionDetails, styled as styled$2, Accordion as Accordion$1, InputAdornment as InputAdornment$1, TextField as TextField$1, Box, CircularProgress, FormHelperText as FormHelperText$1, Select as Select$2, useTheme as useTheme$3, useMediaQuery as useMediaQuery$1, DialogTitle, IconButton as IconButton$1, Tabs as Tabs$1, Tab as Tab$1, MenuItem, DialogActions as DialogActions$1, Checkbox as Checkbox$1, Radio as Radio$1, RadioGroup, FormControlLabel, Tooltip, Divider, OutlinedInput as OutlinedInput$1, ListItemIcon, ListItemText, Grid, DialogContent as DialogContent$1, Stack as Stack$1, Autocomplete, Menu as Menu$3, Alert as Alert$1, FormControl as FormControl$1, Chip as Chip$2, Dialog as Dialog$1, Grow as Grow$1, Breadcrumbs, List as List$1, ListItem as ListItem$1, ListItemAvatar, Switch as Switch$1 } from "@mui/material";
6
6
  import { useDrag, useDrop } from "react-dnd";
7
7
  /* empty css */
@@ -12,29 +12,29 @@ import { Controller, useWatch, useFormContext, useForm, FormProvider } from "rea
12
12
  /* empty css */
13
13
  import { useTranslation } from "react-i18next";
14
14
  import { f as getDisplayName, e as extendSxProp, c as clsx, b as composeClasses, j as styled$3, g as generateUtilityClasses, d as createSvgIcon, h as require$$1, i as rootShouldForwardProp, r as reactIsExports, s as slotShouldForwardProp } from "./notification-DCKWI861.esm.js";
15
- import { C as Chip$1, M as Menu$2, t as transformTableColumns, f as formBuilderDeConversion } from "./form-builder-deconversion-CFtHF1hm.esm.js";
15
+ import { C as Chip$1, M as Menu$2, t as transformTableColumns, f as formBuilderDeConversion } from "./form-builder-deconversion-DNGMsAEj.esm.js";
16
16
  import * as Yup from "yup";
17
17
  import dayjs from "dayjs";
18
- import { $ as formatText, A as fetchApi, ab as getErrorMessage, aY as toFixedWithNumbers, af as getFileName, N as formatAmount, R as formatDate, X as formatLabel, S as SECTION_TYPES, aV as skuGenerator, G as fetchOptions, aw as getToken, aN as postV1Designation, aM as postV1DepartmentsTeams, aL as postV1Departments, a3 as generateFields, a4 as generateQueryString, aK as postImportSheet, am as getOperatorLabel, ac as getExcelExportTemplate, ar as getPdfExportTemplate, ad as getExcelTemplateGenerateTemplate, a5 as generateRandomId } from "./common-Nn4SUfK7.esm.js";
18
+ import { $ as formatText, A as fetchApi, p as checkUniqueFields, ab as getErrorMessage, aY as toFixedWithNumbers, af as getFileName, N as formatAmount, R as formatDate, X as formatLabel, S as SECTION_TYPES, aV as skuGenerator, G as fetchOptions, aw as getToken, aN as postV1Designation, aM as postV1DepartmentsTeams, aL as postV1Departments, a3 as generateFields, a4 as generateQueryString, aK as postImportSheet, am as getOperatorLabel, ac as getExcelExportTemplate, ar as getPdfExportTemplate, ad as getExcelTemplateGenerateTemplate, a5 as generateRandomId } from "./common-D59u5rE6.esm.js";
19
19
  import _, { sortBy, debounce as debounce$2, flatMap } from "lodash";
20
20
  import { Add as Add$1, Close, Upload, KeyboardArrowUp, KeyboardArrowDown as KeyboardArrowDown$1, Cancel, Share, Save as Save$1 } from "@mui/icons-material";
21
- import { a as useApi, f as usePages, b as useDeepMemo, u as useAccountingSetting, d as useLocationFilter } from "./useAccountSetting-CAUDy8rg.esm.js";
21
+ import { a as useApi, f as usePages, b as useDeepMemo, u as useAccountingSetting, d as useLocationFilter, g as usePermissions } from "./useAccountSetting-D1Ze8r-T.esm.js";
22
22
  import { v as viewTypes } from "./action-bar-BsXTcYpL.esm.js";
23
23
  import { QueryBuilder } from "react-querybuilder";
24
24
  import { QueryBuilderMaterial } from "@react-querybuilder/material";
25
- import { u as useLanguage } from "./useLangauge-BUF4epYu.esm.js";
25
+ import { u as useLanguage } from "./useLangauge-CbMaEsdS.esm.js";
26
26
  import { a as ArrowDown, T as Trash, d as CheckBoxIcon, t as RecgtangleIcon, F as FilledCircle, B as BlankCircle, M as MoreIcon, S as Save, g as Close$1, c as ArrowUpDown, E as Edit, m as FolderSave, b as ArrowDownTwo, k as Filter$1, l as FilterRemove, j as Export, D as DocumentDownload, n as Import } from "./trash-DDBuxxtn.esm.js";
27
27
  import { H as getV1CompanyId, bk as postV1PaymentTerms, be as postV1JournalTypes, bm as postV1SourceTypes, bj as postV1PartiesIndustry, b8 as postV1CategoryItems, b7 as postV1Brand, bc as postV1InventoryFixedAssetItems, bh as postV1Parties, bp as postV1WarehouseLocation, T as getV1FilterFilterTable, k as deleteV1FilterId, bq as putV1FilterId, U as getV1FilterResource, bb as postV1Filter } from "./api-BF3CyrPB.esm.js";
28
28
  import { a as auth } from "./api-config-GOys-syK.esm.js";
29
29
  import { enqueueSnackbar } from "notistack";
30
30
  import { a$ as routeToResourceMap } from "./route-page-map-H4_LYqag.esm.js";
31
- import { useNavigate, useLocation, Link } from "react-router-dom";
31
+ import { useNavigate, useLocation, Link, Navigate } from "react-router-dom";
32
32
  import { u as useAppDispatch, a as useAppSelector } from "./hooks-Cj9Yhy-E.esm.js";
33
33
  import { useDropzone } from "react-dropzone";
34
- import { i as initialFilter, d as defaultPageState } from "./page-context-BbQNncGA.esm.js";
34
+ import { i as initialFilter, d as defaultPageState } from "./page-context-BlGcwtdZ.esm.js";
35
35
  import { S as Search$1 } from "./tick-DGRjM86F.esm.js";
36
36
  import { useDispatch, useSelector } from "react-redux";
37
- import { o as setSharedPage, g as getAllUserAndDepartmentDropdown, i as pinToDashboardList, w as sharePage } from "./reducer-DRkUwBHb.esm.js";
37
+ import { o as setSharedPage, g as getAllUserAndDepartmentDropdown, i as pinToDashboardList, w as sharePage } from "./reducer-D6_f0R4C.esm.js";
38
38
  import ReactPhoneInput from "react-phone-input-2";
39
39
  import { useMaterialReactTable, MaterialReactTable } from "material-react-table";
40
40
  import { u as useTheme$1, a as useTheme$2, G as GlobalStyles } from "./CssBaseline-D1tufpxr.esm.js";
@@ -44,7 +44,7 @@ import { P as PathnameDocument } from "./modules-DIHbpV-p.esm.js";
44
44
  import { l as PathnameRental, b as PathnameCrm, k as PathnamePurchase, j as PathnameManufacturing, i as PathnameInventory, a as PathnameAccounting } from "./pathname.rental-BKwgwsUV.esm.js";
45
45
  import { b as PathnameHrms, c as PathnameUsers } from "./pathname.hrms-CWjGHE-w.esm.js";
46
46
  import parsePhoneNumberFromString from "libphonenumber-js";
47
- import { c as createParties } from "./actionCreator-C8cLIOap.esm.js";
47
+ import { c as createParties } from "./actionCreator-BzPZv2rR.esm.js";
48
48
  let cachedType;
49
49
  function detectScrollType() {
50
50
  if (cachedType) {
@@ -28909,6 +28909,7 @@ function CustomerVendorModal({
28909
28909
  const [contactRows, setContactRows] = useState([]);
28910
28910
  const [isCreating, setIsCreating] = useState(false);
28911
28911
  const [selectedCompanyData, setSelectedCompanyData] = useState([]);
28912
+ const lastCheckedValues = useRef({});
28912
28913
  const {
28913
28914
  control,
28914
28915
  formState: { errors },
@@ -28919,7 +28920,8 @@ function CustomerVendorModal({
28919
28920
  resetField,
28920
28921
  reset,
28921
28922
  watch,
28922
- getFieldState
28923
+ getFieldState,
28924
+ setError
28923
28925
  } = useForm({
28924
28926
  defaultValues: {
28925
28927
  status: true,
@@ -28957,6 +28959,39 @@ function CustomerVendorModal({
28957
28959
  control,
28958
28960
  name: `${PARTIES_FORM_ARRAY_NAME}.${PARTIES_FIELDS.EMAIL_IDS}`
28959
28961
  });
28962
+ const checkUniqueness = useCallback(async () => {
28963
+ const values = getValues();
28964
+ const formValues = values == null ? void 0 : values[PARTIES_FORM_ARRAY_NAME];
28965
+ const fieldsToCheck = ["crn", "email_ids", "company_name"];
28966
+ const allFields = ["crn", "email_ids", "contact_no", "company_name"];
28967
+ const nothingChanged = fieldsToCheck.every(
28968
+ (field) => lastCheckedValues.current[field] === (formValues == null ? void 0 : formValues[field])
28969
+ );
28970
+ if (nothingChanged) return true;
28971
+ const payload = {};
28972
+ allFields.forEach((field) => payload[field] = formValues == null ? void 0 : formValues[field]);
28973
+ const response = await checkUniqueFields(payload);
28974
+ let isUnique = true;
28975
+ for (const [field, exists] of Object.entries(response)) {
28976
+ if (exists) {
28977
+ setError(`${PARTIES_FORM_ARRAY_NAME}.${field}`, {
28978
+ type: "manual",
28979
+ message: `${field.replace(/_/g, " ").toLowerCase()} already exists`
28980
+ });
28981
+ isUnique = false;
28982
+ }
28983
+ }
28984
+ lastCheckedValues.current = { ...formValues };
28985
+ return isUnique;
28986
+ }, [getValues, setError]);
28987
+ const handleFieldBlur = useCallback(
28988
+ async (fieldName) => {
28989
+ const uniquenessFields = ["crn", "email_ids", "company_name"];
28990
+ if (!uniquenessFields.includes(fieldName)) return;
28991
+ await checkUniqueness();
28992
+ },
28993
+ [checkUniqueness]
28994
+ );
28960
28995
  const tableColumns = useCallback(
28961
28996
  (columns, tableRows) => {
28962
28997
  const phoneNumberCache = /* @__PURE__ */ new Map();
@@ -29163,6 +29198,8 @@ ${val}`;
29163
29198
  var _a, _b, _c, _d;
29164
29199
  const isValid = await trigger();
29165
29200
  if (!isValid) return;
29201
+ const isUnique = await checkUniqueness();
29202
+ if (!isUnique) return;
29166
29203
  const values = getValues();
29167
29204
  const formValues = values == null ? void 0 : values[PARTIES_FORM_ARRAY_NAME];
29168
29205
  let emailArray = [];
@@ -29357,7 +29394,8 @@ ${val}`;
29357
29394
  placeholder: t("common.party.fields.company_name_placeholder"),
29358
29395
  fieldArrayName: PARTIES_FORM_ARRAY_NAME,
29359
29396
  formControl: control,
29360
- required: true
29397
+ required: true,
29398
+ onBlur: () => handleFieldBlur(PARTIES_FIELDS.COMPANY_NAME)
29361
29399
  }
29362
29400
  ) }),
29363
29401
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, sm: 6, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -29379,7 +29417,8 @@ ${val}`;
29379
29417
  placeholder: t("common.party.fields.crn_placeholder"),
29380
29418
  fieldArrayName: PARTIES_FORM_ARRAY_NAME,
29381
29419
  formControl: control,
29382
- max: 10
29420
+ max: 10,
29421
+ onBlur: () => handleFieldBlur(PARTIES_FIELDS.CRN)
29383
29422
  }
29384
29423
  ) })
29385
29424
  ] }),
@@ -29403,7 +29442,8 @@ ${val}`;
29403
29442
  placeholder: t("common.party.fields.email_placeholder"),
29404
29443
  fieldArrayName: PARTIES_FORM_ARRAY_NAME,
29405
29444
  formControl: control,
29406
- required: true
29445
+ required: true,
29446
+ onBlur: () => handleFieldBlur(PARTIES_FIELDS.EMAIL_IDS)
29407
29447
  }
29408
29448
  ) }),
29409
29449
  /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, sm: 6, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -41354,6 +41394,129 @@ const ModuleTile = (props) => {
41354
41394
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { type: "s3", className: "module-label", children: props.module.label })
41355
41395
  ] }) });
41356
41396
  };
41397
+ const ProtectedRoute = ({
41398
+ module,
41399
+ action,
41400
+ multiModule,
41401
+ complexPermissions,
41402
+ customPermissionCheck,
41403
+ redirectTo = "/403",
41404
+ showError = true,
41405
+ children
41406
+ }) => {
41407
+ const permissions = usePermissions();
41408
+ const hasPermission = useMemo(() => {
41409
+ if (!permissions) {
41410
+ return false;
41411
+ }
41412
+ if (customPermissionCheck) {
41413
+ return customPermissionCheck(permissions);
41414
+ }
41415
+ if (complexPermissions) {
41416
+ const { permissions: permList, operator = "AND" } = complexPermissions;
41417
+ const results = permList.map(({ module: mod, action: act }) => {
41418
+ const modulePerms = _.get(permissions, mod, {});
41419
+ return modulePerms[act] ?? false;
41420
+ });
41421
+ return operator === "AND" ? results.every(Boolean) : results.some(Boolean);
41422
+ }
41423
+ if (multiModule) {
41424
+ const { modules, action: act, operator = "OR" } = multiModule;
41425
+ const results = modules.map((mod) => {
41426
+ const modulePerms = _.get(permissions, mod, {});
41427
+ return modulePerms[act] ?? false;
41428
+ });
41429
+ return operator === "AND" ? results.every(Boolean) : results.some(Boolean);
41430
+ }
41431
+ if (module && action) {
41432
+ const modulePerms = _.get(permissions, module, {});
41433
+ return modulePerms[action] ?? false;
41434
+ }
41435
+ return false;
41436
+ }, [permissions, module, action, multiModule, complexPermissions, customPermissionCheck]);
41437
+ const ErrorComponent = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(
41438
+ Box,
41439
+ {
41440
+ sx: {
41441
+ display: "flex",
41442
+ flexDirection: "column",
41443
+ justifyContent: "center",
41444
+ alignItems: "center",
41445
+ position: "absolute",
41446
+ top: "50%",
41447
+ left: "50%",
41448
+ transform: "translate(-50%, -50%)",
41449
+ // Fixed transform values
41450
+ gap: 2,
41451
+ textAlign: "center",
41452
+ p: 3
41453
+ },
41454
+ children: [
41455
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
41456
+ Typography,
41457
+ {
41458
+ type: "h1",
41459
+ color: "theme.secondary.900",
41460
+ weight: "bold",
41461
+ sx: { fontSize: { xs: "4rem", sm: "6rem" } },
41462
+ children: "403"
41463
+ }
41464
+ ),
41465
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
41466
+ Divider,
41467
+ {
41468
+ flexItem: true
41469
+ }
41470
+ ),
41471
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
41472
+ Typography,
41473
+ {
41474
+ type: "s3",
41475
+ color: "theme.secondary.900",
41476
+ weight: "medium",
41477
+ children: "Access Denied"
41478
+ }
41479
+ ),
41480
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
41481
+ Typography,
41482
+ {
41483
+ type: "body2",
41484
+ color: "theme.secondary.700",
41485
+ weight: "regular",
41486
+ sx: { mt: 1, maxWidth: "300px" },
41487
+ children: "You don't have the required permissions to access this resource."
41488
+ }
41489
+ )
41490
+ ]
41491
+ }
41492
+ );
41493
+ if (!permissions || Object.keys(permissions).length === 0) {
41494
+ return null;
41495
+ }
41496
+ if (hasPermission) {
41497
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
41498
+ }
41499
+ return showError ? /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorComponent, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(Navigate, { to: redirectTo, replace: true });
41500
+ };
41501
+ const createPermissionConfig = {
41502
+ // Single module
41503
+ single: (module, action) => ({
41504
+ module,
41505
+ action
41506
+ }),
41507
+ // Multiple modules with same action
41508
+ multiModule: (modules, action, operator = "OR") => ({
41509
+ multiModule: { modules, action, operator }
41510
+ }),
41511
+ // Complex permissions
41512
+ complex: (permissions, operator = "AND") => ({
41513
+ complexPermissions: { permissions, operator }
41514
+ }),
41515
+ // Custom function
41516
+ custom: (checkFn) => ({
41517
+ customPermissionCheck: checkFn
41518
+ })
41519
+ };
41357
41520
  const Android12Switch = styled$2(Switch$1)(({ theme }) => ({
41358
41521
  padding: 8,
41359
41522
  "& .MuiSwitch-track": {
@@ -41426,38 +41589,40 @@ export {
41426
41589
  PageNavigator as a0,
41427
41590
  Pagination as a1,
41428
41591
  PhoneInput as a2,
41429
- Radio as a3,
41430
- RemoveAction as a4,
41431
- RemoveGroupAction as a5,
41432
- SaveFilterModal as a6,
41433
- SearchableSelect as a7,
41434
- Select$1 as a8,
41435
- SharePopUp as a9,
41436
- SharedPageModal as aa,
41437
- SharedPageView as ab,
41438
- SourceTypeAddModal as ac,
41439
- SwitchBase as ad,
41440
- Tab as ae,
41441
- TabBar as af,
41442
- TabContext as ag,
41443
- TabList as ah,
41444
- TabPanel$1 as ai,
41445
- TimePicker2 as aj,
41446
- TitleDropdownButton as ak,
41447
- Toggle as al,
41448
- ToggleSwitch as am,
41449
- UploadExcel as an,
41450
- UploadMedia as ao,
41451
- ValueEditor as ap,
41452
- ViewModal as aq,
41453
- createApiThunk as ar,
41454
- default_1$4 as as,
41455
- default_1$9 as at,
41456
- default_1$2 as au,
41457
- default_1$5 as av,
41458
- dynamicSelectAdd as aw,
41459
- useThemeProps as ax,
41460
- userRoles as ay,
41592
+ ProtectedRoute as a3,
41593
+ Radio as a4,
41594
+ RemoveAction as a5,
41595
+ RemoveGroupAction as a6,
41596
+ SaveFilterModal as a7,
41597
+ SearchableSelect as a8,
41598
+ Select$1 as a9,
41599
+ userRoles as aA,
41600
+ SharePopUp as aa,
41601
+ SharedPageModal as ab,
41602
+ SharedPageView as ac,
41603
+ SourceTypeAddModal as ad,
41604
+ SwitchBase as ae,
41605
+ Tab as af,
41606
+ TabBar as ag,
41607
+ TabContext as ah,
41608
+ TabList as ai,
41609
+ TabPanel$1 as aj,
41610
+ TimePicker2 as ak,
41611
+ TitleDropdownButton as al,
41612
+ Toggle as am,
41613
+ ToggleSwitch as an,
41614
+ UploadExcel as ao,
41615
+ UploadMedia as ap,
41616
+ ValueEditor as aq,
41617
+ ViewModal as ar,
41618
+ createApiThunk as as,
41619
+ createPermissionConfig as at,
41620
+ default_1$4 as au,
41621
+ default_1$9 as av,
41622
+ default_1$2 as aw,
41623
+ default_1$5 as ax,
41624
+ dynamicSelectAdd as ay,
41625
+ useThemeProps as az,
41461
41626
  AddFilterButton as b,
41462
41627
  AddGroupButton as c,
41463
41628
  AddPage as d,
@@ -41484,4 +41649,4 @@ export {
41484
41649
  DynamicRadioButton as y,
41485
41650
  DynamicSearchSelect as z
41486
41651
  };
41487
- //# sourceMappingURL=android-12-switch-eTZOAHAa.esm.js.map
41652
+ //# sourceMappingURL=android-12-switch-DpJE56Wi.esm.js.map