1import{a as we}from"./chunk-ILRUTWFH.js";import{a as ve}from"./chunk-AHP6CBJJ.js";import{b as me,c as ge,d as _e,f as ue,g as Ce,i as fe,j as he,l as be,m as Se,o as Me,q as ye}from"./chunk-IRVXRWZD.js";import"./chunk-PVDG46DZ.js";import{a as se}from"./chunk-MJHKSL2V.js";import{b as ce}from"./chunk-H3ZOHFO7.js";import"./chunk-CIKJJUSN.js";import"./chunk-RRZRS5BZ.js";import"./chunk-LY7WOQZN.js";import{b as le}from"./chunk-VG7OHNZN.js";import"./chunk-Q4V6AKYI.js";import{a as de,b as pe}from"./chunk-T3PLPHIG.js";import"./chunk-2JW6ZMWV.js";import"./chunk-NIP74ZKI.js";import"./chunk-QNUNLKYK.js";import{c as re,r as N}from"./chunk-RE4JJFV5.js";import{d as J,e as K,f as Q,g as X,i as Y,j as Z,k as R}from"./chunk-COEKBYWO.js";import"./chunk-E2K2LIS4.js";import{a as W}from"./chunk-KJKRX6VS.js";import"./chunk-2CRWMDGS.js";import{a as ne,b as ae}from"./chunk-4WMDX4SQ.js";import"./chunk-IQLKO45Z.js";import"./chunk-V6KBZVCY.js";import"./chunk-6FQQM4CE.js";import{a as ee,i as te,j as ie}from"./chunk-VTTO24NQ.js";import"./chunk-Y5VOXWTF.js";import{l as $,n as V,q as H}from"./chunk-YWHNFDXQ.js";import"./chunk-FCTHY2PU.js";import"./chunk-DPVJW3LI.js";import"./chunk-GW33KQPR.js";import{T as oe,U as B}from"./chunk-TUEKBDZZ.js";import"./chunk-RLPOKPIS.js";import"./chunk-TPES7EAS.js";import{G as A,c as L,h as z,m as q,o as G,z as U}from"./chunk-QXJM3TTT.js";import{F as I}from"./chunk-TMOIAHHX.js";import{Fa as b,Ib as r,Jb as k,Kb as F,Rb as x,Sa as O,Sb as P,Tb as E,Wa as S,Xa as M,ab as c,bb as o,cb as n,db as u,ga as l,hb as y,ib as v,kb as w,o as f,p as h,qb as _,sa as g,tb as m,za as T}from"./chunk-DJNWGYMM.js";import{ea as C,f as D}from"./chunk-VOZAGDK7.js";import{a as j}from"./chunk-E5QWB6YB.js";function xe(t,s){t&1&&(o(0,"div",2),u(1,"rp-state",3),n())}function Pe(t,s){if(t&1){let e=w();o(0,"div",2)(1,"rp-state",4)(2,"button",5),_("click",function(){f(e);let i=m();return h(i.load())}),r(3,"Try again"),n()()()}if(t&2){let e=m();l(),c("body",e.errorMessage)}}function Ee(t,s){if(t&1){let e=w();o(0,"rp-state",9)(1,"button",5),_("click",function(){f(e);let i=m(2);return h(i.openEdit())}),o(2,"mat-icon"),r(3,"add"),n(),r(4," New Category "),n()()}}function De(t,s){t&1&&(o(0,"th",26),r(1,"Category"),n())}function Te(t,s){if(t&1&&(o(0,"td",27)(1,"span",28),r(2),n()()),t&2){let e=s.$implicit;l(2),k(e.name)}}function Oe(t,s){t&1&&(o(0,"th",29),r(1,"Sort"),n())}function ke(t,s){if(t&1&&(o(0,"td",30),r(1),n()),t&2){let e=s.$implicit;l(),k(e.sortPos)}}function Ie(t,s){t&1&&(o(0,"th",31),r(1,"Status"),n())}function Ae(t,s){t&1&&(o(0,"span",33)(1,"mat-icon",34),r(2,"visibility_off"),n(),r(3," Hidden "),n())}function Re(t,s){if(t&1&&(o(0,"td",32),S(1,Ae,4,0,"span",33),n()),t&2){let e=s.$implicit;l(),M(e.active?-1:1)}}function Ve(t,s){t&1&&(o(0,"th",35),r(1,"Actions"),n())}function He(t,s){if(t&1){let e=w();o(0,"td",36)(1,"button",37),_("click",function(){let i=f(e).$implicit,d=m(3);return h(d.openEdit(i))}),o(2,"mat-icon"),r(3,"edit"),n()(),o(4,"button",38),_("click",function(){let i=f(e).$implicit,d=m(3);return h(d.remove(i))}),o(5,"mat-icon"),r(6,"delete_outline"),n()()()}if(t&2){let e=s.$implicit;l(),c("matTooltip","Edit "+e.name),O("aria-label","Edit "+e.name),l(3),c("matTooltip","Remove "+e.name),O("aria-label","Remove "+e.name)}}function Be(t,s){t&1&&u(0,"tr",39)}function We(t,s){t&1&&u(0,"tr",40)}function Ne(t,s){if(t&1&&(o(0,"div",10)(1,"table",11),y(2,12),b(3,De,2,0,"th",13)(4,Te,3,1,"td",14),v(),y(5,15),b(6,Oe,2,0,"th",16)(7,ke,2,1,"td",17),v(),y(8,18),b(9,Ie,2,0,"th",19)(10,Re,2,1,"td",20),v(),y(11,21),b(12,Ve,2,0,"th",22)(13,He,7,4,"td",23),v(),b(14,Be,1,0,"tr",24)(15,We,1,0,"tr",25),n()()),t&2){let e=m(2);l(),c("dataSource",e.categories),l(13),c("matHeaderRowDef",e.displayedColumns),l(),c("matRowDefColumns",e.displayedColumns)}}function je(t,s){if(t&1){let e=w();o(0,"div",2)(1,"div",6)(2,"div",7),r(3,"Categories group products on the shop page. Buyers only see visible categories."),n(),u(4,"span",8),o(5,"button",5),_("click",function(){f(e);let i=m();return h(i.openEdit())}),o(6,"mat-icon"),r(7,"add"),n(),r(8," New Category "),n()(),S(9,Ee,5,0,"rp-state",9)(10,Ne,16,3,"div",10),n()}if(t&2){let e=m();l(9),M(e.categories.length===0?9:10)}}var Fe=(()=>{class t{data;dialogRef;api;notify;saving=!1;_unsubscribeAll=new D;constructor(e,a,i,d){this.data=e,this.dialogRef=a,this.api=i,this.notify=d}save(){this.saving||!this.data.name?.trim()||(this.saving=!0,this.dialogRef.disableClose=!0,this.api.post("Shop/admin/saveCategory",this.data,!0).pipe(C(this._unsubscribeAll)).subscribe({next:()=>this.dialogRef.close(this.data),error:e=>{this.saving=!1,this.dialogRef.disableClose=!1,this.notify.openErrorModal(e.error?e.error:"The category could not be saved. Please try again.")}}))}ngOnDestroy(){this._unsubscribeAll.next(!0),this._unsubscribeAll.complete()}static \u0275fac=function(a){return new(a||t)(g(K),g(J),g(W),g(N))};static \u0275cmp=T({type:t,selectors:[["shop-category-edit-dialog"]],decls:18,vars:7,consts:[["titleId","cat-dialog-title",3,"closed","title"],[1,"mat-typography"],["appearance","outline",1,"w-100-p","mt-16"],["matInput","","name","name","required","",3,"ngModelChange","ngModel"],["appearance","outline",1,"w-100-p"],["matInput","","type","number","name","sortPos",3,"ngModelChange","ngModel"],["name","active",3,"ngModelChange","ngModel"],[1,"rpui-dialog-actions"],[1,"rpui-spacer"],["mat-button","",3,"mat-dialog-close","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(a,i){a&1&&(o(0,"rp-dialog-header",0),_("closed",function(){return i.dialogRef.close()}),n(),o(1,"mat-dialog-content",1)(2,"mat-form-field",2)(3,"mat-label"),r(4,"Name"),n(),o(5,"input",3),E("ngModelChange",function(p){return P(i.data.name,p)||(i.data.name=p),p}),n()(),o(6,"mat-form-field",4)(7,"mat-label"),r(8,"Sort order (lower shows first)"),n(),o(9,"input",5),E("ngModelChange",function(p){return P(i.data.sortPos,p)||(i.data.sortPos=p),p}),n()(),o(10,"mat-slide-toggle",6),E("ngModelChange",function(p){return P(i.data.active,p)||(i.data.active=p),p}),r(11,"Visible in the shop"),n()(),o(12,"mat-dialog-actions",7),u(13,"span",8),o(14,"button",9),r(15,"Cancel"),n(),o(16,"button",10),_("click",function(){return i.save()}),r(17),n()()),a&2&&(c("title",i.data._key?"Edit Category":"New Category"),l(5),x("ngModel",i.data.name),l(4),x("ngModel",i.data.sortPos),l(),x("ngModel",i.data.active),l(4),c("disabled",i.saving),l(2),c("disabled",!(i.data.name!=null&&i.data.name.trim())||i.saving),l(),F(" ",i.saving?"Saving\u2026":"Save"," "))},dependencies:[I,A,L,G,z,U,q,R,X,Z,Y,H,V,ie,te,ee,B,ae,ne,pe,de,we],encapsulation:2})}return t})(),ut=(()=>{class t{api;notify;dialog;loading=!0;errorMessage="";categories=[];displayedColumns=["name","sort","status","actions"];_unsubscribeAll=new D;constructor(e,a,i){this.api=e,this.notify=a,this.dialog=i}ngOnInit(){this.load()}load(){this.loading=!0,this.errorMessage="",this.api.get("Shop/admin/categories",!0).pipe(C(this._unsubscribeAll)).subscribe({next:e=>{this.categories=e||[],this.loading=!1},error:e=>{this.errorMessage=e.error?e.error:"The categories could not be loaded. Please try again.",this.loading=!1}})}openEdit(e){let a=e?j({},e):{name:"",sortPos:(this.categories.length+1)*10,active:!0};this.dialog.open(Fe,{data:a,width:"460px",maxWidth:"94vw",ariaLabelledBy:"cat-dialog-title"}).afterClosed().pipe(C(this._unsubscribeAll)).subscribe(i=>{i&&(this.notify.openToaster("Category saved.","success"),this.load())})}remove(e){let a=this.dialog.open(re,{disableClose:!1});
1a.componentInstance.confirmMessage='Remove the category "'+e.name+'"? Products in it are kept and show without a category.',a.afterClosed().pipe(C(this._unsubscribeAll)).subscribe(i=>{i&&this.api.post("Shop/admin/deleteCategory/"+e._key,{},!0).pipe(C(this._unsubscribeAll)).subscribe({next:()=>{this.notify.openToaster("Category removed.","success"),this.load()},error:d=>this.notify.openErrorModal(d.error?d.error:"The category could not be removed. Please try again.")})})}ngOnDestroy(){this._unsubscribeAll.next(!0),this._unsubscribeAll.complete()}static \u0275fac=function(a){return new(a||t)(g(W),g(N),g(Q))};static \u0275cmp=T({type:t,selectors:[["shop-categories"]],decls:5,vars:4,consts:[["id","ShopCategoriesPage",1,"page-layout","simple","fullwidth"],["title","Shop Categories","matIcon","category",3,"hideBanner"],[1,"content","p-24"],["mode","loading","body","Loading categories"],["mode","error","title","We couldn't load your categories",3,"body"],["mat-flat-button","","color","primary",3,"click"],[1,"toolbar"],[1,"rpui-hint"],[1,"toolbar__spacer"],["mode","empty","icon","category","title","No categories yet","body","Create your first category \u2014 for example \u201CApparel\u201D or \u201CBats\u201D \u2014 to group products on your shop page."],[1,"rpui-table-wrap","rpui-table-stack"],["mat-table","",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","sort"],["mat-header-cell","","class","rpui-num col-narrow",4,"matHeaderCellDef"],["mat-cell","","class","rpui-num col-narrow","data-label","Sort",4,"matCellDef"],["matColumnDef","status"],["mat-header-cell","","class","col-status",4,"matHeaderCellDef"],["mat-cell","","class","col-status",4,"matCellDef"],["matColumnDef","actions"],["mat-header-cell","","class","col-actions",4,"matHeaderCellDef"],["mat-cell","","class","col-actions",4,"matCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],[1,"cat-name"],["mat-header-cell","",1,"rpui-num","col-narrow"],["mat-cell","","data-label","Sort",1,"rpui-num","col-narrow"],["mat-header-cell","",1,"col-status"],["mat-cell","",1,"col-status"],[1,"rpui-chip","rpui-chip--neutral"],["aria-hidden","true"],["mat-header-cell","",1,"col-actions"],["mat-cell","",1,"col-actions"],["mat-icon-button","",1,"rpui-icon-target",3,"click","matTooltip"],["mat-icon-button","",1,"rpui-icon-target","act-remove",3,"click","matTooltip"],["mat-header-row",""],["mat-row",""]],template:function(a,i){a&1&&(o(0,"div",0),u(1,"page-header",1),S(2,xe,2,0,"div",2),S(3,Pe,4,1,"div",2),S(4,je,11,1,"div",2),n()),a&2&&(l(),c("hideBanner",!0),l(),M(i.loading?2:-1),l(),M(!i.loading&&i.errorMessage?3:-1),l(),M(!i.loading&&!i.errorMessage?4:-1))},dependencies:[I,A,H,V,$,R,B,oe,ye,me,_e,he,ue,ge,be,Ce,fe,Se,Me,se,le,ce,ve],styles:["[_ngcontent-%COMP%]:root{--rp-navy-900: #10243f;--rp-navy-800: #143b67;--rp-navy-700: #1a3668;--rp-navy-600: #244f7e;--rp-text: #122033;--rp-text-muted: #64798c;--rp-text-subtle: #667085;--rp-divider: #dce5ee;--rp-divider-soft: #e8edf3;--rp-border-control: #8792a5;--rp-surface: #ffffff;--rp-surface-tint: #f2f7fc;--rp-surface-head: #eef2f6;--rp-surface-sunken: #f7f9fc;--rp-ok-bg: #eaf6ea;--rp-ok-border: #7fb583;--rp-ok-fg: #2e7d32;--rp-warn-bg: #fff3e0;--rp-warn-border: #c9922f;--rp-warn-fg: #9a4a00;--rp-danger-bg: #ffebee;--rp-danger-border: #d97b7b;--rp-danger-fg: #c62828;--rp-info-bg: #eef2fb;--rp-info-border: #8fa6cf;--rp-info-fg: #244f7e;--rp-neutral-bg: #f1f3f6;--rp-neutral-border: #9aa4b2;--rp-neutral-fg: #5a6b7d;--rp-gold-bg: #fdf6e3;--rp-gold-ring: #d4a531;--rp-gold-fg: #6b4700;--rp-silver-bg: #f1f3f6;--rp-silver-ring: #9ba5b1;--rp-silver-fg: #48535f;--rp-bronze-bg: #f8ede6;--rp-bronze-ring: #c4855f;--rp-bronze-fg: #6e3b1d;--rp-focus-ring: #244f7e;--rp-radius-control: 6px;--rp-radius-card: 8px;--rp-radius-row: 10px;--rp-radius-panel: 16px;--rp-shadow-card: 0 1px 3px rgba(15, 31, 53, .05);--rp-shadow-panel: 0 1px 3px rgba(15, 31, 53, .04), 0 8px 32px rgba(15, 31, 53, .07)}#ShopCategoriesPage[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:16px;margin-bottom:16px}#ShopCategoriesPage[_ngcontent-%COMP%] .toolbar__spacer[_ngcontent-%COMP%]{flex:1 1 auto}@media screen and (max-width:599px){#ShopCategoriesPage[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%]{flex-wrap:wrap}#ShopCategoriesPage[_ngcontent-%COMP%] .toolbar__spacer[_ngcontent-%COMP%]{display:none}#ShopCategoriesPage[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%}}#ShopCategoriesPage[_ngcontent-%COMP%] .rpui-table-wrap[_ngcontent-%COMP%]{max-width:1280px}
1#ShopCategoriesPage[_ngcontent-%COMP%] .cat-name[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:#122033}#ShopCategoriesPage[_ngcontent-%COMP%] .col-narrow[_ngcontent-%COMP%]{width:96px;white-space:nowrap}#ShopCategoriesPage[_ngcontent-%COMP%] .col-status[_ngcontent-%COMP%]{width:160px}#ShopCategoriesPage[_ngcontent-%COMP%] .col-actions[_ngcontent-%COMP%]{width:104px;white-space:nowrap;text-align:right}#ShopCategoriesPage[_ngcontent-%COMP%] .act-remove[_ngcontent-%COMP%]:hover:not([disabled]){color:#c62828}"]})}return t})();export{ut as ShopCategoriesComponent,Fe as ShopCategoryEditDialogComponent};
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.