PageSourceSearch

https://bitacora.ai/assets/Tareas-NDD3idgn.js

js bitacora.ai collected 2026-10-05 15:28:38 UTC 8,198 bytes, 6 lines download raw bytes

1import{c as F,u as y,r as l,e as k,z as x,j as t,x as R,L as E}from"./index-BiVk33Bn.js";import{P as z}from"./PatientCombobox-Ev8Ltelw.js";import{V as P}from"./ViewToggle-B6Oc7Rno.js";import{u as U}from"./useListView-Cd7ahFXU.js";import{j as V,a as L,T as A,b as B}from"./task-mlwlyDok.js";import{u as q,B as K,a as Y}from"./useBulkSelection-KaBbGcd5.js";import{b as O}from"./trash-CdUJ4-Bt.js";import{S as W}from"./square-check-big-xg-tLOXU.js";import"./patients-BbfSHjXB.js";import"./list-BHEiAzn9.js";import"./download-BHAxTLf1.js";import"./check-BeXug3s7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"daca8474617e38beb40596519f5b410a89e15552"};var s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="e03787e7-8abe-413b-b498-0debea494ea1",e._sentryDebugIdIdentifier="sentry-dbid-e03787e7-8abe-413b-b498-0debea494ea1")}catch{}})();/**
2 * @license lucide-react v0.508.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const G=[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Q=F("list-todo",G),H=["pending","overdue","completed","all"],g={assigned:"bg-bark/10 text-bark",viewed:"bg-bark/10 text-bark",in_progress:"bg-terracotta/15 text-terracotta",completed:"bg-forest/15 text-forest",returned:"bg-terracotta/15 text-terracotta",overdue:"bg-terracotta/15 text-terracotta",cancelled:"bg-bark/15 text-bark-muted"};function v(e,s){if(!e)return s("due.none");const i=new Date(`${e}T23:59:59`),u=new Date,n=Math.round((i.getTime()-u.getTime())/(1e3*60*60*24));return n===0?s("due.today"):n===1?s("due.tomorrow"):n>0?s("due.inDays",{count:n}):s("due.overdue",{count:Math.abs(n)})}function j(e,s){return e.patient?[e.patient.first_name,e.patient.last_name].filter(Boolean).join(" ").trim():s("page.deletedPatient")}function f(e){return!e.due_date||e.status==="completed"||e.status==="returned"||e.status==="cancelled"?!1:new Date(`${e.due_date}T23:59:59`).getTime()<Date.now()}function pe(){const{t:e}=y("tareas"),[s,i]=l.useState([]),[u,n]=l.useState(!0),[c,w]=l.useState(null),[m,D]=l.useState(""),[d,$]=l.useState("pending"),[T,C]=U("tareas-aggregate","list"),N=l.useMemo(()=>{const r={};return m&&(r.patientId=m),d==="pending"&&(r.status=["assigned","viewed","in_progress"]),d==="completed"&&(r.status=["completed","returned"]),d==="overdue"&&(r.overdue=!0),r},[m,d]),h=l.useCallback(async()=>{n(!0),w(null);try{const r=await V(N);i(r)}catch(r){w(k(r,e("errors.load"))),x.error(k(r,e("errors.load")))}finally{n(!1)}},[N,e]);l.useEffect(()=>{h()},[h]);const a=q(),[M,S]=l.useState(!1);async function I(){const r=a.count;if(!(r===0||!await R({title:e("bulk.confirmTitle"),description:e("bulk.confirmBody",{count:r}),confirmLabel:e("bulk.confirm"),destructive:!0}))){S(!0);try{const{deleted:o,errors:_}=await O("tasks",a.selectedIds);_.length>0&&x.error(e("bulk.deleteErrors",{count:_.length})),o>0&&x.success(o===1?e("bulk.sentOne",{count:o}):e("bulk.sentMany",{count:o})),await h(),a.disable()}catch(o){x.error(k(o,e("bulk.error")))}finally{S(!1)}}}const p=l.useMemo(()=>{if(d==="overdue")return s;const r=s.filter(f),b=s.filter(o=>!f(o));return[...r,...b]},[s,d]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-5 py-8 lg:px-12 lg:py-12",children:[t.jsxs("header",{className:"mb-12 flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-tiny uppercase tracking-widest text-terracotta mb-3",children:e("page.marker")}),t.jsx("h1",{className:"text-h1 font-sans text-bark mb-4",children:e("page.title")}),t.jsx("p",{className:"text-body text-bark-muted max-w-2xl leading-relaxed",children:e("page.subtitle")})]}),t.jsxs("button",{type:"button",onClick:()=>a.active?a.disable():a.enable(),className:`inline-flex items-center gap-2 border uppercase tracking-widest text-tiny rounded-full px-6 py-3 transition-colors ${a.active?"border-terracotta text-terracotta bg-terracotta/5":"border-bark/30 text-bark hover:border-bark hover:bg-bone"}`,children:[t.jsx(W,{size:16,strokeWidth:1.5}),a.active?e("page.cancelSelection"):e("page.select")]})]}),t.jsxs("div",{className:"mb-8 flex flex-wrap items-center gap-4",children:[t.jsx(z,{value:m,onChange:D}),t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:H.map(r=>{const b=d===r,o=e(r==="pending"?"page.filters.pending":r==="overdue"?"page.filters.overdue":r==="completed"?"page.filters.completed":"page.filters.all");return t.jsx("button",{type:"button",onClick:()=>$(r),className:`h-8 px-4 text-tiny uppercase tracking-widest rounded-full border transition-colors ${b?"border-bark bg-bark text-linen":"border-bark/20 text-bark-muted hover:border-bark hover:text-bark"}`,children:o},r)})}),t.jsx("div",{className:"ml-auto",children:t.jsx(P,{value:T,onChange:C,ariaLabel:e("viewToggleAria")})})]}),u?t.jsx("p",{className:"text-tiny uppercase tracking-widest text-bark-muted",children:e("common:estados.cargando")}):c?t.jsx("p",{className:"text-small text-clay",children:c}):p.length===0?t.jsx(Z,{filter:d}
6):a.active?t.jsx(K,{rows:p.map(r=>({id:r.id,title:r.title,subtitle:`${j(r,e)}${r.due_date?` · ${v(r.due_date,e)}`:""}`})),selectedSet:a.selectedSet,onToggle:a.toggle,onToggleAll:()=>a.toggleAll(p.map(r=>r.id)),emptyMessage:e("page.bulkEmpty")}):T==="grid"?t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:p.map(r=>t.jsx(J,{task:r},r.id))}):t.jsx("ul",{className:"divide-y divide-bark/10 border-y border-bark/10",children:p.map(r=>t.jsx(X,{task:r},r.id))})]}),t.jsx(Y,{count:a.count,onCancel:a.disable,onDelete:()=>void I(),busy:M})]})}function J({task:e}){const{t:s}=y("tareas"),i=g[e.status]??g.assigned,n=f(e)&&e.status!=="overdue"?"overdue":e.status,c=e.patient?`/dashboard/pacientes/${e.patient.id}?tab=tareas`:"#";return t.jsxs(E,{to:c,className:"block border border-bark/10 rounded-md p-4 bg-bone hover:border-bark/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-tiny uppercase tracking-widest text-bark-muted",children:j(e,s)}),t.jsx("h4",{className:"text-body text-bark font-sans truncate mt-1",children:e.title}),t.jsxs("p",{className:"text-tiny text-bark-muted mt-1",children:[e.task_type?L[e.task_type]:s("card.noType")," ·"," ",A[e.frequency]," · ",v(e.due_date,s)]})]}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-tiny uppercase tracking-widest ${i}`,children:B[n]})]}),e.description?t.jsx("p",{className:"text-small text-bark mt-3 line-clamp-2",children:e.description}):null]})}function X({task:e}){const{t:s}=y("tareas"),i=g[e.status]??g.assigned,n=f(e)&&e.status!=="overdue"?"overdue":e.status,c=e.patient?`/dashboard/pacientes/${e.patient.id}?tab=tareas`:"#";return t.jsx("li",{children:t.jsxs(E,{to:c,className:"flex items-center gap-4 px-4 py-4 hover:bg-bark/5 transition-colors",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-tiny uppercase tracking-widest text-bark-muted",children:j(e,s)}),t.jsx("p",{className:"text-body text-bark truncate mt-1",children:e.title}),t.jsxs("p",{className:"text-tiny text-bark-muted mt-1",children:[e.task_type?L[e.task_type]:s("card.noType")," ·"," ",A[e.frequency]," · ",v(e.due_date,s)]})]}),t.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-tiny uppercase tracking-widest ${i}`,children:B[n]})]})})}function Z({filter:e}){const{t:s}=y("tareas"),i=s(e==="pending"?"page.empty.pending":e==="overdue"?"page.empty.overdue":e==="completed"?"page.empty.completed":"page.empty.all");return t.jsxs("div",{className:"text-center py-24 max-w-md mx-auto",children:[t.jsx(Q,{size:24,strokeWidth:1.5,className:"mx-auto text-bark-muted"}),t.jsx("p",{className:"text-body text-bark mt-4",children:i})]})}export{pe 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.