1import{r as s,i as e,S as t,j as i,T as a}from"./DGrbOkrFsn0voVzUoWkxi-1790053513351.js";import{u as n}from"./G_z35mcMeQsIItbNAJgAg.js";import{f as o}from"./C0VscXY0q_hXYqQxArNlG.js";import{a as c}from"./q-6oGMB0PsXVGXMly6yhg.js";import"./GM7h-BAS7l37-geROCDvC.js";import"./z2-kYIZVeWKpfphko5Pls.js";import r from"./CVUX0FKZTmG_lNrUkIt3I.js";import l from"./BD_IM4zsefxMDfRV1RcoM.js";import"./BfzzDmt2RiLmJZVfcg9BD.js";import"./CHSiLyzyFXCI1vlnTHxLQ.js";import"./BHR_E30JFALbpiL80jiU2.js";import"./BlrroQs9l0thMZABoksCJ.js";import"./BL9dUyJlbPDUW1dvFHbSh.js";import"./Cwc5Fkf4CO55m2V60HDn6.js";/* empty css */import"./B5fb8ITR-4qV4a5gN_vIP.js";/* empty css */import"./B3ofwaRctflPf-IBO8dRg.js";import"./Bc4US-ot8ZP2T-MCyGQm3.js";import"./CLiT59kNjOZeib1THZBM-.js";import"./CIpdRhfiXBSWbRz-2W63r.js";import"./DfjbUWDNlMnDXVpDaxvye.js";import"./DEgv3bW2ZlSonDnEpkKOb.js";import"./DKH85ULOfjf3Da7FilGdw.js";import"./CwUlqFR9Tc9kgKWCzRlE-.js";import"./DMpOXg_SNv6ei_SFX_jrX.js";import"./l-jgK5g1z2RCJO6grM3_t.js";/* empty css */const d="MANAGE_PAYMENT_SLIP",_=({onClick:_})=>{const[m,u]=s.useState([]),[p,f]=s.useState([]),[j,h]=s.useState([]),[y,N]=s.useState([]),[S,g]=s.useState(!1),[x,v]=s.useState(!1),[w,b]=s.useState(!1),[A,T]=s.useState(0),[E,k]=s.useState(!1),M=s.useRef(null),{control:O,watch:C,setValue:I,getValues:L,reset:P,formState:{errors:F}}=n(),D=C("session_id"),R=C("class_id"),Y=C("student_name");s.useEffect(()=>{G(),W(),U()},[]),s.useEffect(()=>{const s=setTimeout(()=>{D&&R&&H()},300);return()=>clearTimeout(s)},[D,R,C("section_id"),Y]);const U=async()=>{try{k(!0);const{data:s}=await e.get(t,"/user-preference/table-filters",{tableId:d}
1),i=s?.data?.filters||[];let a=!1;for(const e of i){const s=e.filter_value?.[0]??e.filter_value;if(s)switch(e.filter_key){case"session_id":const e=m.find(e=>e.value==s);e&&(I("session_id",e),a=!0);break;case"class_id":I("class_id",s),B(s,L("session_id"));break;case"section_id":I("section_id",s);break;case"student_name":I("student_name",s)}}if(!a&&m.length>0){const s=m.find(s=>s.is_current);s&&(I("session_id",s),setTimeout(()=>V(L()),100))}const n=L();n.session_id&&n.class_id&&setTimeout(H,100)}catch(s){}finally{k(!1)}},V=async s=>{try{const i=[{filter_type:"select",filter_key:"session_id",filter_value:s.session_id?s.session_id:"",is_active:!0},{filter_type:"select",filter_key:"class_id",filter_value:s.class_id?s.class_id:"",is_active:!0},{filter_type:"select",filter_key:"section_id",filter_value:s.section_id?s.section_id:"",is_active:!0},{filter_type:"text",filter_key:"student_name",filter_value:s.student_name||"",is_active:!0}];await e.post(t,"/user-preference/table-filters",{tableId:d,filters:i})}catch(i){}},G=async()=>{try{const{data:s}=await e.get(t,"/common/getSessionsOptions"),i=s.data?.sessionsOp||[];u(i);const a=s.data?.currentSession;a&&!L().session_id&&I("session_id",a),H(!1)}catch(s){}},W=async()=>{try{const{data:s}=await e.get(t,"/common/getClassesOptions");f(s.data||[])}catch(s){}},B=async(s,i)=>{if(s?.value&&i?.value)try{const{data:a}=await e.get(t,"/common/getSectionsOptions",{class_id:s.value,session_id:i.value});a.data.classWithNoSection?(g(!1),h([])):(g(!0),h(a.data.sectionsOp||[]))}catch(a){g(!1),h([])}},H=async(s=!1)=>{const i=L();if(i.session_id?.value){v(!0);try{const a={session_id:i.session_id.value,limit:20,skip:s?A:0};i.class_id&&(a.class_id=i.class_id.value),i.section_id&&(a.section_id=i.section_id.value),i.student_name?.trim()&&(a.student_name=i.student_name.trim());const n=await e.get(t,"/accounts/getStudentForFeePayment",a),o=n?.data?.data||[];N(s?s=>[...s,...o]:o||[]),b(20===o?.length),T(s=>s+20)}catch(a){N([])}finally{v(!1)}}else N([])},K=()=>{const s=L();return{session_id:s.session_id,class_id:s.class_id,section_id:s.section_id,student_name:s.student_name}};return i.jsx("div",{className:"sc-cstm-section-sm sc-main-page",children:i.jsx(r,{id:d,list:y,itemKey:s=>s.id,loader:(x||E)&&0===y.length,hasMore:w,next:()=>H(!0),title:"Student List",subtitle:"Student Fee Payment List",countLabel:`${y.length} STUDENT LISTED`,toolbarActions:i.jsx("div",{className:"header-sectio flex-wrap gap-8",children:i.jsx("div",{className:"content-head-right d-flex flex-wrap gap-8 justify-content-end ms-auto",children:i.jsx(a,{message:"Filter Options",children:i.jsx("button",{className:"icon-btn-lg icon-btn-primary-light",onClick:()=>M.current?.togglePopup?.(),children:i.jsx("i",{className:"ri-filter-line"})})})})}),filters:i.jsx(l,{ref:M,id:d,control:O,options:{session_id:m,class_id:p,section_id:j,student_name:[]},isLoading:E,onFilterChange:(s,e)=>{I(s,e),V(L()),"class_id"===s&&e&&B(e,D)},onReset:()=>{P({session_id:L("session_id"),class_id:null,section_id:null,student_name:""}),h([]),g(!1),N([]);const s=m.find(s=>s.is_current);s&&setTimeout(()=>{I("session_id",s)},100),V(L()),H()},formValues:L()}),renderRow:s=>({STUDENT_NAME:i.jsxs("div",{className:"fee-row__student",children:[i.jsx("span",{className:"fee-row__avatar",children:(s.student_name||"S").trim().charAt(0).toUpperCase()}),i.jsx("span",{className:"text-ellipsis",children:s.student_name||"N/A"})]}),CLASS_NAME:i.jsx("span",{className:"fee-row__roll",children:s.class_name}),SECTION_NAME:i.jsx("span",{className:"fee-row__roll",children:s.section_name||"NA"}),ADMISSION_TYPE:i.jsx("span",{className:"fee-row__roll",children:"Yes"==s.is_readmission?"Re Admission":"New Admission"}),MODE_OF_PAYMENT:s.last_payment_date?i.jsxs("span",{className:"fee-row__student-name",children:[o(s.last_payment_date)," ",c(s.mode_of_payment)||"Cash"]}):i.jsx("span",{className:"fee-row__student-name",children:"Initial payment pending"}),FEE_SLIP:s.is_payment_done?i.jsx("button",{className:"sc-btn-xs sc-btn--primary px-2 sc-white-nowrap",onClick:()=>_({student:s,filters:K()}),children:"Generate Slip"}):i.jsx("span",{className:"badge bg-danger",children:"NA"})}),noDataMessage:D&&R?"No students found for the selected criteria":"Please select session and class to view students"})})};export{_ 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.