@erpsquad/common 1.10.8-test → 1.10.9-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{ai-summary-D9QajB4_.js → ai-summary-4NVNEHfi.js} +2 -2
- package/dist/chunks/{ai-summary-D9QajB4_.js.map → ai-summary-4NVNEHfi.js.map} +1 -1
- package/dist/chunks/{ai-summary-FqAUpafL.esm.js → ai-summary-f8clWLbW.esm.js} +65 -44
- package/dist/chunks/{ai-summary-FqAUpafL.esm.js.map → ai-summary-f8clWLbW.esm.js.map} +1 -1
- package/dist/chunks/{android-12-switch-BVabRCje.esm.js → android-12-switch-BUbQYnRQ.esm.js} +53 -35
- package/dist/chunks/{android-12-switch-BVabRCje.esm.js.map → android-12-switch-BUbQYnRQ.esm.js.map} +1 -1
- package/dist/chunks/android-12-switch-CphTHRb8.js +2 -0
- package/dist/chunks/{android-12-switch-DMaoWQwq.js.map → android-12-switch-CphTHRb8.js.map} +1 -1
- package/dist/chunks/{appbar-6Ucw59ku.js → appbar-C6Es9HGk.js} +2 -2
- package/dist/chunks/{appbar-6Ucw59ku.js.map → appbar-C6Es9HGk.js.map} +1 -1
- package/dist/chunks/{appbar-mDf1LZ0u.esm.js → appbar-CKrHdx9n.esm.js} +2 -2
- package/dist/chunks/{appbar-mDf1LZ0u.esm.js.map → appbar-CKrHdx9n.esm.js.map} +1 -1
- package/dist/chunks/{default-data-CwLgBvlI.esm.js → default-data-BsZWgQGR.esm.js} +3 -3
- package/dist/chunks/{default-data-CwLgBvlI.esm.js.map → default-data-BsZWgQGR.esm.js.map} +1 -1
- package/dist/chunks/{default-data-D2cqOmp4.js → default-data-Dsjlvwev.js} +2 -2
- package/dist/chunks/{default-data-D2cqOmp4.js.map → default-data-Dsjlvwev.js.map} +1 -1
- package/dist/chunks/{fullScreen-VlXxoepU.js → fullScreen-BBpaDn-A.js} +2 -2
- package/dist/chunks/{fullScreen-VlXxoepU.js.map → fullScreen-BBpaDn-A.js.map} +1 -1
- package/dist/chunks/{fullScreen-B9d2_kak.esm.js → fullScreen-Dn-3Tkwm.esm.js} +2 -2
- package/dist/chunks/{fullScreen-B9d2_kak.esm.js.map → fullScreen-Dn-3Tkwm.esm.js.map} +1 -1
- package/dist/chunks/index-B9CFxEZ9.js +2 -0
- package/dist/chunks/index-B9CFxEZ9.js.map +1 -0
- package/dist/chunks/{index-iPYNYnNP.esm.js → index-wf5q5BST.esm.js} +73 -66
- package/dist/chunks/{index-iPYNYnNP.esm.js.map → index-wf5q5BST.esm.js.map} +1 -1
- package/dist/chunks/{migration-utils-TYitNMC7.js → migration-utils-9IXhe_fj.js} +2 -2
- package/dist/chunks/{migration-utils-TYitNMC7.js.map → migration-utils-9IXhe_fj.js.map} +1 -1
- package/dist/chunks/{migration-utils-BRjncD-b.esm.js → migration-utils-DGoEzQUj.esm.js} +2 -2
- package/dist/chunks/{migration-utils-BRjncD-b.esm.js.map → migration-utils-DGoEzQUj.esm.js.map} +1 -1
- package/dist/chunks/{sidebar-DJREtRnK.js → sidebar-B3SExDRU.js} +2 -2
- package/dist/chunks/{sidebar-DJREtRnK.js.map → sidebar-B3SExDRU.js.map} +1 -1
- package/dist/chunks/{sidebar-D_3INLNa.esm.js → sidebar-n9Y25HU-.esm.js} +2 -2
- package/dist/chunks/{sidebar-D_3INLNa.esm.js.map → sidebar-n9Y25HU-.esm.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-CUf5Onkp.js → sidebarScreen-Dxb_e58p.js} +2 -2
- package/dist/chunks/{sidebarScreen-CUf5Onkp.js.map → sidebarScreen-Dxb_e58p.js.map} +1 -1
- package/dist/chunks/{sidebarScreen-CLjYZOzQ.esm.js → sidebarScreen-_Zt2pSOx.esm.js} +3 -3
- package/dist/chunks/{sidebarScreen-CLjYZOzQ.esm.js.map → sidebarScreen-_Zt2pSOx.esm.js.map} +1 -1
- package/dist/components/index.esm.js +121 -103
- package/dist/components/index.js +1 -1
- package/dist/index.esm.js +218 -200
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/index.esm.js +2 -2
- package/dist/layout/index.js +1 -1
- package/dist/src/components/index.d.ts +18 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/index.esm.js +5 -5
- package/dist/views/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/android-12-switch-DMaoWQwq.js +0 -2
- package/dist/chunks/index-BQ2NBHDS.js +0 -2
- package/dist/chunks/index-BQ2NBHDS.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),r=require("lodash"),t=require("react"),o=require("@mui/material");;/* empty css */const n=require("./tick-ChY3vEPD.js"),a=require("@mui/material/Box"),i=require("@mui/material/styles"),s=require("@mui/material/AppBar"),l=require("@mui/material/Toolbar"),d=require("@mui/material/IconButton"),c=require("react-router-dom"),u=require("react-i18next"),m=require("@mui/icons-material/Lock"),h=require("@mui/material/MenuItem"),p=require("@mui/material/Menu"),g=require("@mui/icons-material/KeyboardBackspace"),x=require("@mui/material/ListItemText"),y=require("@mui/material/Divider"),f=require("@mui/material/ListItemIcon"),j=require("./pathname.rental-Br768eN2.js"),v=require("./useAuth-C1y8BBuX.js"),b=require("./images-DrJQoSCu.js"),S=require("@mui/icons-material/Search"),C=require("./modules-BiUx1fbP.js"),w=require("@mui/icons-material/Person2Outlined"),P=require("@mui/icons-material/Close"),I=require("./useLangauge-p2qKwusp.js"),T=require("./common-wRWMk0Fs.js"),E=require("react-hook-form"),_=require("@hookform/resolvers"),R=require("yup"),k=require("./index-BQ2NBHDS.js"),N=require("@mui/icons-material/WarningAmber"),A=require("@mui/icons-material/CheckCircleOutline"),M=require("@mui/icons-material"),B=require("./api-DG3x2G1d.js"),W=require("notistack"),q=require("./notification-BKDhX9qz.js"),D=require("./api-config-CkfRrKRY.js");function F(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return r.default=e,Object.freeze(r)}const O=F(R),z=o.styled(o.Button)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s;return{fontSize:".875rem",textTransform:"none",minHeight:"0rem",minWidth:"0rem",padding:"0.25rem .75rem",fontWeight:"500",lineHeight:"1.25rem",letterSpacing:"-0.01875rem","&.MuiButton-startIcon":{backgroundColor:"red"},"&.MuiButton-contained":{backgroundColor:null==(r=e.theme)?void 0:r.primary[700],"&:hover":{backgroundColor:null==(t=e.theme)?void 0:t.primary[800]}},"&.MuiButton-outlined":{border:"none",boxShadow:"0px 0px 2px 0px #E0E0E0, 0px 1px 4px -2px rgba(24, 39, 75, 0.02), 0px 4px 4px -2px rgba(24, 39, 75, 0.06)",color:null==(o=e.theme)?void 0:o.primary[700]},"&.MuiButton-text":{color:null==(n=e.theme)?void 0:n.secondary[1e3],backgroundColor:"white","&:hover":{color:null==(a=e.theme)?void 0:a.primary[700]},"& .MuiButton-startIcon":{}},"&.MuiButton-containedError":{backgroundColor:null==(i=e.theme)?void 0:i.error[500],"&:hover":{backgroundColor:null==(s=e.theme)?void 0:s.error[600]}},"&.Mui-disabled":{opacity:.5}}}),V=r=>{const{children:t,variant:o="contained",...n}=r;return e.jsx(z,{variant:o,...n,children:t})},L=o.styled(o.Dialog)(()=>({".MuiDialog-paper":{borderRadius:"1rem"},".MuiDialogTitle-root":{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.5rem 1.5rem"},".MuiDialogContent-root":{padding:"1.5rem"},".MuiDialogActions-root":{padding:"0.5rem 1rem"}})),$=({children:r,open:t,onClose:o,...n})=>e.jsx(L,{open:t,onClose:o,...n,children:r}),G=o.styled(o.TextField)(({theme:{palette:e}})=>{var r,t;return{padding:"0rem 0.75rem 0.5rem 0.75rem",borderBottom:`1px solid ${null==(r=e.theme)?void 0:r.secondary[200]}`,input:{padding:"0.5rem 0rem"},".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiOutlinedInput-root":{fontSize:"0.8125rem",paddingLeft:"0.5rem",color:null==(t=e.theme)?void 0:t.secondary[800],border:"1px solid #F5F6F5",borderRadius:"0.5rem",":hover .MuiOutlinedInput-notchedOutline":{border:1},"&.Mui-focused fieldset":{border:0}}}}),H=t.forwardRef(({searchPlaceholder:r,handleSearch:t,value:n,...a},i)=>e.jsx(G,{inputRef:i,placeholder:r,onChange:t,value:n,fullWidth:!0,variant:"outlined",InputProps:{startAdornment:e.jsx(o.InputAdornment,{position:"start",children:e.jsx(S,{fontSize:"small"})})},...a})),U=o.styled(o.Select)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s,l,d;return{color:null==(r=e.theme)?void 0:r.secondary[800],fontSize:" 0.875rem",".MuiOutlinedInput-notchedOutline":{borderColor:null==(t=e.theme)?void 0:t.secondary[300]},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"0.0625rem",borderColor:null==(o=e.theme)?void 0:o.primary[700]},"&.Mui-focused.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"0.0625rem",borderColor:null==(n=e.theme)?void 0:n.error[600]},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:null==(a=e.theme)?void 0:a.secondary[400]},"&.Mui-error:hover .MuiOutlinedInput-notchedOutline":{borderColor:null==(i=e.theme)?void 0:i.error[600]},"&.Mui-disabled":{background:null==(s=e.theme)?void 0:s.secondary[200],color:null==(l=e.theme)?void 0:l.secondary[800]},".MuiMenuItem-root":{fontSize:"10px"},"&.Mui-error":{color:null==(d=e.theme)?void 0:d.error[600],"&fieldset":{borderColor:"grey"}}}}),Y=t.memo(r=>{const a=t.useRef(null),{children:i,label:s,handleSearch:l,dataPosition:d,dataName:c,placeholder:u,searchPlaceholder:m,required:h,searchValue:p,fullWidth:g=!1,onChange:x,renderValue:y,error:f,helperText:j,loading:b=!1,CustomDropdownIcon:S=n.ArrowDown,...C}=r;return e.jsxs(e.Fragment,{children:[s&&e.jsxs(v.Typography,{type:"s5",weight:"medium","data-position":d,"data-name":c,mb:.5,color:f?"theme.error.600":"theme.secondary.800",children:[s," ",h&&e.jsx("span",{style:{color:"#c64d4d"},children:"*"})]}),e.jsxs(U,{IconComponent:r=>e.jsx(S,{...r,fontSize:"small"}),MenuProps:{PaperProps:{sx:{maxHeight:300,overflowY:"auto"}},anchorOrigin:{vertical:"bottom",horizontal:"center"}},displayEmpty:!0,fullWidth:g,renderValue:y??(r=>""!==r?r:e.jsx(v.Typography,{color:"inherit",type:"s3",children:u})),onChange:x,error:f,onOpen:()=>{setTimeout(()=>{a.current&&a.current.focus()},0)},...C,children:[l&&e.jsx(o.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:"#fff",margin:"-4px -4px 0 -4px",mb:.5},children:e.jsx(H,{ref:a,searchPlaceholder:m,handleSearch:e=>l(e.target.value),value:p,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.stopPropagation(),(null==r?void 0:r.value)&&setTimeout(()=>{var e;return null==(e=a.current)?void 0:e.focus()},0)},sx:{p:1}})}),b?e.jsx(o.Box,{sx:{display:"flex",width:"100%",p:2,justifyContent:"center",alignItems:"center"},children:e.jsx(o.CircularProgress,{size:30,color:"inherit"})}):i]}),j&&e.jsx(o.FormHelperText,{error:f,children:j})]})}),K=o.styled(o.TextField)(({theme:{palette:e}})=>{var r;return{"&.MuiTextField-root":{backgroundColor:null==(r=e.theme)?void 0:r.secondary[200],borderRadius:"0.5rem",padding:"0.375rem 0.75rem"},"& .MuiOutlinedInput-input":{fontSize:"0.875rem",padding:"0rem",paddingLeft:"1.375rem"},".MuiOutlinedInput-notchedOutline":{border:"none"}}}),J=o.styled(o.TextField)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s,l,d,c,u;return{"& .MuiOutlinedInput-root":{padding:"0",color:null==(r=e.theme)?void 0:r.secondary[800],"& fieldset":{borderColor:null==(t=e.theme)?void 0:t.secondary[400]},"&:hover fieldset":{borderColor:null==(o=e.theme)?void 0:o.secondary[500]},"&.Mui-focused fieldset":{borderWidth:"0.0625rem",borderStyle:"solid",borderColor:null==(n=e.theme)?void 0:n.primary[700]},"&.Mui-error fieldset":{borderColor:null==(a=e.theme)?void 0:a.error[600]},"&.Mui-error .MuiInputBase-input::placeholder":{color:null==(i=e.theme)?void 0:i.error[600]},"&.Mui-disabled":{background:null==(s=e.theme)?void 0:s.secondary[200],color:null==(l=e.theme)?void 0:l.secondary[800]},"& .MuiInputBase-input::placeholder":{color:null==(d=e.theme)?void 0:d.secondary[800],opacity:1}},"& .MuiFormHelperText-root":{marginLeft:0,color:null==(c=e.theme)?void 0:c.secondary[800],"&.Mui-error":{color:null==(u=e.theme)?void 0:u.error[600]}},"& .MuiIconButton-root":{marginRight:0}}}),X=t.memo(r=>{const{required:t,placeholder:o,label:n,error:a=!1,dataPosition:i,dataName:s,hidden:l,...d}=r;return e.jsxs(e.Fragment,{children:[n&&!l&&e.jsxs(v.Typography,{type:"s5",weight:"medium",mb:.5,color:a?"theme.error.600":"theme.secondary.800","data-position":i,"data-name":s,children:[n," ",t&&e.jsx("span",{className:"requiredStar",children:"*"})]}),e.jsx(J,{error:a,placeholder:o,className:"textfield",hidden:l,...d})]})}),Q=t.memo(r=>e.jsx(E.Controller,{control:r.formControl,name:`${r.fieldArrayName}.${r.name}`,render:({field:t,fieldState:n})=>{var a,i;return e.jsx(X,{...t,dataPosition:r.position,dataName:`${r.fieldArrayName}.${r.name}`,fullWidth:!0,label:r.label,defaultValue:"number"===r.type||"currency"===r.type||"geoLocation"===r.type?"string"==typeof r.defaultValue?r.defaultValue.replace(/[^0-9]/g,""):r.defaultValue:r.defaultValue||"",placeholder:r.placeholder,type:"currency"===r.type||"geoLocation"===r.type||"relation"===r.type?"text":r.type||"text",value:"number"===r.type&&"number"==typeof t.value?!1===(null==r?void 0:r.shouldApplyPrecission)||["exchange_rate"].includes(r.name)?t.value:(()=>{var e;const o=null==r?void 0:r.float_step,n=o&&"any"!==o?(null==(e=String(o).split(".")[1])?void 0:e.length)??2:2;return console.log("+++++++",t.value,n),Number(t.value.toFixed(n)).toString()})():t.value||"",multiline:r.is_multiline||!1,minRows:4,required:"builder"!==r.formType&&r.required,InputProps:{minLength:r.min||1,endAdornment:r.endIcon?e.jsx(o.InputAdornment,{position:"end",children:e.jsx(o.IconButton,{edge:"end",onClick:null==r?void 0:r.onIconClick,children:r.endIcon})}):void 0,...r.InputProps},inputProps:{step:(null==r?void 0:r.float_step)||"any",min:r.min_length||void 0},disabled:r.disabled,hidden:r.hidden,error:Boolean(null==(a=n.error)?void 0:a.message),helperText:(null==(i=n.error)?void 0:i.message)||"",onBlur:e=>{t.onBlur(e),r.onBlur&&"function"==typeof r.onBlur&&r.onBlur(e)}})}}));function Z(e,r,t){return void 0===r&&(r={}),void 0===t&&(t={}),function(o,n,a){try{return Promise.resolve(function(i,s){try{var l=(r.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===t.mode?"validateSync":"validate"](o,Object.assign({abortEarly:!1},r,{context:n}))).then(function(e){return a.shouldUseNativeValidation&&_.validateFieldsNatively({},a),{values:t.raw?o:e,errors:{}}}))}catch(d){return s(d)}return l&&l.then?l.then(void 0,s):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:_.toNestErrors((r=e,t=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(r.inner||[]).reduce(function(e,r){if(e[r.path]||(e[r.path]={message:r.message,type:r.type}),t){var o=e[r.path].types,n=o&&o[r.type];e[r.path]=E.appendErrors(r.path,t,e,r.type,n?[].concat(n,r.message):r.message)}return e},{})),a)};var r,t}))}catch(i){return Promise.reject(i)}}}Q.propTypes={formControl:k.PropTypes.shape({register:k.PropTypes.func.isRequired,setValue:k.PropTypes.func,_formState:k.PropTypes.object.isRequired}).isRequired,name:k.PropTypes.string.isRequired,placeholder:k.PropTypes.string.isRequired,label:k.PropTypes.node.isRequired,fieldArrayName:k.PropTypes.string,defaultValue:k.PropTypes.string,type:k.PropTypes.string,required:k.PropTypes.bool,is_multiline:k.PropTypes.bool,min:k.PropTypes.number,max:k.PropTypes.number,min_length:k.PropTypes.number,max_length:k.PropTypes.number,float_step:k.PropTypes.string,position:k.PropTypes.number,formType:k.PropTypes.string,disabled:k.PropTypes.bool,typeOfField:k.PropTypes.string,endIcon:k.PropTypes.node,onIconClick:k.PropTypes.func,onBlur:k.PropTypes.func,hidden:k.PropTypes.bool,InputProps:k.PropTypes.object,shouldApplyPrecission:k.PropTypes.bool},Q.defaultProps={onBlur:()=>{}};const ee=r=>{const{t:t}=u.useTranslation(),{open:n,title:a,description:i,onClose:s,onConfirm:l,modalType:d="alert",buttonTexts:c={confirm:t("common.delete"),cancel:t("common.cancel")},buttonColors:m={confirm:"error"},loading:h=!1,showAction:p=!0,...g}=r,x="info"===d?b.images.info:b.images.alert,{isRtl:y}=I.useLanguage();return e.jsx(e.Fragment,{children:e.jsxs(o.Dialog,{open:n,onClose:s,className:"confirm",...g,children:[e.jsxs(o.DialogTitle,{className:"confirm--head",children:[e.jsxs(o.Box,{className:"confirm--title",children:[e.jsx("img",{src:x,alt:"alert icon"})," ",e.jsx(v.Typography,{type:"s3",ml:1,weight:"medium",color:"theme.secondary.1000",children:a})]}),e.jsx(o.IconButton,{disableRipple:!0,onClick:s,disabled:h,children:e.jsx(P,{})})]}),e.jsx(o.Divider,{}),e.jsx(o.DialogContent,{className:"confirm--content",children:e.jsx(v.Typography,{type:"s3",color:"theme.secondary.1000",children:i})}),e.jsx(o.Divider,{}),p&&e.jsxs(o.DialogActions,{className:"confirm--actions",sx:{backgroundColor:"theme.secondary.200"},children:[e.jsx(V,{variant:"text",onClick:s,color:null==m?void 0:m.cancel,disabled:h,children:c.cancel}),c.confirm&&e.jsx(V,{color:m.confirm,onClick:l,sx:y?{mr:1}:{},endIcon:h&&e.jsx(o.CircularProgress,{size:18,color:"inherit"}),disabled:h,children:c.confirm})]})]})})},re=o.styled(o.Alert)(({theme:{palette:e}})=>{var r,t;return{color:"white",height:"2.5rem",padding:"0rem 1rem",display:"flex",alignItems:"center","&.MuiAlert-standardWarning":{backgroundColor:null==(r=e.theme)?void 0:r.error[600]},"&.MuiAlert-standardInfo":{backgroundColor:null==(t=e.theme)?void 0:t.secondary[900]},".MuiAlert-action":{padding:"0rem",marginLeft:"0.5rem"},".MuiAlert-icon":{marginRight:"0.5rem"}}}),te=r=>{const{open:t,message:n,type:a="alert",handleUndo:i,handleClose:s,...l}=r,d=e.jsx(e.Fragment,{children:i?e.jsx(v.Typography,{className:"toast-undo",type:"s4",color:"normal"===a?"theme.primary.600":"white",onClick:i,children:"Undo"}):e.jsx(o.IconButton,{color:"inherit",className:"icon",onClick:s,children:e.jsx(P,{fontSize:"inherit"})})});return e.jsx(e.Fragment,{children:e.jsx(o.Snackbar,{open:t,autoHideDuration:3e5,onClose:s,...l,children:e.jsx(re,{action:d,onClose:s,severity:"normal"===a?"info":"warning",icon:"normal"===a?e.jsx(A,{htmlColor:"white",className:"icon"}):e.jsx(N,{htmlColor:"white",className:"icon"}),children:e.jsx(v.Typography,{color:"inherit",type:"s4",children:n})})})})},oe=r=>{const{icon:t,badge:n,src:a,alt:i,size:s,altIcon:l,...d}=r,c={height:s,width:s},u=s*(i&&i.split(" ").length>1?.025:.035),m=.0225*s,h=.004*s;let p="";return i&&i.length>0&&(p=i.split(" ").map(e=>e.charAt(0)).join("")),e.jsxs("div",{className:"Avatar",children:[e.jsxs(o.Avatar,{alt:i,src:a||void 0,style:c,...d,children:[t&&(!a||i&&0===i.length)&&e.jsx(e.Fragment,{children:l?e.jsx(o.SvgIcon,{children:l}):e.jsx(w,{style:{fontSize:`${u+.8}rem`}})}),!t&&!a&&e.jsx("span",{className:"Avatar--FirstChar",style:{fontSize:`${u}rem`},children:p})]}),n&&e.jsx("div",{className:"Avatar--Badge",style:{width:`${m}rem`,height:`${m}rem`,border:`${h}rem solid #ffffff`}})]})},ne=O.object({login:O.object({current_password:O.string().required("Please enter current password"),password:O.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"),confirm_password:O.string().required("Please enter confirm password").oneOf([O.ref("password")],"Passwords must match")})}),ae=({showModal:r,setShowModal:o})=>{const{changeUserPassword:s}=v.useAuth(),[l,d]=t.useState(null),{control:c,handleSubmit:u,trigger:m}=E.useForm({resolver:Z(ne),mode:"all"}),h=async e=>{if(await m())return await s(e.login,(e,r)=>{r?(d({message:e,type:"normal"}),o(!1)):d({message:e,type:"alert"})}),e},[p,g]=t.useState(!1),[x,y]=t.useState(!1),[f,j]=t.useState(!1),b=i.styled(a)(()=>({display:"flex",flexDirection:"column"}));return e.jsxs(e.Fragment,{children:[e.jsx($,{open:r,onClose:()=>o(!1),children:e.jsx(e.Fragment,{children:e.jsx("form",{onSubmit:u(h),children:e.jsxs(b,{gap:4,className:"popup-change-pass",children:[e.jsxs(b,{gap:2,children:[e.jsxs(a,{children:[e.jsx(v.Typography,{align:"center",type:"h1",weight:"medium",color:"theme.secondary.1000",children:"Change Password"}),e.jsx(v.Typography,{align:"center",type:"h5",weight:"normal",color:"theme.secondary81000",children:"Enter Details below"})]}),e.jsxs(b,{gap:2,children:[e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Current Password",name:"current_password",type:x?"text":"password",placeholder:"Enter Current Password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:x?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>y(!x)})}),e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Password",name:"password",type:p?"text":"password",placeholder:"Enter Password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:p?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>g(!p)})}),e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Confirm Password",name:"confirm_password",type:f?"text":"password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:f?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>j(!f),placeholder:"Enter confirm password"})})]})]}),e.jsx(b,{gap:2,children:e.jsx(V,{type:"button",onClick:u(h),size:"large",variant:"contained",children:"Change Password"})})]})})})}),e.jsx(te,{open:Boolean(l),message:null==l?void 0:l.message,type:null==l?void 0:l.type,handleClose:()=>d(null),anchorOrigin:{horizontal:"right",vertical:"bottom"},autoHideDuration:3e3})]})},ie={rbac:b.images.user,document:b.images.document,"accounts-and-finance":b.images.accounting,inventory:b.images.inventory,manufacturing:b.images.manufacturing,sales:b.images.crm,rental:b.images.rental,user:b.images.user,purchase:b.images.procurement,hrms:b.images.hrms},se={rbac:"#F3E5F5",document:"#FFF8E1","accounts-and-finance":"#E8F5E8",inventory:"#E3F2FD",manufacturing:"#FFF3E0",sales:"#F3E5F5",rental:"#E8F5E8",user:"#F3E5F5",purchase:"#FCE4EC",hrms:"#fcfcfc"},le=()=>{const[r,a]=t.useState(null),[i,s]=t.useState([]),[l,d]=t.useState(!1),[u,m]=t.useState(!1),[h,p]=t.useState(null),[g,x]=t.useState(0),[y,f]=t.useState(!1),[b,S]=t.useState({skip:0,limit:10,totalCount:0,hasMore:!0}),C=c.useNavigate(),w=t.useRef(null),P=t.useRef(!1),I=Boolean(r),E=r=>{const t={"accounts-and-finance":e.jsx(M.AccountBalance,{color:"primary"}),user:e.jsx(M.Person,{color:"action"}),approval:e.jsx(M.Assignment,{color:"warning"})},o=r.sub_module_data||{};return{id:r.id,type:r.action||r.notification_type||"info",title:T.formatText(r.title),message:r.message,timestamp:(e=>{const r=new Date(e),t=new Date-r,o=Math.floor(t/6e4),n=Math.floor(t/36e5),a=Math.floor(t/864e5);return o<1?"Just now":o<60?`${o} minute${o>1?"s":""} ago`:n<24?`${n} hour${n>1?"s":""} ago`:a<7?`${a} day${a>1?"s":""} ago`:r.toLocaleDateString()})(r.created_at),read:"read"===r.status,avatar:(e=>{if(!e)return null;const r=e.first_name||"",t=e.last_name||"";return r||t?(r.charAt(0)+t.charAt(0)).toUpperCase():null})(r.performed_user),performedByName:(n=r.performed_user,n&&`${n.first_name||""} ${n.last_name||""}`.trim()||null),module:r.module,subModule:r.sub_module,subModuleId:r.sub_module_id,status:r.status,seriesNumber:o.series_number||null,documentStatus:o.status||null,customerName:o.customer_name||null,icon:t[r.module]||t[r.action]||e.jsx(M.Person,{color:"action"})};var n},_=t.useCallback(async(e=!1)=>{if(!e||!P.current){e?(P.current=!0,m(!0)):(d(!0),S(e=>({...e,skip:0,hasMore:!0}))),p(null);try{const r=e?b.skip:0,t=await B.getV1Notification({skip:r,limit:b.limit,...T.getToken()});if(!t.success||!t.data)throw x(0),new Error(t.message||"Failed to load notifications");{const o=t.data.notifications.map(E);s(e?e=>[...e,...o]:o);const n=r+t.data.notifications.length,a=n<t.data.pagination.totalCount;if(S(e=>({...e,skip:n,totalCount:t.data.pagination.totalCount,hasMore:a})),!e){const e=t.data.pagination.unreadCount;x(e)}}}catch(r){p("Failed to load notifications")}finally{d(!1),m(!1),e&&(P.current=!1)}}},[b.limit,b.skip]),R=t.useCallback(e=>{const{scrollTop:r,scrollHeight:t,clientHeight:o}=e.target;r+o>=t-50&&!P.current&&!l&&b.hasMore&&_(!0)},[_,l,b.hasMore]),k=()=>{a(null)},N=r=>{if(r.icon)return r.icon;switch(r.type){case"approval":return e.jsx(M.Assignment,{color:"warning"});case"user":default:return e.jsx(M.Person,{color:"action"});case"message":return e.jsx(M.Email,{color:"primary"});case"warning":return e.jsx(M.Warning,{color:"warning"});case"success":return e.jsx(M.CheckCircle,{color:"success"})}},A=t.useCallback(async()=>{if(!y){if(f(!0),!g)return W.enqueueSnackbar("No unread notifications!"),void f(!1);try{await B.getV1NotificationMarkAllAsRead({...T.getToken()}),s(e=>e.map(e=>({...e,read:!0,status:"read"}))),x(0)}catch(e){const r=T.getErrorMessage(e.message);W.enqueueSnackbar(r,{variant:"error"})}finally{f(!1)}}},[y,g]);t.useEffect(()=>{I||setTimeout(()=>{s([])},500)},[I]);const D=e=>{switch(null==e?void 0:e.toLowerCase()){case"approved":return"Approved by";case"rejected":case"reject":return"Rejected by";default:return"Request to"}},F=r=>{switch(null==r?void 0:r.toLowerCase()){case"approved":return e.jsx(M.CheckCircle,{sx:{fontSize:"0.9rem",color:"success.main"}});case"rejected":case"reject":return e.jsx(M.Cancel,{sx:{fontSize:"0.9rem",color:"error.main"}});default:return e.jsx(M.HourglassEmpty,{sx:{fontSize:"0.9rem",color:"warning.main"}})}};return e.jsxs(o.Box,{children:[e.jsx(o.IconButton,{"aria-label":"notifications","aria-controls":I?"notification-menu":void 0,"aria-haspopup":"true","aria-expanded":I?"true":void 0,onClick:e=>{a(e.currentTarget),0===i.length&&_()},children:e.jsx(o.Badge,{badgeContent:g,color:"error",children:e.jsx(q.Notification,{fontSize:"medium"})})}),e.jsxs(o.Menu,{id:"notification-menu",anchorEl:r,open:I,onClose:k,ref:w,slotProps:{paper:{sx:{overflow:"visible",minWidth:400,maxWidth:450,maxHeight:520,"&:before":{content:'""',display:"block",position:"absolute",top:0,right:"50%",width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) translateX(50%) rotate(45deg)",zIndex:0,border:"1px solid",borderColor:({palette:e})=>e.grey[300]}}}},sx:{"& .MuiList-root":{borderRadius:"8px",maxHeight:520,overflowY:"auto",padding:0}},transformOrigin:{horizontal:"center",vertical:"top"},anchorOrigin:{horizontal:"center",vertical:"bottom"},onScroll:R,children:[e.jsxs(o.Box,{sx:{px:2,py:1,borderBottom:"1px solid #e0e0e0",backgroundColor:"#fafafa"},children:[e.jsx(v.Typography,{type:"h5",weight:"bold",color:"grey.1000",children:"Notifications"}),g>0&&e.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",width:"100%",alignItems:"center"},children:[e.jsxs(v.Typography,{type:"s4",color:"grey.800",children:["You have ",g," unread notification",g>1?"s":""]}),e.jsx(V,{variant:"text",startIcon:y?e.jsx(o.CircularProgress,{size:15,color:"inherit"}):e.jsx(n.Tick,{sx:{fontSize:"0.75rem !important"},color:"grey.900"}),sx:{p:0},onClick:A,disabled:g<=0||y,children:e.jsx(v.Typography,{type:"s4",color:"grey.900",children:"Mark all as read"})})]})]}),l&&0===i.length&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})})]}),h&&e.jsx(o.Box,{sx:{p:2},children:e.jsx(o.Alert,{severity:"error",children:h})}),!l&&!h&&i.length>0&&e.jsxs(o.Box,{sx:{maxHeight:420,overflowY:"auto",p:1},onScroll:R,children:[i.map(r=>e.jsx("div",{children:e.jsxs(o.MenuItem,{onClick:()=>(async e=>{const r=i.find(r=>r.id===e);if(!r)return;k(),"pending"===r.status&&await B.patchV1NotificationMarkAsReadId({id:e,...T.getToken()}),s(r=>r.map(r=>r.id===e?{...r,read:!0}:r)),x(e=>Math.max(0,e-1));const t=(e=>{var r;const{moduleName:t="",moduleId:o="",notificationData:n={}}=e,a={sales_invoice:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_SALES_INVOICES),o.toString()),asset_transfers:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_ASSET_TRANSFER),o.toString()),budgets:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_BUDGET),o.toString()),cash_expense:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_CASH_EXPENSE),o.toString()),credit_notes:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_CREDIT_NOTE),o.toString()),debit_notes:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_DEBIT_NOTE),o.toString()),expense_reimbursement:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT),o.toString()),journal_entries:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_JOURNAL_ENTRY),o.toString()),payment_entries:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_PAYMENT_ENTRY),o.toString()),purchase_invoice:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_PURCHASE_INVOICE),o.toString()),stock_transfer:()=>v.generateRouteWithId(j.PathnameGenerator$4(j.PathnameInventory.VIEW_STOCK_TRANSFER),o.toString()),bills_of_materials:()=>v.generateRouteWithId(j.PathnameGenerator$3(j.PathnameManufacturing.VIEW_BILL_OF_MATERIAL),o.toString()),purchase_agreement:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_AGREEMENT),o.toString()),purchase_orders:()=>{var e;return v.generateRouteWithId(1==(null==(e=null==n?void 0:n.data)?void 0:e.is_rental)?j.ROUTES.VIEW:j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_ORDER),o.toString())},purchase_request:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_ORDER),o.toString()),vra:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_VENDOR_RETURNS),o.toString()),sales_customer_returns:()=>v.generateRouteWithId(j.PathnameGenerator$2(j.PathnameCrm.VIEW_CUSTOMER_RETURNS),o.toString()),sales_order:()=>v.generateRouteWithId(j.PathnameGenerator$2(j.PathnameCrm.VIEW_SALES_ORDER),o.toString()),rental_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_RENTAL_ORDER),o.toString()),replacement_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_RENTAL_ORDER),o.toString()),rental_agreement:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_AGREEMENT),o.toString()),cross_hire_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_CROSS_HIRE_ORDER),o.toString()),cross_hire_request:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_CROSS_HIRE_REQUEST),o.toString())};return(null==(r=a[T.convertToUnderscore(t)])?void 0:r.call(a))||"/dashboard"})({moduleName:r.subModule,moduleId:r.subModuleId,notificationData:r});setTimeout(()=>{C(t)},300)})(r.id),sx:({palette:e})=>({py:1,px:1,backgroundColor:r.read?"transparent":e.theme.grey[200],border:`1px solid ${e.grey[200]}`,marginBottom:"4px !important","&:hover":{backgroundColor:e.theme.grey[200]},alignItems:"flex-start",minHeight:"auto"}),children:[e.jsx(o.ListItemAvatar,{sx:{minWidth:48,mt:0},children:(null==ie?void 0:ie[r.module])?e.jsx(o.Avatar,{sx:{width:40,height:40,fontSize:"0.875rem",bgcolor:se[r.module]||"primary.main",color:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)","& img":{width:"28px",height:"28px",objectFit:"contain"}},src:null==ie?void 0:ie[r.module]}):e.jsx(e.Fragment,{children:r.avatar?e.jsx(o.Avatar,{sx:{width:40,height:40,fontSize:"0.875rem",bgcolor:"primary.main",color:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:r.avatar}):e.jsx(o.Avatar,{sx:{width:36,height:36,bgcolor:"grey.100",color:"grey.600",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:N(r)})})}),e.jsx(o.ListItemText,{sx:{margin:0,pr:1},primary:e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap",mb:.25},children:[e.jsx(v.Typography,{type:"s3",weight:"bold",color:"grey.1000",children:r.title}),r.seriesNumber&&e.jsx(v.Typography,{type:"s4",sx:{color:"text.secondary",fontWeight:500},children:r.seriesNumber}),F(r.type)]}),secondary:e.jsxs(o.Box,{children:[r.customerName&&e.jsxs(v.Typography,{type:"s4",color:"grey.800",sx:{display:"block",mb:.25},children:[e.jsx(v.Typography,{component:"span",type:"s5",sx:{fontSize:"0.7rem !important",color:"text.secondary",mr:.5},children:"purchase"===r.module?"Vendor:":"Customer:"}),r.customerName]}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[r.performedByName&&e.jsxs(v.Typography,{type:"s5",sx:{fontSize:"0.7rem !important",color:"text.secondary"},children:[D(r.type)," ",r.performedByName]}),r.performedByName&&e.jsx(o.Box,{sx:{height:4,width:4,borderRadius:"100%",backgroundColor:"grey.400",flexShrink:0}}),e.jsx(v.Typography,{type:"s5",color:"primary",sx:{fontSize:"0.65rem !important"},children:r.timestamp})]})]})}),!r.read&&e.jsx(o.Box,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:"primary.main",flexShrink:0,mt:.5}})]})},r.id)),u&&e.jsxs(o.Box,{sx:{display:"flex",justifyContent:"center",py:2.5,px:3},children:[e.jsx(o.CircularProgress,{size:20}),e.jsx(v.Typography,{variant:"body2",sx:{ml:1.5,color:"text.secondary"},children:"Loading more..."})]}),!b.hasMore&&i.length>0&&e.jsx(o.Box,{sx:{textAlign:"center",py:1.5,px:2},children:e.jsx(v.Typography,{type:"s3",color:"grey.800",textAlign:"center",children:"No more notifications"})})]}),!l&&!h&&0===i.length&&e.jsxs(o.Box,{sx:{p:4,textAlign:"center"},children:[e.jsx(q.Notification,{sx:{fontSize:56,color:"text.secondary",mb:2}}),e.jsx(v.Typography,{type:"s1",color:"grey.800",sx:{mb:1},textAlign:"center",children:"No notifications yet"})]})]})]})};function de(r){const o=c.useNavigate(),{t:i}=u.useTranslation(),s=c.useLocation(),{logout:l,user:S}=v.useAuth(),w=D.getApiConfig(),{languages:P,currentLanguage:E,changeLanguage:_,isLoading:R,error:k,isFallbackActive:N,fetchLanguages:A,isRtl:M}=I.useLanguage(),{pathname:B}=s,[W,q]=t.useState(null),[F,O]=t.useState(!1),[z,V]=t.useState(null),[L,$]=t.useState(!1),G=localStorage.getItem("_u_data")||void 0,H=G?JSON.parse(G):"",U=Boolean(W),K=()=>O(!F),J=t.useCallback(e=>{const r=Array.isArray(e)?e.map(e=>({path:e})):[{path:e}];return Boolean(c.matchRoutes(r,s))},[s]),X=t.useMemo(()=>C.modules(i),[i]),Q=t.useMemo(()=>X.find(e=>{var r;return(null==(r=null==e?void 0:e.link)?void 0:r.toLowerCase())===B.toLowerCase()||J(e.connectedRoutes)})||null,[X,B,J]),Z=e=>{const r=e.target.value;if(V(null),!P||0===P.length){const e=i("header.language_not_available")||"Languages not available";return void V(e)}if(P.some(e=>e.code===r))try{_(r)}catch(t){const e=t instanceof Error?t.message:"Failed to change language";V(e)}else{const e=i("header.language_not_found",{language:r})||`Selected language "${r}" is not available`;V(e)}},re=async()=>{V(null);try{await A()}catch(e){V("Failed to reload languages")}},te="primary-search-account-menu",ne=e.jsxs(p,{className:"main-profile-menu",anchorEl:W,id:te,keepMounted:!0,open:U,onClose:()=>{q(null)},children:[e.jsx(h,{className:"user-assigned",children:e.jsx("span",{children:i("common.assigned_roles")||"Assigned roles"})}),e.jsxs(h,{className:"user-data-wrap",value:H.role_id,children:[e.jsx(f,{children:e.jsx(oe,{size:27,alt:H.role_name})}),e.jsx(x,{className:"size15",children:H.role_name}),e.jsx(v.Typography,{variant:"body2",color:"text.secondary",children:e.jsx("img",{src:b.images.tickicon,alt:"Active"})})]}),e.jsx(y,{}),e.jsxs(h,{className:"user-assigned",onClick:()=>{$(!0),q(null)},children:[e.jsx(f,{children:e.jsx(n.Eye,{fontSize:"medium",width:20,height:20,htmlColor:"#292D32"})}),e.jsx(x,{className:"size15",children:i("common.change_password")})]}),e.jsx(y,{}),e.jsxs(h,{className:"menu-item-color",onClick:()=>{K(),q(null)},children:[e.jsx(f,{children:e.jsx("img",{src:b.images.logout,alt:"logout"})}),e.jsx(x,{className:"size15",children:i("common.logout")})]})]}),ie=D.getApiConfig().appLogo||b.images.logo;return e.jsxs(e.Fragment,{children:[e.jsxs(a,{className:"main-box",children:[!r.isDropdownShow&&e.jsx(c.Link,{to:S?j.Pathname.DASHBOARD:j.Pathname.LOGIN,children:e.jsx("img",{src:ie,alt:"logo",height:55})}),e.jsx(a,{className:"second-box",children:r.isDropdownShow&&e.jsxs(e.Fragment,{children:[e.jsx(d,{onClick:()=>{window.history.back()},children:e.jsx(g,{className:M?"arrow-pointer_rtl":"arrow-pointer"})}),e.jsx(a,{width:250,children:e.jsx(Y,{fullWidth:!0,placeholder:"Placeholder",size:"small",value:(null==Q?void 0:Q.link)||"",onChange:e=>{const r=e.target.value;setTimeout(()=>{o(r)},300)},className:"select-box",variant:"outlined",renderValue:r=>e.jsx(e.Fragment,{children:Q?e.jsxs(a,{className:"selected-menu-box",children:[e.jsx("img",{src:Q.icon,alt:Q.label}),Q.label]}):r}),children:X.map((r,t)=>e.jsxs(h,{className:"select-box-menu-item",value:r.link,children:[e.jsx("img",{src:r.icon,alt:r.label}),r.label]},t))})})]})}),e.jsxs(a,{className:"header-right-wrap",children:[e.jsx(a,{className:"language-selector-wrapper",children:(()=>{const r=P&&0!==P.length?P.some(e=>"en"===e.code)?P:[{code:"en",label:"English",direction:"ltr"},...P]:[{code:"en",label:"English",direction:"ltr"}],t=(null==E?void 0:E.code)||"en";return R?e.jsx(a,{className:"language-loading",children:e.jsx(v.Typography,{variant:"body2",color:"text.secondary",children:"Loading..."})}):e.jsxs(Y,{onChange:Z,size:"small",value:t,renderValue:()=>E?N||k?`${E.label}`:E.label:i("header.select_language")||"Select Language",error:!!z,className:"language-select "+(N||k?"language-fallback-active":""),children:[r.map(({code:r,label:t})=>e.jsx(h,{value:r,children:e.jsx(v.Typography,{type:"s4",weight:"medium",color:"theme.secondary.1000",children:t})},r)),k&&e.jsx(h,{onClick:re,style:{fontStyle:"italic"},children:e.jsxs(v.Typography,{type:"s4",weight:"medium",color:"theme.secondary.500",children:["🔄 ",i("header.retry_languages")||"Retry loading languages"]})})]})})()}),e.jsx(le,{}),e.jsx(d,{size:"small","aria-label":"help",className:"p-0",children:e.jsx("img",{src:b.images.question,alt:"question icon"})}),e.jsx("img",{src:b.images.vdivider,alt:"divider icon"}),localStorage.getItem("_tid")?e.jsxs(a,{className:"user-profile-box",onClick:e=>q(e.currentTarget),children:[e.jsx(oe,{size:32,src:(null==S?void 0:S.profile_image)?`${null==w?void 0:w.s3BucketUrl}${null==S?void 0:S.profile_image}`:void 0,alt:T.formatText(null==S?void 0:S.full_name),className:"avatar-class"}),e.jsxs("div",{children:[e.jsx(v.Typography,{className:"profile-name",children:null==S?void 0:S.full_name}),e.jsx(v.Typography,{className:"user-auth",children:null==S?void 0:S.role_name})]})]}):e.jsx(d,{size:"large",edge:"end","aria-label":"account of current user","aria-controls":te,"aria-haspopup":"true",component:c.Link,to:j.Pathname.LOGIN,color:"inherit",children:e.jsx(m,{className:"icon-btn"})})]}),ne]}),e.jsx(ee,{open:F,title:i("common.logout"),description:i("common.logout_confirmation")||"Are you sure, you want to logout?",onConfirm:()=>l(),onClose:K,fullWidth:!0,maxWidth:"xs",buttonTexts:{confirm:i("common.logout"),cancel:i("common.cancel")}}),e.jsx(ae,{showModal:L,setShowModal:$})]})}let ce;const ue=i.styled(s,{shouldForwardProp:e=>"open"!==e})(({theme:e,open:r})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),...r&&{marginLeft:"ltr"===document.body.dir?ce:0,marginRight:"rtl"===document.body.dir?ce:0,width:`calc(100% - ${ce}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})},boxShadow:"none"}));exports.ActivityArea=r=>e.jsx(a,{className:"main-wrapper",component:"main",width:"100%",marginTop:"4.6875rem",children:r.children}),exports.AppBarWrapper=r=>(ce=r.width,e.jsx(ue,{position:"fixed",open:null==r?void 0:r.open,sx:e=>{var r,t;return{borderBottom:"1px solid",borderColor:null==(r=e.palette.theme)?void 0:r.secondary[200],backgroundColor:null==(t=e.palette.theme)?void 0:t.secondary[100]}},children:e.jsx(l,{sx:{backgroundColor:"grey.100"},children:(null==r?void 0:r.handleDrawerOpen)?e.jsxs(e.Fragment,{children:[e.jsx(d,{color:"inherit","aria-label":"open drawer",edge:"start",sx:{marginRight:5,...r.open&&{display:"none"}},children:e.jsx("img",{src:b.images.favicon,height:30,width:30})}),e.jsx(de,{isDropdownShow:!0})]}):e.jsx(e.Fragment,{children:e.jsx(de,{isDropdownShow:!1})})})})),exports.Avatar=oe,exports.Button=V,exports.ConfirmPopUp=ee,exports.DynamicInput=Q,exports.Header=de,exports.Modal=$,exports.ResetPasswordModal=ae,exports.SearchBar=({handleSearch:o,debounceTime:a=300,className:i,InputProps:s,isDrivePage:l,searchText:d,value:c="",...u})=>{const[m,h]=t.useState(""),p=t.useRef();return t.useEffect(()=>{const e=l&&localStorage.getItem("searchTerm")||"";h(e),l&&localStorage.setItem("searchTerm","")},[l]),t.useEffect(()=>{h("string"==typeof d&&d||"")},[d]),t.useEffect(()=>(p.current=r.debounce(e=>o(e),a),()=>{var e;null==(e=p.current)||e.cancel()}),[o,a]),t.useEffect(()=>{h(c||"")},[]),e.jsxs("div",{className:`${i} search-wrapper`,children:[e.jsx(K,{fullWidth:!0,className:"s3",value:m,onChange:e=>{const r=e.target.value;h(r),l&&localStorage.setItem("searchTerm",r),p.current&&p.current(r)},onKeyDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},autoComplete:"off",InputProps:s,...u}),e.jsx("span",{className:"search-icon",children:m?e.jsx(n.SearchStatus,{fontSize:"small",sx:{color:m?"grey.900":"grey.700"}}):e.jsx(n.Search,{fontSize:"small",sx:{color:m?"grey.900":"grey.700"}})})]})},exports.Select=Y,exports.TextField=X,exports.Toast=te,exports.Tooltip=({title:r,children:t,sx:n,...a})=>e.jsx(o.Tooltip,{componentsProps:{tooltip:{sx:{padding:"0.5rem 0.75rem",backgroundColor:"#393B3E",maxWidth:"12rem","& .MuiTooltip-arrow":{color:"#393B3E"},...n}}},title:r,...a,children:t}),exports.o=Z;
|
|
2
|
-
//# sourceMappingURL=appbar-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),r=require("lodash"),t=require("react"),o=require("@mui/material");;/* empty css */const n=require("./tick-ChY3vEPD.js"),a=require("@mui/material/Box"),i=require("@mui/material/styles"),s=require("@mui/material/AppBar"),l=require("@mui/material/Toolbar"),d=require("@mui/material/IconButton"),c=require("react-router-dom"),u=require("react-i18next"),m=require("@mui/icons-material/Lock"),h=require("@mui/material/MenuItem"),p=require("@mui/material/Menu"),g=require("@mui/icons-material/KeyboardBackspace"),x=require("@mui/material/ListItemText"),y=require("@mui/material/Divider"),f=require("@mui/material/ListItemIcon"),j=require("./pathname.rental-Br768eN2.js"),v=require("./useAuth-C1y8BBuX.js"),b=require("./images-DrJQoSCu.js"),S=require("@mui/icons-material/Search"),C=require("./modules-BiUx1fbP.js"),w=require("@mui/icons-material/Person2Outlined"),P=require("@mui/icons-material/Close"),I=require("./useLangauge-p2qKwusp.js"),T=require("./common-wRWMk0Fs.js"),E=require("react-hook-form"),_=require("@hookform/resolvers"),R=require("yup"),k=require("./index-B9CFxEZ9.js"),N=require("@mui/icons-material/WarningAmber"),A=require("@mui/icons-material/CheckCircleOutline"),M=require("@mui/icons-material"),B=require("./api-DG3x2G1d.js"),W=require("notistack"),q=require("./notification-BKDhX9qz.js"),D=require("./api-config-CkfRrKRY.js");function F(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return r.default=e,Object.freeze(r)}const O=F(R),z=o.styled(o.Button)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s;return{fontSize:".875rem",textTransform:"none",minHeight:"0rem",minWidth:"0rem",padding:"0.25rem .75rem",fontWeight:"500",lineHeight:"1.25rem",letterSpacing:"-0.01875rem","&.MuiButton-startIcon":{backgroundColor:"red"},"&.MuiButton-contained":{backgroundColor:null==(r=e.theme)?void 0:r.primary[700],"&:hover":{backgroundColor:null==(t=e.theme)?void 0:t.primary[800]}},"&.MuiButton-outlined":{border:"none",boxShadow:"0px 0px 2px 0px #E0E0E0, 0px 1px 4px -2px rgba(24, 39, 75, 0.02), 0px 4px 4px -2px rgba(24, 39, 75, 0.06)",color:null==(o=e.theme)?void 0:o.primary[700]},"&.MuiButton-text":{color:null==(n=e.theme)?void 0:n.secondary[1e3],backgroundColor:"white","&:hover":{color:null==(a=e.theme)?void 0:a.primary[700]},"& .MuiButton-startIcon":{}},"&.MuiButton-containedError":{backgroundColor:null==(i=e.theme)?void 0:i.error[500],"&:hover":{backgroundColor:null==(s=e.theme)?void 0:s.error[600]}},"&.Mui-disabled":{opacity:.5}}}),V=r=>{const{children:t,variant:o="contained",...n}=r;return e.jsx(z,{variant:o,...n,children:t})},L=o.styled(o.Dialog)(()=>({".MuiDialog-paper":{borderRadius:"1rem"},".MuiDialogTitle-root":{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.5rem 1.5rem"},".MuiDialogContent-root":{padding:"1.5rem"},".MuiDialogActions-root":{padding:"0.5rem 1rem"}})),$=({children:r,open:t,onClose:o,...n})=>e.jsx(L,{open:t,onClose:o,...n,children:r}),G=o.styled(o.TextField)(({theme:{palette:e}})=>{var r,t;return{padding:"0rem 0.75rem 0.5rem 0.75rem",borderBottom:`1px solid ${null==(r=e.theme)?void 0:r.secondary[200]}`,input:{padding:"0.5rem 0rem"},".MuiOutlinedInput-notchedOutline":{border:0},"& .MuiOutlinedInput-root":{fontSize:"0.8125rem",paddingLeft:"0.5rem",color:null==(t=e.theme)?void 0:t.secondary[800],border:"1px solid #F5F6F5",borderRadius:"0.5rem",":hover .MuiOutlinedInput-notchedOutline":{border:1},"&.Mui-focused fieldset":{border:0}}}}),H=t.forwardRef(({searchPlaceholder:r,handleSearch:t,value:n,...a},i)=>e.jsx(G,{inputRef:i,placeholder:r,onChange:t,value:n,fullWidth:!0,variant:"outlined",InputProps:{startAdornment:e.jsx(o.InputAdornment,{position:"start",children:e.jsx(S,{fontSize:"small"})})},...a})),U=o.styled(o.Select)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s,l,d;return{color:null==(r=e.theme)?void 0:r.secondary[800],fontSize:" 0.875rem",".MuiOutlinedInput-notchedOutline":{borderColor:null==(t=e.theme)?void 0:t.secondary[300]},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"0.0625rem",borderColor:null==(o=e.theme)?void 0:o.primary[700]},"&.Mui-focused.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"0.0625rem",borderColor:null==(n=e.theme)?void 0:n.error[600]},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:null==(a=e.theme)?void 0:a.secondary[400]},"&.Mui-error:hover .MuiOutlinedInput-notchedOutline":{borderColor:null==(i=e.theme)?void 0:i.error[600]},"&.Mui-disabled":{background:null==(s=e.theme)?void 0:s.secondary[200],color:null==(l=e.theme)?void 0:l.secondary[800]},".MuiMenuItem-root":{fontSize:"10px"},"&.Mui-error":{color:null==(d=e.theme)?void 0:d.error[600],"&fieldset":{borderColor:"grey"}}}}),Y=t.memo(r=>{const a=t.useRef(null),{children:i,label:s,handleSearch:l,dataPosition:d,dataName:c,placeholder:u,searchPlaceholder:m,required:h,searchValue:p,fullWidth:g=!1,onChange:x,renderValue:y,error:f,helperText:j,loading:b=!1,CustomDropdownIcon:S=n.ArrowDown,...C}=r;return e.jsxs(e.Fragment,{children:[s&&e.jsxs(v.Typography,{type:"s5",weight:"medium","data-position":d,"data-name":c,mb:.5,color:f?"theme.error.600":"theme.secondary.800",children:[s," ",h&&e.jsx("span",{style:{color:"#c64d4d"},children:"*"})]}),e.jsxs(U,{IconComponent:r=>e.jsx(S,{...r,fontSize:"small"}),MenuProps:{PaperProps:{sx:{maxHeight:300,overflowY:"auto"}},anchorOrigin:{vertical:"bottom",horizontal:"center"}},displayEmpty:!0,fullWidth:g,renderValue:y??(r=>""!==r?r:e.jsx(v.Typography,{color:"inherit",type:"s3",children:u})),onChange:x,error:f,onOpen:()=>{setTimeout(()=>{a.current&&a.current.focus()},0)},...C,children:[l&&e.jsx(o.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:"#fff",margin:"-4px -4px 0 -4px",mb:.5},children:e.jsx(H,{ref:a,searchPlaceholder:m,handleSearch:e=>l(e.target.value),value:p,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.stopPropagation(),(null==r?void 0:r.value)&&setTimeout(()=>{var e;return null==(e=a.current)?void 0:e.focus()},0)},sx:{p:1}})}),b?e.jsx(o.Box,{sx:{display:"flex",width:"100%",p:2,justifyContent:"center",alignItems:"center"},children:e.jsx(o.CircularProgress,{size:30,color:"inherit"})}):i]}),j&&e.jsx(o.FormHelperText,{error:f,children:j})]})}),K=o.styled(o.TextField)(({theme:{palette:e}})=>{var r;return{"&.MuiTextField-root":{backgroundColor:null==(r=e.theme)?void 0:r.secondary[200],borderRadius:"0.5rem",padding:"0.375rem 0.75rem"},"& .MuiOutlinedInput-input":{fontSize:"0.875rem",padding:"0rem",paddingLeft:"1.375rem"},".MuiOutlinedInput-notchedOutline":{border:"none"}}}),J=o.styled(o.TextField)(({theme:{palette:e}})=>{var r,t,o,n,a,i,s,l,d,c,u;return{"& .MuiOutlinedInput-root":{padding:"0",color:null==(r=e.theme)?void 0:r.secondary[800],"& fieldset":{borderColor:null==(t=e.theme)?void 0:t.secondary[400]},"&:hover fieldset":{borderColor:null==(o=e.theme)?void 0:o.secondary[500]},"&.Mui-focused fieldset":{borderWidth:"0.0625rem",borderStyle:"solid",borderColor:null==(n=e.theme)?void 0:n.primary[700]},"&.Mui-error fieldset":{borderColor:null==(a=e.theme)?void 0:a.error[600]},"&.Mui-error .MuiInputBase-input::placeholder":{color:null==(i=e.theme)?void 0:i.error[600]},"&.Mui-disabled":{background:null==(s=e.theme)?void 0:s.secondary[200],color:null==(l=e.theme)?void 0:l.secondary[800]},"& .MuiInputBase-input::placeholder":{color:null==(d=e.theme)?void 0:d.secondary[800],opacity:1}},"& .MuiFormHelperText-root":{marginLeft:0,color:null==(c=e.theme)?void 0:c.secondary[800],"&.Mui-error":{color:null==(u=e.theme)?void 0:u.error[600]}},"& .MuiIconButton-root":{marginRight:0}}}),X=t.memo(r=>{const{required:t,placeholder:o,label:n,error:a=!1,dataPosition:i,dataName:s,hidden:l,...d}=r;return e.jsxs(e.Fragment,{children:[n&&!l&&e.jsxs(v.Typography,{type:"s5",weight:"medium",mb:.5,color:a?"theme.error.600":"theme.secondary.800","data-position":i,"data-name":s,children:[n," ",t&&e.jsx("span",{className:"requiredStar",children:"*"})]}),e.jsx(J,{error:a,placeholder:o,className:"textfield",hidden:l,...d})]})}),Q=t.memo(r=>e.jsx(E.Controller,{control:r.formControl,name:`${r.fieldArrayName}.${r.name}`,render:({field:t,fieldState:n})=>{var a,i;return e.jsx(X,{...t,dataPosition:r.position,dataName:`${r.fieldArrayName}.${r.name}`,fullWidth:!0,label:r.label,defaultValue:"number"===r.type||"currency"===r.type||"geoLocation"===r.type?"string"==typeof r.defaultValue?r.defaultValue.replace(/[^0-9]/g,""):r.defaultValue:r.defaultValue||"",placeholder:r.placeholder,type:"currency"===r.type||"geoLocation"===r.type||"relation"===r.type?"text":r.type||"text",value:"number"===r.type&&"number"==typeof t.value?!1===(null==r?void 0:r.shouldApplyPrecission)||["exchange_rate"].includes(r.name)?t.value:(()=>{var e;const o=null==r?void 0:r.float_step,n=o&&"any"!==o?(null==(e=String(o).split(".")[1])?void 0:e.length)??2:2;return console.log("+++++++",t.value,n),Number(t.value.toFixed(n)).toString()})():t.value||"",multiline:r.is_multiline||!1,minRows:4,required:"builder"!==r.formType&&r.required,InputProps:{minLength:r.min||1,endAdornment:r.endIcon?e.jsx(o.InputAdornment,{position:"end",children:e.jsx(o.IconButton,{edge:"end",onClick:null==r?void 0:r.onIconClick,children:r.endIcon})}):void 0,...r.InputProps},inputProps:{step:(null==r?void 0:r.float_step)||"any",min:r.min_length||void 0},disabled:r.disabled,hidden:r.hidden,error:Boolean(null==(a=n.error)?void 0:a.message),helperText:(null==(i=n.error)?void 0:i.message)||"",onBlur:e=>{t.onBlur(e),r.onBlur&&"function"==typeof r.onBlur&&r.onBlur(e)}})}}));function Z(e,r,t){return void 0===r&&(r={}),void 0===t&&(t={}),function(o,n,a){try{return Promise.resolve(function(i,s){try{var l=(r.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===t.mode?"validateSync":"validate"](o,Object.assign({abortEarly:!1},r,{context:n}))).then(function(e){return a.shouldUseNativeValidation&&_.validateFieldsNatively({},a),{values:t.raw?o:e,errors:{}}}))}catch(d){return s(d)}return l&&l.then?l.then(void 0,s):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:_.toNestErrors((r=e,t=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(r.inner||[]).reduce(function(e,r){if(e[r.path]||(e[r.path]={message:r.message,type:r.type}),t){var o=e[r.path].types,n=o&&o[r.type];e[r.path]=E.appendErrors(r.path,t,e,r.type,n?[].concat(n,r.message):r.message)}return e},{})),a)};var r,t}))}catch(i){return Promise.reject(i)}}}Q.propTypes={formControl:k.PropTypes.shape({register:k.PropTypes.func.isRequired,setValue:k.PropTypes.func,_formState:k.PropTypes.object.isRequired}).isRequired,name:k.PropTypes.string.isRequired,placeholder:k.PropTypes.string.isRequired,label:k.PropTypes.node.isRequired,fieldArrayName:k.PropTypes.string,defaultValue:k.PropTypes.string,type:k.PropTypes.string,required:k.PropTypes.bool,is_multiline:k.PropTypes.bool,min:k.PropTypes.number,max:k.PropTypes.number,min_length:k.PropTypes.number,max_length:k.PropTypes.number,float_step:k.PropTypes.string,position:k.PropTypes.number,formType:k.PropTypes.string,disabled:k.PropTypes.bool,typeOfField:k.PropTypes.string,endIcon:k.PropTypes.node,onIconClick:k.PropTypes.func,onBlur:k.PropTypes.func,hidden:k.PropTypes.bool,InputProps:k.PropTypes.object,shouldApplyPrecission:k.PropTypes.bool},Q.defaultProps={onBlur:()=>{}};const ee=r=>{const{t:t}=u.useTranslation(),{open:n,title:a,description:i,onClose:s,onConfirm:l,modalType:d="alert",buttonTexts:c={confirm:t("common.delete"),cancel:t("common.cancel")},buttonColors:m={confirm:"error"},loading:h=!1,showAction:p=!0,...g}=r,x="info"===d?b.images.info:b.images.alert,{isRtl:y}=I.useLanguage();return e.jsx(e.Fragment,{children:e.jsxs(o.Dialog,{open:n,onClose:s,className:"confirm",...g,children:[e.jsxs(o.DialogTitle,{className:"confirm--head",children:[e.jsxs(o.Box,{className:"confirm--title",children:[e.jsx("img",{src:x,alt:"alert icon"})," ",e.jsx(v.Typography,{type:"s3",ml:1,weight:"medium",color:"theme.secondary.1000",children:a})]}),e.jsx(o.IconButton,{disableRipple:!0,onClick:s,disabled:h,children:e.jsx(P,{})})]}),e.jsx(o.Divider,{}),e.jsx(o.DialogContent,{className:"confirm--content",children:e.jsx(v.Typography,{type:"s3",color:"theme.secondary.1000",children:i})}),e.jsx(o.Divider,{}),p&&e.jsxs(o.DialogActions,{className:"confirm--actions",sx:{backgroundColor:"theme.secondary.200"},children:[e.jsx(V,{variant:"text",onClick:s,color:null==m?void 0:m.cancel,disabled:h,children:c.cancel}),c.confirm&&e.jsx(V,{color:m.confirm,onClick:l,sx:y?{mr:1}:{},endIcon:h&&e.jsx(o.CircularProgress,{size:18,color:"inherit"}),disabled:h,children:c.confirm})]})]})})},re=o.styled(o.Alert)(({theme:{palette:e}})=>{var r,t;return{color:"white",height:"2.5rem",padding:"0rem 1rem",display:"flex",alignItems:"center","&.MuiAlert-standardWarning":{backgroundColor:null==(r=e.theme)?void 0:r.error[600]},"&.MuiAlert-standardInfo":{backgroundColor:null==(t=e.theme)?void 0:t.secondary[900]},".MuiAlert-action":{padding:"0rem",marginLeft:"0.5rem"},".MuiAlert-icon":{marginRight:"0.5rem"}}}),te=r=>{const{open:t,message:n,type:a="alert",handleUndo:i,handleClose:s,...l}=r,d=e.jsx(e.Fragment,{children:i?e.jsx(v.Typography,{className:"toast-undo",type:"s4",color:"normal"===a?"theme.primary.600":"white",onClick:i,children:"Undo"}):e.jsx(o.IconButton,{color:"inherit",className:"icon",onClick:s,children:e.jsx(P,{fontSize:"inherit"})})});return e.jsx(e.Fragment,{children:e.jsx(o.Snackbar,{open:t,autoHideDuration:3e5,onClose:s,...l,children:e.jsx(re,{action:d,onClose:s,severity:"normal"===a?"info":"warning",icon:"normal"===a?e.jsx(A,{htmlColor:"white",className:"icon"}):e.jsx(N,{htmlColor:"white",className:"icon"}),children:e.jsx(v.Typography,{color:"inherit",type:"s4",children:n})})})})},oe=r=>{const{icon:t,badge:n,src:a,alt:i,size:s,altIcon:l,...d}=r,c={height:s,width:s},u=s*(i&&i.split(" ").length>1?.025:.035),m=.0225*s,h=.004*s;let p="";return i&&i.length>0&&(p=i.split(" ").map(e=>e.charAt(0)).join("")),e.jsxs("div",{className:"Avatar",children:[e.jsxs(o.Avatar,{alt:i,src:a||void 0,style:c,...d,children:[t&&(!a||i&&0===i.length)&&e.jsx(e.Fragment,{children:l?e.jsx(o.SvgIcon,{children:l}):e.jsx(w,{style:{fontSize:`${u+.8}rem`}})}),!t&&!a&&e.jsx("span",{className:"Avatar--FirstChar",style:{fontSize:`${u}rem`},children:p})]}),n&&e.jsx("div",{className:"Avatar--Badge",style:{width:`${m}rem`,height:`${m}rem`,border:`${h}rem solid #ffffff`}})]})},ne=O.object({login:O.object({current_password:O.string().required("Please enter current password"),password:O.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"),confirm_password:O.string().required("Please enter confirm password").oneOf([O.ref("password")],"Passwords must match")})}),ae=({showModal:r,setShowModal:o})=>{const{changeUserPassword:s}=v.useAuth(),[l,d]=t.useState(null),{control:c,handleSubmit:u,trigger:m}=E.useForm({resolver:Z(ne),mode:"all"}),h=async e=>{if(await m())return await s(e.login,(e,r)=>{r?(d({message:e,type:"normal"}),o(!1)):d({message:e,type:"alert"})}),e},[p,g]=t.useState(!1),[x,y]=t.useState(!1),[f,j]=t.useState(!1),b=i.styled(a)(()=>({display:"flex",flexDirection:"column"}));return e.jsxs(e.Fragment,{children:[e.jsx($,{open:r,onClose:()=>o(!1),children:e.jsx(e.Fragment,{children:e.jsx("form",{onSubmit:u(h),children:e.jsxs(b,{gap:4,className:"popup-change-pass",children:[e.jsxs(b,{gap:2,children:[e.jsxs(a,{children:[e.jsx(v.Typography,{align:"center",type:"h1",weight:"medium",color:"theme.secondary.1000",children:"Change Password"}),e.jsx(v.Typography,{align:"center",type:"h5",weight:"normal",color:"theme.secondary81000",children:"Enter Details below"})]}),e.jsxs(b,{gap:2,children:[e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Current Password",name:"current_password",type:x?"text":"password",placeholder:"Enter Current Password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:x?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>y(!x)})}),e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Password",name:"password",type:p?"text":"password",placeholder:"Enter Password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:p?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>g(!p)})}),e.jsx(a,{children:e.jsx(Q,{formControl:c,label:"Confirm Password",name:"confirm_password",type:f?"text":"password",fieldArrayName:"login",endIcon:e.jsx(e.Fragment,{children:f?e.jsx(n.Eye,{fontSize:"small",htmlColor:"#292D32"}):e.jsx(n.EyeOff,{fontSize:"small",htmlColor:"#292D32"})}),onIconClick:()=>j(!f),placeholder:"Enter confirm password"})})]})]}),e.jsx(b,{gap:2,children:e.jsx(V,{type:"button",onClick:u(h),size:"large",variant:"contained",children:"Change Password"})})]})})})}),e.jsx(te,{open:Boolean(l),message:null==l?void 0:l.message,type:null==l?void 0:l.type,handleClose:()=>d(null),anchorOrigin:{horizontal:"right",vertical:"bottom"},autoHideDuration:3e3})]})},ie={rbac:b.images.user,document:b.images.document,"accounts-and-finance":b.images.accounting,inventory:b.images.inventory,manufacturing:b.images.manufacturing,sales:b.images.crm,rental:b.images.rental,user:b.images.user,purchase:b.images.procurement,hrms:b.images.hrms},se={rbac:"#F3E5F5",document:"#FFF8E1","accounts-and-finance":"#E8F5E8",inventory:"#E3F2FD",manufacturing:"#FFF3E0",sales:"#F3E5F5",rental:"#E8F5E8",user:"#F3E5F5",purchase:"#FCE4EC",hrms:"#fcfcfc"},le=()=>{const[r,a]=t.useState(null),[i,s]=t.useState([]),[l,d]=t.useState(!1),[u,m]=t.useState(!1),[h,p]=t.useState(null),[g,x]=t.useState(0),[y,f]=t.useState(!1),[b,S]=t.useState({skip:0,limit:10,totalCount:0,hasMore:!0}),C=c.useNavigate(),w=t.useRef(null),P=t.useRef(!1),I=Boolean(r),E=r=>{const t={"accounts-and-finance":e.jsx(M.AccountBalance,{color:"primary"}),user:e.jsx(M.Person,{color:"action"}),approval:e.jsx(M.Assignment,{color:"warning"})},o=r.sub_module_data||{};return{id:r.id,type:r.action||r.notification_type||"info",title:T.formatText(r.title),message:r.message,timestamp:(e=>{const r=new Date(e),t=new Date-r,o=Math.floor(t/6e4),n=Math.floor(t/36e5),a=Math.floor(t/864e5);return o<1?"Just now":o<60?`${o} minute${o>1?"s":""} ago`:n<24?`${n} hour${n>1?"s":""} ago`:a<7?`${a} day${a>1?"s":""} ago`:r.toLocaleDateString()})(r.created_at),read:"read"===r.status,avatar:(e=>{if(!e)return null;const r=e.first_name||"",t=e.last_name||"";return r||t?(r.charAt(0)+t.charAt(0)).toUpperCase():null})(r.performed_user),performedByName:(n=r.performed_user,n&&`${n.first_name||""} ${n.last_name||""}`.trim()||null),module:r.module,subModule:r.sub_module,subModuleId:r.sub_module_id,status:r.status,seriesNumber:o.series_number||null,documentStatus:o.status||null,customerName:o.customer_name||null,icon:t[r.module]||t[r.action]||e.jsx(M.Person,{color:"action"})};var n},_=t.useCallback(async(e=!1)=>{if(!e||!P.current){e?(P.current=!0,m(!0)):(d(!0),S(e=>({...e,skip:0,hasMore:!0}))),p(null);try{const r=e?b.skip:0,t=await B.getV1Notification({skip:r,limit:b.limit,...T.getToken()});if(!t.success||!t.data)throw x(0),new Error(t.message||"Failed to load notifications");{const o=t.data.notifications.map(E);s(e?e=>[...e,...o]:o);const n=r+t.data.notifications.length,a=n<t.data.pagination.totalCount;if(S(e=>({...e,skip:n,totalCount:t.data.pagination.totalCount,hasMore:a})),!e){const e=t.data.pagination.unreadCount;x(e)}}}catch(r){p("Failed to load notifications")}finally{d(!1),m(!1),e&&(P.current=!1)}}},[b.limit,b.skip]),R=t.useCallback(e=>{const{scrollTop:r,scrollHeight:t,clientHeight:o}=e.target;r+o>=t-50&&!P.current&&!l&&b.hasMore&&_(!0)},[_,l,b.hasMore]),k=()=>{a(null)},N=r=>{if(r.icon)return r.icon;switch(r.type){case"approval":return e.jsx(M.Assignment,{color:"warning"});case"user":default:return e.jsx(M.Person,{color:"action"});case"message":return e.jsx(M.Email,{color:"primary"});case"warning":return e.jsx(M.Warning,{color:"warning"});case"success":return e.jsx(M.CheckCircle,{color:"success"})}},A=t.useCallback(async()=>{if(!y){if(f(!0),!g)return W.enqueueSnackbar("No unread notifications!"),void f(!1);try{await B.getV1NotificationMarkAllAsRead({...T.getToken()}),s(e=>e.map(e=>({...e,read:!0,status:"read"}))),x(0)}catch(e){const r=T.getErrorMessage(e.message);W.enqueueSnackbar(r,{variant:"error"})}finally{f(!1)}}},[y,g]);t.useEffect(()=>{I||setTimeout(()=>{s([])},500)},[I]);const D=e=>{switch(null==e?void 0:e.toLowerCase()){case"approved":return"Approved by";case"rejected":case"reject":return"Rejected by";default:return"Request to"}},F=r=>{switch(null==r?void 0:r.toLowerCase()){case"approved":return e.jsx(M.CheckCircle,{sx:{fontSize:"0.9rem",color:"success.main"}});case"rejected":case"reject":return e.jsx(M.Cancel,{sx:{fontSize:"0.9rem",color:"error.main"}});default:return e.jsx(M.HourglassEmpty,{sx:{fontSize:"0.9rem",color:"warning.main"}})}};return e.jsxs(o.Box,{children:[e.jsx(o.IconButton,{"aria-label":"notifications","aria-controls":I?"notification-menu":void 0,"aria-haspopup":"true","aria-expanded":I?"true":void 0,onClick:e=>{a(e.currentTarget),0===i.length&&_()},children:e.jsx(o.Badge,{badgeContent:g,color:"error",children:e.jsx(q.Notification,{fontSize:"medium"})})}),e.jsxs(o.Menu,{id:"notification-menu",anchorEl:r,open:I,onClose:k,ref:w,slotProps:{paper:{sx:{overflow:"visible",minWidth:400,maxWidth:450,maxHeight:520,"&:before":{content:'""',display:"block",position:"absolute",top:0,right:"50%",width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) translateX(50%) rotate(45deg)",zIndex:0,border:"1px solid",borderColor:({palette:e})=>e.grey[300]}}}},sx:{"& .MuiList-root":{borderRadius:"8px",maxHeight:520,overflowY:"auto",padding:0}},transformOrigin:{horizontal:"center",vertical:"top"},anchorOrigin:{horizontal:"center",vertical:"bottom"},onScroll:R,children:[e.jsxs(o.Box,{sx:{px:2,py:1,borderBottom:"1px solid #e0e0e0",backgroundColor:"#fafafa"},children:[e.jsx(v.Typography,{type:"h5",weight:"bold",color:"grey.1000",children:"Notifications"}),g>0&&e.jsxs(o.Box,{sx:{display:"flex",justifyContent:"space-between",width:"100%",alignItems:"center"},children:[e.jsxs(v.Typography,{type:"s4",color:"grey.800",children:["You have ",g," unread notification",g>1?"s":""]}),e.jsx(V,{variant:"text",startIcon:y?e.jsx(o.CircularProgress,{size:15,color:"inherit"}):e.jsx(n.Tick,{sx:{fontSize:"0.75rem !important"},color:"grey.900"}),sx:{p:0},onClick:A,disabled:g<=0||y,children:e.jsx(v.Typography,{type:"s4",color:"grey.900",children:"Mark all as read"})})]})]}),l&&0===i.length&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1,justifyContent:"center",minWidth:400,p:1,m:1,backgroundColor:"grey.200",borderRadius:"8px"},children:e.jsxs(o.Box,{sx:{display:"flex",gap:1},children:[e.jsx(o.Skeleton,{variant:"rounded",width:40,height:40}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[e.jsx(o.Skeleton,{variant:"rounded",width:360,height:25}),e.jsx(o.Skeleton,{variant:"rounded",width:150,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11}),e.jsx(o.Skeleton,{variant:"rounded",width:360,height:11})]})]})})]}),h&&e.jsx(o.Box,{sx:{p:2},children:e.jsx(o.Alert,{severity:"error",children:h})}),!l&&!h&&i.length>0&&e.jsxs(o.Box,{sx:{maxHeight:420,overflowY:"auto",p:1},onScroll:R,children:[i.map(r=>e.jsx("div",{children:e.jsxs(o.MenuItem,{onClick:()=>(async e=>{const r=i.find(r=>r.id===e);if(!r)return;k(),"pending"===r.status&&await B.patchV1NotificationMarkAsReadId({id:e,...T.getToken()}),s(r=>r.map(r=>r.id===e?{...r,read:!0}:r)),x(e=>Math.max(0,e-1));const t=(e=>{var r;const{moduleName:t="",moduleId:o="",notificationData:n={}}=e,a={sales_invoice:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_SALES_INVOICES),o.toString()),asset_transfers:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_ASSET_TRANSFER),o.toString()),budgets:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_BUDGET),o.toString()),cash_expense:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_CASH_EXPENSE),o.toString()),credit_notes:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_CREDIT_NOTE),o.toString()),debit_notes:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_DEBIT_NOTE),o.toString()),expense_reimbursement:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT),o.toString()),journal_entries:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_JOURNAL_ENTRY),o.toString()),payment_entries:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_PAYMENT_ENTRY),o.toString()),purchase_invoice:()=>v.generateRouteWithId(j.PathnameGenerator$5(j.PathnameAccounting.VIEW_PURCHASE_INVOICE),o.toString()),stock_transfer:()=>v.generateRouteWithId(j.PathnameGenerator$4(j.PathnameInventory.VIEW_STOCK_TRANSFER),o.toString()),bills_of_materials:()=>v.generateRouteWithId(j.PathnameGenerator$3(j.PathnameManufacturing.VIEW_BILL_OF_MATERIAL),o.toString()),purchase_agreement:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_AGREEMENT),o.toString()),purchase_orders:()=>{var e;return v.generateRouteWithId(1==(null==(e=null==n?void 0:n.data)?void 0:e.is_rental)?j.ROUTES.VIEW:j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_ORDER),o.toString())},purchase_request:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_PURCHASE_ORDER),o.toString()),vra:()=>v.generateRouteWithId(j.PathnameGenerator$1(j.PathnamePurchase.VIEW_VENDOR_RETURNS),o.toString()),sales_customer_returns:()=>v.generateRouteWithId(j.PathnameGenerator$2(j.PathnameCrm.VIEW_CUSTOMER_RETURNS),o.toString()),sales_order:()=>v.generateRouteWithId(j.PathnameGenerator$2(j.PathnameCrm.VIEW_SALES_ORDER),o.toString()),rental_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_RENTAL_ORDER),o.toString()),replacement_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_RENTAL_ORDER),o.toString()),rental_agreement:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_AGREEMENT),o.toString()),cross_hire_order:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_CROSS_HIRE_ORDER),o.toString()),cross_hire_request:()=>v.generateRouteWithId(j.PathnameGenerator(j.PathnameRental.VIEW_CROSS_HIRE_REQUEST),o.toString())};return(null==(r=a[T.convertToUnderscore(t)])?void 0:r.call(a))||"/dashboard"})({moduleName:r.subModule,moduleId:r.subModuleId,notificationData:r});setTimeout(()=>{C(t)},300)})(r.id),sx:({palette:e})=>({py:1,px:1,backgroundColor:r.read?"transparent":e.theme.grey[200],border:`1px solid ${e.grey[200]}`,marginBottom:"4px !important","&:hover":{backgroundColor:e.theme.grey[200]},alignItems:"flex-start",minHeight:"auto"}),children:[e.jsx(o.ListItemAvatar,{sx:{minWidth:48,mt:0},children:(null==ie?void 0:ie[r.module])?e.jsx(o.Avatar,{sx:{width:40,height:40,fontSize:"0.875rem",bgcolor:se[r.module]||"primary.main",color:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)","& img":{width:"28px",height:"28px",objectFit:"contain"}},src:null==ie?void 0:ie[r.module]}):e.jsx(e.Fragment,{children:r.avatar?e.jsx(o.Avatar,{sx:{width:40,height:40,fontSize:"0.875rem",bgcolor:"primary.main",color:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:r.avatar}):e.jsx(o.Avatar,{sx:{width:36,height:36,bgcolor:"grey.100",color:"grey.600",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:N(r)})})}),e.jsx(o.ListItemText,{sx:{margin:0,pr:1},primary:e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap",mb:.25},children:[e.jsx(v.Typography,{type:"s3",weight:"bold",color:"grey.1000",children:r.title}),r.seriesNumber&&e.jsx(v.Typography,{type:"s4",sx:{color:"text.secondary",fontWeight:500},children:r.seriesNumber}),F(r.type)]}),secondary:e.jsxs(o.Box,{children:[r.customerName&&e.jsxs(v.Typography,{type:"s4",color:"grey.800",sx:{display:"block",mb:.25},children:[e.jsx(v.Typography,{component:"span",type:"s5",sx:{fontSize:"0.7rem !important",color:"text.secondary",mr:.5},children:"purchase"===r.module?"Vendor:":"Customer:"}),r.customerName]}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[r.performedByName&&e.jsxs(v.Typography,{type:"s5",sx:{fontSize:"0.7rem !important",color:"text.secondary"},children:[D(r.type)," ",r.performedByName]}),r.performedByName&&e.jsx(o.Box,{sx:{height:4,width:4,borderRadius:"100%",backgroundColor:"grey.400",flexShrink:0}}),e.jsx(v.Typography,{type:"s5",color:"primary",sx:{fontSize:"0.65rem !important"},children:r.timestamp})]})]})}),!r.read&&e.jsx(o.Box,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:"primary.main",flexShrink:0,mt:.5}})]})},r.id)),u&&e.jsxs(o.Box,{sx:{display:"flex",justifyContent:"center",py:2.5,px:3},children:[e.jsx(o.CircularProgress,{size:20}),e.jsx(v.Typography,{variant:"body2",sx:{ml:1.5,color:"text.secondary"},children:"Loading more..."})]}),!b.hasMore&&i.length>0&&e.jsx(o.Box,{sx:{textAlign:"center",py:1.5,px:2},children:e.jsx(v.Typography,{type:"s3",color:"grey.800",textAlign:"center",children:"No more notifications"})})]}),!l&&!h&&0===i.length&&e.jsxs(o.Box,{sx:{p:4,textAlign:"center"},children:[e.jsx(q.Notification,{sx:{fontSize:56,color:"text.secondary",mb:2}}),e.jsx(v.Typography,{type:"s1",color:"grey.800",sx:{mb:1},textAlign:"center",children:"No notifications yet"})]})]})]})};function de(r){const o=c.useNavigate(),{t:i}=u.useTranslation(),s=c.useLocation(),{logout:l,user:S}=v.useAuth(),w=D.getApiConfig(),{languages:P,currentLanguage:E,changeLanguage:_,isLoading:R,error:k,isFallbackActive:N,fetchLanguages:A,isRtl:M}=I.useLanguage(),{pathname:B}=s,[W,q]=t.useState(null),[F,O]=t.useState(!1),[z,V]=t.useState(null),[L,$]=t.useState(!1),G=localStorage.getItem("_u_data")||void 0,H=G?JSON.parse(G):"",U=Boolean(W),K=()=>O(!F),J=t.useCallback(e=>{const r=Array.isArray(e)?e.map(e=>({path:e})):[{path:e}];return Boolean(c.matchRoutes(r,s))},[s]),X=t.useMemo(()=>C.modules(i),[i]),Q=t.useMemo(()=>X.find(e=>{var r;return(null==(r=null==e?void 0:e.link)?void 0:r.toLowerCase())===B.toLowerCase()||J(e.connectedRoutes)})||null,[X,B,J]),Z=e=>{const r=e.target.value;if(V(null),!P||0===P.length){const e=i("header.language_not_available")||"Languages not available";return void V(e)}if(P.some(e=>e.code===r))try{_(r)}catch(t){const e=t instanceof Error?t.message:"Failed to change language";V(e)}else{const e=i("header.language_not_found",{language:r})||`Selected language "${r}" is not available`;V(e)}},re=async()=>{V(null);try{await A()}catch(e){V("Failed to reload languages")}},te="primary-search-account-menu",ne=e.jsxs(p,{className:"main-profile-menu",anchorEl:W,id:te,keepMounted:!0,open:U,onClose:()=>{q(null)},children:[e.jsx(h,{className:"user-assigned",children:e.jsx("span",{children:i("common.assigned_roles")||"Assigned roles"})}),e.jsxs(h,{className:"user-data-wrap",value:H.role_id,children:[e.jsx(f,{children:e.jsx(oe,{size:27,alt:H.role_name})}),e.jsx(x,{className:"size15",children:H.role_name}),e.jsx(v.Typography,{variant:"body2",color:"text.secondary",children:e.jsx("img",{src:b.images.tickicon,alt:"Active"})})]}),e.jsx(y,{}),e.jsxs(h,{className:"user-assigned",onClick:()=>{$(!0),q(null)},children:[e.jsx(f,{children:e.jsx(n.Eye,{fontSize:"medium",width:20,height:20,htmlColor:"#292D32"})}),e.jsx(x,{className:"size15",children:i("common.change_password")})]}),e.jsx(y,{}),e.jsxs(h,{className:"menu-item-color",onClick:()=>{K(),q(null)},children:[e.jsx(f,{children:e.jsx("img",{src:b.images.logout,alt:"logout"})}),e.jsx(x,{className:"size15",children:i("common.logout")})]})]}),ie=D.getApiConfig().appLogo||b.images.logo;return e.jsxs(e.Fragment,{children:[e.jsxs(a,{className:"main-box",children:[!r.isDropdownShow&&e.jsx(c.Link,{to:S?j.Pathname.DASHBOARD:j.Pathname.LOGIN,children:e.jsx("img",{src:ie,alt:"logo",height:55})}),e.jsx(a,{className:"second-box",children:r.isDropdownShow&&e.jsxs(e.Fragment,{children:[e.jsx(d,{onClick:()=>{window.history.back()},children:e.jsx(g,{className:M?"arrow-pointer_rtl":"arrow-pointer"})}),e.jsx(a,{width:250,children:e.jsx(Y,{fullWidth:!0,placeholder:"Placeholder",size:"small",value:(null==Q?void 0:Q.link)||"",onChange:e=>{const r=e.target.value;setTimeout(()=>{o(r)},300)},className:"select-box",variant:"outlined",renderValue:r=>e.jsx(e.Fragment,{children:Q?e.jsxs(a,{className:"selected-menu-box",children:[e.jsx("img",{src:Q.icon,alt:Q.label}),Q.label]}):r}),children:X.map((r,t)=>e.jsxs(h,{className:"select-box-menu-item",value:r.link,children:[e.jsx("img",{src:r.icon,alt:r.label}),r.label]},t))})})]})}),e.jsxs(a,{className:"header-right-wrap",children:[e.jsx(a,{className:"language-selector-wrapper",children:(()=>{const r=P&&0!==P.length?P.some(e=>"en"===e.code)?P:[{code:"en",label:"English",direction:"ltr"},...P]:[{code:"en",label:"English",direction:"ltr"}],t=(null==E?void 0:E.code)||"en";return R?e.jsx(a,{className:"language-loading",children:e.jsx(v.Typography,{variant:"body2",color:"text.secondary",children:"Loading..."})}):e.jsxs(Y,{onChange:Z,size:"small",value:t,renderValue:()=>E?N||k?`${E.label}`:E.label:i("header.select_language")||"Select Language",error:!!z,className:"language-select "+(N||k?"language-fallback-active":""),children:[r.map(({code:r,label:t})=>e.jsx(h,{value:r,children:e.jsx(v.Typography,{type:"s4",weight:"medium",color:"theme.secondary.1000",children:t})},r)),k&&e.jsx(h,{onClick:re,style:{fontStyle:"italic"},children:e.jsxs(v.Typography,{type:"s4",weight:"medium",color:"theme.secondary.500",children:["🔄 ",i("header.retry_languages")||"Retry loading languages"]})})]})})()}),e.jsx(le,{}),e.jsx(d,{size:"small","aria-label":"help",className:"p-0",children:e.jsx("img",{src:b.images.question,alt:"question icon"})}),e.jsx("img",{src:b.images.vdivider,alt:"divider icon"}),localStorage.getItem("_tid")?e.jsxs(a,{className:"user-profile-box",onClick:e=>q(e.currentTarget),children:[e.jsx(oe,{size:32,src:(null==S?void 0:S.profile_image)?`${null==w?void 0:w.s3BucketUrl}${null==S?void 0:S.profile_image}`:void 0,alt:T.formatText(null==S?void 0:S.full_name),className:"avatar-class"}),e.jsxs("div",{children:[e.jsx(v.Typography,{className:"profile-name",children:null==S?void 0:S.full_name}),e.jsx(v.Typography,{className:"user-auth",children:null==S?void 0:S.role_name})]})]}):e.jsx(d,{size:"large",edge:"end","aria-label":"account of current user","aria-controls":te,"aria-haspopup":"true",component:c.Link,to:j.Pathname.LOGIN,color:"inherit",children:e.jsx(m,{className:"icon-btn"})})]}),ne]}),e.jsx(ee,{open:F,title:i("common.logout"),description:i("common.logout_confirmation")||"Are you sure, you want to logout?",onConfirm:()=>l(),onClose:K,fullWidth:!0,maxWidth:"xs",buttonTexts:{confirm:i("common.logout"),cancel:i("common.cancel")}}),e.jsx(ae,{showModal:L,setShowModal:$})]})}let ce;const ue=i.styled(s,{shouldForwardProp:e=>"open"!==e})(({theme:e,open:r})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),...r&&{marginLeft:"ltr"===document.body.dir?ce:0,marginRight:"rtl"===document.body.dir?ce:0,width:`calc(100% - ${ce}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})},boxShadow:"none"}));exports.ActivityArea=r=>e.jsx(a,{className:"main-wrapper",component:"main",width:"100%",marginTop:"4.6875rem",children:r.children}),exports.AppBarWrapper=r=>(ce=r.width,e.jsx(ue,{position:"fixed",open:null==r?void 0:r.open,sx:e=>{var r,t;return{borderBottom:"1px solid",borderColor:null==(r=e.palette.theme)?void 0:r.secondary[200],backgroundColor:null==(t=e.palette.theme)?void 0:t.secondary[100]}},children:e.jsx(l,{sx:{backgroundColor:"grey.100"},children:(null==r?void 0:r.handleDrawerOpen)?e.jsxs(e.Fragment,{children:[e.jsx(d,{color:"inherit","aria-label":"open drawer",edge:"start",sx:{marginRight:5,...r.open&&{display:"none"}},children:e.jsx("img",{src:b.images.favicon,height:30,width:30})}),e.jsx(de,{isDropdownShow:!0})]}):e.jsx(e.Fragment,{children:e.jsx(de,{isDropdownShow:!1})})})})),exports.Avatar=oe,exports.Button=V,exports.ConfirmPopUp=ee,exports.DynamicInput=Q,exports.Header=de,exports.Modal=$,exports.ResetPasswordModal=ae,exports.SearchBar=({handleSearch:o,debounceTime:a=300,className:i,InputProps:s,isDrivePage:l,searchText:d,value:c="",...u})=>{const[m,h]=t.useState(""),p=t.useRef();return t.useEffect(()=>{const e=l&&localStorage.getItem("searchTerm")||"";h(e),l&&localStorage.setItem("searchTerm","")},[l]),t.useEffect(()=>{h("string"==typeof d&&d||"")},[d]),t.useEffect(()=>(p.current=r.debounce(e=>o(e),a),()=>{var e;null==(e=p.current)||e.cancel()}),[o,a]),t.useEffect(()=>{h(c||"")},[]),e.jsxs("div",{className:`${i} search-wrapper`,children:[e.jsx(K,{fullWidth:!0,className:"s3",value:m,onChange:e=>{const r=e.target.value;h(r),l&&localStorage.setItem("searchTerm",r),p.current&&p.current(r)},onKeyDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},autoComplete:"off",InputProps:s,...u}),e.jsx("span",{className:"search-icon",children:m?e.jsx(n.SearchStatus,{fontSize:"small",sx:{color:m?"grey.900":"grey.700"}}):e.jsx(n.Search,{fontSize:"small",sx:{color:m?"grey.900":"grey.700"}})})]})},exports.Select=Y,exports.TextField=X,exports.Toast=te,exports.Tooltip=({title:r,children:t,sx:n,...a})=>e.jsx(o.Tooltip,{componentsProps:{tooltip:{sx:{padding:"0.5rem 0.75rem",backgroundColor:"#393B3E",maxWidth:"12rem","& .MuiTooltip-arrow":{color:"#393B3E"},...n}}},title:r,...a,children:t}),exports.o=Z;
|
|
2
|
+
//# sourceMappingURL=appbar-C6Es9HGk.js.map
|