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.191.198.245
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/SelectQpSetter-hv0Su7wH.js |
import{v as P,E as r,x as W,r as h,H as K,t as a,D as X,B as w,L as Z,G as b,F as I}from"./index-DfEK0E8g.js";import{I as ee}from"./index-BJ6U21M4.js";import{g as te,a as ae,d as se}from"./UploadQpPattern-DOfHNZbl.js";import{s as v,a as ne,t as le,u as oe,f as re}from"./sem-DLpF_ddZ.js";import{f as k,g as D,s as q}from"./datatable-CGnYKdpq.js";import{S as ie}from"./index-Fh5tF1lB.js";import{R as de}from"./StopOutlined-DeHoYxT2.js";import{R as pe}from"./SaveOutlined-5ctPSKo6.js";import{R as ce}from"./HomeOutlined-CZtKeVIo.js";import{R,C as T}from"./row-CWrckbdU.js";import{F as ge}from"./Table-ieolh-q0.js";import{C as O}from"./index-CoCZOPj_.js";import"./responsiveObserver-D7cmz6KF.js";import"./index-C3842RPj.js";import"./index-BT78X51v.js";const fe=(...n)=>async(c,g)=>{try{let f=localStorage.getItem("dbname");c({type:"SET_LOADER"});const p=await P.get("app.php?a=getSelectedQpSetters&db="+f+"°grp="+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(f){r("error",f.message)}},me=(n,c,g,f,p,x)=>async(o,u)=>{try{let i=localStorage.getItem("dbname");o({type:"SET_LOADER"});let y=await P.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,f,p,x)):r("info",y.data.data.msg)}catch(i){r("error",i.message)}},he=n=>{let c=localStorage.getItem("dbname");const[g,f]=h.useState("Select"),[p,x]=h.useState("All"),[o,u]=h.useState("Select"),[i,y]=h.useState("THEORY"),[m,S]=h.useState([]),[_,C]=h.useState(!1),A=K();h.useEffect(()=>{n.getQpDeggrp()},[]),h.useEffect(()=>{S(n.qpsetters)},[n.qpsetters]);const j=async(t,e)=>{e==="deggrp"&&(f(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),C(!1)},L=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),C(!0)},B=[...n.deggrp.map(t=>({key:t.fdeggrp,label:t.fdescpn,value:t.fdeggrp})),...v],F=n.board.map(t=>({key:t.fboardcode,label:t.fboardname,value:t.fboardcode})),N=[...ne,...F],H=[...n.qpcode.map(t=>({key:t.fqpcode,label:t.fsubname,value:t.fqpcode})),...v],E=(t,e,s)=>{const l=[...m];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)},M=async(t,e)=>{let s=[...m];A({type:"SET_LOADER"});const l=await P.post("/app.php?a=checkTemplateCode&db="+c+"&updtype="+t+"&qpcode="+o+"&type="+i,e);if(A({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])},z=(t,e)=>{const s=[...m];s[e].flastdate=t.target.value,s[e].onchange="T",S([...s])},Y=(t,e)=>{let s=new Date,l=t.split("/"),d=new Date(l[2],l[1]-1,l[0]);if(d<s&&!$(d,s)){r("info","Enter vaild date");const Q=m;Q[e].flastdate="",S([...Q])}},$=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),U=t=>{const e=[...m];e[t.key].oldpendingstats=e[t.key].setspending},G=[{title:"Sl. No",dataIndex:"fslno",align:"center",width:"4%"},{title:"Teach. Code",dataIndex:"fteachcode",...D("fteachcode","teach. code"),sorter:(t,e)=>q(t,e,"fteachcode"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{title:"Teach. Name",dataIndex:"fteachname",...D("fteachname","teach name"),sorter:(t,e)=>q(t,e,"fteachname"),sortDirections:["descend","ascend"],width:"14%"},{title:"Teacher Email ID",dataIndex:"femail",...D("femail","email"),sortDirections:["descend","ascend"],width:"14%"},{title:"Mobile No.",dataIndex:"fmobile",...D("fmobile","mobile"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{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(I,{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(I,{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:oe,style:{width:"100%"},onChange:s=>M(s,e)}),align:"center",width:"8%"},{title:"On or Before Date",render:(t,e)=>a.jsx(ee,{formatChars:re,style:{height:"35px"},className:"date-input",mask:"ed/nm/zyyy",value:e.flastdate,onChange:s=>z(s,e.key),onBlur:()=>Y(e.flastdate,e.key),placeholder:"dd/mm/yyyy"}),align:"center",width:"9%"},{title:"Apponited?",render:(t,e)=>a.jsx(O,{checked:e.status=="T",onChange:s=>E(s,e,"select")}),align:"center",width:"5%"},{title:"Send Email?",render:(t,e)=>a.jsx(O,{checked:e.emailstatus==="T",onChange:s=>E(s,e,"email")}),align:"center",width:"5%"}],V=async()=>{let t=m.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(m.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)},J=()=>{f("Select"),x("All"),u("Select"),y("THEORY"),S([]),C(!1)};return a.jsxs(X,{style:{margin:"6rem 10px 10px"},title:a.jsx("h6",{children:"Select QP Setter"}),extra:a.jsxs(ie,{children:[a.jsxs(w,{style:{background:"black",color:"white"},onClick:()=>J(),children:[a.jsx(de,{})," Clear"]}),a.jsxs(w,{type:"primary",onClick:V,children:[a.jsx(pe,{})," Save"]}),a.jsx(Z,{to:"/dashboard",children:a.jsxs(w,{type:"primary",danger:!0,children:[a.jsx(ce,{})," Exit"]})})]}),children:[a.jsxs(R,{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,{filterOption:k,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:g,options:B,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,{filterOption:k,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:p,options:N,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,{filterOption:k,showSearch:!0,className:"ant-select-item-option-content",optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:o,options:H,onChange:t=>j(t,"qpcode")})]})]}),a.jsxs(R,{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,{filterOption:k,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:i,options:le,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(w,{type:"primary",style:{marginBottom:"10px"},onClick:()=>L(),children:"Submit"})]})]}),_&&a.jsx(ge,{style:{marginTop:"20px"},dataSource:m,size:"small",scroll:{y:300,x:1300},bordered:!0,columns:G})]})},ue=n=>(console.log(n.qpsetters),{deggrp:n.deggrp,board:n.board,qpcode:n.availableSubjects,qpsetters:n.qpsetters,avlQpCount:n.avlQpCount,user:n.loginfo.userData}),Re=W(ue,{getQpDeggrp:te,getQpBoard:ae,getSelectedQpSetters:fe,saveQPSetterDetails:me,getAvailableSubjects:se})(he);export{Re as default};
|