Files
doormile_crm_build/dist/assets/Tenants-BtGlpICZ.js
2026-07-08 18:53:29 +05:30

12 lines
19 KiB
JavaScript

import{c as se,r,e as ne,j as e,S as ie,B as v,a as le,f as re,g as ae,C as oe,U as O,I as de}from"./index-TNj5auBr.js";import{d as ce,U as pe,P as Y,H as _,A as xe}from"./dayjs.min-DXk7t_A6.js";import{P as fe}from"./PageHeader-B9Ytwo9b.js";import{S as I}from"./StatCard-CeBP5QBY.js";import{S as K}from"./StatusChip-Bf11bHPP.js";import{E as ge}from"./EmptyState-DGz1kDMS.js";import{T as he}from"./TabLabelCount-NU3aDS1r.js";import{t as h,a as ue}from"./format-BZvJYrzU.js";import{C as me}from"./ClientFormDialog-4iTaiNea.js";import{T as ye}from"./TextInput-DL-5979h.js";import{P as be}from"./plus-CZCr3OEY.js";import{C as je}from"./Card-Cvh0wiAW.js";import{T as ve,b as Ce,c as M,d as f,e as Se,f as d}from"./Table-SizHLk8D.js";import{A as ke,P as ze}from"./phone-BqZPAT1U.js";import{C as Te}from"./chevron-up-CSuWANIv.js";import{M as R}from"./map-pin-BQjktuvD.js";import{S as X}from"./square-pen-BItzjjNj.js";import{T as Ie}from"./trash-2-Mcf_1vVz.js";import{C as De}from"./contact-CqGb35TO.js";import{S as We,T as Re,M as Pe}from"./truck-DmPHp74_.js";import"./Banner-DVJsik2E.js";import"./Selector-D-0RMSQ0.js";import"./TextArea-B4wLAlyG.js";import"./HStack-tSPMb9QU.js";/**
* @license lucide-react v1.22.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ee=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]],Fe=se("sticky-note",Ee),Ae=t=>({full:"success",basiconly:"info",none:"neutral"})[String(t||"").toLowerCase()]||"neutral",Le=t=>{const l=String(t||"").toLowerCase();return/high|good|excellent/.test(l)?"success":/med|average|moderate/.test(l)?"warning":/low|poor|bad/.test(l)?"error":"info"};function g({label:t,color:l="neutral"}){if(t==null||t==="")return e.jsx("span",{style:{fontWeight:500,color:"#94a3b8"},children:"—"});const n={success:{bg:"#E3F6EC",fg:"#00773B"},warning:{bg:"#FFF7E0",fg:"#8A6500"},info:{bg:"#E0F7F8",fg:"#00727B"},error:{bg:"#FEEAE9",fg:"#A82216"},primary:{bg:"#F8E0E3",fg:"#9E0E20"},neutral:{bg:"#f1f5f9",fg:"#475569"}},a=n[l]||n.neutral;return e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"9999px",fontSize:"0.75rem",fontWeight:600,backgroundColor:a.bg,color:a.fg},children:t})}function o({label:t,children:l}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("span",{style:{textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"0.68rem",fontWeight:700,color:"#475569"},children:t}),e.jsx("div",{children:l})]})}function D({label:t,value:l}){return e.jsx(o,{label:t,children:e.jsx("span",{style:{fontWeight:500,color:l?"#1e293b":"#94a3b8",fontSize:"0.875rem",wordBreak:"break-word"},children:l||"—"})})}function W({icon:t,title:l,accent:n="primary",children:a}){return e.jsxs("div",{style:{height:"100%",borderRadius:"8px",border:"1px solid #e2e8f0",backgroundColor:"#ffffff",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",padding:"10px 16px",borderBottom:"1px solid #e2e8f0",backgroundColor:"rgba(192, 18, 39, 0.04)"},children:[e.jsx(t,{size:16,style:{color:"#C01227"}}),e.jsx("span",{style:{fontWeight:700,color:"#1e293b",fontSize:"0.68rem",letterSpacing:"0.05em",textTransform:"uppercase"},children:l})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px",padding:"16px"},children:a})]})}function U({label:t,value:l,icon:n}){return e.jsxs("div",{style:{flex:1,padding:"12px",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"4px",backgroundColor:"rgba(192, 18, 39, 0.08)",color:"#C01227",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(n,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:700,color:"#1e293b",fontSize:"1.125rem",lineHeight:1.1},children:l}),e.jsx("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:t})]})]})}function V({label:t,value:l,color:n="#1e293b"}){return e.jsxs("div",{style:{textAlign:"center",minWidth:"56px"},children:[e.jsx("div",{style:{fontWeight:700,color:n,fontSize:"0.875rem",lineHeight:1.2},children:l}),e.jsx("div",{style:{color:"#64748b",fontSize:"0.65rem"},children:t})]})}function Be({row:t,onEdit:l}){return e.jsxs("div",{style:{margin:"16px",borderRadius:"10px",border:"1px solid #e2e8f0",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.04)",backgroundColor:"#ffffff",fontFamily:"system-ui, sans-serif"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:"14px 20px",borderBottom:"1px solid #e2e8f0",background:"linear-gradient(90deg, rgba(192, 18, 39, 0.05) 0%, #ffffff 75%)",flexWrap:"wrap",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx(O,{name:t.name,size:40}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:700,fontSize:"1rem",color:"#1e293b",lineHeight:1.2},children:t.name}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginTop:"2px",color:"#64748b",fontSize:"0.75rem"},children:[e.jsx(De,{size:12}),e.jsx("span",{children:t.clientId})]})]}),e.jsx(K,{status:t.status})]}),e.jsx(v,{size:"sm",variant:"secondary",icon:e.jsx(X,{size:14}),onClick:()=>l(t),label:"Edit Client"})]}),e.jsxs("div",{style:{padding:"20px",backgroundColor:"#f8fafc"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:"20px"},children:[e.jsxs(W,{icon:We,title:"Business",accent:"primary",children:[e.jsxs("div",{style:{display:"flex",gap:"12px"},children:[e.jsx(U,{label:"Parcel Volume",value:Number(t.parcelVolume).toLocaleString(),icon:Y}),e.jsx(U,{label:"Active Contracts",value:t.activeContracts,icon:_})]}),e.jsx(o,{label:"Client ID",children:e.jsx("span",{style:{fontFamily:"monospace",fontWeight:600,color:"#1e293b",fontSize:"0.875rem"},children:t.clientId})}),e.jsx(o,{label:"Business Type",children:e.jsx(g,{label:t.businessType&&h(t.businessType),color:"primary"})}),e.jsx(o,{label:"Order Frequency",children:e.jsx(g,{label:t.frequency&&h(t.frequency),color:"info"})})]}),e.jsxs(W,{icon:Re,title:"Logistics",accent:"primary",children:[e.jsx(o,{label:"Logistics Segment",children:t.logisticsSegment?e.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:String(t.logisticsSegment).split(/[,/]/).map(n=>n.trim()).filter(Boolean).map(n=>e.jsx(g,{label:h(n),color:"primary"},n))}):e.jsx(g,{label:null})}),e.jsx(D,{label:"Current Provider",value:t.provider}),e.jsx(o,{label:"Efficiency",children:e.jsx(g,{label:t.efficiency&&h(t.efficiency),color:Le(t.efficiency)})}),e.jsx(o,{label:"Transit Route",children:(()=>{const n=[t.transitFrom,...String(t.transitTo||"").split(",")].map(a=>a.trim()).filter(Boolean);return n.length?e.jsx("div",{style:{display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap"},children:n.map((a,c)=>e.jsxs(r.Fragment,{children:[c>0&&e.jsx(xe,{size:14,style:{color:"#C01227"}}),e.jsx(g,{label:h(a),color:c===0?"neutral":"info"})]},`${a}-${c}`))}):e.jsx(g,{label:null})})()})]}),e.jsxs(W,{icon:R,title:"Location & Survey",accent:"primary",children:[e.jsx(o,{label:"City / State",children:e.jsx("span",{style:{fontWeight:500,color:"#1e293b",fontSize:"0.875rem"},children:[t.city,t.businessState].filter(Boolean).join(", ")||"—"})}),e.jsx(D,{label:"Neighbourhood",value:t.neighbourhood}),e.jsx(o,{label:"Survey Address",children:e.jsxs("div",{style:{display:"flex",gap:"8px",padding:"10px",borderRadius:"6px",backgroundColor:"#f8fafc",border:"1px solid #e2e8f0"},children:[e.jsx(R,{size:14,style:{color:"#94a3b8",marginTop:"2px",flexShrink:0}}),e.jsx("span",{style:{color:"#1e293b",fontSize:"0.875rem",lineHeight:1.4},children:t.surveyAddress||"—"})]})}),e.jsx(o,{label:"Coordinates",children:t.surveyLat&&t.surveyLng?e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(R,{size:14,style:{color:"#94a3b8"}}),e.jsx("span",{style:{fontWeight:500,color:"#1e293b",fontSize:"0.875rem",borderBottom:"1px dotted #cbd5e1"},children:[t.neighbourhood,t.city].filter(Boolean).join(", ")||"Pinned location"})]}),e.jsxs("a",{href:`https://www.google.com/maps?q=${t.surveyLat},${t.surveyLng}`,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",fontSize:"0.75rem",fontWeight:600,borderRadius:"20px",color:"#C01227",border:"1px solid rgba(192, 18, 39, 0.1)",backgroundColor:"rgba(192, 18, 39, 0.05)",textDecoration:"none"},children:[e.jsx(Pe,{size:12}),"View on map"]})]}):e.jsx("span",{style:{color:"#94a3b8"},children:"—"})})]})]}),e.jsx("div",{style:{marginTop:"20px"},children:e.jsxs(W,{icon:de,title:"Contact & Compliance",accent:"primary",children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"16px"},children:[e.jsx(D,{label:"Phone",value:t.phone}),e.jsx(o,{label:"Data Consent",children:e.jsx(g,{label:t.dataConsent&&h(t.dataConsent),color:Ae(t.dataConsent)})}),e.jsx(D,{label:"Last Updated",value:t.lastUpdated})]}),t.notes&&e.jsxs("div",{style:{padding:"12px",borderRadius:"6px",backgroundColor:"#fffbeb",border:"1px solid #fef3c7",marginTop:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"},children:[e.jsx(Fe,{size:14,style:{color:"#d97706"}}),e.jsx("span",{style:{color:"#d97706",textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"0.68rem",fontWeight:700},children:"Notes"})]}),e.jsx("span",{style:{color:"#1e293b",fontSize:"0.875rem"},children:t.notes})]})]})})]})]})}function Me({row:t,onEdit:l,onDelete:n}){const[a,c]=r.useState(!1);return e.jsxs(r.Fragment,{children:[e.jsxs(M,{onClick:()=>c(p=>!p),style:{cursor:"pointer",backgroundColor:a?"rgba(192, 18, 39, 0.02)":void 0},children:[e.jsx(d,{children:e.jsx("button",{onClick:p=>{p.stopPropagation(),c(C=>!C)},style:{background:"none",border:"none",cursor:"pointer",color:"#64748b",display:"flex",alignItems:"center"},children:a?e.jsx(Te,{size:16}):e.jsx(oe,{size:16})})}),e.jsx(d,{style:{whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontFamily:"monospace",fontWeight:700,color:"#C01227",backgroundColor:"rgba(192, 18, 39, 0.08)",padding:"2px 8px",borderRadius:"4px",border:"1px solid rgba(192, 18, 39, 0.1)",fontSize:"0.75rem"},children:t.logicalId})}),e.jsx(d,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx(O,{name:t.name,size:38}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontWeight:600,color:"#0f172a",fontSize:"0.875rem"},children:t.name}),e.jsx("div",{style:{marginTop:"2px"},children:t.businessType&&e.jsx("span",{style:{fontSize:"0.68rem",fontWeight:600,backgroundColor:"#f1f5f9",color:"#475569",padding:"2px 6px",borderRadius:"4px"},children:h(t.businessType)})})]})]})}),e.jsx(d,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(ze,{size:14,style:{color:"#94a3b8"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"0.875rem",color:"#0f172a"},children:t.phone||"—"}),t.frequency&&e.jsx("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:t.frequency})]})]})}),e.jsx(d,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(R,{size:14,style:{color:"#94a3b8"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"0.875rem",color:"#0f172a"},children:[t.city||"—",t.businessState?`, ${t.businessState}`:""]}),t.neighbourhood&&e.jsx("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:t.neighbourhood})]})]})}),e.jsx(d,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"12px"},children:[e.jsx(V,{label:"Parcels",value:Number(t.parcelVolume).toLocaleString()}),e.jsx("div",{style:{width:"1px",height:"24px",backgroundColor:"#e2e8f0"}}),e.jsx(V,{label:"Contracts",value:t.activeContracts,color:"#C01227"})]})}),e.jsx(d,{children:e.jsx(K,{status:t.status})}),e.jsx(d,{style:{textAlign:"right"},onClick:p=>p.stopPropagation(),children:e.jsxs("div",{style:{display:"inline-flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>l(t),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",borderRadius:"4px",color:"#475569"},className:"action-btn",title:"Edit",children:e.jsx(X,{size:16})}),e.jsx("button",{onClick:()=>n(t),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",borderRadius:"4px",color:"#dc2626"},className:"action-btn",title:"Delete",children:e.jsx(Ie,{size:16})})]})})]}),a&&e.jsx(M,{children:e.jsx(d,{colSpan:8,style:{padding:0,backgroundColor:"#f8fafc"},children:e.jsx(Be,{row:t,onEdit:l})})})]})}function ot(){var $;const[t,l]=r.useState(()=>ce().format("YYYY-MM-DD")),[n,a]=r.useState([]),[c,p]=r.useState(!0),[C,P]=r.useState(null),[E]=ne(),[b,G]=r.useState(0),[S,N]=r.useState(E.get("q")||""),[u,m]=r.useState(0),[x,J]=r.useState(10);r.useEffect(()=>{const s=E.get("q");s!=null&&(N(s),m(0))},[E]);const[F,k]=r.useState({open:!1,mode:"add",initial:null}),[z,A]=r.useState(null),[Q,H]=r.useState(!1),j=(s=!1)=>{s||(p(!0),P(null)),re().then(i=>a(i.map(ue))).catch(i=>{s||P(i.message||"Failed to load clients")}).finally(()=>{s||p(!1)})};r.useEffect(()=>{j();const s=setInterval(()=>{j(!0)},1e4);return()=>clearInterval(s)},[]);const T=r.useMemo(()=>({total:n.length,newCount:n.filter(s=>s.status==="newClient").length,parcels:n.reduce((s,i)=>s+(Number(i.parcelVolume)||0),0),contracts:n.reduce((s,i)=>s+(Number(i.activeContracts)||0),0)}),[n]),L=r.useMemo(()=>{const s=[];return n.forEach(i=>{s.includes(i.status)||s.push(i.status)}),[{key:"all",label:"All"},...s.map(i=>({key:i,label:h(i)}))]},[n]),B=(($=L[Math.min(b,L.length-1)])==null?void 0:$.key)||"all",Z=r.useMemo(()=>{const s={all:n.length};return n.forEach(i=>{s[i.status]=(s[i.status]||0)+1}),s},[n]),y=r.useMemo(()=>n.filter(s=>{const i=B==="all"||s.status===B,te=!S||[s.name,s.phone,s.city,s.businessType,s.clientId,s.neighbourhood].join(" ").toLowerCase().includes(S.toLowerCase());return i&&te}),[n,B,S]),q=y.slice(u*x,u*x+x),w=()=>{k({open:!1,mode:"add",initial:null}),j()},ee=async()=>{H(!0);try{await ae(z.id),A(null),j()}catch(s){P(s.message||"Failed to delete client")}finally{H(!1)}};return e.jsxs("div",{style:{fontFamily:"system-ui, sans-serif"},children:[e.jsx(fe,{title:"Clients",action:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"nowrap"},children:[e.jsx("div",{style:{flex:"0 1 320px",minWidth:"200px"},children:e.jsx(ye,{label:"Search clients",isLabelHidden:!0,placeholder:"Search clients…",startIcon:e.jsx(ie,{size:16}),hasClear:!0,value:S,onChange:s=>{N(s),m(0)}})}),e.jsx("input",{type:"date",className:"clients-date-picker",value:t,onChange:s=>l(s.target.value),style:{padding:"8px 12px",borderRadius:"10px",border:"1px solid rgba(5, 54, 89, 0.12)",fontSize:"0.875rem",fontWeight:500,fontFamily:"inherit",color:"#1e293b",backgroundColor:"#ffffff",outline:"none",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.04)",flexShrink:0,width:"150px"},onFocus:s=>{s.target.style.borderColor="#C01227",s.target.style.boxShadow="0 0 0 3px rgba(192, 18, 39, 0.12)"},onBlur:s=>{s.target.style.borderColor="rgba(5, 54, 89, 0.12)",s.target.style.boxShadow="0 1px 2px rgba(15, 23, 42, 0.04)"}}),e.jsx(v,{variant:"primary",icon:e.jsx(be,{size:14}),onClick:()=>k({open:!0,mode:"add",initial:null}),label:"Add Client",style:{flexShrink:0}})]})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"16px",marginBottom:"24px"},children:[e.jsx(I,{size:"sm",title:"Total Clients",value:T.total,icon:le}),e.jsx(I,{size:"sm",title:"New Clients",value:T.newCount,icon:pe,color:"primary"}),e.jsx(I,{size:"sm",title:"Total Parcel Volume",value:T.parcels.toLocaleString(),icon:Y,color:"primary"}),e.jsx(I,{size:"sm",title:"Active Contracts",value:T.contracts,icon:_,color:"primary"})]}),e.jsxs(je,{style:{padding:"0",borderRadius:"16px",border:"1px solid rgba(5, 54, 89, 0.08)",backgroundColor:"#ffffff",overflow:"hidden",boxShadow:"0 10px 30px -5px rgba(0,0,0,0.02), 0 4px 12px -3px rgba(0,0,0,0.02)"},children:[e.jsx("div",{style:{display:"flex",padding:"0 24px",borderBottom:"1px solid rgba(5, 54, 89, 0.06)",overflowX:"auto",gap:"24px"},children:L.map((s,i)=>e.jsx("div",{onClick:()=>{G(i),m(0)},style:{padding:"16px 0",cursor:"pointer",borderBottom:b===i?"2px solid #C01227":"2px solid transparent",color:b===i?"#C01227":"#64748b",fontWeight:b===i?600:500,fontSize:"0.875rem",transition:"all 0.2s"},children:e.jsx(he,{label:s.label,count:Z[s.key]||0,active:b===i})},s.key))}),C&&e.jsxs("div",{style:{padding:"16px",backgroundColor:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"8px",color:"#b91c1c",margin:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{children:C}),e.jsx(v,{label:"Retry",variant:"ghost",size:"sm",onClick:()=>j(!1)})]}),c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e.jsx("div",{className:"spinner",style:{width:"32px",height:"32px",border:"3px solid #f1f5f9",borderTop:"3px solid #C01227",borderRadius:"50%",animation:"spin 1s linear infinite"}})}):q.length===0?e.jsx(ge,{title:"No clients found",caption:"Try a different tab or search term, or add a client."}):e.jsxs(ve,{density:"balanced",dividers:"rows",hasHover:!0,children:[e.jsx(Ce,{children:e.jsxs(M,{isHeaderRow:!0,children:[e.jsx(f,{style:{width:"48px"}}),e.jsx(f,{children:"ID"}),e.jsx(f,{children:"Client"}),e.jsx(f,{children:"Contact"}),e.jsx(f,{children:"Location"}),e.jsx(f,{style:{textAlign:"center"},children:"Volume"}),e.jsx(f,{children:"Status"}),e.jsx(f,{style:{textAlign:"right"},children:"Actions"})]})}),e.jsx(Se,{children:q.map(s=>e.jsx(Me,{row:s,onEdit:i=>k({open:!0,mode:"edit",initial:i}),onDelete:i=>A(i)},s.id))})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:"12px 24px",borderTop:"1px solid #e2e8f0",gap:"20px",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"0.875rem",color:"#475569"},children:[e.jsx("span",{children:"Rows per page:"}),e.jsx("select",{value:x,onChange:s=>{J(Number(s.target.value)),m(0)},className:"rpp-select",children:[5,10,25].map(s=>e.jsx("option",{value:s,children:s},s))})]}),e.jsxs("span",{style:{fontSize:"0.875rem",color:"#475569"},children:[y.length===0?"0-0":`${u*x+1}-${Math.min((u+1)*x,y.length)}`," of ",y.length]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx(v,{label:"Prev",variant:"secondary",size:"sm",onClick:()=>m(s=>Math.max(0,s-1)),isDisabled:u===0}),e.jsx(v,{label:"Next",variant:"secondary",size:"sm",onClick:()=>m(s=>Math.min(Math.ceil(y.length/x)-1,s+1)),isDisabled:u>=Math.ceil(y.length/x)-1})]})]})]}),e.jsx(me,{open:F.open,mode:F.mode,initial:F.initial,onClose:()=>k({open:!1,mode:"add",initial:null}),onSaved:w}),e.jsx(ke,{isOpen:!!z,onOpenChange:s=>{s||A(null)},title:"Delete client?",description:z?`This will permanently remove ${z.name} from the doormile_clients collection. This cannot be undone.`:"",actionLabel:"Delete",onAction:ee,isActionLoading:Q}),e.jsx("style",{children:`
.action-btn:hover {
background-color: #f1f5f9;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
`})]})}export{ot as default};