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


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

import{v as q,E as b,x as z,r as i,t as a,D as U,B as S,L as G,G as m}from"./index-uSLgVfkU.js";import{I as C}from"./index-s4yyblCv.js";import{a as D,t as $,p as J,f as E}from"./sem-D-kovgiG.js";import{g as Y,a as K,d as V}from"./UploadQpPattern-DE4T8IKJ.js";import{g as T}from"./datatable-CqrcmzS5.js";import{S as W}from"./index-BHm-CzQ-.js";import{R as X}from"./SaveOutlined-CwxJ9y0O.js";import{R as Z}from"./HomeOutlined-B45HDwec.js";import{R as v,C as h}from"./row-3YQ52Rbu.js";import{F as ee}from"./Table-DLJwgx-T.js";import{C as w}from"./index-eMzDZxU5.js";import"./responsiveObserver-FJfPeJjz.js";import"./index-DGKUD4BF.js";import"./index-BdGn2rsi.js";const te=(...o)=>async(l,x)=>{try{const d=x();let u=localStorage.getItem("dbname");l({type:"SET_LOADER"});const r=await q.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)}},ae=o=>async(l,x)=>{try{const d=x();let u=localStorage.getItem("dbname");l({type:"SET_LOADER"});const r=await q.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)}},oe=o=>{const[l,x]=i.useState(""),[d,u]=i.useState("All"),[r,j]=i.useState("All"),[f,c]=i.useState("THEORY"),[p,M]=i.useState("All"),[A,k]=i.useState([]),[F,O]=i.useState(!1);i.useEffect(()=>{o.getQpDeggrp()},[]),i.useEffect(()=>{k(o.getAssignMod)},[o.getAssignMod]);const y=async(e,t)=>{t==="deggrp"&&(x(e),j("All"),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"&&M(e)},I=async()=>{if(l==="")return b("info","Please Select Degree Group"),!1;await o.getAssignModeratorDetails(l,d,r,f,p),O(!0)},R=o.deggrp.map(e=>({key:e.fdeggrp,label:e.fdescpn,value:e.fdeggrp})),L=o.board.map(e=>({key:e.fboardcode,label:e.fboardname,value:e.fboardcode})),B=[...D,...L],N=o.qpcode.map(e=>({key:e.fqpcode,label:e.fsubname+" ["+e.fqpcode+"]",value:e.fqpcode})),P=[...D,...N],g=(e,t,s)=>{const n=A;n[t.key][s]=e,n[t.key].onchange="T",k([...n])},_=[{key:"All",label:"All",value:"All"},{key:"Allowed",label:"Allowed",value:"Allowed"},{key:"NotAllowed",label:"Not Allowed",value:"NotAllowed"}],H=[{title:"Sl. No",dataIndex:"fslno",align:"center",width:"5%"},{title:"QP Code",dataIndex:"fqpcode",...T("fqpcode","qpcode"),align:"center",width:"9%"},{title:"Subject Name",dataIndex:"fsubname",...T("fsubname","subname"),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")}),...T("fteachcode","teachcode"),width:"19%"},{title:"From Date",render:(e,t)=>a.jsx(C,{style:{height:"35px"},formatChars:E,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(C,{style:{height:"35px"},formatChars:E,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%"}],Q=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(U,{style:{margin:"6rem 10px 10px"},title:a.jsx("h6",{children:"Assign Moderator"}),extra:a.jsxs(W,{children:[a.jsxs(S,{type:"primary",onClick:()=>Q(),children:[a.jsx(X,{})," Save"]}),a.jsx(G,{to:"/",children:a.jsxs(S,{type:"primary",danger:!0,children:[a.jsx(Z,{})," Exit"]})})]}),children:[a.jsxs(v,{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:R,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:B,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:P,onChange:e=>y(e,"qpcode")})]})]}),a.jsxs(v,{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:$,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:_,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"})]})]}),F&&a.jsx(ee,{dataSource:A,columns:H,scroll:{x:1300,y:300},size:"small",pagination:J})]})},se=o=>({deggrp:o.deggrp,board:o.board,qpcode:o.availableSubjects,user:o.loginfo.userData,getAssignMod:o.getAssignMod,teachers:o.teachers}),be=z(se,{getQpDeggrp:Y,getQpBoard:K,getAvailableSubjects:V,getAssignModeratorDetails:te,saveAssignModerator:ae})(oe);export{be as default};