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 : 18.227.140.251


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/CreateUser-DEXFu6Y5.js

import{x as b,r as x,t as e,D as C,B as r,R as w,L as v,M as U,F as c,G as k,E as I}from"./index-CT0MCJRS.js";import{I as D}from"./index-I2DsYQ6D.js";import{p as S,f as R}from"./sem-DLpF_ddZ.js";import{g as B,a as E,b as M,c as N}from"./Usertype-CQx0n-7R.js";import{S as H}from"./index-BXd_zj4l.js";import{R as L}from"./StopOutlined-BC1K77n5.js";import{R as $}from"./HomeOutlined-tFTk3wpO.js";import{F}from"./Table-hKK0LBJN.js";import{R as n,C as i}from"./row-kYbFF_mS.js";import{R as T}from"./EditOutlined-BEohi6D3.js";import"./index-Deb-I35J.js";import"./index-CyeMQuwW.js";import"./index-BIuGNSBg.js";import"./responsiveObserver-zv9EbOz7.js";const O=s=>{const[a,p]=x.useState({mobile:"",name:"",email:"",dob:"",usertype:""}),[d,h]=x.useState(!1);x.useEffect(()=>{s.getUsertypeData()},[]);const o=(t,l)=>{p({...a,[l]:t})},g=async()=>{if(a.mobile===""||a.email===""||a.dob===""||a.usertype===""||a.name===""){I("info","all the fields are mandatory");return}const t=new FormData;t.append("type",JSON.stringify(d)),t.append("data",JSON.stringify(a)),await s.saveCreateUser(t)},m=()=>{s.openCreateUserModal(!1)},u=()=>{s.getUserData()},y=t=>{p({mobile:t.fmobileno,name:t.fname,email:t.femail,dob:t.fdob,usertype:t.fusertype}),h(!0),m()},f=[{title:"Sl. No.",dataIndex:"fslno",align:"center",width:"10%"},{title:"Name",dataIndex:"fname",width:"25%"},{title:"Mobile",dataIndex:"fmobileno",align:"center",width:"10%"},{title:"Email",dataIndex:"femail",width:"25%"},{title:"Dob",dataIndex:"fdob",align:"center",width:"10%"},{title:"Usertype",dataIndex:"fdescpn",align:"center",width:"10%"},{title:"Action",render:(t,l)=>e.jsxs(r,{style:{color:"white",background:"green"},size:"medium",onClick:()=>y(l),children:[e.jsx(T,{})," Edit"]}),align:"center",width:"10%"}],j=s.usertype.map((t,l)=>({key:l,value:t.fusertype,label:t.fdescpn}));return e.jsxs(C,{style:{margin:"6rem 10px 10px"},title:e.jsx("h6",{children:"Create User Type"}),extra:e.jsxs(H,{children:[e.jsxs(r,{style:{background:"black",color:"white"},onClick:()=>window.location.reload(),children:[e.jsx(L,{})," Clear"]}),e.jsxs(r,{style:{color:"white",background:"green"},onClick:()=>u(),children:[e.jsx(w,{})," View"]}),e.jsx(v,{to:"/",children:e.jsxs(r,{type:"primary",danger:!0,children:[e.jsx($,{})," Exit"]})})]}),children:[e.jsx(U,{title:e.jsx("p",{children:"User Data"}),footer:e.jsx(r,{type:"primary",onClick:()=>m(),children:"Close"}),width:1200,open:s.open,onCancel:()=>m(),children:e.jsx(F,{columns:f,dataSource:s.data,scroll:{x:800,y:300},pagination:S})}),e.jsx(n,{children:e.jsxs(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Mobile Number"}),e.jsx(c,{disabled:d,style:{marginBottom:"10px"},value:a.mobile,maxLength:10,onChange:t=>{const l=/^[0-9\b]+$/;(t.target.value==""||l.test(t.target.value))&&o(t.target.value,"mobile")}})]})}),e.jsx(n,{children:e.jsxs(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Name"}),e.jsx(c,{style:{marginBottom:"10px"},value:a.name,maxLength:50,onChange:t=>{o(t.target.value,"name")}})]})}),e.jsx(n,{children:e.jsxs(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Email"}),e.jsx(c,{style:{marginBottom:"10px"},value:a.email,name:"email",maxLength:50,onChange:t=>o(t.target.value,"email")})]})}),e.jsx(n,{children:e.jsxs(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Date of Birth"}),e.jsx(D,{style:{marginBottom:"10px"},formatChars:R,className:"date-input",mask:"ed/nm/zyyy",value:a.dob,onChange:t=>o(t.target.value,"dob"),placeholder:"dd/mm/yyyy"})]})}),e.jsx(n,{children:e.jsxs(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:[e.jsx("label",{children:"Select User Type"}),e.jsx(k,{disabled:d,style:{width:"100%",marginBottom:"10px"},value:a.usertype,options:j,onChange:t=>o(t,"usertype")})]})}),e.jsx(n,{children:e.jsx(i,{xs:24,sm:24,md:12,lg:6,xl:6,xxl:6,children:e.jsx(r,{type:"primary",onClick:()=>g(),children:"Save"})})})]})},z=s=>({usertype:s.getUsertypedata,data:s.getCreateUserData,open:s.openCreateUserModal}),te=b(z,{getUsertypeData:B,saveCreateUser:E,openCreateUserModal:M,getUserData:N})(O);export{te as default};