1"use strict";(self.webpackChunkaudio_go=self.webpackChunkaudio_go||[]).push([["apps_audio-go_src_app_modules_coupons_coupons_module_ts"],{64286:(no,I,s)=>{s.r(I),s.d(I,{CouponsModule:()=>to});var c=s(7624),g=s(36549),u=s(26836),e=s(97783),U=s(86702),A=s(28812);let m=(()=>{class t{constructor(){this._appConfigService=(0,e.WQX)(A.RK),this._httpClient=(0,e.WQX)(U.Qq),this.API_URL=`${this._appConfigService.apiUrl}`,this.LIGHT_URL=`${this.API_URL}/light`,this.ADVERTISERS_URL=`${this.LIGHT_URL}/advertisers`,this.COUPON_URL=`${this.ADVERTISERS_URL}/coupons`}getCouponById(o){return this._httpClient.get(`${this.COUPON_URL}/${o}`)}createCoupon(o){return this._httpClient.post(this.COUPON_URL,o)}updateCoupon(o,a){return this._httpClient.put(`${this.COUPON_URL}/${a}`,o)}getCouponCurrencyList(){return this._httpClient.get(`${this.COUPON_URL}/currencies`)}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275prov=e.jDH({token:t,factory:t.\u0275fac})}}return t})();var i=s(10351);let x=(()=>{class t{constructor(){this._formBuilder=(0,e.WQX)(i.ok)}buildCouponCreateForm(){return this._formBuilder.group({code:["",[i.k0.required]],currency:this._formBuilder.control(null,[i.k0.required]),description:["",[i.k0.required,i.k0.maxLength(200)]],activationDate:["",[i.k0.required]],expirationDate:["",[i.k0.required]],advertiser:this._formBuilder.control(null),usages:this._formBuilder.control(null,[i.k0.required,i.k0.max(999),i.k0.min(-1)]),value:this._formBuilder.control(null,[i.k0.required,i.k0.max(5e4)])})}buildCouponUpdateForm(o){return this._formBuilder.group({code:[o.code,[i.k0.required]],currency:[{value:o.currency,disabled:!0},i.k0.required],description:[o.description,[i.k0.required,i.k0.maxLength(200)]],activationDate:[o.activationDate,[i.k0.required]],expirationDate:[o.expirationDate,[i.k0.required]],advertiser:[{value:o.advertiser?o.advertiser:null,disabled:!0}],usages:[{value:o.usages,disabled:!0},[i.k0.required,i.k0.max(999),i.k0.min(-1)]],value:[o.value,[i.k0.required,i.k0.max(5e4)]]})}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275prov=e.jDH({token:t,factory:t.\u0275fac})}}return t})(),j=(()=>{class t{constructor(){this._couponService=(0,e.WQX)(m)}resolve(){return this._couponService.getCouponCurrencyList()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275prov=e.jDH({token:t,factory:t.\u0275fac})}}return t})(),P=(()=>{class t{constructor(){this._couponService=(0,e.WQX)(m)}resolve({params:o}){return this._couponService.getCouponById(o.id)}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275prov=e.jDH({token:t,factory:t.\u0275fac})}}return t})(),W=(()=>{class t{static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275mod=e.$C({type:t})}static{this.\u0275inj=e.G2t({providers:[m,x,c.Duw,j],imports:[u.MD,c.cC3,g.xh]})}}return t})();var Q=s(60646),f=s(5482),M=s(33416),l=s(141),h=s(5837),N=s(25446),G=s(68357),_=s(33197),$=s(79390),L=s(84521),S=s(35778),O=s(70564);function z(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function V(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,z,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.code.errors?null:o.couponFormGroup.controls.code.errors.required)}}function B(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function q(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,B,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.currency.errors?null:o.couponFormGroup.controls.currency.errors.required)}}function J(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function H(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max length 200 characters."),e.k0s())}function K(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,J,2,0,"span",30)(2,H,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.description.errors?null:o.couponFormGroup.controls.description.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.description.errors?null:o.couponFormGroup.controls.description.errors.maxlength)}}function Z(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function ee(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max 999 usages."),e.k0s())}function oe(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,Z,2,0,"span",30)(2,ee,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.usages.errors?null:o.couponFormGroup.controls.usages.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.usages.errors?null:o.couponFormGroup.controls.usages.errors.max)}}function te(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function ne(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max value 50000."),e.k0s())}function re(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,te,2,0,"span",30)(2,ne,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.value.errors?null:o.couponFormGroup.controls.value.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.value.errors?null:o.couponFormGroup.controls.value.errors.max)}}function ae(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function ie(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,ae,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.activationDate.errors?null:o.couponFormGroup.controls.activationDate.errors.required)}}function se(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function ce(t,n){if(1&t&&(e.j41(0,"div",29),e.DNE(1,se,2,0,"span",30),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.expirationDate.errors?null:o.couponFormGroup.controls.expirationDate.errors.required)}}let pe=(()=>{class t{constructor(){this._store=(0,e.WQX)(M.il),this._ngRxStore=(0,e.WQX)(G.il),this._couponUtilsService=(0,e.WQX)(x),this._couponService=(0,e.WQX)(m),this._toastrService=(0,e.WQX)(N.tw),this._metadata=(0,e.WQX)(c.pMU),this._awDrawerRef=(0,e.WQX)(c.Fcj),this._awConfirmOnExitService=(0,e.WQX)(c.rr0),this.timezone=this._ngRxStore.selectSignal(_.XZ)(),this.dayJs=l,this.isLoading=!1,this.couponFormGroup=this._couponUtilsService.buildCouponCreateForm(),this.expirationDateMin=l(),this.currencyList=this._metadata.currencyList}createCoupon(){if(this.isLoading=!0,this.couponFormGroup.invalid)return void this.couponFormGroup.markAllAsTouched();const{advertiser:o,usages:a,value:r,...p}=this.couponFormGroup.getRawValue(),d={...p,advertiserId:o?.id?o.id:void 0,usages:a??0,value:r??0};this._couponService.createCoupon(d).subscribe(()=>{this.isLoading=!1,this._toastrService.success("Coupon created","Created"),this._awConfirmOnExitService.confirmOnExit=!1,this._awDrawerRef.close(d)})}transformAdvertiserList(){return c.UaP}activationDateChanged(o){this.couponFormGroup.patchValue({activationDate:o}),this.expirationDateMin=l(o)}expirationDateChanged(o){this.couponFormGroup.patchValue({expirationDate:o})}hasErrors(o){return o.invalid&&(o.dirty||o.touched)}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=e.VBU({type:t,selectors:[["feat-coupon-create-modal"]],decls:69,vars:17,consts:[["awDrawerClose","",1,"aw-sliding-modal-dismiss-button"],[1,"fa","fa-fw","fa-long-arrow-left"],[1,"aw-modal-header"],[1,"aw-modal-header-title"],[1,"aw-modal-body"],["awConfirmOnExit","",1,"aw-form","marginTop20px",3,"formGroup"],["property","code",1,"marginTop20px"],[1,"required"],["formControlName","code","placeholder","Type the code of the coupon","required","",1,"form-control"],["class","form-error-message",4,"ngIf"],["property","currency",1,"marginTop20px"],["formControlName","currency","placeholder","Select currency","bindLabel","currency","bindValue","currency",1,"ago-custom-ng-select",3,"items","closeOnSelect","clearable"],["property","description",1,"marginTop20px"],["formControlName","description","placeholder","Type the description of the coupon","required","",1,"form-control"],["property","usages",1,"marginTop20px"],["formControlName","usages","placeholder","Type the max usage of the coupon","required","",1,"form-control"],["property","value",1,"marginTop20px"],["formControlName","value","placeholder","Type the value of the coupon","required","",1,"form-control"],["property","advertiser",1,"marginTop20px"],["placeholder","Search for an Advert
1iser","bindLabel","label",3,"control","transformAdvertiserList","clearable"],[1,"aw-form-row"],[1,"aw-form-col","half-row"],["property","activationDate",1,"marginTop20px"],["placeholder","Activation date",3,"dateRangeChanged","selectedDate"],["property","expirationDate",1,"marginTop20px"],["placeholder","Expiration date",3,"dateRangeChanged","minDate","selectedDate"],[1,"aw-form-actions","form-actions-flex-column","marginTop40px"],[1,"primary-button",3,"click"],["awDrawerClose","","tabindex","-1",1,"cancel","marginTop20px"],[1,"form-error-message"],[4,"ngIf"]],template:function(a,r){1&a&&(e.j41(0,"div",0),e.nrm(1,"i",1),e.EFF(2," Back\n"),e.k0s(),e.j41(3,"div",2)(4,"div",3),e.EFF(5," Create coupon "),e.k0s()(),e.j41(6,"div",4)(7,"form",5)(8,"aw-form-element",6)(9,"label"),e.EFF(10," Code "),e.j41(11,"span",7),e.EFF(12,"*"),e.k0s()(),e.nrm(13,"input",8),e.DNE(14,V,2,1,"div",9),e.k0s(),e.j41(15,"aw-form-element",10)(16,"label"),e.EFF(17," Currency "),e.j41(18,"span",7),e.EFF(19,"*"),e.k0s()(),e.nrm(20,"ng-select",11),e.DNE(21,q,2,1,"div",9),e.k0s(),e.j41(22,"aw-form-element",12)(23,"label"),e.EFF(24," Description "),e.j41(25,"span",7),e.EFF(26,"*"),e.k0s()(),e.nrm(27,"input",13),e.DNE(28,K,3,2,"div",9),e.k0s(),e.j41(29,"aw-form-element",14)(30,"label"),e.EFF(31," Max Usage "),e.j41(32,"span",7),e.EFF(33,"*"),e.k0s()(),e.nrm(34,"input",15),e.DNE(35,oe,3,2,"div",9),e.k0s(),e.j41(36,"aw-form-element",16)(37,"label"),e.EFF(38," Value "),e.j41(39,"span",7),e.EFF(40,"*"),e.k0s()(),e.nrm(41,"input",17),e.DNE(42,re,3,2,"div",9),e.k0s(),e.j41(43,"aw-form-element",18)(44,"label"),e.EFF(45," For which advertiser "),e.k0s(),e.nrm(46,"aw-advertiser-select",19),e.k0s(),e.j41(47,"div",20)(48,"div",21)(49,"aw-form-element",22)(50,"label"),e.EFF(51," Activation Date "),e.j41(52,"span",7),e.EFF(53,"*"),e.k0s()(),e.j41(54,"aw-sc-date-picker",23),e.bIt("dateRangeChanged",function(d){return r.activationDateChanged(d)}),e.k0s(),e.DNE(55,ie,2,1,"div",9),e.k0s()(),e.j41(56,"div",21)(57,"aw-form-element",24)(58,"label"),e.EFF(59," Expiration date "),e.j41(60,"span",7),e.EFF(61,"*"),e.k0s()(),e.j41(62,"aw-sc-date-picker",25),e.bIt("dateRangeChanged",function(d){return r.expirationDateChanged(d)}),e.k0s(),e.DNE(63,ce,2,1,"div",9),e.k0s()()()(),e.j41(64,"div",26)(65,"button",27),e.bIt("click",function(){return r.createCoupon()}),e.EFF(66," Save "),e.k0s(),e.j41(67,"a",28),e.EFF(68," Cancel "),e.k0s()()()),2&a&&(e.R7$(7),e.Y8G("formGroup",r.couponFormGroup),e.R7$(7),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.code)),e.R7$(6),e.Y8G("items",r.currencyList)("closeOnSelect",!0)("clearable",!1),e.R7$(),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.currency)),e.R7$(7),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.description)),e.R7$(7),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.usages)),e.R7$(7),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.value)),e.R7$(4),e.Y8G("control",r.couponFormGroup.controls.advertiser)("transformAdvertiserList",r.transformAdvertiserList())("clearable",!0),e.R7$(8),e.Y8G("selectedDate",r.couponFormGroup.controls.activationDate.value?r.dayJs(r.couponFormGroup.controls.activationDate.value):void 0),e.R7$(),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.activationDate)),e.R7$(7),e.Y8G("minDate",r.expirationDateMin)("selectedDate",r.couponFormGroup.controls.expirationDate.value?r.dayJs(r.couponFormGroup.controls.expirationDate.value):void 0),e.R7$(),e.Y8G("ngIf",r.hasErrors(r.couponFormGroup.controls.expirationDate)))},dependencies:[i.X1,i.qT,i.me,i.BC,i.cb,i.YS,i.j4,i.JD,c.cC3,$.M,L.x,S.T,O.$,g.xh,u.MD,u.bT,h.MQ,h.vr,c.cNZ],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer!important}[_nghost-%COMP%] .ago-advertiser-ng-select.ng-select{max-width:100%}[_nghost-%COMP%] .form-error-message[_ngcontent-%COMP%]{color:#ef4836;margin-top:5px;animation:_ngcontent-%COMP%_fade-in .5s ease-in}@keyframes _ngcontent-%COMP%_fade-in{0%{opacity:0}to{opacity:1}}"]})}}return t})();var C=s(39252);function ue(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function le(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,ue,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.code.errors?null:o.couponFormGroup.controls.code.errors.required)}}function de(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function me(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,de,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.currency.errors?null:o.couponFormGroup.controls.currency.errors.required)}}function fe(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function he(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max length 200 characters."),e.k0s())}function ge(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,fe,2,0,"span",31)(2,he,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.description.errors?null:o.couponFormGroup.controls.description.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.description.errors?null:o.couponFormGroup.controls.description.errors.maxlength)}}function _e(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function Ce(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max 999 usages."),e.k0s())}function ve(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,_e,2,0,"span",31)(2,Ce,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.usages.errors?null:o.couponFormGroup.controls.usages.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.usages.errors?null:o.couponFormGroup.controls.usages.errors.max)}}function Fe(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function xe(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"Max value 50000."),e.k0s())}function Ge(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,Fe,2,0,"span",31)(2,xe,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.value.errors?null:o.couponFormGroup.controls.value.errors.required),e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.value.errors?null:o.couponFormGroup.controls.value.errors.max)}}function Ee(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function De(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,Ee,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.activationDate.errors?null:o.couponFormGroup.controls.activationDate.errors.required)}}function ye(t,n){1&t&&(e.j41(0,"span"),e.EFF(1,"The field is required."),e.k0s())}function Te(t,n){if(1&t&&(e.j41(0,"div",30),e.DNE(1,ye,2,0,"span",31),e.k0s()),2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",null==o.couponFormGroup.controls.expirationDate.errors?null:o.couponFormGroup.controls.expirationDate.errors.required)}}function ke(t,n){if(1&t){const o=e.RV6();e.j41(0,"div",5)(1,"form",6)(2,"aw-form-element",7)(3,"label"),e.EFF(4," Code "),e.j41(5,"span",8),e.EFF(6,"*"),e.k0s()(),e.nrm(7,"input",9),e.DNE(8,le,2,1,"div",10),e.k0s(),e.j41(9,"aw-form-element",11)(10,"label"),e.EFF(11," Currency "),e.j41(12,"span",8),e.EFF(13,"*"),e.k0s()(),e.nrm(14,"ng-select",12),e.DNE(15,me,2,1,"div",10),e.k0s(),e.j41(16,"aw-form-element",13)(17,"label"),e.EFF(18," Description "),e.j41(19,"span",8),e.EFF(20,"*"),e.k0s()(),e.nrm(21,"input",14),e.DNE(22,ge,3,2,"div",10),e.k0s(),e.j41(23,"aw-form-element",15)(24,"label"),e.EFF(25," Max Usage "),e.j41(26,"span",8),e.EFF(27,"*"),e.k0s()(),e.nrm(28,"input",16),e.DNE(29,ve,3,2,"div",10),e.k0s(),e.j41(30,"aw-form-element",17)(31,"label"),e.EFF(32," Value "),e.j41(33,"span",8),e.EFF(34,"*"),e.k0s()(),e.nrm(35,"input",18),e.DNE(36,Ge,3,2,"div",10),e.k0s(),e.j41(37,"aw-form-element",19)(38,"label"),e.EFF(39," For which advertiser "),e.k0s(),e.nrm(40,"aw-advertiser-select",20),e.k0s(),e.j41(41,"div",21)(42,"div",22)(43,"aw-form-element",23)(44,"label"),e.EFF(45," Activation Date "),e.j41(46,"span",8),e.EFF(47,"*"),e.k0s()(),e.j41(48,"aw-sc-date-picker",24),e.bIt("dateRangeChanged",function(r){e.eBV(o);const p=e.XpG();return e.Njj(p.activationDateChanged(r))}),e.k0s(),e.DNE(49,De,2,1,"div",10),e.k0s()(),e.j41(50,"div",22)(51,"aw-form-element",25)(52,"label"),e.EFF(53," Expiration date "),e.j41(54,"span",8),e.EFF(55,"*"),e.k0s()(),e.j41(56,"aw-sc-date-picker",26),e.bIt("dateRangeChanged",function(r){e.eBV(o);const p=e.XpG();return e.Njj(p.expirationDateChanged(r))}),e.k0s(),e.DNE(57,Te,2,1,"div",10),e.k0s()()()(),e.j41(58,"div",27)(59,"button",28),e.bIt("click",function(){e.eBV(o);const r=e.XpG();return e.Njj(r.editCoupon())}),e.EFF(60," Save "),e.k0s(),e.j41(61,"a",29),e.EFF(62," Cancel "),e.k0s()()()}if(2&t){const o=e.XpG();e.R7$(),e.Y8G("formGroup",o.couponFormGroup),e.R7$(7),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.code)),e.R7$(6),e.Y8G("items",o.currencyList)("closeOnSelect",!0)("clearable",!1),e.R7$(),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.currency)),e.R7$(7),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.description)),e.R7$(7),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.usages)),e.R7$(7),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.value)),e.R7$(4),e.Y8G("control",o.couponFormGroup.controls.advertiser)("transformAdvertiserList",o.transformAdvertiserList())("clearable",!0),e.R7$(8),e.Y8G("selectedDate",o.dayJs(o.couponFormGroup.controls.activationDate.value)),e.R7$(),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.activationDate)),e.R7$(7),e.Y8G("minDate",o.expirationDateMin)("selectedDate",o.dayJs(o.couponFormGroup.controls.expirationDate.value)),e.R7$(),e.Y8G("ngIf",o.hasErrors(o.couponFormGroup.controls.expirationDate))}}let E=class R{constructor(){this._metadata=(0,e.WQX)(c.pMU),this._couponUtilsService=(0,e.WQX)(x),this._couponService=(0,e.WQX)(m),this._toastrService=(0,e.WQX)(N.tw),this._awDrawerRef=(0,e.WQX)(c.Fcj),this._awConfirmOnExitService=(0,e.WQX)(c.rr0),this._cdRef=(0,e.WQX)(e.gRc),this._store=(0,e.WQX)(G.il),this.dayJs=l,this.couponId=this._metadata.id,this.dateFormat$=this._store.select(_.$7),this.isLoading=!1,this.expirationDateMin=l(),this.currencyList=this._metadata.currencyList}ngOnInit(){this.couponFormGroup=this._couponUtilsService.buildCouponUpdateForm(this._metadata.coupon),this._cdRef.detectChanges()}editCoupon(){if(this.isLoading=!0,this.couponFormGroup.invalid)return void this.couponFormGroup.markAllAsTouched();const{advertiser:n,usages:o,value:a,...r}=this.couponFormGroup.getRawValue(),p={...r,advertiserId:n?.id?n.id:void 0,usages:o??0,value:a??0};this._couponService.updateCoupon(p,this.couponId).subscribe(()=>{this.isLoading=!1,this._toastrService.success("Coupon updated","Updated"),this._awConfirmOnExitService.confirmOnExit=!1,this._awDrawerRef.close(p)})}transformAdvertiserList(){return c.UaP}activationDateChanged(n){this.couponFormGroup.patchValue({activationDate:n}),this.expirationDateMin=l(n)}expirationDateChanged(n){this.couponFormGroup.patchValue({expirationDate:n})}hasErrors(n){return n.invalid&&(n.dirty||n.touched)}static{this.\u0275fac=function(o){return new(o||R)}}static{this.\u0275cmp=e.VBU({type:R,selectors:[["feat-coupon-edit-modal"]],decls:7,vars:1,consts:[["awDrawerClose","",1,"aw-sliding-modal-dismiss-button"],[1,"fa","fa-fw","fa-long-arrow-left"],[1,"aw-modal-header"],[1,"aw-modal-header-title"],["class","aw-modal-body",4,"ngIf"],[1,"aw-modal-body"],["awConfirmOnExit","",1,"aw-form","marginTop20px",3,"formGroup"],["property","code",1,"marginTop20px"],[1,"required"],["formControlName","code","placeholder","Type the code of the coupon","required","",1,"form-control"],["class","form-error-message",4,"ngIf"],["property","currency",1,"marginTop20px","currency-dropdown"],["formControlName","currency","placeholder","Select currency","bindLabel","currency","bindValue","currency",1,"ago-custom-ng-select",3,"items","closeOnSelect","clearable"],["property","description",1,"marginTop20px"],["formControlName","description","placeholder","Type the description of the coupon","required","",1,"form-control"],["property","usages",1,"marginTop20px"],["formControlName","usages","placeholder","Type the max usage of the coupon","required","",1,"form-control"],["property","value",1,"marginTop20px"],["formControlName","value","placeholder","Type the value of the coupon","required","",1,"form-control"],["property","advertiser",1,"marginTop20px"],["placeholder","Search for an Advert
1iser","bindLabel","label",3,"control","transformAdvertiserList","clearable"],[1,"aw-form-row"],[1,"aw-form-col","half-row"],["property","activationDate",1,"marginTop20px"],["placeholder","Activation date",3,"dateRangeChanged","selectedDate"],["property","expirationDate",1,"marginTop20px"],["placeholder","Expiration date",3,"dateRangeChanged","minDate","selectedDate"],[1,"aw-form-actions","form-actions-flex-column","marginTop40px"],[1,"primary-button",3,"click"],["awDrawerClose","","tabindex","-1",1,"cancel","marginTop20px"],[1,"form-error-message"],[4,"ngIf"]],template:function(o,a){1&o&&(e.j41(0,"div",0),e.nrm(1,"i",1),e.EFF(2," Back\n"),e.k0s(),e.j41(3,"div",2)(4,"div",3),e.EFF(5," Edit coupon "),e.k0s()(),e.DNE(6,ke,63,17,"div",4)),2&o&&(e.R7$(6),e.Y8G("ngIf",a.couponFormGroup))},dependencies:[i.X1,i.qT,i.me,i.BC,i.cb,i.YS,i.j4,i.JD,c.cC3,$.M,L.x,S.T,O.$,g.xh,u.MD,u.bT,h.MQ,h.vr,c.cNZ],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer!important}[_nghost-%COMP%] .ago-advertiser-ng-select.ng-select{max-width:100%}[_nghost-%COMP%] .form-error-message[_ngcontent-%COMP%]{color:#ef4836;margin-top:5px;animation:_ngcontent-%COMP%_fade-in .5s ease-in}@keyframes _ngcontent-%COMP%_fade-in{0%{opacity:0}to{opacity:1}}"]})}};E=(0,f.Cg)([(0,C.d)()],E);var D=s(36301);class Re{constructor(){this.suppressContextMenu=!0,this.loadingCellRenderer=c.cvY,this.getUrl=()=>"/light/advertisers/coupons",this.defaultPagination=!1,this.colDef=[{headerName:"Id",sortable:!1,sort:"desc",lockPosition:!0,field:"id",flex:1,resizable:!1},{headerName:"Code",sortable:!1,lockPosition:!0,field:"code",flex:1,resizable:!1},{headerName:"Value",sortable:!1,lockPosition:!0,field:"value",flex:1,resizable:!1},{headerName:"Description",sortable:!1,lockPosition:!0,field:"description",flex:1,resizable:!1},{headerName:"Currency",sortable:!1,lockPosition:!0,field:"currency",flex:1,resizable:!1},{headerName:"Activation Date",field:"activationDate",sortable:!1,lockPosition:!0,cellRenderer:"awGridDate",resizable:!1},{headerName:"Expiration Date",field:"expirationDate",sortable:!1,lockPosition:!0,cellRenderer:"awGridDate",resizable:!1},{headerName:"Max Usage",sortable:!1,lockPosition:!0,field:"usages",flex:1,resizable:!1},{headerName:"Current usage",sortable:!1,lockPosition:!0,field:"counter",flex:1,resizable:!1},{headerName:"Advertiser Id",field:"advertiser.id",sortable:!1,lockPosition:!0,resizable:!1},{headerName:" ",field:"dropdownActions",maxWidth:55,sortable:!1,lockPosition:"right",suppressSizeToFit:!0,suppressNavigable:!0,cellRenderer:"awGridCouponDropdown",cellClass:["actions-cell"],resizable:!1}],this.rowHeight=90,this.frameworkComponents={awGridDate:$e,awGridCouponDropdown:T},this.enableCellTextSelection=!0,this.customPageSizeSelect=!0,this.loadingCellRenderer=c.cvY,this.suppressContextMenu=!0,this.pageSize=10,this.overlayNoRowsTemplate="<span></span>"}}var we=s(23872);function be(t,n){if(1&t){const o=e.RV6();e.j41(0,"adswizz-ui-aw-dashboard",1),e.bIt("paginationChanged",function(r){e.eBV(o);const p=e.XpG();return e.Njj(p.changePagination(r))})("modelUpdated",function(){e.eBV(o);const r=e.XpG();return e.Njj(r.onModelUpdated())})("gridReady",function(r){e.eBV(o);const p=e.XpG();return e.Njj(p.onGridReady(r))}),e.k0s()}if(2&t){const o=e.XpG();e.Y8G("dashboardConfig",o.couponListDashboardConfig)("paginationClass","ago-aw-dashboard")("currentPageIndex",o.currentPageIndex)}}let Ie=(()=>{class t{constructor(){this._awDashboardUtilsService=(0,e.WQX)(D.tH),this._dashboardService=(0,e.WQX)(c.BVK),this.currentPageIndex=0}ngOnInit(){this.couponListDashboardConfig=new Re}changePagination(o){this.currentPageIndex=o.api.paginationGetCurrentPage()}onGridReady({api:o}){this._gridApi=o}onModelUpdated(){this.showNoRowsOverlay=!this._gridApi?.getDisplayedRowCount()}refreshAgGrid(){this._gridApi?.refreshServerSide({purge:!0})}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=e.VBU({type:t,selectors:[["feat-coupon-list"]],features:[e.Jv_([{provide:c.BVK,useClass:D.KP}])],decls:1,vars:1,consts:[[3,"dashboardConfig","paginationClass","currentPageIndex","paginationChanged","modelUpdated","gridReady",4,"ngIf"],[3,"paginationChanged","modelUpdated","gridReady","dashboardConfig","paginationClass","currentPageIndex"]],template:function(a,r){1&a&&e.DNE(0,be,1,3,"adswizz-ui-aw-dashboard",0),2&a&&e.Y8G("ngIf",r.couponListDashboardConfig)},dependencies:[i.X1,c.cC3,u.MD,u.bT,h.MQ,D.PG,we.M],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer!important}[_nghost-%COMP%]{width:100%}"]})}}return t})();var v=s(69192),y=s(60477);const X=t=>[t],je=t=>({coupon:t}),Pe=t=>({outlets:t});let T=class w{constructor(){this.APP_PERMISSION_RIGHTS=(0,e.WQX)(c.d$L)}agInit(n){this._gridApi=n.api,this.couponId=n.data.id}refresh(){return!0}static{this.\u0275fac=function(o){return new(o||w)}}static{this.\u0275cmp=e.VBU({type:w,selectors:[["feat-coupon-list-item-dropdown"]],decls:7,vars:10,consts:[["couponManagementActionsMenu","matMenu"],["tabindex","-1",3,"matMenuTriggerFor"],[1,"fa","fa-ellipsis-v"],[1,"coupon-list-item-table-actions"],["mat-menu-item",""],["tabindex","-1",3,"routerLink"]],template:function(o,a){if(1&o&&(e.j41(0,"button",1),e.nrm(1,"i",2),e.k0s(),e.j41(2,"mat-menu",3,0)(4,"li",4)(5,"a",5),e.EFF(6," Edit Coupon "),e.k0s()()()),2&o){const r=e.sdS(3);e.Y8G("matMenuTriggerFor",r),e.R7$(5),e.Y8G("routerLink",e.eq3(8,X,e.eq3(6,Pe,e.eq3(4,je,e.eq3(2,X,a.couponId)))))}},dependencies:[v.Wk,c.lMB,y.kk,y.fb,y.Cp],styles:["div.mat-menu-panel.coupon-list-item-table-actions li.mat-menu-item{padding:0} div.mat-menu-panel.coupon-list-item-table-actions li.mat-menu-item>a{display:block;padding:0 16px}"]})}};T=(0,f.Cg)([(0,C.d)()],T);var Me=s(63884),Ne=s(73948);let $e=(()=>{class t{constructor(){this._store=(0,e.WQX)(G.il),this.userDateFormat$=this._store.select(_.$7),this.userTimezone$=this._store.select(_.XZ)}agInit(o){this.date=o.getValue()}refresh({data:o}){return this.date!==o}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=e.VBU({type:t,selectors:[["feat-coupon-date-cell"]],decls:6,vars:11,template:function(a,r){1&a&&(e.j41(0,"div"),e.EFF(1),e.nI1(2,"async"),e.nI1(3,"async"),e.nI1(4,"awDate"),e.nI1(5,"awFalsyToDash"),e.k0s()),2&a&&(e.R7$(),e.SpI(" ",e.bMT(5,9,e.brH(4,5,r.date,e.bMT(2,1,r.userDateFormat$),e.bMT(3,3,r.userTimezone$))),"\n"))},dependencies:[c.cC3,Me.l,Ne.V,u.Jj],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer!important}[_nghost-%COMP%]{display:flex;align-items:center;height:100%;font-weight:500}"]})}}return t})();var k=s(54238),Le=s(52988),Se=s(27555),Y=s(61966),Oe=s(27937),Xe=s(33033),Ye=s(4157),Ue=s(77351),Ae=s(9606);const We=["couponPageList"],Qe=()=>["create"],ze=t=>({coupon:t}),Ve=t=>({outlets:t}),Be=t=>[t];function qe(t,n){if(1&t&&e.nrm(0,"fa-icon",13),2&t){const o=e.XpG(3);e.Y8G("icon",o.faCloudDownloadAlt)("fixedWidth",!0)}}function Je(t,n){1&t&&e.nrm(0,"aw-spinner",14),2&t&&e.Y8G("diameter",20)}function He(t,n){if(1&t){const o=e.RV6();e.j41(0,"button",9),e.bIt("click",function(){e.eBV(o);const r=e.XpG(2);return e.Njj(r.exportCouponCodesReport())}),e.DNE(1,qe,1,2,"fa-icon",10)(2,Je,1,1,"aw-spinner",11),e.j41(3,"span",12),e.EFF(4),e.k0s()()}if(2&t){const o=e.XpG(2);e.R7$(),e.Y8G("ngIf",!o.isExportLoading),e.R7$(),e.Y8G("ngIf",o.isExportLoading),e.R7$(2),e.SpI("",o.isExportLoading?"Exporting":"Export"," coupons")}}function Ke(t,n){if(1&t&&(e.qex(0),e.DNE(1,He,5,3,"button",8),e.bVm()),2&t){const o=e.XpG();e.R7$(),e.Y8G("awPermissionCheck",o.APP_PERMISSION_RIGHTS.COUPON_ADMIN.READ)}}let F=class b{constructor(){this._router=(0,e.WQX)(k.Ix),this._paymentMethodService=(0,e.WQX)(Y.PY),this._changeDetectorRef=(0,e.WQX)(e.gRc),this._exportTrackingService=(0,e.WQX)(Xe.j5),this.APP_PERMISSION_RIGHTS=(0,e.WQX)(c.d$L),this.isExportLoading=!1,this.faCloudDownloadAlt=Se.uqk}ngOnInit(){this._router.events.pipe((0,Le.p)(n=>n instanceof k.Z),(0,C.s)(this)).subscribe(n=>{this._router.getCurrentNavigation()?.extras?.state?.refreshData&&this.listComponent.refreshAgGrid()})}
1exportCouponCodesReport(){var n=this;return(0,Q.A)(function*(){if(n.isExportLoading)return;const o=Date.now();n.isExportLoading=!0;try{yield n._paymentMethodService.exportCouponCodesReport().toPromise()}catch{}finally{n.isExportLoading=!1,n._exportTrackingService.exportSucceeded({startTime:o,endTime:Date.now(),type:"Coupons"})}n._changeDetectorRef.detectChanges()})()}static{this.\u0275fac=function(o){return new(o||b)}}static{this.\u0275cmp=e.VBU({type:b,selectors:[["feat-coupons-page"]],viewQuery:function(o,a){if(1&o&&e.GBs(We,5),2&o){let r;e.mGM(r=e.lsd())&&(a.listComponent=r.first)}},features:[e.Jv_([{provide:c.d$L,useValue:c.Ei2},Y.PY])],decls:13,vars:11,consts:[["couponPageList",""],[1,"coupons-page-header"],[1,"coupons-page-info"],[1,"coupons-page-title"],[1,"coupons-page-subtitle"],[4,"ngIf"],[1,"primary-button",3,"routerLink"],["name","coupon"],["class","link-button","tabindex","-1",3,"click",4,"awPermissionCheck"],["tabindex","-1",1,"link-button",3,"click"],[3,"icon","fixedWidth",4,"ngIf"],[3,"diameter",4,"ngIf"],[1,"marginLeft5px"],[3,"icon","fixedWidth"],[3,"diameter"]],template:function(o,a){1&o&&(e.j41(0,"div",1)(1,"div",2)(2,"div",3),e.EFF(3," Coupon management "),e.k0s(),e.j41(4,"div",4),e.EFF(5," Manage all coupons "),e.k0s()(),e.DNE(6,Ke,2,1,"ng-container",5),e.nI1(7,"async"),e.j41(8,"button",6),e.EFF(9," Add new coupon "),e.k0s()(),e.nrm(10,"feat-coupon-list",null,0)(12,"router-outlet",7)),2&o&&(e.R7$(6),e.Y8G("ngIf",e.bMT(7,2,a.isUserAdmin$)),e.R7$(2),e.Y8G("routerLink",e.eq3(9,Be,e.eq3(7,Ve,e.eq3(5,ze,e.lJ4(4,Qe))))))},dependencies:[i.X1,c.cC3,Ye.aY,Ue.X,Ae.r,Ie,v.Wk,k.n3,u.bT,u.Jj],styles:[".cursor-pointer[_ngcontent-%COMP%]{cursor:pointer!important}[_nghost-%COMP%]{display:flex;flex:1 0 auto;flex-direction:column;padding:var(--aw-page-padding)}.coupons-page-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding-bottom:15px;margin-bottom:20px}.coupons-page-header[_ngcontent-%COMP%] > .coupons-page-info[_ngcontent-%COMP%]{flex:1 0 auto}.coupons-page-header[_ngcontent-%COMP%] > .coupons-page-info[_ngcontent-%COMP%] > .coupons-page-title[_ngcontent-%COMP%]{font-size:28px}.coupons-page-header[_ngcontent-%COMP%] > .coupons-page-info[_ngcontent-%COMP%] > .coupons-page-subtitle[_ngcontent-%COMP%]{font-size:14px;color:#8898b0}"]})}};(0,f.Cg)([(0,M.l6)(g.T7.isUserAdmin),(0,f.Sn)("design:type",Oe.c)],F.prototype,"isUserAdmin$",void 0),F=(0,f.Cg)([(0,C.d)()],F);var Ze=s(55298);const eo=[{path:"",component:F,data:{requiredPermission:c.Ei2.COUPON.WRITE,permissionRightRedirect:Ze.y1.SECURED.DEFAULT_REDIRECT_MISSING_PERMISSION},resolve:{currencyList:j},children:[{path:"create",component:c.YXv,canDeactivate:[c.LQr],outlet:"coupon",data:{drawerComponent:pe}},{path:":id",component:c.YXv,canDeactivate:[c.LQr],outlet:"coupon",data:{drawerComponent:E},resolve:{coupon:P}}]}];let oo=(()=>{class t{constructor(o){if(o)throw new Error("CouponsRoutingModule is already loaded.")}static{this.\u0275fac=function(a){return new(a||t)(e.KVO(t,12))}}static{this.\u0275mod=e.$C({type:t})}static{this.\u0275inj=e.G2t({imports:[v.iI.forChild(eo),v.iI]})}}return t})(),to=(()=>{class t{static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275mod=e.$C({type:t})}static{this.\u0275inj=e.G2t({providers:[P],imports:[W,oo]})}}return t})()}}]);
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.