codigo0/dist/assets/page-material-Ck8ErBi1.js

2 lines
19 KiB
JavaScript
Raw Normal View History

import{r as f,j as e,R as E,C as z,X as T,i as j,I,au as B}from"./0-vendor-react-DWOJpYrt.js";import{B as A}from"./page-ajustes-DgawOEJM.js";import{B as x,C as y,A as C,a as N}from"./page-comunicacion-DmHQUHoW.js";import"./1-vendor-utils-Delnuc0l.js";import"./2-vendor-markdown-BQlHAcA7.js";const O=({checklist:t,onReset:c})=>{const[o,d]=f.useState(new Set),[u,s]=f.useState(new Set([t.sections[0]?.id||""])),b=i=>{const a=new Set(o);a.has(i)?a.delete(i):a.add(i),d(a)},g=i=>{const a=new Set(u);a.has(i)?a.delete(i):a.add(i),s(a)},S=()=>{d(new Set),c&&c()},w=i=>{const a=i.items.length,n=i.items.filter(l=>o.has(l.id)).length;return{checked:n,total:a,percentage:a>0?Math.round(n/a*100):0}},P=()=>{const i=t.sections.flatMap(l=>l.items),a=i.length,n=i.filter(l=>o.has(l.id)).length;return{checked:n,total:a,percentage:a>0?Math.round(n/a*100):0}},M=()=>t.sections.flatMap(i=>i.items.filter(a=>a.critical)),_=()=>M().filter(i=>!o.has(i.id)),m=P(),h=_(),R=i=>{switch(i){case"inicio_turno":return"default";case"pre_escena":return"default";case"post_servicio":return"default";default:return"default"}},k=i=>{switch(i){case"inicio_turno":return"Inicio Turno";case"pre_escena":return"Pre-Escena";case"post_servicio":return"Post-Servicio";default:return i}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-bold text-foreground text-lg",children:t.title}),e.jsx(x,{variant:R(t.phase),children:k(t.phase)})]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.description})]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:S,className:"shrink-0",title:"Reiniciar checklist",children:e.jsx(E,{className:"w-4 h-4"})})]}),e.jsx(y,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Progreso general"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[m.checked," / ",m.total," (",m.percentage,"%)"]})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${m.percentage}%`}})})]})}),h.length>0&&e.jsxs(C,{variant:"destructive",children:[e.jsx(z,{className:"w-4 h-4"}),e.jsxs(N,{children:[e.jsx("strong",{children:"Items críticos pendientes:"})," ",h.length," item(s) crítico(s) sin verificar"]})]}),e.jsx("div",{className:"space-y-3",children:t.sections.map(i=>{const a=w(i),n=u.has(i.id),v=i.items.filter(r=>r.critical).filter(r=>!o.has(r.id));return e.jsxs(y,{className:"overflow-hidden",children:[e.jsxs("button",{onClick:()=>g(i.id),className:"w-full p-4 flex items-center justify-between hover:bg-accent transition-colors text-left",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"font-semibold text-foreground",children:i.title}),v.length>0&&e.jsxs(x,{variant:"destructive",className:"text-xs",children:[v.length," crítico(s)"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[a.checked," / ",a.total," completado"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[a.percentage,"%"]})]})]}),e.jsx("div",{className:"ml-4",children:n?e.jsx(T,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(j,{className:"w-5 h-5 text-muted-foreground"})})]}),n&&e.jsxs("div",{className:"px-4 pb-4 space-y-2 border-t border-border pt-4",children:[i.items.map(r=>{const p=o.has(r.id);return e.jsxs("button",{onClick:()=>b(r.id),className:`w-full flex items-start gap-3 p-3 rounded-lg bg-muted hover:bg-accent transition-colors text-left ${p?r.critical?"bg-destructive/15 ring-2 ring-destructive/40":"bg-success/15 ring-2 ring-success/40":""}`,children:[e.jsx("div",{className:`w-6 h-6 rounded border-2 flex items-center justify-center trans