1"use strict";(self.webpackChunkDashboard=self.webpackChunkDashboard||[]).push([[1802],{48549:(e,t,o)=>{o.r(t),o.d(t,{default:()=>m});var i=o(2934),r=o.n(i),s=o(46015),a=o(76610),c=o(4267),n=o(23919),l=o.n(n);r().use(l());const d={name:"PublishedBooksMetadataSalesPrice",components:{AlertContainer:function(){return o.e(7561).then(o.bind(o,89451))}},data:function(){return{currencyCode:this.$t("general.currencyISO"),salesPriceEdit:!1,salesPriceOptions:[],salesPriceSelected:"",salesPriceRevenue:{net:"0.00 "+this.$t("general.currencyISO"),percent:"0%",shopNet:"0.00 "+this.$t("general.currencyISO"),shopPercent:"0%"},salesPriceRange:{min:2.99,max:9.99},promoPriceEdit:!1,promoPriceOptions:[],promoPriceSelected:"",promoPriceRevenue:{net:"0.00 "+this.$t("general.currencyISO"),percent:"0%",shopNet:"0.00 "+this.$t("general.currencyISO"),shopPercent:"0%"},promoPriceMin:.99,promoPriceMax:{de:10,ch:10,fi:10,fr:10,es:10,dk:85,se:119,no:125},promoPriceRuntimeOptions:[1,2,4,8],promoPriceRuntimeSelected:1,promoPriceStartDate:null,alert:{state:"",text:""},alertStartDate:{state:"",text:""},finalSaved:!1,isSendLoading:!1}},props:{data:{type:Object,required:!0}},computed:{isoLocale:function(){return s.ND},userPersId:function(){return this.$store.getters.user.persId},version:function(){return this.data.version},ebookVersion:function(){return this.data.ebookVersion},salesPrice:function(){return this.data.current.salesPrice},oldSalesPrice:function(){return{price:this.finalSaved?this.salesPriceSelected:this.salesPrice.price,dateFromText:this.finalSaved?"":this.oldSalesPriceDate.dateFromText,dateFrom:this.finalSaved?"":this.oldSalesPriceDate.dateFrom,dateToText:this.finalSaved?"":this.oldSalesPriceDate.dateToText,dateTo:this.finalSaved?"":this.oldSalesPriceDate.dateTo}},oldSalesPriceDate:function(){return this.salesPrice.salesPriceDate},oldPromoPrice:function(){return this.finalSaved?{dateFrom:this.promoPriceStartDate?this.$moment(this.promoPriceStartDate).format("DD.MM.YYYY"):"",dateFromText:this.promoPriceStartDate?this.$t("publishedbooksmetadata.salesPrice.runningTimeActionStart"):this.$t("publishedbooksmetadata.salesPrice.runningTimePublication"),dateTo:"",dateToText:"",price:this.promoPriceSelected,time:this.promoPriceRuntimeSelected,timeText:"",timeUnit:" "+(1===this.promoPriceRuntimeSelected?this.$t("general.week"):this.$t("general.weeks"))}:this.salesPrice.salesPricePromo},allowEdit:function(){return this.data.allowEdit.salesPrice},allowSalesPriceEdit:function(){return this.allowEdit.price.status&&this.isEbook&&!this.finalSaved},allowPromoPriceEdit:function(){var e={min:this.salesPriceSelected>this.promoPriceMin,max:this.salesPriceSelected<this.promoPriceMax[s.$r]};return this.allowEdit.promo.status&&e.min&&e.max},allowPromoPriceStartDateEdit:function(){return this.allowEdit.date.status},isEbook:function(){return!this.noEbook},noEbook:function(){return"noebook"==this.allowEdit.price.status},newVersionInProcess:function(){return"inProcess"==this.data.newVersion.status},startDateMin:function(){return this.$moment().add(2,"days").format()},startDateMax:function(){return this.$moment().add(6,"months").format()},promoPriceSummary:function(){return this.$t("publishedbooksmetadata.salesPrice.editPromoPriceSummary",{publication:this.promoPriceStartDate?"<b>".concat(this.$moment(this.promoPriceStartDate).format("DD.MM.YYYY"),"</b>"):"<span>".concat(this.$t("publishedbooksmetadata.salesPrice.publication"),"</span>"),runtime:"<b>".concat(this.getWeekName(this.promoPriceRuntimeSelected),"</b>"),promoPrice:"<b>".concat(this.formatPrice(this.promoPriceSelected),"</b>"),salesPrice:"<b>".concat(this.formatPrice(this.salesPriceSelected),"</b>")})},alertRecommendedSalesPrice:function(){var e=this.salesPriceRange.min,t=this.salesPriceRange.max;return this.salesPriceSelected<e||this.salesPriceSelected>t?{state:"info",text:this.$t("publishedbooksmetadata.salesPrice.alertRecommendedInfoText",{min:this.formatPrice(e),max:this.formatPrice(t)})}:{state:"success",title:this.$t("publishedbooksmetadata.salesPrice.alertRecommendedSuccessTitle"),text:this.$t("publishedbooksmetadata.salesPrice.alertRecommendedSuccessText")}},editMessage:function(){return this.allowEdit.price.message},editDateMessage:function(){return this.allowEdit.date.message}},mounted:function(){this.salesPrice&&(this.currencyCode=this.salesPrice.currency),this.editMessage&&(this.alert={state:"info",text:this.editMessage}),this.editDateMessage&&(this.alertStartDate={state:"info",text:this.editDateMessage})},methods:{frSpaces:c.TX,formatNumberFixed:function(e){return(0,c.uf)(e,2,"",".")},formatPrice:function(e){return(0,c.zc)(e,this.currencyCode)},formatPriceRevenue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"shop"==t?e.shopNet+" ("+e.shopPercent+")":e.net+" ("+e.percent+")"},getWeekName:function(e){return(e<1?"0":e)+" "+(1===e?this.$t("general.week"):this.$t("general.weeks"))}
1,showEditView:function(){this.loadSalesPrice(),this.salesPriceEdit=!0},hideEditView:function(){this.salesPriceEdit=!1,this.hidePromoPriceEditView(),this.finalSaved||(this.salesPriceOptions=[],this.salesPriceSelected="",this.salesPriceRevenue={net:"0.00 "+this.currencyCode,percent:"0%",shopNet:"0.00 "+this.currencyCode,shopPercent:"0%"})},showPromoPriceEditView:function(){this.allowPromoPriceStartDateEdit&&(this.promoPriceStartDate=this.$moment(this.startDateMin).toDate()),this.loadPromoPrice(this.salesPriceSelected),this.promoPriceEdit=!0},hidePromoPriceEditView:function(){this.promoPriceEdit=!1,this.finalSaved||(this.promoPriceOptions=[],this.promoPriceSelected="",this.promoPriceRevenue={net:"0.00 "+this.currencyCode,percent:"0%",shopNet:"0.00 "+this.currencyCode,shopPercent:"0%"},this.promoPriceRuntimeSelected=1,this.promoPriceStartDate=null)},loadSalesPrice:function(){var e=this,t=this.data.salesPrice;"ebook"==this.data.type&&(t=1e3);var o={salesPrice:parseFloat(t),product:this.data.product};a.hi.post("/v1/me/pricecalculation/ebookpriceselection",o).then((function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.data;o.ebookSelection?e.salesPriceOptions=o.ebookSelection:e.salesPriceOptions=[o.ebookSalesPriceRecommended];var i=e.salesPriceOptions.includes(e.salesPrice.price.toString())?e.salesPrice.price:o.ebookSalesPriceRecommended;e.salesPriceSelected=i?e.formatNumberFixed(i):e.salesPriceOptions[0],o.ebookMargeRecommendedNet&&o.ebookMargeRecommendedPercent&&o.ebookMargeBoDShopRecommendedNet&&o.ebookMargeBoDShopRecommendedPercent&&e.updateRevenueData("salesPrice",o.ebookMargeRecommendedNet,o.ebookMargeRecommendedPercent,o.ebookMargeBoDShopRecommendedNet,o.ebookMargeBoDShopRecommendedPercent),e.loadPriceRevenue("salesPrice",e.salesPriceSelected)})).catch((function(e){console.error(e)}))},loadPromoPrice:function(e){var t=this,o={salesPrice:parseFloat(e),product:this.data.product,isPromo:!0};a.hi.post("/v1/me/pricecalculation/ebookpriceselection",o).then((function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.data;o.ebookSelection?t.promoPriceOptions=o.ebookSelection:t.promoPriceOptions=[o.ebookSalesPriceRecommended];var i=t.promoPriceSelected;i||(i=t.oldPromoPrice.price),t.promoPriceSelected=t.formatNumberFixed(t.promoPriceOptions.includes(i)?i:o.ebookSalesPriceRecommended),t.updateRevenueData("promoPrice",o.ebookMargeRecommendedNet,o.ebookMargeRecommendedPercent,o.ebookMargeBoDShopRecommendedNet,o.ebookMargeBoDShopRecommendedPercent),t.loadPriceRevenue("promoPrice",t.promoPriceSelected)})).catch((function(e){console.error(e)}))},loadPriceRevenue:function(e,t){var o=this,i={ebookSalesPrice:parseFloat(t)};a.hi.post("/v1/me/pricecalculation/ebookmarge",i).then((function(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.data;o.updateRevenueData(e,r.ebookMargeNet,r.ebookMargePercent,r.ebookMargeBoDShopNet,r.ebookMargeBoDShopPercent),"salesPrice"==e&&o.promoPriceEdit&&o.loadPromoPrice(t)})).catch((function(e){console.error(e)}))},updateRevenueData:function(e,t,o,i,r){"salesPrice"==e&&(this.salesPriceRevenue={net:t,percent:o,shopNet:i,shopPercent:r}),"promoPrice"==e&&(this.promoPriceRevenue={net:t,percent:o,shopNet:i,shopPercent:r})},saveFinalSalesPrice:function(){var e=this;if(this.salesPriceSelected&&"0.00"!=this.salesPriceSelected){this.isSendLoading=!0;var t={id:this.data.id},o={version:this.version,salesPrice:{ebookVersionPrice:parseInt(this.ebookVersion),ebookSalesPrice:parseFloat(this.salesPriceSelected),ebookPromoPrice:this.promoPriceEdit?parseFloat(this.promoPriceSelected):null,ebookPromoTime:this.promoPriceEdit?7*this.promoPriceRuntimeSelected:null,ebookPromoStart:this.promoPriceEdit&&this.promoPriceStartDate?this.$moment(this.promoPriceStartDate).format("DD-MM-YYYY"):null}};a.hi.post("/v1/me/books/{id}/metadata",o,t).then((function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.data;e.alert={state:"success",text:o.message},e.finalSaved=!0,e.isSendLoading=!1,e.hideEditView()})).catch((function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.response;e.alert={state:"error",text:Object.values(o.data)[0]},e.isSendLoading=!1,e.hideEditView()}))}else this.hideEditView()}}};const m=(0,o(51900).Z)(d,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"published-books-metadata-sales-price"},[o("h2",{staticClass:"display-4 fw-bold text-bodblue-dark"},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.title"))+"\n ")]),e._v(" "),e.noEbook?[o("p",[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.descriptionPrintOnly"))+"\n ")]),e._v(" "),e.newVersionInProcess?[o("router-link",{staticClass:"btn btn-dark rounded-pill px-4 mt-4",attrs:{to:{name:"project-basics",params:{projectId:e.data.newVersion.projectId}}}},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.btnNeweditionEdit"))+"\n ")])]:[o("router-link",{staticClass:"btn btn-dark rounded-pill px-4 mt-4",attrs:{to:{name:"project-start",query:{objectId:e.data.id}}}},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.btnNeweditionNew"))+"\n ")])]]:[o("p",[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.description"))+"\n ")])],e._v(" "),e.salesPriceEdit?[o("div",{staticClass:"bg-bodgrey-light rounded p-3"},[o("div",{staticClass:"row row-cols-md-2 g-3"},[o("div",{staticClass:"col-lg-8"},[o("b",{staticClass:"d-block"},[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editSalesPriceHeadline")))]),e._v(" "),o("small",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editSalesPriceDesc")))])]),e._v(" "),o("div",{staticClass:"col-lg-4 order-lg-first"},[e.salesPriceOptions.length?o("select",{directives:[{name:"model",rawName:"v-model",value:e.salesPriceSelected,expression:"salesPriceSelected"}],staticClass:"form-select",on:{change:[function(t){var o=Array.prototype.filter.call(t.target.options,
1(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.salesPriceSelected=t.target.multiple?o:o[0]},function(t){return e.loadPriceRevenue("salesPrice",e.salesPriceSelected)}]}},e._l(e.salesPriceOptions,(function(t){return o("option",{domProps:{value:t}},[e._v(e._s(e.formatPrice(t)))])})),0):o("span",[o("i",{staticClass:"fa-duotone fa-spinner-third fa-spin"}),e._v("\n "+e._s(e.$t("general.loading"))+"\n ")])]),e._v(" "),o("div",{staticClass:"col-lg-6"},[o("b",{staticClass:"d-block"},[e._v(e._s(e.formatPriceRevenue(e.salesPriceRevenue)))]),e._v(" "),o("small",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editSalesPriceRevenueDesc")))])]),e._v(" "),o("div",{staticClass:"col-lg-6"},[o("b",{staticClass:"d-block"},[e._v(e._s(e.formatPriceRevenue(e.salesPriceRevenue,"shop")))]),e._v(" "),o("small",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editSalesPriceRevenueShopDesc")))])])])]),e._v(" "),o("alert-container",{staticClass:"mt-2",attrs:{data:e.alertRecommendedSalesPrice,layoutType:2}}),e._v(" "),e.allowPromoPriceEdit?o("div",{staticClass:"bg-bodgrey-light rounded mt-4"},[o("div",{staticClass:"card-body p-3"},[o("h2",[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceHeadline"))+"\n ")]),e._v(" "),o("p",[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceDesc"))+"\n ")]),e._v(" "),e.promoPriceEdit?[o("div",{staticClass:"row mb-3"},[o("label",{staticClass:"col-lg-8 col-form-label",attrs:{for:"promoPriceSelected"}},[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceLabelPromoPrice"))+e._s(e.frSpaces(":")))]),e._v(" "),o("div",{staticClass:"col-lg-8"},[o("select",{directives:[{name:"model",rawName:"v-model",value:e.promoPriceSelected,expression:"promoPriceSelected"}],staticClass:"form-select",attrs:{id:"promoPriceSelected"},on:{change:[function(t){var o=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.promoPriceSelected=t.target.multiple?o:o[0]},function(t){return e.loadPriceRevenue("promoPrice",e.promoPriceSelected)}]}},e._l(e.promoPriceOptions,(function(t){return o("option",{domProps:{value:t}},[e._v(e._s(e.formatPrice(t)))])})),0)])]),e._v(" "),o("div",{staticClass:"row mb-3"},[o("div",{staticClass:"col offset-lg-8"},[o("b",{staticClass:"d-block"},[e._v(e._s(e.formatPriceRevenue(e.promoPriceRevenue)))]),e._v(" "),o("small",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceRevenueDesc")))])]),e._v(" "),o("div",{staticClass:"col"},[o("b",{staticClass:"d-block"},[e._v(e._s(e.formatPriceRevenue(e.promoPriceRevenue,"shop")))]),e._v(" "),o("small",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceRevenueShopDesc")))])])]),e._v(" "),o("div",{staticClass:"row mb-3"},[o("label",{staticClass:"col-lg-8 col-form-label",attrs:{for:"promoPriceRuntime"}},[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceLabelRunningTime"))+e._s(e.frSpaces(":")))]),e._v(" "),o("div",{staticClass:"col-lg-8"},[o("select",{directives:[{name:"model",rawName:"v-model",value:e.promoPriceRuntimeSelected,expression:"promoPriceRuntimeSelected"}],staticClass:"form-select",attrs:{id:"promoPriceRuntime"},on:{change:function(t){var o=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.promoPriceRuntimeSelected=t.target.multiple?o:o[0]}}},e._l(e.promoPriceRuntimeOptions,(function(t){return o("option",{domProps:{value:t}},[e._v(e._s(e.getWeekName(t)))])})),0)])]),e._v(" "),e.allowPromoPriceStartDateEdit?o("div",{staticClass:"row mb-3"},[o("label",{staticClass:"col-lg-8 col-form-label",attrs:{for:"promoPriceStartDate"}},[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceLabelStartDate"))+e._s(e.frSpaces(":")))]),e._v(" "),o("div",{staticClass:"col-lg-8"},[o("v-date-picker",{staticClass:"d-inline-block",attrs:{id:"promoPriceStartDate",locale:e.isoLocale,color:"gray","min-date":e.startDateMin,"max-date":e.startDateMax},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.togglePopover;return[o("button",{staticClass:"btn btn-outline-dark rounded-pill px-3",attrs:{type:"button"},on:{click:function(e){return i({placement:"bottom-start"})}}},[e.promoPriceStartDate?[o("i",{staticClass:"fa-light fa-calendar-lines text-bodgrey-dark me-1"}),e._v("\n "+e._s(e.$moment(e.promoPriceStartDate).format("DD.MM.YYYY"))+"\n ")]:[e._v("\n "+e._s(e.$t("general.pleaseChoose"))+"\n ")]],2)]}}],null,!1,1157047696),model:{value:e.promoPriceStartDate,callback:function(t){e.promoPriceStartDate=t},expression:"promoPriceStartDate"}}
1)],1)]):e._e(),e._v(" "),e.alertStartDate.state?o("alert-container",{attrs:{data:e.alertStartDate,layoutType:2}}):e._e(),e._v(" "),o("div",{staticClass:"card mb-3"},[o("div",{staticClass:"card-body lead m-0",domProps:{innerHTML:e._s(e.promoPriceSummary)}})]),e._v(" "),o("a",{staticClass:"text-dark",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.hidePromoPriceEditView(t)}}},[o("i",{staticClass:"fa-regular fa-trash-can me-2"}),e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceBtnRemove"))+"\n ")])]:o("button",{staticClass:"btn btn-dark rounded-pill px-4",on:{click:function(t){return t.preventDefault(),e.showPromoPriceEditView(t)}}},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.salesPrice.editPromoPriceBtnAdd"))+"\n ")])],2)]):e._e(),e._v(" "),o("div",{staticClass:"d-flex justify-content-between justify-content-md-end align-items-center mt-5"},[o("button",{staticClass:"btn btn-outline-dark rounded-pill px-4 me-4",attrs:{disabled:e.isSendLoading},on:{click:function(t){return t.preventDefault(),e.hideEditView(t)}}},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.btnCancel"))+"\n ")]),e._v(" "),o("button",{staticClass:"btn btn-bodorange rounded-pill px-4",attrs:{disabled:e.isSendLoading},on:{click:function(t){return t.preventDefault(),e.saveFinalSalesPrice(t)}}},[e.isSendLoading?[o("i",{staticClass:"fa-duotone fa-spinner-third fa-spin"}),e._v("\n "+e._s(e.$t("general.loading"))+"\n ")]:[e._v(e._s(e.$t("publishedbooksmetadata.btnSave")))]],2)])]:[e.isEbook?o("div",[o("p",[o("b",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.overviewRetailPriceHeadline"))+e._s(e.frSpaces(":")))]),e._v(" "),e.oldSalesPrice.price&&"0.00"!=e.oldSalesPrice.price?[e._v("\n "+e._s(e.formatPrice(e.oldSalesPrice.price))+"\n ")]:[e._v(" - ")],e._v(" "),e.oldSalesPrice.dateFrom?o("span",[o("br"),e._v(e._s(e.oldSalesPrice.dateFromText)+" "+e._s(e.$moment(e.oldSalesPrice.dateFrom).format("DD.MM.YYYY"))+"\n ")]):e._e(),e._v(" "),e.oldSalesPrice.dateTo?o("span",[o("br"),e._v(e._s(e.oldSalesPrice.dateToText)+" "+e._s(e.$moment(e.oldSalesPrice.dateTo).format("DD.MM.YYYY"))+"\n ")]):e._e()],2),e._v(" "),e.oldPromoPrice.price?o("p",[o("b",[e._v(e._s(e.$t("publishedbooksmetadata.salesPrice.overviewPromoPriceHeadline"))+e._s(e.frSpaces(":")))]),e._v("\n "+e._s(e.formatPrice(e.oldPromoPrice.price))+"\n\n "),e.oldPromoPrice.timeText&&e.oldPromoPrice.time&&e.oldPromoPrice.timeUnit?o("span",[o("br"),e._v(e._s(e.oldPromoPrice.timeText)+e._s(e.frSpaces(":"))+" "+e._s(e.oldPromoPrice.time)+" "+e._s(e.oldPromoPrice.timeUnit)+"\n ")]):e._e(),e._v(" "),e.oldPromoPrice.dateFrom?o("span",[o("br"),e._v(e._s(e.oldPromoPrice.dateFromText)+" "+e._s(e.oldPromoPrice.dateFrom)+"\n\n "),e.oldPromoPrice.dateTo?o("span",[e._v("\n - "+e._s(e.oldPromoPrice.dateToText)+" "+e._s(e.oldPromoPrice.dateTo)+"\n ")]):e._e(),e._v(" "),e.oldPromoPrice.time&&e.oldPromoPrice.timeUnit?o("span",[e._v("\n "+e._s(e.frSpaces(":"))+" "+e._s(e.oldPromoPrice.time)+" "+e._s(e.oldPromoPrice.timeUnit)+"\n ")]):e._e()]):e._e()]):e._e()]):e._e(),e._v(" "),e.alert.state?o("alert-container",{attrs:{data:e.alert,layoutType:2}}):e._e(),e._v(" "),e.allowSalesPriceEdit?[o("button",{staticClass:"btn btn-dark rounded-pill px-4",on:{click:function(t){return t.preventDefault(),e.showEditView(t)}}},[e._v("\n "+e._s(e.$t("publishedbooksmetadata.btnEdit"))+"\n ")])]:e._e()]],2)}),[],!1,null,null,null).exports}}]);
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.