PageSourceSearch

https://www.bagchee.com/static/js/2381.4faf6c29.chunk.js

js bagchee.com collected 2026-10-02 11:17:04 UTC 9,623 bytes, 3 lines download raw bytes

1/*! For license information please see 2381.4faf6c29.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[2381],{86(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},1360(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},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"}]])},2381(e,t,a){a.r(t),a.d(t,{default:()=>y});var s=a(9379),r=a(5043),l=a(2024),i=a(6533),n=a(7104),o=a(1360),d=a(86),c=a(8693),h=a(9292),x=a(9855),p=a(7874),m=a(3046),u=a(2339),b=a(5003),g=a(579);const y=()=>{const e=(0,p.Zp)(),{confirm:t}=(0,b.S)(),[a,y]=(0,r.useState)([]),[w,f]=(0,r.useState)(!0),[j,v]=(0,r.useState)(!1),[N,A]=(0,r.useState)(!1),[k,C]=(0,r.useState)({section:"",title:"",tagline:""}),M=async()=>{f(!0);try{const e="https://www.bagchee.com/api",t=await m.A.get("".concat(e,"/home-sections/list"));t.data.status&&(y(t.data.data),A(!1))}catch(e){console.error("Fetch Error:",e),u.Ay.error("Failed to load home sections")}finally{f(!1)}};(0,r.useEffect)(()=>{M()},[]);const S=(0,r.useMemo)(()=>a.filter(e=>(e.section||"").toLowerCase().includes(k.section.toLowerCase())&&(e.title||"").toLowerCase().includes(k.title.toLowerCase())&&(e.tagline||"").toLowerCase().includes(k.tagline.toLowerCase())),[a,k]),z=e=>{C((0,s.A)((0,s.A)({},k),{},{[e.target.name]:e.target.value}))},E="w-full rounded p-1 text-[11px] outline-none text-text-main border border-transparent focus:border-white/50 bg-white/20 placeholder-white/50 text-white font-body";return(0,g.jsxs)("div",{className:"bg-cream-50 min-h-screen p-4 md:p-6 font-body text-text-main pb-20",children:[(0,g.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4 mb-6",children:[(0,g.jsxs)("div",{className:"flex flex-wrap gap-2 w-full md:w-auto",children:[(0,g.jsxs)("button",{onClick:()=>e("/admin/add-home-section"),className:"bg-primary text-white px-5 py-2.5 rounded-xl shadow-lg shadow-primary/20 flex items-center gap-2 font-bold text-xs uppercase hover:brightness-110 active:scale-95 transition-all",children:[(0,g.jsx)(o.A,{size:16})," Add Section"]}),N&&(0,g.jsxs)("button",{onClick:async()=>{if(!N)return u.Ay.error("No changes detected to save!");v(!0);const e=u.Ay.loading("Updating sections...");try{const t="https://www.bagchee.com/api";(await m.A.post("".concat(t,"/home-sections/bulk-update"),{sections:a})).data.status&&(u.Ay.success("All sections updated! \u2728",{id:e}),A(!1))}catch(t){u.Ay.error("Failed to save changes",{id:e})}finally{v(!1)}},disabled:j,className:"bg-green-600 text-white px-5 py-2.5 rounded-xl shadow-lg flex items-center gap-2 font-bold text-xs uppercase hover:bg-green-700 active:scale-95 transition-all animate-pulse",children:[j?(0,g.jsx)(l.A,{size:16,className:"animate-spin"}):(0,g.jsx)(c.A,{size:16}),"Save All Changes"]})]}),(0,g.jsxs)("div",{className:"flex flex-wrap gap-2 w-full md:w-auto justify-end",children:[(0,g.jsxs)("button",{className:"bg-white border border-gray-300 text-gray-700 px-4 py-1.5 rounded-xl shadow-sm hover:bg-gray-50 flex items-center gap-2 text-xs font-bold transition-colors",children:[(0,g.jsx)(n.A,{size:14,className:"text-orange-400"})," Export"]}),(0,g.jsx)("button",{onClick:()=>{C({section:"",title:"",tagline:""})},className:"bg-white border border-gray-300 text-gray-700 px-4 py-1.5 rounded-xl shadow-sm hover:text-red-500 transition-all flex items-center gap-2 text-xs font-bold uppercase",children:"Clear filters"}),(0,g.jsx)("div",{className:"relative flex items-center",children:(0,g.jsx)("button",{onClick:M,className:"bg-primary text-white p-2 rounded-xl hover:brightness-110 transition-all shadow-sm group",children:(0,g.jsx)(h.A,{size:16})})})]})]}),(0,g.jsxs)("div",{className:"bg-white rounded-2xl border border-cream-200 overflow-hidden shadow-xl animate-fadeIn",children:[(0,g.jsx)("div",{className:"overflow-x-auto",children:(0,g.jsxs)("table",{className:"w-full min-w-[800px] border-collapse text-sm",children:[(0,g.jsxs)("thead",{children:[(0,g.jsxs)("tr",{className:"bg-primary text-white border-b border-white/10 font-bold uppercase tracking-widest text-[10px] font-display",children:[(0,g.jsx)("th",{className:"p-4 text-left border-r border-white/20 w-1/3",children:"Section Category"}),(0,g.jsx)("th",{className:"p-4 text-left border-r border-white/20",children:"Title (Editable)"}),(0,g.jsx)("th",{className:"p-4 text-left border-r border-white/20 w-1/3",children:"Tagline (Editable)"}),(0,g.jsx)("th",{className:"p-4 text-center w-32",children:"Actions"})]}),(0,g.jsxs)("tr",{className:"bg-primary border-b border-gray-200",children:[(0,g.jsx)("td",{className:"p-2 border-r border-white/20",children:(0,g.jsx)("input",{name:"section",value:k.section,onChange:z,type:"text",className:E,placeholder:"Filter Section..."})}),(0,g.jsx)("td",{className:"p-2 border-r border-white/20",children:(0,g.jsx)("input",{name:"title",value:k.title,onChange:z,type:"text",className:E,placeholder:"Filter Title..."})}),(0,g.jsx)("td",{className:"p-2 border-r border-white/20",children:(0,g.jsx)("input",{name:"tagline",value:k.tagline,onChange:z,type:"text",className:E,placeholder:"Filter Tagline..."})}),(0,g.jsx)("td",{className:"p-2 text-center",children:(0,g.jsx)("button",{onClick:M,className:"text-white hover:rotate-180 transition-transform duration-500",children:(0,g.jsx)(d.A,{size:16})})})]})]}),(0,g.jsx)("tbody",{className:"divide-y divide-gray-50",children:w?(0,g.jsx)("tr",{children:(0,g.jsxs)("td",{colSpan:"3",className:"p-20 text-center",children:[(0,g.jsx)(l.A,{className:"animate-spin text-primary inline-block mb-2",size:32}),(0,g.jsx)("p",{className:"text-xs font-bold text-gray-400 uppercase",children:"Loading Sections..."})]})}):S.length>0?S.map((s,r)=>(0,g.jsxs)("tr",{className:"hover:bg-primary/5 transition-colors group",children:[(0,g.jsx)("td",{className:"p-4 border-r text-gray-500 font-mono text-xs font-bold uppercase tracking-tighter",children:s.section}),(0,g.jsx)("td",{className:"p-3 border-r",children:(0,g.jsx)("input",{type:"text",value:s.title,onChange:e=>((e,t)=>{const s=[...a];s[e].title=t,y(s),A(!0)})(r,e.target.value),className:"w-full bg-white border border-gray-100 rounded-lg px-3 py-1.5 text-[14px] font-bold text-primary focus:border-primary focus:ring-4 focus:ring-primary/10 outline-none transition-all shadow-inner"})}),(0,g.jsx)("td",{className:"p-3 border-r",children:(0,g.jsx)("input",{type:"text",value:s.tagline||"",onChange:e=>((e,t)=>{const s=[...a];s[e].tagline=t,y(s),A(!0)})(r,e.target.value),className:"w-full bg-white border border-gray-100 rounded-lg px-3 py-1.5 text-[13px] text-blue-600 focus:border-blue-500 focus:ring-4 focus:ring-blue-500/10 outline-none transition-all shadow-inner",placeholder:"Enter Tagline..."})}),(0,g.jsx)("td",{className:"p-4 text-center",children:(0,g.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,g.jsx)("button",{onClick:()=>e("/admin/edit-home-section/".concat(s.id||s._id)),className:"p-2 bg-blue-50 text-blue-600 rounded-lg hover:bg-blue-600 hover:text-white transition-all shadow-sm",title:"Full Edit",children:(0,g.jsx)(i.A,{size:14})}),(0,g.jsx)("button",{onClick:()=>(async e=>{if(!await t())return;const a=u.Ay.loading("Deleting...");try{const t="https://www.bagchee.com/api",s=await m.A.delete("".concat(t,"/home-sections/delete/").concat(e));s.data.status?(u.Ay.success("Deleted successfully!",{id:a}),M()):u.Ay.error(s.data.msg||"Could not delete section",{id:a})}catch(s){u.Ay.error("Delete failed",{id:a})}})(s.id||s._id),className:"p-2 bg-red-50 text-red-600 rounded-lg hover:bg-red-600 hover:text-white transition-all shadow-sm",title:"Delete",children:(0,g.jsx)(x.A,{size:14})})]})})]},s.id||s._id)):(0,g.jsx)("tr",{children:(0,g.jsx)("td",{colSpan:"3",className:"p-20 text-center text-gray-400 italic font-bold",children:"No matching sections foun
2d."})})})]})}),(0,g.jsxs)("div",{className:"p-4 bg-primary/5 border-t border-cream-200 flex items-center gap-2",children:[(0,g.jsx)("div",{className:"w-2 h-2 bg-primary rounded-full animate-pulse"}),(0,g.jsxs)("span",{className:"text-[10px] font-black text-primary uppercase tracking-[0.2em]",children:["Direct Inline Edit Enabled | Total Records: ",S.length]})]})]})]})}},6533(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},7104(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]])},8693(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},9855(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])}}]);
3//# sourceMappingURL=2381.4faf6c29.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.