"use strict";(this.webpackChunk_tsmesolutions_cubes_initiatives=this.webpackChunk_tsmesolutions_cubes_initiatives||[]).push([[6869],{56869:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var o=n(24590);const i={is:{type:[String,Object]},title:String,subTitle:String,date:Date,filter:Object};var r=n(90726),l=n(91123),a=n(19244);function s(e,t,n,o,i,r,l){try{var a=e[r](l),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(o,i)}const c={key:0,class:"print"},u=(0,o.defineComponent)({__name:"pdf",props:i,emits:["print-complete"],setup(e,t){let{expose:n,emit:i}=t;const u=e,p=i,d=r.IoC.DI().resolve(a.St.AppService.key),m=(r.IoC.DI().resolve(a.St.ThemeManager.key),r.IoC.DI().resolve(a.St.PDFService.key)),f=(0,o.toRef)((0,l.useTranslation)(d),"tGlobal"),v=(0,o.toRef)(u,"is"),h=(0,o.toRef)(u,"subTitle"),y=(0,o.ref)(!1),b=(0,o.computed)(()=>[{},{component:v.value}]),k=e=>new Promise(function(){var t,n=(t=function*(t,n){try{const o=document.cloneNode(!0),i=o.qs("base"),l=window.location.origin+i.attr("href");i.attr("href",l);const a=o.qs("head");a.prepend(i),(0,r.find)("script",e=>a?.removeChild(e),a);const s=o.qs(`${e??""} .print`);s.classList.remove("d-none");const c=o.createElement("body");c.classList.add("bg-white"),c.classList.add("overflow-auto"),c.appendChild(s),o.body.replace(c);try{yield m.printAsync({data:JSON.stringify((0,r.htmlEncode)(o.documentElement)),headers:{"Content-Type":"application/json"},query:{layout:window.configure().pdfLayout??"adeo",fileName:h.value??null,ext:"pdf"}}),t({data:"1"})}catch(e){d.error(f.value.requestError,void 0,"pdf::printReport"),n(e)}}catch(e){n(e)}finally{p("print-complete")}},function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function l(e){s(r,o,i,l,a,"next",e)}function a(e){s(r,o,i,l,a,"throw",e)}l(void 0)})});return function(e,t){return n.apply(this,arguments)}}());return(0,o.onMounted)(()=>{y.value=!0}),n({exportReport:e=>()=>new Promise(t=>{y.value=!0,(0,o.nextTick)(()=>{setTimeout(()=>t(k(e)),2e3)})})}),(e,t)=>y.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",c,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(b.value,t=>((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(t.component),{title:e.title,subTitle:{ar:"subTitle",en:"subTitle"},date:e.date,filter:e.filter},null,8,["title","date","filter"]))),256))])):(0,o.createCommentVNode)("v-if",!0)}}),p=u}}]);
//# sourceMappingURL=b851ec2ac9da626164be.js.map