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.217.26.8
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/SelectQpSetter-B_UaaTUT.js |
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-C8M3lyNu.js";import{I as K}from"./index-Dcs-UC-W.js";import{g as X,a as Z,d as ee}from"./UploadQpPattern-kidoxO1-.js";import{a as te,t as ae,u as se,f as ne}from"./sem-xL-Ac5nH.js";import{g as T,s as w}from"./datatable-Pcc3qusZ.js";import{S as le}from"./index-Bhb34QNg.js";import{R as oe}from"./SaveOutlined-CtFciPoQ.js";import{R as re}from"./HomeOutlined-C5ZSuxRe.js";import{R as I,C as b}from"./row-B_crsxDb.js";import{F as ie,C as q}from"./Table-CCr-bhsx.js";import"./responsiveObserver-iG098kB7.js";import"./index-C1EEZ13m.js";const de=(...n)=>async(d,p)=>{try{let m=localStorage.getItem("dbname");d({type:"SET_LOADER"});const i=await C.get("app.php?a=getSelectedQpSetters&db="+m+"°grp="+n[0]+"&board="+n[1]+"&qpcode="+n[2]+"&type="+n[3]);if(d({type:"UNSET_LOADER"}),i.data.error_code===0){const x=i.data.data.data.map((o,h)=>({...o,key:h,fslno:h+1}));d({type:"SELECTED_QP_SETTER",payload:x}),d({type:"AVAILABLE_QP_DATA",payload:i.data.data.avl})}else d({type:"CLEAR_SELECTED_QP_SETTER",payload:[]}),d({type:"CLEAR_AVAILABLE_QP_DATA",payload:{}})}catch(m){r("error",m.message)}},ce=(n,d,p,m,i,x)=>async(o,h)=>{try{let c=localStorage.getItem("dbname");o({type:"SET_LOADER"});let u=await C.post("app.php?a=saveQpsetterDetails&db="+c,n);o({type:"UNSET_LOADER"}),u.data.error_code===0?(r("success",u.data.data.msg),d(p,m,i,x)):r("info",u.data.data.msg)}catch(c){r("error",c.message)}},pe=n=>{let d=localStorage.getItem("dbname");const[p,m]=f.useState(""),[i,x]=f.useState(""),[o,h]=f.useState(""),[c,u]=f.useState(""),[g,y]=f.useState([]),[R,A]=f.useState(!1),P=Y();f.useEffect(()=>{n.getQpDeggrp()},[]),f.useEffect(()=>{y(n.qpsetters)},[n.qpsetters]);const j=async(t,e)=>{console.log(t,e),e==="deggrp"&&(m(t),await n.getQpBoard(t),h(""),await n.getAvailableSubjects(t,"All")),e==="board"&&(x(t),await n.getAvailableSubjects(p,t)),e==="qpcode"&&h(t),e==="type"&&(u(t),A(!1))},_=async()=>{if(p==="")return r("info","Please Select Degree Group"),!1;if(i==="")return r("info","Please Select Board"),!1;if(o==="")return r("info","Please Select QP Code"),!1;if(c==="")return r("info","Please Select Type"),!1;await n.getSelectedQpSetters(p,i,o,c),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})),D=(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];P({type:"SET_LOADER"});const l=await C.post("/app.php?a=checkTemplateCode&db="+d+"&updtype="+t+"&qpcode="+o,e);console.log(l),P({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"),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 v=g;v[e].flastdate="",y([...v])}},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",...T("fteachcode","teach. code"),sorter:(t,e)=>w(t,e,"fteachcode"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{title:"Teach. Name",dataIndex:"fteachname",...T("fteachname","teach name"),sorter:(t,e)=>w(t,e,"fteachname"),sortDirections:["descend","ascend"],width:"12%"},{title:"Teacher Email ID",dataIndex:"femail",...T("femail","email"),sorter:(t,e)=>w(t,e,"femail"),sortDirections:["descend","ascend"],width:"12%"},{title:"Mobile No.",dataIndex:"fmobile",...T("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=>D(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=>D(a,e,"maxqn")}),align:"center",hidden:c!=="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=>D(a,e,"email")}),align:"center",width:"5%"},{title:"Select",render:(t,e)=>s.jsx(q,{checked:e.status=="T",onChange:a=>D(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",p),a.append("board",i),a.append("qpcode",o),a.append("collcode",n.user.fcollcode),a.append("mobile",n.user.fmobile),a.append("type",c),a.append("data",JSON.stringify(t)),await n.saveQPSetterDetails(a,n.getSelectedQpSetters,p,i,o,c)};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:p,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:i,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:c,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.tmpcode,"stats"),{deggrp:n.deggrp,board:n.board,qpcode:n.availableSubjects,qpsetters:n.qpsetters,avlQpCount:n.avlQpCount,user:n.loginfo.userData}),Ee=V(ge,{getQpDeggrp:X,getQpBoard:Z,getSelectedQpSetters:de,saveQPSetterDetails:ce,getAvailableSubjects:ee})(pe);export{Ee as default};
|