Files
doormile_crm_build/dist/assets/Tenants-D4KJ4DGP.js
2026-06-22 16:30:45 +05:30

2 lines
18 KiB
JavaScript

import{r as N,j as e,i as V,a as c,u as pe,t as f,S as l,d as ee,B as o,T as i,h as je,C as te,f as fe,e as be,k as ye,I as O,U as re,D as ve,l as w,m as Ce}from"./index-q3Tisdnr.js";import{d as Se,D as Ie,a as Te,b as _e,c as $e}from"./Close-DL7iP88x.js";import{d as ze,E as ke}from"./EmptyState-Cd38MYLa.js";import{d as ne}from"./EditOutlined-CZAx7RBQ.js";import{d as Pe}from"./DeleteOutline-D9KY4TEB.js";import{d as De,a as Re,b as A,c as We,e as Le}from"./StorefrontOutlined-CL5n-1RH.js";import{S as F,d as Be,a as le,b as oe,c as ie}from"./StatusChip-B8l2Cm5r.js";import{T as Ae,D as Fe,d as Ee}from"./PhoneOutlined-B1Tyd8uC.js";import{d as Me}from"./MapOutlined-D-SVmliy.js";import{T as qe,d as He}from"./TabLabelCount-CtPAsD1G.js";import{P as Oe,G as x,C as G,A as we}from"./PageHeader-BdVI3_ZB.js";import{C as Ne}from"./ClientFormDialog-DIiAXoHi.js";import{B as b}from"./Button-BmCu8mk5.js";import{C as Ve}from"./Link-CshtP915.js";import{T as Ge}from"./TextField-CVNMv7Sa.js";import{I as Ue}from"./InputAdornment-NDKbvoTZ.js";import{T as Ke,a as Xe}from"./Tabs-Dn0f7B1p.js";import{T as Je,a as Qe,b as Ye,c as $,d as Ze}from"./TableRow-C5wbv4Kn.js";import{T as d}from"./TableCell-DV7KoMLs.js";import"./Snackbar-Cz2M_lq2.js";var U={},et=V;Object.defineProperty(U,"__esModule",{value:!0});var ce=U.default=void 0,tt=et(N()),rt=e;ce=U.default=(0,tt.default)((0,rt.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.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 8"}),"InfoOutlined");var K={},nt=V;Object.defineProperty(K,"__esModule",{value:!0});var de=K.default=void 0,it=nt(N()),st=e;de=K.default=(0,it.default)((0,st.jsx)("path",{d:"M21 11.01 3 11v2h18zM3 16h12v2H3zM21 6H3v2.01L21 8z"}),"NotesOutlined");var X={},at=V;Object.defineProperty(X,"__esModule",{value:!0});var xe=X.default=void 0,lt=at(N()),ot=e;xe=X.default=(0,lt.default)((0,ot.jsx)("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z"}),"ArrowRightAlt");const ct=t=>({full:"success",basiconly:"info",none:"default"})[String(t||"").toLowerCase()]||"default",dt=t=>{const a=String(t||"").toLowerCase();return/high|good|excellent/.test(a)?"success":/med|average|moderate/.test(a)?"warning":/low|poor|bad/.test(a)?"error":"info"},xt={textTransform:"uppercase",letterSpacing:.4,fontSize:"0.68rem",fontWeight:700,color:"grey.700"};function j({label:t,color:a="default"}){return t==null||t===""?e.jsx(i,{variant:"body2",sx:{fontWeight:500,color:"grey.500"},children:"—"}):e.jsx(G,{size:"small",label:t,sx:{fontWeight:600,...a==="default"?{bgcolor:"grey.100",color:"grey.700"}:{bgcolor:`${a}.lighter`,color:`${a}.dark`}}})}function u({label:t,children:a}){return e.jsxs(o,{children:[e.jsx(i,{variant:"caption",color:"text.secondary",sx:xt,children:t}),e.jsx(o,{sx:{mt:.5},children:a})]})}function E({label:t,value:a}){return e.jsx(u,{label:t,children:e.jsx(i,{variant:"body2",sx:{fontWeight:500,color:a?"grey.800":"grey.500",wordBreak:"break-word"},children:a||"—"})})}function M({icon:t,title:a,accent:h="primary",children:g}){return e.jsxs(o,{sx:{height:"100%",borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",overflow:"hidden"},children:[e.jsxs(l,{direction:"row",spacing:1,alignItems:"center",sx:{px:2,py:1.25,borderBottom:1,borderColor:"divider",bgcolor:`${h}.lighter`,opacity:.999},children:[e.jsx(t,{sx:{fontSize:18,color:`${h}.main`}}),e.jsx(i,{variant:"overline",sx:{fontWeight:700,color:"grey.800",letterSpacing:.6,lineHeight:1},children:a})]}),e.jsx(l,{spacing:1.75,sx:{p:2},children:g})]})}function se({label:t,value:a,icon:h,color:g="primary"}){return e.jsx(o,{sx:{flex:1,p:1.5,borderRadius:1.5,border:1,borderColor:"divider",bgcolor:"grey.50"},children:e.jsxs(l,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(o,{sx:{width:32,height:32,borderRadius:1,bgcolor:`${g}.lighter`,color:`${g}.main`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(h,{sx:{fontSize:18}})}),e.jsxs(o,{children:[e.jsx(i,{variant:"h5",sx:{fontWeight:700,color:"grey.800",lineHeight:1.1},children:a}),e.jsx(i,{variant:"caption",color:"text.secondary",children:t})]})]})})}function ae({label:t,value:a,color:h="grey.800"}){return e.jsxs(o,{sx:{textAlign:"center",minWidth:56},children:[e.jsx(i,{variant:"body2",sx:{fontWeight:700,color:h,lineHeight:1.2},children:a}),e.jsx(i,{variant:"caption",color:"text.secondary",sx:{fontSize:"0.65rem"},children:t})]})}function ht({row:t,index:a,onEdit:h,onDelete:g}){const[p,y]=c.useState(!1);return e.jsxs(c.Fragment,{children:[e.jsxs($,{hover:!0,sx:{cursor:"pointer","& > *":{borderBottom:p?"unset":void 0},...p&&{bgcolor:"primary.lighter","&:hover":{bgcolor:"primary.lighter"}}},onClick:()=>y(s=>!s),children:[e.jsx(d,{padding:"checkbox",children:e.jsx(O,{size:"small",onClick:s=>{s.stopPropagation(),y(m=>!m)},children:p?e.jsx(De,{}):e.jsx(Re,{})})}),e.jsx(d,{sx:{whiteSpace:"nowrap"},children:e.jsx(i,{variant:"caption",sx:{fontFamily:"monospace",fontWeight:700,color:"primary.main",bgcolor:"primary.lighter",px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:"primary.light",whiteSpace:"nowrap"},children:t.logicalId})}),e.jsx(d,{children:e.jsxs(l,{direction:"row",spacing:1.25,alignItems:"center",children:[e.jsx(re,{name:t.name,size:38}),e.jsxs(o,{sx:{minWidth:0},children:[e.jsx(i,{variant:"body2",sx:{fontWeight:600,color:"grey.800"},children:t.name}),e.jsx(l,{direction:"row",spacing:.75,alignItems:"center",sx:{mt:.4},children:t.businessType&&e.jsx(G,{size:"small",label:f(t.businessType),sx:{height:20,fontSize:"0.68rem",fontWeight:600,bgcolor:"grey.100",color:"grey.700"}})})]})]})}),e.jsx(d,{children:e.jsxs(l,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(Ee,{sx:{fontSize:15,color:"grey.400"}}),e.jsxs(o,{children:[e.jsx(i,{variant:"body2",children:t.phone||"—"}),t.frequency&&e.jsx(i,{variant:"caption",color:"text.secondary",children:t.frequency})]})]})}),e.jsx(d,{children:e.jsxs(l,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(A,{sx:{fontSize:15,color:"grey.400"}}),e.jsxs(o,{children:[e.jsxs(i,{variant:"body2",children:[t.city||"—",t.businessState?`, ${t.businessState}`:""]}),t.neighbourhood&&e.jsx(i,{variant:"caption",color:"text.secondary",children:t.neighbourhood})]})]})}),e.jsx(d,{children:e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",justifyContent:"center",divider:e.jsx(ve,{orientation:"vertical",flexItem:!0}),children:[e.jsx(ae,{label:"Parcels",value:Number(t.parcelVolume).toLocaleString()}),e.jsx(ae,{label:"Contracts",value:t.activeContracts,color:"primary.main"})]})}),e.jsx(d,{children:e.jsx(ie,{status:t.status})}),e.jsxs(d,{align:"right",children:[e.jsx(w,{title:"Edit",children:e.jsx(O,{size:"small",onClick:s=>{s.stopPropagation(),h(t)},children:e.jsx(ne,{fontSize:"small"})})}),e.jsx(w,{title:"Delete",children:e.jsx(O,{size:"small",onClick:s=>{s.stopPropagation(),g(t)},children:e.jsx(Pe,{fontSize:"small"})})})]})]}),e.jsx($,{children:e.jsx(d,{colSpan:8,sx:{py:0,borderBottom:p?void 0:"none"},children:e.jsx(Ce,{in:p,timeout:"auto",unmountOnExit:!0,children:e.jsxs(o,{sx:{m:2,borderRadius:2.5,border:1,borderColor:"divider",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.06)"},children:[e.jsxs(l,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},spacing:1.5,sx:{px:2.5,py:1.75,borderBottom:1,borderColor:"divider",background:s=>`linear-gradient(90deg, ${s.palette.primary.lighter}88 0%, ${s.palette.background.paper} 75%)`},children:[e.jsxs(l,{direction:"row",spacing:1.5,alignItems:"center",children:[e.jsx(re,{name:t.name,size:40}),e.jsxs(o,{children:[e.jsx(i,{variant:"subtitle1",sx:{fontWeight:700,lineHeight:1.2},children:t.name}),e.jsxs(l,{direction:"row",spacing:.75,alignItems:"center",sx:{mt:.25},children:[e.jsx(He,{sx:{fontSize:14,color:"grey.400"}}),e.jsx(i,{variant:"caption",color:"text.secondary",children:t.clientId})]})]}),e.jsx(ie,{status:t.status,sx:{ml:.5}})]}),e.jsx(b,{size:"small",variant:"contained",startIcon:e.jsx(ne,{}),onClick:()=>h(t),children:"Edit Client"})]}),e.jsx(o,{sx:{p:2.5,bgcolor:"grey.50"},children:e.jsxs(x,{container:!0,spacing:2.5,alignItems:"stretch",children:[e.jsx(x,{item:!0,xs:12,md:4,children:e.jsxs(M,{icon:We,title:"Business",accent:"primary",children:[e.jsxs(l,{direction:"row",spacing:1.5,children:[e.jsx(se,{label:"Parcel Volume",value:Number(t.parcelVolume).toLocaleString(),icon:le,color:"primary"}),e.jsx(se,{label:"Active Contracts",value:t.activeContracts,icon:oe,color:"primary"})]}),e.jsx(u,{label:"Client ID",children:e.jsx(i,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:600,color:"grey.800"},children:t.clientId})}),e.jsx(u,{label:"Business Type",children:e.jsx(j,{label:t.businessType&&f(t.businessType),color:"primary"})}),e.jsx(u,{label:"Order Frequency",children:e.jsx(j,{label:t.frequency&&f(t.frequency),color:"info"})})]})}),e.jsx(x,{item:!0,xs:12,md:4,children:e.jsxs(M,{icon:Le,title:"Logistics",accent:"primary",children:[e.jsx(u,{label:"Logistics Segment",children:t.logisticsSegment?e.jsx(l,{direction:"row",spacing:.75,flexWrap:"wrap",useFlexGap:!0,children:String(t.logisticsSegment).split(/[,/]/).map(s=>s.trim()).filter(Boolean).map(s=>e.jsx(j,{label:f(s),color:"primary"},s))}):e.jsx(j,{label:null})}),e.jsx(E,{label:"Current Provider",value:t.provider}),e.jsx(u,{label:"Efficiency",children:e.jsx(j,{label:t.efficiency&&f(t.efficiency),color:dt(t.efficiency)})}),e.jsx(u,{label:"Transit Route",children:(()=>{const s=[t.transitFrom,...String(t.transitTo||"").split(",")].map(m=>m.trim()).filter(Boolean);return s.length?e.jsx(l,{direction:"row",spacing:.75,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:s.map((m,C)=>e.jsxs(c.Fragment,{children:[C>0&&e.jsx(xe,{sx:{fontSize:20,color:"primary.main"}}),e.jsx(j,{label:f(m),color:C===0?"default":"info"})]},`${m}-${C}`))}):e.jsx(j,{label:null})})()})]})}),e.jsx(x,{item:!0,xs:12,md:4,children:e.jsxs(M,{icon:A,title:"Location & Survey",accent:"primary",children:[e.jsx(u,{label:"City / State",children:e.jsx(i,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:[t.city,t.businessState].filter(Boolean).join(", ")||"—"})}),e.jsx(E,{label:"Neighbourhood",value:t.neighbourhood}),e.jsx(u,{label:"Survey Address",children:e.jsxs(l,{direction:"row",spacing:1,sx:{p:1.25,borderRadius:1.5,bgcolor:"grey.50",border:1,borderColor:"divider"},children:[e.jsx(A,{sx:{fontSize:16,color:"grey.400",mt:"2px"}}),e.jsx(i,{variant:"body2",sx:{color:"grey.800",lineHeight:1.5},children:t.surveyAddress||"—"})]})}),e.jsx(u,{label:"Coordinates",children:t.surveyLat&&t.surveyLng?e.jsxs(l,{direction:"row",spacing:1.25,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[e.jsx(w,{title:`${t.surveyLat}, ${t.surveyLng}`,arrow:!0,placement:"top",children:e.jsxs(l,{direction:"row",spacing:.5,alignItems:"center",sx:{cursor:"default"},children:[e.jsx(A,{sx:{fontSize:16,color:"grey.400"}}),e.jsx(i,{variant:"body2",sx:{fontWeight:500,color:"grey.800",borderBottom:"1px dotted",borderColor:"grey.300"},children:[t.neighbourhood,t.city].filter(Boolean).join(", ")||"Pinned location"})]})}),e.jsx(b,{component:"a",href:`https://www.google.com/maps?q=${t.surveyLat},${t.surveyLng}`,target:"_blank",rel:"noopener",size:"small",variant:"outlined",startIcon:e.jsx(Me,{sx:{fontSize:16}}),sx:{py:.25,px:1.25,minWidth:0,fontSize:"0.75rem",fontWeight:600,borderRadius:5,color:"primary.main",borderColor:"primary.100",bgcolor:"primary.lighter","&:hover":{borderColor:"primary.main",bgcolor:"primary.lighter"}},children:"View on map"})]}):e.jsx(i,{variant:"body2",sx:{color:"grey.500"},children:"—"})})]})}),e.jsx(x,{item:!0,xs:12,children:e.jsx(M,{icon:ce,title:"Contact & Compliance",accent:"primary",children:e.jsxs(x,{container:!0,spacing:2.5,children:[e.jsx(x,{item:!0,xs:12,sm:6,md:4,children:e.jsx(E,{label:"Phone",value:t.phone})}),e.jsx(x,{item:!0,xs:12,sm:6,md:4,children:e.jsx(u,{label:"Data Consent",children:e.jsx(j,{label:t.dataConsent&&f(t.dataConsent),color:ct(t.dataConsent)})})}),e.jsx(x,{item:!0,xs:12,sm:6,md:4,children:e.jsx(E,{label:"Last Updated",value:t.lastUpdated})}),t.notes&&e.jsx(x,{item:!0,xs:12,children:e.jsxs(o,{sx:{p:2,borderRadius:1.5,bgcolor:"warning.lighter",border:1,borderColor:"warning.light"},children:[e.jsxs(l,{direction:"row",spacing:1,alignItems:"center",sx:{mb:.5},children:[e.jsx(de,{sx:{fontSize:16,color:"warning.dark"}}),e.jsx(i,{variant:"caption",sx:{color:"warning.dark",textTransform:"uppercase",letterSpacing:.4,fontSize:"0.68rem",fontWeight:700},children:"Notes"})]}),e.jsx(i,{variant:"body2",sx:{color:"grey.800"},children:t.notes})]})})]})})})]})})]})})})})]})}function Wt(){var Z;const[t,a]=c.useState([]),[h,g]=c.useState(!0),[p,y]=c.useState(null),[s]=pe(),[m,C]=c.useState(0),[z,J]=c.useState(s.get("q")||""),[k,S]=c.useState(0),[I,he]=c.useState(10);c.useEffect(()=>{const r=s.get("q");r!=null&&(J(r),S(0))},[s]);const[q,P]=c.useState({open:!1,mode:"add",initial:null}),[T,D]=c.useState(null),[R,Q]=c.useState(!1),v=(r=!1)=>{r||(g(!0),y(null)),fe().then(n=>a(n.map(be))).catch(n=>{r||y(n.message||"Failed to load clients")}).finally(()=>{r||g(!1)})};c.useEffect(()=>{v();const r=setInterval(()=>{v(!0)},1e4);return()=>clearInterval(r)},[]);const W=c.useMemo(()=>({total:t.length,newCount:t.filter(r=>r.status==="newClient").length,parcels:t.reduce((r,n)=>r+(Number(n.parcelVolume)||0),0),contracts:t.reduce((r,n)=>r+(Number(n.activeContracts)||0),0)}),[t]),L=c.useMemo(()=>{const r=[];return t.forEach(n=>{r.includes(n.status)||r.push(n.status)}),[{key:"all",label:"All"},...r.map(n=>({key:n,label:f(n)}))]},[t]),H=((Z=L[Math.min(m,L.length-1)])==null?void 0:Z.key)||"all",ue=c.useMemo(()=>{const r={all:t.length};return t.forEach(n=>{r[n.status]=(r[n.status]||0)+1}),r},[t]),B=c.useMemo(()=>t.filter(r=>{const n=H==="all"||r.status===H,_=!z||[r.name,r.phone,r.city,r.businessType,r.clientId,r.neighbourhood].join(" ").toLowerCase().includes(z.toLowerCase());return n&&_}),[t,H,z]),Y=B.slice(k*I,k*I+I),me=()=>{P({open:!1,mode:"add",initial:null}),v()},ge=async()=>{Q(!0);try{await ye(T.id),D(null),v()}catch(r){y(r.message||"Failed to delete client")}finally{Q(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(Oe,{title:"Clients",breadcrumbs:[{label:"Clients"}],action:e.jsxs(l,{direction:"row",spacing:1.5,children:[e.jsx(b,{variant:"outlined",startIcon:e.jsx(ze,{}),onClick:v,disabled:h,children:"Refresh"}),e.jsx(b,{variant:"contained",startIcon:e.jsx(Se,{}),onClick:()=>P({open:!0,mode:"add",initial:null}),children:"Add Client"})]})}),e.jsxs(x,{container:!0,spacing:2.5,sx:{mb:3},children:[e.jsx(x,{item:!0,xs:12,sm:6,lg:3,children:e.jsx(F,{accent:!0,title:"Total Clients",value:W.total,icon:ee,caption:"All registered"})}),e.jsx(x,{item:!0,xs:12,sm:6,lg:3,children:e.jsx(F,{accent:!0,title:"New Clients",value:W.newCount,icon:Be,color:"primary",caption:"Awaiting onboarding"})}),e.jsx(x,{item:!0,xs:12,sm:6,lg:3,children:e.jsx(F,{accent:!0,title:"Total Parcel Volume",value:W.parcels.toLocaleString(),icon:le,color:"primary",caption:"Across all clients"})}),e.jsx(x,{item:!0,xs:12,sm:6,lg:3,children:e.jsx(F,{accent:!0,title:"Active Contracts",value:W.contracts,icon:oe,color:"primary",caption:"Currently running"})})]}),e.jsxs(Ve,{sx:{overflow:"hidden"},children:[e.jsxs(o,{sx:{px:2.5,py:2,borderBottom:1,borderColor:"divider",display:"flex",alignItems:"center",gap:1.5,background:r=>`linear-gradient(90deg, ${r.palette.primary.lighter}66 0%, ${r.palette.background.paper} 70%)`},children:[e.jsx(o,{sx:{width:40,height:40,borderRadius:2,bgcolor:"primary.lighter",color:"primary.main",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(ee,{fontSize:"small"})}),e.jsxs(o,{children:[e.jsx(i,{variant:"subtitle1",sx:{fontWeight:700,color:"grey.800",lineHeight:1.2},children:"Client Directory"}),e.jsx(i,{variant:"caption",color:"text.secondary",children:"Browse, search and manage every client account"})]})]}),e.jsxs(l,{direction:{xs:"column",md:"row"},spacing:1.5,sx:{p:2},alignItems:{md:"center"},children:[e.jsx(Ge,{size:"small",placeholder:"Search by name, phone, city, ID…",value:z,onChange:r=>{J(r.target.value),S(0)},sx:{minWidth:300},InputProps:{startAdornment:e.jsx(Ue,{position:"start",children:e.jsx(je,{fontSize:"small"})})}}),e.jsx(o,{sx:{flexGrow:1}}),!h&&e.jsxs(l,{direction:"row",spacing:1,alignItems:"center",children:[e.jsxs(i,{variant:"body2",color:"text.secondary",children:[B.length," ",B.length===1?"client":"clients"]}),e.jsx(G,{size:"small",label:"live · doormile_clients",sx:{height:22,fontSize:"0.7rem",bgcolor:"success.lighter",color:"success.dark",fontWeight:600}})]})]}),e.jsx(o,{sx:{px:2,borderBottom:1,borderColor:"divider"},children:e.jsx(Ke,{value:Math.min(m,L.length-1),onChange:(r,n)=>{C(n),S(0)},variant:"scrollable",scrollButtons:"auto",children:L.map((r,n)=>e.jsx(Xe,{label:e.jsx(qe,{label:r.label,count:ue[r.key]||0,active:m===n})},r.key))})}),p&&e.jsx(we,{severity:"error",sx:{m:2},action:e.jsx(b,{color:"inherit",size:"small",onClick:v,children:"Retry"}),children:p}),e.jsx(Je,{children:e.jsxs(Qe,{sx:{minWidth:900},children:[e.jsx(Ye,{children:e.jsxs($,{sx:{"& th":{bgcolor:"grey.50",fontWeight:700,color:"grey.700",textTransform:"uppercase",fontSize:"0.72rem",letterSpacing:.4}},children:[e.jsx(d,{padding:"checkbox"}),e.jsx(d,{children:"ID"}),e.jsx(d,{children:"Client"}),e.jsx(d,{children:"Contact"}),e.jsx(d,{children:"Location"}),e.jsx(d,{align:"center",children:"Volume"}),e.jsx(d,{children:"Status"}),e.jsx(d,{align:"right",children:"Actions"})]})}),e.jsx(Ze,{children:h?e.jsx($,{children:e.jsx(d,{colSpan:8,sx:{border:"none"},children:e.jsx(o,{sx:{display:"flex",justifyContent:"center",py:6},children:e.jsx(te,{})})})}):Y.length===0?e.jsx($,{children:e.jsx(d,{colSpan:8,sx:{border:"none"},children:e.jsx(ke,{title:"No clients found",caption:"Try a different tab or search term, or add a client."})})}):Y.map((r,n)=>e.jsx(ht,{row:r,index:k*I+n,onEdit:_=>P({open:!0,mode:"edit",initial:_}),onDelete:_=>D(_)},r.id))})]})}),e.jsx(Ae,{component:"div",count:B.length,page:k,onPageChange:(r,n)=>S(n),rowsPerPage:I,onRowsPerPageChange:r=>{he(+r.target.value),S(0)},rowsPerPageOptions:[5,10,25]})]}),e.jsx(Ne,{open:q.open,mode:q.mode,initial:q.initial,onClose:()=>P({open:!1,mode:"add",initial:null}),onSaved:me}),e.jsxs(Ie,{open:!!T,onClose:R?void 0:()=>D(null),children:[e.jsx(Te,{children:"Delete client?"}),e.jsx(_e,{children:e.jsxs(Fe,{children:["This will permanently remove ",e.jsx("strong",{children:T==null?void 0:T.name})," from the doormile_clients collection. This cannot be undone."]})}),e.jsxs($e,{sx:{px:3,py:2},children:[e.jsx(b,{onClick:()=>D(null),disabled:R,children:"Cancel"}),e.jsx(b,{color:"error",variant:"contained",onClick:ge,disabled:R,startIcon:R?e.jsx(te,{size:16,color:"inherit"}):null,children:"Delete"})]})]})]})}export{Wt as default};