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.148.117.240
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/TeacherEntry-DcGTdgZK.js |
import{x as v,Q as C,r,y as w,t as e,D as k,L as g,B as d,R as T,F as x,G as j,E as B}from"./index-Dg6L4Sgi.js";import{I as D}from"./index-Cg_1Pd0f.js";import{f as E,e as R}from"./sem-DLpF_ddZ.js";import{s as S,g as I,a as N,c as $}from"./TeacherEntry-BlYVM9-d.js";import{S as F}from"./index-DlmGwZY4.js";import{R as H}from"./StopOutlined-DdILRcPk.js";import{R as L}from"./HomeOutlined-DuiGAEJZ.js";import{R as i,C as c}from"./row-BmL0HVtY.js";import"./responsiveObserver-BUHeJEGz.js";const O=l=>{const s=C();r.useRef(null);const[t,m]=r.useState({teachcode:"",name:"",dob:"",email:"",mobile:"",college:"",examiner:""}),[f,h]=r.useState(!1);w(),r.useEffect(()=>{s.type!=="insert"&&(h(!0),m({...t,teachcode:s.teachcode,mobile:s.mobileno}),l.getTeachdet(s.teachcode)),l.getCollegeDetails()},[]),r.useEffect(()=>{s.type!=="insert"&&(h(!0),m({...t,teachcode:s.teachcode,mobile:s.mobileno,name:l.teachdet.fteachname,dob:l.teachdet.fdob,email:l.teachdet.femail,college:l.teachdet.fcollcode,examiner:l.teachdet.fexaminer}))},[l.teachdet]);const o=(a,n)=>{m({...t,[n]:a})},u=async a=>{a=="teachcode"?await l.checkTeachcode(t.teachcode,a):s.type==="insert"&&await l.checkTeachcode(t.mobile,a)},y=async()=>{if(t.name==""||t.dob==""||t.email==""||t.mobile==""||t.college==""||t.examiner==""){B("warning","All the fields are mandatory");return}const a=new FormData;a.append("data",JSON.stringify(t)),a.append("type",s.type),await l.saveTeacherDetails(a)},b=l.college.map((a,n)=>({key:n,value:a.fcollcode,label:a.fcollname})),p=()=>{m({teachcode:"",name:"",dob:"",email:"",mobile:"",college:"",examiner:""}),h(!1)};return e.jsxs(k,{style:{margin:"6rem 10px 10px"},title:e.jsx("h6",{children:"Teacher Entry"}),extra:e.jsxs(F,{children:[e.jsx(g,{to:{pathname:"/qpsettings/teacher-entry/insert"},children:e.jsxs(d,{style:{background:"black",color:"white"},onClick:()=>p(),children:[e.jsx(H,{})," Clear"]})}),e.jsx(g,{to:"/qpsettings/view-teacher-list",children:e.jsxs(d,{style:{background:"green",color:"white"},children:[e.jsx(T,{})," View"]})}),e.jsx(g,{to:"/dashboard",children:e.jsxs(d,{type:"primary",danger:!0,children:[e.jsx(L,{})," Exit"]})})]}),children:[e.jsx(i,{gutter:16,children:e.jsxs(c,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Teacher Code"}),e.jsx(x,{disabled:f,style:{marginBottom:"10px"},value:t.teachcode,onBlur:()=>u("teachcode"),onChange:a=>o(a.target.value,"teachcode")})]})}),e.jsxs(i,{gutter:16,children:[e.jsxs(c,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Name"}),e.jsx(x,{style:{marginBottom:"10px"},value:t.name,onChange:a=>o(a.target.value,"name")})]}),e.jsxs(c,{xs:24,sm:24,md:12,lg:4,xl:4,xxl:4,children:[e.jsx("label",{children:"Date of Birth"}),e.jsx(D,{className:"date-input",formatChars:E,mask:"ed/nm/zyyy",placeholder:"dd/mm/yyyy",style:{marginBottom:"10px",height:"35px"},value:t.dob,onChange:a=>o(a.target.value,"dob")})]})]}),e.jsxs(i,{gutter:16,children:[e.jsxs(c,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Email ID"}),e.jsx(x,{style:{marginBottom:"10px"},value:t.email,onChange:a=>o(a.target.value,"email")})]}),e.jsxs(c,{xs:24,sm:24,md:12,lg:4,xl:4,xxl:4,children:[e.jsx("label",{children:"Mobile No."}),e.jsx(x,{style:{marginBottom:"10px"},value:t.mobile,maxLength:10,onBlur:()=>u("mobile"),onChange:a=>{const n=/^[0-9\b]+$/;(a.target.value==""||n.test(a.target.value))&&o(a.target.value,"mobile")}})]})]}),e.jsxs(i,{gutter:16,children:[e.jsxs(c,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"College"}),e.jsx(j,{showSearch:!0,optionFilterProp:"label",style:{marginBottom:"10px",width:"100%"},value:t.college,options:b,onChange:a=>o(a,"college")})]}),e.jsxs(c,{xs:24,sm:24,md:12,lg:4,xl:4,xxl:4,children:[e.jsx("label",{children:"Examiner"}),e.jsx(j,{style:{marginBottom:"10px",width:"100%"},value:t.examiner,options:R,onChange:a=>o(a,"examiner")})]})]}),e.jsx(i,{gutter:16,children:e.jsx(c,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:e.jsx(d,{type:"primary",onClick:()=>y(),children:"Save"})})})]})},P=l=>({college:l.collegeDetails,teachdet:l.teachdet}),K=v(P,{saveTeacherDetails:S,getCollegeDetails:I,getTeachdet:N,checkTeachcode:$})(O);export{K as default};
|