1import{h as T}from"./chunk-JCGU4DJ5.js";import{a as D,b as L,d as K,e as U,f as Z,g as J,h as $,t as q,w as G}from"./chunk-4NYICKVE.js";import{b as j,c as w,d as z,e as N,l as A,m as F,o as R}from"./chunk-5JXCLUFZ.js";import{F as V,H as O,J as B}from"./chunk-AYQHWHSC.js";import{$a as C,Da as S,Ha as u,Ob as E,Pb as W,Q as m,R as g,Sa as d,Ta as o,Ua as i,Zb as I,bb as _,cb as l,jb as M,kb as c,lb as f,nb as v,qb as y,rb as b,sa as s,sb as h}from"./chunk-SFGAONKY.js";import{a as k,b as P}from"./chunk-C6Q5SG76.js";function Q(t,n){if(t&1&&(o(0,"p",12),c(1),i()),t&2){let e=l();s(),f(e.message)}}function X(t,n){if(t&1&&(o(0,"p",13),c(1),i()),t&2){let e=l();s(),f(e.error)}}function Y(t,n){t&1&&(o(0,"p"),c(1,"Kolejno\u015B\u0107 i opisy stron ofertowych."),i())}function ee(t,n){t&1&&(o(0,"p"),c(1,"Aktywne profile wy\u015Bwietlane na stronie."),i())}function te(t,n){t&1&&(o(0,"p"),c(1,"Program polece\u0144, polityka prywatno\u015Bci i pozosta\u0142e tre\u015Bci."),i())}function ne(t,n){t&1&&(o(0,"p"),c(1,"Pobieranie danych\u2026"),i())}function ie(t,n){if(t&1){let e=C();o(0,"article")(1,"div")(2,"strong"),c(3),i(),o(4,"span"),c(5),i()(),o(6,"div",21)(7,"button",7),_("click",function(){let a=m(e).$implicit,p=l(3);return g(p.edit(a))}),c(8,"Edytuj"),i(),o(9,"button",22),_("click",function(){let a=m(e).$implicit,p=l(3);return g(p.remove(a))}),c(10,"Usu\u0144"),i()()()}if(t&2){let e=n.$implicit;s(3),f(e.name||e.title||e.id),s(2),v("",e.id," \xB7 ",e.active===!1?"ukryty":"aktywny")}}function oe(t,n){t&1&&(o(0,"p"),c(1,"Brak wpis\xF3w w tej sekcji."),i())}function re(t,n){if(t&1&&(o(0,"div",19),u(1,ie,11,3,"article",20)(2,oe,2,0,"p",16),i()),t&2){let e=l(2);s(),d("ngForOf",e.records)("ngForTrackBy",e.trackById),s(),d("ngIf",!e.records.length)}}function ae(t,n){if(t&1){let e=C();o(0,"section",14)(1,"div",15)(2,"div")(3,"h2"),c(4),i(),u(5,Y,2,0,"p",16)(6,ee,2,0,"p",16)(7,te,2,0,"p",16),i(),o(8,"button",17),_("click",function(){m(e);let a=l();return g(a.create())}),c(9,"Dodaj wpis"),i()(),u(10,ne,2,0,"p",16)(11,re,3,3,"div",18),i()}if(t&2){let e=l();s(4),f(e.definition.title),s(),d("ngIf",e.section==="categories"),s(),d("ngIf",e.section==="team"),s(),d("ngIf",e.section==="content"),s(3),d("ngIf",e.loading),s(),d("ngIf",!e.loading)}}function se(t,n){if(t&1){let e=C();o(0,"label")(1,"span"),c(2,"Identyfikator"),i(),o(3,"input",29),h("ngModelChange",function(a){m(e);let p=l(2);return b(p.selected.id,a)||(p.selected.id=a),g(a)}),i()()}if(t&2){let e=l(2);s(3),y("ngModel",e.selected.id)}}function ce(t,n){if(t&1){let e=C();o(0,"textarea",32),h("ngModelChange",function(a){m(e);let p=l().$implicit,x=l(2);return b(x.selected[p.key],a)||(x.selected[p.key]=a),g(a)}),i()}if(t&2){let e=l().$implicit,r=l(2);y("ngModel",r.selected[e.key]),d("name",e.key)}}function le(t,n){if(t&1){let e=C();o(0,"input",33),h("ngModelChange",function(a){m(e);let p=l().$implicit,x=l(2);return b(x.selected[p.key],a)||(x.selected[p.key]=a),g(a)}),i()}if(t&2){let e=l().$implicit,r=l(2);d("type",e.kind||"text"),y("ngModel",r.selected[e.key]),d("name",e.key)}}function de(t,n){if(t&1&&(o(0,"label")(1,"span"),c(2),i(),u(3,ce,1,2,"textarea",30)(4,le,1,3,"input",31),i()),t&2){let e=n.$implicit;s(2),f(e.label),s(),d("ngIf",e.kind==="textarea"),s(),d("ngIf",e.kind!=="textarea")}}function pe(t,n){if(t&1){let e=C();o(0,"form",23),_("ngSubmit",function(){m(e);let a=l();return g(a.save())}),o(1,"div",15)(2,"div")(3,"p",2),c(4,"Edycja"),i(),o(5,"h2"),c(6),i()(),o(7,"label",24)(8,"input",25),h("ngModelChange",function(a){m(e);let p=l();return b(p.selected.active,a)||(p.selected.active=a),g(a)}),i(),c(9," Widoczny"),i()(),u(10,se,4,1,"label",16)(11,de,5,3,"label",26),o(12,"div",27)(13,"button",7),_("click",function(){m(e);let a=l();return g(a.cancel())}),c(14,"Anuluj"),i(),o(15,"button",28),c(16),i()()()}if(t&2){let e=l();s(6),f(e.selected.name||e.selected.title||"Nowy wpis"),s(2),y("ngModel",e.selected.active),s(2),d("ngIf",!e.selected.id),s(),d("ngForOf",e.definition.fields),s(4),d("disabled",e.saving),s(),f(e.saving?"Zapisywanie\u2026":"Zapisz")}}var H=class t{section="categories";records=[];selected=null;loading=!0;saving=!1;message="";error="";arrayFields=new Set(["benefits","indications","contraindications","procedureSteps","specialties","images"]);db=z(O().length?O()[0]:V(B));
1definitions={categories:{collection:"publicSiteCategories",title:"Kategorie",fields:[{key:"name",label:"Nazwa"},{key:"slug",label:"Adres URL"},{key:"shortDescription",label:"Kr\xF3tki opis",kind:"textarea"},{key:"fullDescription",label:"Pe\u0142ny opis",kind:"textarea"},{key:"heroImage",label:"Adres zdj\u0119cia"},{key:"displayOrder",label:"Kolejno\u015B\u0107",kind:"number"},{key:"seoTitle",label:"Tytu\u0142 SEO"},{key:"seoDescription",label:"Opis SEO",kind:"textarea"}]},team:{collection:"publicSiteTeam",title:"Zesp\xF3\u0142",fields:[{key:"name",label:"Imi\u0119 i nazwisko"},{key:"slug",label:"Adres URL"},{key:"role",label:"Stanowisko"},{key:"shortDescription",label:"Kr\xF3tki opis",kind:"textarea"},{key:"fullDescription",label:"Pe\u0142ny opis",kind:"textarea"},{key:"specialties",label:"Specjalizacje (ka\u017Cda w nowej linii)",kind:"textarea"},{key:"profileImage",label:"Adres zdj\u0119cia"},{key:"displayOrder",label:"Kolejno\u015B\u0107",kind:"number"},{key:"seoTitle",label:"Tytu\u0142 SEO"},{key:"seoDescription",label:"Opis SEO",kind:"textarea"}]},content:{collection:"publicSiteContent",title:"Tre\u015Bci i dokumenty",fields:[{key:"title",label:"Tytu\u0142"},{key:"slug",label:"Adres URL"},{key:"intro",label:"Wprowadzenie",kind:"textarea"},{key:"sections",label:"Sekcje (format JSON)",kind:"textarea"},{key:"displayOrder",label:"Kolejno\u015B\u0107",kind:"number"},{key:"seoTitle",label:"Tytu\u0142 SEO"},{key:"seoDescription",label:"Opis SEO",kind:"textarea"}]}};get definition(){return this.definitions[this.section]}async ngOnInit(){await this.load()}async chooseSection(n){this.section=n,this.selected=null,await this.load()}async load(){this.loading=!0,this.error="",this.message="";try{let n=await A(j(this.db,this.definition.collection));this.records=n.docs.map(e=>k({id:e.id},e.data())).sort((e,r)=>Number(e.displayOrder||0)-Number(r.displayOrder||0))}catch(n){this.error=this.describe(n,"Nie uda\u0142o si\u0119 pobra\u0107 tre\u015Bci.")}finally{this.loading=!1}}edit(n){let e=k({},n);for(let r of this.arrayFields)Array.isArray(e[r])&&(e[r]=e[r].join(` 2`));Array.isArray(e.sections)&&(e.sections=JSON.stringify(e.sections,null,2)),this.selected=e}create(){this.selected={id:"",active:!0,displayOrder:this.records.length+1}}cancel(){this.selected=null}async save(){if(!this.selected)return;let n=String(this.selected.id||this.selected.slug||"").trim();if(!n){this.error="Podaj adres URL albo identyfikator.";return}this.saving=!0,this.error="",this.message="";try{let e=P(k({},this.selected),{id:void 0,updatedAt:N()});delete e.id;for(let r of this.arrayFields)typeof e[r]=="string"&&(e[r]=String(e[r]).split(/\r?\n/).map(a=>a.trim()).filter(Boolean));typeof e.sections=="string"&&String(e.sections).trim()&&(e.sections=JSON.parse(String(e.sections))),e.displayOrder=Number(e.displayOrder||0),await F(w(this.db,this.definition.collection,n),e,{merge:!0}),this.message="Zmiany zosta\u0142y zapisane i s\u0105 dost\u0119pne dla strony.",this.selected=null,await this.load()}catch(e){this.error=this.describe(e,"Nie uda\u0142o si\u0119 zapisa\u0107 zmian.")}finally{this.saving=!1}}async remove(n){if(confirm(`Usun\u0105\u0107 \u201E${n.name||n.title||n.id}\u201D?`))try{await R(w(this.db,this.definition.collection,n.id)),await this.load()}catch(e){this.error=this.describe(e,"Nie uda\u0142o si\u0119 usun\u0105\u0107 wpisu.")}}trackById(n,e){return e.id}describe(n,e){return n instanceof Error?`${e} ${n.message}`:e}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=S({type:t,selectors:[["app-website-cms"]],decls:25,vars:10,consts:[[1,"cms-shell"],[1,"cms-head"],[1,"eyebrow"],[1,"head-actions"],["routerLink","/portal/cennik"],["href","/","target","_blank","rel","noopener"],["aria-label","Sekcje CMS",1,"tabs"],["type","button",3,"click"],["class","notice success",4,"ngIf"],["class","notice error",4,"ngIf"],["class","panel",4,"ngIf"],["class","panel editor",3,"ngSubmit",4,"ngIf"],[1,"notice","success"],[1,"notice","error"],[1,"panel"],[1,"panel-head"],[4,"ngIf"],["type","button",1,"primary",3,"click"],["class","record-list",4,"ngIf"],[1,"record-list"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"record-actions"],["type","button",1,"danger",3,"click"],[1,"panel","editor",3,"ngSubmit"],[1,"active-toggle"],["type","checkbox","name","active",3,"ngModelChange","ngModel"],[4,"ngFor","ngForOf"],[1,"form-actions"],["type","submit",1,"primary",3,"disabled"],["name","id","required","","placeholder","np. head-spa",3,"ngModelChange","ngModel"],["rows","5",3,"ngModel","name","ngModelChange",4,"ngIf"],[3,"type","ngModel","name","ngModelChange",4,"ngIf"],["rows","5",3,"ngModelChange","ngModel","name"],[3,"ngModelChange","type","ngModel","name"]],template:function(e,r){e&1&&(o(0,"main",0)(1,"header",1)(2,"div")(3,"p",2),c(4,"ASAMI.CARE"),i(),o(5,"h1"),c(6,"Strona gabinetu"),i(),o(7,"p"),
2c(8,"Zarz\u0105dzaj tre\u015Bciami widocznymi na stronie publicznej."),i()(),o(9,"div",3)(10,"a",4),c(11,"Us\u0142ugi i promocje"),i(),o(12,"a",5),c(13,"Otw\xF3rz stron\u0119"),i()()(),o(14,"nav",6)(15,"button",7),_("click",function(){return r.chooseSection("categories")}),c(16,"Kategorie"),i(),o(17,"button",7),_("click",function(){return r.chooseSection("team")}),c(18,"Zesp\xF3\u0142"),i(),o(19,"button",7),_("click",function(){return r.chooseSection("content")}),c(20,"Tre\u015Bci i SEO"),i()(),u(21,Q,2,1,"p",8)(22,X,2,1,"p",9)(23,ae,12,6,"section",10)(24,pe,17,6,"form",11),i()),e&2&&(s(15),M("active",r.section==="categories"),s(2),M("active",r.section==="team"),s(2),M("active",r.section==="content"),s(2),d("ngIf",r.message),s(),d("ngIf",r.error),s(),d("ngIf",!r.selected),s(),d("ngIf",r.selected))},dependencies:[I,E,W,G,$,L,D,K,U,q,J,Z,T],styles:["[_nghost-%COMP%]{display:block;color:#332c27}.cms-shell[_ngcontent-%COMP%]{max-width:1180px;margin:0 auto;padding:32px 24px 72px;font-family:Poppins,sans-serif}.cms-head[_ngcontent-%COMP%], .panel-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.cms-head[_ngcontent-%COMP%] h1[_ngcontent-%COMP%], .panel[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-weight:300;text-transform:uppercase;letter-spacing:.06em}.cms-head[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .panel[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:#756b63}.eyebrow[_ngcontent-%COMP%]{margin:0 0 6px!important;color:#ae8b48!important;font-size:12px;letter-spacing:.18em;text-transform:uppercase}.head-actions[_ngcontent-%COMP%], .record-actions[_ngcontent-%COMP%], .form-actions[_ngcontent-%COMP%]{display:flex;gap:10px;flex-wrap:wrap}.head-actions[_ngcontent-%COMP%] a[_ngcontent-%COMP%], button[_ngcontent-%COMP%]{border:1px solid #c5a664;background:#fff;color:#463b31;padding:10px 16px;border-radius:2px;text-decoration:none;font:500 12px Poppins,sans-serif;text-transform:uppercase;letter-spacing:.08em;cursor:pointer}.primary[_ngcontent-%COMP%], .tabs[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background:#9d7a3c;color:#fff}.danger[_ngcontent-%COMP%]{border-color:#bd7a70;color:#9d473d}.tabs[_ngcontent-%COMP%]{display:flex;gap:8px;margin:30px 0 18px;flex-wrap:wrap}.panel[_ngcontent-%COMP%]{background:#fff;border:1px solid #e6ded3;padding:24px;box-shadow:0 12px 42px #755b3014}.record-list[_ngcontent-%COMP%]{display:grid;gap:10px;margin-top:20px}.record-list[_ngcontent-%COMP%] article[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:14px;border:1px solid #eee7df}.record-list[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], .record-list[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block}.record-list[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-weight:500}.record-list[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:12px;color:#897d73;margin-top:3px}.editor[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.editor[_ngcontent-%COMP%] .panel-head[_ngcontent-%COMP%], .editor[_ngcontent-%COMP%] .form-actions[_ngcontent-%COMP%]{grid-column:1/-1}.editor[_ngcontent-%COMP%] label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;margin-bottom:7px;font-size:11px;text-transform:uppercase;letter-spacing:.1em}.editor[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:not([type=checkbox]), .editor[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{width:100%;box-sizing:border-box;border:1px solid #d9cfc2;padding:11px;background:#fff;font:400 14px Poppins,sans-serif}.active-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.notice[_ngcontent-%COMP%]{padding:12px 16px}.notice.success[_ngcontent-%COMP%]{background:#edf6ec;color:#315c31}.notice.error[_ngcontent-%COMP%]{background:#fbefed;color:#873e37}.form-actions[_ngcontent-%COMP%]{justify-content:flex-end}@media(max-width:760px){.cms-shell[_ngcontent-%COMP%]{padding:20px 14px 56px}.cms-head[_ngcontent-%COMP%], .panel-head[_ngcontent-%COMP%], .record-list[_ngcontent-%COMP%] article[_ngcontent-%COMP%]{align-items:stretch;flex-direction:column}
2.editor[_ngcontent-%COMP%]{grid-template-columns:1fr}.head-actions[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{flex:1;text-align:center}}"]})};export{H as WebsiteCmsComponent};
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.