PageSourceSearch

https://abulyatama.ac.id/assets/index-BASWwSQb.js

js abulyatama.ac.id collected 2026-10-02 19:26:47 UTC 47,583 bytes, 26 lines download raw bytes

1import{r as be,e as Q,R as i,t as V,z as N,i as ue,j as e,B,F as ye,k as M,l as D,m as $,o as O,I as me,p as k,L as Ue,s as fe,J as Ua,K as xa,M as La,N as pa,O as Wa,P as Ka,Q as ja,T as Ha,U as Ja,V as qa,W as $a,X as za,Y as Le,d as L,u as We,b as J,y as Ve,A as Me,Z as ga,c as S,_ as Ya,$ as ha,S as Qe,a0 as Ga,a1 as Xa,C as Qa,q as Za,a2 as Ta,a3 as es,a4 as as,a5 as ss}from"./index-IoLqQIKe.js";import{g as rs,a as ls,b as ns,d as cs,e as os,f as ts,h as is,j as ds,u as ms,k as hs}from"./pembayaran-service-CMq05HDv.js";import{P as xs}from"./page-wrapper-oKa-ZJSn.js";import{d as Ke,e as He,D as Je,a as qe,b as $e,f as ze,T as ba,c as Te,C as oe}from"./table-no-data-BTrAMv74.js";import{P as ua}from"./pencil-BFET79NY.js";import{C as ps,S as he,a as xe,b as pe,c as je,d as ge}from"./select-DTnBFM8D.js";import{T as Ne,a as ve,b as R,c as E,d as we,e as y}from"./table-Djv5_X9C.js";import{l as js,f as ya,P as gs,I as bs,i as fa,C as us,a as ys}from"./calendar-B2gwzg0M.js";import{P as te,a as ie,b as de,C as De,c as ke,d as Be,e as Ee,f as Re,g as Oe}from"./popover-D2BHETzM.js";import{A as ea,a as aa,b as sa,c as ra,d as la,e as na,f as ca,g as oa,h as ta}from"./alert-dialog-D7tt56t_.js";import{B as fs}from"./banknote-CpmxeyQU.js";import"./chevron-left-LqDoiO-W.js";/**
2 * @license lucide-react v0.476.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ns=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Na=be("ArrowRight",Ns);/**
7 * @license lucide-react v0.476.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const vs=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],ws=be("Monitor",vs);/**
12 * @license lucide-react v0.476.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const _s=[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]],Ss=be("MoveRight",_s);/**
17 * @license lucide-react v0.476.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Cs=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Ps=be("Repeat",Cs);/**
22 * @license lucide-react v0.476.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const As=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Is=be("School",As);function Vs(){const a=Q(C=>C.setCategory),r=Q(C=>C.category),[n,o]=i.useState(),[s,d]=i.useState([]),[p,x]=i.useState([]),[b,g]=i.useState(!1),[c,f]=i.useState(!1),[j,l]=i.useState(!1),[u,A]=i.useState(!1),[F,_]=i.useState(!1),[w,W]=i.useState(0),[q,H]=i.useState(!1),[Y,G]=i.useState(0),[X,K]=i.useState(!1),[Z,re]=i.useState(0),[Se,le]=i.useState(!1),[ne,Ce]=i.useState(0),[Pe,t]=i.useState(!1),v=i.useCallback(async C=>{try{g(!0);const m=await rs(C),P=m==null?void 0:m.data;o(P);const Fa=r.map(Xe=>Xe.category_code===(P==null?void 0:P.payment_category)?{...Xe,amount:P==null?void 0:P.amount,denda:P==null?void 0:P.denda}:Xe);a(Fa)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{g(!1)}},[]),h=async(C,m)=>{try{l(!0);const P=await ms(C,m);P.code===201?(V.success("Berhasil",{description:P.message}),await v(C)):V.error("Ops!",{description:P.message})}catch(P){P instanceof Error&&V.error("Ops!",{description:P.message})}finally{l(!1)}},U=i.useCallback(async C=>{try{A(!0);const m=await ls(C);d(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{A(!1)}},[]),I=i.useCallback(async C=>{try{_(!0);const m=await ns(C);x(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{_(!1)}},[]),Ae=async(C,m)=>{try{f(!0);const P=await ds(m);P.code===201?(V.success("Berhasil",{description:P.message}),await v(C),await U(C),await I(C)):V.error("Ops!",{description:P.message})}catch(P){P instanceof Error&&V.error("Ops!",{description:P.message})}finally{f(!1)}},Ie=i.useCallback(async C=>{try{H(!0);const m=await cs(C);W(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{H(!1)}},[]),ce=i.useCallback(async C=>{try{K(!0);const m=await os(C);G(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{K(!1)}},[]),Ra=i.useCallback(async C=>{try{le(!0);const m=await ts(C);re(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{le(!1)}},[]),Oa=i.useCallback(async C=>{try{t(!0);const m=await is(C);Ce(m==null?void 0:m.data)}catch(m){m instanceof Error&&V.error("Ops!",{description:m.message})}finally{t(!1)}},[]);return{loading:b,loadingPayment:c,loadingTransaksi:u,loadingSummary:F,loadingUpdate:j,studentTuition:n,dataTransaksi:s,dataSummary:p,getStudentTuition:v,updateStudentTuition:h,getDataTransaksi:U,getDataSummary:I,createPayment:Ae,sisaSumbanganWajib:w,loadingSisaSumbanganWajib:q,getSisaSumbanganWajib:Ie,totalBayarSumbanganWajib:Y,loadingTotalBayarSumbanganWajib:X,getTotalBayarSumbanganWajib:ce,sisaPkmb:Z,loadingSisaPkmb:Se,getSisaPkmb:Ra,totalBayarPkmb:ne,loadingTotalBayarPkmb:Pe,getTotalBayarPkmb:Oa}}const Ms=N.object({amount:N.string({required_error:"Amount harus diisi"}).min(1,{message:"Amount harus diisi"}),denda:N.string({required_error:"Denda harus diisi"}).min(1,{message:"Denda harus diisi"})}),Ds=N.object({invoice:N.string({required_error:"Invoice harus diisi"}).min(1,{message:"Invoice tidak boleh kosong"}
26),nim:N.string({required_error:"NIM harus diisi"}).min(1,{message:"NIM tidak boleh kosong"}),price:N.string({required_error:"Harga harus diisi"}).min(1,{message:"Harga tidak boleh kosong"}),month:N.string().optional(),year:N.string().optional(),paid_date:N.number({required_error:"Tanggal pembayaran harus diisi"}).min(1,{message:"Tanggal pembayaran tidak boleh kosong"}).transform(a=>a?Number(a):void 0).refine(a=>a&&a>0,{message:"Tanggal pembayaran harus valid"}),payment_category:N.string({required_error:"Pilih kategori pembayaran"}).min(1,{message:"Pilih kategori pembayaran"}),payment_method:N.string({required_error:"Metode pembayaran harus diisi"}).min(1,{message:"Metode pembayaran tidak boleh kosong"}),fine:N.string().optional()}).superRefine((a,r)=>{a.payment_category==="SPP"&&(!a.month||!a.year)&&r.addIssue({code:"custom",message:"Bulan dan Tahun wajib diisi jika pembayaran SPP",path:["month","year"]})}),ks=N.object({_id:N.string().min(1,{message:"Id tidak boleh kosong"}).optional(),id_prodi:N.string().min(1,{message:"Program studi tidak boleh kosong"}).optional(),invoice:N.string().min(1,{message:"Invoice tidak boleh kosong"}).optional(),nim:N.string().min(1,{message:"NIM tidak boleh kosong"}).optional(),nama_mahasiswa:N.string().min(1,{message:"Nama mahasiswa tidak boleh kosong"}).optional(),nama_program_studi:N.string().min(1,{message:"Nama program studi tidak boleh kosong"}).optional(),price:N.number({required_error:"Harga harus diisi",invalid_type_error:"Harga harus berupa angka"}).positive({message:"Harga harus lebih besar dari 0"}).optional(),month:N.string().min(1,{message:"Bulan tidak boleh kosong"}).optional(),year:N.string().min(4,{message:"Tahun tidak valid"}).optional(),paid_date:N.number({invalid_type_error:"Tanggal bayar harus berupa angka (timestamp)"}).optional(),payment_category:N.string().min(1,{message:"Kategori pembayaran tidak boleh kosong"}).optional(),payment_method:N.string().min(1,{message:"Metode pembayaran tidak boleh kosong"}).optional(),payment_status:N.string().min(1,{message:"Status pembayaran tidak boleh kosong"}).optional(),payment_exp:N.number({invalid_type_error:"Tanggal kadaluarsa harus berupa angka (timestamp)"}).optional(),user:N.string().min(1,{message:"User tidak boleh kosong"}).optional(),description:N.string().min(1,{message:"Deskripsi tidak boleh kosong"}).optional(),payment_date:N.number({invalid_type_error:"Tanggal proses pembayaran harus berupa angka (timestamp)"}).optional()});function Bs({studentTuition:a,updateStudentTuition:r}){const n=ue({resolver:fe(Ms),defaultValues:{amount:"",denda:""}}),[o,s]=i.useState(!1),d=async p=>{await r(a==null?void 0:a.nim,p),await s(!1)};return i.useEffect(()=>{var p,x;n.reset(),a&&(n.setValue("amount",(p=a==null?void 0:a.amount)==null?void 0:p.toString()),n.setValue("denda",(x=a==null?void 0:a.denda)==null?void 0:x.toString()))},[n,a]),e.jsxs(Ke,{open:o,onOpenChange:p=>{s(p)},children:[e.jsx(He,{asChild:!0,children:e.jsxs(B,{variant:"destructive",size:"sm",className:"w-fit inline-flex items-center justify-center gap-2 mt-5",children:[e.jsx(ua,{className:"w-4 h-4"}),e.jsx("span",{children:"Edit"})]})}),e.jsx(Je,{children:e.jsx(ye,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(d),className:"space-y-5",children:[e.jsx(qe,{children:e.jsx($e,{children:"Edit data keuangan"})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{control:n.control,name:"amount",render:({field:p})=>e.jsxs(D,{children:[e.jsx($,{children:"Jumlah"}),e.jsx(O,{children:e.jsx(me,{type:"number",min:0,...p})}),e.jsx(k,{})]})}),e.jsx(M,{control:n.control,name:"denda",render:({field:p})=>e.jsxs(D,{children:[e.jsx($,{children:"Denda"}),e.jsx(O,{children:e.jsx(me,{type:"number",min:0,...p})}),e.jsx(k,{})]})})]}),e.jsx(ze,{children:e.jsxs(B,{type:"submit",className:"w-fit inline-flex items-center justify-center gap-3",disabled:n.formState.isSubmitting,children:[n.formState.isSubmitting&&e.jsx(Ue,{className:"animate-spin"}),e.jsx("span",{children:"Simpan"})]})})]})})})]})}var z="Accordion",Es=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ia,Rs,Os]=Ua(z),[Ye,gr]=La(z,[Os,pa]),da=pa(),va=i.forwardRef((a,r)=>{const{type:n,...o}=a,s=o,d=o;return e.jsx(ia.Provider,{scope:a.__scopeAccordion,children:n==="multiple"?e.jsx(Ws,{...d,ref:r}):e.jsx(Ls,{...s,ref:r})})});va.displayName=z;var[wa,Fs]=Ye(z),[_a,Us]=Ye(z,{collapsible:!1}),Ls=i.forwardRef((a,r)=>{const{value:n,defaultValue:o,onValueChange:s=()=>{},collapsible:d=!1,...p}=a,[x,b]=xa({prop:n,defaultProp:o,onChange:s});return e.jsx(wa,{scope:a.__scopeAccordion,value:x?[x]:[],onItemOpen:b,onItemClose:i.useCallback(()=>d&&b(""),[d,b]),children:e.jsx(_a,{scope:a.__scopeAccordion,collapsible:d,children:e.jsx(Sa,{...p,ref:r})})})}),Ws=i.forwardRef((a,r)=>{const{value:n,defaultValue:o,onValueChange:s=()=>{},...d}=a,[p=[],x]=xa({prop:n,defaultProp:o,onChange:s}),b=i.useCallback(c=>x((f=[])=>[...f,c]),[x]),g=i.useCallback(c=>x((f=[])=>f.filter(j=>j!==c)),[x]);return e.jsx(wa,{scope:a.__scopeAccordion,value:p,onItemOpen:b,onItemClose:g,children:e.jsx(_a,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Sa,{...d,ref:r})})})}),[Ks,Ge]=Ye(z),Sa=i.forwardRef((a,r)=>{const{__scopeAccordion:n,disabled:o,dir:s,orientation:d="vertical",...p}=a,x=i.useRef(null),b=qa(x,r),g=Rs(n),f=$a(s)==="ltr",j=za(a.onKeyDown,l=>{var X;if(!Es.includes(l.key))return;const u=l.target,A=g().filter(K=>{var Z;return!((Z=K.ref.current)!=null&&Z.disabled)}),F=A.findIndex(K=>
26K.ref.current===u),_=A.length;if(F===-1)return;l.preventDefault();let w=F;const W=0,q=_-1,H=()=>{w=F+1,w>q&&(w=W)},Y=()=>{w=F-1,w<W&&(w=q)};switch(l.key){case"Home":w=W;break;case"End":w=q;break;case"ArrowRight":d==="horizontal"&&(f?H():Y());break;case"ArrowDown":d==="vertical"&&H();break;case"ArrowLeft":d==="horizontal"&&(f?Y():H());break;case"ArrowUp":d==="vertical"&&Y();break}const G=w%_;(X=A[G].ref.current)==null||X.focus()});return e.jsx(Ks,{scope:n,disabled:o,direction:s,orientation:d,children:e.jsx(ia.Slot,{scope:n,children:e.jsx(ja.div,{...p,"data-orientation":d,ref:b,onKeyDown:o?void 0:j})})})}),Fe="AccordionItem",[Hs,ma]=Ye(Fe),Ca=i.forwardRef((a,r)=>{const{__scopeAccordion:n,value:o,...s}=a,d=Ge(Fe,n),p=Fs(Fe,n),x=da(n),b=Wa(),g=o&&p.value.includes(o)||!1,c=d.disabled||a.disabled;return e.jsx(Hs,{scope:n,open:g,disabled:c,triggerId:b,children:e.jsx(Ka,{"data-orientation":d.orientation,"data-state":Da(g),...x,...s,ref:r,disabled:c,open:g,onOpenChange:f=>{f?p.onItemOpen(o):p.onItemClose(o)}})})});Ca.displayName=Fe;var Pa="AccordionHeader",Aa=i.forwardRef((a,r)=>{const{__scopeAccordion:n,...o}=a,s=Ge(z,n),d=ma(Pa,n);return e.jsx(ja.h3,{"data-orientation":s.orientation,"data-state":Da(d.open),"data-disabled":d.disabled?"":void 0,...o,ref:r})});Aa.displayName=Pa;var Ze="AccordionTrigger",Ia=i.forwardRef((a,r)=>{const{__scopeAccordion:n,...o}=a,s=Ge(z,n),d=ma(Ze,n),p=Us(Ze,n),x=da(n);return e.jsx(ia.ItemSlot,{scope:n,children:e.jsx(Ha,{"aria-disabled":d.open&&!p.collapsible||void 0,"data-orientation":s.orientation,id:d.triggerId,...x,...o,ref:r})})});Ia.displayName=Ze;var Va="AccordionContent",Ma=i.forwardRef((a,r)=>{const{__scopeAccordion:n,...o}=a,s=Ge(z,n),d=ma(Va,n),p=da(n);return e.jsx(Ja,{role:"region","aria-labelledby":d.triggerId,"data-orientation":s.orientation,...p,...o,ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Ma.displayName=Va;function Da(a){return a?"open":"closed"}var Js=va,qs=Ca,$s=Aa,ka=Ia,Ba=Ma;const _e=Js,ee=Le.forwardRef(({className:a,...r},n)=>e.jsx(qs,{ref:n,className:L("border-b",a),...r}));ee.displayName="AccordionItem";const ae=Le.forwardRef(({className:a,children:r,...n},o)=>e.jsx($s,{className:"flex",children:e.jsxs(ka,{ref:o,className:L("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",a),...n,children:[r,e.jsx(ps,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));ae.displayName=ka.displayName;const se=Le.forwardRef(({className:a,children:r,...n},o)=>e.jsx(Ba,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:e.jsx("div",{className:L("pb-4 pt-0",a),children:r})}));se.displayName=Ba.displayName;function zs({dataSummary:a}){const r=a==null?void 0:a.map(o=>{const s=Array.from({length:12},(d,p)=>{const x=p+1,b=o.data.find(g=>g.month===x);return b?b.price===0?"CUTI":"LUNAS":"-"});return{year:o._id,payments:s}}),n=[{name:"Tahun",className:"w-32"},{name:"Jan",className:"w-32"},{name:"Feb",className:"w-32"},{name:"Mar",className:"w-32"},{name:"Apr",className:"w-32"},{name:"May",className:"w-32"},{name:"Jun",className:"w-32"},{name:"Jul",className:"w-32"},{name:"Aug",className:"w-32"},{name:"Sep",className:"w-32"},{name:"Oct",className:"w-32"},{name:"Nov",className:"w-32"},{name:"Dec",className:"w-32"}];return e.jsx(_e,{type:"single",className:"bg-card w-full shadow-md border rounded-md px-5",collapsible:!0,defaultValue:"data-spp",children:e.jsxs(ee,{value:"data-spp",className:"border-none",children:[e.jsx(ae,{className:"text-left font-semibold text-lg",children:"Data SPP"}),e.jsx(se,{children:e.jsxs(Ne,{className:"table-fixed w-full",children:[e.jsx(ve,{className:"border",children:e.jsx(R,{className:"border",children:n==null?void 0:n.map((o,s)=>e.jsx(E,{className:"text-center border w-[100px]",children:o.name},s))})}),e.jsx(we,{children:r.length<=0?e.jsx(ba,{span:n.length}):r==null?void 0:r.map((o,s)=>{var d;return e.jsxs(R,{className:"border",children:[e.jsx(y,{className:"text-center p-3 border",children:o==null?void 0:o.year}),(d=o.payments)==null?void 0:d.map((p,x)=>e.jsx(y,{className:"text-center p-3 border",children:p},x))]},s)})})]})})]})})}const Ea=Le.forwardRef(({className:a,...r},n)=>
26e.jsx("textarea",{className:L("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:n,...r}));Ea.displayName="Textarea";function Ys({dataTransaksi:a}){const r=We(j=>j.role),n=Q(j=>j.category),o=Q(j=>j.method),s=ue({resolver:fe(ks),defaultValues:{description:"",id_prodi:"",invoice:"",month:"",nama_mahasiswa:"",nama_program_studi:"",nim:"",paid_date:0,payment_category:"",payment_date:0,payment_exp:0,payment_method:"",payment_status:"",price:0,user:"",year:"",_id:""}}),[d,p]=i.useState(!1),[x,b]=i.useState(!1),g=r===J.PMB?o.filter(j=>j.method_name.toUpperCase().includes("TUNAI")):o,c=r===J.PMB?n.filter(j=>["4101030401","4101030402","4101030403"].includes(j.category_code)||j.category_name.toUpperCase().includes("SUMBANGAN WAJIB")):n,f=j=>{console.log("Update Invoice:",j)};return i.useEffect(()=>{s.reset(),a&&(s.setValue("description",a==null?void 0:a.description),s.setValue("id_prodi",a==null?void 0:a.id_prodi),s.setValue("invoice",a==null?void 0:a.invoice),s.setValue("month",a==null?void 0:a.month),s.setValue("nama_mahasiswa",a==null?void 0:a.nama_mahasiswa),s.setValue("nama_program_studi",a==null?void 0:a.nama_program_studi),s.setValue("nim",a==null?void 0:a.nim),s.setValue("paid_date",a==null?void 0:a.paid_date),s.setValue("payment_category",a==null?void 0:a.payment_category),s.setValue("payment_date",a==null?void 0:a.payment_date),s.setValue("payment_exp",a==null?void 0:a.payment_exp),s.setValue("payment_method",a==null?void 0:a.payment_method),s.setValue("payment_status",a==null?void 0:a.payment_status),s.setValue("price",a==null?void 0:a.price),s.setValue("user",a==null?void 0:a.user),s.setValue("year",a==null?void 0:a.year),s.setValue("_id",a==null?void 0:a._id))},[s,a]),e.jsxs(Ke,{children:[e.jsx(He,{asChild:!0,children:e.jsxs(B,{type:"button",size:"sm",variant:"destructive",className:"inline-flex items-center w-fit gap-3",children:[e.jsx(ua,{}),e.jsx("span",{children:"Edit"})]})}),e.jsxs(Je,{children:[e.jsxs(qe,{children:[e.jsx($e,{children:"Edit Data Transaksi"}),e.jsx(Te,{className:"sr-only",children:"Modal edit data transaksi pembayaran mahasiswa"})]}),e.jsx(ye,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(f),className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(M,{control:s.control,name:"invoice",render:({field:j})=>e.jsxs(D,{children:[e.jsx($,{children:"Invoice"}),e.jsx(O,{children:e.jsx(me,{type:"text",...j})}),e.jsx(k,{})]})}),e.jsx(M,{control:s.control,name:"payment_category",render:({field:j})=>{var l;return e.jsxs(D,{className:"col-span-3 w-full",children:[e.jsx($,{children:"Kategori"}),e.jsxs(te,{open:d,onOpenChange:p,children:[e.jsx(ie,{asChild:!0,children:e.jsx(O,{children:e.jsxs("div",{className:"relative w-full flex items-center",children:[e.jsx(B,{type:"button",variant:"outline",role:"combobox",className:L("w-full justify-between whitespace-nowrap",!j.value&&"text-muted-foreground"),children:e.jsx("span",{className:"truncate",children:j.value?(l=n==null?void 0:n.find(u=>(u==null?void 0:u.category_code)===j.value))==null?void 0:l.category_name:"Pilih Pembayaran"})}),j.value?e.jsx(oe,{className:"opacity-50 right-2 absolute w-4 h-4 hover:cursor-pointer",onClick:()=>{s.setValue("payment_category","")}}):e.jsx(Ve,{className:"opacity-50 right-2 absolute w-4 h-4"})]})})}),e.jsx(de,{className:"w-full p-0",children:e.jsxs(De,{children:[e.jsx(ke,{placeholder:"Cari Pembayaran...",className:"h-9"}),e.jsxs(Be,{children:[e.jsx(Ee,{children:"Pembayaran Tidak Ditemukan."}),e.jsx(Re,{children:c==null?void 0:c.map((u,A)=>e.jsxs(Oe,{value:u==null?void 0:u.category_name,onSelect:()=>{s.setValue("payment_category",u.category_code),p(!1)},children:[u==null?void 0:u.category_name,e.jsx(Me,{className:L("ml-auto",u.category_name===j.value?"opacity-100":"opacity-0")})]},A))})]})]})})]}),e.jsx(k,{})]})}}),e.jsx(M,{control:s.control,name:"payment_method",render:({field:j})=>{var l;return e.jsxs(D,{className:"col-span-3 w-full",children:[e.jsx($,{children:"Metode Pembayaran"}),e.jsxs(te,{open:x,onOpenChange:b,children:[e.jsx(ie,{asChild:!0,children:e.jsx(O,{children:e.jsxs("div",{className:"relative w-full flex items-center",children:[e.jsx(B,{t
26ype:"button",variant:"outline",role:"combobox",className:L("w-full justify-between whitespace-nowrap",!j.value&&"text-muted-foreground"),children:e.jsx("span",{className:"truncate",children:j.value?(l=o==null?void 0:o.find(u=>(u==null?void 0:u.method_code)===j.value))==null?void 0:l.method_name:"Pilih Metode Pembayaran"})}),j.value?e.jsx(oe,{className:"opacity-50 right-2 absolute w-4 h-4 hover:cursor-pointer",onClick:()=>{s.setValue("payment_method","")}}):e.jsx(Ve,{className:"opacity-50 right-2 absolute w-4 h-4"})]})})}),e.jsx(de,{className:"w-full p-0",children:e.jsxs(De,{children:[e.jsx(ke,{placeholder:"Cari Metode Pembayaran...",className:"h-9"}),e.jsxs(Be,{children:[e.jsx(Ee,{children:"Metode Pembayaran Tidak Ditemukan."}),e.jsx(Re,{children:g==null?void 0:g.map((u,A)=>e.jsxs(Oe,{value:u==null?void 0:u.method_name,onSelect:()=>{s.setValue("payment_method",u==null?void 0:u.method_code),b(!1)},children:[u==null?void 0:u.method_name,e.jsx(Me,{className:L("ml-auto",u.method_code===j.value?"opacity-100":"opacity-0")})]},A))})]})]})})]}),e.jsx(k,{})]})}}),e.jsx(M,{control:s.control,name:"description",render:({field:j})=>e.jsxs(D,{children:[e.jsx($,{children:"Deskripsi"}),e.jsx(O,{children:e.jsx(Ea,{rows:3,...j})}),e.jsx(k,{})]})})]}),e.jsx(ze,{children:e.jsxs(B,{type:"submit",className:"w-fit inline-flex items-center justify-center gap-3",disabled:s.formState.isSubmitting,children:[s.formState.isSubmitting&&e.jsx(Ue,{className:"animate-spin"}),e.jsx("span",{children:"Edit"})]})})]})})]})]})}const T=[{name:"Januari",value:"1"},{name:"Februari",value:"2"},{name:"Maret",value:"3"},{name:"April",value:"4"},{name:"Mei",value:"5"},{name:"Juni",value:"6"},{name:"Juli",value:"7"},{name:"Agustus",value:"8"},{name:"September",value:"9"},{name:"Oktober",value:"10"},{name:"November",value:"11"},{name:"Desember",value:"12"}],Gs=N.object({month:N.string().min(1,"Bulan wajib dipilih"),year:N.string().min(1,"Tahun wajib dipilih").regex(/^\d{4}$/,"Tahun harus 4 digit angka")});function Xs({dataTransaksi:a,onSuccess:r}){var A,F;const[n,o]=i.useState(!1),[s,d]=i.useState(!1),p=new Date().getFullYear(),x=ga(2010,p+5),b=((A=T.find(_=>_.value===a.month))==null?void 0:A.name)??a.month,g=ue({resolver:fe(Gs),defaultValues:{month:a.month||"",year:a.year||""}}
26),c=g.watch("month"),f=g.watch("year"),j=(F=T.find(_=>_.value===c))==null?void 0:F.name,l=c===a.month&&f===a.year,u=async _=>{try{d(!0);const w=await hs(a._id,{month:Number(_.month),year:_.year});w.code===200?(V.success("Berhasil",{description:w.message||"Periode pembayaran SPP berhasil diperbarui!"}),o(!1),g.reset(),r==null||r()):V.error("Ops!",{description:w.message||"Gagal memperbarui periode pembayaran."})}catch(w){w instanceof Error&&V.error("Ops!",{description:w.message})}finally{d(!1)}};return e.jsxs(Ke,{open:n,onOpenChange:_=>{o(_),_||g.reset({month:a.month||"",year:a.year||""})},children:[e.jsx(He,{asChild:!0,children:e.jsxs(B,{type:"button",size:"sm",variant:"outline",className:"inline-flex items-center w-fit gap-2",children:[e.jsx(Ss,{className:"w-4 h-4"}),e.jsx("span",{children:"Pindah Bulan"})]})}),e.jsxs(Je,{children:[e.jsxs(qe,{children:[e.jsx($e,{children:"Pindah Bulan Pembayaran"}),e.jsx(Te,{className:"sr-only",children:"Pindahkan data pembayaran ke bulan dan tahun lain"})]}),e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm space-y-1",children:[e.jsxs("p",{className:"text-muted-foreground",children:["Invoice: ",e.jsx("span",{className:"font-medium text-foreground",children:a.invoice})]}),e.jsxs("p",{className:"text-muted-foreground",children:["Bulan / Tahun saat ini:"," ",e.jsxs("span",{className:"font-medium text-foreground",children:[b," / ",a.year]})]})]}),e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Na,{className:"text-muted-foreground"})}),e.jsx(ye,{...g,children:e.jsxs("form",{onSubmit:g.handleSubmit(u),className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(M,{control:g.control,name:"month",render:({field:_})=>e.jsxs(D,{className:"flex-1",children:[e.jsx($,{children:"Bulan Tujuan"}),e.jsxs(he,{onValueChange:_.onChange,value:_.value,children:[e.jsx(O,{children:e.jsx(xe,{className:"w-full",children:e.jsx(pe,{placeholder:"Pilih Bulan"})})}),e.jsx(je,{children:T.map(w=>e.jsx(ge,{value:w.value,children:w.name},w.value))})]}),e.jsx(k,{})]})}),e.jsx(M,{control:g.control,name:"year",render:({field:_})=>e.jsxs(D,{className:"flex-1",children:[e.jsx($,{children:"Tahun Tujuan"}),e.jsxs(he,{onValueChange:_.onChange,value:_.value,children:[e.jsx(O,{children:e.jsx(xe,{className:"w-full",children:e.jsx(pe,{placeholder:"Pilih Tahun"})})}),e.jsx(je,{children:x.map(w=>e.jsx(ge,{value:w.toString(),children:w},w))})]}),e.jsx(k,{})]})})]}),c&&f&&!l&&e.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-3 text-sm text-muted-foreground",children:["Pembayaran akan dipindahkan ke"," ",e.jsxs("span",{className:"font-semibold text-foreground",children:[j," / ",f]})]}),e.jsx(ze,{children:e.jsxs(ea,{children:[e.jsx(aa,{asChild:!0,children:e.jsxs(B,{type:"button",disabled:!g.formState.isValid||l||s,className:"inline-flex items-center gap-2",children:[s&&e.jsx(Ue,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"Simpan"})]})}),e.jsxs(sa,{children:[e.jsxs(ra,{children:[e.jsx(la,{children:"Konfirmasi Pindah Bulan"}),e.jsxs(na,{children:["Pembayaran ",e.jsx("span",{className:"font-semibold",children:a.invoice})," ","akan dipindahkan dari"," ",e.jsxs("span",{className:"font-semibold",children:[b," / ",a.year]})," ","ke"," ",e.jsxs("span",{className:"font-semibold",children:[j," / ",f]}),". Lanjutkan?"]})]}),e.jsxs(ca,{children:[e.jsx(oa,{children:"Batal"}),e.jsx(ta,{onClick:()=>g.handleSubmit(u)(),children:"Ya, Pindahkan"})]})]})]})})]})})]})]})}const Qs=N.object({payment_category:N.string().min(1,"Jenis pembayaran tujuan wajib dipilih")});function Zs({dataTransaksi:a}){var g;const[r,n]=i.useState(!1),o=Q(c=>c.category),s=o.filter(c=>c.category_name!==a.payment_category),d=ue({resolver:fe(Qs),defaultValues:{payment_category:""}}),p=d.watch("payment_category"),x=(g=o.find(c=>c.category_code===p))==null?void 0:g.category_name,b=c=>{console.log("Pindah kategori pembayaran:",{invoice:a.invoice,from:a.payment_category,to:x,payment_category_code:c.payment_category}),n(!1),d.reset()};return e.jsxs(Ke,{open:r,onOpenChange:c=>{n(c),c||d.reset()},children:[e.jsx(He,{asChild:!0,children:e.jsxs(B,{type:"button",size:"sm",variant:"outline",className:"inline-flex items-center w-fit gap-2",children:[e.jsx(Ps,{className:"w-4 h-4"}),e.jsx("span",{children:"Pindah Kategori"})]})}),e.jsxs(Je,{children:[e.jsxs(qe,{children:[e.jsx($e,{children:"Pindah Kategori Pembayaran"}),e.jsx(Te,{className:"sr-only",children:"Alihkan data pembayaran ke jenis biaya lain"})]}),e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm space-y-1",children:[e.jsxs("p",{className:"text-muted-foreground",children:["Invoice: ",e.jsx("span",{className:"font-medium text-foreground",children:a.invoice})]}),e.jsxs("p",{className:"text-muted-foreground",children:["Jenis Pembayaran saat ini:"," ",e.jsx("span",{className:"font-medium text-foreground",children:a.payment_category})]})]}),e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Na,{className:"text-muted-foreground"})}),e.jsx(ye,{...d,children:e.jsxs("form",{onSubmit:d.handleSubmit(b),className:"space-y-4",children:[e.jsx(M,{control:d.control,name:"payment_category",render:({field:c})=>e.jsxs(D,{children:[e.jsx($,{children:"Jenis Pembayaran Tujuan"}),e.jsxs(he,{onValueChange:c.onChange,value:c.value,children:[e.jsx(O,{children:e.jsx(xe,{className:"w-full",children:e.jsx(pe,{placeholder:"Pilih Jenis Pembayaran"})})}),e.jsx(je,{children:s.map(f=>e.jsx(ge,{value:f.category_code,children:f.category_name},f.category_code))})]}),e.jsx(k,{})]})}),x&&e.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-3 text-sm text-muted-foreground",children:["Pembayaran akan dipindahkan ke"," ",e.jsx("span",{className:"font-semibold text-foreground",children:x})]}),e.jsx(ze,{children:e.jsxs(ea,{children:[e.jsx(aa,{asChild:!0,children:e.jsx(B,{t
26ype:"button",disabled:!d.formState.isValid,className:"inline-flex items-center gap-2",children:e.jsx("span",{children:"Simpan"})})}),e.jsxs(sa,{children:[e.jsxs(ra,{children:[e.jsx(la,{children:"Konfirmasi Pindah Kategori"}),e.jsxs(na,{children:["Pembayaran ",e.jsx("span",{className:"font-semibold",children:a.invoice})," ","akan dipindahkan dari"," ",e.jsx("span",{className:"font-semibold",children:a.payment_category})," ke"," ",e.jsx("span",{className:"font-semibold",children:x}),". Lanjutkan?"]})]}),e.jsxs(ca,{children:[e.jsx(oa,{children:"Batal"}),e.jsx(ta,{onClick:()=>d.handleSubmit(b)(),children:"Ya, Pindahkan"})]})]})]})})]})})]})]})}function Ts({studentTuition:a,dataTransaksi:r,onUpdated:n}){const o=We(c=>c.role),s=i.useRef(null),[d,p]=i.useState(null),x=["No","Tanggal","Pembayaran","Bulan","Tahun","Keterangan","Jumlah","Metode","User","Invoice"],b=js.useReactToPrint({contentRef:s,documentTitle:"Invoice"}),g=c=>{const f={...c,nama_mahasiswa:a==null?void 0:a.name,nim:a==null?void 0:a.nim,nama_program_studi:a==null?void 0:a.nama_prodi};p(f),setTimeout(()=>{b()},0)};return e.jsx(_e,{type:"single",className:"bg-card w-full shadow-md border rounded-md px-5",collapsible:!0,defaultValue:"data-transaksi",children:e.jsxs(ee,{value:"data-transaksi",className:"border-none",children:[e.jsx(ae,{className:"text-left font-semibold text-lg",children:"Data Transaksi"}),e.jsxs(se,{children:[e.jsxs(Ne,{children:[e.jsx(ve,{className:"border",children:e.jsx(R,{className:"border",children:x==null?void 0:x.map((c,f)=>e.jsx(E,{className:"text-center border",children:c},f))})}),e.jsx(we,{children:(r==null?void 0:r.length)<=0?e.jsx(ba,{span:x==null?void 0:x.length}):r==null?void 0:r.map((c,f)=>e.jsxs(R,{className:"border",children:[e.jsx(y,{className:"border text-center p-3",children:f+1}),e.jsx(y,{className:"border p-3 text-nowrap",children:c.paid_date&&c.paid_date!==0?ya(new Date(c.paid_date),"dd MMMM yyyy",{locale:fa}):"-"}),e.jsx(y,{className:"border p-3",children:c.payment_category}),e.jsx(y,{className:"border p-3 text-center",children:c.month||"-"}),e.jsx(y,{className:"border p-3 text-center",children:c.year||"-"}),e.jsx(y,{className:"border p-3 text-center",children:c.payment_status||"-"}),e.jsx(y,{className:"border p-3 text-right text-nowrap",children:c.payment_method==="BEASISWA"?"BEASISWA":S(c.price)}),e.jsx(y,{className:"border p-3 text-center",children:c.payment_method}),e.jsx(y,{className:"border p-3 text-nowrap",children:c.user||"-"}),e.jsx(y,{className:"border p-3 text-center",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap justify-center",children:[e.jsxs(B,{type:"button",size:"sm",variant:"blue",onClick:()=>g(c),className:"inline-flex items-center w-fit gap-3",children:[e.jsx(gs,{}),e.jsx("span",{children:"Cetak"})]}),e.jsx(Ys,{dataTransaksi:c}),!!o&&[J.ADMIN,J.KEUANGAN,J.PMB].includes(o)&&c.payment_category==="SPP"&&c.month&&e.jsx(Xs,{dataTransaksi:c,onSuccess:n}),o===J.ADMIN&&e.jsx(Zs,{dataTransaksi:c})]})})]},f))})]}),d&&e.jsx(bs,{ref:s,data:d})]})]})})}function er({studentTuition:a}){return e.jsx(_e,{type:"single",className:"bg-card w-full shadow-md border rounded-md px-5",collapsible:!0,defaultValue:"data-kewajiban",children:e.jsxs(ee,{value:"data-kewajiban",className:"border-none",children:[e.jsx(ae,{className:"text-left font-semibold text-lg",children:"Data Kewajiban"}),e.jsx(se,{children:e.jsxs(Ne,{children:[e.jsxs(ve,{className:"border",children:[e.jsxs(R,{className:"border",children:[e.jsx(E,{className:"border",rowSpan:2,children:"Tahun Ajaran"}),e.jsx(E,{className:"border text-center",colSpan:2,children:"Ganjil"}),e.jsx(E,{className:"border text-center",colSpan:2,children:"Genap"})]}),e.jsxs(R,{className:"border",children:[e.jsx(E,{className:"border text-center",children:"Kewajiban"}),e.jsx(E,{className:"border text-center",children:"Sisa"}),e.jsx(E,{className:"border text-center",children:"Kewajiban"}),e.jsx(E,{className:"border text-center",children:"Sisa"})]})]}),e.jsxs(we,{children:[e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border",children:"2025"}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)})]}),e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border",children:"2026"}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)})]}),e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border",children:"2027"}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)})]}),e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border",children:"2028"}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)}),e.jsx(y,{className:"border text-right",children:S((a==null?void 0:a.amount)*6)}),e.jsx(y,{className:"border text-right",children:S(0)})]})]})]})})]})})}function ar({studentTuition:a,loadingPayment:r,createPayment:n,getSisaSumbanganWajib:o,getTotalBayarSumbanganWajib:s,getSisaPkmb:d,getTotalBayarPkmb:p}){const x=We(t=>t.role),b=Q(t=>t.category),g=Q(t=>t.method),c=x===J.PMB?b.filter(t=>["4101030401","4101030402","4101030403","11111","004"].includes(t.category_code)||t.category_name.toUpperCase().includes("SUMBANGAN WAJIB")||t.category_name.toUpperCase().includes("PKMB")):b,f=i.useCallback(t=>{var U;if(!t)return!1;if(t==="003"||t==="004")return!0;const v=b.find(I=>I.category_code===t),h=((U=v==null?void 0:v.category_name)==null?void 0:U.toUpperCase())??"";return h.includes("SUMBANGAN WAJIB")||h.includes("PKMB")},[b]),j=x===J.PMB?g.filter(t=>t.method_name.toUpperCase().includes("TUNAI")):g,l=ue({mode:"onSubmit",resolver:fe(Ds),defaultValues:{invoice:"",nim:"",price:"",month:"",year:"",paid_date:Date.now(),payment_category:"",payment_method:"",fine:""}});console.log(l.getValues());const[u,A]=i.useState(!1),[F,_]=i.useState(!1),[w,W]=i.useState(!1),[q,H]=i.useState(!1),[Y,G]=i.useState(!1),[X,K]=i.useState(0),Z=new Date().getFullYear(),re=ga(2010,Z+5),Se=l.watch("month"),le=l.watch("year"),ne=l.watch("payment_method"),Ce=Ya(le,Se),Pe=async t=>{await n(a==null?void 0:a.nim,t),await o(a==null?void 0:a.nim),await s(a==null?void 0:a.nim),await d(a==null?void 0:a.nim),await p(a==null?void 0:a.nim);const v=ha(a==null?void 0:a.nim);l.setValue("invoice",v)};return i.useEffect(()=>{a&&(l.setValue("nim",a==null?void 0:a.nim),l.setValue("invoice",ha(a==null?void 0:a.nim)))},[l,a]),i.useEffect(()=>{var v,h,U;const t=l.getValues("payment_category");
26if(f(t)){l.setValue("price","0"),l.setValue("fine","0");return}t==="SPP"&&(l.setValue("price",(v=a==null?void 0:a.amount)==null?void 0:v.toString()),l.setValue("fine","0")),Ce?(K((a==null?void 0:a.denda)||0),ne==="CUTI"?(l.setValue("price","0"),l.setValue("fine","0"),K(0)):(l.setValue("price",(h=a==null?void 0:a.amount)==null?void 0:h.toString()),l.setValue("fine",(U=a==null?void 0:a.denda)==null?void 0:U.toString()))):(K(0),ne==="CUTI"&&l.setValue("price","0"),l.setValue("fine","0"))},[l,f,Ce,ne,Se,le,a,a==null?void 0:a.amount,a==null?void 0:a.denda]),e.jsx("div",{className:"w-full flex flex-col gap-5",children:e.jsx(ye,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(Pe),className:"w-full flex flex-col gap-5",children:[e.jsx(M,{control:l.control,name:"payment_category",render:({field:t})=>{var v;return e.jsxs(D,{className:"col-span-3 w-full",children:[e.jsxs(te,{open:u,onOpenChange:A,children:[e.jsx(ie,{asChild:!0,children:e.jsx(O,{children:e.jsxs("div",{className:"relative w-full flex items-center",children:[e.jsx(B,{type:"button",variant:"outline",role:"combobox",className:L("w-full justify-between whitespace-nowrap",!t.value&&"text-muted-foreground"),children:e.jsx("span",{className:"truncate",children:t.value?(v=b==null?void 0:b.find(h=>(h==null?void 0:h.category_code)===t.value))==null?void 0:v.category_name:"Pilih Pembayaran"})}),t.value?e.jsx(oe,{className:"opacity-50 right-2 absolute w-4 h-4 hover:cursor-pointer",onClick:()=>{l.setValue("payment_category",""),H(!1)}}):e.jsx(Ve,{className:"opacity-50 right-2 absolute w-4 h-4"})]})})}),e.jsx(de,{className:"w-full p-0",children:e.jsxs(De,{children:[e.jsx(ke,{placeholder:"Cari Pembayaran...",className:"h-9"}),e.jsxs(Be,{children:[e.jsx(Ee,{children:"Pembayaran Tidak Ditemukan."}),e.jsx(Re,{children:c==null?void 0:c.map((h,U)=>e.jsxs(Oe,{value:h==null?void 0:h.category_name,onSelect:()=>{var Ae,Ie;l.resetField("year"),l.resetField("month"),l.resetField("paid_date"),G(!1),l.setValue("payment_category",h==null?void 0:h.category_code),A(!1);const I=b==null?void 0:b.find(ce=>(ce==null?void 0:ce.category_code)===(h==null?void 0:h.category_code));f(I==null?void 0:I.category_code)?l.setValue("price","0"):(I==null?void 0:I.category_code)==="SPP"?l.setValue("price",((Ae=a==null?void 0:a.amount)==null?void 0:Ae.toString())||""):l.setValue("price",((Ie=I==null?void 0:I.amount)==null?void 0:Ie.toString())||""),(I==null?void 0:I.category_code)==="SPP"?G(!0):G(!1)},children:[h==null?void 0:h.category_name,e.jsx(Me,{className:L("ml-auto",h.category_name===t.value?"opacity-100":"opacity-0")})]},U))})]})]})})]}),e.jsx(k,{})]})}}),e.jsx(M,{control:l.control,name:"payment_method",render:({field:t})=>{var v;return e.jsxs(D,{className:"col-span-3 w-full",children:[e.jsxs(te,{open:F,onOpenChange:_,children:[e.jsx(ie,{asChild:!0,children:e.jsx(O,{children:e.jsxs("div",{className:"relative w-full flex items-center",children:[e.jsx(B,{type:"button",variant:"outline",role:"combobox",className:L("w-full justify-between whitespace-nowrap",!t.value&&"text-muted-foreground"),children:e.jsx("span",{className:"truncate",children:t.value?(v=g==null?void 0:g.find(h=>(h==null?void 0:h.method_code)===t.value))==null?void 0:v.method_name:"Pilih Metode Pembayaran"})}),t.value?e.jsx(oe,{className:"opacity-50 right-2 absolute w-4 h-4 hover:cursor-pointer",onClick:()=>{l.setValue("payment_method",""),H(!1)}}):e.jsx(Ve,{className:"opacity-50 right-2 absolute w-4 h-4"})]})})}),e.jsx(de,{className:"w-full p-0",children:e.jsxs(De,{children:[e.jsx(ke,{placeholder:"Cari Metode Pembayaran...",className:"h-9"}),e.jsxs(Be,{children:[e.jsx(Ee,{children:"Metode Pembayaran Tidak Ditemukan."}),e.jsx(Re,{children:j==null?void 0:j.map((h,U)=>e.jsxs(Oe,{value:h==null?void 0:h.method_name,onSelect:I=>{l.resetField("year"),l.resetField("month"),l.resetField("paid_date"),l.setValue("payment_method",h==null?void 0:h.method_code),I==="CUTI"&&(l.setValue("fine","0"),l.setValue("price","0")),_(!1)},children:[h==null?void 0:h.method_name,e.jsx(Me,{className:L("ml-auto",h.method_code===t.value?"opacity-100":"opacity-0")})]},U))})]})]})})]}),e.jsx(k,{})]})}}
26),e.jsx(B,{type:"button",size:"sm",className:"w-fit",onClick:()=>{H(!0)},disabled:!l.getValues("payment_category")||!l.getValues("payment_method")||r,children:"Tampilkan"}),q&&e.jsxs("div",{className:"space-y-5 mt-5",children:[e.jsx(Qe,{}),e.jsxs("div",{className:"w-full flex flex-col gap-5",children:[e.jsx(M,{control:l.control,name:"paid_date",render:({field:t})=>e.jsxs(D,{className:"col-span-3 w-full",children:[e.jsxs(te,{open:w,onOpenChange:W,children:[e.jsx(ie,{asChild:!0,children:e.jsx(O,{children:e.jsxs("div",{className:"relative w-full flex items-center",children:[e.jsx(B,{type:"button",variant:"outline",role:"combobox",className:L("w-full justify-between whitespace-nowrap",!t.value&&"text-muted-foreground"),children:e.jsx("span",{className:"truncate",children:t.value?ya(new Date(t.value),"dd MMMM yyyy",{locale:fa}):"Pilih Tanggal Pembayaran"})}),t.value?e.jsx(oe,{className:"opacity-50 right-2 absolute w-4 h-4 hover:cursor-pointer",onClick:()=>{l.setValue("paid_date",void 0)}}):e.jsx(us,{className:"opacity-50 right-2 absolute w-4 h-4"})]})})}),e.jsx(de,{className:"w-auto p-0",align:"start",children:e.jsx(ys,{mode:"single",selected:t.value?new Date(t.value):void 0,onSelect:v=>{if(v){const h=+new Date(v);t.onChange(h)}W(!1)},initialFocus:!0})})]}),e.jsx(k,{})]})}),Y&&e.jsxs("div",{className:"flex flex-col w-full gap-5",children:[e.jsx(M,{control:l.control,name:"year",render:({field:t})=>e.jsxs(D,{className:"w-full",children:[e.jsxs(he,{onValueChange:v=>{t.onChange(v)},value:t.value,children:[e.jsx(O,{children:e.jsx(xe,{value:t.value,onReset:()=>{l.resetField("year"),K(0)},className:"w-full",children:e.jsx(pe,{placeholder:"Pilih Tahun"})})}),e.jsx(je,{children:re==null?void 0:re.map(v=>e.jsx(ge,{value:v.toString(),children:v},v))})]}),e.jsx(k,{})]})}),e.jsx(M,{control:l.control,name:"month",render:({field:t})=>e.jsxs(D,{className:"w-full",children:[e.jsxs(he,{onValueChange:v=>{t.onChange(v)},value:t.value,children:[e.jsx(O,{children:e.jsx(xe,{value:t.value,onReset:()=>{l.resetField("month"),K(0)},className:"w-full",children:e.jsx(pe,{placeholder:"Pilih Bulan"})})}),e.jsx(je,{children:T==null?void 0:T.map(v=>e.jsx(ge,{value:v.value,children:v.name},v.value))})]}),e.jsx(k,{})]})}),X>0&&e.jsxs("div",{className:"text-muted-foreground text-xs",children:["Mahasiswa telat membayar, dikenekan denda sebesar"," ",S(X)]})]}),e.jsx(M,{control:l.control,name:"invoice",render:({field:t})=>e.jsxs(D,{className:"w-full",children:[e.jsx(me,{readOnly:!0,...t}),e.jsx(k,{})]})}),e.jsx(M,{control:l.control,name:"price",render:({field:t})=>e.jsxs(D,{className:"w-full",children:[e.jsx(me,{readOnly:!f(l.getValues("payment_category")),value:t.value,onChange:v=>{const h=v.target.value;(h===""||/^[0-9]*\.?[0-9]*$/.test(h))&&t.onChange(h)}}),e.jsx(k,{})]})}),e.jsxs(ea,{children:[e.jsx(aa,{asChild:!0,children:e.jsxs(B,{type:"button",size:"sm",className:"w-full inline-flex items-center justify-center gap-3",disabled:l.formState.isSubmitting||r||!l.formState.isValid,children:[l.formState.isSubmitting||r&&e.jsx(Ue,{className:"animate-spin"}),e.jsx("span",{children:"Bayar"})]})}),e.jsxs(sa,{children:[e.jsxs(ra,{children:[e.jsx(la,{children:"Apakah anda yakin?"}),e.jsx(na,{children:"Setelah disetujui data tidak dapat direset"})]}),e.jsxs(ca,{children:[e.jsx(oa,{children:"Tidak"}),e.jsx(ta,{onClick:()=>l.handleSubmit(Pe)(),children:"Setujui"})]})]})]})]})]})]})})})}function sr({sisa:a,studentTuition:r,totalBayarSumbanganWajib:n}){return e.jsx(_e,{type:"single",className:"bg-card w-full shadow-md border rounded-md px-5",collapsible:!0,defaultValue:"data-sumbangan-wajib",children:e.jsxs(ee,{value:"data-sumbangan-wajib",className:"border-none",children:[e.jsx(ae,{className:"text-left font-semibold text-lg",children:"Data Sumbangan Wajib"}),e.jsx(se,{children:e.jsxs(Ne,{children:[e.jsx(ve,{className:"border",children:e.jsxs(R,{className:"border",children:[e.jsx(E,{className:"border text-center",children:"Total"}),e.jsx(E,{className:"border text-center",children:"Sudah Bayar"}),e.jsx(E,{className:"border text-center",children:"Sisa"})]})}),e.jsx(we,{children:e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border text-right",children:S((r==null?void 0:r.sumbangan_wajib)||0)}),e.jsx(y,{className:"border text-right text-primary",children:S(n)||0}),e.jsx(y,{className:"border text-right text-destructive",children:S(a)})]})})]})})]})})}function rr({sisa:a,studentTuition:r,totalBayarPkmb:n}){return e.jsx(_e,{type:"single",className:"bg-card w-full shadow-md border rounded-md px-5",collapsible:!0,defaultValue:"data-pkmb",children:e.jsxs(ee,{value:"data-pkmb",className:"border-none",children:[e.jsx(ae,{className:"text-left font-semibold text-lg",children:"Data PKMB"}),e.jsx(se,{children:e.jsxs(Ne,{children:[e.jsx(ve,{className:"border",children:e.jsxs(R,{className:"border",children:[e.jsx(E,{className:"border text-center",children:"Total"}),e.jsx(E,{className:"border text-center",children:"Sudah Bayar"}),e.jsx(E,{className:"border text-center",children:"Sisa"})]})}),e.jsx(we,{children:e.jsxs(R,{className:"",children:[e.jsx(y,{className:"border text-right",children:S((r==null?void 0:r.pkkmb)||0)}),e.jsx(y,{className:"border text-right text-primary",children:S(n)||0}),e.jsx(y,{className:"border text-right text-destructive",children:S(a)})]})})]})})]})})}function br(){const a=We(q=>q.role),{nim:r}=Ga(),{loading:n,loadingPayment:o,studentTuition:s,dataTransaksi:d,dataSummary:p,getStudentTuition:x,updateStudentTuition:b,getDataTransaksi:g,getDataSummary:c,createPayment:f,sisaSumbanganWajib:j,getSisaSumbanganWajib:l,totalBayarSumbanganWajib:u,getTotalBayarSumbanganWajib:A,sisaPkmb:F,getSisaPkmb:_,totalBayarPkmb:w,getTotalBayarPkmb:W}=Vs();return i.useEffect(()=>{r&&(x(r),g(r),c(r),l(r),A(r),_(r),W(r))},[c,g,l,x,A,_,W,r]),n?e.jsx(Xa,{}):e.jsx(xs,{title:"Detail Pembayaran",children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(Qa,{children:e.jsxs(Za,{className:"w-full h-full flex flex-col lg:flex-row justify-between gap-5 p-5",children:[e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"flex items-center justify-center w-full",children:e.jsxs(Ta,{className:"h-40 w-40 rounded-full border-primary border-2",children:[e.jsx(es,{src:"",alt:`@${s==null?void 0:s.name}`}),e.jsx(as,{className:"rounded-full text-3xl",children:ss(s==null?void 0:s.name)})]})}),e.jsxs("h1",{className:"font-semibold text-center text-lg uppercase mt-3",children:[s==null?void 0:s.name," - ",s==null?void 0:s.nim]}),e.jsxs("div",{className:"space-y-3 mt-5 text-muted-foreground",children:[e.jsxs("div",{className:"flex flex-row gap-3",children:[e.jsx(Is,{}),e.jsx("p",{children:s==null?void 0:s.nama_prodi})]}),e.jsxs("div",{className:"flex flex-row gap-3",children:[e.jsx(ws,{}),e.jsxs("p",{children:["SPP - ",S(s==null?void 0:s.amount)]})]}),e.jsxs("div",{className:"flex flex-row gap-3",children:[e.jsx(fs,{}),e.jsxs("p",{children:["Denda - ",S(s==null?void 0:s.denda)]})]})]}),a===J.ADMIN&&e.jsx(Bs,{studentTuition:s,updateStudentTuition:b})]}),a!==J.USER&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-fit flex items-start justify-start",children:[e.jsx(Qe,{orientation:"vertical",className:"hidden lg:block"}),e.jsx(Qe,{className:"block lg:hidden"})]}),e.jsx(ar,{studentTuition:s,loadingPayment:o,createPayment:f,getSisaSumbanganWajib:l,getTotalBayarSumbanganWajib:A,getSisaPkmb:_,getTotalBayarPkmb:W})]})]})}),e.jsx(sr,{sisa:j,studentTuition:s,totalBayarSumbanganWajib:u}),e.jsx(rr,{sisa:F,studentTuition:s,totalBayarPkmb:w}),e.jsx(zs,{dataSummary:p}),e.jsx(er,{studentTuition:s}),e.jsx(Ts,{studentTuition:s,dataTransaksi:d,onUpdated:()=>{r&&(g(r),c(r))}})]})})}export{br 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.