1import{a as w}from"./chunk-BN22P4ZT.js";import{a as O}from"./chunk-UYLWLFNL.js";import{a as de}from"./chunk-RUXCQEMJ.js";import{L as nt,N as at,S as rt,Vb as lt,cc as ct,pc as mt}from"./chunk-5XDC2GJB.js";import{$ as T,$b as c,$f as Oe,Ah as De,Aj as We,Ak as Ke,Cb as x,Ea as f,Eb as G,El as le,Fi as Me,Ga as $,Gg as Ve,Ha as Ee,Hi as ae,Hl as ce,Il as me,Jb as K,Jd as Z,Ji as we,Ka as q,Kb as Q,Kd as Ne,Lb as J,Lf as te,Lg as ie,Li as re,Ma as X,Mb as Ge,Md as Re,Ol as it,Q as R,Rb as M,Ti as oe,Va as v,Vc as Ie,Vi as Be,Vk as Qe,W as D,Wa as Le,X as ve,Xa as E,Xg as ne,Xi as b,Z as F,Zi as Ye,_b as l,_i as Xe,_k as Je,aa as y,ab as p,aj as ke,bb as s,cb as o,cj as He,cl as Ze,da as z,db as u,dj as P,dl as et,ej as Ue,hb as xe,hj as je,ib as be,ij as ze,im as ot,kb as L,km as st,lf as h,lj as $e,lm as pt,mb as C,nb as m,o as Y,pf as Fe,ql as tt,ra as S,sk as se,ue as ee,wk as pe,xa as a,xj as qe,yc as Pe,z as j,zb as W}from"./chunk-FGOAN7BD.js";import"./chunk-X56CQ6VT.js";import{a as Ae,b as Se,h as ge}from"./chunk-CEWFFWI2.js";var g=(function(n){return n.FIX="FIX",n.VARIABLE="VARIABLE",n.PERCENT="PERCENT",n.VAR_PERCENT="VAR_PERCENT",n})(g||{}),k=(function(n){return n.FIX="FIX",n.VARIABLE="VARIABLE",n})(k||{});var _e=class{constructor(d,e,i){this.langCode=d,this.name=e,this.description=i}};var H=class{static priceValueValidator(d){return e=>{let i=e.controls.price.value,t=e.controls.priceType.value;if(t===g.FIX||t===g.PERCENT)if(w(i)){if(i<=0)return{price:d.instant("LANG_WARNING_NOT_POSITIVE_FIELD")}}else return{price:d.instant("LANG_INVALID_FORMAT",{arg0:"'"+d.instant("LANG_STAYTAX_PRICE")+"'"})}}}static applyToPaxValidator(d){return e=>{let i={};return e.controls.paxType.value.length===0&&(i.paxType=d.instant("LANG_STAYTAX_ERROR_APPLYTOPAX")),i}}};var dt=ge(Oe());var I=(()=>{class n{constructor(e){this._rest=e}saveStayAssignement(e){return this._rest.post("/tax/stay/save/assignment",e)}getStayList(){return this._rest.get("/tax/stay/list")}getStay(e){let i=new Ie;return h(e)||(i=i.set("optionid",`${e}`)),this._rest.get("/tax/stay/detail",{params:i})}deleteStay(e){return this._rest.post("/tax/stay/delete",e).toPromise()}saveStay(e){return this._rest.post("/tax/stay/save",e).toPromise()}static{this.\u0275fac=function(i){return new(i||n)(F(De))}}static{this.\u0275prov=D({token:n,factory:n.\u0275fac})}}return n})();var fe=()=>({standalone:!0});function Lt(n,d){if(n&1&&(s(0,"div",15),x(1),o()),n&2){let e=m(2);a(),G(" ",e.stayFormGroup.errors.price," ")}}function xt(n,d){if(n&1&&(s(0,"div"),u(1,"input",26),x(2),v(3,Lt,2,1,"div",15),o()),n&2){let e=m();a(),W("error",e.stayFormGroup==null||e.stayFormGroup.errors==null?null:e.stayFormGroup.errors.price),a(),G(" ",e.currencyPriceValue," "),a(),E(!(e.stayFormGroup==null||e.stayFormGroup.errors==null)&&e.stayFormGroup.errors.price?3:-1)}}function bt(n,d){if(n&1){let e=L();s(0,"div")(1,"div",27)(2,"div",28)(3,"p-button",29),l(4,"translate"),C("click",function(){T(e);let t=m();return y(t.saveStayBeforeGridPrice(t.stayFormGroup.get("priceType").value))}),o()(),s(5,"div",28)(6,"p-checkbox",30,0),J("ngModelChange",function(t){T(e);let r=m();return Q(r.saveBeforeGridPrice,t)||(r.saveBeforeGridPrice=t),y(t)}),o(),u(8,"label",31),l(9,"translate"),o()()()}if(n&2){let e=m();a(3),p("label",c(4,5,"LANG_GOTO_GRID")),a(3),K("ngModel",e.saveBeforeGridPrice),p("ngModelOptions",M(9,fe))("disabled",e.stayTax.optionid<=0),a(2),p("innerHTML",c(9,7,"LANG_SAVE_BEFORE_GOTO_GRID"),S)}}function Gt(n,d){if(n&1){let e=L();s(0,"it-form-line",7)(1,"it-form-field")(2,"p-select",32),C("onChange",function(){T(e);let t=m();return y(t.updatePriceCaps())}),o()()()}if(n&2){let e=m();a(2),p("options",e.priceCapOptions)}}function Pt(n,d){if(n&1&&(s(0,"div",15),x(1),o()),n&2){let e=m(2);a(),G(" ",e.errorPriceCap," ")}}function It(n,d){if(n&1){let e=L();s(0,"it-form-line",8)(1,"it-form-field")(2,"input",33),C("input",function(){T(e);let t=m();return y(t.checkPriceCapErrors())}),o(),x(3),v(4,Pt,2,1,"div",15),o()()}if(n&2){let e=m();a(2),W("error",e.errorPriceCap),a(),G(" ",e.user.currencyCode," "),a(),E(e.errorPriceCap?4:-1)}}function Nt(n,d){if(n&1){let e=L();s(0,"it-form-line",9)(1,"it-form-field"),xe(2),s(3,"div",27)(4,"div",28)(5,"p-button",29),l(6,"translate"),C("click",function(){T(e);let t=m();return y(t.updatePriceCap())}),o()(),s(7,"div",28)(8,"p-checkbox",34),J("ngModelChange",function(t){T(e);let r=m();return Q(r.saveBeforeGridPriceCap,t)||(r.saveBeforeGridPriceCap=t),y(t)}),o(),u(9,"label",31),l(10,"translate"),o()(),be(),o()()}if(n&2){let e=m();a(5),p("label",c(6,5,"LANG_GOTO_GRID")),a(3),K("ngModel",e.saveBeforeGridPriceCap),p("ngModelOptions",M(9,fe))("disabled",e.stayTax.optionid<=0),a(),p("innerHTML",c(10,7,"LANG_SAVE_BEFORE_GOTO_GRID"),S)}}function Rt(n,d){if(n&1&&(u(0,"span",37),x(1," - "),u(2,"span",37)),n&2){let e=d.$implicit;p("innerHTML",e.value,S),a(2),p("innerHTML",e.label,S)}}function Ft(n,d){if(n&1){let e=L();s(0,"it-form-line",12)(1,"it-form-field")(2,"p-select",35),l(3,"translate"),C("onChange",function(){T(e);let t=m();return y(t.updateAccountingCode())}),o(),X(4,Rt,3,2,"ng-template",36),o()()}if(n&2){let e=m();a(2),p("options",e.listAccountingCode)("placeholder",c(3,2,"LANG_EXPORTCONF_SELECT_ACCOUNTINGCODE_PLACEHOLDER"))}}function Ot(n,d){if(n&1&&(s(0,"div",15),x(1),o()),n&2){let e=m();a(),G(" ",e.stayFormGroup.errors.paxType," ")}}function Vt(n,d){if(n&1){let e=L();s(0,"p-button",38),l(1,"translate"),C("click",function(){T(e);let t=m(2);return y(t.showRateAssigningModal())}),o()}n&2&&p("label",c(1,1,"LANG_ACCESS_ASSIGNMENT"))}function Dt(n,d){if(n&1){let e=L();s(0,"div",28)(1,"p-button",39),l(2,"translate"),C("click",function(){T(e);let t=m(2);return y(t.saveStayBeforeOptAssignScreen())}),o()(),s(3,"div",28)(4,"p-checkbox",40,1),J("ngModelChange",function(t){T(e);let r=m(2);return Q(r.saveBeforeAccessAssignment,t)||(r.saveBeforeAccessAssignment=t),y(t)}),o(),u(6,"label",18),l(7,"translate"),o()}if(n&2){let e=m(2);a(),p("label",c(2,5,"LANG_ACCESS_ASSIGNMENT")),a(3),K("ngModel",e.saveBeforeAccessAssignment),p("ngModelOptions",M(9,fe))("disabled",e.stayTax.optionid<=0),a(2),p("innerHTML",c(7,7,"LANG_SAVE_BEFORE_ACCESS_ASSIGNMENT"),S)}}function Mt(n,d){n&1&&(s(0,"it-form-line",19)(1,"it-form-field")(2,"div",27),v(3,Vt,2,3,"p-button",25),l(4,"isFunctionalityAuthorized"),Le(5,Dt,8,10),o()()()),n&2&&(a(3),E(c(4,1,"bOptionsPagesV2")?3:5))}function wt(n,d){if(n&1){let e=L();s(0,"p-button",38),l(1,"translate"),C("click",function(){T(e);let t=m();return y(t.submit(!1))}),o()}n&2&&p("label",c(1,1,"LANG_SAVE_CONTINUE"))}var _t=(()=>{class n extends oe{constructor(e,i,t,r,_,A,N,V,B){super(B),this._messageService=e,this._provider=i,this._accountingCodeProvider=t,this._router=r,this._dialog=_,this._dialogService=A,this._lazy=N,this.priceTypesOptions=[],this.priceCapOptions=[],this.labelValuePaxType=[],this.listAccountingCode=[],this.saveBeforeGridPrice=!0,this.saveBeforeGridPriceCap=!0,this.saveBeforeAccessAssignment=!0,this.bManageReservitPMSInvoicing=!1,this.errorPriceCap="",this.nameGroup=new ke({}),this.stayFormGroup=V.group({priceType:new P(g.FIX,b.required),priceCapType:new P(k.FIX,b.required),bNotPayableOnSpot:new P(!1,b.required),price:new P(void 0,b.required),priceCap:new P(void 0,b.required),paxType:new P(2,b.required),applyToAllOffers:new P(!0,b.required),name:this.nameGroup,accountingCode:new P(""),rates:new He([])}),this.stayFormGroup.setValidators([H.priceValueValidator(this._translate),H.applyToPaxValidator(this._translate)])}ngOnInit(){this.user=this._store.selectSnapshot(ie.getUser),this._initStayTax(),this._initPriceTypesOptions(),this._initPriceCapOptions(),this._transformDescriptionsForI18n(),this._updateCurrencyPriceValue(),this._initManageReservitPMSInvoicing(),this.bManageReservitPMSInvoicing&&this._initAccountingCodes(),this._translate.onTranslationChange.pipe(R(this._untilDestroyed)).subscribe(()=>{this._provider.getStay(this.stayTax.optionid).subscribe(e=>{this.stayTax=e.data.stayTax,this.labelValuePaxType=e.data.labelValuePaxType,this._initPriceTypesOptions(),this._transformDescriptionsForI18n(),this._updateCurrencyPriceValue(),this.bManageReservitPMSInvoicing&&this._initAccountingCodes(),this._changeRef.detectChanges()}),this._changeRef.detectChanges()}),this.nameI18nEditorField={formControlName:"name",type:"input"},this._initI18nLangs(this.langs),this._stopAppLoading()}_initI18nLangs(e){Object.keys(e).forEach(i=>
1{Object.keys(e[i].fields).forEach(t=>{let r=e[i].fields[t],_=r.content?r.content:"",A=[];r.mandatory&&A.push(b.required),this.nameGroup.setControl(i,new P(_,A))})})}_initStayTax(){this._route.data.pipe(Y(e=>e.StayTax),R(this._untilDestroyed)).subscribe(e=>{if(!h(e)){this.stayTax=e.data.stayTax,this._rooms=e.data.rooms,this._rates=e.data.rates,this.labelValuePaxType=e.data.labelValuePaxType;let i=this.labelValuePaxType.map(t=>t.value);this.stayTax?.paxType&&(this.stayTax.paxType=this.stayTax.paxType.filter(t=>i.includes(t))),this._initForm()}})}showRateAssigningModal(){let e=import("./chunk-F3ACAJQY.js");this._lazy.load(e,"OptionModule","OptionRateAssignModalComponent").then(i=>{let t=this.stayFormGroup.get("rates").value;this._dialog.openUniq(this._dialogService,i,{styleClass:"it-modal rate-option-modal modal-xl",showHeader:!1,closeOnEscape:!1,data:{items:[...O.computeItemsOfRateAssigningModal(this._rates,t)],subItems:[...O.computeSubItemsOfRateAssigningModal(this._rooms)],titleLang:"LANG_STAYTAX_RATES_TITLE",searchInputPlaceHolderLang:"LANG_OPTION_RATES_SEARCH",selectedSubItemLang:"LANG_RATE_ROOMS_SELECTED_COUNT",allSubItemsLang:"LANG_RATE_ALL_ROOMS"}}).then(r=>{r.onClose.pipe(R(this._untilDestroyed),j(_=>!h(_))).subscribe(_=>{let A=_.map(N=>({rateId:N.value,rooms:O.toOptionRateRoomDTOs(N)}));this.stayFormGroup.get("rates").patchValue(A)})})})}_initPriceTypesOptions(){this.priceTypesOptions=[];for(let e in g)this.priceTypesOptions.push({label:this._translate.instant(`LANG_STAYTAX_PRICETYPE_${e}`),value:e})}_initPriceCapOptions(){this.priceCapOptions=[];for(let e in k)this.priceCapOptions.push({label:this._translate.instant(`LANG_STAYTAX_PRICETYPE_${e}`),value:e})}_initAccountingCodes(){this._translate.get(["LANG_NONE"]).subscribe(e=>{this.listAccountingCode=[],this.listAccountingCode.push({label:e.LANG_NONE,value:null}),this._accountingCodeProvider.getAccountingCodeList().subscribe(i=>{if(!h(i))for(let t of i)this.listAccountingCode.push({label:`${t.accountingCode} - ${t.label}`,value:t.id});!h(this.stayTax)&&!h(this.stayTax.accountingCode)&&this.stayFormGroup.get("accountingCode").setValue(Number(this.stayTax.accountingCode)),this._detectChanges()})})}updateAccountingCode(){this.stayTax.accountingCode=this.stayFormGroup.get("accountingCode").value,this.stayFormGroup.updateValueAndValidity()}_initForm(){this.stayFormGroup.patchValue(this.stayTax)}updatePriceCaps(){this.stayFormGroup.get("priceCapType").value===k.VARIABLE&&(this.stayFormGroup.get("priceCap").clearValidators(),this.stayFormGroup.get("priceCap").setErrors(null)),this.checkPriceCapErrors()}_transformDescriptionsForI18n(){let e={},i=!1;h(this.stayTax)&&(i=!0);let t=i?void 0:this.stayTax.stayTaxDescription.descriptions;
1this.user.langs.forEach(r=>{let _=t!==void 0?t[r.langCode.toUpperCase()]:void 0;e[r.langCode]={},e[r.langCode].fields={};let A=!1;(r.langCode===We.DEFAULT_LANGCODE||r.langCode.toLowerCase()===this.user.customer.langCode.toLowerCase())&&(A=!0),e[r.langCode].fields.name={content:_!==void 0?(0,dt.decode)(_.name):"",mandatory:A}}),this.langs=e}_initManageReservitPMSInvoicing(){!h(this.user)&&!h(this.user.functionalities)&&this.user.functionalities.bManageReservITPMSInvoicing&&(this.bManageReservitPMSInvoicing=!0)}updatePriceTypes(){this._updateCurrencyPriceValue(),this.checkPriceCapErrors()}updatePriceCap(){let e={pageReturn:"itback",backURI:"/tax/stay/detail",optionid:this.stayTax.optionid,isPriceCap:!0},i={url:`/${this.user.app}/ext/it/roomPrice`,params:{queryParams:e}};this.saveBeforeGridPriceCap?this._save(!1,e,i):this._router.navigate([i.url],i.params)}_updateCurrencyPriceValue(){this.stayFormGroup.get("priceType").value===g.FIX?(this.currencyPriceValue=this.user.currencyCode,this.stayFormGroup.controls.price.setValidators(b.required)):this.stayFormGroup.get("priceType").value===g.PERCENT?(this.currencyPriceValue="%",this.stayFormGroup.controls.price.setValidators(b.required)):this.stayFormGroup.controls.price.clearValidators(),this.stayFormGroup.updateValueAndValidity()}saveStayBeforeGridPrice(e){let i={pageReturn:"itback",backURI:"/tax/stay/detail",optionid:this.stayTax.optionid,isStayTax:!0,type:e===g.VAR_PERCENT?g.PERCENT.toLowerCase():g.FIX.toLowerCase()},t={url:`/${this.user.app}/ext/it/roomPrice`,params:{queryParams:i}};this.saveBeforeGridPrice?this._save(!1,i,t):this._router.navigate([t.url],t.params)}saveStayBeforeOptAssignScreen(){let e={pageReturn:"itback",backURI:"/tax/stay/detail",action:"display",optionid:this.stayTax.optionid},i={url:`/${this.user.app}/ext/it/optionsassignment`,params:{queryParams:e}};this.saveBeforeAccessAssignment?this._save(!1,e,i):this._router.navigate([i.url],i.params)}submit(e){this._save(e)}_save(e,i,t){if(this.stayFormGroup.valid&&(h(this.errorPriceCap)||this.errorPriceCap.length===0)){this._startAppLoading(),this._managePrice(),Fe(this.stayTax,this.stayFormGroup.value),this.stayTax.paxType=this.stayFormGroup.get("paxType").value;let r={};for(let[_,A]of Object.entries(this.nameGroup.value))r[_]=new _e(_,A.toString(),void 0);this.stayTax.stayTaxDescription.descriptions=r,this._provider.saveStay(this.stayTax).then(_=>{this._stopAppLoading(),e?this._router.navigate([`/${this.user.app}/tax/stay/list`]):!h(i)&&!h(t)&&(i.optionid<=0&&(i.optionid=_),i.backURI+=`?optionid=${_}`,this._router.navigate([t.url],t.params)),this._changeRef.detectChanges()},_=>{this._messageService.add({severity:"error",summary:this._translate.instant("LANG_STAY_TAX_ERROR_SUMMARY"),detail:this._translate.instant("LANG_STAY_TAX_ERROR_DETAIL")}),console.error(_),this._stopAppLoading()})}else this._messageService.add({severity:"warn",summary:this._translate.instant("LANG_STAY_TAX_WARNING_SUMMARY"),detail:this._translate.instant("LANG_STAY_TAX_WARNING_DETAIL")})}checkPriceCapErrors(){if(this.errorPriceCap="",this.stayFormGroup.get("priceType").value===g.PERCENT&&this.stayFormGroup.get("priceCapType").value=="FIX"||this.stayFormGroup.get("priceType").value===g.VAR_PERCENT&&this.stayFormGroup.get("priceCapType").value=="FIX"){let e=this.stayFormGroup.controls.priceCap.value;w(e)?e<=0&&(this.errorPriceCap=this._translate.instant("LANG_WARNING_NOT_POSITIVE_FIELD")):this.errorPriceCap=this._translate.instant("LANG_INVALID_FORMAT",{arg0:`'${this._translate.instant("LANG_STAYTAX_PRICECAP")}'`})}}_managePrice(){w(this.stayFormGroup.get("price").value)&&this.stayFormGroup.get("price").value.toString().includes(",")&&this.stayFormGroup.get("price").setValue(this.stayFormGroup.get("price").value.toString().replace(",",".")),w(this.stayFormGroup.get("priceCap").value)&&this.stayFormGroup.get("priceCap").value.toString().includes(",")&&this.stayFormGroup.get("priceCap").setValue(this.stayFormGroup.get("priceCap").value.toString().replace(",","."))}ngOnDestroy(){this._untilDestroyed.next()}static{this.\u0275fac=function(i){return new(i||n)(f(ae),f(I),f(de),f(Z),f(ce),f(le),f(me),f(qe),f(z))}}static{this.\u0275cmp=$({type:n,selectors:[["ng-component"]],standalone:!1,features:[q],decls:56,vars:52,consts:[["saveBeforeGridPrices",""],["saveBeforeGotoOptAssignScreen",""],["id","staytax-detail-component",1,"component","component-form",3,"formGroup"],[3,"field","form","user","autoTranslate"],["label","LANG_STAYTAX_PRICETYPE","helpid","HELP_STAYTAX_PRICETYPE"],["formControlName","priceType","optionLabel","label","optionValue","value",3,"onChange","options"],["helpid","HELP_STAYTAX_PRICE",3,"label"],["label","LANG_STAYTAX_PRICECAP_TYPE","helpid","HELP_STAYTAX_PRICETYPE"],["label","LANG_STAYTAX_PRICECAP","helpid","HELP_STAYTAX_PRICECAP"],["label","LANG_STAYTAX_PRICECAP","helpid","HELP_STAYTAX_PRICE"],["label","LANG_STAYTAX_NOT_PAYABLE_ON_SPOT","helpid","HELP_STAYTAX_PRICETYPE_NOT_ON_SPOT"],["binary","true",3,"formControl"],["label","LANG_INVOICE_ACCOUNTING_CODE","helpid","HELP_INVOICE_ACCOUNTING_CODE"],["label","LANG_STAYTAX_PAX_TYPE","helpid","HELP_STAYTAX_PAX_TYPE"],["formControlName","paxType",3,"options","selectedItemsLabel","maxSelectedLabels","placeholder","filter"],[1,"form-hint","form-error"],["label","LANG_STAYTAX_OFFER_XREF","helpid","HELP_STAYTAX_OFFER_XREF"],["name","applyToAllOffers","inputId","applyToAllOffers","formControlName","applyToAllOffers",3,"binary"],["for","saveBeforeGotoOptAssignScreen",3,"innerHTML"],["label","LANG_LABEL_ATRIBUTE_STAYTAX","helpid","HELP_STAYTAX_ATRIBUTE"],[1,"btn-btm"],[1,"left"],["pRipple","","icon","fa fa-arrow-left",3,"label","routerLink"],[1,"right"],["pRipple","",3,"click","label"],["pRipple","","type","button",3,"label"],["id","price-value-input","type","text","pInputText","","formControlName","price",1,"price-value"],[1,"form-column"],[1,"form-column-line"],["pRipple","","type","button","icon","fa fa-external-link-alt",3,"click","label"],["inputId","saveBeforeGotoGrid","binary","true",3,"ngModelChange","ngModel","ngModelOptions","disabled"],["for","saveBeforeGotoGrid",3,"innerHTML"],["formControlName","priceCapType","optionLabel","label","optionValue","value",3,"onChange","options"],["id","pricecap-value-input","type","text","pInputText","","formControlName","priceCap",1,"price-value",3,"input"],["binary","true","inputId","saveBeforeGotoGrid",3,"ngModelChange","ngModel","ngModelOptions","disabled"],["formControlName","accountingCode","optionLabel","label","optionValue","value",3,"onChange","options","placeholder"],["pTemplate","item"],[3,"innerHTML"],["pRipple","","type","button",3,"click","label"],["pRipple","","type","button","icon","fa fa-external-link",3,"click","label"],["inputId","saveBeforeGotoOptAssignScreen","binary","true",3,"ngModelChange","ngModel","ngModelOptions","disabled"]],template:function(i,t){if(i&1&&(s(0,"div",2)(1,"p-panel")(2,"p-header")(3,"span"),x(4),l(5,"translate"),o()(),u(6,"it-i18n-editor",3),o(),s(7,"p-panel")(8,"p-header")(9,"span"),x(10),l(11,"translate"),o()(),s(12,"it-form-line",4)(13,"it-form-field")(14,"p-select",5),C("onChange",function(){return t.updatePriceTypes()}
1),o()()(),s(15,"it-form-line",6)(16,"it-form-field"),v(17,xt,4,4,"div"),v(18,bt,10,10,"div"),o()(),v(19,Gt,3,1,"it-form-line",7),v(20,It,5,4,"it-form-line",8),v(21,Nt,11,10,"it-form-line",9),s(22,"it-form-line",10)(23,"it-form-field"),u(24,"p-checkbox",11),o()(),v(25,Ft,5,4,"it-form-line",12),o(),s(26,"p-panel")(27,"p-header")(28,"span"),x(29),l(30,"translate"),o()(),s(31,"it-form-line",13)(32,"it-form-field"),u(33,"p-multiSelect",14),l(34,"translate"),l(35,"translate"),v(36,Ot,2,1,"div",15),o()()(),s(37,"p-panel")(38,"p-header")(39,"span"),x(40),l(41,"translate"),o()(),s(42,"it-form-line",16)(43,"it-form-field"),u(44,"p-checkbox",17)(45,"label",18),l(46,"translate"),o()(),v(47,Mt,6,3,"it-form-line",19),o(),s(48,"div",20)(49,"div",21),u(50,"p-button",22),l(51,"translate"),o(),s(52,"div",23)(53,"p-button",24),l(54,"translate"),C("click",function(){return t.submit(!0)}),o(),v(55,wt,2,3,"p-button",25),o()()()),i&2){let r;p("formGroup",t.stayFormGroup),a(4),G(" ",c(5,34,"LANG_STAYTAX_LABEL_NAME")," "),a(2),p("field",t.nameI18nEditorField)("form",t.stayFormGroup)("user",t.user)("autoTranslate",!0),a(4),G(" ",c(11,36,"LANG_STAYTAX_PRICE_PANEL")," "),a(4),p("options",t.priceTypesOptions),a(),p("label",Ge(t.stayFormGroup.get("priceType").value==="PERCENT"||t.stayFormGroup.get("priceType").value==="VAR_PERCENT"?"LANG_STAYTAX_PERCENT":"LANG_STAYTAX_PRICE")),a(2),E(t.stayFormGroup.get("priceType").value!=="VARIABLE"&&t.stayFormGroup.get("priceType").value!=="VAR_PERCENT"?17:-1),a(),E(t.stayFormGroup.get("priceType").value==="VARIABLE"||t.stayFormGroup.get("priceType").value==="VAR_PERCENT"?18:-1),a(),E(t.stayFormGroup.get("priceType").value==="VAR_PERCENT"||t.stayFormGroup.get("priceType").value=="PERCENT"?19:-1),a(),E(t.stayFormGroup.get("priceType").value==="PERCENT"&&t.stayFormGroup.get("priceCapType").value==="FIX"||t.stayFormGroup.get("priceType").value==="VAR_PERCENT"&&t.stayFormGroup.get("priceCapType").value==="FIX"||t.stayFormGroup.get("priceType").value==="PAYABLE_ON_SPOT"&&((r=t.stayFormGroup.get("priceNotOnSpot"))==null?null:r.value)==="PERCENT"?20:-1),a(),E(t.stayFormGroup.get("priceType").value==="VAR_PERCENT"&&t.stayFormGroup.get("priceCapType").value==="VARIABLE"||t.stayFormGroup.get("priceType").value==="PERCENT"&&t.stayFormGroup.get("priceCapType").value==="VARIABLE"?21:-1),a(3),p("formControl",t.stayFormGroup.controls.bNotPayableOnSpot),a(),E(t.bManageReservitPMSInvoicing?25:-1),a(4),G(" ",c(30,38,"LANG_STAYTAX_PAX_TYPE_PANEL")," "),a(4),W("error",t.stayFormGroup==null||t.stayFormGroup.errors==null?null:t.stayFormGroup.errors.paxType),p("options",t.labelValuePaxType)("selectedItemsLabel","{0} "+c(34,40,"LANG_ITEMS_SELECTED"))("maxSelectedLabels",4)("placeholder","0 "+c(35,42,"LANG_ITEMS_SELECTED"))("filter",!1),a(3),E(!(t.stayFormGroup==null||t.stayFormGroup.errors==null)&&t.stayFormGroup.errors.paxType?36:-1),a(4),G(" ",c(41,44,"LANG_STAYTAX_OFFER_XREF_PANEL")," "),a(4),p("binary",!0),a(),p("innerHTML",c(46,46,"LANG_STAYTAX_APPLY_TO_ALL_OFFERS"),S),a(2),E(t.stayFormGroup.controls.applyToAllOffers.value===!1?47:-1),a(3),p("label",c(51,48,"LANG_BACK"))("routerLink","/"+t.user.app+"/tax/stay/list"),a(3),p("label",c(54,50,"LANG_SAVE_QUIT")),a(2),E((t.stayTax==null?null:t.stayTax.optionid)>0?55:-1)}},dependencies:[Ne,Be,Ye,Xe,Ue,je,ze,$e,pe,we,re,Ke,it,se,Qe,Ze,et,rt,lt,mt,ne,at],styles:["#staytax-detail-component p-checkbox{padding-bottom:5px} #staytax-detail-component button{margin-right:5px}"],changeDetection:0})}}return n})();var ut=ge(Oe());var Bt=()=>[5,10,20];function Yt(n,d){n&1&&(s(0,"tr")(1,"th",10),u(2,"span",11),l(3,"translate"),l(4,"ucfirst"),u(5,"p-sortIcon",12),o(),s(6,"th",13),u(7,"span",11),l(8,"translate"),l(9,"ucfirst"),u(10,"p-sortIcon",14),o(),s(11,"th",15),u(12,"span",11),l(13,"translate"),l(14,"ucfirst"),u(15,"p-sortIcon",16),o(),s(16,"th",17),u(17,"span",11),l(18,"translate"),l(19,"ucfirst"),o()()),n&2&&(a(2),p("innerHTML",c(4,6,c(3,4,"LANG_STAYTAX_NAME")),S),a(5),p("innerHTML",c(9,10,c(8,8,"LANG_STAYTAX_PRICETYPE")),S),a(5),p("innerHTML",c(14,14,c(13,12,"LANG_STAYTAX_PRICE")),S),a(5),p("innerHTML",c(19,18,c(18,16,"LANG_WORD_ACTIONS")),S))}function Xt(n,d){n&1&&(s(0,"tr"),u(1,"td",18),l(2,"translate"),o()),n&2&&(a(),p("innerHTML",c(2,1,"LANG_NO_RESULTS"),S))}function kt(n,d){if(n&1){let e=L();s(0,"p-button",22),l(1,"translate"),C("click",function(){T(e);let t=m().$implicit,r=m();return y(r.accessOptAssignScreen(t))}),o()}n&2&&p("pTooltip",c(1,1,"LANG_ACCESS_ASSIGNMENT"))}function Ht(n,d){if(n&1){let e=L();s(0,"tr")(1,"td",19),C("click",function(){let t=T(e).$implicit,r=m();return y(r.viewStayTaxes(t))}),o(),s(2,"td",19),C("click",function(){let t=T(e).$implicit,r=m();return y(r.viewStayTaxes(t))}),o(),s(3,"td",19),C("click",function(){let t=T(e).$implicit,r=m();return y(r.viewStayTaxes(t))}),o(),s(4,"td",17)(5,"p-button",20),l(6,"translate"),C("click",function(){let t=T(e).$implicit,r=m();return y(r.deleteStay(t))}),o(),X(7,kt,2,3,"p-button",21),o()()}if(n&2){let e=d.$implicit;a(),p("innerHTML",e.nameToDisplay,S),a(),p("innerHTML",e.priceType,S),a(),p("innerHTML",e.price,S),a(2),p("pTooltip",c(6,5,"LANG_TOOLTIP_DELETE_STAYTAX")),a(2),p("ngIf",!e.applyToAllOffers)}}var Tt=(()=>{class n extends oe{constructor(e,i,t,r,_,A,N,V){super(V),this._provider=e,this._lazy=i,this._dialog=t,this._dialogSupervisor=r,this._confirmationService=_,this._messageService=A,this._router=N,this.stayTaxesToDataTable=[]}ngOnInit(){this.user=this._store.selectSnapshot(ie.getUser),this._initListStay(),this._translate.onTranslationChange.pipe(R(this._untilDestroyed)).subscribe(()=>{this._provider.getStayList().subscribe(e=>{this.stayTaxes=e.data.stayTaxes,this._rates=e.data.rates,this._rooms=e.data.rooms}),this._changeRef.detectChanges()})}withActionButton(){return this._translate.get("LANG_WORD_ADD").pipe(Y(e=>({label:e,styleClass:"btn-add",cb:()=>{this._router.navigate([`/${this.user.app}/tax/stay/detail`])}})))}_initListStay(){this._route.data.pipe(Y(e=>e.StayTax),R(this._untilDestroyed)).subscribe(e=>{this.stayTaxes=e.data.stayTaxes,this._rates=e.data.rates,this._rooms=e.data.rooms,this._manageStayTaxToDataTable(),this._stopAppLoading()})}showRateAssigningModal(e){let i=import("./chunk-F3ACAJQY.js");this._lazy.load(i,"OptionModule","OptionRateAssignModalComponent").then(t=>{let r=e.rates;
1this._dialogSupervisor.openUniq(this._dialog,t,{styleClass:"it-modal rate-option-modal modal-xl",showHeader:!1,closeOnEscape:!1,data:{items:[...O.computeItemsOfRateAssigningModal(this._rates,r)],subItems:[...O.computeSubItemsOfRateAssigningModal(this._rooms)],titleLang:"LANG_STAYTAX_RATES_TITLE",searchInputPlaceHolderLang:"LANG_OPTION_RATES_SEARCH",selectedSubItemLang:"LANG_RATE_ROOMS_SELECTED_COUNT",allSubItemsLang:"LANG_RATE_ALL_ROOMS"}}).then(_=>{_.onClose.pipe(R(this._untilDestroyed),j(A=>!h(A))).subscribe(A=>{this._translate.get(["LANG_SUCCESS","LANG_STAY_TAX_SUCCESS","LANG_STAY_TAX_ERROR_SUMMARY","LANG_STAY_TAX_ERROR_DETAIL"]).pipe(R(this._untilDestroyed)).subscribe(N=>{let V;this.stayTaxes=this.stayTaxes.map(B=>{if(B.optionid==e.optionid){let he=Se(Ae({},B),{rates:A.map(Ce=>({rateId:Ce.value,rooms:O.toOptionRateRoomDTOs(Ce)}))});return V=he,he}return B}),this._manageStayTaxToDataTable(),this._startAppLoading(),this._provider.saveStayAssignement(V).subscribe(()=>{this._messageService.add({severity:"success",summary:N.LANG_SUCCESS,detail:N.LANG_STAY_TAX_SUCCESS}),this._stopAppLoading()},()=>{this._messageService.add({severity:"error",summary:this._translate.instant("LANG_STAY_TAX_ERROR_SUMMARY"),detail:this._translate.instant("LANG_STAY_TAX_ERROR_DETAIL")}),this._stopAppLoading()})})})})})}deleteStay(e){this._translate.get(["LANG_TAX_CONFIRM_DELETE_STAY_HEADER","LANG_TAX_CONFIRM_DELETE_STAY","LANG_YES","LANG_NO"]).subscribe(i=>{this._confirmationService.confirm({header:i.LANG_TAX_CONFIRM_DELETE_STAY_HEADER,message:i.LANG_TAX_CONFIRM_DELETE_STAY,icon:"fa fa-trash",acceptLabel:i.LANG_YES,rejectLabel:i.LANG_NO,accept:()=>{this._startAppLoading();let t=this.stayTaxes.find(r=>r.optionid===e.optionId);this._provider.deleteStay(t).then(()=>{this.stayTaxes=this.stayTaxes.filter(r=>r.optionid!==e.optionId),this.stayTaxesToDataTable=this.stayTaxesToDataTable.filter(r=>r.optionId!==e.optionId),this._changeRef.markForCheck(),this._stopAppLoading()})}})})}accessOptAssignScreen(e){if(Ve.isFunctionalityAuthorized(this.user,"bOptionsPagesV2")){let i=this.stayTaxes.find(t=>t.optionid===e.optionId);this.showRateAssigningModal(i)}else{let i={pageReturn:"itback",backURI:"/tax/stay/list",action:"display",optionid:h(e)?"":e.optionId},t={url:`/${this.user.app}/ext/it/optionsassignment`,params:{queryParams:i}};this._router.navigate([t.url],t.params)}}_manageStayTaxToDataTable(){let e=new nt(this._store);this.stayTaxes.forEach(i=>{let t={optionId:0,nameToDisplay:"",price:"",priceType:"",applyToAllOffers:i.applyToAllOffers};switch(t.optionId=i.optionid,t.nameToDisplay=`${(0,ut.decode)(i.nameToDisplay)} (id: ${i.optionid})`,t.priceType=this._translate.instant("LANG_STAYTAX_PRICETYPE_"+i.priceType),i.priceType){case"FIX":t.price=e.transform(i.price,this.user.currencyCode);break;case"PERCENT":t.price=`${i.price} %`;break;default:t.price="-"}this.stayTaxesToDataTable.push(t)})}viewStayTaxes(e){let i={optionid:e.optionId},t={url:`/${this.user.app}/tax/stay/detail`,params:{queryParams:i}};this._router.navigate([t.url],t.params)}ngOnDestroy(){this._untilDestroyed.next()}static{this.\u0275fac=function(i){return new(i||n)(f(I),f(me),f(le),f(ce),f(Me),f(ae),f(Z),f(z))}}static{this.\u0275cmp=$({type:n,selectors:[["ng-component"]],standalone:!1,features:[q],decls:11,vars:10,consts:[["dt",""],["id","staytax-list-component",1,"component","component-form"],[1,"card"],["sortField","nameToDisplay",1,"center",3,"value","rows","rowsPerPageOptions","paginator","rowHover","sortOrder"],["pTemplate","header"],["pTemplate","emptymessage"],["pTemplate","body"],[1,"btn-btm"],[1,"right"],["pRipple","",1,"btn-primary","btn-default",3,"click","label"],["pSortableColumn","nameToDisplay",1,"it-col-ellipsis"],[3,"innerHTML"],["field","nameToDisplay"],["pSortableColumn","priceType",1,"it-col-ellipsis"],["field","priceType"],["pSortableColumn","price",1,"it-col-ellipsis"],["field","price"],[1,"it-col-small"],["colspan","4",1,"center",3,"innerHTML"],[1,"it-col-ellipsis",3,"click","innerHTML"],["pRipple","","type","button","icon","fa fa-trash",1,"btn-icon","btn-secondary","btn-default",3,"click","pTooltip"],["pRipple","","type","button","class","btn-icon btn-default","icon","fa fa-external-link-alt",3,"pTooltip","click",4,"ngIf"],["pRipple","","type","button","icon","fa fa-external-link-alt",1,"btn-icon","btn-default",3,"click","pTooltip"]],template:function(i,t){if(i&1){let r=L();s(0,"div",1)(1,"div",2)(2,"p-table",3,0),X(4,Yt,20,20,"ng-template",4)(5,Xt,3,3,"ng-template",5)(6,Ht,8,7,"ng-template",6),o()(),s(7,"div",7)(8,"div",8)(9,"p-button",9),l(10,"translate"),C("click",function(){return T(r),y(t.accessOptAssignScreen())}),o()()()()}i&2&&(a(2),p("value",t.stayTaxesToDataTable)("rows",5)("rowsPerPageOptions",M(9,Bt))("paginator",!0)("rowHover",!0)("sortOrder",1),a(7),p("label",c(10,7,"LANG_ACCESS_ASSIGNMENT")))},dependencies:[Pe,pe,re,se,ot,st,pt,Je,ne,tt],styles:["#staytax-list-component p-panel button{margin-right:5px} #staytax-list-component p-panel p-header{display:unset!important;padding-left:unset!important;padding-right:unset!important}"],changeDetection:0})}}return n})();var ue=(()=>{class n{constructor(e,i){this._provider=e,this._store=i}resolve(e){return this._store.dispatch(new te),this._provider.getStayList()}static{this.\u0275fac=function(i){return new(i||n)(F(I),F(ee))}}static{this.\u0275prov=D({token:n,factory:n.\u0275fac})}}return n})();var Te=(()=>{class n{constructor(e,i){this._provider=e,this._store=i}resolve(e){let i=e.queryParams.optionid;return this._store.dispatch(new te),h(i)?this._provider.getStay():this._provider.getStay(i)}static{this.\u0275fac=function(i){return new(i||n)(F(I),F(ee))}}static{this.\u0275prov=D({token:n,factory:n.\u0275fac})}}return n})();var yt=[{path:"list",component:Tt,resolve:{StayTax:ue},data:{pageid:{hotel:"M92514"},infos:{title:"LANG_STAY_TAX_LIST",subtitle:"",helpid:"HELP_STAY_TAX_LIST"}}},{path:"detail",component:_t,resolve:{StayTax:Te},data:{infos:{title:"LANG_STAY_TAX_DETAIL",subtitle:"",helpid:"HELP_STAY_TAX_DETAIL",back:{title:"LANG_STAY_TAX_LIST",subtitle:"",route:"/tax/stay/list"}}}}];var zi=(()=>{class n{static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275mod=Ee({type:n})}static{this.\u0275inj=ve({providers:[I,ue,Te,de],imports:[Re.forChild(yt),ct]})}}return n})();export{zi as StayModule};
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.