1import{r as L,j as e}from"./index-BH8Hq4fF.js";import{f as E}from"./money-CmD9E_V-.js";import{R as d,C as f,T as x,L as y,B as v}from"./generateCategoricalChart-BdpZagc6.js";import{P as S,a as w}from"./PieChart-BecCKbda.js";import{B as C,X as k,Y as R}from"./BarChart-BcX6CtaQ.js";import{C as K}from"./CartesianGrid-v8Vrjjuo.js";import"./isEqual-JxrnfUIG.js";import"./tiny-invariant-BaFNuDhB.js";const M={×¤× ××:"#10b981",××ש×ר:"#0ea5e9",×ת××××§×:"#f59e0b","×× ××××":"#94a3b8"},P={פת××:"#f59e0b",×××פ××:"#0ea5e9","××ת×× ××××§":"#a855f7",××ש××:"#10b981",××××:"#94a3b8"},o=["#d97706","#0ea5e9","#10b981","#a855f7","#e11d48","#64748b"],$=n=>new Date(`${String(n||"").slice(0,10)}T00:00:00`);function m({title:n,children:i}){return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4",children:[e.jsx("h4",{className:"text-sm font-bold text-slate-700 mb-3",children:n}),e.jsx("div",{style:{height:240},children:i})]})}function J({caravans:n,rentals:i,tickets:c}){const l=L.useMemo(()=>{const r=new Date,a={},u={};for(const t of n){a[t.status||"×¤× ××"]=(a[t.status||"×¤× ××"]||0)+1;const s=t.owner_type||"×××";u[s]=(u[s]||0)+1}const h={};for(const t of c)h[t.status||"פת××"]=(h[t.status||"פת××"]||0)+1;const b=[{label:"â¤7 ××××",max:7},{label:"â¤14",max:14},{label:"â¤30",max:30},{label:"â¤60",max:60}],p=i.filter(t=>t.status==="פע×××"&&t.end_date),T=b.map((t,s)=>{const _=s?b[s-1].max:0,z=p.filter(A=>{const j=($(A.end_date)-r)/864e5;return j>=0&&j>_&&j<=t.max}).length;return{label:t.label,count:z}}),g=n.filter(t=>t.status==="××ש×ר").length,O=n.length?Math.round(g/n.length*100):0,D=c.filter(t=>t.status!=="××ש××"&&t.status!=="××××").length,B=c.reduce((t,s)=>t+(Number(s.cost)||0),0);return{status:Object.entries(a).map(([t,s])=>({name:t,value:s})),owner:Object.entries(u).map(([t,s])=>({name:t,value:s})),ticketStatus:Object.entries(h).map(([t,s])=>({name:t,value:s})),ending:T,occupancy:O,rented:g,openTickets:D,totalCost:B,activeRentals:p.length}},[n,i,c]),N=[{label:"ש××¢×ר תפ×ס×",value:`${l.occupancy}%`,color:"text-sky-600"},{label:"ש××ר×××ת פע×××ת",value:l.activeRentals,color:"text-emerald-600"},{label:"קר×××ת פת×××ת",value:l.openTickets,color:"text-rose-600"},{label:"×¢××ת ת××××§×",value:E(l.totalCost),color:"text-amber-600"}];return e.jsxs("div",{className:"space-y-4",dir:"rtl",children:[e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:N.map(r=>e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 text-right",children:[e.jsx("p",{className:`text-2xl font-extrabold ${r.color}`,children:r.value}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:r.label})]},r.label))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[e.jsx(m,{title:"×תפ×××ת ס×××ס קר×××× ××",children:e.jsx(d,{children:e.jsxs(S,{children:[e.jsx(w,{data:l.status,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:!0,children:l.status.map((r,a)=>e.jsx(f,{fill:M[r.name]||o[a%o.length]},a))}),e.jsx(x,{}),e.jsx(y,{})]})})}),e.jsx(m,{title:"קר×××× ×× ××¤× ××ר×/××¢××ת",children:e.jsx(d,{children:e.jsxs(C,{data:l.owner,children:[e.jsx(K,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),e.jsx(k,{dataKey:"name",tick:{fontSize:12}}),e.jsx(R,{allowDecimals:!1,tick:{fontSize:12}}),e.jsx(x,{}),e.jsx(v,{dataKey:"value",radius:[6,6,0,0],children:l.owner.map((r,a)=>e.jsx(f,{fill:o[a%o.length]},a))})]})})}),e.jsx(m,{title:"ש××ר×××ת ×סת××××ת (××¤× ××××)",children:e.jsx(d,{children:e.jsxs(C,{data:l.ending,children:[e.jsx(K,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),e.jsx(k,{dataKey:"label",tick:{fontSize:12}}),e.jsx(R,{allowDecimals:!1,tick:{fontSize:12}}),e.jsx(x,{}),e.jsx(v,{dataKey:"count",fill:"#f59e0b",radius:[6,6,0,0]})]})})}),e.jsx(m,{title:"ס×××ס קר×××ת ת××××§×",children:e.jsx(d,{children:e.jsxs(S,{children:[e.jsx(w,{data:l.ticketStatus,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:!0,children:l.ticketStatus.map((r,a)=>
1e.jsx(f,{fill:P[r.name]||o[a%o.length]},a))}),e.jsx(x,{}),e.jsx(y,{})]})})})]})]})}export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.