2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
import{r as Q,j as e,i as Z,a as f,B as i,N as u,T as o,H as J,S as x,C as X,c as ee,O as re,L as B,M as R,I as H}from"./index-gNwqoTqU.js";import{d as se,D as te,a as oe,b as ne,c as ie,e as ae}from"./EditOutlined-B802GMcZ.js";import{d as G,T as le,a as ce}from"./PhoneOutlined-M3cVq2Rj.js";import{c as T,d as de,a as xe,b as E,e as he}from"./StorefrontOutlined-Bh94DgRn.js";import{d as ge}from"./MapOutlined-BmXj-MCs.js";import{P as ue,G as a,C as I}from"./PageHeader-B51VIWnC.js";import{C as Y}from"./Link-C5Ej37i0.js";import{T as b}from"./TextField-CQUIOxV_.js";import{I as pe}from"./InputAdornment-iipxR859.js";import{B as v}from"./Button-C4dHjkLI.js";import"./TableCell-BNqM6Q1z.js";var D={},fe=Z;Object.defineProperty(D,"__esModule",{value:!0});var k=D.default=void 0,me=fe(Q()),je=e;k=D.default=(0,me.default)((0,je.jsx)("path",{d:"M7 15h7v2H7zm0-4h10v2H7zm0-4h10v2H7zm12-4h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64-.1.23-.16.49-.16.77v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75M19 19H5V5h14z"}),"AssignmentOutlined");const A="https://api.doormile.com/api/v1",q=()=>{const r=localStorage.getItem("auth_token");return{"Content-Type":"application/json",...r?{Authorization:`Bearer ${r}`}:{}}},be={textTransform:"uppercase",letterSpacing:.4,fontSize:"0.68rem",fontWeight:700,color:"grey.700"};function N({label:r,color:t="default"}){return r?e.jsx(I,{size:"small",label:r,sx:{fontWeight:600,...t==="default"?{bgcolor:"grey.100",color:"grey.700"}:{bgcolor:`${t}.lighter`,color:`${t}.dark`}}}):e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.500"},children:"—"})}function m({label:r,children:t}){return e.jsxs(i,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:be,children:r}),e.jsx(i,{sx:{mt:.5},children:t})]})}function w({title:r,value:t,icon:l,gradient:c,percentage:s}){return e.jsxs(i,{sx:{position:"relative",overflow:"hidden",borderRadius:3.5,p:3,color:"white",background:c,boxShadow:"0 10px 30px rgba(0,0,0,0.08)",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{transform:"translateY(-6px)",boxShadow:"0 20px 40px rgba(0,0,0,0.12)"}},children:[e.jsxs(i,{sx:{position:"relative",zIndex:2},children:[e.jsxs(x,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(o,{variant:"overline",sx:{fontWeight:700,letterSpacing:1.2,opacity:.9},children:r}),e.jsx(i,{sx:{width:36,height:36,borderRadius:"50%",bgcolor:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(4px)"},children:e.jsx(l,{sx:{fontSize:20}})})]}),e.jsxs(x,{direction:"row",alignItems:"baseline",spacing:1.5,sx:{mt:2},children:[e.jsx(o,{variant:"h3",sx:{fontWeight:800,lineHeight:1},children:t}),s&&e.jsx(I,{size:"small",label:s,sx:{height:22,bgcolor:"rgba(255,255,255,0.25)",color:"white",fontWeight:700,borderRadius:1.5,backdropFilter:"blur(4px)"}})]})]}),e.jsx(l,{sx:{position:"absolute",right:-24,bottom:-24,fontSize:160,opacity:.1,zIndex:1,transform:"rotate(-15deg)"}})]})}function W({icon:r,title:t,children:l}){return e.jsxs(i,{sx:{height:"100%",borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",overflow:"hidden"},children:[e.jsxs(x,{direction:"row",spacing:1,alignItems:"center",sx:{px:2,py:1.25,borderBottom:1,borderColor:"divider",bgcolor:u("#c01227",.08)},children:[e.jsx(r,{sx:{fontSize:18,color:"#c01227"}}),e.jsx(o,{variant:"overline",sx:{fontWeight:700,color:"grey.800",letterSpacing:.6,lineHeight:1},children:t})]}),e.jsx(x,{spacing:2,sx:{p:2},children:l})]})}async function ye(){let r=[],t=0;const l=50;let c=1;for(;t<c;){const s=await fetch(`${A}/admin/competitor-branches?limit=${l}&offset=${t}`,{headers:q()});if(!s.ok)throw new Error("Failed to fetch surveys");const p=await s.json();if(!p.data||p.data.length===0)break;const h=p.data.filter(g=>!r.some(d=>d.id===g.id));if(h.length===0)break;r=[...r,...h],c=p.total||0,t+=l}return{data:r,total:r.length}}async function ve(r){const t=!!r.id,l=t?`${A}/admin/competitor-branches/${r.id}`:`${A}/admin/competitor-branches`,s=await fetch(l,{method:t?"PUT":"POST",headers:q(),body:JSON.stringify(r)});if(!s.ok)throw new Error("Failed to save survey");return s.json()}function Ce({open:r,onClose:t,onSave:l,initialData:c}){const[s,p]=f.useState({}),[h,g]=f.useState(!1);f.useEffect(()=>{r&&p(c||{company:"",area:"",phone:"",rate_per_kg:"",offers_pickup:"no",offers_drop:"no",packing_charge:"",time_in_days:"",plus_code:"",address:""})},[r,c]);const d=C=>S=>{p(P=>({...P,[C]:S.target.value}))},z=async()=>{g(!0);try{await ve(s),l(),t()}catch(C){console.error(C),alert("Failed to save. Please try again.")}finally{g(!1)}};return e.jsxs(te,{open:r,onClose:t,maxWidth:"sm",fullWidth:!0,children:[e.jsx(oe,{sx:{fontWeight:800},children:c?"Edit Survey Record":"Add New Survey"}),e.jsx(ne,{dividers:!0,children:e.jsxs(a,{container:!0,spacing:2,children:[e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Company",value:s.company||"",onChange:d("company"),size:"small"})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Area / Zone",value:s.area||"",onChange:d("area"),size:"small"})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Phone",value:s.phone||"",onChange:d("phone"),size:"small"})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Rate Per KG",value:s.rate_per_kg||"",onChange:d("rate_per_kg"),size:"small"})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsxs(b,{select:!0,fullWidth:!0,label:"Offers Pickup",value:s.offers_pickup||"no",onChange:d("offers_pickup"),size:"small",children:[e.jsx(R,{value:"yes",children:"Yes"}),e.jsx(R,{value:"no",children:"No"})]})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsxs(b,{select:!0,fullWidth:!0,label:"Offers Drop",value:s.offers_drop||"no",onChange:d("offers_drop"),size:"small",children:[e.jsx(R,{value:"yes",children:"Yes"}),e.jsx(R,{value:"no",children:"No"})]})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Time in Days",value:s.time_in_days||"",onChange:d("time_in_days"),size:"small"})}),e.jsx(a,{item:!0,xs:12,sm:6,children:e.jsx(b,{fullWidth:!0,label:"Packing Charge",value:s.packing_charge||"",onChange:d("packing_charge"),size:"small"})}),e.jsx(a,{item:!0,xs:12,children:e.jsx(b,{fullWidth:!0,label:"Plus Code",value:s.plus_code||"",onChange:d("plus_code"),size:"small"})}),e.jsx(a,{item:!0,xs:12,children:e.jsx(b,{fullWidth:!0,multiline:!0,rows:2,label:"Address",value:s.address||"",onChange:d("address"),size:"small"})})]})}),e.jsxs(ie,{sx:{p:2,bgcolor:"grey.50"},children:[e.jsx(v,{onClick:t,disabled:h,color:"inherit",children:"Cancel"}),e.jsx(v,{onClick:z,disabled:h,variant:"contained",sx:{bgcolor:"#c01227","&:hover":{bgcolor:"#a00f20"},borderRadius:2},children:h?"Saving...":"Save Record"})]})]})}function Se({row:r,onEdit:t,users:l}){const[c,s]=f.useState(!1),p=l.find(g=>g.id===r.created_by),h=l.find(g=>g.id===r.updated_by);return e.jsxs(i,{sx:{p:2,borderRadius:2.5,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",transition:"all 0.2s ease","&:hover":{borderColor:"#c01227",boxShadow:"0 4px 12px rgba(192, 18, 39, 0.05)"}},children:[e.jsxs(x,{direction:{xs:"column",md:"row"},spacing:3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",onClick:()=>s(!c),sx:{cursor:"pointer",userSelect:"none"},children:[e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",sx:{minWidth:240},children:[e.jsx(i,{sx:{p:1.5,borderRadius:2,bgcolor:u("#c01227",.05)},children:e.jsx(E,{sx:{color:"#c01227"}})}),e.jsxs(i,{children:[e.jsx(o,{variant:"subtitle1",sx:{fontWeight:700,color:"grey.900",lineHeight:1.2},children:r.area||"Unknown Area"}),e.jsxs(o,{variant:"body2",sx:{color:"grey.600",display:"flex",alignItems:"center",gap:.5,mt:.5},children:[e.jsx(G,{sx:{fontSize:14}})," ",r.phone||"—"]})]})]}),e.jsxs(x,{direction:"row",spacing:4,sx:{flex:1},justifyContent:{xs:"flex-start",md:"center"},children:[e.jsxs(i,{children:[e.jsx(o,{variant:"caption",sx:{color:"grey.500",fontWeight:700,letterSpacing:.5,display:"block",mb:.5},children:"RATE PER KG"}),e.jsx(N,{label:r.rate_per_kg,color:"success"})]}),e.jsxs(i,{children:[e.jsx(o,{variant:"caption",sx:{color:"grey.500",fontWeight:700,letterSpacing:.5,display:"block",mb:.5},children:"LOGISTICS"}),e.jsx(o,{variant:"body2",sx:{fontWeight:600,color:"grey.800"},children:r.offers_pickup==="yes"||r.offers_drop==="yes"?`${r.offers_pickup==="yes"?"Pickup":""} ${r.offers_drop==="yes"?"Drop":""}`:"—"})]})]}),e.jsxs(x,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(v,{size:"small",sx:{borderRadius:1.5,color:c?"#c01227":"grey.700",bgcolor:c?u("#c01227",.05):"transparent","&:hover":{bgcolor:u("#c01227",.1),color:"#c01227"}},children:c?"Hide Info":"More Info"}),e.jsx(H,{size:"small",onClick:g=>{g.stopPropagation(),t(r)},sx:{color:"grey.400","&:hover":{color:"#c01227",bgcolor:u("#c01227",.1)}},children:e.jsx(ae,{fontSize:"small"})}),e.jsx(H,{size:"small",onClick:g=>g.stopPropagation(),sx:{color:"grey.400","&:hover":{color:"#ef4444",bgcolor:u("#ef4444",.1)}},children:e.jsx(ce,{fontSize:"small"})})]})]}),e.jsx(B,{in:c,timeout:"auto",unmountOnExit:!0,children:e.jsx(i,{sx:{mt:2.5,pt:2.5,borderTop:"1px dashed",borderColor:"divider"},children:e.jsxs(a,{container:!0,spacing:2,alignItems:"stretch",children:[e.jsx(a,{item:!0,xs:12,md:4,children:e.jsxs(W,{icon:T,title:"ENQUIRY DETAILS",children:[e.jsx(m,{label:"RATE PER KG",children:e.jsx(N,{label:r.rate_per_kg,color:"success"})}),e.jsx(m,{label:"PICKUP",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:r.offers_pickup?"grey.800":"grey.500"},children:r.offers_pickup||"—"})}),e.jsx(m,{label:"DROP",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:r.offers_drop?"grey.800":"grey.500"},children:r.offers_drop||"—"})}),e.jsx(m,{label:"PACKING",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:r.packing_charge?"grey.800":"grey.500"},children:r.packing_charge||"—"})})]})}),e.jsx(a,{item:!0,xs:12,md:4,children:e.jsxs(W,{icon:he,title:"LOGISTICS & OPS",children:[e.jsx(m,{label:"TIME IN DAYS",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:r.time_in_days?"grey.800":"grey.500"},children:r.time_in_days||"—"})}),e.jsx(m,{label:"COMPANY",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:r.company||"—"})}),e.jsx(m,{label:"CONTACT NUMBER",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:r.phone||"—"})})]})}),e.jsx(a,{item:!0,xs:12,md:4,children:e.jsxs(W,{icon:E,title:"LOCATION & PINCODE",children:[e.jsx(m,{label:"AREA / ZONE",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:r.area||"—"})}),e.jsx(m,{label:"PLUS CODE",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:r.plus_code?"grey.800":"grey.500"},children:r.plus_code||"—"})}),e.jsx(m,{label:"FULL ADDRESS",children:e.jsxs(x,{spacing:1.5,children:[e.jsxs(x,{direction:"row",spacing:1,sx:{p:1.5,borderRadius:1.5,bgcolor:"grey.50",border:1,borderColor:"divider"},children:[e.jsx(E,{sx:{fontSize:16,color:"grey.400",mt:"2px"}}),e.jsx(o,{variant:"body2",sx:{color:"grey.800",lineHeight:1.5},children:r.address||"—"})]}),(r.address||r.plus_code)&&e.jsx(v,{component:"a",href:`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(r.plus_code?r.plus_code+" "+(r.address||""):r.address)}`,target:"_blank",rel:"noopener",size:"small",variant:"outlined",startIcon:e.jsx(ge,{sx:{fontSize:16}}),sx:{alignSelf:"flex-start",py:.5,px:1.5,fontSize:"0.75rem",fontWeight:600,borderRadius:2,color:"#c01227",borderColor:u("#c01227",.5),bgcolor:u("#c01227",.05),"&:hover":{borderColor:"#c01227",bgcolor:u("#c01227",.1)}},children:"View on map"})]})})]})}),e.jsx(a,{item:!0,xs:12,children:e.jsx(W,{icon:k,title:"RECORD METADATA",children:e.jsxs(a,{container:!0,spacing:2,children:[e.jsx(a,{item:!0,xs:6,children:e.jsx(m,{label:"CREATED BY",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:p?p.first_name:r.created_by?`User ID: ${r.created_by}`:"System"})})}),e.jsx(a,{item:!0,xs:6,children:e.jsx(m,{label:"LAST EDITED BY",children:e.jsx(o,{variant:"body2",sx:{fontWeight:500,color:"grey.800"},children:h?h.first_name:r.updated_by?`User ID: ${r.updated_by}`:"—"})})})]})})})]})})})]})}function _e({companyName:r,branches:t,onEdit:l,users:c}){const[s,p]=f.useState(!1);return e.jsxs(Y,{elevation:0,sx:{borderRadius:3,border:"1px solid",borderColor:s?"#c01227":"grey.200",p:{xs:2.5,md:3},mb:2.5,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{borderColor:"#c01227",boxShadow:"0 8px 30px rgba(192, 18, 39, 0.08)",transform:"translateY(-2px)"}},children:[e.jsxs(x,{direction:{xs:"column",md:"row"},spacing:3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",onClick:()=>p(!s),sx:{cursor:"pointer",userSelect:"none"},children:[e.jsxs(x,{direction:"row",spacing:2.5,alignItems:"center",children:[e.jsx(re,{sx:{width:64,height:64,bgcolor:u("#c01227",.1),color:"#c01227",fontWeight:800,fontSize:"1.5rem",borderRadius:2.5},children:(r||"A")[0].toUpperCase()}),e.jsxs(i,{children:[e.jsx(o,{variant:"h5",sx:{fontWeight:800,lineHeight:1.2,color:"grey.900"},children:r||"Unknown Company"}),e.jsxs(o,{variant:"body2",sx:{color:"grey.600",mt:.5,display:"flex",alignItems:"center",gap:.5},children:[e.jsx(T,{sx:{fontSize:16}})," ",t.length," Location",t.length!==1&&"s"," Surveyed"]})]})]}),e.jsxs(x,{direction:"row",spacing:3,alignItems:"center",children:[e.jsxs(x,{direction:"row",spacing:1,sx:{display:{xs:"none",md:"flex"}},children:[e.jsx(I,{size:"small",label:"First Mile",sx:{bgcolor:u("#c01227",.08),color:"#c01227",fontWeight:700,borderRadius:1.5}}),e.jsx(I,{size:"small",label:"Mid Mile",sx:{bgcolor:u("#c01227",.08),color:"#c01227",fontWeight:700,borderRadius:1.5}}),e.jsx(I,{size:"small",label:"Last Mile",sx:{bgcolor:u("#c01227",.08),color:"#c01227",fontWeight:700,borderRadius:1.5}})]}),e.jsx(x,{direction:"row",spacing:1.5,alignItems:"center",children:e.jsx(v,{sx:{borderRadius:2,py:1,px:3,fontWeight:700,color:s?"#c01227":"grey.700",bgcolor:s?u("#c01227",.1):"grey.100","&:hover":{bgcolor:u("#c01227",.15),color:"#c01227"}},endIcon:s?e.jsx(de,{}):e.jsx(xe,{}),children:s?"Hide Locations":"View Locations"})})]})]}),e.jsx(B,{in:s,timeout:"auto",unmountOnExit:!0,children:e.jsx(i,{sx:{mt:3,pt:3,borderTop:"2px dashed",borderColor:"grey.200"},children:e.jsx(x,{spacing:2,children:t.map(h=>e.jsx(Se,{row:h,onEdit:l,users:c},h.id||Math.random()))})})})]})}function Oe(){const[r,t]=f.useState([]),[l,c]=f.useState(!0),[s,p]=f.useState(""),[h,g]=f.useState(0),[d,z]=f.useState(5),[C,S]=f.useState(!1),[P,O]=f.useState(null),[K,V]=f.useState([]),$=()=>{let n=!1;return c(!0),Promise.all([ye(),ee().catch(()=>[])]).then(([j,_])=>{n||(t(j.data||j||[]),V(_||[]))}).catch(j=>console.error("Error fetching data:",j)).finally(()=>{n||c(!1)}),()=>{n=!0}};f.useEffect(()=>$(),[]);const L=r.filter(n=>(n.company||"").toLowerCase().includes(s.toLowerCase())||(n.area||"").toLowerCase().includes(s.toLowerCase())||(n.phone||"").toLowerCase().includes(s.toLowerCase())),M=L.reduce((n,j)=>{const _=j.company||"Unknown Company";return n[_]||(n[_]=[]),n[_].push(j),n},{}),U=Object.keys(M).sort(),F=U.slice(h*d,h*d+d),y={total:r.length,quoted:r.filter(n=>n.rate_per_kg&&!n.rate_per_kg.toLowerCase().includes("not answered")).length,missing:r.filter(n=>!n.rate_per_kg||n.rate_per_kg.toLowerCase().includes("not answered")).length};return e.jsxs(i,{sx:{pb:6,bgcolor:"#f8fafc",px:{xs:2,md:4},pt:3,minHeight:"100vh"},children:[e.jsx(ue,{title:"Field Surveys",breadcrumbs:[{label:"Survey Management"}]}),e.jsxs(a,{container:!0,spacing:3,sx:{mb:5,mt:1},children:[e.jsx(a,{item:!0,xs:12,md:4,children:e.jsx(w,{title:"TOTAL ENQUIRIES",value:l?"...":y.total,icon:k,gradient:"linear-gradient(135deg, #e11d48 0%, #c01227 100%)"})}),e.jsx(a,{item:!0,xs:12,md:4,children:e.jsx(w,{title:"RATES QUOTED",value:l?"...":y.quoted,icon:T,gradient:"linear-gradient(135deg, #10b981 0%, #047857 100%)",percentage:y.total?`${Math.round(y.quoted/y.total*100)}%`:"0%"})}),e.jsx(a,{item:!0,xs:12,md:4,children:e.jsx(w,{title:"MISSING INFO",value:l?"...":y.missing,icon:G,gradient:"linear-gradient(135deg, #334155 0%, #0f172a 100%)",percentage:y.total?`${Math.round(y.missing/y.total*100)}%`:"0%"})})]}),e.jsxs(Y,{sx:{borderRadius:2,boxShadow:"0 4px 20px rgba(0,0,0,0.05)",overflow:"hidden"},children:[e.jsxs(i,{sx:{p:3,display:"flex",alignItems:"center",gap:2,borderBottom:"1px solid",borderColor:"grey.100"},children:[e.jsx(i,{sx:{width:48,height:48,borderRadius:2.5,bgcolor:u("#c01227",.1),color:"#c01227",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(k,{})}),e.jsxs(i,{children:[e.jsx(o,{variant:"h6",sx:{fontWeight:700,color:"grey.900"},children:"Survey Records"}),e.jsx(o,{variant:"body2",sx:{color:"grey.600",mt:.5},children:"Manage business enquiry and survey data from the field"})]})]}),e.jsxs(i,{sx:{p:2,borderBottom:"1px solid",borderColor:"grey.100",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(b,{size:"small",placeholder:"Search by company, area, phone, or",value:s,onChange:n=>{p(n.target.value),g(0)},sx:{width:{xs:"100%",md:400}},InputProps:{startAdornment:e.jsx(pe,{position:"start",children:e.jsx(J,{fontSize:"small"})})}}),e.jsxs(x,{direction:"row",spacing:2,alignItems:"center",children:[!l&&e.jsxs(o,{variant:"body2",sx:{color:"grey.500",fontWeight:600},children:[L.length," records"]}),e.jsx(v,{variant:"contained",startIcon:e.jsx(se,{}),onClick:()=>{O(null),S(!0)},sx:{bgcolor:"#c01227","&:hover":{bgcolor:"#a00f20"},borderRadius:2,px:2,fontWeight:700,whiteSpace:"nowrap"},children:"Add New Survey"})]})]}),e.jsx(i,{sx:{p:3,bgcolor:"grey.50"},children:l?e.jsx(i,{sx:{display:"flex",justifyContent:"center",py:8},children:e.jsx(X,{})}):F.length>0?e.jsx(i,{children:F.map(n=>e.jsx(_e,{companyName:n,branches:M[n],onEdit:j=>{O(j),S(!0)},users:K},n))}):e.jsxs(i,{sx:{py:10,textAlign:"center"},children:[e.jsx(k,{sx:{fontSize:48,color:"grey.300",mb:2}}),e.jsx(o,{variant:"h6",color:"text.secondary",children:"No survey records found."}),e.jsx(o,{variant:"body2",color:"text.disabled",sx:{mt:1},children:"Try adjusting your search filters."})]})}),e.jsx(i,{sx:{borderTop:"1px solid",borderColor:"grey.200",bgcolor:"white"},children:e.jsx(le,{component:"div",count:U.length,page:h,onPageChange:(n,j)=>g(j),rowsPerPage:d,onRowsPerPageChange:n=>{z(parseInt(n.target.value,10)),g(0)},rowsPerPageOptions:[5,10,25],labelRowsPerPage:"Companies per page:"})})]}),e.jsx(Ce,{open:C,onClose:()=>S(!1),onSave:()=>$(),initialData:P})]})}export{Oe as default};
|