1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7877,9810],{13563:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/system-config",function(){return n(42685)}])},4180:function(e,t){"use strict";t.Z={src:"/_next/static/media/samu-giken.1bf2ec60.webp",height:549,width:1920,blurDataURL:"data:image/webp;base64,UklGRmQAAABXRUJQVlA4WAoAAAAQAAAABwAAAQAAQUxQSBEAAAAAGjk6MjtENBAZNi4qQzcvCgBWUDggLAAAAJABAJ0BKggAAgACQDgloAJ0ugADmAD+6ez/dAAp+z/+0s/+pZ/9Sz/NAAAA",blurWidth:8,blurHeight:2}},49810:function(e,t,n){"use strict";n.d(t,{Z:function(){return Y}});var r=n(52676),i=n(75271),l=n(46035),a=n(33022),s=n(40150),o=n(28994),d=n(85304),c=n(4180),u=n(16624),m=n(27026),p=n.n(m),h=n(78051),f=n(98807),g=n(15036),x=n(32623),y=n.n(x);let v=e=>{let{isMobile:t,isDrawerOpen:n,setIsDrawerOpen:i,collapsed:l,setCollapsed:a,fullName:s}=e,{logout:o}=(0,d.a)();return(0,r.jsxs)("div",{style:{borderBottom:"1px solid #e8e8e8",position:"fixed",width:"100%",zIndex:100},className:"flex items-center justify-between h-16 px-6 bg-white",children:[(0,r.jsxs)("div",{className:"flex items-center h-full gap-2",children:[(0,r.jsx)(h.ZP,{onClick:()=>{t?i(!n):a(!l)},"aria-controls":"sidebar",className:"flex items-center justify-center w-8 px-1 py-0",icon:(0,r.jsx)("svg",{className:"w-5 h-5 text-gray-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h6a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z",clipRule:"evenodd"})})}),!t&&(0,r.jsx)(p(),{href:"/",className:"h-full",children:(0,r.jsx)(y(),{src:c.Z,alt:"Samugiken",className:"w-[100%] h-[60px]"})})]}),(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,r.jsx)("div",{className:"flex items-center justify-center col-row",children:(0,r.jsx)(f.Z,{arrow:!0,placement:"bottomRight",overlayClassName:"shadow-[rgba(0,0,0,0.35)_0_5px_15px] rounded-xl top-10",trigger:["click"],dropdownRender:()=>(0,r.jsxs)("div",{className:"flex flex-col p-3 bg-white rounded-md shadow-md gap-y-1",children:[(0,r.jsx)(p(),{href:"/my-profile",className:"font-medium leading-[normal] text-primary hover:text-primary",children:(0,r.jsx)("div",{className:"cursor-pointer rounded-[4px] p-3 duration-100 hover:bg-primary/10",children:"My Profile"})}),(0,r.jsx)(g.Z,{className:"!my-2"}),(0,r.jsx)(h.ZP,{type:"primary",danger:!0,onClick:o,children:"Logout"})]}),children:(0,r.jsxs)("div",{className:"flex items-center cursor-pointer gap-x-3",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 ml-2",children:(0,r.jsx)("span",{className:"font-semibold",children:s})}),(0,r.jsx)(u.ZP,{name:s,round:!0,maxInitials:1,size:"35",textSizeRatio:2,fgColor:"white",color:"black"})]})})})})]})};var b=n(73640),j=n(62581),N=n(26134),A=n(1952),w=n(7144),C=n(42439),R=n(88483),E=n(42720),I=n(43146),_=n(57221),k=n(84176),Z=n(54216),O=n(12285),S=n(20188),D=n(19254);let P=e=>{var t,n,l,a,s,o,c,u,m,h,f;let{activeMenu:g,activeDropdown:x}=e,[y,v]=(0,i.useState)(g),{user:P}=(0,d.a)(),T=null==P?void 0:P.role.accessRights,M=e=>{v([e])},F=[{key:"dashboard",label:(0,r.jsx)(p(),{href:j.Z.ADMIN_DASHBOARD,children:"Dashboard"}),icon:(0,r.jsx)(A.Z,{width:16,height:16}),onClick:()=>M("dashboard")},...(0,N.f)(null==T?void 0:null===(t=T.PRODUCT)||void 0===t?void 0:t.READ,[{key:"product",label:(0,r.jsx)(p(),{href:j.Z.PRODUCT,children:"Product"}),icon:(0,r.jsx)(w.Z,{width:16,height:16}),onClick:()=>M("product")}]),...(0,N.f)(null==T?void 0:null===(n=T.REVIEW)||void 0===n?void 0:n.READ,[{key:"review",label:(0,r.jsx)(p(),{href:j.Z.REVIEW,children:"Reviews"}),icon:(0,r.jsx)(C.Z,{width:16,height:16}),onClick:()=>M("review")}]),...(0,N.f)(null==T?void 0:null===(l=T.WARRANTY)||void 0===l?void 0:l.READ,[{key:"warranty",label:"Warranty",icon:(0,r.jsx)(D.Z,{width:16,height:16}),children:[{key:"warranty-register",label:(0,r.jsx)(p(),{href:j.Z.WARRANTY_REGISTER,children:"Warranty Register"}),onClick:()=>M("warranty-register")},{key:"warranty-claim",label:(0,r.jsx)(p(),{href:j.Z.WARRANTY_CLAIM,children:"Warranty Claim"}),onClick:()=>M("warranty-claim")}]}]),...(0,N.f)(null==T?void 0:null===(a=T.COUPON)||void 0===a?void 0:a.READ,[{key:"c
1oupon",label:(0,r.jsx)(p(),{href:j.Z.COUPON,children:"Coupon"}),icon:(0,r.jsx)(R.Z,{width:16,height:16}),onClick:()=>M("coupon")}]),...(0,N.f)(null==T?void 0:null===(s=T.ORDER)||void 0===s?void 0:s.READ,[{key:"order",label:(0,r.jsx)(p(),{href:j.Z.ORDER,children:"Orders"}),icon:(0,r.jsx)(D.Z,{width:16,height:16}),onClick:()=>M("order")},{key:"abandonment",label:(0,r.jsx)(p(),{href:j.Z.ABANDONMENT,children:"Abandonment"}),icon:(0,r.jsx)(E.Z,{width:16,height:16}),onClick:()=>M("abandonment")}]),...(0,N.f)(null==T?void 0:null===(o=T.BLOG)||void 0===o?void 0:o.READ,[{key:"blog",label:(0,r.jsx)(p(),{href:j.Z.BLOG,children:"Blog"}),icon:(0,r.jsx)(I.Z,{width:16,height:16}),onClick:()=>M("blog")}]),...(0,N.f)(null==T?void 0:null===(c=T.OUR_PARTNERS)||void 0===c?void 0:c.READ,[{key:"our-partners",label:(0,r.jsx)(p(),{href:j.Z.OUR_PARTNERS,children:"Our Partners"}),icon:(0,r.jsx)(_.Z,{width:16,height:16}),onClick:()=>M("our-partners")}]),...(0,N.f)(null==T?void 0:null===(u=T.CONTENT_MANAGEMENT)||void 0===u?void 0:u.READ,[{key:"content",label:"Content Management",icon:(0,r.jsx)(k.Z,{width:16,height:16}),children:[{key:"content-banners",label:(0,r.jsx)(p(),{href:j.Z.CONTENT_BANNER,children:"Banners"}),onClick:()=>M("content-banners")},{key:"content-reviews",label:(0,r.jsx)(p(),{href:j.Z.CONTENT_REVIEW,children:"Customer Reviews"}),onClick:()=>M("content-reviews")},{key:"content-videos",label:(0,r.jsx)(p(),{href:j.Z.CONTENT_VIDEO,children:"Product Videos"}),onClick:()=>M("content-videos")},{key:"content-popups",label:(0,r.jsx)(p(),{href:j.Z.CONTENT_POPUP,children:"Popups"}),onClick:()=>M("content-popups")}]}]),...(0,N.f)(null==T?void 0:null===(m=T.USER)||void 0===m?void 0:m.READ,[{key:"user",label:(0,r.jsx)(p(),{href:j.Z.USER,children:"User"}),icon:(0,r.jsx)(Z.Z,{width:16,height:16}),onClick:()=>M("user")}]),...(0,N.f)(null==T?void 0:null===(h=T.ROLE)||void 0===h?void 0:h.READ,[{key:"role",label:(0,r.jsx)(p(),{href:j.Z.ROLE,children:"Role"}),icon:(0,r.jsx)(O.Z,{width:16,height:16}),onClick:()=>M("role")}]),...(0,N.f)(null==T?void 0:null===(f=T["SYSTEM_CONFIG/CATEGORY"])||void 0===f?void 0:f.READ,[{key:"system-config",label:(0,r.jsx)(p(),{href:j.Z.SYSTEM_CONFIG,children:"System Config"}),icon:(0,r.jsx)(S.Z,{width:16,height:16}),onClick:()=>M("category")}])];return(0,r.jsx)(b.Z,{theme:"light",mode:"inline",defaultOpenKeys:x||[],defaultSelectedKeys:y,items:F,className:"h-full font-medium"})};var T=n(63309);let{Sider:M,Content:F}=a.default;var Y=e=>{let{children:t,user:n,activeMenu:u=[],activeDropdown:m=[],seoConfig:p,withPadding:h=!0,card:f=!0,contentClassName:g}=e,x=(0,o.ac)("(max-width: 768px)"),[b,j]=(0,i.useState)(!1),[N,A]=(0,i.useState)(!1);return(0,r.jsx)(d.H,{user:n,children:(0,r.jsxs)(a.default,{className:"!min-h-screen",children:[(0,r.jsx)(l.PB,{...p}),(0,r.jsx)(v,{isMobile:x,isDrawerOpen:N,setIsDrawerOpen:A,collapsed:b,setCollapsed:j,fullName:(null==n?void 0:n.firstName)+" "+(null==n?void 0:n.lastName)||""}),(0,r.jsx)("div",{className:"mt-[64px]"}),(0,r.jsxs)(a.default,{hasSider:!0,style:{minHeight:"100%"},children:[x?(0,r.jsx)(s.Z,{placement:"left",open:N,onClose:()=>A(!1),width:"250px",styles:{body:{padding:0}},closable:!1,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("div",{className:"py-2",children:(0,r.jsx)(y(),{src:c.Z,alt:"Samugiken",className:"w-[100%] h-[70px]"})}),(0,r.jsx)(P,{activeMenu:u,activeDropdown:m})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:b?"duration-200 ml-[80px]":"duration-200 ml-[250px]"}),(0,r.jsx)(M,{trigger:null,collapsible:!0,collapsed:b,theme:"light",width:250,className:"hide-scrollbar",style:{overflow:"scroll",position:"fixed",marginTop:"64px",left:0,top:0,bottom:0,zIndex:100},children:(0,r.jsx)(P,{activeMenu:u,activeDropdown:m})})]}),(0,r.jsx)(F,{className:(0,T.cn)("min-h-full",h&&"px-3 py-5 md:p-9"),children:(0,r.jsx)("div",{className:(0,T.cn)(f&&"rounded-lg bg-white p-8 shadow-sm",g),children:t})})]})]})})}},5409:function(e,t,n){"use strict";n.d(t,{J:function(){return s}});var r=n(15989),i=n(39771),l=n(91340);let a=r.Z.create({baseURL:i.T5+"/api",headers:{"Content-Type":"application/json"},withCredentials:!0});a.interceptors.request.use(e=>{if((0,l.rD)()){let t=(0,l.Zd)();t&&(e.headers=e.headers||{},e.headers["x-session-id"]=t)}else e.headers&&e.headers["x-session-id"]&&delete e.headers["x-session-id"];return e});let s=r.Z.create({baseURL:i.T5+"/api",headers:{"Content-Type":"multipart/form-data"},maxContentLength:1/0,maxBodyLength:1/0,withCredentials:!0});t.Z=a}
1,95809:function(e,t,n){"use strict";var r=n(75271);t.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],[t,n]=(0,r.useState)(e);return{visible:t,open:()=>{n(!0)},close:()=>{n(!1)},toggle:()=>{n(e=>!e)}}}},85304:function(e,t,n){"use strict";n.d(t,{H:function(){return p},a:function(){return h}});var r=n(52676),i=n(75271),l=n(76517),a=n(73414),s=n(71030),o=n(83214),d=n(62581),c=n(69504),u=n(91340);let m=(0,i.createContext)(null),p=e=>{let{children:t,user:n}=e,p=(0,a.useRouter)(),{mutate:h}=(0,s.D)({mutationFn:c.kS,onError:e=>l.Am.error((0,o._g)(e)),onSuccess:()=>{p.push(d.Z.LOGIN)}});return(0,i.useEffect)(()=>{n?(0,u.hv)():(0,u.wN)()},[n]),(0,r.jsx)(m.Provider,{value:{user:n,logout:h},children:t})},h=()=>{let e=(0,i.useContext)(m);if(!e)throw Error("useAuth must be used within a AuthProvider");return e}},86516:function(e,t,n){"use strict";var r=n(52676),i=n(43532),l=n(78051),a=n(57786),s=n(57065),o=n(29607),d=n(76517),c=n(39771),u=n(83471),m=n(88290);let{Dragger:p}=i.default;t.Z=e=>{let{value:t,onChange:n,disabled:h,aspect:f}=e;if(t)return(0,r.jsxs)("div",{className:"relative w-full h-32",children:[(0,r.jsx)("img",{src:t.url,alt:t.name,className:"object-contain w-full h-full rounded-lg border border-gray-200 bg-neutral-50"}),(0,r.jsx)("div",{className:"absolute top-2 right-2",children:(0,r.jsx)(l.ZP,{danger:!0,size:"small",icon:(0,r.jsx)(s.Z,{size:12}),onClick:()=>n(null),disabled:h})})]});let g=(0,r.jsxs)(p,{disabled:h,customRequest:e=>(0,u.c)(m.T.CONTENT_IMAGE,e),showUploadList:!1,onChange:e=>{"done"===e.file.status&&n(e.file.response)},beforeUpload:e=>!(e.size/1024/1024>c.Pg)||(d.Am.error("File too large (max ".concat(c.Pg,"MB)")),i.default.LIST_IGNORE),children:[(0,r.jsx)(o.Z,{size:40,className:"mx-auto"}),(0,r.jsx)("p",{children:"Click or drag image to upload"})]});return(0,r.jsx)("div",{className:"h-32 [&_.ant-upload-wrapper]:!h-full [&_.ant-upload-drag]:!h-full",children:f?(0,r.jsx)(a.Z,{aspect:f,children:g}):g})}},83471:function(e,t,n){"use strict";n.d(t,{$:function(){return a},c:function(){return l}});var r=n(5409),i=n(22903);let l=async(e,t,n)=>{let l=new FormData;l.append("file",t.file);try{let a=await r.J.post(null!=n?n:"/file/upload/".concat(e),l),s=(0,i.I)(a.data.key),o={uid:a.data.refId,name:a.data.name,url:s,status:"done",type:t.file.type,originFileObj:t.file};t.onSuccess(o)}catch(e){t.onError(e)}},a=async(e,t,n)=>{let l=new FormData;
1l.append("video",t.file);try{let a=await r.J.post(null!=n?n:"/video/upload/".concat(e),l),s=(0,i.I)(a.data.key),o={uid:a.data.refId,name:a.data.name,url:s,status:"done",type:t.file.type,originFileObj:t.file};return t.onSuccess(o),{success:!0,fileObject:o}}catch(e){return t.onError(e),{success:!1,error:e.response.data.message}}}},88290:function(e,t,n){"use strict";var r,i,l,a;n.d(t,{T:function(){return r},Z:function(){return i}}),(l=r||(r={})).PRODUCT_IMAGE="product-image",l.BLOG_IMAGE="blog-image",l.WARRANTY_CLAIM="warranty-claim",l.REVIEW="review",l.CONTENT_IMAGE="content-image",(a=i||(i={})).warranty_claim="warranty-claim",a.description="product-description",a.review="review"},42685:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return z},default:function(){return G}});var r=n(52676),i=n(49810),l=n(47645),a=n(26134),s=n(5409);let o=()=>s.Z.get("/admin/category"),d=e=>s.Z.post("/admin/category",e),c=(e,t)=>s.Z.put("/admin/category/".concat(e),t),u=e=>s.Z.delete("/admin/category/".concat(e)),m=(e,t)=>s.Z.patch("/admin/category/".concat(e,"/reorder"),t);var p=n(69834),h=n(71030),f=n(18060),g=n(78051),x=n(63468),y=n(60600),v=n(79406),b=n(75271),j=n(21844),N=n(68734);function A(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(let a of e){var r,i,l;if(a.refId===t)return{refId:a.refId,name:a.name,slug:a.slug,parentRefId:n?n.refId:null,image:null!==(i=a.image)&&void 0!==i?i:null,banners:null!==(l=a.banners)&&void 0!==l?l:[]};if(null===(r=a.children)||void 0===r?void 0:r.length){let e=A(a.children,t,a);if(e)return e}}return null}var w=n(97589),C=n.n(w),R=n(86516),E=n(22903);let I=()=>[{id:"banner-slot-1",image:null,link:""},{id:"banner-slot-2",image:null,link:""}];var _=e=>{let{onSubmit:t,categoryRefId:n,initialImage:i,initialBanners:l,formInstance:a}=e,[s]=f.Z.useForm(a),[d,c]=(0,b.useState)(null),[u,m]=(0,b.useState)(I),h=!f.Z.useWatch("parentRefId",s);(0,b.useEffect)(()=>{c(i?{uid:i.refId,name:i.refId,url:(0,E.I)(i.key),status:"done"}:null)},[i]),(0,b.useEffect)(()=>{let e=I();(null!=l?l:[]).slice(0,2).forEach((t,n)=>{var r;e[n]={id:e[n].id,image:{uid:t.refId,name:t.refId,url:(0,E.I)(t.key),status:"done"},link:null!==(r=t.link)&&void 0!==r?r:""}}),m(e)},[l]);let{data:x,isFetching:y}=(0,p.a)({queryKey:["category","options"],queryFn:o,select:e=>e.data}),v=(0,b.useMemo)(()=>(x||[]).map(e=>(function e(t,n){let r=!!n&&n.includes(t.refId);return{title:t.name,disabled:r,value:t.refId,children:t.children.map(t=>e(t,r?[...n||[],t.refId]:n))}})(e,n?[n]:[])),[x,n]),A=(e,t)=>{m(n=>n.map((n,r)=>r===e?{...n,...t}:n))};return(0,r.jsxs)(f.Z,{form:s,onFinish:e=>{var n;t({...e,imageRefId:null!==(n=null==d?void 0:d.uid)&&void 0!==n?n:null,banners:h?u.filter(e=>e.image).map(e=>({imageRefId:e.image.uid,link:e.link.trim()?e.link.trim():null})):[]})},layout:"vertical",children:[(0,r.jsx)(f.Z.Item,{name:"name",label:"Name",rules:[{required:!0}],children:(0,r.jsx)(j.default,{onBlur:e=>{s.setFieldValue("slug",C()(e.target.value||"",{lower:!0}))}})}),(0,r.jsx)(f.Z.Item,{name:"slug",label:"Slug",rules:[{required:!0}],children:(0,r.jsx)(j.default,{disabled:!0})}),(0,r.jsx)(f.Z.Item,{name:"parentRefId",label:"Parent Category",children:(0,r.jsx)(N.Z,{showSearch:!0,treeNodeFilterProp:"title",treeData:v,loading:y,treeDefaultExpandAll:!0,allowClear:!0})}),(0,r.jsx)("p",{className:"mb-1 font-medium",children:"Category Image (optional)"}),(0,r.jsx)("p",{className:"mb-2 text-sm text-gray-500",children:"Shown as the category icon on the listing page. Falls back to the logo if empty."}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(R.Z,{value:d,onChange:c,aspect:1})}),h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"mb-1 font-medium",children:"Menu Banners (optional, up to 2)"}),(0,r.jsx)("p",{className:"mb-3 text-sm text-gray-500",children:"Shown in the header dropdown when hovering this category. Top-level categories only."}),(0,r.jsx)("div",{className:"flex flex-col gap-4 mb-4",children:u.map((e,t)=>(0,r.jsxs)("div",{className:"p-3 border rounded-lg border-neutral-200",children:[(0,r.jsxs)("p",{className:"mb-1 text-sm",children:["Banner ",t+1]}),(0,r.jsx)(R.Z,{value:e.image,onChange:e=>A(t,{image:e})}),(0,r.jsx)(j.default,{className:"mt-2",value:e.link,placeholder:"Link (optional) â clicking the banner redirects here",onChange:e=>A(t,{link:e.target.value})})]},e.id))})]}),(0,r.jsx)(g.ZP,{type:"primary",htmlType:"submit",children:n?"Update":"Submit"})]})},k=n(76517),Z=n(83214),O=n(95809),S=n(31564),D=n(37986),P=n(1705),T=()=>{let[e]=f.Z.useForm(),[t,n]=(0,b.useState)(void 0),{visible:i,open:l,close:a}=(0,O.Z)(),{data:s,isFetching:j,refetch:N}=(0,p.a)({queryKey:["category","list"],queryFn:o,select:e=>e.data}),w=(0,h.D)({mutationFn:d,onSuccess:()=>{a(),e.resetFields(),N()}}),C=(0,h.D)({mutationFn:e=>c(t,e),onSuccess:()=>{a(),e.resetFields(),N()}}),R=(0,h.D)({mutationFn:u,onSuccess:(r,i)=>{t===i&&(n(void 0),e.resetFields(),a()),N()}}),E=(0,h.D)({mutationFn:e=>{let{categoryId:t,targetParentRefId:n,targetIndex:r}=e;return m(t,{targetParentRefId:n,targetIndex:r})},onSuccess:()=>{N()}}),I=(0,b.useMemo)(()=>(s||[]).map(e=>(function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{key:t.refId,refId:t.refId,title:t.name,parentRefId:n,children:t.children.map(n=>e(n,t.refId))}})(e)),[s]),T=(0,b.useMemo)(()=>{let e=new Map,t=n=>
1{n.forEach(n=>{var r;e.set(n.key,n),(null===(r=n.children)||void 0===r?void 0:r.length)&&t(n.children)})};return t(I),e},[I]),M=e=>{var t;return null===e?I:(null===(t=T.get(e))||void 0===t?void 0:t.children)||[]},F=t=>{if(!s)return;if(!t){n(void 0),e.resetFields(),l();return}let r=A(s,t);r&&(e.setFieldsValue({name:r.name,slug:r.slug,parentRefId:r.parentRefId}),n(r.refId),l())},Y=e=>{k.Am.promise(R.mutateAsync(e),{pending:"Deleting category...",success:"Category deleted successfully",error:{render(e){let{data:t}=e;return(0,Z._g)(t)}}})},L=R.variables,U=e=>{let t=R.isPending&&L===e.key;return(0,r.jsx)("div",{className:"flex items-center w-full gap-2 pr-2",children:(0,r.jsxs)("div",{className:"flex items-center min-w-0 gap-2",children:[(0,r.jsx)(S.Z,{size:16,className:"text-gray-400 cursor-grab","aria-hidden":!0}),(0,r.jsx)("span",{className:"text-sm truncate",children:e.title}),(0,r.jsxs)("div",{className:"flex items-center flex-shrink-0 gap-1",children:[(0,r.jsx)(g.ZP,{type:"text",size:"small",className:"!px-1",icon:(0,r.jsx)(D.Z,{size:14}),onClick:t=>{t.stopPropagation(),F(e.key)}}),(0,r.jsx)(x.Z,{title:"Delete this category?",okText:"Delete",cancelText:"Cancel",placement:"left",onConfirm:()=>{Y(e.key)},children:(0,r.jsx)(g.ZP,{type:"text",danger:!0,size:"small",className:"!px-1",icon:(0,r.jsx)(P.Z,{size:14}),loading:t,onClick:e=>e.stopPropagation()})})]})]})})};if(j||!s)return(0,r.jsx)("div",{children:"Loading..."});let B=t?A(s,t):void 0;return(0,r.jsxs)("div",{children:[(null==s?void 0:s.length)===0?(0,r.jsx)("div",{className:"flex items-center justify-center h-[200px]",children:(0,r.jsx)(g.ZP,{type:"primary",onClick:()=>{F()},children:"Create Your First Category"})}):(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"flex justify-end mb-5",children:(0,r.jsx)(g.ZP,{type:"primary",onClick:()=>{F()},children:"Create New Category"})}),(0,r.jsx)("p",{className:"mb-3 text-sm text-gray-500",children:"Drag categories to reorder or nest them. Use the icons on the right to edit or delete a category."}),(0,r.jsx)(y.Z,{treeData:I,showLine:!0,defaultExpandAll:!0,blockNode:!0,draggable:!0,allowDrop:e=>{let{dragNode:t,dropNode:n}=e,r=t.key,i=n.key;if(r===i)return!1;let l=i;for(;l;){var a,s;if(l===r)return!1;l=null!==(s=null===(a=T.get(l))||void 0===a?void 0:a.parentRefId)&&void 0!==s?s:null}return!0},onDrop:e=>{var t,n,r,i;let l=e.dragNode.key,a=e.node,s=T.get(l);if(!s)return;let o=null,d=0;if(e.dropToGap){let i=M(o=null!==(n=a.parentRefId)&&void 0!==n?n:null),l=i.findIndex(e=>e.key===a.key);if(l<0)return;let s=Number(null!==(r=null===(t=a.pos)||void 0===t?void 0:t.split("-").pop())&&void 0!==r?r:l);d=Math.max(0,Math.min(d=-1==e.dropPosition-s?l:l+1,i.length))}else d=M(o=a.key).length;let c=null!==(i=s.parentRefId)&&void 0!==i?i:null,u=M(c).findIndex(e=>e.key===l);c===o&&u>
1-1&&u<d&&(d-=1),c===o&&u>-1&&u===d||k.Am.promise(E.mutateAsync({categoryId:l,targetParentRefId:o,targetIndex:d}),{pending:"Reordering category...",success:"Category reordered successfully",error:{render(e){let{data:t}=e;return(0,Z._g)(t)}}})},selectable:!1,titleRender:e=>U(e)})]}),(0,r.jsx)(v.Z,{open:i,onCancel:()=>{n(void 0),a(),e.resetFields()},footer:null,title:t?"Edit Category":"Create Category",destroyOnClose:!0,children:(!t||t&&B)&&(0,r.jsx)(_,{formInstance:e,onSubmit:e=>{t?k.Am.promise(C.mutateAsync(e),{pending:"Updating category...",success:"Category updated successfully",error:{render(e){let{data:t}=e;return(0,Z._g)(t)}}}):k.Am.promise(w.mutateAsync(e),{pending:"Creating category...",success:"Category created successfully",error:{render(e){let{data:t}=e;return(0,Z._g)(t)}}})},categoryRefId:t,initialImage:null==B?void 0:B.image,initialBanners:null==B?void 0:B.banners})})]})},M=n(88463),F=n(99388),Y=n(93839),L=n(52043),U=n.n(L),B=()=>{let[e]=f.Z.useForm(),t=(0,p.a)({queryKey:["policy",Y.Mi.WARRANTY_POLICY],queryFn:()=>(0,Y.SP)(Y.Mi.WARRANTY_POLICY)});(0,b.useEffect)(()=>{t.data&&e.setFieldsValue({effectiveDate:U()(t.data.effectiveDate),content:t.data.content})},[t.data]);let n=(0,h.D)({mutationKey:["policy",Y.Mi.WARRANTY_POLICY],mutationFn:Y.i5});return(0,r.jsx)("div",{children:(0,r.jsxs)(f.Z,{form:e,layout:"vertical",onFinish:e=>{k.Am.promise(n.mutateAsync({effectiveDate:e.effectiveDate,content:e.content,type:Y.Mi.WARRANTY_POLICY}),{pending:"Updating warranty policy...",success:"Warranty policy updated successfully",error:{render(e){let{data:t}=e;return"Error updating warranty policy: ".concat((0,Z._g)(t))}}})},children:[(0,r.jsx)(f.Z.Item,{name:"effectiveDate",label:"Effective Date",rules:[{required:!0,message:"Please pick an effective date"}],children:(0,r.jsx)(M.default,{className:"w-full"})}),(0,r.jsx)(f.Z.Item,{name:"content",label:"Content",rules:[{required:!0,message:"Please enter content"}],trigger:"onEditorChange",className:"mb-5",layout:"vertical",children:(0,r.jsx)(F.M,{tinymceScriptSrc:"/tinymce/js/tinymce/tinymce.min.js",init:{contextmenu:!1,invalid_elements:"pre",menubar:!1,height:500,plugins:["advlist","autolink","lists","link","searchreplace","code","preview","wordcount","image","fullscreen"],block_formats:"Paragraph=p;Header=h2",toolbar:"blocks |numlist bullist |link |bold italic |undo redo |subscript superscript |fullscreen",content_style:"@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&display=swap'); body { font-family: 'Manrope', sans-serif; font-size:14px }img {max-width: 100%; height: auto; width:100%}h2 {margin-top: 1.5rem; margin-bottom: 0}p {margin: 0; padding-top: 0.5rem; padding-bottom: 1rem;}table {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}tr {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}td {border-color: rgb(229,231,235); border-width: 1px; border-style: solid; padding: 0.75rem}",image_dimensions:!1,object_resizing:!1,promotion:!1,paste_data_images:!0,paste_as_text:!0}})}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(g.ZP,{type:"primary",htmlType:"submit",loading:n.isPending,children:"Save"})})]})})},V=()=>{let[e]=f.Z.useForm(),t=(0,p.a)({queryKey:["policy",Y.Mi.PRIVACY_POLICY],queryFn:()=>(0,Y.SP)(Y.Mi.PRIVACY_POLICY)});(0,b.useEffect)(()=>{t.data&&e.setFieldsValue({effectiveDate:U()(t.data.effectiveDate),content:t.data.content})},[t.data]);let n=(0,h.D)({mutationKey:["policy",Y.Mi.PRIVACY_POLICY],mutationFn:Y.i5});return(0,r.jsx)("div",{children:(0,r.jsxs)(f.Z,{form:e,layout:"vertical",onFinish:e=>{k.Am.promise(n.mutateAsync({effectiveDate:e.effectiveDate,content:e.content,type:Y.Mi.PRIVACY_POLICY}),{pending:"Updating privacy policy...",success:"Privacy policy updated successfully",error:{render(e){let{data:t}=e;return"Error updating privacy policy: ".concat((0,Z._g)(t))}}})},children:[(0,r.jsx)(f.Z.Item,{name:"effectiveDate",label:"Effective Date",rules:[{required:!0,message:"Please pick an effective date"}],children:(0,r.jsx)(M.default,{className:"w-full"})}),(0,r.jsx)(f.Z.Item,{name:"content",label:"Content",rules:[{required:!0,message:"Please enter content"}],trigger:"onEditorChange",className:"mb-5",layout:"vertical",children:(0,r.jsx)(F.M,{tinymceScriptSrc:"/tinymce/js/tinymce/tinymce.min.js",init:{contextmenu:!1,invalid_elements:"pre",menubar:!1,height:500,plugins:["advlist","autolink","lists","link","searchreplace","code","preview","wordcount","
1image","fullscreen"],block_formats:"Paragraph=p;Header=h2",toolbar:"blocks |numlist bullist |link |bold italic |undo redo |subscript superscript |fullscreen",content_style:"@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&display=swap'); body { font-family: 'Manrope', sans-serif; font-size:14px }img {max-width: 100%; height: auto; width:100%}h2 {margin-top: 1.5rem; margin-bottom: 0}p {margin: 0; padding-top: 0.5rem; padding-bottom: 1rem;}table {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}tr {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}td {border-color: rgb(229,231,235); border-width: 1px; border-style: solid; padding: 0.75rem}",image_dimensions:!1,object_resizing:!1,promotion:!1,paste_data_images:!0,paste_as_text:!0}})}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(g.ZP,{type:"primary",htmlType:"submit",children:"Save"})})]})})},W=()=>{let[e]=f.Z.useForm(),t=(0,p.a)({queryKey:["policy",Y.Mi.TERMS_OF_SERVICE],queryFn:()=>(0,Y.SP)(Y.Mi.TERMS_OF_SERVICE)});(0,b.useEffect)(()=>{t.data&&e.setFieldsValue({effectiveDate:U()(t.data.effectiveDate),content:t.data.content})},[t.data]);let n=(0,h.D)({mutationKey:["policy",Y.Mi.TERMS_OF_SERVICE],mutationFn:Y.i5});return(0,r.jsx)("div",{children:(0,r.jsxs)(f.Z,{form:e,layout:"vertical",onFinish:e=>{k.Am.promise(n.mutateAsync({effectiveDate:e.effectiveDate,content:e.content,type:Y.Mi.TERMS_OF_SERVICE}),{pending:"Updating terms & conditions...",success:"Terms & conditions updated successfully",error:{render(e){let{data:t}=e;return"Error updating terms & conditions: ".concat((0,Z._g)(t))}}})},children:[(0,r.jsx)(f.Z.Item,{name:"effectiveDate",label:"Effective Date",rules:[{required:!0,message:"Please pick an effective date"}],children:(0,r.jsx)(M.default,{className:"w-full"})}),(0,r.jsx)(f.Z.Item,{name:"content",label:"Content",rules:[{required:!0,message:"Please enter content"}],trigger:"onEditorChange",className:"mb-5",layout:"vertical",children:(0,r.jsx)(F.M,{tinymceScriptSrc:"/tinymce/js/tinymce/tinymce.min.js",init:{contextmenu:!1,invalid_elements:"pre",menubar:!1,height:500,plugins:["advlist","autolink","lists","link","searchreplace","code","preview","wordcount","image","fullscreen"],block_formats:"Paragraph=p;Header=h2",toolbar:"blocks |numlist bullist |link |bold italic |undo redo |subscript superscript |fullscreen",content_style:"@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&display=swap'); body { font-family: 'Manrope', sans-serif; font-size:14px }img {max-width: 100%; height: auto; width:100%}h2 {margin-top: 1.5rem; margin-bottom: 0}p {margin: 0; padding-top: 0.5rem; padding-bottom: 1rem;}table {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}tr {border-color: rgb(229,231,235); border-width: 1px; border-style: solid}td {border-color: rgb(229,231,235); border-width: 1px; border-style: solid; padding: 0.75rem}",image_dimensions:!1,object_resizing:!1,promotion:!1,paste_data_images:!0,paste_as_text:!0}})}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(g.ZP,{type:"primary",htmlType:"submit",children:"Save"})})]})})},z=!0,G=e=>{var t,n,s,o,d,c,u,m;let{user:p}=e,h=[...(0,a.f)(null==p?void 0:null===(n=p.role.accessRights)||void 0===n?void 0:null===(t=n["SYSTEM_CONFIG/CATEGORY"])||void 0===t?void 0:t.READ,[{key:"category",label:"Category",children:(0,r.jsx)(T,{})}]),...(0,a.f)(null==p?void 0:null===(o=p.role.accessRights)||void 0===o?void 0:null===(s=o["SYSTEM_CONFIG/POLICY"])||void 0===s?void 0:s.READ,[{key:"warranty",label:"Warranty",children:(0,r.jsx)(B,{}),destroyOnHidden:!0}]),...(0,a.f)(null==p?void 0:null===(c=p.role.accessRights)||void 0===c?void 0:null===(d=c["SYSTEM_CONFIG/POLICY"])||void 0===d?void 0:d.READ,[{key:"privacy-policy",label:"Privacy Policy",children:(0,r.jsx)(V,{}),destroyOnHidden:!0}]),...(0,a.f)(null==p?void 0:null===(m=p.role.accessRights)||void 0===m?void 0:null===(u=m["SYSTEM_CONFIG/POLICY"])||void 0===u?void 0:u.READ,[{key:"terms-and-conditions",label:"Terms & Conditions",children:(0,r.jsx)(W,{}),destroyOnHidden:!0}])];return(0,r.jsx)(i.Z,{user:p,activeMenu:["system-config"],children:(0,r.jsx)(l.Z,{items:h})})}},69504:function(e,t,n){"use strict";n.d(t,{A9:function(){return d},IU:function(){return l},c0:function(){return o},kS:function(){return a},o9:function(){return s},x4:function(){return i}});var r=n(5409);let i=async e=>r.Z.post("/auth/login",e),l=async e=>r.Z.post("/auth/signup",e),a=async()=>r.Z.post("/auth/logout"),s=async e=>r.Z.post("/auth/forget-password",e),o=async e=>r.Z.post("/auth/password-reset/confirm",e),d=async e=>r.Z.post("/auth/verify-user",e)},93839:function(e,t,n){"use strict";n.d(t,{Mi:function(){return i},SP:function(){return s},i5:function(){return a}});var r,i,l=n(5409);(r=i||(i={})).PRIVACY_POLICY="PRIVACY_POLICY",r.TERMS_OF_SERVICE="TERMS_OF_SERVICE",r.WARRANTY_POLICY="WARRANTY_POLICY";let a=async e=>(await l.Z.put("/admin/system-config/policy",e)).data,s=async e=>(await l.Z.get("/admin/system-config/policy",{params:{type:e}})).data},62581:function(e,t,n){"use strict";var r,i;n.d(t,{Z:function(){return r}}),(i=r||(r={})).LOGIN="/login",i.ADMIN_DASHBOARD="/admin/dashboard",i.HOME="/",i.USER="/admin/user",i.ROLE="/admin/role",i.NEW_ROLE="/admin/role/new",i.SYSTEM_CONFIG="/admin/system-config",i.PRODUCT="/admin/product",i.BLOG="/admin/blog",i.ORDER="/admin/order",i.ABANDONMENT="/admin/abandonment",i.WARRANTY_REGISTER="/admin/warranty-register",i.WARRANTY_CLAIM="/admin/warranty-claim",i.COUPON="/admin/coupon",i.OUR_PARTNERS="/admin/our-partners",i.REVIEW="/admin/review",i.CONTENT_BANNER="/admin/content/banners",i.CONTENT_REVIEW="/admin/content/reviews",i.CONTENT_VIDEO="/admin/content/videos",i.CONTENT_POPUP="/admin/content/popups"},26134:function(e,t,n){"use strict";n.d(t,{f:function(){return r}});let r=(e,t,n)=>void 0===t?void 0!==n?n:Array.isArray(t)?[]:{}:e?t:void 0!==n?n:Array.isArray(t)?[]:{}},83214:function(e,t,n){"use strict";n.d(t,{_g:function(){return l},i$:function(){return a}});var r=n(52043),i=n.n(r);let l=e=>{if("response"in e){var t,n;return null===(n=e.response)||void 0===n?void 0:null===(t=n.data)||void 0===t?void 0:t.message}return e.message},a=(e,t)=>{let n=i()(e);return e&&n.isValid()?i()(e).format("DD MMM YYYY, hh:mm a"):t||null}},22903:function(e,t,n){"use strict";n.d(t,{B:function(){return i},I:function(){return r}});let r=e=>"".concat("https://cdn.samugiken.com","/").concat("production","/").concat(encodeURIComponent(e)),i=e=>"".concat("https://cdn.samugiken.com","/").concat("production","/").concat(encodeURIComponent(e))},91340:function(e,t,n){"use strict";n.d(t,{Zd:function(){return l},hv:function(){return s},rD:function(){return o},wN:function(){return a}});let r="session_id",i="session_header_enabled";function l(){try{let e=localStorage.getItem(r);if(e&&e.length>0)return e;let t="undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():d();return localStorage.setItem(r,t),t}catch(e){return d()}}function a(){try{localStorage.setItem(i,"1")}catch(e){}}function s(){try{localStorage.setItem(i,"0"),localStorage.removeItem(r)}catch(e){}}function o(){try{return"1"===localStorage.getItem(i)}catch(e){return!1}}function d(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}},function(e){e.O(0,[5989,4237,7610,8174,9834,8051,9513,4540,928,4298,4190,6631,6220,9575,7444,9406,150,1887,5934,8060,1795,7645,8463,3532,6138,8734,5954,2888,9774,179],function(){return e(e.s=13563)}),_N_E=e.O()}]);
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.