import{r as c,j as e,X as L,S as X,A as K}from"./app-0b8HgTDA.js";import{u as M,a as O,c as T,P as E,b as w}from"./index-aSTaWEIf.js";import{u as $}from"./index-DmFwObfI.js";import{u as q}from"./index-BZfJPluq.js";import{P as U}from"./toaster-CRWCZyFP.js";import{c as P}from"./utils-CytzSlOG.js";import{C as _}from"./Combination-DhAoV45C.js";import{A as F}from"./AdminLayout-CP7W2bBD.js";import{B as G}from"./button-Bw_zDqGo.js";import{U as J}from"./users-tT88xRHv.js";import{P as Q}from"./printer-J-kzqH9Z.js";import{c as R}from"./createLucideIcon-t55EzsJV.js";import"./x-CPqJ4yqJ.js";import"./dropdown-menu-Bdy7vvA1.js";import"./chevron-right-BRGzN-yT.js";import"./graduation-cap-DoN7DOOS.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"}]],W=R("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 Y=[["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"}]],Z=R("CircleX",Y);var v="Checkbox",[ee,Ne]=T(v),[te,se]=ee(v),S=c.forwardRef((t,r)=>{const{__scopeCheckbox:a,name:l,checked:x,defaultChecked:i,required:p,disabled:s,value:n="on",onCheckedChange:b,form:o,...y}=t,[m,g]=c.useState(null),k=M(r,d=>g(d)),N=c.useRef(!1),C=m?o||!!m.closest("form"):!0,[u=!1,j]=O({prop:x,defaultProp:i,onChange:b}),D=c.useRef(u);return c.useEffect(()=>{const d=m==null?void 0:m.form;if(d){const f=()=>j(D.current);return d.addEventListener("reset",f),()=>d.removeEventListener("reset",f)}},[m,j]),e.jsxs(te,{scope:a,state:u,disabled:s,children:[e.jsx(E.button,{type:"button",role:"checkbox","aria-checked":h(u)?"mixed":u,"aria-required":p,"data-state":H(u),"data-disabled":s?"":void 0,disabled:s,value:n,...y,ref:k,onKeyDown:w(t.onKeyDown,d=>{d.key==="Enter"&&d.preventDefault()}),onClick:w(t.onClick,d=>{j(f=>h(f)?!0:!f),C&&(N.current=d.isPropagationStopped(),N.current||d.stopPropagation())})}),C&&e.jsx(re,{control:m,bubbles:!N.current,name:l,value:n,checked:u,required:p,disabled:s,form:o,style:{transform:"translateX(-100%)"},defaultChecked:h(i)?!1:i})]})});S.displayName=v;var A="CheckboxIndicator",I=c.forwardRef((t,r)=>{const{__scopeCheckbox:a,forceMount:l,...x}=t,i=se(A,a);return e.jsx(U,{present:l||h(i.state)||i.state===!0,children:e.jsx(E.span,{"data-state":H(i.state),"data-disabled":i.disabled?"":void 0,...x,ref:r,style:{pointerEvents:"none",...t.style}})})});I.displayName=A;var re=t=>{const{control:r,checked:a,bubbles:l=!0,defaultChecked:x,...i}=t,p=c.useRef(null),s=$(a),n=q(r);c.useEffect(()=>{const o=p.current,y=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(y,"checked").set;if(s!==a&&g){const k=new Event("click",{bubbles:l});o.indeterminate=h(a),g.call(o,h(a)?!1:a),o.dispatchEvent(k)}},[s,a,l]);const b=c.useRef(h(a)?!1:a);return e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:x??b.current,...i,tabIndex:-1,ref:p,style:{...t.style,...n,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function h(t){return t==="indeterminate"}function H(t){return h(t)?"indeterminate":t?"checked":"unchecked"}var z=S,ae=I;const B=c.forwardRef(({className:t,...r},a)=>e.jsx(z,{ref:a,className:P("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...r,children:e.jsx(ae,{className:P("flex items-center justify-center text-current"),children:e.jsx(_,{className:"h-4 w-4"})})}));B.displayName=z.displayName;function je({jadwal:t}){const[r,a]=c.useState(t.pelatihan.pesertas),l=s=>{a(r.map(n=>n.id===s?{...n,hadir:!n.hadir}:n))};c.useEffect(()=>{for(let s=0;s<t.pelatihan.pesertas.length;s++){const n=t.pelatihan.pesertas[s];t.absen_pesertas.find(o=>o.peserta_id==n.peserta.id&&o.hadir==!0)&&(n.hadir=!0,r.map(o=>o.id===n.id?{...n,hadir:!0}:o))}a(r)},[]);const x=()=>{K.post(route("admin.pelatihan.simpan-absensi",{pelatihan_jadwal_id:t.id}),{absensi:r.map(s=>({id:s.peserta.id,hadir:s.hadir}))})},i=r.filter(s=>s.hadir).length,p=L().props.auth.user;return e.jsxs(F,{user:p,header:e.jsxs("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:["Absensi Peserta Pelatihan : ",t.pelatihan.title]}),children:[e.jsx(X,{title:`Absensi Pelatihan ${t.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 : ",t.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:[t.name," / ",t.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: ",i," / ",r.length]}),e.jsxs("a",{href:`${route("admin.pelatihan.absensi.print",t.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(Q,{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:r.map((s,n)=>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:n+1}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"text-sm font-medium text-card-foreground",children:s.peserta.nama_lengkap})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap no-print",children:e.jsx(B,{checked:s.hadir,onCheckedChange:()=>l(s.id)})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"flex items-center",children:s.hadir?e.jsxs("span",{className:"flex items-center text-green-600 font-medium",children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),"Hadir"]}):e.jsxs("span",{className:"flex items-center text-destructive font-medium",children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),"Tidak Hadir"]})})})]},s.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: ",r.length," | Hadir: ",i," | Absent: ",r.length-i]}),e.jsxs(G,{variant:"outline",onClick:x,className:"no-print",children:[e.jsx(_,{className:"w-4 h-4 text-green-500"})," Simpan"]})]})]})]})}export{je as default};
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]