๐ File Manager
๐
/
/
home
/
u449181296
/
domains
/
birulogi.smakpbaleendah.sch.id
/
public_html
/
lms
/
tukang-ngatur
/
assets
/
img
/
qr-logos
/home/u449181296/domains/birulogi.smakpbaleendah.sch.id/public_html/lms/tukang-ngatur/assets/img/qr-logos
Upload
Name
Size
Date
CHMOD
Action
โ FILE โ
logo_1773801405.php
6.73 KB
2026-03-18 02:36
644
(rw-r--r--)
Edit
|
Rename
|
Preview
|
Del
Edit
import{r,j as e}from"./react-vendor-Cdu9POhR.js";import{t as q,d as _,p as F}from"./index-g-CJvtxD.js";import{o as M,f as K,s as Q,j as U}from"./firebase-vendor-Cr1os6Vr.js";import"./pdf-vendor-BoEiDn9A.js";import"./router-vendor-EW88JuZe.js";const J=["Hadir","Terlambat","Tidak Hadir"],V=()=>{const d=new Date;return new Date(d.getTime()-d.getTimezoneOffset()*6e4).toISOString().split("T")[0]},Y=d=>new Date(`${d}T12:00:00`),B=d=>d?Y(d).toLocaleDateString("id-ID",{weekday:"long",day:"numeric",month:"long",year:"numeric"}):"-",X=d=>{const p=Y(d),I=p.getDay(),x=I===0?-6:1-I,g=new Date(p);g.setDate(p.getDate()+x);const u=new Date(g);u.setDate(g.getDate()+6);const T=n=>new Date(n.getTime()-n.getTimezoneOffset()*6e4).toISOString().split("T")[0];return{start:T(g),end:T(u)}},v=d=>d.slice(0,7),z=d=>d==="Hadir"?"bg-emerald-600 text-white border-emerald-600":d==="Terlambat"?"bg-amber-500 text-white border-amber-500":"bg-rose-600 text-white border-rose-600",W=d=>d==="Hadir"?"bg-emerald-50 text-emerald-700 border-emerald-200":d==="Terlambat"?"bg-amber-50 text-amber-700 border-amber-200":"bg-rose-50 text-rose-700 border-rose-200",le=({teacher:d})=>{const[p,I]=r.useState([]),[x,g]=r.useState({picTeacherIds:[],schedules:[]}),[u,T]=r.useState([]),[n,A]=r.useState(V()),[j,P]=r.useState(""),[k,H]=r.useState({}),[O,E]=r.useState(""),[S,$]=r.useState(!1);r.useEffect(()=>{const a=M(q,l=>{I(l.docs.map(i=>({id:i.id,...i.data()})).sort((i,h)=>i.name.localeCompare(h.name)))}),t=M(K(_,"piket_5s_settings","default"),l=>{l.exists()?g({id:l.id,...l.data()}):g({picTeacherIds:[],schedules:[]})}),s=M(F,l=>{T(l.docs.map(i=>({id:i.id,...i.data()})).sort((i,h)=>h.date.localeCompare(i.date)))});return()=>{a(),t(),s()}},[]);const D=r.useMemo(()=>x.picTeacherIds.map(a=>p.find(t=>t.id===a)||null).filter(Boolean),[x.picTeacherIds,p]),m=r.useMemo(()=>x.schedules.find(a=>a.date===n)||null,[x.schedules,n]),b=r.useMemo(()=>m?m.teacherIds.map((a,t)=>{var l;const s=p.find(i=>i.id===a);return{teacherId:a,teacherName:(s==null?void 0:s.name)||((l=m.teacherNames)==null?void 0:l[t])||`Guru ${t+1}`}}):[],[m,p]),c=r.useMemo(()=>u.find(a=>a.date===n)||null,[u,n]);r.useEffect(()=>{const a={};b.forEach(t=>{var l;const s=(l=c==null?void 0:c.attendance)==null?void 0:l[t.teacherId];a[t.teacherId]={teacherId:t.teacherId,teacherName:t.teacherName,status:(s==null?void 0:s.status)||"Hadir",note:(s==null?void 0:s.note)||""}}),H(a),E((c==null?void 0:c.notes)||"")},[n,b,c]),r.useEffect(()=>{if(c!=null&&c.picTeacherId&&x.picTeacherIds.includes(c.picTeacherId)){P(c.picTeacherId);return}j&&x.picTeacherIds.includes(j)||P(x.picTeacherIds[0]||"")},[c,x.picTeacherIds,j]);const f=r.useMemo(()=>D.find(a=>a.id===j)||null,[D,j]),o=r.useMemo(()=>{const a=Object.values(k);return{total:a.length,hadir:a.filter(t=>t.status==="Hadir").length,terlambat:a.filter(t=>t.status==="Terlambat").length,tidakHadir:a.filter(t=>t.status==="Tidak Hadir").length}},[k]),w=r.useMemo(()=>X(n),[n]),C=r.useMemo(()=>u.filter(a=>a.date>=w.start&&a.date<=w.end),[u,w]),N=r.useMemo(()=>u.filter(a=>v(a.date)===v(n)),[u,n]),y=r.useMemo(()=>x.schedules.filter(a=>v(a.date)===v(n)),[x.schedules,n]),L=r.useMemo(()=>{const a=[];return x.picTeacherIds.length||a.push("Role manajemen belum memilih PIC 5S yang bisa mengisi portal ini."),m||a.push("Tanggal yang dipilih belum dijadwalkan sebagai piket 5S."),m&&!c&&a.push("Jadwal hari ini sudah aktif, tetapi laporan 5S belum disimpan."),o.terlambat>0&&a.push(`${o.terlambat} guru terlambat dan perlu tindak lanjut.`),o.tidakHadir>0&&a.push(`${o.tidakHadir} guru tidak hadir dan perlu koordinasi pengganti.`),y.length>N.length&&a.push(`Masih ada ${y.length-N.length} jadwal 5S bulan ini yang belum memiliki laporan.`),a},[x.picTeacherIds.length,m,c,o,y.length,N.length]),R=async()=>{if(!m){alert("Tanggal yang dipilih belum dijadwalkan pada setting Piket 5S.");return}if(!f){alert("Pilih nama PIC 5S terlebih dahulu.");return}if(!b.length){alert("Belum ada guru yang dijadwalkan untuk tanggal ini.");return}$(!0);try{const a=b.reduce((t,s)=>{var l,i,h;return t[s.teacherId]={teacherId:s.teacherId,teacherName:s.teacherName,status:((l=k[s.teacherId])==null?void 0:l.status)||"Hadir",note:((h=(i=k[s.teacherId])==null?void 0:i.note)==null?void 0:h.trim())||""},t},{});await Q(K(_,"piket_5s_reports",n),{date:n,picTeacherId:f.id,picTeacherName:f.name,scheduledTeacherIds:b.map(t=>t.teacherId),scheduledTeacherNames:b.map(t=>t.teacherName),attendance:a,notes:O.trim(),createdByPortal:"pic_5s_shared",updatedAt:U()},{merge:!0}),alert("Laporan PIC 5S berhasil disimpan.")}catch(a){console.error(a),alert("Gagal menyimpan laporan PIC 5S.")}finally{$(!1)}};return e.jsxs("div",{className:"max-w-7xl mx-auto space-y-8 animate-fade-in pb-20 px-4",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row justify-between items-start xl:items-center gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-violet-50 border border-violet-100 text-violet-700 text-[10px] font-black uppercase tracking-[0.3em]",children:"Portal PIC 5S"}),e.jsx("h1",{className:"text-4xl font-black text-slate-800 tracking-tight mt-4",children:"Dashboard PIC 5S"})]}),e.jsxs("div",{className:"bg-white border border-slate-100 shadow-xl rounded-[2rem] px-6 py-5 min-w-[280px]",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Akun Aktif"}),e.jsx("p",{className:"text-lg font-black text-slate-800 mt-2",children:d.name}),e.jsx("p",{className:"text-xs font-bold text-violet-600 mt-1",children:B(n)})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-8",children:[e.jsx("div",{className:"xl:col-span-4",children:e.jsxs("div",{className:"bg-slate-900 text-white p-8 rounded-[2.5rem] shadow-xl sticky top-24 space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-black uppercase tracking-widest text-violet-300",children:"Kontrol PIC 5S"}),e.jsx("p",{className:"text-sm text-slate-300 font-medium mt-2",children:"Pilih tanggal kerja, tentukan PIC yang bertugas, cek kehadiran guru 5S, lalu simpan laporan harian."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 ml-1",children:"Tanggal Piket 5S"}),e.jsx("input",{type:"date",value:n,onChange:a=>A(a.target.value),className:"w-full px-5 py-4 rounded-2xl bg-slate-800 text-sm font-bold text-white"}),e.jsxs("div",{className:"px-4 py-3 rounded-2xl bg-white/5 border border-white/10 text-xs font-bold text-slate-200",children:["Status jadwal: ",e.jsx("span",{className:m?"text-emerald-300":"text-amber-300",children:m?"Aktif & siap diisi":"Belum dijadwalkan"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 ml-1",children:"Nama PIC 5S"}),e.jsxs("select",{value:j,onChange:a=>P(a.target.value),className:"w-full px-5 py-4 rounded-2xl bg-slate-800 text-sm font-bold text-white",children:[e.jsx("option",{value:"",children:"Pilih PIC dari setting manajemen"}),D.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]}),e.jsx("p",{className:"text-[11px] font-bold text-slate-400",children:"Daftar PIC otomatis membaca data dari panel setting Piket 5S di role manajemen."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase text-slate-400 tracking-widest",children:"Guru Bertugas"}),e.jsx("p",{className:"text-2xl font-black text-white mt-2",children:o.total})]}),e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase text-slate-400 tracking-widest",children:"Laporan Bulan Ini"}),e.jsx("p",{className:"text-2xl font-black text-violet-300 mt-2",children:N.length})]}),e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase text-slate-400 tracking-widest",children:"Terlambat"}),e.jsx("p",{className:"text-2xl font-black text-amber-300 mt-2",children:o.terlambat})]}),e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase text-slate-400 tracking-widest",children:"Tidak Hadir"}),e.jsx("p",{className:"text-2xl font-black text-rose-300 mt-2",children:o.tidakHadir})]})]}),e.jsx("button",{onClick:R,disabled:S||!m||!b.length,className:"w-full py-4 bg-violet-600 rounded-2xl font-black text-xs uppercase tracking-widest disabled:opacity-50",children:S?"Menyimpan...":"Simpan Laporan PIC 5S"})]})}),e.jsxs("div",{className:"xl:col-span-8 space-y-8",children:[e.jsxs("div",{className:"bg-white rounded-[2.5rem] shadow-xl border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"p-8 border-b border-slate-100 bg-slate-50/70 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-[0.2em]",children:"Laporan Kegiatan PIC 5S"}),e.jsx("h2",{className:"text-2xl font-black text-slate-800 mt-2",children:B(n)}),e.jsx("p",{className:"text-sm font-medium text-slate-500 mt-1",children:"Nama guru bertugas otomatis mengikuti jadwal yang diisi oleh manajemen."})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(a=>e.jsx("span",{className:`px-4 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest border ${W(a)}`,children:a},a))})]}),m?b.length?e.jsxs("div",{className:"p-8 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-slate-50 rounded-[2rem] p-5 border border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"PIC Aktif"}),e.jsx("p",{className:"mt-2 text-lg font-black text-violet-600",children:(f==null?void 0:f.name)||"Belum dipilih"})]}),e.jsxs("div",{className:"bg-slate-50 rounded-[2rem] p-5 border border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Guru Hadir"}),e.jsx("p",{className:"mt-2 text-lg font-black text-emerald-600",children:o.hadir})]}),e.jsxs("div",{className:"bg-slate-50 rounded-[2rem] p-5 border border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Guru Terlambat"}),e.jsx("p",{className:"mt-2 text-lg font-black text-amber-600",children:o.terlambat})]}),e.jsxs("div",{className:"bg-slate-50 rounded-[2rem] p-5 border border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Guru Tidak Hadir"}),e.jsx("p",{className:"mt-2 text-lg font-black text-rose-600",children:o.tidakHadir})]})]}),e.jsx("div",{className:"overflow-x-auto rounded-[1.8rem] border border-slate-100 bg-slate-50",children:e.jsxs("table",{className:"w-full min-w-[980px] text-left",children:[e.jsx("thead",{className:"bg-white text-[10px] font-black uppercase tracking-widest text-slate-400 border-b border-slate-100",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-4",children:"No"}),e.jsx("th",{className:"px-4 py-4",children:"Nama Guru Piket 5S"}),e.jsx("th",{className:"px-4 py-4",children:"Status"}),e.jsx("th",{className:"px-4 py-4",children:"Ceklis Kehadiran"}),e.jsx("th",{className:"px-4 py-4",children:"Keterangan"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100 bg-white",children:b.map((a,t)=>{const s=k[a.teacherId]||{teacherId:a.teacherId,teacherName:a.teacherName,status:"Hadir",note:""};return e.jsxs("tr",{className:"align-top hover:bg-slate-50",children:[e.jsx("td",{className:"px-4 py-4 text-sm font-black text-slate-500",children:t+1}),e.jsxs("td",{className:"px-4 py-4",children:[e.jsx("p",{className:"text-sm font-black text-slate-800",children:a.teacherName}),e.jsx("p",{className:"mt-1 text-[11px] font-bold text-slate-400",children:"Jadwal otomatis dari role manajemen."})]}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("span",{className:`inline-flex px-3 py-1.5 rounded-xl text-[10px] font-black uppercase tracking-widest border ${z(s.status)}`,children:s.status})}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("div",{className:"flex flex-wrap gap-2 max-w-[380px]",children:J.map(l=>{const i=s.status===l;return e.jsx("button",{type:"button",onClick:()=>H(h=>{var G;return{...h,[a.teacherId]:{teacherId:a.teacherId,teacherName:a.teacherName,status:l,note:((G=h[a.teacherId])==null?void 0:G.note)||""}}}),className:`px-3 py-2 rounded-xl text-[10px] font-black uppercase tracking-widest border transition-all ${i?z(l):W(l)}`,children:l},l)})})}),e.jsx("td",{className:"px-4 py-4",children:e.jsx("input",{type:"text",value:s.note||"",onChange:l=>H(i=>{var h;return{...i,[a.teacherId]:{teacherId:a.teacherId,teacherName:a.teacherName,status:((h=i[a.teacherId])==null?void 0:h.status)||"Hadir",note:l.target.value}}}),placeholder:"Contoh: hadir 06.50, terlambat 10 menit, izin mendadak.",className:"w-full px-4 py-3 rounded-2xl bg-slate-50 border border-slate-100 font-bold text-sm text-slate-700"})})]},a.teacherId)})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Catatan Kegiatan"}),e.jsx("textarea",{value:O,onChange:a=>E(a.target.value),placeholder:"Tuliskan kegiatan 5S hari ini, kendala lapangan, tindak lanjut, atau hal penting yang perlu dipantau kurikulum.",className:"mt-3 w-full min-h-[220px] px-6 py-5 rounded-[2rem] bg-slate-50 border border-slate-100 font-medium text-sm text-slate-700 leading-relaxed"})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:R,disabled:S,className:"px-8 py-4 bg-violet-600 text-white rounded-2xl font-black text-xs uppercase tracking-widest disabled:opacity-50",children:S?"Menyimpan...":"Simpan Laporan"})})]}):e.jsx("div",{className:"py-24 text-center text-slate-400 font-bold",children:"Belum ada guru yang dijadwalkan untuk tanggal ini."}):e.jsx("div",{className:"p-10",children:e.jsxs("div",{className:"rounded-[2rem] border border-amber-200 bg-amber-50 p-6",children:[e.jsx("p",{className:"text-sm font-black text-amber-700",children:"Tanggal ini belum aktif pada setting Piket 5S."}),e.jsx("p",{className:"mt-2 text-sm font-medium text-amber-700/90",children:"Buka panel manajemen untuk menambahkan jadwal agar guru yang piket otomatis muncul di dashboard PIC 5S."})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 shadow-xl p-6",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Rekap Harian"}),e.jsx("h3",{className:"mt-2 text-xl font-black text-slate-800",children:B(n)}),e.jsxs("div",{className:"mt-5 space-y-3 text-sm font-bold text-slate-600",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Jadwal aktif"}),e.jsx("span",{className:"text-slate-800",children:m?"Ya":"Tidak"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Laporan tersimpan"}),e.jsx("span",{className:"text-slate-800",children:c?"Sudah":"Belum"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Hadir"}),e.jsx("span",{className:"text-emerald-600",children:o.hadir})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Terlambat"}),e.jsx("span",{className:"text-amber-600",children:o.terlambat})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Tidak hadir"}),e.jsx("span",{className:"text-rose-600",children:o.tidakHadir})]})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 shadow-xl p-6",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Rekap Mingguan"}),e.jsxs("h3",{className:"mt-2 text-xl font-black text-slate-800",children:[w.start," s/d ",w.end]}),e.jsxs("div",{className:"mt-5 space-y-3 text-sm font-bold text-slate-600",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Jumlah laporan"}),e.jsx("span",{className:"text-slate-800",children:C.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Hadir tercatat"}),e.jsx("span",{className:"text-emerald-600",children:C.reduce((a,t)=>a+Object.values(t.attendance||{}).filter(s=>s.status==="Hadir").length,0)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Terlambat"}),e.jsx("span",{className:"text-amber-600",children:C.reduce((a,t)=>a+Object.values(t.attendance||{}).filter(s=>s.status==="Terlambat").length,0)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Tidak hadir"}),e.jsx("span",{className:"text-rose-600",children:C.reduce((a,t)=>a+Object.values(t.attendance||{}).filter(s=>s.status==="Tidak Hadir").length,0)})]})]})]}),e.jsxs("div",{className:"bg-white rounded-[2rem] border border-slate-100 shadow-xl p-6",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Rekap Bulanan"}),e.jsx("h3",{className:"mt-2 text-xl font-black text-slate-800",children:v(n)}),e.jsxs("div",{className:"mt-5 space-y-3 text-sm font-bold text-slate-600",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Jadwal bulan ini"}),e.jsx("span",{className:"text-slate-800",children:y.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Laporan masuk"}),e.jsx("span",{className:"text-violet-600",children:N.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Belum terisi"}),e.jsx("span",{className:"text-amber-600",children:Math.max(y.length-N.length,0)})]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-[2.5rem] border border-slate-100 shadow-xl p-8",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Aksi yang Perlu Dilakukan"}),e.jsx("h3",{className:"mt-2 text-2xl font-black text-slate-800",children:"Ringkasan tindak lanjut realtime"}),e.jsx("div",{className:"mt-6 space-y-3",children:L.length?L.map((a,t)=>e.jsx("div",{className:"rounded-2xl border border-slate-100 bg-slate-50 px-5 py-4 text-sm font-bold text-slate-700",children:a},`${a}-${t}`)):e.jsx("div",{className:"rounded-2xl border border-emerald-100 bg-emerald-50 px-5 py-4 text-sm font-black text-emerald-700",children:"Semua indikator PIC 5S pada periode ini sudah aman dan tidak ada tindak lanjut mendesak."})})]})]})]})]})};export{le as default};
Save
๐งช PHP Preview
<?php echo 'hello'; ?>
Run PHP
๐ฅ Linux CMD
Run CMD