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


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/TeacherEntry-D2Zm_qtk.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-CBbt9NTc.js";import{I as T}from"./index-BQ2HHrHV.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-DQRAczXL.js";import{S as N}from"./index-2FOt2MBX.js";import{R as $}from"./StopOutlined-C11N2FOB.js";import{R as F}from"./HomeOutlined-Doj6V8OL.js";import{R as i,C as o}from"./row-CFnelDp4.js";import"./responsiveObserver-BCVFZ_Q7.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};