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.144.6.9
import{v as k,E as y,x as L,r as c,t as a,D as _,B as j,L as P,G as f}from"./index-CYIKbhnb.js";import{I as T}from"./index-Dq1ZM93s.js";import{a as N,t as H,f as D}from"./sem-Dd1ri5Qb.js";import{g as Q,a as z,d as U}from"./UploadQpPattern-tIwNgfKP.js";import{S as G}from"./index-D47VtnHA.js";import{R as $}from"./SaveOutlined-D_5Y2b5I.js";import{R as J}from"./HomeOutlined-CvmI8okJ.js";import{R as E,C as u}from"./row-Dqg1Zeqa.js";import{F as Y}from"./Table-D14CbZ5x.js";import{C as w}from"./index-D-2byGsL.js";import"./responsiveObserver-DfClcaWx.js";import"./index-CBvvA-3u.js";import"./index-C_kgUC9x.js";const K=(...s)=>async(o,m)=>{try{const l=m();let h=localStorage.getItem("dbname");o({type:"SET_LOADER"});const n=await k.get("app.php?a=getAssignModeratorDetails&db="+h+"&board="+s[1]+"&qpcode="+s[2]+"°grp="+s[0]+"&qptype="+s[3]+"&fuser="+l.loginfo.userData.fregno);if(o({type:"UNSET_LOADER"}),n.data.error_code===0){const b=n.data.data.mod.map((p,i)=>({...p,key:i,fslno:i+1})),x=n.data.data.teach.map((p,i)=>({key:i,value:p.fteachcode,label:p.fteachname+" ["+p.fteachcode+"]"}));o({type:"MOD_DETAILS",payload:b}),o({type:"TEACHER_DETAILS",payload:x})}else o({type:"MOD_DETAILS",payload:[]}),o({type:"TEACHER_DETAILS",payload:[]})}catch(l){y("error",l.message)}},V=s=>async(o,m)=>{try{const l=m();let h=localStorage.getItem("dbname");o({type:"SET_LOADER"});const n=await k.post("app.php?a=saveAssignModerator&db="+h,s);o({type:"UNSET_LOADER"}),n.data.error_code===0?y("success",n.data.data.msg):y("info",n.data.data.msg)}catch(l){y("error",l.message)}},W=s=>{const[o,m]=c.useState(""),[l,h]=c.useState("All"),[n,b]=c.useState("All"),[x,p]=c.useState("THEORY"),[i,A]=c.useState([]),[C,v]=c.useState(!1);c.useEffect(()=>{s.getQpDeggrp()},[]),c.useEffect(()=>{A(s.getAssignMod)},[s.getAssignMod]);const S=async(e,t)=>{console.log(e,t),t==="deggrp"&&(m(e),b(""),await s.getQpBoard(e),await s.getAvailableSubjects(e,"All")),t==="board"&&(h(e),await s.getAvailableSubjects(o,e)),t==="qpcode"&&b(e),t==="type"&&p(e)},M=async()=>{if(o==="")return y("info","Please Select Degree Group"),!1;await s.getAssignModeratorDetails(o,l,n,x),v(!0)},I=s.deggrp.map(e=>({key:e.fdeggrp,label:e.fdescpn,value:e.fdeggrp})),q=s.board.map(e=>({key:e.fboardcode,label:e.fboardname,value:e.fboardcode})),R=[...N,...q],F=s.qpcode.map(e=>({key:e.fqpcode,label:e.fsubname+" ["+e.fqpcode+"]",value:e.fqpcode})),g=(e,t,r)=>{const d=i;d[t.key][r]=e,d[t.key].onchange="T",A([...d])},O=[{title:"Sl. No",dataIndex:"fslno",align:"center",width:"5%"},{title:"QP Code",dataIndex:"fqpcode",align:"center",width:"9%"},{title:"Subject Name",dataIndex:"fsubname",width:"19%"},{title:"QP Count",dataIndex:"fset",align:"center",width:"5%"},{title:"Uploaded Count",dataIndex:"uploaded",align:"center",width:"5%"},{title:"Moderator",render:(e,t)=>a.jsx(f,{size:"mini",showSearch:!0,optionFilterProp:"label",style:{width:"100%"},value:t.fteachcode,options:s.teachers,onChange:r=>g(r,t,"fteachcode")}),width:"19%"},{title:"From Date",render:(e,t)=>a.jsx(T,{style:{height:"35px"},formatChars:D,className:"date-input",mask:"ed/nm/zyyy",value:t.ffromdate,onChange:r=>g(r.target.value,t,"ffromdate"),placeholder:"dd/mm/yyyy"}),width:"14%"},{title:"To Date",render:(e,t)=>a.jsx(T,{style:{height:"35px"},formatChars:D,className:"date-input",mask:"ed/nm/zyyy",value:t.ftodate,onChange:r=>g(r.target.value,t,"ftodate"),placeholder:"dd/mm/yyyy"}),align:"center",width:"14%"},{title:"Allow Login?",render:(e,t)=>a.jsx(w,{checked:t.fstatus==="T",onChange:r=>{let d=r.target.checked?"T":"F";g(d,t,"fstatus")}}),align:"center",width:"5%"},{title:"Send Email",render:(e,t)=>a.jsx(w,{checked:t.emailstatus==="T",onChange:r=>{let d=r.target.checked?"T":"F";g(d,t,"emailstatus")}}),align:"center",width:"5%"},{title:"Delete?",render:(e,t)=>a.jsx(w,{checked:t.fdeleted==="T",onChange:r=>{let d=r.target.checked?"T":"F";g(d,t,"fdeleted")}}),align:"center",width:"5%"}],B=async()=>{const e=i.filter(r=>r.onchange==="T"),t=new FormData;t.append("user",s.user.fmobile),t.append("univcode",s.user.funivcode),t.append("exam",o),t.append("board",l),t.append("qpcode",n),t.append("qptype",x),t.append("data",JSON.stringify(e)),await s.saveAssignModerator(t)};return a.jsxs(_,{style:{margin:"6rem 10px 10px"},title:a.jsx("h6",{children:"Assign Moderator"}),extra:a.jsxs(G,{children:[a.jsxs(j,{type:"primary",onClick:()=>B(),children:[a.jsx($,{})," Save"]}),a.jsx(P,{to:"/",children:a.jsxs(j,{type:"primary",danger:!0,children:[a.jsx(J,{})," Exit"]})})]}),children:[a.jsxs(E,{gutter:16,children:[a.jsxs(u,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[a.jsx("label",{children:"Exam"}),a.jsx(f,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:o,options:I,onChange:e=>S(e,"deggrp")})]}),a.jsxs(u,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[a.jsx("label",{children:"Board"}),a.jsx(f,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:l,options:R,onChange:e=>S(e,"board")})]}),a.jsxs(u,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[a.jsx("label",{children:"Subject"}),a.jsx(f,{showSearch:!0,className:"ant-select-item-option-content",optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:n,options:F,onChange:e=>S(e,"qpcode")})]})]}),a.jsxs(E,{gutter:16,children:[a.jsxs(u,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[a.jsx("label",{children:"Type"}),a.jsx(f,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:x,options:H,onChange:e=>S(e,"type")})]}),a.jsxs(u,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[a.jsx("p",{style:{marginTop:"20px"}}),a.jsx(j,{type:"primary",style:{marginBottom:"10px"},onClick:()=>M(),children:"Submit"})]})]}),C&&a.jsx(Y,{dataSource:i,columns:O,scroll:{x:1300,y:300},size:"small"})]})},X=s=>({deggrp:s.deggrp,board:s.board,qpcode:s.availableSubjects,user:s.loginfo.userData,getAssignMod:s.getAssignMod,teachers:s.teachers}),ge=L(X,{getQpDeggrp:Q,getQpBoard:z,getAvailableSubjects:U,getAssignModeratorDetails:K,saveAssignModerator:V})(W);export{ge as default};
|