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.144.104.175
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/PrepareThQp-IafYya7u.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 o,F as z,G as xe,E as N,v as H,O as me,Q as ge}from"./index-DoOhtRM-.js";import{R as k}from"./quill.snow-Bo0giXs1.js";import{a as je,u as ye,d as qe}from"./PrepareQp-DsgK6t8Y.js";import{k as be}from"./sem-DLpF_ddZ.js";import{S as V}from"./index-DAtDV0BY.js";import{R as te}from"./ArrowLeftOutlined-DJz7NNcU.js";import{R as ve}from"./FilePdfOutlined-v1Mryy41.js";import{R as Ce}from"./HomeOutlined-RRy07SvX.js";import{R as Y}from"./index-Dp7SaHdv.js";import{R as m,C as p}from"./row-B8SdGvkB.js";import{U as w,R as T}from"./UploadOutlined-BywrhFSM.js";import{R}from"./DeleteOutlined-BL8kPxK9.js";import"./index-Gneb6Krm.js";import"./responsiveObserver-BniLz5dQ.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:Q,set:L,teachcode:U,tempcode:Ue,type:S,year:B,disabled:j}=n.element;let M="https://omr-files.s3.ap-south-1.amazonaws.com/",K=localStorage.getItem("dbname");const[u,y]=h.useState([]),[G,v]=h.useState(""),[J,O]=h.useState(null),[W,D]=h.useState(null),[X,E]=h.useState(null),[Z,_]=h.useState(null),[ee,A]=h.useState(null),[se,re]=h.useState(null);h.useState(""),h.useEffect(()=>{oe()},[]);const oe=async()=>{await n.getQuestions(n.element)};h.useEffect(()=>{var r;y(n.getQn),v((r=n.getQn[0])==null?void 0:r.fdata[0].fqpno)},[n.getQn]),h.useEffect(()=>{y(u)},[u]);const P=r=>{document.execCommand(r)},C=r=>{r.file.status==="done"?message.success(`${r.file.name} file uploaded successfully`):r.file.status==="error"&&message.error(`${r.file.name} file upload failed.`)},fe=(r,t,s)=>{const a=u;s.target.checked&&(a[r].fdata[t].ftype=s.target.value),y([...a])},x=(r,t,s,a)=>{const l=u;l[r].fdata[t][a]=s,y([...l])},f=async(r,t,s,a,l,I)=>{let i=r.file.name.split(".").pop();if(i!=="jpg"&&i!=="png"&&i!=="jpeg"){N("info","only jpg or png files allowed");return}const c=new FormData;c.append("univcode",n.user.funivcode),c.append("qpcode",Q),c.append("year",B),c.append("mode",b),c.append("qnno",a),c.append("field",l),c.append("file",r.file),c.append("noqp",L),c.append("teachcode",U),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,F=u;F[t].fdata[s][$]=q.data.data.msg,y([...F])}else N("error",q.data.data.msg);n.uploadQnFiles(JSON.stringify(q.data))},de=async(r,t,s)=>{let a=u[r].fdata[t];if(a.fquestion===""||a.fquestion==="<p><br></p>"){N("info","Question field should not be empty");return}const l=new FormData;if(l.append("data",JSON.stringify(a)),l.append("qpcode",Q),l.append("year",B),l.append("mode",b),l.append("teachcode",U),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[r].fdata.length===t+1)if(u[r+1]==null)v(u[0].fdata[0].fqpno);else{let c=u[r+1].fdata[0].fqpno;v(c)}else v(s[t+1].fqpno);let i=u;a.fquestion!==""&&a.fquestion!==null&&(i[r].fdata[t].fqpcomp="Completed",y(i)),O(""),D(""),E(""),_(""),A("")}},d=async(r,t,s,a,l,I)=>{const i=new FormData;i.append("qpcode",Q),i.append("year",B),i.append("mode",b),i.append("teachcode",U),i.append("set",L),i.append("fqpno",s),i.append("path",a),i.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,i);if(g({type:"UNSET_LOADER"}),q.data.error_code===0){let $=n.user.fusertype==="T"?l:n.user.fusertype==="M"&&I,F=u;F[r].fdata[t][$]="",y([...F]),O(""),D(""),E(""),_(""),A("")}else N("info",q.data.data.msg)},pe=()=>{window.open(me+"/app.php?a=getOmrQpReport&db="+localStorage.getItem("dbname")+"&univcode="+n.user.funivcode+"&qpcode="+Q+"&year="+B+"&mode="+b+"&teachcode="+U+"&noqp="+L+"&type="+S+"&teachtype="+n.user.fusertype)},ie=()=>e.jsxs(V,{children:[e.jsx(o,{size:"small",onClick:()=>{P("bold")},children:"B"}),e.jsx(o,{size:"small",onClick:()=>P("italic"),children:"I"}),e.jsx(o,{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(o,{style:{background:"green",color:"white"},children:[e.jsx(te,{}),"Back"]})}),e.jsxs(o,{type:"primary",onClick:()=>pe(),children:[e.jsx(ve,{})," Preview"]}),e.jsx(ae,{to:"/",children:e.jsxs(o,{type:"primary",danger:!0,children:[e.jsx(Ce,{})," Exit"]})})]}),children:e.jsx("div",{style:{height:"160px",overflowY:"auto"},children:u.map((r,t)=>e.jsxs("div",{children:[e.jsx("span",{children:e.jsxs("b",{children:[r.fpartcode+" - "+r.fpartdesc,":"]})}),r.fdata.map((s,a)=>e.jsx(o,{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((r,t)=>e.jsx("div",{children:r.fdata.map((s,a)=>e.jsx("div",{children:G==s.fqpno&&e.jsxs(le,{title:e.jsx("div",{children:S==="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(ie,{}),children:[e.jsxs(m,{gutter:16,children:[e.jsxs(p,{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=>{O(l)},maxCount:1,children:e.jsxs(o,{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(o,{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"&&S!=="MCQ"?e.jsxs(p,{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=>{D(l)},maxCount:1,children:e.jsxs(o,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:W&&W.name}),s.fkeyansfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(o,{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:M+s.fkeyansfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}):e.jsxs(p,{xs:24,sm:24,md:24,lg:12,xl:12,xxl:12,children:[e.jsxs(m,{gutter:16,children:[e.jsxs(p,{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(o,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:X&&X.name}),s.foptafile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(o,{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:M+s.foptafile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}),e.jsxs(p,{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(o,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:Z&&Z.name}),s.foptbfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(o,{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:M+s.foptbfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]})]}),e.jsxs(m,{gutter:16,children:[e.jsxs(p,{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(o,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:ee&&ee.name}),s.foptcfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(o,{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:M+s.foptcfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]}),e.jsxs(p,{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=>{re(l)},maxCount:1,children:e.jsxs(o,{size:"small",children:[e.jsx(T,{})," Upload Image"]})}),e.jsx("a",{children:se&&se.name}),s.foptdfile!==""&&e.jsxs(e.Fragment,{children:[e.jsx(o,{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:M+s.foptdfile,target:"_blank",style:{float:"right"},children:"View"})]})]})]})]})]}),e.jsxs(p,{xs:24,sm:24,md:24,lg:4,xl:4,xxl:4,children:[e.jsxs(m,{gutter:4,children:[e.jsxs(p,{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})]}),(S==="MCQ"||s.ftype==="MCQ")&&e.jsxs(p,{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(p,{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(p,{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(p,{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(p,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(p,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(p,{children:e.jsx("p",{})})}),e.jsx(m,{children:e.jsx(p,{children:e.jsx("p",{})})})]})]}),e.jsx(m,{children:e.jsx(p,{span:24,children:e.jsxs(V,{style:{float:"right",position:"absolute",right:0,bottom:20},children:[e.jsx(o,{size:"medium",icon:e.jsx(te,{}),onClick:()=>{a!==0&&v(r.fdata[a-1].fqpno)},children:"Previous"}),e.jsxs(o,{size:"medium",type:"primary",disabled:j=="T"&&n.user.fusertype!=="M",onClick:()=>de(t,a,r.fdata),children:["Next ",e.jsx(Te,{})]})]})})})]},a)},a))},t))})]})},Me=n=>({user:n.loginfo.userData,getQn:n.getQuestions,btnLoading:n.loader.btnLoading,qnfiles:n.qnfiles}),Fe=ne(Me,{getQuestions:je,uploadQnFiles:ye,deleteFileHandler:qe})(Re),Qe=n=>{const g=ge();return e.jsx(Fe,{element:g})},Le=n=>({user:n.loginfo.userData}),Ye=ne(Le,{})(Qe);export{Ye as default};
|