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.220.196.68
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/UploadQuestionPaper-BQaVSylU.js |
import{v as E,E as c,x as T,r as i,t,B as x,D as N,L as C}from"./index-CAvdhLGp.js";import{U as F,R as h}from"./UploadOutlined-B5WcHIAP.js";import{S as O}from"./index-Bthn8aXT.js";import{R as v}from"./HomeOutlined-CsEPm3IA.js";import{F as K}from"./Table-UOfxwYBm.js";import"./index-DmG-UXL6.js";import"./index-BX9F7V_3.js";import"./DeleteOutlined-CJCYzgSk.js";import"./index-D4XjlJqh.js";import"./responsiveObserver-CtD7KI5g.js";const z=()=>async(n,f)=>{try{const o=f();let g=localStorage.getItem("dbname");n({type:"SET_LOADER"});const d=await E.get("app.php?a=getQpUploadDetails&db="+g+"&userid="+o.loginfo.userData.fregno);if(n({type:"UNSET_LOADER"}),typeof d.data!="object")c("Error","Something Went wrong, please try again later");else if(d.data.error_code===0){let s=d.data.data.result.map((m,u)=>({...m,key:u,fslno:u+1}));n({type:"SET_QP_UPLOAD_DETAILS",payload:s}),n({type:"QP_UPD_NOTE",payload:d.data.data.fnote})}else n({type:"CLEAR_SET_QP_UPLOAD_DETAILS",payload:[]}),n({type:"CLEAR_QP_UPD_NOTE",payload:{}}),c("Info","No data found")}catch(o){console.log(o.message)}},B=(n,f)=>async(o,g)=>{try{let d=localStorage.getItem("dbname");o({type:"SET_LOADER"});const s=await E.post("app.php?a=uploadQuestionPaper&db="+d,n);o({type:"UNSET_LOADER"}),s.data.error_code===0?(c("success",s.data.data.msg),f()):c("info",s.data.data.msg)}catch(d){c("Error",d.message)}},Y=n=>{const f="https://qp-scheme.s3.ap-south-1.amazonaws.com/",o="https://qp-upd.s3.ap-south-1.amazonaws.com/",[g,d]=i.useState([]),[s,m]=i.useState([]),[u,S]=i.useState([]),[y,k]=i.useState([]),[P,U]=i.useState([]),[q,b]=i.useState([]),[Q,L]=i.useState([]),[M,D]=i.useState(""),[A,_]=i.useState(""),[V,w]=i.useState("");i.useEffect(()=>{n.getQpUploadDetails()},[]),i.useEffect(()=>{d(n.qpUpdData)},[n.qpUpdData]);const j=async(a,e,r)=>{if(r==="anskey"){const p={...s};if(a.fileList.length>0){const l=a.fileList[0].name.split(".").pop();if(l!=="docx"&&l!=="doc"){c("info","Select word file only");return}p[e.key]=a.fileList,m(p),D(e.key),U("Yes")}else{const l={...s,[e.key]:[]};m(l),D(""),U("No")}}else if(r==="qp"){const p={...u};if(a.fileList.length>0){const l=a.fileList[0].name.split(".").pop();if(l!=="docx"&&l!=="doc"){c("info","Select word file only");return}p[e.key]=a.fileList,S(p),_(e.key),b("Yes")}else{const l={...p,[e.key]:[]};S(l),_(""),b("No")}}else if(r==="rem"){const p={...y};if(a.fileList.length>0){const l=a.fileList[0].name.split(".").pop();if(l!=="docx"&&l!=="doc"){c("info","Select word file only");return}p[e.key]=a.fileList,k(p),w(e.key),L("Yes")}else{const l={...p,[e.key]:[]};k(l),w(""),L("No")}}},I=async a=>{if(a.key!=A){c("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",P),e.append("qpstatus",q),e.append("remstatus",Q),y[a.key]&&y[a.key][0]&&e.append("remfile",y[a.key][0].originFileObj),u[a.key]&&u[a.key][0]&&e.append("qpfile",u[a.key][0].originFileObj),s[a.key]&&s[a.key][0]&&e.append("anskeyfile",s[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:f+e.FQPSYLLABUS,target:"_blank",download:!0,children:"Download"}),align:"center"},{title:"QP Pattern",render:(a,e)=>t.jsx("a",{href:f+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(F,{onClick:()=>m([]),fileList:s[e.key]||[],onChange:r=>j(r,e,"anskey"),beforeUpload:()=>!1,children:t.jsx(x,{size:"medium",icon:t.jsx(h,{}),children:"Select File"})}),e.fanskeypath!==""&&t.jsx("a",{href:o+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(F,{onClick:()=>S([]),fileList:u[e.key]||[],onChange:r=>j(r,e,"qp"),beforeUpload:()=>!1,children:t.jsx(x,{size:"medium",icon:t.jsx(h,{}),children:"Select File"})}),e.fqpfilepath!==""&&t.jsx("a",{href:o+e.fqpfilepath,target:"_blank",download:!0,children:"View"})]}),align:"center"},{title:"Remuneration Det.",render:(a,e)=>t.jsxs("div",{children:[t.jsx(F,{onClick:()=>k([]),fileList:y[e.key]||[],onChange:r=>j(r,e,"rem"),beforeUpload:()=>!1,children:t.jsx(x,{size:"medium",icon:t.jsx(h,{}),children:"Select File"})}),e.fremfile!==""&&t.jsx("a",{href:o+e.fremfile,target:"_blank",download:!0,children:"View"})]}),align:"center",hidden:n.user.funivcode!="040"&&!0},{title:"Action",render:(a,e)=>t.jsx(x,{size:"medium",style:{background:"green",color:"#fff"},onClick:()=>I(e),children:t.jsx(h,{})}),align:"center"}];return t.jsxs(N,{style:{margin:"6rem 10px 10px"},title:t.jsx("h6",{children:"Upload Question Paper"}),extra:t.jsx(O,{children:t.jsx(C,{to:"/",children:t.jsxs(x,{type:"primary",danger:!0,children:[t.jsx(v,{})," 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(K,{dataSource:g,columns:R,pagination:!1,scroll:{x:1300}})]})},H=n=>({user:n.loginfo.userData,qpUpdData:n.qpUpdData,qpUpdNote:n.qpUpdNote}),le=T(H,{getQpUploadDetails:z,uploadQuestionPaper:B})(Y);export{le as default};
|