PageSourceSearch

https://redgo.in/assets/js/AddDeliveryman-CT6fZprH.js

js redgo.in collected 2026-09-24 15:03:50 UTC 14,169 bytes, 1 lines download raw bytes

1import{r,j as e}from"./index-Cf_ajVON.js";import{D as C,a as D,d as E,b as P,e as S}from"./dialog-CrMXwKWe.js";import{E as k}from"./index-BZFWozEr.js";import{S as I}from"./settings-BEH2D0zs.js";import{U as p}from"./upload-BhkmleXG.js";import{C as T}from"./calendar-C53yYcCc.js";import{E as g}from"./eye-off-CoDAbRMZ.js";import{E as f}from"./eye-DP9IZTXG.js";import"./index-BH0fEq1S.js";import"./index-DvNrSChk.js";import"./index-BLHo7-Gi.js";import"./index-Bkla0msJ.js";import"./tslib.es6-CwyXKlH1.js";import"./index-BgkASZz5.js";import"./x-BzwCsDoT.js";function U(){const[t,m]=r.useState({firstName:"",lastName:"",email:"",deliverymanType:"",zone:"",vehicle:"",identityType:"Passport",identityNumber:"",age:"",birthdate:"",phone:"+1",password:"",confirmPassword:""}),[i,j]=r.useState(!1),[o,N]=r.useState(!1),[v,n]=r.useState(!1),[l,x]=r.useState({}),[u,b]=r.useState(!1),a=(s,d)=>{m(c=>({...c,[s]:d})),l[s]&&x(c=>({...c,[s]:""}))},y=()=>{const s={};return t.firstName.trim()||(s.firstName="First name is required"),t.lastName.trim()||(s.lastName="Last name is required"),t.email.trim()?k.test(t.email)||(s.email="Invalid email format"):s.email="Email is required",t.deliverymanType||(s.deliverymanType="Deliveryman type is required"),t.zone||(s.zone="Zone is required"),t.vehicle||(s.vehicle="Vehicle is required"),t.identityNumber.trim()||(s.identityNumber="Identity number is required"),(!t.age||parseInt(t.age)<18)&&(s.age="Age must be at least 18"),t.birthdate||(s.birthdate="Birthdate is required"),(!t.phone||t.phone.length<10)&&(s.phone="Valid phone number is required"),(!t.password||t.password.length<8)&&(s.password="Password must be at least 8 characters"),t.password!==t.confirmPassword&&(s.confirmPassword="Passwords do not match"),x(s),Object.keys(s).length===0},w=async s=>{s.preventDefault(),y()&&(b(!0),await new Promise(d=>setTimeout(d,1e3)),b(!1),n(!0),h())},h=()=>{m({firstName:"",lastName:"",email:"",deliverymanType:"",zone:"",vehicle:"",identityType:"Passport",identityNumber:"",age:"",birthdate:"",phone:"+1",password:"",confirmPassword:""})};return e.jsxs("div",{className:"p-4 lg:p-6 bg-slate-50 min-h-screen",children:[e.jsx("div",{className:"max-w-5xl mx-auto",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6 relative",children:[e.jsx("button",{className:"absolute top-6 right-6 p-2 rounded-lg bg-slate-100 hover:bg-slate-200 transition-colors",children:e.jsx(I,{className:"w-5 h-5 text-slate-600"})}),e.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-6",children:"Add New Deliveryman"}),e.jsxs("form",{onSubmit:w,children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"1. General info"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["First Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:t.firstName,onChange:s=>a("firstName",s.target.value),placeholder:"Ex: Jhone",className:`w-full px-4 py-2.5 border rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm ${l.firstName?"border-red-500":"border-slate-300"}`}),l.firstName&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:l.firstName})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Last Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:t.lastName,onChange:s=>a("lastName",s.target.value),placeholder:"Ex: Joe",className:`w-full px-4 py-2.5 border rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm ${l.lastName?"border-red-500":"border-slate-300"}`}),l.lastName&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:l.lastName})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Email ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"email",value:t.email,onChange:s=>a("email",s.target.value),placeholder:"Ex: [email protected]",className:`w-full px-4 py-2.5 border rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm ${l.email?"border-red-500":"border-slate-300"}`}),l.email&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:l.email})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Deliveryman Type ",e.jsx("span",{className:"text-red-500",children:"*"})]}
1),e.jsxs("select",{value:t.deliverymanType,onChange:s=>a("deliverymanType",s.target.value),className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:[e.jsx("option",{value:"",children:"Delivery man type"}),e.jsx("option",{value:"full-time",children:"Full Time"}),e.jsx("option",{value:"part-time",children:"Part Time"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Zone ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:t.zone,onChange:s=>a("zone",s.target.value),className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:[e.jsx("option",{value:"",children:"Select Zone"}),e.jsx("option",{value:"asia",children:"Asia"}),e.jsx("option",{value:"europe",children:"Europe"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Image ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-6 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[e.jsx(p,{className:"w-8 h-8 text-slate-400 mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-blue-600 mb-1",children:"Click to upload Or drag and drop"}),e.jsx("p",{className:"text-xs text-slate-500",children:"JPG, JPEG, PNG, Gif Image size: Max 2 MB (1:1)"})]})]})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"2. Identification Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Vehicle ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:t.vehicle,onChange:s=>a("vehicle",s.target.value),className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:[e.jsx("option",{value:"",children:"Select Vehicle"}),e.jsx("option",{value:"car",children:"Car"}),e.jsx("option",{value:"motorcycle",children:"Motorcycle"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Identity Type ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:t.identityType,onChange:s=>a("identityType",s.target.value),className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:[e.jsx("option",{value:"Passport",children:"Passport"}),e.jsx("option",{value:"Driving License",children:"Driving License"}),e.jsx("option",{value:"National ID",children:"National ID"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Identity Number ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:t.identityNumber,onChange:s=>a("identityNumber",s.target.value),placeholder:"Ex: DH-23434-LS",className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:"Identity Image"}),e.jsxs("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-6 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[e.jsx(p,{className:"w-8 h-8 text-slate-400 mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-blue-600 mb-1",children:"Select a file or Drag & Drop here"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Pdf, doc, jpg. File size: max 2 MB"})]})]})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"3. Additional Data"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Enter your age ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"number",value:t.age,onChange:s=>a("age",s.target.value),placeholder:"Enter Age",className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Enter your birthdate ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"date",value:t.birthdate,onChange:s=>a("birthdate",s.target.value),className:"w-full px-4 py-2.5 pr-10 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"}),e.jsx(T,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:"Driving license"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"relative flex-1",children:e.jsx("input",{type:"file",className:"w-full px-4 py-2.5 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"})})})]})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"4. Account info"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Phone ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"px-3 py-2.5 border border-slate-300 rounded-l-lg bg-slate-50 text-sm",children:"+1"}),e.jsx("input",{type:"tel",value:t.phone.replace("+1",""),onChange:s=>a("phone","+1"+s.target.value),placeholder:"Enter phone number",className:"flex-1 px-4 py-2.5 border border-slate-300 border-l-0 rounded-r-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Password ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:i?"text":"password",value:t.password,onChange:s=>a("password",s.target.value),placeholder:"Ex: 8+ Character",className:"w-full px-4 py-2.5 pr-10 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"}),e.jsx("button",{type:"button",onClick:()=>j(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:i?e.jsx(g,{className:"w-4 h-4"}):e.jsx(f,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-semibold text-slate-700 mb-2",children:["Confirm Password ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:o?"text":"password",value:t.confirmPassword,onChange:s=>a("confirmPassword",s.target.value),placeholder:"Ex: 8+ Character",className:"w-full px-4 py-2.5 pr-10 border border-slate-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"}),e.jsx("button",{type:"button",onClick:()=>N(!o),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:o?e.jsx(g,{className:"w-4 h-4"}):e.jsx(f,{className:"w-4 h-4"})})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-4",children:[e.jsx("button",{type:"button",onClick:h,className:"px-6 py-2.5 text-sm font-medium rounded-lg border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 transition-all",children:"Reset"}),e.jsx("button",{type:"submit",disabled:u,className:"px-6 py-2.5 text-sm font-medium rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Submitting...":"Submit"})]})]})]})}),e.jsx(C,{open:v,onOpenChange:n,children:e.jsxs(D,{className:"max-w-md bg-white p-0 o
1pacity-0 data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:scale-100 data-[state=closed]:scale-100",children:[e.jsx(E,{className:"px-6 pt-6 pb-4",children:e.jsx(P,{className:"text-green-600",children:"Success!"})}),e.jsx("div",{className:"px-6 pb-6",children:e.jsx("p",{className:"text-sm text-slate-700",children:"Deliveryman added successfully!"})}),e.jsx(S,{className:"px-6 pb-6",children:e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 text-sm font-medium rounded-lg bg-emerald-500 text-white hover:bg-emerald-600 transition-all shadow-md",children:"OK"})})]})})]})}export{U as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.