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.223.210.196
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/TeacherEntry-6f3xJJiO.js |
import{x as p,Q as v,r,t as e,D as C,B as d,L as u,R as w,F as m,G as j,E as k}from"./index-B1vCiLdb.js";import{I as T}from"./index-5BwMSbtq.js";import{f as B,e as D}from"./sem-BK69X1ab.js";import{s as E,g as R,a as S,c as I}from"./TeacherEntry-CQLdv3pC.js";import{S as N}from"./index-Bg4J2mA-.js";import{R as $}from"./StopOutlined-DIuy6noG.js";import{R as F}from"./HomeOutlined-URzAi1xv.js";import{R as i,C as o}from"./row-BpBokYu2.js";import"./responsiveObserver-MZZXoO8e.js";const L=l=>{const s=v();r.useRef(null);const[t,x]=r.useState({teachcode:"",name:"",dob:"",email:"",mobile:"",college:"",examiner:""}),[f,h]=r.useState(!1);r.useEffect(()=>{s.type!=="insert"&&(h(!0),x({...t,teachcode:s.teachcode,mobile:s.mobileno}),l.getTeachdet(s.teachcode)),l.getCollegeDetails()},[]),r.useEffect(()=>{s.type!=="insert"&&(h(!0),x({...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 c=(a,n)=>{x({...t,[n]:a})},g=async a=>{a=="teachcode"?await l.checkTeachcode(t.teachcode,a):s.type==="insert"&&await l.checkTeachcode(t.mobile,a)},y=async()=>{if(t.teachcode==""||t.name==""||t.dob==""||t.email==""||t.mobile==""||t.college==""||t.examiner==""){k("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}));return e.jsxs(C,{style:{margin:"6rem 10px 10px"},title:e.jsx("h6",{children:"Teacher Entry"}),extra:e.jsxs(N,{children:[e.jsxs(d,{style:{background:"black",color:"white"},onClick:()=>window.location.reload(),children:[e.jsx($,{})," Clear"]}),e.jsx(u,{to:"/qpsettings/view-teacher-list",children:e.jsxs(d,{style:{background:"green",color:"white"},children:[e.jsx(w,{})," View"]})}),e.jsx(u,{to:"/dashboard",children:e.jsxs(d,{type:"primary",danger:!0,children:[e.jsx(F,{})," Exit"]})})]}),children:[e.jsx(i,{gutter:16,children:e.jsxs(o,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Teacher Code"}),e.jsx(m,{disabled:f,style:{marginBottom:"10px"},value:t.teachcode,onBlur:()=>g("teachcode"),onChange:a=>c(a.target.value,"teachcode")})]})}),e.jsxs(i,{gutter:16,children:[e.jsxs(o,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Name"}),e.jsx(m,{style:{marginBottom:"10px"},value:t.name,onChange:a=>c(a.target.value,"name")})]}),e.jsxs(o,{xs:24,sm:24,md:12,lg:4,xl:4,xxl:4,children:[e.jsx("label",{children:"Date of Birth"}),e.jsx(T,{className:"date-input",formatChars:B,mask:"ed/nm/zyyy",placeholder:"dd/mm/yyyy",style:{marginBottom:"10px",height:"35px"},value:t.dob,onChange:a=>c(a.target.value,"dob")})]})]}),e.jsxs(i,{gutter:16,children:[e.jsxs(o,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Email ID"}),e.jsx(m,{style:{marginBottom:"10px"},value:t.email,onChange:a=>c(a.target.value,"email")})]}),e.jsxs(o,{xs:24,sm:24,md:12,lg:4,xl:4,xxl:4,children:[e.jsx("label",{children:"Mobile No."}),e.jsx(m,{style:{marginBottom:"10px"},value:t.mobile,maxLength:10,onBlur:()=>g("mobile"),onChange:a=>{const n=/^[0-9\b]+$/;(a.target.value==""||n.test(a.target.value))&&c(a.target.value,"mobile")}})]})]}),e.jsxs(i,{gutter:16,children:[e.jsxs(o,{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=>c(a,"college")})]}),e.jsxs(o,{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:D,onChange:a=>c(a,"examiner")})]})]}),e.jsx(i,{gutter:16,children:e.jsx(o,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:e.jsx(d,{type:"primary",onClick:()=>y(),children:"Save"})})})]})},O=l=>({college:l.collegeDetails,teachdet:l.teachdet}),V=p(O,{saveTeacherDetails:E,getCollegeDetails:R,getTeachdet:S,checkTeachcode:I})(L);export{V as default};
|