@erpsquad/common 1.10.71 → 1.10.73

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 (76) hide show
  1. package/dist/chunks/{ERPUIProvider-DUOrclB1.js → ERPUIProvider-BPpcQgND.js} +6 -5
  2. package/dist/chunks/ERPUIProvider-BPpcQgND.js.map +1 -0
  3. package/dist/chunks/{ERPUIProvider-BjGiWErz.esm.js → ERPUIProvider-DZbxFsRb.esm.js} +6 -5
  4. package/dist/chunks/ERPUIProvider-DZbxFsRb.esm.js.map +1 -0
  5. package/dist/chunks/{android-12-switch-DBMpexMb.esm.js → android-12-switch-DSM1b9TA.esm.js} +6 -6
  6. package/dist/chunks/{android-12-switch-DBMpexMb.esm.js.map → android-12-switch-DSM1b9TA.esm.js.map} +1 -1
  7. package/dist/chunks/{android-12-switch-8FZt3_su.js → android-12-switch-DcPr9cvn.js} +6 -6
  8. package/dist/chunks/{android-12-switch-8FZt3_su.js.map → android-12-switch-DcPr9cvn.js.map} +1 -1
  9. package/dist/chunks/{appbar-DUsqcqhx.js → appbar-Bf_GaMVY.js} +3 -3
  10. package/dist/chunks/{appbar-DUsqcqhx.js.map → appbar-Bf_GaMVY.js.map} +1 -1
  11. package/dist/chunks/{appbar-B9_uWANQ.esm.js → appbar-DDijzrAm.esm.js} +3 -3
  12. package/dist/chunks/{appbar-B9_uWANQ.esm.js.map → appbar-DDijzrAm.esm.js.map} +1 -1
  13. package/dist/chunks/{checkbox-DnQs7CJp.esm.js → checkbox-C5oERyEy.esm.js} +3 -3
  14. package/dist/chunks/{checkbox-DnQs7CJp.esm.js.map → checkbox-C5oERyEy.esm.js.map} +1 -1
  15. package/dist/chunks/{checkbox-Dn9rJCo7.js → checkbox-Jgx2gkFF.js} +3 -3
  16. package/dist/chunks/{checkbox-Dn9rJCo7.js.map → checkbox-Jgx2gkFF.js.map} +1 -1
  17. package/dist/chunks/{default-data-SL7vE9s3.js → default-data-CmARVEBW.js} +6 -6
  18. package/dist/chunks/{default-data-SL7vE9s3.js.map → default-data-CmARVEBW.js.map} +1 -1
  19. package/dist/chunks/{default-data-CT8SRoZj.esm.js → default-data-DSbmaVFY.esm.js} +6 -6
  20. package/dist/chunks/{default-data-CT8SRoZj.esm.js.map → default-data-DSbmaVFY.esm.js.map} +1 -1
  21. package/dist/chunks/{fullScreen-CgWfXef3.esm.js → fullScreen-B73ASpXc.esm.js} +2 -2
  22. package/dist/chunks/{fullScreen-CgWfXef3.esm.js.map → fullScreen-B73ASpXc.esm.js.map} +1 -1
  23. package/dist/chunks/{fullScreen-CBLaTtul.js → fullScreen-GATqKdsG.js} +2 -2
  24. package/dist/chunks/{fullScreen-CBLaTtul.js.map → fullScreen-GATqKdsG.js.map} +1 -1
  25. package/dist/chunks/{modules-DEtfCF0Q.js → modules-0TgSOLkZ.js} +2 -2
  26. package/dist/chunks/{modules-DEtfCF0Q.js.map → modules-0TgSOLkZ.js.map} +1 -1
  27. package/dist/chunks/{modules-vCRpCUq6.esm.js → modules-CDt6nd-Q.esm.js} +2 -2
  28. package/dist/chunks/{modules-vCRpCUq6.esm.js.map → modules-CDt6nd-Q.esm.js.map} +1 -1
  29. package/dist/chunks/{page-context-DR9FWSjI.esm.js → page-context-C_YWMVhh.esm.js} +8 -3
  30. package/dist/chunks/page-context-C_YWMVhh.esm.js.map +1 -0
  31. package/dist/chunks/{page-context-C7YuOn6E.js → page-context-_AMJB_ty.js} +8 -3
  32. package/dist/chunks/{page-context-DR9FWSjI.esm.js.map → page-context-_AMJB_ty.js.map} +1 -1
  33. package/dist/chunks/{route-page-map-B5JTClV2.js → route-page-map-BMisO6c3.js} +4 -4
  34. package/dist/chunks/route-page-map-BMisO6c3.js.map +1 -0
  35. package/dist/chunks/{route-page-map-D0mD4Ap5.esm.js → route-page-map-CwkJKqEq.esm.js} +4 -4
  36. package/dist/chunks/route-page-map-CwkJKqEq.esm.js.map +1 -0
  37. package/dist/chunks/{sidebar-CfW9jEHs.esm.js → sidebar-CGU3tdez.esm.js} +2 -2
  38. package/dist/chunks/{sidebar-CfW9jEHs.esm.js.map → sidebar-CGU3tdez.esm.js.map} +1 -1
  39. package/dist/chunks/{sidebar-CTnAl3Mf.js → sidebar-CobitAdp.js} +2 -2
  40. package/dist/chunks/{sidebar-CTnAl3Mf.js.map → sidebar-CobitAdp.js.map} +1 -1
  41. package/dist/chunks/{sidebarScreen-Cbqswa48.js → sidebarScreen-Kh58mSpF.js} +3 -3
  42. package/dist/chunks/{sidebarScreen-Cbqswa48.js.map → sidebarScreen-Kh58mSpF.js.map} +1 -1
  43. package/dist/chunks/{sidebarScreen-BINtOlZh.esm.js → sidebarScreen-R_SLQJpq.esm.js} +3 -3
  44. package/dist/chunks/{sidebarScreen-BINtOlZh.esm.js.map → sidebarScreen-R_SLQJpq.esm.js.map} +1 -1
  45. package/dist/chunks/{uom-field-wrapper-Rjqn9-H7.js → uom-field-wrapper-BAFOTp35.js} +46 -36
  46. package/dist/chunks/uom-field-wrapper-BAFOTp35.js.map +1 -0
  47. package/dist/chunks/{uom-field-wrapper-B_hEFzVR.esm.js → uom-field-wrapper-Dke2cTpR.esm.js} +46 -36
  48. package/dist/chunks/uom-field-wrapper-Dke2cTpR.esm.js.map +1 -0
  49. package/dist/chunks/{useAddressContact-BqS66jS8.js → useAddressContact-DRv6rxkI.js} +20 -7
  50. package/dist/chunks/{useAddressContact-BqS66jS8.js.map → useAddressContact-DRv6rxkI.js.map} +1 -1
  51. package/dist/chunks/{useAddressContact-DfKTLjAf.esm.js → useAddressContact-jJ8XlmC_.esm.js} +21 -8
  52. package/dist/chunks/{useAddressContact-DfKTLjAf.esm.js.map → useAddressContact-jJ8XlmC_.esm.js.map} +1 -1
  53. package/dist/components/address-modal/address-modal.d.ts +1 -0
  54. package/dist/components/index.esm.js +7 -7
  55. package/dist/components/index.js +7 -7
  56. package/dist/constants/index.esm.js +2 -2
  57. package/dist/constants/index.js +2 -2
  58. package/dist/contexts/index.esm.js +1 -1
  59. package/dist/contexts/index.js +1 -1
  60. package/dist/hooks/index.esm.js +3 -3
  61. package/dist/hooks/index.js +3 -3
  62. package/dist/index.esm.js +13 -13
  63. package/dist/index.js +13 -13
  64. package/dist/layout/index.esm.js +2 -2
  65. package/dist/layout/index.js +2 -2
  66. package/dist/src/components/address-modal/address-modal.d.ts +1 -0
  67. package/dist/views/index.esm.js +7 -7
  68. package/dist/views/index.js +6 -6
  69. package/package.json +1 -1
  70. package/dist/chunks/ERPUIProvider-BjGiWErz.esm.js.map +0 -1
  71. package/dist/chunks/ERPUIProvider-DUOrclB1.js.map +0 -1
  72. package/dist/chunks/page-context-C7YuOn6E.js.map +0 -1
  73. package/dist/chunks/route-page-map-B5JTClV2.js.map +0 -1
  74. package/dist/chunks/route-page-map-D0mD4Ap5.esm.js.map +0 -1
  75. package/dist/chunks/uom-field-wrapper-B_hEFzVR.esm.js.map +0 -1
  76. package/dist/chunks/uom-field-wrapper-Rjqn9-H7.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
