1import{$d as ge,$g as Ge,Af as Ne,Ag as ke,Cg as Ue,Ie as Te,Ke as G,Lc as S,Le as Fe,Me as Se,Mf as De,Pa as Y,Re as ve,Te as Ee,Ue as xe,Wf as $e,Xe as be,Ya as he,Yf as Re,Zf as Le,_f as Be,d as $,df as Me,ee as Oe,ef as Ae,eg as ze,ff as we,fh as He,gf as H,if as Pe,nf as ye,re as Ce,rf as Ie,w as de,x as _e,z as ue}from"./chunk-JAIR6HE6.js";import{Bc as re,Cc as d,Da as b,Dc as F,Ea as z,Ec as T,Ic as q,Id as ae,Jc as Q,Jd as le,Kc as J,Kd as U,Ld as fe,Mc as w,Md as se,Na as k,Nc as P,Nd as me,Oa as g,Pa as O,Pb as _,Rb as ie,Sb as a,Sd as pe,Tb as ne,Vb as M,Wd as ce,X as I,Xa as N,Xc as D,Yc as oe,Zc as K,ac as o,bc as l,cc as c,dc as u,ec as h,gc as x,lc as A,pc as C,qc as s,sa as R,ta as L,xa as B,xb as r,yb as E}from"./chunk-HFDQBUXK.js";import{a as ee,b as te}from"./chunk-GAL4ENT6.js";var V=(()=>{class t{constructor(e){this.http=e,this.baseUrl=$.cloudServicesPath.baseUrl,this.stage=$.cloudServicesPath.stage,this.domain=$.cloudServicesPath.domain,this.appPostfix=$.cloudServicesPath.apoService}getAllOffers(){return this.http.get(`${this.baseUrl}${this.stage}${this.domain}${this.appPostfix}`,{params:new _e().set("all","true")})}getOfferContent(e){return this.http.get(e,{responseType:"text",headers:this.disableBrowserCache()})}createOffer(e){return this.http.post(`${this.baseUrl}${this.stage}${this.domain}${this.appPostfix}`,e)}updateOffer(e){return this.http.put(`${this.baseUrl}${this.stage}${this.domain}${this.appPostfix}/${e.ID}`,e)}deleteOffer(e){return this.http.delete(`${this.baseUrl}${this.stage}${this.domain}${this.appPostfix}/${e}`)}disableBrowserCache(){return new de().set("pragma","no-cache").set("cache-control","no-cache")}static{this.\u0275fac=function(i){return new(i||t)(B(ue))}}static{this.\u0275prov=R({token:t,factory:t.\u0275fac})}}return t})();var v=(()=>{class t{constructor(e){this.APOService=e}getAllOffers(){return this.APOService.getAllOffers()}getOfferContent(e){return this.APOService.getOfferContent(e)}createOffer(e){return this.APOService.createOffer(e)}updateOffer(e){return this.APOService.updateOffer(e)}deleteOffer(e){return this.APOService.deleteOffer(e)}static{this.\u0275fac=function(i){return new(i||t)(B(V))}}static{this.\u0275prov=R({token:t,factory:t.\u0275fac})}}return t})();function We(t,f){if(t&1){let e=x();o(0,"div",11)(1,"div"),c(2,"fa-icon",12),o(3,"input",13,1),C("input",function(n){g(e),s();let m=re(1);return O(m.filterGlobal(n.target==null||n.target.value==null?null:n.target.value.trim(),"contains"))}),l()(),o(5,"div",14)(6,"button",15),C("click",function(){g(e);let n=s();return O(n.showCreateOffer())}),c(7,"fa-icon",12),o(8,"span"),A(9,2),l()()()()}if(t&2){let e=s();r(2),a("icon",e.faSearch),r(5),a("icon",e.faPlus)}}function qe(t,f){if(t&1&&c(0,"col"),t&2){let e=f.$implicit;ne("width",e.width)}}function Qe(t,f){if(t&1&&(o(0,"colgroup"),_(1,qe,1,2,"col",16),l()),t&2){let e=f.$implicit;r(),a("ngForOf",e)}}function Je(t,f){if(t&1&&(u(0),d(1),h()),t&2){let e=s().$implicit;r(),T(" ",e.header," ")}}function Ke(t,f){if(t&1&&(u(0),d(1),h()),t&2){let e=s().$implicit;r(),T(" ",e.header," ")}}function Ye(t,f){if(t&1&&(u(0),d(1),c(2,"p-sortIcon",22),h()),t&2){let e=s().$implicit;r(),T(" ",e.header," "),r(),a("field",e.field)}}function Ze(t,f){if(t&1&&(o(0,"th",18),u(1,19),_(2,Je,2,1,"ng-container",20)(3,Ke,2,1,"ng-container",20)(4,Ye,3,2,"ng-container",21),h(),l()),t&2){let e=f.$implicit;a("pSortableColumn",e.field)("pSortableColumnDisabled",e.field==="Edit"||e.field==="Delete"),r(),a("ngSwitch",e.field),r(),a("ngSwitchCase","Edit"),r(),a("ngSwitchCase","Delete")}}function et(t,f){if(t&1&&(o(0,"tr"),_(1,Ze,5,5,"th",17),l()),t&2){let e=f.$implicit;r(),a("ngForOf",e)}}function tt(t,f){t&1&&(o(0,"span",26),c(1,"i",27),l())}function it(t,f){if(t&1&&(u(0),_(1,tt,2,0,"span",25),h()),t&2){let e=s(2).$implicit;r(),a("ngIf",e.Promoted)}}function nt(t,f){if(t&1&&(u(0),d(1),D(2,"date"),h()),t&2){let e=s(2).$implicit;r(),T(" ",K(2,1,e.FromDate,"dd-MM-yyyy")," ")}}function rt(t,f){if(t&1&&(u(0),d(1),D(2,"date"),h()),t&2){let e=s(2).$implicit;r(),T(" ",K(2,1,e.ThruDate,"dd-MM-yyyy")," ")}}function ot(t,f){if(t&1&&(u(0),o(1,"span",28),c(2,"i",29),l(),h()),t&2){let e=s(2).$implicit;r(),a("title","This offer is "+e.Status),r(),a("ngClass",e.Status)}}function at(t,f){if(t&1){let e=x();u(0),o(1,"button",30),C("click",function(){g(e);let n=s(2).$implicit,m=s();return O(m.showUpdateOffer(n))}),c(2,"i",31),o(3,"span"),A(4,3),l()(),h()}}function lt(t,f){if(t&1){let e=x();u(0),o(1,"button",32),C("click",function(){g(e);let n=s(2).$implicit,m=s();return O(m.deleteOffer(n))}),c(2,"i",33),o(3,"span"),A(4,4),l()(),h()}}function ft(t,f){if(t&1&&(u(0),d(1),h()),t&2){let e=s().$implicit,i=s().$implicit;r(),T(" ",i[e.field]," ")}}function st(t,f){if(t&1&&(o(0,"td",24),u(1,19),_(2,it,2,1,"ng-container",20)(3,nt,3,4,"ng-container",20)(4,rt,3,4,"ng-container",20)(5,ot,3,2,"ng-container",20)(6,at,5,0,"ng-container",20)(7,lt,5,0,"ng-container",20)(8,ft,2,1,"ng-container",21),h(),l()),t&2){let e=f.$implicit;r(),a("ngSwitch",e.field),r(),a("ngSwitchCase","Promoted"),r(),a("ngSwitchCase","FromDate"),r(),a("ngSwitchCase","ThruDate"),r(),a("ngSwitchCase","Status"),r(),a("ngSwitchCase","Edit"),r(),a("ngSwitchCase","Delete")}}function mt(t,f){if(t&1&&(o(0,"tr"),_(1,st,9,7,"td",23),l()),t&2){let e=f.columns;r(),a("ngForOf",e)}}function pt(t,f){if(t&1&&(o(0,"tr")(1,"td"),d(2),l()()),t&2){let e=f.$implicit,i=s();r(),ie("colspan",e.length),r(),T(" ",i.loading?i.loadingText:i.nothingFound," ")}}var j=(()=>{class t{constructor(e){this.facade=e,this.newOfferModal=new N,this.updateOfferModal=new N,this.showOfferForm=!1,this.faPlus=Oe,this.faSearch=ge,this.nothingFound=S.NOTHING_FOUND,this.loadingText=S.LOADING,this.offersColumns=[{field:"Name",header:$localize`Name`},{field:"Promoted",header:$localize`Promoted`,width:"110px"},{field:"Type",header:$localize`Type`,width:"80px"},{field:"FromDate",header:$localize`From Date`,width:"110px"},{field:"ThruDate",header:$localize`Thru Date`,width:"110px"},{field:"Status",header:$localize`Status`,width:"80px"},{field:"Edit",header:$localize`Edit`,width:"60px"},{field:"Delete",header:$localize`Delete`,width:"80px"}]}ngOnChanges(){let e=Date.now();this.copiedOffers=this.offers.map(i=>{let n=this.getOfferStatus(i,e);return te(ee({},i),{Status:n})})}showCreateOffer(){this.newOfferModal.emit(!0)}showUpdateOffer(e){this.updateOfferModal.emit(e)}deleteOffer(e){window.confirm($localize`Are you sure want to delete this offer?`)&&this.facade.deleteOffer(e.ID).subscribe(n=>{this.copiedOffers=this.copiedOffers.filter(m=>m.ID!==e.ID)})}getOfferStatus(e,i){return i>e.FromDate&&(!e.ThruDate||i<e.ThruDate)?"available":i<e.FromDate||!e.ThruDate?"in future":i>e.ThruDate?"expired":""}static{this.\u0275fac=function(i){return new(i||t)(E(v))}}static{this.\u0275cmp=b({type:t,selectors:[["alfah-offers-table"]],inputs:{loading:"loading",offers:"offers"},outputs:{newOfferModal:"newOfferModal",updateOfferModal:"updateOfferModal"}
1,standalone:!0,features:[k,w],decls:7,vars:3,consts:()=>{let e;e=$localize`Filter`;let i;i=$localize`New Offer`;let n;n=$localize`Edit`;let m;return m=$localize`Delete`,[["offersTable",""],["filter",""],i,n,m,["sortField","Type",3,"columns","value","loading"],["pTemplate","caption"],["pTemplate","colgroup"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[2,"display","flex","text-align","left"],[2,"margin","4px 4px 0 0",3,"icon"],["type","text","pInputText","","size","30","placeholder",e,3,"input"],[2,"margin-left","20px"],[1,"btn","btn-sm","btn-alfah",3,"click"],[3,"width",4,"ngFor","ngForOf"],[3,"pSortableColumn","pSortableColumnDisabled",4,"ngFor","ngForOf"],[3,"pSortableColumn","pSortableColumnDisabled"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["ariaLabel","Activate to sort","ariaLabelDesc","Activate to sort in descending order","ariaLabelAsc","Activate to sort in ascending order",3,"field"],["class","ui-resizable-column",4,"ngFor","ngForOf"],[1,"ui-resizable-column"],["class","center",4,"ngIf"],[1,"center"],[1,"pi","pi-check"],[1,"center",3,"title"],[1,"pi","pi-circle-on",3,"ngClass"],[1,"btn","btn-exsm","btn-alfah",3,"click"],[1,"pi","pi-pencil"],[1,"btn","btn-exsm","btn-danger",3,"click"],[1,"pi","pi-times"]]},template:function(i,n){i&1&&(o(0,"p-table",5,0),_(2,We,10,2,"ng-template",6)(3,Qe,2,1,"ng-template",7)(4,et,2,1,"ng-template",8)(5,mt,2,1,"ng-template",9)(6,pt,3,2,"ng-template",10),l()),i&2&&a("columns",n.offersColumns)("value",n.copiedOffers)("loading",n.loading)},dependencies:[ze,Re,he,Le,Be,Ce,H,le,fe,se,me,U,ae,pe],styles:[".expired[_ngcontent-%COMP%]{color:var(--alfah-main-red, darkred)}.available[_ngcontent-%COMP%]{color:#006400}.future[_ngcontent-%COMP%]{color:var(--alfah-main-blue, darkblue)}"]})}}return t})();var ct=()=>({height:"620px"}),dt=()=>({width:"80px",height:"80px"});function _t(t,f){if(t&1&&(o(0,"span",19),d(1),l()),t&2){let e=s();r(),F(e.required)}}function ut(t,f){if(t&1&&(o(0,"span",19),d(1),l()),t&2){let e=s();r(),F(e.required)}}function ht(t,f){if(t&1&&(o(0,"span",19),d(1),l()),t&2){let e=s();r(),F(e.required)}}function gt(t,f){if(t&1){let e=x();o(0,"div",20)(1,"button",21),C("click",function(){g(e);let n=s();return O(n.createOffer(n.offerForm.value))})("mouseenter",function(){g(e);let n=s();return O(n.mouseoverSubmit=!0)})("mouseleave",function(){g(e);let n=s();return O(n.mouseoverSubmit=!1)}),o(2,"span",22),d(3),l()()()}if(t&2){let e=s();
1r(),a("disabled",e.offerForm.invalid),r(2),F(e.createOfferText)}}function Ot(t,f){if(t&1){let e=x();o(0,"div",20)(1,"button",21),C("click",function(){g(e);let n=s();return O(n.updateOffer(n.offerForm.value))})("mouseenter",function(){g(e);let n=s();return O(n.mouseoverSubmit=!0)})("mouseleave",function(){g(e);let n=s();return O(n.mouseoverSubmit=!1)}),o(2,"span",22),d(3),l()()()}if(t&2){let e=s();r(),a("disabled",e.offerForm.invalid),r(2),F(e.updateOfferText)}}var X=(()=>{class t{get dateControl(){return this.offerForm.get("Date")}get nameControl(){return this.offerForm.get("Name")}get typeControl(){return this.offerForm.get("Type")}get contentControl(){return this.offerForm.get("Content")}constructor(e,i){this.fb=e,this.facade=i,this.showForm=new N,this.de=Ge,this.mouseoverSubmit=!1,this.offerUploading=!1,this.types=[{label:$localize`Fahrzeuge`,value:"Car"},{label:$localize`Angebote`,value:"Offer"},{label:$localize`Dienstleistungen`,value:"Service"},{label:$localize`Sonstige`,value:"Other"}],this.required=S.REQUIRED,this.createOfferText=$localize`Create offer`,this.updateOfferText=$localize`Update offer`,this.pleaseWait=S.PLEASE_WAIT}ngOnInit(){this.offerForm=this.fb.group({Name:[null,G.required],Type:[null,G.required],Date:[null,G.required],Promoted:[!1],HTML:[""]})}ngOnChanges(){if(this.offer){let e=this.getOfferDate(this.offer);this.offerForm.patchValue({Name:this.offer.Name,Type:this.offer.Type,Promoted:this.offer.Promoted,Date:e}),this.facade.getOfferContent(this.offer.ContentURL).subscribe(i=>{this.offerForm.patchValue({HTML:i})})}}createOffer(e){this.offerUploading=!0;let i={Name:e.Name,Type:e.Type,Promoted:e.Promoted,FromDate:new Date(e.Date[0]).getTime(),ThruDate:e.Date[1]?new Date(e.Date[1]).getTime():null,ImageBase64:this.extractFirstImage(e.HTML),HTML:e.HTML};this.facade.createOffer(i).pipe(I(()=>this.offerUploading=!1)).subscribe(()=>{this.showForm.emit(!1),this.offerForm.reset()})}updateOffer(e){this.offerUploading=!0;let i={ID:this.offer.ID,Name:e.Name,Type:e.Type,Promoted:e.Promoted,FromDate:new Date(e.Date[0]).getTime(),ThruDate:e.Date[1]?new Date(e.Date[1]).getTime():null,ImageBase64:this.extractFirstImage(e.HTML),ContentURL:this.offer.ContentURL,HTML:e.HTML};this.facade.updateOffer(i).pipe(I(()=>this.offerUploading=!1)).subscribe(()=>{this.showForm.emit(!1)})}extractFirstImage(e){let i=e.indexOf('<img src="'),n=i>0?e.indexOf('"',i+10):null,m="";return i>0&&n&&(m=e.slice(i+10,n)),m}getOfferDate(e){let i=[];return i.push(new Date(this.offer.FromDate)),e.ThruDate&&i.push(new Date(this.offer.ThruDate)),i}static{this.\u0275fac=function(i){return new(i||t)(E(Me),E(v))}}static{this.\u0275cmp=b({type:t,selectors:[["alfah-offer-form"]],inputs:{offer:"offer"},outputs:{showForm:"showForm"},standalone:!0,features:[k,w],decls:32,vars:25,consts:()=>{let e;e=$localize`Name`;let i;i=$localize`Type`;let n;return n=$localize`Promoted:`,[n,["novalidate","",3,"formGroup"],[2,"display","flex","flex-wrap","wrap","margin-bottom","20px","align-items","center"],[2,"height","20px"],["class","error-message",4,"ngIf"],["dateFormat","dd.mm.yy","selectionMode","range","formControlName","Date",3,"showButtonBar","numberOfMonths","showIcon","locale"],[2,"margin","0 20px"],["id","input","type","text","size","30","placeholder",e,"pInputText","","formControlName","Name"],[2,"margin-right","20px"],["placeholder",i,"formControlName","Type",3,"options","showClear"],[2,"margin-right","10px"],[3,"binary","formControl"],["formControlName","HTML"],["class","center","style","margin-top: 10px;",4,"ngIf"],[3,"blocked"],[2,"margin-top","50vh"],["strokeWidth","6","animationDuration","1s",1,"center"],[1,"center"],[2,"color","whitesmoke","font-size","20px","font-weight","900"],[1,"error-message"],[1,"center",2,"margin-top","10px"],["pButton","","type","button",3,"click","mouseenter","mouseleave","disabled"],["pButtonLabel",""]]},template:function(i,n){i&1&&(o(0,"form",1)(1,"div",2)(2,"div")(3,"div",3),_(4,_t,2,1,"span",4),l(),c(5,"p-datepicker",5),l(),o(6,"div",6)(7,"div",3),_(8,ut,2,1,"span",4),l(),c(9,"input",7),l(),o(10,"div",8)(11,"div",3),_(12,ht,2,1,"span",4),l(),o(13,"div"),c(14,"p-select",9),l()(),o(15,"div"),c(16,"div",3),o(17,"div")(18,"label",10),A(19,0),l(),c(20,"p-checkbox",11),D(21,"formControl"),l()()(),o(22,"div"),c(23,"p-editor",12),l(),_(24,gt,4,2,"div",13)(25,Ot,4,2,"div",13),l(),o(26,"p-blockUI",14)(27,"div",15),c(28,"p-progress-spinner",16),o(29,"div",17)(30,"p",18),d(31),l()()()()),i&2&&(a("formGroup",n.offerForm),r(4),a("ngIf",n.dateControl.invalid&&n.mouseoverSubmit),r(),a("showButtonBar",!0)("numberOfMonths",3)("showIcon",!0)("locale",n.de)("showButtonBar",!0),r(3),a("ngIf",n.nameControl.invalid&&n.mouseoverSubmit),r(4),a("ngIf",n.typeControl.invalid&&n.mouseoverSubmit),r(2),a("options",n.types)("showClear",!0),r(6),a("binary",!0)("formControl",oe(21,21,n.offerForm.controls.Promoted)),r(3),M(P(23,ct)),r(),a("ngIf",!n.offer),r(),a("ngIf",n.offer),r(),a("blocked",n.offerUploading),r(2),M(P(24,dt)),r(3),T(" ",n.pleaseWait," "))},dependencies:[Ae,ve,Te,Fe,Se,we,Ee,xe,be,U,$e,H,Ie,Pe,Ue,ke,ye,De],styles:["[_nghost-%COMP%] .ui-calendar .ui-datepicker{min-width:990px}.error-message[_ngcontent-%COMP%]{color:var(--alfah-main-red, darkred)}"]})}}return t})();var Ve=()=>({width:"60%"}),W=(()=>{class t{constructor(e){this.facade=e,this.offers=[],this.allOffers=S.ALL_OFFERS,this.createOffer=$localize`Create Offer`,this.editOffer=$localize`Edit Offer`,this.loading=!0,this.showCreateOffer=!1,this.showEditOffer=!1}ngOnInit(){this.facade.getAllOffers().pipe(I(()=>this.loading=!1)).subscribe(e=>this.offers=e)}showOfferMofalHandler(e){this.showCreateOffer=e}closeOfferModalHandler(e){this.showCreateOffer=!1,this.showEditOffer=!1,this.facade.getAllOffers().subscribe(i=>this.offers=i)}updateOfferModalHandler(e){this.showEditOffer=!0,this.offerForUpdate=e}static{this.\u0275fac=function(i){return new(i||t)(E(v))}}static{this.\u0275cmp=b({type:t,selectors:[["alfah-apo-admin-container"]],standalone:!0,features:[w],decls:9,vars:15,consts:[[1,"container"],[3,"newOfferModal","updateOfferModal","loading","offers"],[3,"visibleChange","visible","header"],[3,"showForm","offer"]],template:function(i,n){i&1&&(o(0,"div",0)(1,"div")(2,"h2"),d(3),l()(),o(4,"alfah-offers-table",1),C("newOfferModal",function(p){return n.showOfferMofalHandler(p)})("updateOfferModal",function(p){return n.updateOfferModalHandler(p)}),l()(),o(5,"p-dialog",2),J("visibleChange",function(p){return Q(n.showCreateOffer,p)||(n.showCreateOffer=p),p}),o(6,"alfah-offer-form",3),C("showForm",function(p){return n.closeOfferModalHandler(p)}),l()(),o(7,"p-dialog",2),J("visibleChange",function(p){return Q(n.showEditOffer,p)||(n.showEditOffer=p),p}),o(8,"alfah-offer-form",3),C("showForm",function(p){return n.closeOfferModalHandler(p)}),l()()),i&2&&(r(3),F(n.allOffers),r(),a("loading",n.loading)("offers",n.offers),r(),M(P(13,Ve)),q("visible",n.showCreateOffer),a("header",n.createOffer),r(),a("offer",null),r(),M(P(14,Ve)),q("visible",n.showEditOffer),a("header",n.editOffer),r(),a("offer",n.offerForUpdate))},dependencies:[j,Ne,X]})}}return t})();
1var Ct=[{path:"",component:W}],je=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=z({type:t})}static{this.\u0275inj=L({imports:[Y.forChild(Ct),Y]})}}return t})();var Ci=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=z({type:t})}static{this.\u0275inj=L({providers:[V,v],imports:[ce,He,je,W,j,X]})}}return t})();export{Ci as APOAdminModule};
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.