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