1/*! For license information please see 670.4452c6fa.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[670],{670(e,t,a){a.r(t),a.d(t,{default:()=>x});var s=a(9379),r=a(5043),n=a(7874),i=a(2024),c=a(6210),d=a(4805),l=a(614),o=a(3046),p=a(2339),m=a(579);const x=()=>{const e=(0,n.Zp)(),{id:t}=(0,n.g)(),[a,x]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!0),[u,b]=(0,r.useState)({title:""});(0,r.useEffect)(()=>{(async()=>{try{const e="https://www.bagchee.com/api",a=await o.A.get("".concat(e,"/tags/get/").concat(t));a.data.status&&b({title:a.data.data.title})}catch(a){p.Ay.error("Failed to load tag details"),e("/admin/tags")}finally{g(!1)}})()},[t,e]);const y=async(a,s)=>{if(a.preventDefault(),!u.title)return p.Ay.error("Title is required!");x(!0);const r=p.Ay.loading("Updating tag...");try{const a="https://www.bagchee.com/api";(await o.A.patch("".concat(a,"/tags/update/").concat(t),u)).data.status&&(p.Ay.success("Tag updated successfully! \ud83c\udff7\ufe0f",{id:r}),"back"===s&&e("/admin/tags"))}catch(c){var n,i;p.Ay.error((null===(n=c.response)||void 0===n||null===(i=n.data)||void 0===i?void 0:i.msg)||"Failed to update",{id:r})}finally{x(!1)}};return h?(0,m.jsx)("div",{className:"min-h-screen bg-cream-50 flex items-center justify-center",children:(0,m.jsx)(i.A,{className:"animate-spin text-primary",size:40})}):(0,m.jsxs)("div",{className:"bg-cream-50 min-h-screen font-body text-text-main pb-10",children:[(0,m.jsx)("div",{className:"bg-primary px-6 py-3 shadow-md flex items-center justify-between",children:(0,m.jsx)("h1",{className:"text-lg font-bold text-white uppercase tracking-slick font-display",children:"Edit Tag"})}),(0,m.jsx)("div",{className:"max-w-6xl mx-auto p-6 mt-4",children:(0,m.jsxs)("form",{className:"bg-white rounded border border-cream-200 shadow-sm overflow-hidden",children:[(0,m.jsx)("div",{className:"bg-cream-100 px-6 py-2 border-b border-cream-200",children:(0,m.jsx)("h2",{className:"text-[11px] font-bold uppercase tracking-wider font-montserrat text-text-muted",children:"Modify Tag Information"})}),(0,m.jsxs)("div",{className:"p-8 space-y-6",children:[(0,m.jsxs)("div",{className:"grid grid-cols-12 gap-4 items-center",children:[(0,m.jsx)("label",{className:"col-span-3 text-right text-[11px] font-bold text-text-muted uppercase font-montserrat",children:"Title"}),(0,m.jsx)("div",{className:"col-span-9",children:(0,m.jsx)("input",{type:"text",name:"title",value:u.title,onChange:e=>{b((0,s.A)((0,s.A)({},u),{},{[e.target.name]:e.target.value}))},placeholder:"Enter tag title",className:"w-full border border-gray-300 rounded px-4 py-2 text-[13px] outline-none transition-all focus:border-primary focus:ring-1 focus:ring-primary/20 bg-white text-text-main"})})]}),(0,m.jsxs)("div",{className:"flex justify-center items-center gap-3 pt-8 border-t mt-10 font-montserrat",children:[(0,m.jsxs)("button",{type:"button",onClick:e=>y(e,"stay"),disabled:a,className:"bg-white border border-gray-300 hover:bg-gray-50 text-text-main px-6 py-2 rounded font-bold text-[11px] uppercase transition-all flex items-center gap-2 shadow-sm",children:[a?(0,m.jsx)(i.A,{size:14,className:"animate-spin"}):(0,m.jsx)(c.A,{size:16,className:"text-green-600"}),(0,m.jsx)("span",{className:"font-bold",children:"Update"})]}),(0,m.jsxs)("button",{type:"button",onClick:e=>y(e,"back"),disabled:a,className:"bg-white border border-gray-300 hover:bg-gray-50 text-text-main px-6 py-2 rounded font-bold text-[11px] uppercase transition-all flex items-center gap-2 shadow-sm",children:[(0,m.jsx)(d.A,{size:16,className:"text-primary"}),(0,m.jsx)("span",{className:"font-bold",children:"Update and go back to list"})]}),(0,m.jsxs)("button",{type:"button",onClick:()=>e("/admin/tags"),className:"bg-white border border-gray-300 hover:bg-gray-50 text-text-main px-6 py-2 rounded font-bold text-[11px] uppercase transition-all flex items-center gap-2 shadow-sm",children:[(0,m.jsx)(l.A,{size:16,className:"text-red-600"}),(0,m.jsx)("span",{className:"font-bold",children:"Cancel"})]})]})]})]})})]})}},2024(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4805(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},6210(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])}}]); 3//# sourceMappingURL=670.4452c6fa.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.