PageSourceSearch

https://housingguards.ca/store/_next/static/chunks/pages/admin/products/categories-e761fdce7cf4b657.js

js housingguards.ca collected 2026-10-07 09:29:51 UTC 12,676 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5792],{14401:function(e,a,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/products/categories",function(){return s(35222)}])},85289:function(e,a,s){"use strict";s.d(a,{z:function(){return m}});var l=s(85893),n=s(67294),i=s(30767),d=s(12529),r=s(34051),t=s(31555),c=s(36968),o=s(87536);let m=e=>{let{handSumbit:a,handleClose:s,value:m,loading:h,heightDefault:u,widthDefault:g,limit:x}=e,[j,p]=(0,n.useState)(!1),{handleSubmit:b,control:Z,register:v,reset:N,setValue:f,watch:y,formState:{errors:w}}=(0,o.cI)(),_=(e,a)=>{if(!0===x){let s=new Image;s.src=window.URL.createObjectURL(e),s.onload=()=>{let l=s.height,n=s.width;l===u&&n===g?(a.onChange(e),p(!1)):p(!0)}}else a.onChange(e),p(!1)};return(0,l.jsx)(i.Z,{...e,size:"md","aria-labelledby":"contained-modal-title-vcenter address",children:(0,l.jsxs)(d.Z,{onSubmit:b(a),children:[(0,l.jsx)(i.Z.Header,{closeButton:!0,children:(0,l.jsx)(i.Z.Title,{id:"contained-modal-title-vcenter",className:"fs-6 fw-bold m-0",children:"Change Image"})}),(0,l.jsx)(i.Z.Body,{children:(0,l.jsx)(l.Fragment,{children:(0,l.jsx)("div",{className:"default-content add-address-form",children:(0,l.jsxs)(r.Z,{children:[(0,l.jsxs)(t.Z,{md:10,className:"pe-0",children:[(0,l.jsx)("h6",{className:"form-label",children:"Add Image "}),(0,l.jsx)(o.Qr,{control:Z,name:"image",rules:{required:!0},render:e=>{let{field:a}=e;return(0,l.jsx)(d.Z.Control,{type:"file",accept:"image/*",className:"upload-picker",size:"md",onChange:e=>{_(e.target.files[0],a)}})}}),x&&(0,l.jsxs)("span",{children:["The Image must be ",g,"x",u]})]}),w.image&&(0,l.jsx)("span",{className:"text-danger text-capitalize",children:"Image is Required"}),j&&(0,l.jsxs)("span",{className:"text-danger",children:["The Image must be ",g,"x",u]})]})})})}),(0,l.jsx)(i.Z.Footer,{children:(0,l.jsxs)("div",{className:"mb-1 d-flex justify-content-end",children:[(0,l.jsx)("button",{type:"button",className:"btn btn-light mx-2","data-bs-dismiss":"modal",onClick:s,children:"Cancel"}),(0,l.jsxs)("button",{className:"btn btn-green",type:"sumbit",disabled:h,children:[" ",h?(0,l.jsx)(c.Z,{size:"sm"}):""," Submit  "]})]})})]})})}},35222:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return F}});var l=s(85893),n=s(9008),i=s.n(n),d=s(34051),r=s(31555),t=s(52686),c=s(43725),o=s(35005),m=s(80292),h=s(12744),u=s(5607),g=s(67294),x=s(9473),j=s(69520),p=s(87536),b=s(30767),Z=s(76515),v=s(12529),N=s(36968),f=s(16310),y=s(47533);let w=f.Ry().shape({regular_margin:f.Z_().required(),member_margin:f.Z_().required()}),_=e=>{let{handleSetMarginSumbit:a,handleClose:s,values:n,loading:i,category:t}=e;console.log(t);let{handleSubmit:c,register:o,formState:{errors:m,isDirty:h,isValid:u}}=(0,p.cI)({defaultValues:{id:n},resolver:(0,y.X)(w),mode:"onTouched"});return(0,l.jsx)(b.Z,{...e,size:"md","aria-labelledby":"contained-modal-title-vcenter address",centered:!0,children:(0,l.jsxs)("form",{onSubmit:c(a),children:[(0,l.jsx)(b.Z.Header,{closeButton:!0,children:(0,l.jsxs)(b.Z.Title,{id:"contained-modal-title-vcenter",className:"fs-6 fw-bold m-0",children:[(0,l.jsx)("i",{className:"fa-solid fas fa-play"})," ",(0,l.jsx)("span",{className:"ms-2",children:"Set Margin "})]})}),(0,l.jsx)(b.Z.Body,{children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"default-content add-address-form",children:(0,l.jsxs)(d.Z,{children:[(0,l.jsxs)(r.Z,{xs:6,children:[(0,l.jsxs)("label",{class:"form-label",children:["Existing Regular Margin ",(0,l.jsx)("span",{class:"text-danger",children:"*"})]}),(0,l.jsx)("div",{class:"input-group",children:null==t?void 0:t.regular_margin})]}),(0,l.jsx)(r.Z,{xs:6,children:(0,l.jsxs)("div",{className:"mb-1",children:[(0,l.jsxs)("label",{className:"form-label",children:["Existing Member Margin",(0,l.jsx)("span",{className:"text-danger",children:"*"})]}),(0,l.jsx)("div",{className:"input-group",children:null==t?void 0:t.member_margin})]})}),(0,l.jsxs)(r.Z,{children:[(0,l.jsxs)("label",{class:"form-label",children:["Regular Margin ",(0,l.jsx)("span",{class:"text-danger",children:"*"})]}),(0,l.jsxs)("div",{class:"input-group",children:[(0,l.jsx)("input",{type:"number",className:"form-control",placeholder:"",...o("regular_margin")}),(0,l.jsx)(Z.Z.Text,{id:"basic-addon1",className:"rounded-1",children:"%"}),m.regular_margin&&(0,l.jsx)("span",{className:"text-danger text-capitalize",children:m.regular_margin.message})]})]}),(0,l.jsx)(r.Z,{children:(0,l.jsxs)("div",{className:"mb-1",children:[(0,l.jsxs)("label",{className:"form-label",children:["Member Margin",(0,l.jsx)("span",{className:"text-danger",children:"*"})]}),(0,l.jsxs)("div",{className:"input-group",children:[(0,l.jsx)("input",{type:"number",className:"form-control",placeholder:"",...o("member_margin")}),(0,l.jsx)(Z.Z.Text,{id:"basic-addon1",className:"rounded-1",children:"%"}),m.member_margin&&(0,l.jsx)("span",{className:"text-danger text-capitalize",children:m.member_margin.message})]})]})})]})}),(0,l.jsx)("input",{className:"d-none",...o("id")})]})}),(0,l.jsx)(b.Z.Footer,{children:(0,l.jsxs)(d.Z,{children:[(0,l.jsx)(r.Z,{md:12,children:(0,l.jsx)(v.Z.Check,{type:"switch",id:"custom-switch",label:"Also apply the margin for products which has individual margin",...o("force")})}),(0,l.jsx)("button",{type:"button",className:"btn btn-light","data-bs-dismiss":"modal",onClick:s,children:"Close"}),(0,l.jsxs)("button",{className:"btn btn-green",type:"sumbit",disabled:!u&&h,children:["  ",i?(0,l.jsx)(N.Z,{size:"sm"}):"","Submit"]})]})})]})})};
1var C=s(47545),S=s(33004),I=s(84136),k=s(85289),M=s(44307);let T=e=>{var a,s;let n=(0,x.I0)(),[p,b]=(0,g.useState)(),[Z,v]=(0,g.useState)(null),[N,f]=(0,g.useState)(),[y,w]=(0,g.useState)(null),T=(0,x.v9)(e=>{var a,s,l,n,i,d,r,t;return{categories:null==e?void 0:null===(a=e.ctsSlice)||void 0===a?void 0:null===(s=a.departmentsRes)||void 0===s?void 0:s.data,marginLoading:null==e?void 0:null===(l=e.adminProducts)||void 0===l?void 0:null===(n=l.cateSetMargin)||void 0===n?void 0:n.isFetching,loading:null==e?void 0:null===(i=e.ctsSlice)||void 0===i?void 0:null===(d=i.departmentsRes)||void 0===d?void 0:d.isFetching,imgLoading:null==e?void 0:null===(r=e.adminProducts)||void 0===r?void 0:null===(t=r.cateSetImgApi)||void 0===t?void 0:t.isFetching,categoryLoading:e.home.subcategoryList.isFetching}}),F=e=>{f(e),b(!0)},q=e=>{n((0,C.LE)(e)).then(e=>{e.type===C.LE.fulfilled.type?(b(!1),(0,S.h4)(e.payload.message,e.payload.success)):e.type===C.LE.rejected.type&&(0,S.h4)(e.payload.error,e.payload.success)})},E=e=>{n((0,C.Et)({img:{housing_guard_image:null==e?void 0:e.image},id:Z})).then(e=>{e.type===C.Et.fulfilled.type?(b(!1),(0,S.h4)(e.payload.message,e.payload.success)):e.type===C.LE.rejected.type&&(0,S.h4)(e.payload.error,e.payload.success)})};return(0,g.useEffect)(()=>{n((0,j.kN)())},[]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(i(),{children:[(0,l.jsx)("title",{children:"Admin | Categories"}),(0,l.jsx)("meta",{name:"description",content:" "}),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,l.jsx)("link",{rel:"icon",href:"/faviicon.png"})]}),(0,l.jsx)("main",{className:"hg-admin",children:(0,l.jsx)(m.Z,{children:(0,l.jsxs)("div",{className:"hg-pages hg-categories",children:[(0,l.jsx)(h.Z,{data:{title:"Categories",breadCrumb:{one:"one",one:"one",one:"one"}}}),(null==T?void 0:T.loading)?(0,l.jsx)(I.Z,{}):(0,l.jsx)("section",{className:"category-accordion",children:(0,l.jsxs)(d.Z,{children:[(0,l.jsx)(r.Z,{lg:3,children:(0,l.jsx)(t.Z,{children:T.categories&&(null===(a=T.categories)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.map(e=>(0,l.jsx)(l.Fragment,{children:e.children.map((e,a)=>(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(u.Z,{className:"category-form",children:(0,l.jsxs)(u.Z.Item,{eventKey:a,className:"border-0",children:[(0,l.jsxs)(u.Z.Header,{id:"headingOne",className:"category-formcheck ",type:"switch",label:"Building Materials",onClick:async()=>{try{let a=await n((0,M.Dp)({params:{unique_label:null==e?void 0:e.unique_label}})).unwrap();console.log(a.data),w(a.data)}catch(e){console.log(e),(0,S.h4)(e.error,!1)}},children:[e.label,(0,l.jsxs)(c.Z,{className:"table-dropdown",children:[(0,l.jsx)(c.Z.Toggle,{variant:"success",id:"dropdown-basic",className:"table-drop-toggle",children:":"}),(0,l.jsxs)(c.Z.Menu,{children:[(0,l.jsxs)(c.Z.Item,{onClick:async()=>{F(e.id);try{let a=await n((0,M.Dp)({params:{unique_label:null==e?void 0:e.unique_label}})).unwrap();console.log(a.data),w(a.data)}catch(e){console.log(e),(0,S.h4)(e.error,!1)}},children:[(0,l.jsx)(o.Z,{className:"table-button1",children:(0,l.jsx)("i",{className:"fa-solid fa-add"})}),"Set Margin"]}),(0,l.jsxs)(c.Z.Item,{onClick:()=>v(e.id),children:[(0,l.jsx)(o.Z,{className:"table-button1",children:(0,l.jsx)("i",{className:"fa-solid fa-add"})}),"Change Image"]})]})]})]}),(0,l.jsx)(u.Z.Body,{className:"p-1",children:e.children&&e.children.map((a,s)=>(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(u.Z,{children:(0,l.jsxs)(u.Z.Item,{eventKey:"One".concat(s),className:"border-0",children:[(0,l.jsxs)(u.Z.Header,{id:"headingTwo",className:"category-formcheck",type:"switch",children:[a.label,(0,l.jsxs)(c.Z,{className:"table-dropdown",children:[(0,l.jsx)(c.Z.Toggle,{variant:"success",id:"dropdown-basic",className:"table-drop-toggle",children:":"}),(0,l.jsx)(c.Z.Menu,{children:(0,l.jsxs)(c.Z.Item,{onClick:async()=>{F(a.id);try{let a=await n((0,M.Dp)({params:{unique_label:null==e?void 0:e.unique_label}})).unwrap();console.log(a.data),w(a.data)}catch(e){console.log(e),(0,S.h4)(e.error,!1)}},children:[(0,l.jsx)(o.Z,{className:"table-button1",children:(0,l.jsx)("i",{className:"fa-solid fa-add"})}),"Set Margin"]})})]})]}),(0,l.jsx)(u.Z.Body,{className:"p-2",children:(0,l.jsx)(u.Z.Item,{eventKey:"Two".concat(s),className:"border-0",children:a.children&&a.children.map((e,a)=>(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(u.Z,{children:(0,l.jsxs)(u.Z.Item,{eventKey:"Two".concat(a),className:"border-0",children:[(0,l.jsxs)(u.Z.Header,{id:"headingTwo",className:"category-formcheck",type:"switch",children:[e.label,(0,l.jsxs)(c.Z,{className:"table-dropdown",children:[(0,l.jsx)(c.Z.Toggle,{variant:"success",id:"dropdown-basic",className:"table-drop-toggle",children:":"}),(0,l.jsx)(c.Z.Menu,{children:(0,l.jsxs)(c.Z.Item,{onClick:async()=>{F(e.id);try{let a=await n((0,M.Dp)({params:{unique_label:null==e?void 0:e.unique_label}})).unwrap();console.log(a.data),w(a.data)}catch(e){console.log(e),(0,S.h4)(e.error,!1)}},children:[(0,l.jsx)(o.Z,{className:"table-button1",children:(0,l.jsx)("i",{className:"fa-solid fa-add"})}),"Set Margin"]})})]})]}),(0,l.jsx)(u.Z.Body,{className:"p-3",children:e.children&&e.children.map((e,a)=>(0,l.jsx)(u.Z.Item,{eventKey:"Three".concat(a),className:"border-0",children:(0,l.jsxs)("div",{className:"d-flex justify-content-between",children:[e.label,(0,l.jsxs)(c.Z,{className:"table-dropdown",children:[(0,l.jsx)(c.Z.Toggle,{variant:"success",id:"dropdown-basic",className:"table-drop-toggle",children:":"}),(0,l.jsx)(c.Z.Menu,{children:(0,l.jsxs)(c.Z.Item,{onClick:async()=>{F(e.id);try{let a=await n((0,M.Dp)({params:{unique_label:null==e?void 0:e.unique_label}})).unwrap();console.log(a.data),w(a.data)}catch(e){console.log(e),(0,S.h4)(e.error,!1)}},children:[(0,l.jsx)(o.Z,{className:"table-button1",children:(0,l.jsx)("i",{className:"fa-solid fa-add"})}),"Set Margin"]})})]})]})},a))},a)]})},a)}))})},s)]})},s)}))})]})},a)}))})))})}),(0,l.jsxs)(r.Z,{children:[T.categoryLoading&&(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(I.Z,{})}),(0,l.jsx)("img",{src:"https://housing-guard-918800402149-ca-central-1-an.s3.ca-central-1.amazonaws.com/"+(null==y?void 0:y.category_image),alt:"",className:" w-25 position-fixed"})]})]})}),p&&y&&(0,l.jsx)(_,{show:p,category:y,onHide:()=>{w(null),b(!1)},handleClose:()=>{w(null),b(!1)},handleSetMarginSumbit:e=>q(e),values:N,loading:T.marginLoading}),Z&&(0,l.jsx)(k.z,{show:Z,handSumbit:e=>{console.log(null==T?void 0:T.imgLoading),E(e)},handleClose:()=>v(!1),onHide:()=>v(!1),loading:null==T?void 0:T.imgLoading})]})})})]})};var F=T},12744:function(e,a,s){"use strict";var l=s(85893),n=s(11163),i=s(34051),d=s(31555),r=s(26699);let t=e=>{let{data:a}=e,s=(0,n.useRouter)(),t=null==s?void 0:s.pathname.split("/").slice(1);return(0,l.jsx)(i.Z,{className:"hg-header",children:(0,l.jsxs)(d.Z,{md:12,children:[(0,l.jsx)("h4",{children:(null==a?void 0:a.title)||""}),(0,l.jsx)(r.Z,{children:t.map((e,a)=>(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(r.Z.Item,{className:"text-capitalize admin-bread",children:[" ",e," "]},a)}))})]})})};a.Z=t}},function(e){e.O(0,[4114,9555,4507,3841,1877,5920,8308,292,9774,2888,179],function(){return e(e.s=14401)}),_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.