Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.219.107.243
import{v as C,E as r,x as V,r as f,H as Y,t as s,D as J,B as k,L as W,G as S,F as Q}from"./index-DbuAcQXx.js";import{I as K}from"./index-CB0aEnJO.js";import{g as X,a as Z,d as ee}from"./UploadQpPattern-BDUWRZB2.js";import{a as te,t as ae,u as se,f as ne}from"./sem-BK69X1ab.js";import{g as D,s as w}from"./datatable-DpkPs_9K.js";import{S as le}from"./index-BAPoK_Ga.js";import{R as oe}from"./SaveOutlined-huZckol9.js";import{R as re}from"./HomeOutlined-kj8lKMKk.js";import{R as I,C as b}from"./row-DpP_e2pJ.js";import{F as ie}from"./Table-WszsqUiE.js";import{C as q}from"./index-D-tKmmVD.js";import"./responsiveObserver-DPqhCh2n.js";import"./index-B9avJFOk.js";import"./index-DJSdY4DS.js";const de=(...n)=>async(p,c)=>{try{let m=localStorage.getItem("dbname");p({type:"SET_LOADER"});const d=await C.get("app.php?a=getSelectedQpSetters&db="+m+"°grp="+n[0]+"&board="+n[1]+"&qpcode="+n[2]+"&type="+n[3]);if(p({type:"UNSET_LOADER"}),d.data.error_code===0){const x=d.data.data.data.map((o,h)=>({...o,key:h,fslno:h+1,emailstatus:"T"}));p({type:"SELECTED_QP_SETTER",payload:x}),p({type:"AVAILABLE_QP_DATA",payload:d.data.data.avl})}else p({type:"CLEAR_SELECTED_QP_SETTER",payload:[]}),p({type:"CLEAR_AVAILABLE_QP_DATA",payload:{}})}catch(m){r("error",m.message)}},pe=(n,p,c,m,d,x)=>async(o,h)=>{try{let i=localStorage.getItem("dbname");o({type:"SET_LOADER"});let u=await C.post("app.php?a=saveQpsetterDetails&db="+i,n);o({type:"UNSET_LOADER"}),u.data.error_code===0?(r("success",u.data.data.msg),p(c,m,d,x)):r("info",u.data.data.msg)}catch(i){r("error",i.message)}},ce=n=>{let p=localStorage.getItem("dbname");const[c,m]=f.useState(""),[d,x]=f.useState("All"),[o,h]=f.useState(""),[i,u]=f.useState(""),[g,y]=f.useState([]),[R,A]=f.useState(!1),v=Y();f.useEffect(()=>{n.getQpDeggrp()},[]),f.useEffect(()=>{y(n.qpsetters)},[n.qpsetters]);const j=async(t,e)=>{e==="deggrp"&&(m(t),await n.getQpBoard(t),h(""),await n.getAvailableSubjects(t,"All")),e==="board"&&(x(t),await n.getAvailableSubjects(c,t)),e==="qpcode"&&h(t),e==="type"&&u(t),A(!1)},_=async()=>{if(c==="")return r("info","Please Select Degree Group"),!1;if(d==="")return r("info","Please Select Board"),!1;if(o==="")return r("info","Please Select QP Code"),!1;if(i==="")return r("info","Please Select Type"),!1;await n.getSelectedQpSetters(c,d,o,i),A(!0)},L=n.deggrp.map(t=>({key:t.fdeggrp,label:t.fdescpn,value:t.fdeggrp})),B=n.board.map(t=>({key:t.fboardcode,label:t.fboardname,value:t.fboardcode})),O=[...te,...B],F=n.qpcode.map(t=>({key:t.fqpcode,label:t.fsubname,value:t.fqpcode})),T=(t,e,a)=>{const l=[...g];a==="fassign"?/^[1-9]*$/.test(t.target.value)&&(l[e.key].fassign=t.target.value,l[e.key].fassignTotal=parseInt(t.target.value)+parseInt(e.totalsets),l[e.key].fassignPending=parseInt(t.target.value)+parseInt(e.setspending)):a==="email"?l[e.key].emailstatus=t.target.checked?"T":"F":a==="select"?l[e.key].status=t.target.checked?"T":"F":a==="maxqn"&&(l[e.key].fmaxqn=t.target.value),l[e.key].onchange="T",y(l)},N=async(t,e)=>{let a=[...g];v({type:"SET_LOADER"});const l=await C.post("/app.php?a=checkTemplateCode&db="+p+"&updtype="+t+"&qpcode="+o+"&type="+i,e);v({type:"UNSET_LOADER"}),l.data.data.FQPPATREN==""&&t==="upload"?(r("info","QP Pattren and Syllabus not found for this QP Code "+o),a[e.key].fpretype=""):l.data.data.ftempcode==""&&t==="online"?(r("info","Template not found for this QP Code "+o),a[e.key].ftmpcode="",a[e.key].fpretype=""):(a[e.key].ftmpcode=l.data.data.ftempcode,a[e.key].fpretype=t,a[e.key].onchange="T"),l.data.data.fonlineqp==""&&t==="online"&&i==="MCQ"&&(r("info",o+" qp code is not belongs to mcq"),a[e.key].fpretype=""),y([...a])},H=(t,e)=>{const a=[...g];a[e].flastdate=t.target.value,a[e].onchange="T",y([...a])},M=(t,e)=>{let a=new Date,l=t.split("/"),E=new Date(l[2],l[1]-1,l[0]);if(E<a&&!z(E,a)){r("info","Enter vaild date");const P=g;P[e].flastdate="",y([...P])}},z=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),U=t=>{const e=[...g];e[t.key].oldpendingstats=e[t.key].setspending},$=[{title:"Sl. No",dataIndex:"fslno",align:"center",width:"5%"},{title:"Teach. Code",dataIndex:"fteachcode",...D("fteachcode","teach. code"),sorter:(t,e)=>w(t,e,"fteachcode"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{title:"Teach. Name",dataIndex:"fteachname",...D("fteachname","teach name"),sorter:(t,e)=>w(t,e,"fteachname"),sortDirections:["descend","ascend"],width:"12%"},{title:"Teacher Email ID",dataIndex:"femail",...D("femail","email"),sorter:(t,e)=>w(t,e,"femail"),sortDirections:["descend","ascend"],width:"12%"},{title:"Mobile No.",dataIndex:"fmobile",...D("fmobile","mobile"),sorter:(t,e)=>w(t,e,"fmobile"),sortDirections:["descend","ascend"],align:"center",width:"10%"},{title:"Total Sets",render:(t,e)=>s.jsx("span",{children:e.fassign==""||e.fassign==null?e.totalsets:parseInt(e.fassign)+parseInt(e.totalsets)}),align:"center",width:"5%"},{title:"Sets Done",dataIndex:"setsdone",align:"center",width:"5%"},{title:"Pending Sets",render:(t,e)=>s.jsx("span",{children:e.fassign==""||e.fassign==null?e.setspending:parseInt(e.fassign)+parseInt(e.setspending)}),dataIndex:"setspending",align:"center",width:"5%"},{title:"No. of Sets",render:(t,e)=>s.jsx(Q,{value:e.fassign,maxLength:1,style:{textAlign:"center"},onChange:a=>T(a,e,"fassign"),onBlur:()=>U(e)}),align:"center",width:"5%"},{title:"No. of Qn.",render:(t,e)=>s.jsx(Q,{size:"mini",value:e.fmaxqn,style:{textAlign:"center"},onChange:a=>T(a,e,"maxqn")}),align:"center",hidden:i!=="MCQ"&&!0,width:"5%"},{title:"Pre. type",render:(t,e)=>s.jsx(S,{size:"mini",value:e.fpretype,options:se,style:{width:"100%"},onChange:a=>N(a,e)}),align:"center",width:"8%"},{title:"On or Before Date",render:(t,e)=>s.jsx(K,{formatChars:ne,style:{height:"35px"},className:"date-input",mask:"ed/nm/zyyy",value:e.flastdate,onChange:a=>H(a,e.key),onBlur:()=>M(e.flastdate,e.key),placeholder:"dd/mm/yyyy"}),align:"center",width:"10%"},{title:"Send Email?",render:(t,e)=>s.jsx(q,{checked:e.emailstatus==="T",onChange:a=>T(a,e,"email")}),align:"center",width:"5%"},{title:"Select",render:(t,e)=>s.jsx(q,{checked:e.status=="T",onChange:a=>T(a,e,"select")}),align:"center",width:"5%"}],G=async()=>{let t=g.filter(l=>l.onchange=="T"&&l.flastdate!=="");if(g.filter(l=>l.onchange=="T"&&l.flastdate=="").length!==0){r("Info","Please Enter Last Date");return}const a=new FormData;a.append("user",n.user.fregno),a.append("univcode",n.user.funivcode),a.append("deggrp",c),a.append("board",d),a.append("qpcode",o),a.append("collcode",n.user.fcollcode),a.append("mobile",n.user.fmobile),a.append("type",i),a.append("data",JSON.stringify(t)),await n.saveQPSetterDetails(a,n.getSelectedQpSetters,c,d,o,i)};return s.jsxs(J,{style:{margin:"6rem 10px 10px"},title:s.jsx("h6",{children:"Select QP Setter"}),extra:s.jsxs(le,{children:[s.jsxs(k,{type:"primary",onClick:G,children:[s.jsx(oe,{})," Save"]}),s.jsx(W,{to:"/dashboard",children:s.jsxs(k,{type:"primary",danger:!0,children:[s.jsx(re,{})," Exit"]})})]}),children:[s.jsxs(I,{gutter:16,children:[s.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[s.jsx("label",{children:"Exam"}),s.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:c,options:L,onChange:t=>j(t,"deggrp")})]}),s.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[s.jsx("label",{children:"Board"}),s.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:d,options:O,onChange:t=>j(t,"board")})]}),s.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[s.jsx("label",{children:"Subject"}),s.jsx(S,{showSearch:!0,className:"ant-select-item-option-content",optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:o,options:F,onChange:t=>j(t,"qpcode")})]})]}),s.jsxs(I,{gutter:16,children:[s.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[s.jsx("label",{children:"Type"}),s.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:i,options:ae,onChange:t=>j(t,"type")})]}),s.jsxs(b,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[s.jsx("p",{style:{marginTop:"20px"}}),s.jsx(k,{type:"primary",style:{marginBottom:"10px"},onClick:()=>_(),children:"Submit"})]})]}),R&&s.jsx(ie,{style:{marginTop:"20px"},dataSource:g,size:"small",scroll:{y:300,x:1300},bordered:!0,columns:$})]})},ge=n=>(console.log(n.qpsetters),{deggrp:n.deggrp,board:n.board,qpcode:n.availableSubjects,qpsetters:n.qpsetters,avlQpCount:n.avlQpCount,user:n.loginfo.userData}),Ce=V(ge,{getQpDeggrp:X,getQpBoard:Z,getSelectedQpSetters:de,saveQPSetterDetails:pe,getAvailableSubjects:ee})(ce);export{Ce as default};
|