3
3
  const React = require("react");
4
- const appbar = require("./appbar-DUsqcqhx.js");
5
- const sidebar = require("./sidebar-CTnAl3Mf.js");
4
+ const appbar = require("./appbar-Bf_GaMVY.js");
5
+ const sidebar = require("./sidebar-CobitAdp.js");
6
6
  const mui_constants = require("./mui.constants-CJEIUmWO.js");
7
7
  const useLangauge = require("./useLangauge-C_Z9sEw7.js");
8
8
  const common = require("./common-BtIKVrzA.js");
@@ -196,4 +196,4 @@ const SidebarLayout = (props) => {
196
196
  );
197
197
  };
198
198
  exports.SidebarLayout = SidebarLayout;
199
- //# sourceMappingURL=sidebarScreen-Cbqswa48.js.map
199
+ //# sourceMappingURL=sidebarScreen-Kh58mSpF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebarScreen-Cbqswa48.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\nimport ChatBot from '../../components/chat-bot/chat-bot';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\t// setOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t\t<ChatBot />\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["useTheme","useLanguage","useMemo","useState","useLocation","useCallback","getToken","getV1Settings","useEffect","jsx","Box","jsxs","AppBar","drawerWidth","SideBar","ActivityArea","ChatBot"],"mappings":";;;;;;;;;;AAkBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQA,OAAAA,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoBC,wBAAA;AAC5B,QAAM,QAAQC,MAAAA;AAAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAIA,MAAAA,SAAS,KAAK;AACxD,QAAM,WAAWC,eAAAA,YAAA;AACjB,QAAM,cAAcF,MAAAA,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmBG,MAAAA,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QAAQ,kBAAkB,MAAM;AAAA,IACrD,SAAS,OAAO;AACf,cAAQ,KAAK,gDAAgD,KAAK;AAAA,IACnE;AAAA,EACD,GAAG,CAAA,CAAE;AAEL,QAAM,oBAAoBA,MAAAA,YAAY,MAAM;AAC3C,kBAAc,KAAK;AACnB,WAAO,aAAa,QAAQ,mBAAmB,OAAO;AAAA,EACvD,GAAG,CAAA,CAAE;AAEL,QAAM,CAAC,iBAAiB,kBAAkB,IAAIF,MAAAA,SAAc,IAAI;AAEhE,QAAM,cAAcE,MAAAA,YAAY,YAAY;;AAE3C,UAAM,YAAYC,O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,UACX,YAAY;AAAA,UACZ,gBAAgB;AAAA,QAAA;AAAA,QAGjB,UAAAD,2BAAAA,kBAAAA,IAACC,OAAAA,OAAI,UAAA,aAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlB;AAEA,SACCC,2BAAAA,kBAAAA;AAAAA,IAACD,OAAAA;AAAAA,IAAA;AAAA,MACA,IAAI;AAAA,QACH,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,2BAAAA,kBAAAA;AAAAA,UAACG,OAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOC,cAAAA;AAAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDJ,2BAAAA,kBAAAA;AAAAA,UAACK,QAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOD,cAAAA;AAAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBJ,2BAAAA,kBAAAA;AAAAA,UAACM,OAAAA;AAAAA,UAAA;AAAA,YACA;AAAA,YAAA,aACAF,cAAAA;AAAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,yDAEPG,OAAAA,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;;"}
1
+ {"version":3,"file":"sidebarScreen-Kh58mSpF.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\nimport ChatBot from '../../components/chat-bot/chat-bot';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\t// setOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t\t<ChatBot />\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["useTheme","useLanguage","useMemo","useState","useLocation","useCallback","getToken","getV1Settings","useEffect","jsx","Box","jsxs","AppBar","drawerWidth","SideBar","ActivityArea","ChatBot"],"mappings":";;;;;;;;;;AAkBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQA,OAAAA,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoBC,wBAAA;AAC5B,QAAM,QAAQC,MAAAA;AAAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAIA,MAAAA,SAAS,KAAK;AACxD,QAAM,WAAWC,eAAAA,YAAA;AACjB,QAAM,cAAcF,MAAAA,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmBG,MAAAA,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QAAQ,kBAAkB,MAAM;AAAA,IACrD,SAAS,OAAO;AACf,cAAQ,KAAK,gDAAgD,KAAK;AAAA,IACnE;AAAA,EACD,GAAG,CAAA,CAAE;AAEL,QAAM,oBAAoBA,MAAAA,YAAY,MAAM;AAC3C,kBAAc,KAAK;AACnB,WAAO,aAAa,QAAQ,mBAAmB,OAAO;AAAA,EACvD,GAAG,CAAA,CAAE;AAEL,QAAM,CAAC,iBAAiB,kBAAkB,IAAIF,MAAAA,SAAc,IAAI;AAEhE,QAAM,cAAcE,MAAAA,YAAY,YAAY;;AAE3C,UAAM,YAAYC,OAAAA,SAAA;AAClB,UAAM,YAAY;AAAA,MACjB,WAAW,UAAU,SAAS;AAAA,MAC9B,cAAc,OAAO,U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,OAAAA,OAAI,UAAA,aAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlB;AAEA,SACCC,2BAAAA,kBAAAA;AAAAA,IAACD,OAAAA;AAAAA,IAAA;AAAA,MACA,IAAI;AAAA,QACH,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,2BAAAA,kBAAAA;AAAAA,UAACG,OAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOC,cAAAA;AAAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDJ,2BAAAA,kBAAAA;AAAAA,UAACK,QAAAA;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAOD,cAAAA;AAAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBJ,2BAAAA,kBAAAA;AAAAA,UAACM,OAAAA;AAAAA,UAAA;AAAA,YACA;AAAA,YAAA,aACAF,cAAAA;AAAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,yDAEPG,OAAAA,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;;"}
@@ -1,7 +1,7 @@
1
1
  import { j as jsxRuntimeExports } from "./jsx-runtime-ClFauRgV.esm.js";
2
2
  import { useMemo, useState, useCallback, useEffect } from "react";
3
- import { u as useTheme, B as Box, a as AppBarWrapper, A as ActivityArea, C as ChatBot } from "./appbar-B9_uWANQ.esm.js";
4
- import { S as Sidebar } from "./sidebar-CfW9jEHs.esm.js";
3
+ import { u as useTheme, B as Box, a as AppBarWrapper, A as ActivityArea, C as ChatBot } from "./appbar-DDijzrAm.esm.js";
4
+ import { S as Sidebar } from "./sidebar-CGU3tdez.esm.js";
5
5
  import { d as drawerWidth } from "./mui.constants-BFBzxaiA.esm.js";
6
6
  import { u as useLanguage } from "./useLangauge-P-Sc0U-O.esm.js";
7
7
  import { at as getToken } from "./common-D8YIf-p0.esm.js";
@@ -197,4 +197,4 @@ const SidebarLayout = (props) => {
197
197
  export {
198
198
  SidebarLayout as S
199
199
  };
200
- //# sourceMappingURL=sidebarScreen-BINtOlZh.esm.js.map
200
+ //# sourceMappingURL=sidebarScreen-R_SLQJpq.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebarScreen-BINtOlZh.esm.js","sources":["../../src/layout/sidebarScreen/sidebarScreen.tsx"],"sourcesContent":["import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\nimport ChatBot from '../../components/chat-bot/chat-bot';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\t// setOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t\t\t{props.children}\n\t\t\t</ActivityArea>\n\t\t\t<ChatBot />\n\t\t</Box>\n\t);\n};\n\nexport default SidebarLayout;\n"],"names":["jsx","jsxs","AppBar","SideBar"],"mappings":";;;;;;;;;AAkBA,MAAM,mBAAmB;AASlB,MAAM,gBAAgB,CAAC,UAA+B;AAC5D,QAAM,QAAQ,SAAA;AACd,QAAM,EAAE,gBAAA,IAAoB,YAAA;AAC5B,QAAM,QAAQ;AAAA,IACb,OAAM,mDAAiB,eAAc;AAAA,IACrC,CAAC,eAAe;AAAA,EAAA;AAGjB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,IAAI;AACjD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,WAAW,YAAA;AACjB,QAAM,cAAc,QAAQ,MAAM,SAAS,UAAU,CAAC,SAAS,QAAQ,CAAC;AAGxE,QAAM,eAAe,cAAe,CAAC,cAAc;AAGnD,QAAM,mBAAmB,YAAY,MAAM;AAC1C,kBAAc,IAAI;AAClB,iBAAa,KAAK;AAClB,QAAI;AACH,aAAO,aAAa,QAAQ,kBAAkB,MAAM;AAA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import { useEffect, useState, useCallback, useMemo } from 'react';\n\nimport { useTheme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\n\nimport AppBar from '../../components/appbar/appbar';\nimport SideBar from '../../components/sidebar/sidebar';\nimport ActivityArea from '../../components/activityArea/activityArea';\nimport ChatBot from '../../components/chat-bot/chat-bot';\n\nimport drawerWidth from '../../constants/mui.constants';\n// const drawerWidth = 240;\nimport { useLanguage } from '../../hooks/useLangauge';\nimport { getToken } from '@/utils';\nimport { getV1Settings } from '../../api-client/api.manufacturing/api';\nimport { useLocation } from 'react-router-dom';\n\n// Local storage key for drawer state\nconst DRAWER_STATE_KEY = '_is_drawer_open';\n\n// Interface for better type safety\nexport interface ISidebarLayoutProps {\n\tmenu: any[];\n\tchildren: React.ReactNode;\n\tdashboardPath?: string;\n}\n\nexport const SidebarLayout = (props: ISidebarLayoutProps) => {\n\tconst theme = useTheme();\n\tconst { currentLanguage } = useLanguage();\n\tconst isRtl = useMemo(\n\t\t() => currentLanguage?.direction === 'rtl',\n\t\t[currentLanguage]\n\t);\n\t// Enhanced state management\n\tconst [forcedOpen, setForcedOpen] = useState(true);\n\tconst [hoverOpen, setHoverOpen] = useState(false);\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tconst location = useLocation();\n\tconst curPathName = useMemo(() => location.pathname, [location.pathname])\n\n\t// Memoized computed state for actual drawer open status\n\tconst isDrawerOpen = forcedOpen || (!forcedOpen && hoverOpen);\n\n\t// Enhanced drawer control functions with better state management\n\tconst handleDrawerOpen = useCallback(() => {\n\t\tsetForcedOpen(true);\n\t\tsetHoverOpen(false); // Clear hover state when forcing open\n\t\ttry {\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to save drawer state to localStorage:', error);\n\t\t}\n\t}, []);\n\n\tconst handleDrawerClose = useCallback(() => {\n\t\tsetForcedOpen(false);\n\t\twindow.localStorage.setItem('_is_drawer_open', 'false');\n\t}, []);\n\n\tconst [wipSettingsData, setWipSettingsData] = useState<any>(null);\n\n\tconst getSettings = useCallback(async () => {\n\t\t// getToken returns { \"x-token\": string; \"x-timezone\": number }, but API expects string type for \"x-timezone\"\n\t\tconst tokenData = getToken();\n\t\tconst apiParams = {\n\t\t\t'x-token': tokenData['x-token'],\n\t\t\t'x-timezone': String(tokenData['x-timezone'])\n\t\t};\n\t\tconst response = await getV1Settings(apiParams);\n\t\t// The \"data\" property may not exist on GetV1SettingsResponses, so check existence safely\n\t\tconst data = (response && (response as any)?.data?.settings?.[0]) || null;\n\t\tsetWipSettingsData(data);\n\t\tlocalStorage.setItem('wip_settings_data', JSON.stringify(data));\n\t}, []);\n\tuseEffect(() => {\n\t\tif(curPathName?.includes('manufacturing')) {\n\t\t\tgetSettings();\n\t\t}\n\t}, [getSettings, curPathName]);\n\n\tconst [manufacturingSubmenu, setManufacturingSubmenu] = useState<any>(\n\t\tprops.menu\n\t);\n\n\tuseEffect(() => {\n\t\tif (wipSettingsData && Array.isArray(props?.menu)) {\n\t\t\tconsole.log('wipSettingsData: ', wipSettingsData);\n\t\t\tconst _new = props.menu.filter((item) => {\n\t\t\t\tif (!wipSettingsData?.enable_production_planning) {\n\t\t\t\t\treturn item.label !== 'Plans';\n\t\t\t\t} else {\n\t\t\t\t\treturn item;\n\t\t\t\t}\n\t\t\t});\n\t\t\tsetManufacturingSubmenu(_new);\n\t\t}\n\t}, [wipSettingsData, props.menu]);\n\t// const module_type = '';\n\n\tconst handleMouseEnter = () => {\n\t\tif (!forcedOpen) {\n\t\t\t// setOpen(true);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'true');\n\t\t}\n\t};\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (!forcedOpen && isInitialized) {\n\t\t\tsetHoverOpen(false);\n\t\t\twindow.localStorage.setItem(DRAWER_STATE_KEY, 'false');\n\t\t}\n\t}, [forcedOpen, isInitialized]);\n\n\t// Toggle function for programmatic control\n\tconst toggleDrawer = useCallback(() => {\n\t\tif (forcedOpen) {\n\t\t\thandleDrawerClose();\n\t\t} else {\n\t\t\thandleDrawerOpen();\n\t\t}\n\t}, [forcedOpen, handleDrawerClose, handleDrawerOpen]);\n\n\t// Enhanced initialization with error handling\n\tuseEffect(() => {\n\t\tconst initializeDrawerState = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\tsetHoverOpen(false); // Ensure hover state is reset\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t} else {\n\t\t\t\t\t// Fallback for environments without localStorage\n\t\t\t\t\tsetForcedOpen(true);\n\t\t\t\t\tsetIsInitialized(true);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to read drawer state from localStorage:', error);\n\t\t\t\t// Fallback to default state\n\t\t\t\tsetForcedOpen(true);\n\t\t\t\tsetIsInitialized(true);\n\t\t\t}\n\t\t};\n\n\t\tinitializeDrawerState();\n\t}, []);\n\n\t// Handle window focus to sync state across tabs\n\tuseEffect(() => {\n\t\tconst handleWindowFocus = () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window !== 'undefined' && window.localStorage) {\n\t\t\t\t\tconst savedState = window.localStorage.getItem(DRAWER_STATE_KEY);\n\t\t\t\t\tconst shouldBeOpen = savedState === 'true';\n\n\t\t\t\t\tif (shouldBeOpen !== forcedOpen) {\n\t\t\t\t\t\tsetForcedOpen(shouldBeOpen);\n\t\t\t\t\t\tsetHoverOpen(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('Failed to sync drawer state on window focus:', error);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener('focus', handleWindowFocus);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener('focus', handleWindowFocus);\n\t\t};\n\t}, [forcedOpen]);\n\n\t// Prevent rendering until initialization is complete\n\tif (!isInitialized) {\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tminHeight: '100vh',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'center'\n\t\t\t\t}}>\n\t\t\t\t{/* Optional loading indicator */}\n\t\t\t\t<Box>Loading...</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Box\n\t\t\tsx={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tminHeight: '100vh',\n\t\t\t\tdirection: isRtl ? 'rtl' : 'ltr'\n\t\t\t}}>\n\t\t\t<AppBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t/>\n\n\t\t\t<SideBar\n\t\t\t\topen={forcedOpen}\n\t\t\t\tforcedOpen={forcedOpen}\n\t\t\t\thoverOpen={hoverOpen}\n\t\t\t\thandleDrawerClose={handleDrawerClose}\n\t\t\t\thandleDrawerOpen={handleDrawerOpen}\n\t\t\t\ttoggleDrawer={toggleDrawer}\n\t\t\t\twidth={drawerWidth}\n\t\t\t\ttheme={theme}\n\t\t\t\tmenu={manufacturingSubmenu}\n\t\t\t\thandleMouseEnter={handleMouseEnter}\n\t\t\t\thandleMouseLeave={handleMouseLeave}\n\t\t\t\tisInitialized={isInitialized}\n\t\t\t\tdashboardPath={props.dashboardPath}\n\t\t\t/>\n\n\t\t\t<ActivityArea\n\t\t\t\tisDrawerOpen={isDrawerOpen}\n\t\t\t\tdrawerWidth={drawerWidth}\n\t\t\t\tforcedOpen={forcedOpen}>\n\t\t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W,QAAQ,QAAQ;AAAA,MAAA;AAAA,MAE5B,UAAA;AAAA,QAAAD,kCAAAA;AAAAA,UAACE;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDF,kCAAAA;AAAAA,UAACG;AAAAA,UAAA;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP;AAAA,YACA,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA,eAAe,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAGtBH,kCAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACC,UAAA,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,8CAEP,SAAA,CAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -3,8 +3,8 @@ const jsxRuntime = require("./jsx-runtime-B6vEU3CM.js");
3
3
  const reactHookForm = require("react-hook-form");
4
4
  const identifier = require("./identifier-CaTy7Osd.js");
5
5
  const useAuth = require("./useAuth-DtiC6c_b.js");
6
- const android12Switch = require("./android-12-switch-8FZt3_su.js");
7
- const appbar = require("./appbar-DUsqcqhx.js");
6
+ const android12Switch = require("./android-12-switch-DcPr9cvn.js");
7
+ const appbar = require("./appbar-Bf_GaMVY.js");
8
8
  const React = require("react");
9
9
  const DatePicker = require("react-datepicker");
10
10
  ;/* empty css */
@@ -23,13 +23,13 @@ const marked = require("marked");
23
23
  const api = require("./api-CrXXYiZ2.js");
24
24
  const apiConfig = require("./api-config-DXwDMFn-.js");
25
25
  const Yup = require("yup");
26
- const checkbox = require("./checkbox-Dn9rJCo7.js");
26
+ const checkbox = require("./checkbox-Jgx2gkFF.js");
27
27
  const button = require("./button-GxDcw3FY.js");
28
28
  const formBuilderDeconversion = require("./form-builder-deconversion-x7TevuHU.js");
29
29
  const radioButton = require("./radio-button-BYtmY0l-.js");
30
30
  const notistack = require("notistack");
31
31
  const reactRedux = require("react-redux");
32
- const ERPUIProvider = require("./ERPUIProvider-DUOrclB1.js");
32
+ const ERPUIProvider = require("./ERPUIProvider-BPpcQgND.js");
33
33
  const Board = require("@asseinfo/react-kanban");
34
34
  const translations = require("./translations-B5xv1gxS.js");
35
35
  const FullCalendar = require("@fullcalendar/react");
@@ -46,21 +46,21 @@ const arrowUp = require("./arrow-up-Dg35LjrD.js");
46
46
  const ReactFlagsSelect = require("react-flags-select");
47
47
  const reactRouterDom = require("react-router-dom");
48
48
  const navigationUtils = require("./navigation-utils-CjGqJQmS.js");
49
- const pageContext = require("./page-context-C7YuOn6E.js");
49
+ const pageContext = require("./page-context-_AMJB_ty.js");
50
50
  const ganttTaskReact = require("gantt-task-react");
51
51
  const reactDateRange = require("react-date-range");
52
52
  const actionBar = require("./action-bar-DMv6sqDP.js");
53
53
  const DataEditor = require("@glideapps/glide-data-grid");
54
54
  const glideDataGridCells = require("@glideapps/glide-data-grid-cells");
55
55
  const ReactDOM = require("react-dom");
56
- const sidebar = require("./sidebar-CTnAl3Mf.js");
56
+ const sidebar = require("./sidebar-CobitAdp.js");
57
57
  const materialReactTable = require("material-react-table");
58
58
  const trash = require("./trash-C63VDmtW.js");
59
59
  const document$1 = require("./document-DzwARg8r.js");
60
60
  const _$1 = require("lodash");
61
- const modules = require("./modules-DEtfCF0Q.js");
61
+ const modules = require("./modules-0TgSOLkZ.js");
62
62
  const pathname_rental = require("./pathname.rental-C0Yjyyx7.js");
63
- const routePageMap = require("./route-page-map-B5JTClV2.js");
63
+ const routePageMap = require("./route-page-map-BMisO6c3.js");
64
64
  const hooks = require("./hooks-DsdahmnZ.js");
65
65
  const store = require("./store-BlAfdMng.js");
66
66
  const reactDropzone = require("react-dropzone");
@@ -2813,7 +2813,7 @@ function AISummaryPanel(props = {}) {
2813
2813
  )
2814
2814
  ] });
