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


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/PrepareThQp-D6Mkwal0.js

import{r as h,I as ce,a as ue,x as ne,H as he,t as e,D as le,L as ae,B as r,F as z,G as xe,E as D,v as H,O as me,Q as ge}from"./index-BXGyQmrS.js";import{R as k}from"./quill.snow-DiPQVbXP.js";import{a as je,u as ye,d as qe}from"./PrepareQp-jwOEik7E.js";import{k as be}from"./sem-CXAFzSxe.js";import{S as V}from"./index-Dmdyjymp.js";import{R as te}from"./ArrowLeftOutlined-CtcP-jIh.js";import{R as ve}from"./FilePdfOutlined-b1LLwQaT.js";import{R as Ce}from"./HomeOutlined-DXLVvpRw.js";import{R as Y}from"./index-BLFlp97X.js";import{R as m,C as i}from"./row-BC5PwUrl.js";import{U as w,R as T}from"./UploadOutlined-fJC8KsRE.js";import{R}from"./DeleteOutlined-CHQ1I1e1.js";import"./index-DA_qcuNc.js";import"./responsiveObserver-BnSpyoMt.js";var ke={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},we=function(g,b){return h.createElement(ce,ue({},g,{ref:b,icon:ke}))},Te=h.forwardRef(we);const Re=n=>{const g=he(),{mode:b,qpcode:F,set:L,teachcode:S,tempcode:Se,type:U,year:B,disabled:j}=n.element;let Q="https://omr-files.s3.ap-south-1.amazonaws.com/",K=localStorage.getItem("dbname");const[u,y]=h.useState([]),[G,v]=h.useState(""),[J,N]=h.useState(null),[W,O]=h.useState(null),[X,E]=h.useState(null),[Z,_]=h.useState(null),[ee,A]=h.useState(null),[se,oe]=h.useState(null);h.useState(""),h.useEffect(()=>{re()},[]);const re=async()=>{await n.getQuestions(n.element)};h.useEffect(()=>{var o;console.log(n.getQn,"data"),y(n.getQn),v((o=n.getQn[0])==null?void 0:o.fdata[0].fqpno)},[n.getQn]),h.useEffect(()=>{y(u)},[u]);const P=o=>{document.execCommand(o)},C=o=>{o.file.status==="done"?message.success(`${o.file.name} file uploaded successfully`):o.file.status==="error"&&message.error(`${o.file.name} file upload failed.`)},fe=(o,t,s)=>{const a=u;s.target.checked&&(a[o].fdata[t].ftype=s.target.value),y([...a])},x=(o,t,s,a)=>{const l=u;l[o].fdata[t][a]=s,y([...l])},f=async(o,t,s,a,l,I)=>{let p=o.file.name.split(".").pop();if(p!=="jpg"&&p!=="png"&&p!=="jpeg"){D("info","only jpg or png files allowed");return}const c=new FormData;c.append("univcode",n.user.funivcode),c.append("qpcode",F),c.append("year",B),c.append("mode",b),c.append("qnno",a),c.append("field",l),c.append("file",o.file),c.append("noqp",L),c.append("teachcode",S),c.append("userid",n.user.fregno),g({type:"SET_BTN_LOADER"});const q=await H.post("app.php?a=uploadQnFiles&db="+K,c);if(g({type:"UNSET_BTN_LOADER"}),q.data.error_code===0){let $=n.user.fusertype==="T"?l:n.user.fusertype==="M"&&I,M=u;M[t].fdata[s][$]=q.data.data.msg,y([...M])}else D("error",q.data.data.msg);n.uploadQnFiles(JSON.stringify(q.data))},de=async(o,t,s)=>{let a=u[o].fdata[t];if(a.fquestion===""||a.fquestion==="<p><br></p>"){D("info","Question field should not be empty");return}const l=new FormData;if(l.append("data",JSON.stringify(a)),l.append("qpcode",F),l.append("year",B),l.append("mode",b),l.append("teachcode",S),l.append("set",L),l.append("usertype",n.user.fusertype),l.append("userid",n.user.fregno),(await H.post("app.php?a=saveQuestions&db="+K,l)).data.error_code===0){if(u[o].fdata.length===t+1)if(u[o+1]==null)v(u[0].fdata[0].fqpno);else{let c=u[o+1].fdata[0].fqpno;v(c)}else v(s[t+1].fqpno);let p=u;a.fquestion!==""&&a.fquestion!==null&&(p[o].fdata[t].fqpcomp="Completed",y(p)),N(""),O(""),E(""),_(""),A("")}},d=async(o,t,s,a,l,I)=>{const p=new FormData;p.append("qpcode",F),p.append("year",B),p.append("mode",b),p.append("teachcode",S),p.append("set",L),p.append("fqpno",s),p.append("path",a),p.append("field",l);let c=localStorage.getItem("dbname");g({type:"SET_LOADER"});const q=await H.post("app.php?a=deleteThQpFile&db="+c+"&univcode="+n.user.funivcode,p);if(g({type:"UNSET_LOADER"}),q.data.error_code===0){let $=n.user.fusertype==="T"?l:n.user.fusertype==="M"&&I,M=u;M[o].fdata[t][$]="",y([...M]),N(""),O(""),E(""),_(""),A("")}else D("info",q.data.data.msg)},ie=()=>{window.open(me+"/app.php?a=getOmrQpReport&db="+localStorage.getItem("dbname")+"&univcode="+n.user.funivcode+"&qpcode="+F+"&year="+B+"&mode="+b+"&teachcode="+S+"&noqp="+L+"&type="+U+"&teachtype="+n.user.fusertype)},pe=()=>e.jsxs(V,{children:[e.jsx(r,{size:"small",onClick:()=>{P("bold")},children:"B"}),e.jsx(r,{size:"small",onClick:()=>P("italic"),children:"I"}),e.jsx(r,{size:"small",onClick:()=>P("underline"),children:"U"})]});return e.jsxs("div",{children:[e.jsx(le,{style:{margin:"6rem 10px 10px"},title:e.jsx("h6",{children:"Prepare Question Paper"}),extra:e.jsxs(V,{children:[e.jsx(ae,{to:n.user.fusertype==="M"?"/qpsettings/mod-qp-det-online":"/qpsettings/prepare-qp",children:e.jsxs(r,{style:{background:"green",color:"white"},children:[e.jsx(te,{}),"Back"]})}),e.jsxs(r,{type:"primary",onClick:()=>ie(),children:[e.jsx(ve,{})," Preview"]}),e.jsx(ae,{to:"/",children:e.jsxs(r,{type:"primary",danger:!0,children:[e.jsx(Ce,{})," Exit"]})})]}),children:e.jsx("div",{style:{height:"160px",overflowY:"auto"},children:u.map((o,t)=>e.jsxs("div",{children:[e.jsx("span",{children:e.jsxs("b",{children:[o.fpartcode+" - "+o.fpartdesc,":"]})}),o.fdata.map((s,a)=>e.jsx(r,{size:"small",style:{margin:"4px",marginBottom:"3px",background:s.fqpcomp==="Completed"?"green":G===s.fqpno&&"orange",color:s.fqpcomp==="Completed"&&"white"},onClick:()=>v(s.fqpno),children:s.fqpno},a))]},t))})}),e.jsx("div",{style:{margin:"0px 10px"},children:u.map((o,t)=>e.jsx("div",{children:o.fdata.map((s,a)=>e.jsx("div",{children:G==s.fqpno&&e.jsxs(le,{title:e.jsx("div",{children:U==="THEORY"&&e.jsxs(Y.Group,{style:{marginBottom:"10px"},value:s.ftype,onChange:l=>fe(t,a,l),children:[e.jsx(Y,{value:"Descriptive",children:"Descriptive"}),e.jsx(Y,{value:"MCQ",children:"MCQ"})]})}),extra:e.jsx(pe,{}),children:[e.jsxs(m,{gutter:16,children:[e.jsxs(i,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("h6",{children:s.fqpno}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",value:s.fquestion,onChange:l=>x(t,a,l,"fquestion")})}),e.jsxs("div",{style:{marginTop:"5px"},children:[e.jsx(w,{disabled:j==="T"&&!0,customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"fqnfile"),f(l,t,a,s.fqpno,"fmodqnfile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodqnfile","fqnfile")},onChange:C,showUploadList:!1,beforeUpload:l=>{N(l)},maxCount:1,children:e.jsxs(r,{loading:n.btnLoading,size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:J&&J.name}),s.fqnfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"fqnfile"),d(t,a,s.fqpno,s.fqnfile,"fmodqnfile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodqnfile","fqnfile")},children:e.jsx(R,{})}),e.jsx("a",{href:s.fqnfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}),s.ftype!=="MCQ"&&U!=="MCQ"?e.jsxs(i,{xs:24,sm:24,md:12,lg:12,xl:12,xxl:12,style:{marginBottom:"20px"},children:[e.jsx("h6",{children:"Key Answer"}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",value:s.fkeyans,onChange:l=>x(t,a,l,"fkeyans")})}),e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx(w,{disabled:j==="T"&&n.user.fusertype!=="M",customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"fkeyansfile"),f(l,t,a,s.fqpno,"fmodkeyansfile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodkeyansfile","fkeyansfile")},onChange:C,showUploadList:!1,beforeUpload:l=>{O(l)},maxCount:1,children:e.jsxs(r,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:W&&W.name}),s.fkeyansfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"fkeyansfile"),d(t,a,s.fqpno,s.fqnfile,"fmodkeyansfile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodkeyansfile","fkeyansfile")},children:e.jsx(R,{})}),e.jsx("a",{href:Q+s.fkeyansfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}):e.jsxs(i,{xs:24,sm:24,md:24,lg:12,xl:12,xxl:12,children:[e.jsxs(m,{gutter:16,children:[e.jsxs(i,{xs:24,sm:24,md:12,lg:12,xl:12,xxl:12,style:{marginBottom:"20px"},children:[e.jsx("h6",{children:" A) "}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",style:{height:"80px",overflowY:"auto"},value:s.fopta,onChange:l=>x(t,a,l,"fopta")})}),e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx(w,{disabled:j==="T"&&n.user.fusertype!=="M",customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"foptafile"),f(l,t,a,s.fqpno,"fmodoptafile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodoptafile","foptafile")},onChange:C,showUploadList:!1,beforeUpload:l=>{E(l)},maxCount:1,children:e.jsxs(r,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:X&&X.name}),s.foptafile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"foptafile"),d(t,a,s.fqpno,s.fqnfile,"fmodoptafile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodoptafile","foptafile")},children:e.jsx(R,{})}),e.jsx("a",{href:Q+s.foptafile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}),e.jsxs(i,{xs:24,sm:24,md:12,lg:12,xl:12,xxl:12,style:{marginBottom:"20px"},children:[e.jsx("h6",{children:" B) "}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",style:{height:"80px",overflowY:"auto"},value:s.foptb,onChange:l=>x(t,a,l,"foptb")})}),e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx(w,{disabled:j==="T"&&n.user.fusertype!=="M",customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"foptbfile"),f(l,t,a,s.fqpno,"fmodoptbfile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodoptbfile","foptbfile")},onChange:C,showUploadList:!1,beforeUpload:l=>{_(l)},maxCount:1,children:e.jsxs(r,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:Z&&Z.name}),s.foptbfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"foptbfile"),d(t,a,s.fqpno,s.fqnfile,"fmodoptbfile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodoptbfile","foptbfile")},children:e.jsx(R,{})}),e.jsx("a",{href:Q+s.foptbfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]})]}),e.jsxs(m,{gutter:16,children:[e.jsxs(i,{xs:24,sm:24,md:12,lg:12,xl:12,xxl:12,style:{marginBottom:"20px"},children:[e.jsx("h6",{children:" C) "}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",style:{height:"80px",overflowY:"auto"},value:s.foptc,onChange:l=>x(t,a,l,"foptc")})}),e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx(w,{disabled:j==="T"&&n.user.fusertype!=="M",customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"foptcfile"),f(l,t,a,s.fqpno,"fmodoptcfile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodoptcfile","foptcfile")},onChange:C,showUploadList:!1,beforeUpload:l=>{A(l)},maxCount:1,children:e.jsxs(r,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:ee&&ee.name}),s.foptcfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"foptcfile"),d(t,a,s.fqpno,s.fqnfile,"fmodoptcfile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodoptcfile","foptcfile")},children:e.jsx(R,{})}),e.jsx("a",{href:Q+s.foptcfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}),e.jsxs(i,{xs:24,sm:24,md:12,lg:12,xl:12,xxl:12,style:{marginBottom:"20px"},children:[e.jsx("h6",{children:" D) "}),e.jsx("div",{className:"editor-container",children:e.jsx(k,{className:"custom-quill-editor",style:{height:"80px",overflowY:"auto"},value:s.foptd,onChange:l=>x(t,a,l,"foptd")})}),e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx(w,{disabled:j==="T"&&n.user.fusertype!=="M",customRequest:l=>{n.user.fusertype==="T"?(f(l,t,a,s.fqpno,"foptdfile"),f(l,t,a,s.fqpno,"fmodoptdfile")):n.user.fusertype==="M"&&f(l,t,a,s.fqpno,"fmodoptdfile","foptdfile")},onChange:C,showUploadList:!1,beforeUpload:l=>{oe(l)},maxCount:1,children:e.jsxs(r,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:se&&se.name}),s.foptdfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(r,{style:{float:"right",marginLeft:"10px"},size:"small",type:"primary",danger:!0,onClick:()=>{n.user.fusertype==="T"?(d(t,a,s.fqpno,s.fqnfile,"foptdfile"),d(t,a,s.fqpno,s.fqnfile,"fmodoptdfile")):n.user.fusertype==="M"&&d(t,a,s.fqpno,s.fmodqnfile,"fmodoptdfile","foptdfile")},children:e.jsx(R,{})}),e.jsx("a",{href:Q+s.foptdfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]})]})]}),e.jsxs(i,{xs:24,sm:24,md:24,lg:4,xl:4,xxl:4,children:[e.jsxs(m,{gutter:4,children:[e.jsxs(i,{xs:12,sm:12,md:12,lg:12,xl:12,xxl:12,children:[e.jsx("label",{children:"Max. Marks"}),e.jsx(z,{style:{marginBottom:"10px"},value:s.fmaxmarks,disabled:!0})]}),(U==="MCQ"||s.ftype==="MCQ")&&e.jsxs(i,{xs:12,sm:12,md:12,lg:12,xl:12,xxl:12,children:[e.jsx("label",{children:"Key Answer"}),e.jsx(xe,{style:{width:"100%",height:"37px"},value:s.fkeyans,options:be,onChange:l=>x(t,a,l,"fkeyans")})]})]}),e.jsxs(m,{gutter:4,children:[e.jsxs(i,{xs:8,sm:8,md:8,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"CO"}),e.jsx(z,{style:{marginBottom:"10px"},value:s.fco,onChange:l=>x(t,a,l.target.value,"fco")})]}),e.jsxs(i,{xs:8,sm:8,md:8,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"PO"}),e.jsx(z,{style:{marginBottom:"10px"},value:s.fpo,onChange:l=>x(t,a,l.target.value,"fpo")})]}),e.jsxs(i,{xs:8,sm:8,md:8,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"Bloom's"}),e.jsx(z,{style:{marginBottom:"10px"},value:s.fblooms,onChange:l=>x(t,a,l.target.value,"fblooms")})]})]}),e.jsx(m,{children:e.jsx(i,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(i,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(i,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(i,{children:e.jsx("p",{})})})]})]}),e.jsx(m,{children:e.jsx(i,{span:24,children:e.jsxs(V,{style:{float:"right",position:"absolute",right:0,bottom:20},children:[e.jsx(r,{size:"medium",icon:e.jsx(te,{}),onClick:()=>{a!==0&&v(o.fdata[a-1].fqpno)},children:"Previous"}),e.jsxs(r,{size:"medium",type:"primary",disabled:j=="T"&&n.user.fusertype!=="M",onClick:()=>de(t,a,o.fdata),children:["Next ",e.jsx(Te,{})]})]})})})]},a)},a))},t))})]})},Qe=n=>(console.log(n.getQuestions,"SDsdm,sd"),{user:n.loginfo.userData,getQn:n.getQuestions,btnLoading:n.loader.btnLoading,qnfiles:n.qnfiles}),Me=ne(Qe,{getQuestions:je,uploadQnFiles:ye,deleteFileHandler:qe})(Re),Fe=n=>{const g=ge();return console.log(g),e.jsx(Me,{element:g})},Le=n=>({user:n.loginfo.userData}),Ye=ne(Le,{})(Fe);export{Ye as default};