0xV3NOMx
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 : 3.142.198.108


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/SelectQpSetter-DwBltJM_.js

import{v as C,E as r,x as V,r as f,H as Y,t as n,D as J,B as k,L as W,G as S,F as Q}from"./index-BXGyQmrS.js";import{I as K}from"./index-BxW5xLek.js";import{g as X,a as Z,d as ee}from"./UploadQpPattern-CIkhe3Gb.js";import{a as te,t as ae,u as se,f as ne}from"./sem-CXAFzSxe.js";import{g as D,s as w}from"./datatable-B_gJiGAM.js";import{S as le}from"./index-Dmdyjymp.js";import{R as oe}from"./SaveOutlined-C0Uip7qI.js";import{R as re}from"./HomeOutlined-DXLVvpRw.js";import{R as I,C as b}from"./row-BC5PwUrl.js";import{F as ie}from"./Table-CVDZw6UV.js";import{C as q}from"./index-BjgvK_nI.js";import"./responsiveObserver-BnSpyoMt.js";import"./index-BLFlp97X.js";import"./index-DA_qcuNc.js";const de=(...s)=>async(p,c)=>{try{let m=localStorage.getItem("dbname");p({type:"SET_LOADER"});const d=await C.get("app.php?a=getSelectedQpSetters&db="+m+"&deggrp="+s[0]+"&board="+s[1]+"&qpcode="+s[2]+"&type="+s[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=(s,p,c,m,d,x)=>async(o,h)=>{try{let i=localStorage.getItem("dbname");o({type:"SET_LOADER"});let y=await C.post("app.php?a=saveQpsetterDetails&db="+i,s);o({type:"UNSET_LOADER"}),y.data.error_code===0?(r("success",y.data.data.msg),p(c,m,d,x)):r("info",y.data.data.msg)}catch(i){r("error",i.message)}},ce=s=>{let p=localStorage.getItem("dbname");const[c,m]=f.useState(""),[d,x]=f.useState("All"),[o,h]=f.useState(""),[i,y]=f.useState(""),[g,u]=f.useState([]),[R,v]=f.useState(!1),A=Y();f.useEffect(()=>{s.getQpDeggrp()},[]),f.useEffect(()=>{if(s.user.funivcode=="030"){const t=s.qpsetters.map(e=>({...e,fpretype:"online"}));u(t)}else u(s.qpsetters)},[s.qpsetters]);const j=async(t,e)=>{e==="deggrp"&&(m(t),await s.getQpBoard(t),h(""),await s.getAvailableSubjects(t,"All")),e==="board"&&(x(t),await s.getAvailableSubjects(c,t)),e==="qpcode"&&h(t),e==="type"&&y(t),v(!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 s.getSelectedQpSetters(c,d,o,i),v(!0)},L=s.deggrp.map(t=>({key:t.fdeggrp,label:t.fdescpn,value:t.fdeggrp})),B=s.board.map(t=>({key:t.fboardcode,label:t.fboardname,value:t.fboardcode})),O=[...te,...B],F=s.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",u(l)},N=async(t,e)=>{let a=[...g];A({type:"SET_LOADER"});const l=await C.post("/app.php?a=checkTemplateCode&db="+p+"&updtype="+t+"&qpcode="+o+"&type="+i,e);console.log(l),A({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=""),u([...a])},H=(t,e)=>{const a=[...g];a[e].flastdate=t.target.value,a[e].onchange="T",u([...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="",u([...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,console.log(t)},$=[{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)=>n.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)=>n.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)=>n.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)=>n.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)=>n.jsx(S,{disabled:s.user.funivcode=="030",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)=>n.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)=>n.jsx(q,{checked:e.emailstatus==="T",onChange:a=>T(a,e,"email")}),align:"center",width:"5%"},{title:"Select",render:(t,e)=>n.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",s.user.fregno),a.append("univcode",s.user.funivcode),a.append("deggrp",c),a.append("board",d),a.append("qpcode",o),a.append("collcode",s.user.fcollcode),a.append("mobile",s.user.fmobile),a.append("type",i),a.append("data",JSON.stringify(t)),await s.saveQPSetterDetails(a,s.getSelectedQpSetters,c,d,o,i)};return n.jsxs(J,{style:{margin:"6rem 10px 10px"},title:n.jsx("h6",{children:"Select QP Setter"}),extra:n.jsxs(le,{children:[n.jsxs(k,{type:"primary",onClick:G,children:[n.jsx(oe,{})," Save"]}),n.jsx(W,{to:"/dashboard",children:n.jsxs(k,{type:"primary",danger:!0,children:[n.jsx(re,{})," Exit"]})})]}),children:[n.jsxs(I,{gutter:16,children:[n.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Exam"}),n.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:c,options:L,onChange:t=>j(t,"deggrp")})]}),n.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Board"}),n.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:d,options:O,onChange:t=>j(t,"board")})]}),n.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Subject"}),n.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")})]})]}),n.jsxs(I,{gutter:16,children:[n.jsxs(b,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Type"}),n.jsx(S,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:i,options:ae,onChange:t=>j(t,"type")})]}),n.jsxs(b,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[n.jsx("p",{style:{marginTop:"20px"}}),n.jsx(k,{type:"primary",style:{marginBottom:"10px"},onClick:()=>_(),children:"Submit"})]})]}),R&&n.jsx(ie,{style:{marginTop:"20px"},dataSource:g,size:"small",scroll:{y:300,x:1300},bordered:!0,columns:$})]})},ge=s=>(console.log(s.tmpcode,"stats"),{deggrp:s.deggrp,board:s.board,qpcode:s.availableSubjects,qpsetters:s.qpsetters,avlQpCount:s.avlQpCount,user:s.loginfo.userData}),Ce=V(ge,{getQpDeggrp:X,getQpBoard:Z,getSelectedQpSetters:de,saveQPSetterDetails:pe,getAvailableSubjects:ee})(ce);export{Ce as default};