2815
2815
  }
2816
- const validationSchema$3 = Yup__namespace.object().shape({
2816
+ const validationSchema$2 = Yup__namespace.object().shape({
2817
2817
  approver_id: Yup__namespace.array().required("Please select the approvers").min(1, "Please select the approvers")
2818
2818
  });
2819
2819
  const QuickApprovalModal = ({
@@ -2832,7 +2832,7 @@ const QuickApprovalModal = ({
2832
2832
  });
2833
2833
  const { isLoading, isError, error, data } = users;
2834
2834
  const { control, handleSubmit, reset, setValue, getValues, watch, trigger } = reactHookForm.useForm({
2835
- resolver: appbar.o(validationSchema$3),
2835
+ resolver: appbar.o(validationSchema$2),
2836
2836
  mode: "all"
2837
2837
  });
2838
2838
  watch("approver_id");
@@ -3692,7 +3692,7 @@ const CalendarWrapper = (props) => {
3692
3692
  const CardWrapper = ({ children, ...rest }) => {
3693
3693
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Box, { className: "card-wrapper", ...rest, children });
3694
3694
  };
3695
- const validationSchema$2 = Yup__namespace.object({
3695
+ const validationSchema$1 = Yup__namespace.object({
3696
3696
  login: Yup__namespace.object({
3697
3697
  password: Yup__namespace.string().required("Please enter password").min(8, "Password must be at least 8 characters").matches(/[A-Z]/, "Password must contain at least one uppercase letter").matches(/[!@#$%^&*(),.?":{}|<>]/, "Password must contain at least one special character")
3698
3698
  })
@@ -3702,7 +3702,7 @@ const ChangeUserPasswordModal = ({ showModal, setShowModal, userId }) => {
3702
3702
  const [isNotify, setIsNotify] = React.useState(false);
3703
3703
  const [toast, setToast] = React.useState(null);
3704
3704
  const { control, handleSubmit, reset, trigger } = reactHookForm.useForm({
3705
- resolver: appbar.o(validationSchema$2),
3705
+ resolver: appbar.o(validationSchema$1),
3706
3706
  mode: "all"
3707
3707
  });
3708
3708
  const onSubmit = async (values) => {
@@ -3823,7 +3823,7 @@ const Loader = notification.styled(material.CircularProgress)(({ theme }) => {
3823
3823
  const PageLoader = (props) => {
3824
3824
  return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Box, { position: "absolute", left: "50%", top: "50%", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Loader, { size: 50, ...props }) });
3825
3825
  };
3826
- const validationSchema$1 = Yup__namespace.object().shape({
3826
+ const validationSchema = Yup__namespace.object().shape({
3827
3827
  contacts: Yup__namespace.object().shape({
3828
3828
  name: Yup__namespace.string().required("Name is required"),
3829
3829
  email: Yup__namespace.string().email("Invalid email format").required("Email is required")
@@ -3841,7 +3841,7 @@ const ContactModal = ({
3841
3841
  const { t } = reactI18next.useTranslation();
3842
3842
  const [submitLoading, setSubmitLoading] = React.useState(false);
3843
3843
  const { control, handleSubmit, setValue, reset, getValues, trigger, watch } = reactHookForm.useForm({
3844
- resolver: appbar.o(validationSchema$1),
3844
+ resolver: appbar.o(validationSchema),
3845
3845
  mode: "all"
3846
3846
  });
3847
3847
  const onSubmit = async (values) => {
@@ -3979,23 +3979,31 @@ const addressTypeOptions = [
3979
3979
  { label: "Office", value: "Office" }
3980
3980
  ];
3981
3981
  const isKSA = false;
3982
- const validationSchema = Yup__namespace.object().shape({
3983
- addresses: Yup__namespace.object().shape({
3984
- address_type: Yup__namespace.string().required("Address type is required"),
3985
- contact_name: Yup__namespace.string().required("Contact name is required"),
3986
- street_1: Yup__namespace.string().required("Address 1 is required"),
3987
- street_2: Yup__namespace.string(),
3988
- ...{},
3989
- zip_code: Yup__namespace.string().required("Zip code is required").matches(/^[0-9]+$/, "Zip code must contain only digits without special characters").test(
3990
- "no-dot-plus",
3991
- 'Zip code must not contain "." or "+"',
3992
- (value) => !(value == null ? void 0 : value.includes(".")) && !(value == null ? void 0 : value.includes("+"))
3993
- ),
3994
- city: Yup__namespace.string().matches(/^[A-Za-z\s]+$/, "City must contain alphabets only"),
3995
- state: Yup__namespace.number().typeError("State is required").required("State is required"),
3996
- country: Yup__namespace.number().typeError("Country is required").required("Country is required")
3997
- })
3998
- });
3982
+ const buildValidationSchema = (optionalFields = []) => {
3983
+ const zipOptional = optionalFields.includes("zip_code");
3984
+ const stateOptional = optionalFields.includes("state");
3985
+ return Yup__namespace.object().shape({
3986
+ addresses: Yup__namespace.object().shape({
3987
+ address_type: Yup__namespace.string().required("Address type is required"),
3988
+ contact_name: Yup__namespace.string().required("Contact name is required"),
3989
+ street_1: Yup__namespace.string().required("Address 1 is required"),
3990
+ street_2: Yup__namespace.string(),
3991
+ ...{},
3992
+ zip_code: zipOptional ? Yup__namespace.string().nullable().test(
3993
+ "optional-digits",
3994
+ "Zip code must contain only digits without special characters",
3995
+ (value) => !value || !value.includes(".") && !value.includes("+") && /^[0-9]+$/.test(value)
3996
+ ) : Yup__namespace.string().required("Zip code is required").matches(/^[0-9]+$/, "Zip code must contain only digits without special characters").test(
3997
+ "no-dot-plus",
3998
+ 'Zip code must not contain "." or "+"',
3999
+ (value) => !(value == null ? void 0 : value.includes(".")) && !(value == null ? void 0 : value.includes("+"))
4000
+ ),
4001
+ city: Yup__namespace.string().matches(/^[A-Za-z\s]+$/, "City must contain alphabets only"),
4002
+ state: stateOptional ? Yup__namespace.number().nullable().typeError("State is not valid") : Yup__namespace.number().typeError("State is required").required("State is required"),
4003
+ country: Yup__namespace.number().typeError("Country is required").required("Country is required")
4004
+ })
4005
+ });
4006
+ };
3999
4007
  const AddressModal = ({
4000
4008
  isOpen,
4001
4009
  setIsOpen,
@@ -4005,7 +4013,8 @@ const AddressModal = ({
4005
4013
  items,
4006
4014
  prefillData,
4007
4015
  onSave,
4008
- translationKey
4016
+ translationKey,
4017
+ optionalFields = []
4009
4018
  }) => {
4010
4019
  var _a;
4011
4020
  const { t } = reactI18next.useTranslation();
@@ -4014,6 +4023,7 @@ const AddressModal = ({
4014
4023
  country_data: null,
4015
4024
  state_data: null
4016
4025
  });
4026
+ const validationSchema2 = React.useMemo(() => buildValidationSchema(optionalFields), [optionalFields]);
4017
4027
  const { country_data, state_data } = entryDetails;
4018
4028
  const {
4019
4029
  control,
@@ -4025,7 +4035,7 @@ const AddressModal = ({
4025
4035
  trigger,
4026
4036
  getFieldState
4027
4037
  } = reactHookForm.useForm({
4028
- resolver: appbar.o(validationSchema),
4038
+ resolver: appbar.o(validationSchema2),
4029
4039
  mode: "all"
4030
4040
  });
4031
4041
  const watchedValues = reactHookForm.useWatch({
@@ -4298,7 +4308,7 @@ const AddressModal = ({
4298
4308
  name: "zip_code",
4299
4309
  fieldArrayName: "addresses",
4300
4310
  placeholder: t(`accounting.${translationKey}.addressModal.zip_code_placeholder`),
4301
- required: true
4311
+ required: !optionalFields.includes("zip_code")
4302
4312
  }
4303
4313
  ) }),
4304
4314
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, sm: 6, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
@@ -4325,7 +4335,7 @@ const AddressModal = ({
4325
4335
  apiType: "states",
4326
4336
  customeFilter: stateFilter,
4327
4337
  getSelectedData: (row) => setDetailsData(row, "state_data"),
4328
- required: true
4338
+ required: !optionalFields.includes("state")
4329
4339
  }
4330
4340
  ) }),
4331
4341
  /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(material.Grid, { item: true, sm: 6, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
@@ -16981,4 +16991,4 @@ exports.dynamicFields = dynamicFields;
16981
16991
  exports.fields = fields;
16982
16992
  exports.useDynamicLayout = useDynamicLayout;
16983
16993
  exports.validator = validator;
16984
- //# sourceMappingURL=uom-field-wrapper-Rjqn9-H7.js.map
16994
+ //# sourceMappingURL=uom-field-wrapper-BAFOTp35.js.map