import{r as c,X as h,j as e,S as p,A as u}from"./app-k86Ef-z9.js";import{C as f}from"./checkbox-AMKfmfes.js";import{A as g}from"./AdminLayout-AM-rMg-Q.js";import{B as N}from"./button-_NvSFZmI.js";import{U as j}from"./users-Lz_YHj9-.js";import{P as b}from"./printer-DV_-A4Ob.js";import{c as l}from"./createLucideIcon-0-ULngH7.js";import{C as y}from"./Combination-48UUUXzm.js";import"./index-7WSXypvi.js";import"./index-Cfb_fg3c.js";import"./index-CuDCJLcP.js";import"./index-BtC_bxq7.js";import"./index-CdhAbvlA.js";import"./toaster-Cq9HAi8u.js";import"./x-BioAQiNH.js";import"./dropdown-menu-D6NBsqXL.js";import"./chevron-right-Fm4h_7HY.js";import"./graduation-cap-D9WCOiIx.js";/**
* @license lucide-react v0.474.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],k=l("CircleCheck",v);/**
* @license lucide-react v0.474.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],C=l("CircleX",w);function G({jadwal:s}){const[a,d]=c.useState(s.pelatihan.pesertas),m=t=>{d(a.map(r=>r.id===t?{...r,hadir:!r.hadir}:r))};c.useEffect(()=>{for(let t=0;t<s.pelatihan.pesertas.length;t++){const r=s.pelatihan.pesertas[t];s.absen_pesertas.find(i=>i.peserta_id==r.peserta.id&&i.hadir==!0)&&(r.hadir=!0,a.map(i=>i.id===r.id?{...r,hadir:!0}:i))}d(a)},[]);const o=()=>{u.post(route("admin.pelatihan.simpan-absensi",{pelatihan_jadwal_id:s.id}),{absensi:a.map(t=>({id:t.peserta.id,hadir:t.hadir}))})},n=a.filter(t=>t.hadir).length,x=h().props.auth.user;return e.jsxs(g,{user:x,header:e.jsxs("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:["Absensi Peserta Pelatihan : ",s.pelatihan.title]}),children:[e.jsx(p,{title:`Absensi Pelatihan ${s.pelatihan.title}`}),e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("h1",{className:"text-lg font-bold md:text-2xl",children:["Absensi Peserta Pelatihan : ",s.pelatihan.title]})}),e.jsxs("div",{className:"bg-card rounded-lg shadow-lg overflow-hidden border",children:[e.jsx("div",{className:"p-6 bg-primary",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(j,{className:"w-8 h-8 text-primary-foreground"}),e.jsxs("div",{className:"text-primary-foreground",children:[e.jsx("h1",{className:"text-2xl font-bold ",children:"Ceklist Kehadiran"}),e.jsxs("p",{children:[s.name," / ",s.course_date]})]})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"text-primary-foreground bg-primary/80 px-4 py-2 rounded-full text-sm font-medium",children:["Hadir: ",n," / ",a.length]}),e.jsxs("a",{href:`${route("admin.pelatihan.absensi.print",s.id)}`,target:"_blank",className:"no-print flex items-center space-x-2 bg-primary-foreground text-primary px-4 py-2 rounded-full text-sm font-medium hover:bg-primary-foreground/90 transition-colors",children:[e.jsx(b,{className:"w-4 h-4"}),e.jsx("span",{children:"Print"})]})]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",style:{width:"100px"},children:"No."}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Peserta"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider no-print",children:"Hadir"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",style:{width:"200px"},children:"Status"})]})}),e.jsx("tbody",{className:"bg-card divide-y divide-border",children:a.map((t,r)=>e.jsxs("tr",{className:"hover:bg-muted/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-muted-foreground",children:r+1}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm font-medium text-card-foreground",children:t.nama_lengkap})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap no-print",children:e.jsx(f,{checked:t.hadir,onCheckedChange:()=>m(t.id)})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"flex items-center",children:t.hadir?e.jsxs("span",{className:"flex items-center text-green-600 font-medium",children:[e.jsx(k,{className:"w-4 h-4 mr-1"}),"Hadir"]}):e.jsxs("span",{className:"flex items-center text-destructive font-medium",children:[e.jsx(C,{className:"w-4 h-4 mr-1"}),"Tidak Hadir"]})})})]},t.id))})]})}),e.jsxs("div",{className:"p-4 bg-muted/50 border-t flex gap-2 items-center",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Total Peserta: ",a.length," | Hadir: ",n," | Absent: ",a.length-n]}),e.jsxs(N,{variant:"outline",onClick:o,className:"no-print",children:[e.jsx(y,{className:"w-4 h-4 text-green-500"})," Simpan"]})]})]})]})}export{G as default};
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]