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.142.212.225
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/UploadQuestionPaper-B4_Pg-N3.js |
import{v as w,M as N,E as p,x as T,r as i,y as O,t,B as h,D as v,L as K}from"./index-B5F0d500.js";import{U as b,R as k}from"./UploadOutlined-CUZht8o3.js";import{S as z}from"./index-CFNwlapL.js";import{R as B}from"./HomeOutlined-XzFj8f3d.js";import{F as M}from"./Table-Cq_s-lOq.js";import"./index-D-OTWegR.js";import"./index-C9DwObLL.js";import"./DeleteOutlined-Dvma0WKZ.js";import"./index-B0EGZCC0.js";import"./responsiveObserver-B_OpI-E3.js";const Y=n=>async(o,c)=>{try{const y=c();let u=localStorage.getItem("dbname");o({type:"SET_LOADER"});const l=await w.get("app.php?a=getQpUploadDetails&db="+u+"&userid="+y.loginfo.userData.fregno);if(o({type:"UNSET_LOADER"}),l.data.error_code===-2)N.confirm({title:"Warning",content:"Please update bank details before you proceed, Click ok to update bank details",okButtonProps:{style:{backgroundColor:"#8231d3",borderColor:"#8231d3"}},onOk(){n("/qpsettings/bank-details")},onCancel(){console.log("Cancelled")}});else if(typeof l.data!="object")p("Error","Something Went wrong, please try again later");else if(l.data.error_code===0){let x=l.data.data.result.map((f,m)=>({...f,key:m,fslno:m+1}));o({type:"SET_QP_UPLOAD_DETAILS",payload:x}),o({type:"QP_UPD_NOTE",payload:l.data.data.fnote})}else o({type:"CLEAR_SET_QP_UPLOAD_DETAILS",payload:[]}),o({type:"CLEAR_QP_UPD_NOTE",payload:{}}),p("Info","No data found")}catch(y){console.log(y.message)}},H=(n,o)=>async(c,y)=>{try{let u=localStorage.getItem("dbname");c({type:"SET_LOADER"});const l=await w.post("app.php?a=uploadQuestionPaper&db="+u,n);c({type:"UNSET_LOADER"}),l.data.error_code===0?(p("success",l.data.data.msg),o()):p("info",l.data.data.msg)}catch(u){p("Error",u.message)}},V=n=>{const o="https://qp-scheme.s3.ap-south-1.amazonaws.com/",c="https://qp-upd.s3.ap-south-1.amazonaws.com/",[y,u]=i.useState([]),[l,x]=i.useState([]),[f,m]=i.useState([]),[g,S]=i.useState([]),[E,F]=i.useState([]),[q,U]=i.useState([]),[Q,L]=i.useState([]),[$,D]=i.useState(""),[A,_]=i.useState(""),[G,P]=i.useState(""),I=O();i.useEffect(()=>{n.getQpUploadDetails(I)},[]),i.useEffect(()=>{u(n.qpUpdData)},[n.qpUpdData]);const j=async(a,e,r)=>{if(r==="anskey"){const d={...l};if(a.fileList.length>0){const s=a.fileList[0].name.split(".").pop();if(s!=="docx"&&s!=="doc"){p("info","Select word file only");return}d[e.key]=a.fileList,x(d),D(e.key),F("Yes")}else{const s={...l,[e.key]:[]};x(s),D(""),F("No")}}else if(r==="qp"){const d={...f};if(a.fileList.length>0){const s=a.fileList[0].name.split(".").pop();if(s!=="docx"&&s!=="doc"){p("info","Select word file only");return}d[e.key]=a.fileList,m(d),_(e.key),U("Yes")}else{const s={...d,[e.key]:[]};m(s),_(""),U("No")}}else if(r==="rem"){const d={...g};if(a.fileList.length>0){const s=a.fileList[0].name.split(".").pop();if(s!=="docx"&&s!=="doc"){p("info","Select word file only");return}d[e.key]=a.fileList,S(d),P(e.key),L("Yes")}else{const s={...d,[e.key]:[]};S(s),P(""),L("No")}}},C=async a=>{if(a.key!=A){p("info","Please select the files to upload");return}const e=new FormData;e.append("qpcode",a.fqpcode),e.append("set",a.fset),e.append("yearmode",a.fexam),e.append("type",a.ftype),e.append("userid",n.user.fregno),e.append("collcode",n.user.fcollcode),e.append("mobileno",n.user.fmobile),e.append("univcode",n.user.funivcode),e.append("ansstatus",E),e.append("qpstatus",q),e.append("remstatus",Q),g[a.key]&&g[a.key][0]&&e.append("remfile",g[a.key][0].originFileObj),f[a.key]&&f[a.key][0]&&e.append("qpfile",f[a.key][0].originFileObj),l[a.key]&&l[a.key][0]&&e.append("anskeyfile",l[a.key][0].originFileObj),await n.uploadQuestionPaper(e,n.getQpUploadDetails)},R=[{title:"Sl. No.",dataIndex:"fslno",align:"center"},{title:"QP. Code",dataIndex:"fqpcode",align:"center"},{title:"Subject Name",render:(a,e)=>t.jsx("span",{children:e.fsubname+" - "+e.FSUBSHORT})},{title:"Max. Marks",dataIndex:"fvalmax",align:"center",hidden:n.user.funivcode=="030"&&!0},{title:"Set No.",dataIndex:"fset",align:"center"},{title:"Type",dataIndex:"ftype",align:"center"},{title:"Syllabus with CO's",render:(a,e)=>t.jsx("a",{href:o+e.FQPSYLLABUS,target:"_blank",download:!0,children:"Download"}),align:"center"},{title:"QP Pattern",render:(a,e)=>t.jsx("a",{href:o+e.FQPPATREN,target:"_blank",download:!0,children:"Download"}),align:"center"},{title:"Uploaded Date",dataIndex:"qpupd",align:"center"},{title:"Status",render:(a,e)=>t.jsx("p",{children:e.qpupd!=""?t.jsx("span",{style:{color:"green"},children:" Completed "}):t.jsx("span",{style:{color:"red"},children:" Pending"})}),align:"center"},{title:"Upload Ans Key",render:(a,e)=>t.jsxs("div",{children:[t.jsx(b,{onClick:()=>x([]),fileList:l[e.key]||[],onChange:r=>j(r,e,"anskey"),beforeUpload:()=>!1,children:t.jsx(h,{size:"medium",icon:t.jsx(k,{}),children:"Select File"})}),e.fanskeypath!==""&&t.jsx("a",{href:c+e.fanskeypath,target:"_blank",download:!0,children:"View"})]}),align:"center",hidden:n.user.funivcode=="040"&&!0},{title:"Upload QP",render:(a,e)=>t.jsxs("div",{children:[t.jsx(b,{onClick:()=>m([]),fileList:f[e.key]||[],onChange:r=>j(r,e,"qp"),beforeUpload:()=>!1,children:t.jsx(h,{size:"medium",icon:t.jsx(k,{}),children:"Select File"})}),e.fqpfilepath!==""&&t.jsx("a",{href:c+e.fqpfilepath,target:"_blank",download:!0,children:"View"})]}),align:"center"},{title:"Remuneration Det.",render:(a,e)=>t.jsxs("div",{children:[t.jsx(b,{onClick:()=>S([]),fileList:g[e.key]||[],onChange:r=>j(r,e,"rem"),beforeUpload:()=>!1,children:t.jsx(h,{size:"medium",icon:t.jsx(k,{}),children:"Select File"})}),e.fremfile!==""&&t.jsx("a",{href:c+e.fremfile,target:"_blank",download:!0,children:"View"})]}),align:"center",hidden:n.user.funivcode!="040"&&!0},{title:"Action",render:(a,e)=>t.jsx(h,{size:"medium",style:{background:"green",color:"#fff"},onClick:()=>C(e),children:t.jsx(k,{})}),align:"center"}];return t.jsxs(v,{style:{margin:"6rem 10px 10px"},title:t.jsx("h6",{children:"Upload Question Paper"}),extra:t.jsx(z,{children:t.jsx(K,{to:"/",children:t.jsxs(h,{type:"primary",danger:!0,children:[t.jsx(B,{})," Exit"]})})}),children:[n.user.funivcode=="040"?t.jsxs("p",{children:[t.jsx("b",{style:{color:"red",textAlign:"justify"},children:"Attention: "}),"Only one bill will be considered. Additional bills uploaded will not be taken into account."]}):t.jsx("div",{style:{color:"red",marginBottom:"20px"},dangerouslySetInnerHTML:{__html:n.qpUpdNote.fnote}}),t.jsx(M,{dataSource:y,columns:R,pagination:!1,scroll:{x:1300}})]})},W=n=>({user:n.loginfo.userData,qpUpdData:n.qpUpdData,qpUpdNote:n.qpUpdNote}),oe=T(W,{getQpUploadDetails:Y,uploadQuestionPaper:H})(V);export{oe as default};
|