1import{e as ae,o,c as n,F as N,r as $,l as m,t as i,s as T,f as ie,h as de,g as ue,i as Z,j as ce,a as s,k as a,d as f,x as S,n as b,y as pe,p as I,A as g,q as d,b as xe,E as me,_ as fe}from"./BnI3597d.js";import{u as be}from"./4bw899IF.js";const he={class:"flex flex-col items-center justify-center bg-white p-2"},ve=["width","height","viewBox"],ge=["x","width","height"],_e={key:1,class:"mt-1 font-mono text-[10px] tracking-widest text-slate-800 font-bold uppercase"},ke=ae({__name:"BarcodeSvg",props:{value:{},height:{default:50},factor:{default:1.5},showText:{type:Boolean,default:!0}},setup(ee){const c=ee,M="212222222122222221121223121322131222122213122312132212221213221312231212112232122132122231113222123122123221223211221132221231213212223112312131311222321122321221312212322112322211212123212321232121111323131123131321112313132113132311211313231113231311112133112331132131113123113321133121313121211331231131213113213311213131311123311321331121312113312311332111314111221411431111111224111422121124121421141122141221112214112412122114122411142112142211241211221114413111241112134111111242121142121241114212124112124211411212421112421211212141214121412121111143111341131141114113114311411113411311113141114131311141411131".split(/(\d{6})/).filter(Boolean),B={};for(let u=32;u<127;u++)B[String.fromCharCode(u)]=[u-32,M[u-32]||""];const D=T(()=>{const u=c.value||"";let j=10*c.factor,_=104;const k=[];function V(x){x.split("").forEach((K,p)=>{const U=parseInt(K,10);p%2===0&&k.push({x:j,width:U*c.factor}),j+=U*c.factor})}V("211214");for(let x=0;x<u.length;x++){const K=u[x]||"",p=B[K]||[0,""];_+=p[0]*(x+1),V(p[1])}return V(M[_%103]||""),V("23311129"),{rects:k,width:j+c.factor}});return(u,j)=>(o(),n("div",he,[c.value?(o(),n("svg",{key:0,width:D.value.width,height:c.height,viewBox:`0 0 ${D.value.width} ${c.height}`,xmlns:"http://www.w3.org/2000/svg",class:"fill-black"},[(o(!0),n(N,null,$(D.value.rects,(_,k)=>(o(),n("rect",{key:k,x:_.x,y:"0",width:_.width,height:c.height},null,8,ge))),128))],8,ve)):m("",!0),c.value&&c.showText?(o(),n("div",_e,i(c.value),1)):m("",!0)]))}}),ye=Object.assign(ke,{__name:"BarcodeSvg"}),we={class:"space-y-6"},Se={class:"card no-print"},Ie={class:"flex flex-wrap items-center justify-between gap-4"},Ce={class:"flex items-center gap-3"},Ne=["disabled"],$e={key:0,class:"text-sm text-red-600 no-print"},Be={key:1,class:"grid grid-cols-1 gap-6 lg:grid-cols-4 items-start"},je={class:"lg:col-span-1 space-y-6 no-print"},Ve={class:"card space-y-4"},Ke={class:"flex flex-col gap-1.5"},Ue={class:"grid grid-cols-2 gap-1 rounded-xl bg-slate-100 p-1 dark:bg-slate-800"},Ae={key:0,class:"flex flex-col gap-1.5 border-t border-slate-100 pt-3 dark:border-slate-800"},Ee=["value"],Te={class:"border-t border-slate-100 pt-3 dark:border-slate-800"},De={class:"flex items-center justify-between pb-2"},Pe={class:"text-xs font-bold text-slate-500"},qe={key:0,class:"flex items-center gap-1.5 text-xs font-semibold text-primary-600 cursor-pointer select-none"},Le={key:0,class:"max-h-60 overflow-y-auto space-y-2 pr-1 custom-scrollbar"},Me=["onUpdate:modelValue","disabled"],Fe={class:"min-w-0 flex-1"},Re={class:"font-medium text-slate-800 dark:text-slate-200 truncate"},Je={class:"text-[10px] text-slate-400 font-mono truncate"},Oe={key:1,class:"max-h-60 overflow-y-auto space-y-2 pr-1 custom-scrollbar"},Ge=["onUpdate:modelValue","disabled"],We={class:"min-w-0 flex-1"},ze={class:"font-medium text-slate-800 dark:text-slate-200 truncate"},He={class:"text-[10px] text-slate-400 font-mono truncate"},Qe={class:"card space-y-4"},Xe={class:"flex flex-col gap-1.5"},Ye={class:"grid grid-cols-3 gap-1 rounded-xl bg-slate-100 p-1 dark:bg-slate-800"},Ze=["onClick"],et={class:"flex flex-col gap-1.5"},tt={class:"grid grid-cols-3 gap-1 rounded-xl bg-slate-100 p-1 dark:bg-slate-800"},st=["onClick"],at={class:"border-t border-slate-100 pt-3 dark:border-slate-800 space-y-2.5"},lt={class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},ot={class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},nt={class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},rt={class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},it={key:0,class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},dt={class:"flex items-center gap-2 text-xs font-medium text-slate-700 dark:text-slate-300 cursor-pointer select-none"},ut={class:"lg:col-span-3 space-y-6"},ct={key:0,class:"rounded-xl border border-amber-100 bg-amber-50/70 p-4 text-xs text-amber-800 dark:border-amber-900/30 dark:bg-amber-950/20 dark:text-amber-300 no-print flex flex-col gap-1.5"},pt={class:"font-bold"},xt={class:"font-semibold"},mt={key:1,class:"card text-center py-16 no-print text-slate-400"},ft={key:2,class:"print-container"},bt={class:"w-full flex items-start justify-between gap-2 border-b border-dashed border-slate-200 pb-1.5 mb-1.5"},ht={class:"text-left min-w-0"},vt={key:0,class:"text-[9px] font-black uppercase text-slate-500 tracking-wider truncate"},gt={key:1,class:"text-[8px] font-bold text-primary-600 bg-primary-50 dark:bg-slate-800 rounded px-1.5 py-0.5 inline-block truncate mt-0.5 max-w-full"},_t={key:0,class:"shrink-0 w-8 h-8 rounded-full overflow-hidden border border-slate-200 bg-slate-50"},kt=["src","onError"],yt={class:"w-full text-center flex-1 flex flex-col justify-center"},wt={key:0,class:"font-extrabold text-slate-800 text-xs sm:text-sm line-clamp-1 leading-tight"},St={key:1,class:"text-[9px] text-slate-500 font-mono font-medium mt
1-0.5"},It={class:"w-full flex justify-center mt-2"},Ct=ae({__name:"barcode",setup(ee){const{token:c,user:M,apiFetch:B,fetchMe:D}=ie(),{activeSchoolId:u,activeSchoolName:j}=be(),_=de(),k=ue(),V=me(),x=d([]),K=d([]),p=d([]),U=d(!0),P=d(""),r=d("siswa"),h=d(""),A=d({}),E=d({}),z=d({}),v=d("medium"),q=d(3),F=d(!0),R=d(!0),J=d(!0),O=d(!0),L=d(!1),G=d(!0),le=T(()=>x.value.find(l=>l.id===h.value)),y=T(()=>h.value?K.value.filter(l=>l.class_id===h.value):[]),W=T(()=>r.value==="siswa"?y.value.filter(l=>!!l.attendance_external_id&&A.value[l.id]).map(l=>({id:l.id,name:l.full_name,codeLabel:"NISN",code:l.nisn,subtitle:`Kelas: ${l.class_name||le.value?.name||"-"}`,barcode:l.attendance_external_id,photo:L.value&&!z.value[l.id]?`${V.public.apiBaseUrl}/studentphoto/${u.value}/${l.nisn}.jpg`:null})):p.value.filter(l=>!!l.attendance_external_id&&E.value[l.id]).map(l=>({id:l.id,name:l.full_name,codeLabel:"NIP/NIK",code:l.employee_code,subtitle:`Jabatan: ${l.job_position_name||(l.employee_type==="guru"?"Guru":"Staf")}`,barcode:l.attendance_external_id,photo:null}))),H=T(()=>r.value==="siswa"?y.value.filter(l=>!l.attendance_external_id):p.value.filter(l=>!l.attendance_external_id));async function te(){U.value=!0,P.value="";try{const[l,e,C]=await Promise.all([B(`/schools/${u.value}/students`),B(`/schools/${u.value}/classes`),B(`/schools/${u.value}/employees`)]);K.value=l.students,x.value=e.classes,p.value=C.employees;const t=k.query.classId,w=k.query.studentId,Y=k.query.type;(Y==="pegawai"||Y==="siswa")&&(r.value=Y),t&&x.value.some(re=>re.id===t)?(h.value=t,r.value="siswa"):x.value.length>0&&(h.value=x.value[0].id),Q(w),se()}catch(l){P.value="Gagal memuat data pencetakan barcode.",console.error(l)}finally{U.value=!1}}function Q(l){const e={};y.value.forEach(C=>{l?e[C.id]=C.id===l:e[C.id]=!0}),A.value=e}function se(){const l={};p.value.forEach(e=>{l[e.id]=!0}),E.value=l}Z(h,()=>{Q()}),Z(r,()=>{r.value==="siswa"?Q():se()});const X=T({get:()=>{if(r.value==="siswa"){const l=y.value.filter(e=>!!e.attendance_external_id);return l.length===0?!1:l.every(e=>A.value[e.id])}else{const l=p.value.filter(e=>!!e.attendance_external_id);return l.length===0?!1:l.every(e=>E.value[e.id])}},set:l=>{r.value==="siswa"?y.value.forEach(e=>{e.attendance_external_id&&(A.value[e.id]=l)}):p.value.forEach(e=>{e.attendance_external_id&&(E.value[e.id]=l)})}});function oe(l){z.value[l]=!0}function ne(){window.print()}return Z(u,()=>{te()}),ce(async()=>{if(!c.value)return _.push("/login");try{M.value||await D(),await te()}catch{P.value="Terjadi kesalahan otentikasi."}}),(l,e)=>{const C=ye;return o(),n("div",we,[s("div",Se,[s("div",Ie,[e[12]||(e[12]=s("div",null,[s("h1",{class:"text-xl font-bold text-slate-900 dark:text-slate-50"},"Cetak Barcode Kartu Absensi"),s("p",{class:"mt-1 text-sm text-slate-500 dark:text-slate-400"}," Cetak kartu barcode absensi berdasarkan ID Absensi untuk ditempelkan di kartu fisik. ")],-1)),s("div",Ce,[s("button",{type:"button",onClick:e[0]||(e[0]=t=>a(_).back()),class:"rounded-xl border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 transition-all hover:bg-slate-50 active:scale-95 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"}," â Kembali "),s("button",{type:"button",class:"btn-primary btn-shine flex items-center gap-2 text-sm",disabled:a(W).length===0,onClick:ne},[e[11]||(e[11]=s("span",null,"ð¨ï¸",-1)),f(" Cetak Sekarang ("+i(a(W).length)+") ",1)],8,Ne)])])]),a(P)?(o(),n("p",$e,i(a(P)),1)):m("",!0),a(U)?m("",!0):(o(),n("div",Be,[s("div",je,[s("div",Ve,[e[16]||(e[16]=s("h3",{class:"text-xs font-bold uppercase tracking-wider text-slate-400"},"Pilih Tipe & Anggota",-1)),s("div",Ke,[e[13]||(e[13]=s("label",{class:"text-xs font-semibold text-slate-500"},"Tipe Anggota",-1)),s("div",Ue,[s("button",{type:"button",class:S(["rounded-lg py-1.5 text-xs font-medium transition-all",a(r)==="siswa"?"bg-white text-slate-900 shadow-sm dark:bg-slate-700 dark:text-white":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"]),onClick:e[1]||(e[1]=t=>r.value="siswa")}," Siswa ",2),s("button",{type:"button",class:S(["rounded-lg py-1.5 text-xs font-medium transition-all",a(r)==="pegawai"?"bg-white text-slate-900 shadow-sm dark:bg-slate-700 dark:text-white":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"]),onClick:e[2]||(e[2]=t=>r.value="pegawai")}," Pegawai ",2)])]),a(r)==="siswa"?(o(),n("div",Ae,[e[14]||(e[14]=s("label",{class:"text-xs font-semibold text-slate-500"},"Kelas",-1)),b(s("select",{"onUpdate:modelValue":e[3]||(e[3]=t=>I(h)?h.value=t:null),class:"w-full rounded-xl border border-slate-300 px-3 py-2 text-sm dark:border-slate-700 dark:bg-slate-800"},[(o(!0),n(N,null,$(a(x),t=>(o(),n("option",{key:t.id,value:t.id},i(t.name),9,Ee))),128))],512),[[pe,a(h)]])])):m("",!0),s("div",Te,[s("div",De,[s("span",Pe," Daftar "+i(a(r)==="siswa"?"Siswa":"Pegawai")+" ("+i(a(r)==="siswa"?a(y).length:a(p).length)+") ",1),(a(r)==="siswa"?a(y).some(t=>t.attendance_external_id):a(p).some(t=>t.attendance_external_id))?(o(),n("label",qe,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=t=>I(X)?X.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-3.5 w-3.5"},null,512),[[g,a(X)]]),e[15]||(e[15]=f(" Semua ",-1))])):m("",!0)]),a(r)==="siswa"?(o(),n("div",Le,[(o(!0),n(N,null,$(a(y),t=>(o(),n("label",{key:t.id,class:S(["flex items-start gap-2.5 rounded-lg p-1.5 text-xs transition-colors hover:bg-slate-50 dark:hover:bg-slate-800/50 cursor-pointer",t.attendance_external_id?"":"opacity-50"])},[b(s("input",{type:"checkbox","onUpdate:modelValue":w=>a(A)[t.id]=w,disabled:!t.attendance_external_id,class:"mt-0.5 rounded text-primary-600 focus:ring-primary-400 h-3.5 w-3.5"},null,8,Me),[[g,a(A)[t.id]]]),s("div",Fe,[s("div",Re,i(t.full_name),1),s("div",Je," ID: "+i(t.attendance_external_id||"Belum diset"),1)])],2))),128))])):(o(),n("div",Oe,[(o(!0),n(N,null,$(a(p),t=>(o(),n("label",{key:t.id,class:S(["flex items-start gap-2.5 rounded-lg p-1.5 text-xs transition-colors hover:bg-slate-50 dark:hover:bg-slate-800/50 cursor-pointer",t.attendance_external_id?"":"opacity-50"])},[b(s("input",{type:"checkbox","onUpdate:modelValue":w=>a(E)[t.id]=w,disabled:!t.attendance_external_id,class:"mt-0.5 rounded text-primary-600 focus:ring-primary-400 h-3.5 w-3.5"},null,8,Ge),[[g,a(E)[t.id]]]),s("div",We,[s("div",ze,i(t.full_name),1),s("div",He," ID: "+i(t.attendance_external_id||"Belum diset"),1)])],2))),128))]))])]),s("div",Qe,[e[24]||(e[24]=s("h3",{class:"text-xs font-bold uppercase tracking-wider text-slate-400"},"Pengaturan Kartu",-1)),s("div",Xe,[e[17]||(e[17]=s("label",{class:"text-xs font-semibold text-slate-500"},"Ukuran Kartu",-1)),s("div",Ye,[(o(),n(N,null,$(["small","medium","large"],t=>s("button",{key:t,type:"button",class:S(["rounded-lg py-1.5 text-xs font-medium capitalize transition-all",a(v)===t?"bg-white text-slate-900 shadow-sm dark:bg-slate-700 dark:text-white":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"]),onClick:w=>v.value=t},i(t==="small"?"Kecil":t==="medium"?"Sedang":"Besar"),11,Ze)),64))])]),s("div",et,[e[18]||(e[18]=s("label",{class:"text-xs font-semibold text-slate-500"},"Jumlah Kolom Kertas",-1)),s("div",tt,[(o(),n(N,null,$([2,3,4],t=>s("button",{key:t,type:"button",class:S(["rounded-lg py-1.5 text-xs font-medium transition-all",a(q)===t?"bg-white text-slate-900 shadow-sm dark:bg-slate-700 dark:text-white":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"]),onClick:w=>q.value=t},i(t)+" Kolom ",11,st)),64))])]),s("div",at,[e[23]||(e[23]=s("span",{class:"text-xs font-bold text-slate-500 block mb-1"},"Tampilkan Info Kartu",-1)),s("label",lt,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[5]||(e[5]=t=>I(F)?F.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(F)]]),e[19]||(e[19]=f(" Nama Sekolah ",-1))]),s("label",ot,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[6]||(e[6]=t=>I(R)?R.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(R)]]),f(" "+i(a(r)==="siswa"?"Kelas":"Jabatan"),1)]),s("label",nt,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[7]||
1(e[7]=t=>I(J)?J.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(J)]]),e[20]||(e[20]=f(" Nama Lengkap ",-1))]),s("label",rt,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[8]||(e[8]=t=>I(O)?O.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(O)]]),f(" "+i(a(r)==="siswa"?"NISN":"NIP/NIK"),1)]),a(r)==="siswa"?(o(),n("label",it,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[9]||(e[9]=t=>I(L)?L.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(L)]]),e[21]||(e[21]=f(" Foto Siswa ",-1))])):m("",!0),s("label",dt,[b(s("input",{type:"checkbox","onUpdate:modelValue":e[10]||(e[10]=t=>I(G)?G.value=t:null),class:"rounded text-primary-600 focus:ring-primary-400 h-4 w-4"},null,512),[[g,a(G)]]),e[22]||(e[22]=f(" Text Kode di Bawah Barcode ",-1))])])])]),s("div",ut,[a(H).length>0?(o(),n("div",ct,[s("div",pt,"â ï¸ Perhatian: Terdapat "+i(a(H).length)+" "+i(a(r)==="siswa"?"siswa":"pegawai")+" yang belum memiliki ID Absensi",1),s("p",null,[e[25]||(e[25]=f(" Nama-nama berikut tidak dapat dicetak barcodenya karena ID Absensi masih kosong: ",-1)),s("span",xt,i(a(H).map(t=>t.full_name).join(", ")),1),e[26]||(e[26]=f(". Silakan lengkapi ID Absensi terlebih dahulu di halaman manajemen masing-masing. ",-1))])])):m("",!0),a(W).length===0?(o(),n("div",mt," ð·_ Pilih setidaknya satu "+i(a(r)==="siswa"?"siswa":"pegawai")+" dengan ID Absensi untuk menampilkan pratinjau barcode. ",1)):(o(),n("div",ft,[s("div",{class:S(["grid gap-4 print:gap-3",{"grid-cols-2":a(q)===2,"grid-cols-3":a(q)===3,"grid-cols-4":a(q)===4}])},[(o(!0),n(N,null,$(a(W),t=>(o(),n("div",{key:t.id,class:S(["relative bg-white border border-slate-300 rounded-2xl p-4 flex flex-col items-center justify-between text-center overflow-hidden shadow-sm transition-all hover:border-primary-300 print:shadow-none print:border-slate-400 print:rounded-lg print:break-inside-avoid",{"min-h-[140px] p-2.5":a(v)==="small","min-h-[180px] p-4":a(v)==="medium","min-h-[220px] p-5.5":a(v)==="large"}])},[s("div",bt,[s("div",ht,[a(F)?(o(),n("div",vt,i(a(j)||"SCHOOLMANTIC"),1)):m("",!0),a(R)?(o(),n("div",gt,i(t.subtitle),1)):m("",!0)]),a(r)==="siswa"&&a(L)&&t.photo&&!a(z)[t.id]?(o(),n("div",_t,[s("img",{src:t.photo,class:"h-full w-full object-cover",onError:w=>oe(t.id)},null,40,kt)])):m("",!0)]),s("div",yt,[a(J)?(o(),n("div",wt,i(t.name),1)):m("",!0),a(O)?(o(),n("div",St,i(t.codeLabel)+": "+i(t.code),1)):m("",!0)]),s("div",It,[xe(C,{value:t.barcode,"show-text":a(G),height:a(v)==="small"?35:a(v)==="medium"?45:55,factor:a(v)==="small"?1:a(v)==="medium"?1.3:1.6},null,8,["value","show-text","height","factor"])])],2))),128))],2)]))])]))])}}}),Bt=fe(Ct,[["__scopeId","data-v-16c418a6"]]);export{Bt 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.