PageSourceSearch

https://red-de-esperanza-lime.vercel.app/assets/HistoricoSosView-BDA1nwsQ.js

js red-de-esperanza-lime.vercel.app collected 2026-10-03 07:35:49 UTC 4,900 bytes, 1 lines download raw bytes

1import{r,F as d,j as e,L as C,s as w,a3 as E}from"./index-BJUXv7rL.js";import{T as q}from"./TextoExpandible-CikaNgqK.js";const z="id, tipo, urgencia, estado, descripcion, zona, lat, lng, origen, reportado_por, asignado_a, creado_en, eliminada_del_mapa, ultimo_refresco, refrescos",L=500;function O(s){return new Date(s).toLocaleString("es-VE",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function V(){const[s,l]=r.useState([]),[i,v]=r.useState(new Map),[j,p]=r.useState(!0),[g,b]=r.useState(null),[n,y]=r.useState("todos"),[x,N]=r.useState("");r.useEffect(()=>{async function t(){const{data:a,error:c}=await w.from("necesidades").select(z).eq("tipo","rescate").order("creado_en",{ascending:!1}).limit(L);if(c){b(c.message),p(!1);return}l(a??[]);const o=await E(),h=new Map;for(const[_,S]of o)h.set(_,S.contacto);v(h),p(!1)}t()},[]);const f=r.useMemo(()=>{const t=x.trim().toLowerCase();return s.filter(a=>{var c,o;return t&&!((c=a.descripcion)!=null&&c.toLowerCase().includes(t)||(o=a.zona)!=null&&o.toLowerCase().includes(t))?!1:n==="todos"?!0:n==="oculto"?!!a.eliminada_del_mapa||d(a):a.eliminada_del_mapa?!1:n==="activo"?(a.estado==="sin_verificar"||a.estado==="verificada")&&!d(a):a.estado===n})},[s,n,x]),u=r.useMemo(()=>{const t=s.length,a=s.filter(o=>o.eliminada_del_mapa||d(o)).length,c=s.filter(o=>o.estado==="resuelta").length;return{total:t,ocultos:a,resueltos:c}},[s]);return e.jsxs("div",{className:"max-w-3xl mx-auto p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{to:"/voluntario",className:"text-sm font-semibold text-bandera-azul no-underline",children:"← Volver a atender solicitudes"}),e.jsx("h1",{className:"text-2xl font-extrabold text-bandera-azul mt-1",children:"🆘 Histórico de SOS"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Todos los botones SOS que se han enviado, incluidos los que ya vencieron y se ocultaron del mapa. Nada se borra de la base: esta lista sirve para verificar cualquier caso pasado."})]}),e.jsxs("section",{className:"card grid grid-cols-3 gap-2",children:[e.jsx(m,{etiqueta:"Total histórico",n:u.total,color:"#CC0001"}),e.jsx(m,{etiqueta:"Resueltos",n:u.resueltos,color:"#16A34A"}),e.jsx(m,{etiqueta:"Ocultos / vencidos",n:u.ocultos,color:"#475569"})]}),e.jsxs("div",{className:"card flex gap-2 flex-wrap",children:[e.jsxs("select",{className:"rounded-lg border px-2 py-2 text-sm font-semibold",value:n,onChange:t=>y(t.target.value),children:[e.jsx("option",{value:"todos",children:"Todos"}),e.jsx("option",{value:"activo",children:"Activos (visibles en el mapa)"}),e.jsx("option",{value:"en_proceso",children:"En proceso"}),e.jsx("option",{value:"resuelta",children:"Resueltos"}),e.jsx("option",{value:"oculto",children:"Ocultos / vencidos"})]}),e.jsx("input",{className:"rounded-lg border px-2 py-2 text-sm flex-1 min-w-[180px]",placeholder:"Buscar por zona o descripción...",value:x,onChange:t=>N(t.target.value)})]}),g&&e.jsxs("div",{className:"card text-center text-bandera-rojo text-sm py-4",children:["No se pudo cargar el histórico: ",g]}),j?e.jsx("div",{className:"card text-center text-gray-500 py-8",children:"Cargando…"}):f.length===0?e.jsx("div",{className:"card text-center text-gray-500 py-8",children:"No hay SOS con este filtro."}):e.jsx("section",{className:"space-y-2",children:f.map(t=>{const a=!!t.eliminada_del_mapa||d(t);return e.jsxs("div",{className:`card flex items-start gap-3 py-3 ${a?"bg-gray-50 opacity-90":""}`,children:[e.jsx("div",{className:"text-2xl",children:"🆘"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsx(q,{texto:t.descripcion,className:"font-semibold text-sm"}),t.zona&&e.jsxs("div",{className:"text-xs text-gray-600",children:["📍 ",t.zona]}),e.jsxs("div",{className:"text-xs text-gray-500",children:["🕒 ",O(t.creado_en)]}),i.get(t.id)&&e.jsxs("div",{className:"text-xs font-semibold text-bandera-azul break-all",children:["📞 ",i.get(t.id)]}),a&&e.jsx("div",{className:"text-xs font-bold text-gray-500",children:t.eliminada_del_mapa?"🗑️ Eliminado del mapa":"⏳ Vencido (sin renovar por 4 días)"})]}),e.jsx(T,{estado:t.estado})]},t.id)})})]})}function m({etiqueta:s,n:l,color:i}){return e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gray-50 px-3 py-2 text-center",children:[e.jsx("div",{className:"text-2xl font-extrabold leading-none",style:{color:i},children:l}),e.jsx("div",{className:"text-[11px] text-gray-600 mt-1",children:s})]})}function T({estado:s}){const i={sin_verificar:{t:"Recibido",c:"bg-gray-100 text-gray-600"},verificada:{t:"Recibido",c:"bg-gray-100 text-gray-600"},en_proceso:{t:"En proceso",c:"bg-blue-100 text-blue-700"},resuelta:{t:"Atendido",c:"bg-green-100 text-green-700"},rechazada:{t:"Cerrado",c:"bg-red-100 text-red-700"}}[s];return e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap ${i.c}`,children:i.t})}export{V 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.