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.131.37.82
Current Path : /var/www/qpms/assets/ |
| Current File : /var/www/qpms/assets/CreateUser-DReVqxqq.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-D7ghdVBa.js";import{I as D}from"./index-BhmpznoO.js";import{f as S}from"./sem-xL-Ac5nH.js";import{g as R,a as B,b as E,c as M}from"./Usertype--BQnpqVr.js";import{S as N}from"./index-Bip1AesS.js";import{R as H}from"./StopOutlined-h8fRGMLz.js";import{R as L}from"./HomeOutlined-z5gj14D_.js";import{F as $}from"./Table-6YvjVkzP.js";import{R as n,C as i}from"./row-BdYVGbEy.js";import{R as F}from"./EditOutlined-CLK7Mmol.js";import"./index-CyAt-x3R.js";import"./index-CafVQrCG.js";import"./index-DVi4AHCo.js";import"./responsiveObserver-Dqu-tqCp.js";const T=s=>{const[a,h]=x.useState({mobile:"",name:"",email:"",dob:"",usertype:""}),[d,p]=x.useState(!1);x.useEffect(()=>{s.getUsertypeData()},[]);const o=(t,l)=>{h({...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=>{h({mobile:t.fmobileno,name:t.fname,email:t.femail,dob:t.fdob,usertype:t.fusertype}),p(!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(F,{})," 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(N,{children:[e.jsxs(r,{style:{background:"black",color:"white"},onClick:()=>window.location.reload(),children:[e.jsx(H,{})," 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(L,{})," 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($,{columns:f,dataSource:s.data,scroll:{x:800,y:300}})}),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:S,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}),ee=b(z,{getUsertypeData:R,saveCreateUser:B,openCreateUserModal:E,getUserData:M})(T);export{ee as default};
|