1import{aa as A,t as K,cU as H,r as n,d as j,j as e,b as D,bE as L,F as M,aA as B,bp as O,aF as X,a6 as z,cX as q,a7 as E,x as G,z as I}from"./index-BuF13C9R.js";import{S as J}from"./SitePageShell-D3rwKhmW.js";import{R as Q}from"./ResidentLoginRedirect-C4cTFDh_.js";import{D as V}from"./DispatchEventMap-BDG4pCZl.js";import{S as W}from"./siren-DuSchdHr.js";import{C as Y}from"./circle-slash-5Tiii96A.js";import{C as Z}from"./circle-dashed-yfZhd13z.js";import"./usePaymentPlacements-CX0SzjnY.js";import"./user-cog-BrPu6RcS.js";import"./bell-ring-DHDlhRvf.js";import"./life-buoy-DD0yJ6o8.js";import"./log-in-8daxVYSJ.js";import"./kibbutzSiteUtils-DG6eIbUJ.js";import"./info-BIFqAg3-.js";import"./folder-open-BSPTKQzn.js";import"./graduation-cap-D9zn9IjR.js";import"./file-check-D2O-2b5u.js";import"./instagram-rO3n40RO.js";import"./sliders-horizontal-D0cjPgOh.js";import"./youtube-D4vYeyfI.js";import"./leaf-BxZ8PRn4.js";import"./paymentCatalogs-CvImawYM.js";import"./chevron-left-D2IUBEPa.js";import"./clipboard-check-CMT0h_dd.js";import"./personalHeading-D8itHFYD.js";import"./ContentPageHero-BxCWcB43.js";const N=a=>a?new Date(a).toLocaleString("he-IL",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"",x={joined:{label:"×ת×××¨× ×××ר××¢",row:"×ת××ר",Icon:B,bg:"bg-emerald-50",border:"border-emerald-200",text:"text-emerald-700",dot:"bg-emerald-500"},pending:{label:"××¨× ×××××",row:"××ת××",Icon:Z,bg:"bg-slate-50",border:"border-slate-200",text:"text-slate-500",dot:"bg-slate-300"},unavailable:{label:"ס××× × ×× ××××",row:"×× ××××",Icon:Y,bg:"bg-red-50",border:"border-red-200",text:"text-red-600",dot:"bg-red-500"}};function Ce(){const{kibbutzId:a,incidentId:r}=A(),w=K(),l=H(a),[d,v]=n.useState(null),[R,h]=n.useState(!0),[y,F]=n.useState({lat:null,lng:null}),[m,T]=n.useState("all"),[u,P]=n.useState(!1),[S,_]=n.useState(!1);n.useEffect(()=>{a&&j.entities.Kibbutz.get(a).then(t=>F({lat:(t==null?void 0:t.map_latitude)??null,lng:(t==null?void 0:t.map_longitude)??null})).catch(()=>{})},[a]);const b=n.useCallback(()=>{if(!a||!(l!=null&&l.phone)||!r){h(!1);return}h(!0),j.functions.invoke("residentDispatchDetail",{community_id:a,phone:l.phone,incident_id:r}).then(t=>v((t==null?void 0:t.data)||null)).catch(()=>v(null)).finally(()=>h(!1))},[a,r,l==null?void 0:l.phone]);n.useEffect(()=>{b()},[b]);function U(){!(l!=null&&l.phone)||!r||(_(!0),j.functions.invoke("dispatchRespond",{community_id:a,phone:l.phone,incident_id:r,status:"unavailable"}).then(()=>{I.success("××ª× ×ª×§×ª ××××ר××¢"),b()}).catch(()=>I.error("ש×××× ××¢××××")).finally(()=>_(!1)))}return e.jsx(J,{kibbutzId:a,moduleKey:"resident_registration",showHero:!1,hideFooter:!0,pageTitle:"××ר××¢ ××××××",children:()=>{var $;if(!l)return e.jsx(Q,{kibbutzId:a});if(R)return e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx(D,{className:"w-7 h-7 animate-spin text-slate-400"})});const t=d==null?void 0:d.incident;if(!t)return e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-12 text-center",dir:"rtl",children:[e.jsx(W,{className:"w-10 h-10 text-slate-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-slate-500 mb-4",children:"×××ר××¢ ×× × ××¦× ×× ×©××× × ×××¨×©× ×צפ×ת ××."}),e.jsx("button",{onClick:()=>w(L(`/kibbutz-site/${a}/personal/security-team`)),className:"h-10 px-4 rounded-full bg-slate-800 text-white text-sm font-bold",children:"×××¨× ×צ××ת ××ר×× ×××××××"})]});const o=d.recipients||[],g=d.logs||[],C=o.filter(s=>s.status==="joined"),p={joined:C,pending:o.filter(s=>s.status!=="joined"&&s.status!=="unavailable"),unavailable:o.filter(s=>s.status==="unavailable")};return e.jsxs("div",{className:"max-w-5xl mx-auto w-full px-4 py-6 space-y-4",dir:"rtl",children:[e.jsxs("button",{onClick:()=>w(L(`/kibbutz-site/${a}/personal/security-team`)),className:"inline-flex items-center gap-1.5 text-sm font-semibold text-slate-500 hover:text-slate-700",children:[e.jsx(M,{className:"w-4 h-4"})," ×××¨× ×צ××ת ××ר×× ×××××××"]}),e.jsx("div",{className:"rounded-3xl overflow-hidden border border-red-200 shadow-sm",children:e.jsx("div",{className:"bg-gradient-to-l from-red-600 to-rose-600 text-white p-5 sm:p-6",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:`text-[11px] font-bold rounded-full px-2.5 py-0.5 ${t.status==="closed"?"bg-slate-900/30":"bg-white/20"}`,children:t.status==="closed"?"ס××ר":"פע××"}),t.my_status&&e.jsx("span",{className:"text-[11px] font-bold rounded-full px-2.5 py-0.5 bg-white/20",children:(($=x[t.my_status])==null?void 0:$.row)||t.my_status})]}),e.jsx("h1",{className:"text-2xl font-extrabold mt-1.5 leading-tight",children:t.title}),t.message&&e.jsx("p",{className:"text-white/90 text-sm mt-1 leading-relaxed",children:t.message}),e.jsxs("div",{className:"flex items-center gap-4 mt-2.5 text-white/85 text-xs flex-wrap",children:[t.opened_by&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(O,{className:"w-3.5 h-3.5"})," ××קפץ ×¢×´× ",t.opened_by]}),t.opened_at&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(X,{className:"w-3.5 h-3.5"})," ",N(t.opened_at)]}),t.location&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(z,{className:"w-3.5 h-3.5"})," ",t.location]})]})]}),t.status!=="closed"&&t.my_status==="joined"&&e.jsxs("button",{onClick:U,disabled:S,className:"inline-flex items-center gap-1.5 h-9 px-3.5 rounded-full bg-white/15 hover:bg-white/25 text-white text-sm font-bold transition-colors flex-none disabled:opacity-50",children:[S?e.jsx(D,{className:"w-4 h-4 animate-spin"}):e.jsx(q,{className:"w-4 h-4"})," ××ª× ×ª×§ ××××ר××¢"]})]})})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[[{key:"all",label:"×××",count:o.length,dot:"bg-slate-400"},{key:"joined",label:"×ת××ר×",count:p.joined.length,dot:x.joined.dot}
1,{key:"pending",label:"××ת×× ××",count:p.pending.length,dot:x.pending.dot},{key:"unavailable",label:"×× ×××× ××",count:p.unavailable.length,dot:x.unavailable.dot}].map(s=>e.jsxs("button",{onClick:()=>T(s.key),className:`inline-flex items-center gap-1.5 h-9 px-3.5 rounded-full text-sm font-bold border transition-all ${m===s.key?"bg-slate-800 text-white border-slate-800":"bg-white text-slate-600 border-slate-200 hover:border-slate-300"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${s.dot}`})," ",s.label,e.jsx("span",{className:`text-[11px] rounded-full px-1.5 ${m===s.key?"bg-white/20":"bg-slate-100"}`,children:s.count})]},s.key)),e.jsxs("button",{onClick:()=>P(s=>!s),className:`inline-flex items-center gap-1.5 h-9 px-3.5 rounded-full text-sm font-bold border transition-all mr-auto ${u?"bg-indigo-600 text-white border-indigo-600":"bg-white text-indigo-600 border-indigo-200 hover:border-indigo-300"}`,children:[e.jsx(E,{className:"w-4 h-4"})," רש××ת ת××¢××××",e.jsx("span",{className:`text-[11px] rounded-full px-1.5 ${u?"bg-white/20":"bg-indigo-50"}`,children:g.length})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 items-start",children:[e.jsxs("div",{className:"card-float p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg bg-red-50 grid place-items-center",children:e.jsx(G,{className:"w-4 h-4 text-red-600"})}),e.jsx("h3",{className:"text-sm font-bold text-slate-800",children:"××קפצ×× ×××ר××¢"})]}),o.length===0?e.jsx("p",{className:"text-sm text-slate-400 py-8 text-center",children:"××× ××קפצ×× ×××ר××¢ ××."}):e.jsx("div",{className:"space-y-4",children:["joined","pending","unavailable"].filter(s=>m==="all"||m===s).map(s=>{const f=p[s];if(!f.length)return null;const i=x[s];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${i.dot}`}),e.jsxs("span",{className:"text-xs font-bold text-slate-500",children:[i.label," · ",f.length]})]}),e.jsx("div",{className:"space-y-1.5",children:f.map((c,k)=>e.jsxs("div",{className:`flex items-center gap-3 rounded-xl border ${i.border} ${i.bg} px-3 py-2`,children:[s==="joined"&&e.jsx("span",{className:"w-6 h-6 rounded-full bg-emerald-600 text-white text-xs font-black grid place-items-center flex-none tabular-nums",children:k+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800 truncate",children:c.full_name}),c.team&&e.jsx("p",{className:"text-[11px] text-slate-500",children:c.team})]}),e.jsxs("span",{className:`text-[11px] font-bold ${i.text} flex-none inline-flex items-center gap-1`,children:[e.jsx(i.Icon,{className:"w-3.5 h-3.5"}),c.responded_at?N(c.responded_at):i.row]})]},k))})]},s)})})]}),e.jsxs("div",{className:"card-float p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg bg-emerald-50 grid place-items-center",children:e.jsx(z,{className:"w-4 h-4 text-emerald-600"})}),e.jsx("h3",{className:"text-sm font-bold text-slate-800",children:"×פת ×××ר××¢"}),e.jsx("span",{className:"text-xs text-slate-400 mr-auto",children:"×××§× (××××) ×××××ר×× (×ר××§)"})]}),e.jsx(V,{incident:t,joined:C,centerLat:y.lat,centerLng:y.lng,heightClass:"h-[360px]"})]})]}),u&&e.jsxs("div",{className:"card-float p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl bg-indigo-50 grid place-items-center flex-none",children:e.jsx(E,{className:"w-5 h-5 text-indigo-600"})}),e.jsx("h3",{className:"text-base font-extrabold text-slate-900",children:"ת××¢××× ×××ר××¢"})]}),g.length===0?e.jsx("p",{className:"text-sm text-slate-400 py-6 text-center",children:"××× ×ª××¢×××× ××צ××× ××××¨× ×צ××ת."}):e.jsx("div",{className:"space-y-2",children:g.map(s=>e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-slate-50/60 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800",children:s.title}),e.jsx("span",{className:"text-[11px] text-slate-400 tabular-nums flex-none",children:N(s.logged_at)})]}),s.description&&e.jsx("p",{className:"text-xs text-slate-600 mt-1 whitespace-pre-wrap",children:s.description})]},s.id))})]})]})}})}
1export{Ce 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.