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.217.26.8


Current Path : /proc/thread-self/root/var/www/qpms/assets/
Upload File :
Current File : //proc/thread-self/root/var/www/qpms/assets/SelectQpSetter-DaTp7MlD.js

import{v as A,E as i,x as Z,r as h,H as ee,t as n,D as te,B as D,L as ae,G as b,F as R,M as ne}from"./index-BGN0ZMlx.js";import{I as se}from"./index-C43B3qq9.js";import{g as oe,a as le,d as re}from"./UploadQpPattern-Em67LlSc.js";import{s as O,a as ie,t as de,u as ce,f as pe}from"./sem-DLpF_ddZ.js";import{f as C,g as w,s as q}from"./datatable-DO2-ZaDk.js";import{D as ge,R as fe}from"./react-datepicker-CwqgRdqs.js";import{S as me}from"./index-Cvv7jmnp.js";import{R as he}from"./StopOutlined-MY7-J1ak.js";import{R as ue}from"./SaveOutlined-CMdc2l5p.js";import{R as xe}from"./HomeOutlined-D4-Nsiyp.js";import{R as _,C as k}from"./row-AWds_3hu.js";import{F as ye}from"./Table-DrjpZi7U.js";import{P as Se}from"./index-D6hC5Y7U.js";import{C as B}from"./index-CRTM9snO.js";import"./responsiveObserver-lGxp52mZ.js";import"./index-cLl6_n2r.js";import"./index-BzT3oaCy.js";const be=(...o)=>async(g,f)=>{try{let u=localStorage.getItem("dbname");g({type:"SET_LOADER"});const c=await A.get("app.php?a=getSelectedQpSetters&db="+u+"&deggrp="+o[0]+"&board="+o[1]+"&qpcode="+o[2]+"&type="+o[3]);if(g({type:"UNSET_LOADER"}),c.data.error_code===0){const y=c.data.data.data.map((r,x)=>({...r,key:x,fslno:x+1,emailstatus:"T"}));g({type:"SELECTED_QP_SETTER",payload:y}),g({type:"AVAILABLE_QP_DATA",payload:c.data.data.avl})}else g({type:"CLEAR_SELECTED_QP_SETTER",payload:[]}),g({type:"CLEAR_AVAILABLE_QP_DATA",payload:{}})}catch(u){i("error",u.message)}},ke=(o,g,f,u,c,y)=>async(r,x)=>{try{let d=localStorage.getItem("dbname");r({type:"SET_LOADER"});let S=await A.post("app.php?a=saveQpsetterDetails&db="+d,o);r({type:"UNSET_LOADER"}),S.data.error_code===0?(i("success",S.data.data.msg),g(f,u,c,y)):i("info",S.data.data.msg)}catch(d){i("error",d.message)}},Te=o=>{let g=localStorage.getItem("dbname");const[f,u]=h.useState("Select"),[c,y]=h.useState("All"),[r,x]=h.useState("Select"),[d,S]=h.useState("THEORY"),[m,p]=h.useState([]),[L,E]=h.useState(!1),[De,P]=h.useState(!1),v=ee();h.useEffect(()=>{o.getQpDeggrp()},[]),h.useEffect(()=>{p(o.qpsetters)},[o.qpsetters]);const T=async(t,e)=>{e==="deggrp"&&(u(t),await o.getQpBoard(t),x("Select"),await o.getAvailableSubjects(t,"All")),e==="board"&&(y(t),await o.getAvailableSubjects(f,t)),e==="qpcode"&&x(t),e==="type"&&S(t),E(!1)},F=async()=>{if(f==="Select")return i("info","Please Select Degree Group"),!1;if(c==="")return i("info","Please Select Board"),!1;if(r==="Select")return i("info","Please Select QP Code"),!1;if(d==="")return i("info","Please Select Type"),!1;await o.getSelectedQpSetters(f,c,r,d),E(!0)},N=[...o.deggrp.map(t=>({key:t.fdeggrp,label:t.fdescpn,value:t.fdeggrp})),...O],M=o.board.map(t=>({key:t.fboardcode,label:t.fboardname,value:t.fboardcode})),H=[...ie,...M],$=[...o.qpcode.map(t=>({key:t.fqpcode,label:t.fsubname,value:t.fqpcode})),...O],j=(t,e,s)=>{const a=[...m];s==="fassign"?(/^[1-9]*$/.test(t.target.value)&&(a[e.key].fassign=t.target.value,a[e.key].fassignTotal=parseInt(t.target.value)+parseInt(e.totalsets),a[e.key].fassignPending=parseInt(t.target.value)+parseInt(e.setspending)),a[e.key].onchange="T",p(a)):s==="email"?(a[e.key].emailstatus=t.target.checked?"T":"F",a[e.key].onchange="T",p(a)):s==="select"?t.target.checked?(a[e.key].status="T",a[e.key].onchange="T",p(a)):ne.confirm({title:"Warning",content:"Do you want cancel Appointment.?",okButtonProps:{style:{backgroundColor:"#8231d3",borderColor:"#8231d3"}},okText:"Yes",cancelText:"No",onOk(){a[e.key].status="F",a[e.key].onchange="T",p(a)},onCancel(){console.log("Cancelled")}}):s==="maxqn"&&(a[e.key].fmaxqn=t.target.value,a[e.key].onchange="T",p(a))},Y=async(t,e)=>{let s=[...m];v({type:"SET_LOADER"});const a=await A.post("/app.php?a=checkTemplateCode&db="+g+"&updtype="+t+"&qpcode="+r+"&type="+d,e);if(v({type:"UNSET_LOADER"}),a.data.data.FQPPATREN==""&&t==="upload"){i("info","QP Pattren and Syllabus not found for this QP Code "+r),s[e.key].fpretype="";return}else if(a.data.data.ftempcode==""&&t==="online"){i("info","Template not found for this QP Code "+r),s[e.key].ftmpcode="",s[e.key].fpretype="";return}else s[e.key].ftmpcode=a.data.data.ftempcode,s[e.key].fpretype=t,s[e.key].onchange="T";if(a.data.data.fonlineqp==""&&t==="online"&&d==="MCQ"){i("info",r+" qp code is not belongs to mcq"),s[e.key].fpretype="";return}p([...s])},z=(t,e)=>{const s=[...m];s[e].flastdate=t.target.value,s[e].onchange="T",p([...s])},I=(t,e)=>{let s=new Date,a=t.split("/"),l=new Date(a[2],a[1]-1,a[0]);if(l<s&&!V(l,s)){i("info","Enter vaild date");const Q=m;Q[e].flastdate="",p([...Q])}},U=async(t,e)=>{P(!1);const s=new Date(t),a=G(s),l=[...m];l[e].flastdate=a,l[e].onchange="T",p([...l]),I(a,e)},G=t=>{if(!(t instanceof Date))return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}/${s}/${a}`},V=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),W=t=>{const e=[...m];e[t.key].oldpendingstats=e[t.key].setspending},J=[{title:"Sl. No",dataIndex:"fslno",align:"center",width:"3%"},{title:"Teach. Code",dataIndex:"fteachcode",...w("fteachcode","teach. code"),sorter:(t,e)=>q(t,e,"fteachcode"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{title:"Teach. Name",dataIndex:"fteachname",...w("fteachname","teach name"),sorter:(t,e)=>q(t,e,"fteachname"),sortDirections:["descend","ascend"],width:"14%"},{title:"Teacher Email ID",dataIndex:"femail",...w("femail","email"),sortDirections:["descend","ascend"],width:"14%"},{title:"Mobile No.",dataIndex:"fmobile",...w("fmobile","mobile"),sortDirections:["descend","ascend"],align:"center",width:"8%"},{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:"4%"},{title:"Sets Done",dataIndex:"setsdone",align:"center",width:"4%"},{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(R,{value:e.fassign,maxLength:1,style:{textAlign:"center"},onChange:s=>j(s,e,"fassign"),onBlur:()=>W(e)}),align:"center",width:"5%"},{title:"No. of Qn.",render:(t,e)=>n.jsx(R,{size:"mini",value:e.fmaxqn,style:{textAlign:"center"},onChange:s=>j(s,e,"maxqn")}),align:"center",hidden:d!=="MCQ"&&!0,width:"5%"},{title:"Pre. type",render:(t,e)=>n.jsx(b,{size:"mini",value:e.fpretype,options:ce,style:{width:"100%"},onChange:s=>Y(s,e)}),align:"center",width:"8%"},{title:"On or Before Date",render:(t,e)=>n.jsxs("div",{children:[n.jsx(se,{formatChars:pe,style:{height:"35px"},className:"date-input",mask:"ed/nm/zyyy",value:e.flastdate,onChange:s=>z(s,e.key),onBlur:()=>{I(e.flastdate,e.key),P(!0)},placeholder:"dd/mm/yyyy"}),n.jsx(Se,{content:n.jsx("div",{style:{padding:"5px",borderRadius:"8px"},children:n.jsx(ge,{onChange:s=>U(s,e.key),dateFormat:"dd/MM/yyyy",inline:!0,onClickOutside:()=>P(!1)})}),trigger:"click",children:n.jsx(fe,{style:{position:"absolute",top:"45%",right:"15px",transform:"translateY(-50%)",fontSize:"20px",cursor:"pointer"}})})]}),align:"center",width:"12%"},{title:"Apponited?",render:(t,e)=>n.jsx(B,{checked:e.status=="T",onChange:s=>j(s,e,"select")}),align:"center",width:"5%"},{title:"Send Email?",render:(t,e)=>n.jsx(B,{checked:e.emailstatus==="T",onChange:s=>j(s,e,"email")}),align:"center",width:"5%"}],K=async()=>{let t=m.filter(l=>l.onchange=="T"&&l.flastdate!=="");if(t.filter(l=>l.FQPPATREN=="").length!==0){i("Info","QP Pattern was not uploaded for this QP Code "+r);return}if(m.filter(l=>l.onchange=="T"&&l.flastdate==""&&l.status=="T").length!==0){i("Info","Please Enter Last Date");return}if(t.length==0){i("Info","No data to update");return}const a=new FormData;a.append("user",o.user.fregno),a.append("univcode",o.user.funivcode),a.append("deggrp",f),a.append("board",c),a.append("qpcode",r),a.append("collcode",o.user.fcollcode),a.append("mobile",o.user.fmobile),a.append("type",d),a.append("data",JSON.stringify(t)),await o.saveQPSetterDetails(a,o.getSelectedQpSetters,f,c,r,d)},X=()=>{u("Select"),y("All"),x("Select"),S("THEORY"),p([]),E(!1)};return n.jsxs(te,{style:{margin:"6rem 10px 10px"},title:n.jsx("h6",{children:"Select QP Setter"}),extra:n.jsxs(me,{children:[n.jsxs(D,{style:{background:"black",color:"white"},onClick:()=>X(),children:[n.jsx(he,{})," Clear"]}),n.jsxs(D,{type:"primary",onClick:K,children:[n.jsx(ue,{})," Save"]}),n.jsx(ae,{to:"/dashboard",children:n.jsxs(D,{type:"primary",danger:!0,children:[n.jsx(xe,{})," Exit"]})})]}),children:[n.jsxs(_,{gutter:16,children:[n.jsxs(k,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Exam"}),n.jsx(b,{filterOption:C,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:f,options:N,onChange:t=>T(t,"deggrp")})]}),n.jsxs(k,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Board"}),n.jsx(b,{filterOption:C,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:c,options:H,onChange:t=>T(t,"board")})]}),n.jsxs(k,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Subject"}),n.jsx(b,{filterOption:C,showSearch:!0,className:"ant-select-item-option-content",optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:r,options:$,onChange:t=>T(t,"qpcode")})]})]}),n.jsxs(_,{gutter:16,children:[n.jsxs(k,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[n.jsx("label",{children:"Type"}),n.jsx(b,{filterOption:C,showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:d,options:de,onChange:t=>T(t,"type")})]}),n.jsxs(k,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[n.jsx("p",{style:{marginTop:"20px"}}),n.jsx(D,{type:"primary",style:{marginBottom:"10px"},onClick:()=>F(),children:"Submit"})]})]}),L&&n.jsx(ye,{style:{marginTop:"20px"},dataSource:m,size:"small",scroll:{y:300,x:1300},bordered:!0,columns:J})]})},je=o=>({deggrp:o.deggrp,board:o.board,qpcode:o.availableSubjects,qpsetters:o.qpsetters,avlQpCount:o.avlQpCount,user:o.loginfo.userData}),Ye=Z(je,{getQpDeggrp:oe,getQpBoard:le,getSelectedQpSetters:be,saveQPSetterDetails:ke,getAvailableSubjects:re})(Te);export{Ye as default};