1import{a as fe}from"./chunk-RGWTER5P.js";import{a as ge}from"./chunk-PCQZQ3U4.js";import{a as ce,f as me}from"./chunk-JDYWGDNH.js";import"./chunk-IRONFM6M.js";import"./chunk-VHX354RR.js";import{a as de,b as _e}from"./chunk-22WJKAIZ.js";import{b as Ce}from"./chunk-SLWPYULI.js";import{a as ie,b as ne}from"./chunk-6S5SATLI.js";import"./chunk-RPDGXIQT.js";import"./chunk-RFHORXFH.js";import"./chunk-44BDWJO3.js";import"./chunk-YPSMJDVJ.js";import"./chunk-F6HJUGGY.js";import"./chunk-W6FQLWKF.js";import"./chunk-6MXSXX3N.js";import"./chunk-MT62CIDI.js";import"./chunk-BXNQRMY5.js";import"./chunk-RFCDL6VX.js";import{a as pe,b as se}from"./chunk-25TT7GVM.js";import"./chunk-XWDSR7V3.js";import"./chunk-3THAQ3J3.js";import"./chunk-FRZHUY6N.js";import{a as oe,b as le}from"./chunk-OAED5FIG.js";import{a as Q,b as X}from"./chunk-P37GQ53N.js";import{b as re,c as ae}from"./chunk-NZ226J7R.js";import"./chunk-7EBKYMB6.js";import"./chunk-YK3HMHC4.js";import"./chunk-2DRXLVRR.js";import{d as ee,e as te}from"./chunk-OFHUO5H7.js";import"./chunk-M3XSAKW4.js";import"./chunk-H76LZNGX.js";import"./chunk-PGR2NPNS.js";import"./chunk-OZD37XM5.js";import"./chunk-DLIVM562.js";import"./chunk-CV2ZWZQE.js";import"./chunk-AVEXXPAT.js";import{ja as J}from"./chunk-FHU4TM37.js";import{a as ue}from"./chunk-UUEFXD6N.js";import{C as K,D as W,E as q,c as F,e as O,g as U,h as $,m as z,q as Y,s as j}from"./chunk-Q2KKZV5J.js";import{a as k}from"./chunk-JICM7NVH.js";import{a as Z}from"./chunk-BD6EMWWF.js";import"./chunk-AB6CKZTE.js";import{c as B,d as G,e as H}from"./chunk-DIGPPQJE.js";import{x as R}from"./chunk-EU6HCBUP.js";import"./chunk-KAJMKXZ6.js";import{D}from"./chunk-ZAQTNZYS.js";import"./chunk-SRTXE2HR.js";import{Dc as I,Ec as V,Fc as P,Jb as c,Kc as y,Mb as A,Rb as g,Ub as L,Uc as p,Vb as N,Vc as s,Wb as o,Xb as l,Yb as a,_a as w,ac as T,da as x,db as r,gc as f,hc as m,la as h,ma as E,sb as M,uc as _,vc as S,wc as v,yb as u}from"./chunk-NTTV6FWH.js";import{g as b}from"./chunk-W7GRJBO5.js";var Ee=()=>({width:"500px"}),Se=()=>({"min-width":"40rem"}),ve=(e,i)=>i.id;function xe(e,i){e&1&&a(0,"app-widget-loading")}function Te(e,i){if(e&1){let t=T();o(0,"app-widget-api-error",13),f("retry",function(){h(t);let d=m();return E(d.loadCollections())}),l()}}function be(e,i){if(e&1){let t=T();o(0,"app-widget-manager-empty-state",14),f("ctaClick",function(){h(t);let d=m();return E(d.openCreateDialog())}),l()}}function we(e,i){e&1&&(o(0,"tr"),a(1,"th",21),o(2,"th"),_(3),p(4,"translate"),l(),o(5,"th"),_(6),p(7,"translate"),l(),o(8,"th"),_(9),p(10,"translate"),l(),o(11,"th"),_(12),p(13,"translate"),l(),a(14,"th",22),l()),e&2&&(r(3),v(" ",s(4,4,"MANAGER.SHOP.COL_COLLECTION_TITLE")," "),r(3),v(" ",s(7,6,"MANAGER.SHOP.COL_COLLECTION_TYPE")," "),r(3),v(" ",s(10,8,"MANAGER.SHOP.COL_COLLECTION_PRODUCTS")," "),r(3),v(" ",s(13,10,"MANAGER.SHOP.COL_COLLECTION_VISIBLE")," "))}function ye(e,i){if(e&1&&a(0,"img",23),e&2){let t=m().$implicit;c("src",t.imageUrl,w)("alt",t.title)}}function Oe(e,i){e&1&&(o(0,"div",24),a(1,"i",35),l())}function Me(e,i){if(e&1&&(o(0,"div",26),_(1),l()),e&2){let t=m().$implicit;r(),v(" ",t.description," ")}}function Ae(e,i){if(e&1&&a(0,"p-tag",27),e&2){let t=m().$implicit;c("value",t.sourceLabel||t.source)("rounded",!0)}}function Le(e,i){if(e&1&&(a(0,"p-tag",28),p(1,"translate"),p(2,"translate")),e&2){let t=m().$implicit;c("value",t.type==="auto"?s(1,3,"MANAGER.SHOP.COLLECTION_TYPE_AUTO"):s(2,5,"MANAGER.SHOP.COLLECTION_TYPE_MANUAL"))("severity",t.type==="auto"?"info":"secondary")("rounded",!0)}}function Ne(e,i){e&1&&a(0,"i",30)}function Ie(e,i){e&1&&a(0,"i",31)}function Ve(e,i){if(e&1){let t=T();o(0,"tr")(1,"td"),u(2,ye,1,2,"img",23)(3,Oe,2,0,"div",24),l(),o(4,"td")(5,"span",25),_(6),l(),u(7,Me,2,1,"div",26),l(),o(8,"td"),u(9,Ae,1,2,"p-tag",27)(10,Le,3,7,"p-tag",28),l(),o(11,"td")(12,"span",29),_(13),l()(),o(14,"td"),u(15,Ne,1,0,"i",30)(16,Ie,1,0,"i",31),l(),o(17,"td")(18,"div",32)(19,"p-button",33),p(20,"translate"),f("onClick",function(){let d=h(t).$implicit,C=m(2);return E(C.openEditDialog(d))}),l(),o(21,"p-button",34),p(22,"translate"),f("onClick",function(){let d=h(t).$implicit,C=m(2);return E(C.onDelete(d))}),l()()()()}if(e&2){let t,n=i.$implicit;r(2),g(n.imageUrl?2:3),r(4),S(n.title),r(),g(n.description?7:-1),r(2),g(n.source&&n.source!=="manual"?9:10),r(4),S((t=n.productC
1ount)!==null&&t!==void 0?t:0),r(2),g(n.isVisible?15:16),r(4),c("text",!0)("pTooltip",s(20,10,"MANAGER.SHOP.BTN_EDIT")),r(2),c("text",!0)("pTooltip",s(22,12,"MANAGER.SHOP.BTN_DELETE"))}}function Pe(e,i){if(e&1&&a(0,"img",37),e&2){let t=m().$implicit;c("src",t.imageUrl,w)("alt",t.title)}}function De(e,i){e&1&&(o(0,"div",38),a(1,"i",35),l())}function Re(e,i){if(e&1&&a(0,"p-tag",42),e&2){let t=m().$implicit;c("value",t.sourceLabel||t.source)("rounded",!0)}}function Be(e,i){if(e&1&&(a(0,"p-tag",43),p(1,"translate"),p(2,"translate")),e&2){let t=m().$implicit;c("value",t.type==="auto"?s(1,3,"MANAGER.SHOP.COLLECTION_TYPE_AUTO"):s(2,5,"MANAGER.SHOP.COLLECTION_TYPE_MANUAL"))("severity",t.type==="auto"?"info":"secondary")("rounded",!0)}}function Ge(e,i){e&1&&a(0,"i",46)}function He(e,i){e&1&&a(0,"i",47)}function ke(e,i){if(e&1){let t=T();o(0,"div",20)(1,"div",36),u(2,Pe,1,2,"img",37)(3,De,2,0,"div",38),o(4,"div",39)(5,"span",40),_(6),l(),o(7,"div",41),u(8,Re,1,2,"p-tag",42)(9,Be,3,7,"p-tag",43),o(10,"span",44),a(11,"i",45),_(12),l(),u(13,Ge,1,0,"i",46)(14,He,1,0,"i",47),l()(),o(15,"div",48)(16,"p-button",49),f("onClick",function(){let d=h(t).$implicit,C=m(2);return E(C.openEditDialog(d))}),l(),o(17,"p-button",50),f("onClick",function(){let d=h(t).$implicit,C=m(2);return E(C.onDelete(d))}),l()()()()}if(e&2){let t,n=i.$implicit;r(2),g(n.imageUrl?2:3),r(4),S(n.title),r(2),g(n.source&&n.source!=="manual"?8:9),r(4),S((t=n.productCount)!==null&&t!==void 0?t:0),r(),g(n.isVisible?13:14),r(3),c("text",!0),r(),c("text",!0)}}function Fe(e,i){if(e&1&&(o(0,"div",15)(1,"p-table",16),u(2,we,15,12,"ng-template",17)(3,Ve,23,14,"ng-template",18),l()(),o(4,"div",19),L(5,ke,18,7,"div",20,ve),l()),e&2){let t=m();r(),c("value",t.collections)("tableStyle",y(2,Se)),r(4),N(t.collections)}}var he=class e{shopService=x(ge);toastService=x(k);confirmService=x(ue);translateService=x(B);fb=x(K);loading=!0;error="";collections=[];showDialog=!1;editingCollection=null;saving=!1;form=this.fb.group({title:["",[O.required,O.maxLength(200)]],description:[""],imageUrl:[""],isVisible:[!0]});bridge=se(this.form,{preset:pe()});apiError=null;get isEditing(){return!!this.editingCollection}ngOnInit(){this.loadCollections()}loadCollections(){return b(this,null,function*(){this.loading=!0,this.error="";try{this.collections=yield this.shopService.listCollections()}catch(i){this.error=i?.error?.message||i?.message||"Error"}finally{this.loading=!1}})}openCreateDialog(){this.editingCollection=null,this.form.reset({title:"",description:"",imageUrl:"",isVisible:!0}),this.bridge.clearApiErrors(),this.apiError=null,this.showDialog=!0}openEditDialog(i){this.editingCollection=i,this.form.patchValue({title:i.title,description:i.description||"",imageUrl:i.imageUrl||"",isVisible:i.isVisible}),this.showDialog=!0}saveCollection(){return b(this,null,function*(){if(this.form.invalid)return;this.saving=!0,this.bridge.clearApiErrors(),this.apiError=null;let i={title:this.form.value.title,description:this.form.value.description||void 0,imageUrl:this.form.value.imageUrl||void 0,isVisible:this.form.value.isVisible??!0};try{this.isEditing?(yield this.shopService.updateCollection(this.editingCollection.id,i),this.toastService.success(this.translateService.instant("MANAGER.SHOP.COLLECTION_UPDATED"))):(yield this.shopService.createCollection(i),this.toastService.success(this.translateService.instant("MANAGER.SHOP.COLLECTION_CREATED"))),this.showDialog=!1,this.loadCollections()}catch(t){t?.error&&this.bridge.applyApiErrors(t.error),this.apiError=this.bridge.firstErrorSignal()?.message||t?.error?.message||"Error",this.toastService.error(this.apiError||"Error")}finally{this.saving=!1}})}onDelete(i){return b(this,null,function*(){if(yield this.confirmService.confirm({message:this.translateService.instant("MANAGER.SHOP.COLLECTION_DELETE_CONFIRM"),header:this.translateService.instant("MANAGER.SHOP.COLLECTION_DELETE_TITLE"),severity:"danger",acceptLabel:this.translateService.instant("MANAGER.SHOP.BTN_DELETE"),rejectLabel:this.translateService.instant("MANAGER.SHOP.BTN_CANCEL")}))try{yield this.shopService.deleteCollection(i.id),this.toastService.success(this.translateService.instant("MANAGER.SHOP.COLLECTION_DELET
1ED")),this.loadCollections()}catch(n){this.toastService.error(n?.error?.message||"Error")}})}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=M({type:e,selectors:[["app-view-manager-shop-collections"]],decls:29,vars:33,consts:[["icon","pi pi-th-large","titleKey","MANAGER.SHOP.COLLECTIONS_EMPTY_TITLE","descriptionKey","MANAGER.SHOP.COLLECTIONS_EMPTY_DESC","ctaLabelKey","MANAGER.SHOP.BTN_ADD_COLLECTION","ctaIcon","pi pi-plus"],[3,"visibleChange","header","visible","modal","closable"],[3,"ngSubmit","formGroup"],[1,"mb-3"],[1,"form-label"],["pInputText","","formControlName","title",1,"w-100"],["pInputText","","formControlName","description","rows","3",1,"w-100"],[1,"mb-3","d-flex","align-items-center","gap-2"],["formControlName","isVisible"],[1,"form-label","mb-0"],[1,"d-flex","justify-content-end","gap-2","mt-4"],["severity","secondary",3,"onClick","label","text"],["severity","primary","type","submit",3,"label","loading","disabled"],[3,"retry"],["icon","pi pi-th-large","titleKey","MANAGER.SHOP.COLLECTIONS_EMPTY_TITLE","descriptionKey","MANAGER.SHOP.COLLECTIONS_EMPTY_DESC","ctaLabelKey","MANAGER.SHOP.BTN_ADD_COLLECTION","ctaIcon","pi pi-plus",3,"ctaClick"],[1,"d-none","d-md-block"],["styleClass","p-datatable-sm",3,"value","tableStyle"],["pTemplate","header"],["pTemplate","body"],[1,"d-md-none"],[1,"collection-card-mobile","mb-3"],[2,"width","50px"],[2,"width","120px"],[1,"collection-thumb",3,"src","alt"],[1,"collection-thumb","collection-thumb--placeholder"],[1,"fw-semibold"],[1,"text-muted","text-sm","mt-1",2,"max-width","300px","white-space","nowrap","overflow","hidden","text-overflow","ellipsis"],["severity","warn",3,"value","rounded"],[3,"value","severity","rounded"],[1,"text-muted"],[1,"pi","pi-eye","text-success"],[1,"pi","pi-eye-slash","text-muted"],[1,"d-flex","gap-1","justify-content-end"],["icon","pi pi-pencil","severity","secondary","size","small","tooltipPosition","top",3,"onClick","text","pTooltip"],["icon","pi pi-trash","severity","danger","size","small","tooltipPosition","top",3,"onClick","text","pTooltip"],[1,"pi","pi-th-large"],[1,"d-flex","gap-3","align-items-center"],[1,"collection-thumb-mobile",3,"src","alt"],[1,"collection-thumb-mobile","collection-thumb--placeholder"],[1,"flex-grow-1"],[1,"fw-semibold","d-block","mb-1"],[1,"d-flex","gap-2","align-items-center"],["severity","warn","styleClass","text-xs",3,"value","rounded"],["styleClass","text-xs",3,"value","severity","rounded"],[1,"text-muted",2,"font-size","0.8rem"],[1,"pi","pi-box","me-1"],[1,"pi","pi-eye","text-success",2,"font-size","0.8rem"],[1,"pi","pi-eye-slash","text-muted",2,"font-size","0.8rem"],[1,"d-flex","flex-column","gap-1"],["icon","pi pi-pencil","severity","secondary","size","small",3,"onClick","text"],["icon","pi pi-trash","severity","danger","size","small",3,"onClick","text"]],template:function(t,n){t&1&&(u(0,xe,1,0,"app-widget-loading")(1,Te,1,0,"app-widget-api-error")(2,be,1,0,"app-widget-manager-empty-state",0)(3,Fe,7,3),o(4,"p-dialog",1),p(5,"translate"),p(6,"translate"),P("visibleChange",function(C){return V(n.showDialog,C)||
1(n.showDialog=C),C}),o(7,"form",2),f("ngSubmit",function(){return n.saveCollection()}),o(8,"div",3)(9,"label",4),_(10),p(11,"translate"),l(),a(12,"input",5),l(),o(13,"div",3)(14,"label",4),_(15),p(16,"translate"),l(),a(17,"textarea",6),l(),o(18,"div",7),a(19,"p-inputSwitch",8),o(20,"label",9),_(21),p(22,"translate"),l()(),o(23,"div",10)(24,"p-button",11),p(25,"translate"),f("onClick",function(){return n.showDialog=!1}),l(),a(26,"p-button",12),p(27,"translate"),p(28,"translate"),l()()()),t&2&&(g(n.loading?0:n.error?1:n.collections.length===0?2:3),r(4),A(y(32,Ee)),c("header",n.isEditing?s(5,16,"MANAGER.SHOP.COLLECTION_EDIT_TITLE"):s(6,18,"MANAGER.SHOP.COLLECTION_CREATE_TITLE")),I("visible",n.showDialog),c("modal",!0)("closable",!0),r(3),c("formGroup",n.form),r(3),v("",s(11,20,"MANAGER.SHOP.LABEL_TITLE")," *"),r(5),S(s(16,22,"MANAGER.SHOP.LABEL_DESCRIPTION")),r(6),S(s(22,24,"MANAGER.SHOP.LABEL_VISIBLE")),r(3),c("label",s(25,26,"MANAGER.SHOP.BTN_CANCEL"))("text",!0),r(2),c("label",n.isEditing?s(27,28,"MANAGER.SHOP.BTN_SAVE"):s(28,30,"MANAGER.SHOP.BTN_CREATE_COLLECTION"))("loading",n.saving)("disabled",n.form.invalid))},dependencies:[D,R,W,z,F,U,$,q,Y,j,H,G,te,ee,J,me,ce,_e,de,le,oe,X,Q,ae,re,ne,ie,Z,Ce,fe],styles:[".shop-tab-content[_ngcontent-%COMP%]{background:var(--p-surface-card);border:1px solid var(--p-surface-border);border-top:none;border-radius:0 0 10px 10px;padding:1.25rem}.collection-thumb[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:8px;object-fit:cover}.collection-thumb-mobile[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:8px;object-fit:cover}.collection-thumb--placeholder[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;background:var(--p-surface-100);color:var(--p-text-muted-color);font-size:1rem}.collection-card-mobile[_ngcontent-%COMP%]{background:var(--p-surface-card);border:1px solid var(--p-surface-border);border-radius:10px;padding:.75rem}.form-label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:600;color:var(--p-text-muted-color);margin-bottom:.35rem;display:block}"]})};export{he as ViewManagerShopCollectionsComponent};
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.