2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
import{x as _e,y as $e,b as w,z as ze,E as Ce,_ as P,j as e,F as ke,G as z,H as Re,J as N,ac as Ie,ad as Me,O as se,r as v,i as m,S as l,T as x,B as u,A as Oe,M as ie,D as I,I as Pe}from"./index-D7LVXeIK.js";import{d as Ae,a as Ne}from"./VisibilityOff-DxGE-YKE.js";import{P as Te,C as D,G as C,A as He}from"./PageHeader-naLAT9xr.js";import{B as k}from"./Button-Bqp5awT1.js";import{C as A}from"./Link-BEif5YS2.js";import{T as $}from"./TextField-Sd_pshci.js";import{S as We}from"./SwitchBase-CWj2k0Bo.js";import{L as De}from"./LinearProgress-yV9HNsZU.js";import{S as Ve}from"./Snackbar-DOheZfWW.js";import{I as Le}from"./InputAdornment-CMIlL2rx.js";function Ee(t){return _e("MuiSwitch",t)}const c=$e("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),Be=["className","color","edge","size","sx"],Fe=t=>{const{classes:r,edge:s,size:o,color:g,checked:d,disabled:n}=t,S={root:["root",s&&`edge${z(s)}`,`size${z(o)}`],switchBase:["switchBase",`color${z(g)}`,d&&"checked",n&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},y=Re(S,Ee,r);return P({},r,y)},Ge=N("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(t,r)=>{const{ownerState:s}=t;return[r.root,s.edge&&r[`edge${z(s.edge)}`],r[`size${z(s.size)}`]]}})({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${c.thumb}`]:{width:16,height:16},[`& .${c.switchBase}`]:{padding:4,[`&.${c.checked}`]:{transform:"translateX(16px)"}}}}]}),qe=N(We,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(t,r)=>{const{ownerState:s}=t;return[r.switchBase,{[`& .${c.input}`]:r.input},s.color!=="default"&&r[`color${z(s.color)}`]]}})(({theme:t})=>({position:"absolute",top:0,left:0,zIndex:1,color:t.vars?t.vars.palette.Switch.defaultColor:`${t.palette.mode==="light"?t.palette.common.white:t.palette.grey[300]}`,transition:t.transitions.create(["left","transform"],{duration:t.transitions.duration.shortest}),[`&.${c.checked}`]:{transform:"translateX(20px)"},[`&.${c.disabled}`]:{color:t.vars?t.vars.palette.Switch.defaultDisabledColor:`${t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]}`},[`&.${c.checked} + .${c.track}`]:{opacity:.5},[`&.${c.disabled} + .${c.track}`]:{opacity:t.vars?t.vars.opacity.switchTrackDisabled:`${t.palette.mode==="light"?.12:.2}`},[`& .${c.input}`]:{left:"-100%",width:"300%"}}),({theme:t})=>({"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.action.activeChannel} / ${t.vars.palette.action.hoverOpacity})`:se(t.palette.action.active,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(t.palette).filter(([,r])=>r.main&&r.light).map(([r])=>({props:{color:r},style:{[`&.${c.checked}`]:{color:(t.vars||t).palette[r].main,"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:se(t.palette[r].main,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${c.disabled}`]:{color:t.vars?t.vars.palette.Switch[`${r}DisabledColor`]:`${t.palette.mode==="light"?Ie(t.palette[r].main,.62):Me(t.palette[r].main,.55)}`}},[`&.${c.checked} + .${c.track}`]:{backgroundColor:(t.vars||t).palette[r].main}}}))]})),Ue=N("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(t,r)=>r.track})(({theme:t})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:t.transitions.create(["opacity","background-color"],{duration:t.transitions.duration.shortest}),backgroundColor:t.vars?t.vars.palette.common.onBackground:`${t.palette.mode==="light"?t.palette.common.black:t.palette.common.white}`,opacity:t.vars?t.vars.opacity.switchTrack:`${t.palette.mode==="light"?.38:.3}`})),Ye=N("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(t,r)=>r.thumb})(({theme:t})=>({boxShadow:(t.vars||t).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),M=w.forwardRef(function(r,s){const o=ze({props:r,name:"MuiSwitch"}),{className:g,color:d="primary",edge:n=!1,size:S="medium",sx:y}=o,R=Ce(o,Be),i=P({},o,{color:d,edge:n,size:S}),j=Fe(i),b=e.jsx(Ye,{className:j.thumb,ownerState:i});return e.jsxs(Ge,{className:ke(j.root,g),sx:y,ownerState:i,children:[e.jsx(qe,P({type:"checkbox",icon:b,checkedIcon:b,ref:s,ownerState:i},R,{classes:P({},j,{root:j.switchBase})})),e.jsx(Ue,{className:j.track,ownerState:i})]})});var E={},Ze=m;Object.defineProperty(E,"__esModule",{value:!0});var de=E.default=void 0,Xe=Ze(v()),Je=e;de=E.default=(0,Xe.default)((0,Je.jsx)("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm2 16H5V5h11.17L19 7.83zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3M6 6h9v4H6z"}),"SaveOutlined");var B={},Ke=m;Object.defineProperty(B,"__esModule",{value:!0});var F=B.default=void 0,Qe=Ke(v()),et=e;F=B.default=(0,Qe.default)((0,et.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");var G={},tt=m;Object.defineProperty(G,"__esModule",{value:!0});var q=G.default=void 0,rt=tt(v()),at=e;q=G.default=(0,rt.default)((0,at.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"}),"NotificationsNone");var U={},st=m;Object.defineProperty(U,"__esModule",{value:!0});var Y=U.default=void 0,it=st(v()),ot=e;Y=U.default=(0,it.default)((0,ot.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOutlined");var Z={},nt=m;Object.defineProperty(Z,"__esModule",{value:!0});var L=Z.default=void 0,lt=nt(v()),ct=e;L=Z.default=(0,lt.default)((0,ct.jsx)("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25z"}),"ShieldOutlined");var X={},dt=m;Object.defineProperty(X,"__esModule",{value:!0});var ue=X.default=void 0,ut=dt(v()),ht=e;ue=X.default=(0,ut.default)((0,ht.jsx)("path",{d:"M18 11v2h4v-2zm-2 6.61c.96.71 2.21 1.65 3.2 2.39.4-.53.8-1.07 1.2-1.6-.99-.74-2.24-1.68-3.2-2.4-.4.54-.8 1.08-1.2 1.61M20.4 5.6c-.4-.53-.8-1.07-1.2-1.6-.99.74-2.24 1.68-3.2 2.4.4.53.8 1.07 1.2 1.6.96-.72 2.21-1.65 3.2-2.4M4 9c-1.1 0-2 .9-2 2v2c0 1.1.9 2 2 2h1v4h2v-4h1l5 3V6L8 9zm5.03 1.71L11 9.53v4.94l-1.97-1.18-.48-.29H4v-2h4.55zM15.5 12c0-1.33-.58-2.53-1.5-3.35v6.69c.92-.81 1.5-2.01 1.5-3.34"}),"CampaignOutlined");var J={},pt=m;Object.defineProperty(J,"__esModule",{value:!0});var he=J.default=void 0,xt=pt(v()),vt=e;he=J.default=(0,xt.default)((0,vt.jsx)("path",{d:"M12 7V3H2v18h20V7zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8zm-2-8h-2v2h2zm0 4h-2v2h2z"}),"BusinessOutlined");var K={},mt=m;Object.defineProperty(K,"__esModule",{value:!0});var pe=K.default=void 0,gt=mt(v()),oe=e;pe=K.default=(0,gt.default)([(0,oe.jsx)("path",{d:"M23 11.99 20.56 9.2l.34-3.69-3.61-.82L15.4 1.5 12 2.96 8.6 1.5 6.71 4.69 3.1 5.5l.34 3.7L1 11.99l2.44 2.79-.34 3.7 3.61.82 1.89 3.2 3.4-1.47 3.4 1.46 1.89-3.19 3.61-.82-.34-3.69zm-3.95 1.48-.56.65.08.85.18 1.95-1.9.43-.84.19-.44.74-.99 1.68-1.78-.77-.8-.34-.79.34-1.78.77-.99-1.67-.44-.74-.84-.19-1.9-.43.18-1.96.08-.85-.56-.65L3.67 12l1.29-1.48.56-.65-.09-.86-.18-1.94 1.9-.43.84-.19.44-.74.99-1.68 1.78.77.8.34.79-.34 1.78-.77.99 1.68.44.74.84.19 1.9.43-.18 1.95-.08.85.56.65 1.29 1.47z"},"0"),(0,oe.jsx)("path",{d:"m10.09 13.75-2.32-2.33-1.48 1.49 3.8 3.81 7.34-7.36-1.48-1.49z"},"1")],"VerifiedOutlined");var Q={},ft=m;Object.defineProperty(Q,"__esModule",{value:!0});var xe=Q.default=void 0,jt=ft(v()),bt=e;xe=Q.default=(0,jt.default)((0,bt.jsx)("path",{d:"M12 5.99 19.53 19H4.47zM2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1m0 5h2v2h-2z"}),"WarningAmberRounded");var ee={},wt=m;Object.defineProperty(ee,"__esModule",{value:!0});var ve=ee.default=void 0,yt=wt(v()),St=e;ve=ee.default=(0,yt.default)((0,St.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m-1-4h2v2h-2zm1.61-9.96c-2.06-.3-3.88.97-4.43 2.79-.18.58.26 1.17.87 1.17h.2c.41 0 .74-.29.88-.67.32-.89 1.27-1.5 2.3-1.28.95.2 1.65 1.13 1.57 2.1-.1 1.34-1.62 1.63-2.45 2.88 0 .01-.01.01-.01.02-.01.02-.02.03-.03.05-.09.15-.18.32-.25.5-.01.03-.03.05-.04.08-.01.02-.01.04-.02.07-.12.34-.2.75-.2 1.25h2c0-.42.11-.77.28-1.07.02-.03.03-.06.05-.09.08-.14.18-.27.28-.39.01-.01.02-.03.03-.04.1-.12.21-.23.33-.34.96-.91 2.26-1.65 1.99-3.56-.24-1.74-1.61-3.21-3.35-3.47"}),"HelpOutlineRounded");var te={},_t=m;Object.defineProperty(te,"__esModule",{value:!0});var me=te.default=void 0,$t=_t(v()),zt=e;me=te.default=(0,$t.default)((0,zt.jsx)("path",{d:"m17 8-1.41 1.41L17.17 11H9v2h8.17l-1.58 1.58L17 16l4-4zM5 5h7V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h7v-2H5z"}),"LogoutOutlined");var re={},Ct=m;Object.defineProperty(re,"__esModule",{value:!0});var ge=re.default=void 0,kt=Ct(v()),Rt=e;ge=re.default=(0,kt.default)((0,Rt.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");const fe=["Asia/Kolkata (IST)","Asia/Dubai (GST)","UTC","America/New_York (EST)"],je=["English","हिन्दी (Hindi)","العربية (Arabic)"],ne={orgName:"Doormile Technologies",supportEmail:"support@doormile.in",contact:"+91 63749 46729",timezone:fe[0],language:je[0]},le={newClient:!0,contractStatus:!0,teamAccess:!1,databaseSync:!0,emailAlerts:!0,smsAlerts:!1},ce={currentPassword:"",newPassword:"",confirmPassword:"",twoFactor:!1},It=[{icon:F,label:"General",desc:"Organisation profile"},{icon:q,label:"Notifications",desc:"Alerts & channels"},{icon:Y,label:"Security",desc:"Password & 2FA"}],Mt=[{k:"newClient",t:"New client onboarded",d:"Notify when a new client is added to the system"},{k:"contractStatus",t:"Contract status",d:"When a client contract becomes active or expires"},{k:"teamAccess",t:"Team access",d:"When a new team member is granted or revoked access"},{k:"databaseSync",t:"Database sync",d:"Alerts for vector database synchronization events"}],Ot=[{label:"Too weak",color:"error"},{label:"Weak",color:"error"},{label:"Fair",color:"warning"},{label:"Good",color:"info"},{label:"Strong",color:"success"}],Pt=t=>{let r=0;return t.length>=8&&r++,/[a-z]/.test(t)&&/[A-Z]/.test(t)&&r++,/\d/.test(t)&&r++,/[^A-Za-z0-9]/.test(t)&&r++,r};function _({icon:t,title:r,subtitle:s,color:o="primary",danger:g=!1,children:d}){return e.jsxs(A,{sx:g?{borderColor:"error.light"}:void 0,children:[e.jsxs(l,{direction:"row",spacing:1.75,alignItems:"center",sx:{px:{xs:2,sm:3},py:2,borderBottom:1,borderColor:"divider",background:n=>`linear-gradient(90deg, ${n.palette[o].lighter}66 0%, ${n.palette.background.paper} 72%)`},children:[e.jsx(u,{sx:{width:40,height:40,borderRadius:2,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:`${o}.lighter`,color:`${o}.main`},children:e.jsx(t,{fontSize:"small"})}),e.jsxs(u,{sx:{minWidth:0},children:[e.jsx(x,{variant:"subtitle1",sx:{fontWeight:700,color:"grey.800",lineHeight:1.3},children:r}),s&&e.jsx(x,{variant:"caption",color:"text.secondary",children:s})]})]}),e.jsx(u,{sx:{px:{xs:2,sm:3}},children:d})]})}function p({label:t,description:r,children:s,align:o="center"}){return e.jsxs(C,{container:!0,spacing:2,alignItems:o,sx:{py:2.5,borderRadius:2,transition:"background-color .15s","&:hover":{bgcolor:"grey.50"}},children:[e.jsxs(C,{item:!0,xs:12,sm:5,children:[e.jsx(x,{variant:"subtitle2",sx:{fontWeight:600,color:"grey.800"},children:t}),r&&e.jsx(x,{variant:"caption",color:"text.secondary",children:r})]}),e.jsx(C,{item:!0,xs:12,sm:7,children:s})]})}const O={display:"flex",justifyContent:{sm:"flex-end"}};function V({label:t,value:r,onChange:s,autoComplete:o}){const[g,d]=w.useState(!1);return e.jsx($,{fullWidth:!0,size:"small",type:g?"text":"password",label:t,value:r,onChange:s,autoComplete:o,InputProps:{endAdornment:e.jsx(Le,{position:"end",children:e.jsx(Pe,{onClick:()=>d(n=>!n),edge:"end",size:"small",children:g?e.jsx(Ae,{fontSize:"small"}):e.jsx(Ne,{fontSize:"small"})})})}})}function Ft(){const[t,r]=w.useState(0),[s,o]=w.useState(!1),[g,d]=w.useState(!1),[n,S]=w.useState(ne),[y,R]=w.useState(le),[i,j]=w.useState(ce),b=a=>f=>{S(h=>({...h,[a]:f.target.value})),d(!0)},T=a=>f=>{R(h=>({...h,[a]:f.target.checked})),d(!0)},H=a=>f=>{j(h=>({...h,[a]:f.target.value})),d(!0)},be=()=>{o(!0),d(!1)},we=()=>{S(ne),R(le),j(ce),d(!1)},ae=Pt(i.newPassword),W=Ot[ae],ye=i.confirmPassword&&i.newPassword!==i.confirmPassword;return e.jsxs(e.Fragment,{children:[e.jsx(Te,{title:"Settings",breadcrumbs:[{label:"Settings"}],action:e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",useFlexGap:!0,flexWrap:"wrap",sx:{width:{xs:"100%",sm:"auto"},justifyContent:{xs:"flex-start",sm:"flex-end"}},children:[g&&e.jsx(D,{size:"small",label:"Unsaved changes",sx:{bgcolor:"warning.lighter",color:"warning.dark",fontWeight:600}}),e.jsx(k,{variant:"outlined",onClick:we,sx:{flex:{xs:1,sm:"none"}},children:"Discard"}),e.jsx(k,{variant:"contained",startIcon:e.jsx(de,{}),onClick:be,sx:{flex:{xs:1,sm:"none"}},children:"Save Changes"})]})}),e.jsxs(C,{container:!0,spacing:2.5,children:[e.jsx(C,{item:!0,xs:12,md:3,children:e.jsxs(l,{spacing:2.5,sx:{position:{md:"sticky"},top:{md:88}},children:[e.jsxs(A,{sx:{p:2},children:[e.jsx(x,{variant:"overline",sx:{px:1,color:"text.secondary",fontWeight:700,letterSpacing:.6},children:"Preferences"}),e.jsx(l,{spacing:.25,sx:{mt:.5},children:It.map((a,f)=>{const h=t===f,Se=a.icon;return e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",onClick:()=>r(f),sx:{px:1.5,py:1.5,borderRadius:2,cursor:"pointer",position:"relative",bgcolor:h?"primary.lighter":"transparent",transition:"background-color .15s","&:hover":{bgcolor:h?"primary.lighter":"grey.50"},"&::before":h?{content:'""',position:"absolute",left:0,top:9,bottom:9,width:3,borderRadius:3,bgcolor:"primary.main"}:{}},children:[e.jsx(u,{sx:{width:34,height:34,borderRadius:1.5,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:h?"primary.main":"grey.100",color:h?"#fff":"grey.600"},children:e.jsx(Se,{fontSize:"small"})}),e.jsxs(u,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(x,{variant:"subtitle2",sx:{fontWeight:600,color:h?"primary.main":"grey.800"},children:a.label}),e.jsx(x,{variant:"caption",color:"text.secondary",children:a.desc})]}),e.jsx(ge,{sx:{fontSize:18,color:h?"primary.main":"grey.300"}})]},a.label)})})]}),e.jsx(A,{sx:{p:2,bgcolor:"primary.lighter",borderColor:"primary.100"},children:e.jsxs(l,{spacing:1.25,children:[e.jsx(u,{sx:{width:38,height:38,borderRadius:2,bgcolor:"primary.main",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(ve,{fontSize:"small"})}),e.jsxs(u,{children:[e.jsx(x,{variant:"subtitle2",sx:{fontWeight:700,color:"primary.dark"},children:"Need a hand?"}),e.jsx(x,{variant:"caption",sx:{color:"primary.dark",opacity:.85},children:"Our team is available 24/7 for operational support."})]}),e.jsx(k,{size:"small",variant:"contained",sx:{alignSelf:"flex-start"},children:"Contact support"})]})})]})}),e.jsxs(C,{item:!0,xs:12,md:9,children:[t===0&&e.jsxs(l,{spacing:2.5,children:[e.jsx(A,{sx:{overflow:"hidden"},children:e.jsxs(l,{direction:{xs:"column",sm:"row"},spacing:2.5,alignItems:{sm:"center"},sx:{p:3,background:a=>`linear-gradient(90deg, ${a.palette.primary.lighter}88 0%, ${a.palette.background.paper} 75%)`},children:[e.jsx(Oe,{variant:"rounded",sx:{width:64,height:64,bgcolor:"primary.main",color:"#fff"},children:e.jsx(he,{})}),e.jsxs(u,{sx:{flexGrow:1,minWidth:0},children:[e.jsxs(l,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[e.jsx(x,{variant:"h5",sx:{fontWeight:700,color:"grey.800"},children:n.orgName}),e.jsx(D,{size:"small",icon:e.jsx(pe,{sx:{fontSize:15,ml:.5}}),label:"Verified",sx:{fontWeight:700,bgcolor:"success.lighter",color:"success.dark","& .MuiChip-icon":{color:"inherit"}}})]}),e.jsxs(x,{variant:"body2",color:"text.secondary",sx:{mt:.25},children:[n.supportEmail," · ",n.contact]})]}),e.jsx(k,{variant:"outlined",size:"small",children:"Change logo"})]})}),e.jsx(_,{icon:F,title:"Organisation",subtitle:"Profile and regional preferences",color:"primary",children:e.jsxs(l,{divider:e.jsx(I,{}),children:[e.jsx(p,{label:"Organisation name",description:"Shown on invoices and exports",children:e.jsx($,{fullWidth:!0,size:"small",value:n.orgName,onChange:b("orgName")})}),e.jsx(p,{label:"Support email",description:"Where customer replies are routed",children:e.jsx($,{fullWidth:!0,size:"small",value:n.supportEmail,onChange:b("supportEmail")})}),e.jsx(p,{label:"Contact number",description:"Primary operations line",children:e.jsx($,{fullWidth:!0,size:"small",value:n.contact,onChange:b("contact")})}),e.jsx(p,{label:"Timezone",description:"Used for schedules and reports",children:e.jsx($,{select:!0,fullWidth:!0,size:"small",value:n.timezone,onChange:b("timezone"),children:fe.map(a=>e.jsx(ie,{value:a,children:a},a))})}),e.jsx(p,{label:"Language",description:"Console display language",children:e.jsx($,{select:!0,fullWidth:!0,size:"small",value:n.language,onChange:b("language"),children:je.map(a=>e.jsx(ie,{value:a,children:a},a))})})]})})]}),t===1&&e.jsxs(l,{spacing:2.5,children:[e.jsx(_,{icon:q,title:"Notification Preferences",subtitle:"Choose what you get alerted about",color:"primary",children:e.jsx(l,{divider:e.jsx(I,{}),children:Mt.map(a=>e.jsx(p,{label:a.t,description:a.d,children:e.jsx(u,{sx:O,children:e.jsx(M,{checked:y[a.k],onChange:T(a.k)})})},a.k))})}),e.jsx(_,{icon:ue,title:"Delivery Channels",subtitle:"How alerts reach your team",color:"primary",children:e.jsxs(l,{divider:e.jsx(I,{}),children:[e.jsx(p,{label:"Email alerts",description:"Send notifications to the support inbox",children:e.jsx(u,{sx:O,children:e.jsx(M,{checked:y.emailAlerts,onChange:T("emailAlerts")})})}),e.jsx(p,{label:"SMS alerts",description:"Send notifications to the registered mobile",children:e.jsx(u,{sx:O,children:e.jsx(M,{checked:y.smsAlerts,onChange:T("smsAlerts")})})})]})})]}),t===2&&e.jsxs(l,{spacing:2.5,children:[e.jsx(_,{icon:Y,title:"Change Password",subtitle:"Use 8+ characters with a mix of letters, numbers & symbols",color:"primary",children:e.jsxs(l,{divider:e.jsx(I,{}),children:[e.jsx(p,{label:"Current password",description:"Enter your existing password",align:"flex-start",children:e.jsx(V,{label:"Current password",value:i.currentPassword,onChange:H("currentPassword"),autoComplete:"current-password"})}),e.jsx(p,{label:"New password",description:"Choose a strong, unique password",align:"flex-start",children:e.jsxs(u,{children:[e.jsx(V,{label:"New password",value:i.newPassword,onChange:H("newPassword"),autoComplete:"new-password"}),i.newPassword&&e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",sx:{mt:1},children:[e.jsx(De,{variant:"determinate",value:ae/4*100,color:W.color,sx:{flexGrow:1,height:6,borderRadius:3}}),e.jsx(x,{variant:"caption",sx:{fontWeight:700,color:`${W.color}.main`,minWidth:56},children:W.label})]})]})}),e.jsx(p,{label:"Confirm new password",description:"Re-enter the new password",align:"flex-start",children:e.jsxs(u,{children:[e.jsx(V,{label:"Confirm new password",value:i.confirmPassword,onChange:H("confirmPassword"),autoComplete:"new-password"}),ye&&e.jsx(x,{variant:"caption",color:"error.main",sx:{mt:.75,display:"block"},children:"Passwords do not match"})]})})]})}),e.jsx(_,{icon:L,title:"Two-Factor Authentication",subtitle:"Add an extra layer of security to your account",color:"primary",children:e.jsx(p,{label:"Authenticator app",description:"Require a one-time code at sign-in for extra security",children:e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",sx:{justifyContent:{sm:"flex-end"}},children:[e.jsx(D,{size:"small",icon:e.jsx(L,{sx:{fontSize:15,ml:.5}}),label:i.twoFactor?"Enabled":"Disabled",sx:{fontWeight:700,bgcolor:i.twoFactor?"success.lighter":"grey.100",color:i.twoFactor?"success.dark":"grey.600","& .MuiChip-icon":{color:"inherit"}}}),e.jsx(M,{checked:i.twoFactor,onChange:a=>{j(f=>({...f,twoFactor:a.target.checked})),d(!0)}})]})})}),e.jsx(_,{icon:xe,title:"Danger Zone",subtitle:"Irreversible and high-impact actions",color:"error",danger:!0,children:e.jsx(p,{label:"Sign out of all sessions",description:"End every active session on all devices",children:e.jsx(u,{sx:O,children:e.jsx(k,{variant:"outlined",color:"error",startIcon:e.jsx(me,{}),onClick:()=>{localStorage.removeItem("auth_token"),window.location.href="/login"},children:"Sign out everywhere"})})})})]})]})]}),e.jsx(Ve,{open:s,autoHideDuration:2500,onClose:()=>o(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:e.jsx(He,{severity:"success",variant:"filled",onClose:()=>o(!1),sx:{width:"100%"},children:"Settings saved successfully."})})]})}export{Ft as default};
|