PageSourceSearch

https://www.bagchee.com/static/js/8977.5eb345dd.chunk.js

js bagchee.com collected 2026-10-02 11:17:02 UTC 13,811 bytes, 3 lines download raw bytes

1/*! For license information please see 8977.5eb345dd.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8977],{67(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},797(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]])},1360(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},2024(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4651(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},5087(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},6210(e,s,a){a.d(s,{A:()=>t});const t=(0,a(7784).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},8977(e,s,a){a.r(s),a.d(s,{default:()=>y});var t=a(9379),r=a(5043),l=a(7874),n=a(2024),c=a(6210),i=a(4651),d=a(5087),m=a(67),o=a(1360),p=a(797),x=a(1884),h=a(614),u=a(3046
2),g=a(2339),b=a(579);const y=()=>{const e=(0,l.Zp)(),[s,a]=(0,r.useState)(!1),[y,j]=(0,r.useState)(!1),[v,N]=(0,r.useState)(null),f={username:"",email:"",password:"",status:1,firstname:"",lastname:"",company:"",phone:"",membership:"inactive",membershipStart:"",membershipEnd:"",isGuest:"inactive",image:null},[w,A]=(0,r.useState)(f),k=e=>{A((0,t.A)((0,t.A)({},w),{},{[e.target.name]:e.target.value}))},C=e=>{A((0,t.A)((0,t.A)({},w),{},{[e]:""}))},S=async(s,t)=>{if(s.preventDefault(),!w.username||!w.email)return g.Ay.error("Username and Email are mandatory!");if(!w.password||w.password.length<6)return g.Ay.error("Password must be at least 6 characters");a(!0);const r=g.Ay.loading("Creating new user account...");try{const s=new FormData;Object.keys(w).forEach(e=>{"image"!==e&&""!==w[e]&&s.append(e,w[e])});const a="".concat(w.firstname," ").concat(w.lastname).trim();s.append("name",a),w.image&&s.append("profileImage",w.image);(await u.A.post("/user/register",s)).data.status&&(g.Ay.success("User created successfully! \u2728",{id:r}),"back"===t?e("/admin/users"):(A(f),N(null)))}catch(d){var l,n,c,i;console.error(d);const e=(null===(l=d.response)||void 0===l||null===(n=l.data)||void 0===n?void 0:n.msg)||(null===(c=d.response)||void 0===c||null===(i=c.data)||void 0===i?void 0:i.message)||"Creation failed";g.Ay.error(e,{id:r})}finally{a(!1)}},M="col-span-12 md:col-span-3 text-left md:text-right text-[11px] font-bold text-text-muted uppercase font-montserrat pt-2 tracking-tight",z="col-span-12 md:col-span-9",E="w-full border border-gray-300 rounded-lg px-4 py-2 text-[13px] outline-none transition-all focus:border-primary bg-white focus:ring-4 focus:ring-primary/10 font-body";return(0,b.jsxs)("div",{className:"bg-cream-50 min-h-screen font-body text-text-main pb-10",children:[(0,b.jsxs)("div",{className:"bg-primary px-6 py-4 shadow-md flex items-center justify-between text-white sticky top-0 z-50",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(x.A,{size:22}),(0,b.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider font-display",children:"Add New User"})]}),(0,b.jsx)("button",{onClick:()=>e("/admin/users"),className:"hover:rotate-90 transition-transform",children:(0,b.jsx)(h.A,{size:24})})]}),(0,b.jsx)("div",{className:"max-w-5xl mx-auto p-4 md:p-8 mt-6",children:(0,b.jsxs)("form",{onSubmit:e=>e.preventDefault(),className:"bg-white rounded-2xl border border-cream-200 shadow-xl overflow-hidden",children:[(0,b.jsxs)("div",{className:"bg-cream-100/50 px-8 py-4 border-b border-cream-200 flex items-center gap-2",children:[(0,b.jsx)("div",{className:"w-1.5 h-4 bg-primary rounded-full"}),(0,b.jsx)("h2",{className:"text-[10px] font-bold uppercase tracking-[0.2em] font-montserrat text-text-muted",children:"Account Credentials"})]}),(0,b.jsxs)("div",{className:"p-8 md:p-12 space-y-8",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Username*"}),(0,b.jsx)("input",{type:"text",name:"username",value:w.username,onChange:k,className:E,placeholder:"Unique username"})]}),(0,b.jsxs)("div",{className:"space-y-2 relative",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Secure Password*"}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("input",{type:y?"text":"password",name:"password",value:w.password,onChange:k,className:E,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),(0,b.jsx)("button",{type:"button",onClick:()=>j(!y),className:"absolute right-3 top-2.5 text-gray-400 hover:text-primary transition-colors",children:y?(0,b.jsx)(i.A,{size:16}):(0,b.jsx)(d.A,{size:16})})]})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center pt-4",children:[(0,b.jsx)("label",{className:M,children:"Email Address*"}),(0,b.jsx)("div",{className:z,children:(0,b.jsx)("input",{type:"email",name:"email",value:w.email,onChange:k,className:E,placeholder:"[email protected]"})})]}),(0,b.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start pt-4 border-t border-gray-50",children:[(0,b.jsx)("label",{className:M,children:"Active Status"}),(0,b.jsxs)("div",{className:"".concat(z," flex gap-6 pt-1"),children:[(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer group",children:[(0,b.jsx)("input",{type:"radio",name:"status",checked:1===parseInt(w.status),onChange:()=>A((0,t.A)((0,t.A)({},w),{},{status:1})),className:"w-4 h-4 accent-green-600"}),(0,b.jsx)("span",{className:"text-sm font-semibold group-hover:text-green-600 transition-colors",children:"Active"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer group",children:[(0,b.jsx)("input",{type:"radio",name:"status",checked:0===parseInt(w.status),onChange:()=>A((0,t.A)((0,t.A)({},w),{},{status:0})),className:"w-4 h-4 accent-red-600"}),(0,b.jsx)("span",{className:"text-sm font-semibold group-hover:text-red-600 transition-colors",children:"Inactive"})]})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 pt-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"First Name"}),(0,b.jsx)("input",{type:"text",name:"firstname",value:w.firstname,onChange:k,className:E})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Last Name"}),(0,b.jsx)("input",{type:"text",name:"lastname",value:w.lastname,onChange:k,className:E})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Company"}),(0,b.jsx)("input",{type:"text",name:"company",value:w.company,onChange:k,className:E})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Phone Number"}),(0,b.jsx)("input",{type:"text",name:"phone",value:w.phone,onChange:k,className:E})]})]}),(0,b.jsxs)("div",{className:"bg-gray-50/50 p-6 rounded-2xl border border-gray-100 space-y-6",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:"w-1 h-3 bg-primary rounded-full"}),(0,b.jsx)("span",{className:"text-[10px] font-black text-primary uppercase tracking-[0.15em]",children:"Membership Configuration"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 items-start",children:[(0,b.jsx)("label",{className:"col-span-12 md:col-span-3 text-[11px] font-bold text-gray-500 uppercase pt-2",children:"Plan Type"}),(0,b.jsxs)("div",{className:"col-span-12 md:col-span-9 flex gap-6 pt-1",children:[(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:"membership",value:"active",checked:"active"===w.membership,onChange:k,className:"w-4 h-4 accent-primary"}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"Active Member"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:"membership",value:"inactive",checked:"inactive"===w.membership,onChange:k,className:"w-4 h-4 accent-primary"}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"Non-Member"})]})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Member Since"}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("input",{type:"date",name:"membershipStart",value:w.membershipStart,onCh
2ange:k,className:E}),(0,b.jsx)("button",{type:"button",onClick:()=>C("membershipStart"),className:"text-[9px] font-bold text-primary absolute right-3 -bottom-5 hover:underline",children:"CLEAR DATE"})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-[10px] font-bold text-gray-400 uppercase ml-1",children:"Member Until"}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("input",{type:"date",name:"membershipEnd",value:w.membershipEnd,onChange:k,className:E}),(0,b.jsx)("button",{type:"button",onClick:()=>C("membershipEnd"),className:"text-[9px] font-bold text-primary absolute right-3 -bottom-5 hover:underline",children:"CLEAR DATE"})]})]})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-start pt-4 border-t border-gray-50",children:[(0,b.jsx)("label",{className:M,children:"Is Guest Account?"}),(0,b.jsxs)("div",{className:"".concat(z," flex gap-6 pt-1"),children:[(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:"isGuest",value:"active",checked:"active"===w.isGuest,onChange:k,className:"w-4 h-4 accent-primary"}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"Guest User"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:"isGuest",value:"inactive",checked:"inactive"===w.isGuest,onChange:k,className:"w-4 h-4 accent-primary"}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"Registered User"})]})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center border-t border-gray-50 pt-8",children:[(0,b.jsx)("label",{className:M,children:"User Avatar"}),(0,b.jsx)("div",{className:z,children:(0,b.jsxs)("div",{className:"flex items-center gap-6",children:[(0,b.jsx)("div",{className:"h-24 w-24 rounded-2xl border-2 border-primary/10 overflow-hidden bg-gray-50 flex items-center justify-center shadow-inner",children:v?(0,b.jsx)("img",{src:v,alt:"Preview",className:"h-full w-full object-cover"}):(0,b.jsx)(m.A,{className:"text-gray-300",size:32})}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,b.jsx)("input",{type:"file",id:"user_img",className:"hidden",onChange:e=>{const s=e.target.files[0];s&&(A((0,t.A)((0,t.A)({},w),{},{image:s})),N(URL.createObjectURL(s)))},accept:"image/*"}),(0,b.jsxs)("label",{htmlFor:"user_img",className:"bg-white border border-gray-300 px-5 py-2 rounded-xl text-[10px] font-black uppercase cursor-pointer hover:bg-gray-50 flex items-center gap-2 shadow-sm transition-all active:scale-95",children:[(0,b.jsx)(p.A,{size:14,className:"text-primary"})," Select Photo"]}),w.image&&(0,b.jsxs)("span",{className:"text-[10px] text-green-600 font-bold animate-pulse",children:["Selected: ",w.image.name]})]})]})})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row justify-center items-center gap-4 pt-12 border-t mt-12",children:[(0,b.jsxs)("button",{type:"button",onClick:e=>S(e,"stay"),disabled:s,className:"w-full sm:w-auto bg-white border border-gray-300 hover:bg-gray-50 text-text-main px-10 py-3 rounded-xl font-bold text-[11px] uppercase transition-all flex items-center justify-center gap-2 shadow-sm active:scale-95",children:[s?(0,b.jsx)(n.A,{size:16,className:"animate-spin"}):(0,b.jsx)(c.A,{size:18,className:"text-green-600"}),"Save"]}),(0,b.jsxs)("button",{type:"button",onClick:e=>S(e,"back"),disabled:s,className:"w-full sm:w-auto bg-primary text-white hover:bg-primary-dark px-10 py-3 rounded-xl font-bold text-[11px] uppercase flex items-center justify-center gap-2 shadow-lg shadow-primary/20 active:scale-95 transition-all",children:[(0,b.jsx)(o.A,{size:18}),"Save and Return"]}),(0,b.jsxs)("button",{type:"button",onClick:()=>e("/admin/users"),className:"w-full sm:w-auto bg-white border border-red-100 text-red-500 hover:bg-red-50 px-10 py-3 rounded-xl font-bold text-[11px] uppercase transition-all flex items-center justify-center gap-2 shadow-sm",children:[(0,b.jsx)(h.A,{size:18})," cancel"]})]})]})]})})]})}}}]);
3//# sourceMappingURL=8977.5eb345dd.chunk.js.map

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.