import{a as j}from"./chunk-IXE5UUCP.js";import{a as H,b as R,c as W}from"./chunk-HHGPGR2L.js";import{a as A}from"./chunk-Q6YQJFNJ.js";import{b as B}from"./chunk-SPNVV2KO.js";import{k as N}from"./chunk-ZTKV4AIV.js";import{Ha as Q,Ja as L,ba as I,da as z}from"./chunk-JIDGXFMJ.js";import{j as O,p as F}from"./chunk-YJYOGSOO.js";import{Ab as M,Bc as D,Hb as _,Ic as c,Jb as v,Jc as p,Ob as T,Qb as k,Rb as q,Sb as o,Tb as a,Ub as C,hb as t,ib as h,ic as m,jc as S,qa as P,vc as s,wc as x,xc as u,yc as w}from"./chunk-FWZCAEAJ.js";import{f as E}from"./chunk-CWTPBX7D.js";var G=(i,r)=>r.id;function J(i,r){if(i&1&&C(0,"ngb-progressbar",15),i&2){let b=S();_("value",b.progress)("showValue",!0)}}function U(i,r){i&1&&(o(0,"div",16),s(1),c(2,"tr"),a()),i&2&&(t(),u("",p(2,1,"DO_NOT_CLOSE_WINDOW"),"!"))}function K(i,r){if(i&1&&(o(0,"div",17),C(1,"qrcode",18),o(2,"div",19)(3,"b"),s(4),a()()()),i&2){let b=r.$implicit,n=S();t(),_("imageSrc",n.qrCodeSize==="MD"?"/assets/mono.png":void 0)("imageWidth",60)("imageHeight",60)("size",8)("errorCorrectionLevel",n.qrCodeSize==="MD"?"H":"M")("margin",0)("data",n.parser(b)),t(3),w("",b.group.name," - ",b.number,"")}}var se=(()=>{let r=class r{constructor(n,l){this.activeModal=n,this.mobileLink=l,this.qrCodeSize="MD",this.generating=!1,this.parser=e=>this.mobileLink.createTableLink(e.publicId),this.getQrCodeSize=()=>{switch(this.qrCodeSize){case"SM":return 118;case"MD":return 167;default:throw Error("Uknown qr code size")}},this.getQrCodePadding=()=>{switch(this.qrCodeSize){case"SM":return 20;case"MD":return 13;default:throw Error("Uknown qr code size")}}}pdf(){return E(this,null,function*(){this.generating=!0,this.progress=1;let n=document.getElementsByClassName("qr-code-item"),l=new R("p","pt","a4",!0),e=this.getQrCodeSize()+31,d=0,f=0,V=100/n.length;for(let g=0;g<n.length;g++){let y=n.item(g);if(y){let $=yield H(y,{quality:.7,backgroundColor:"#FFFFFF"});l.addImage($,"JPEG",d,f,e,e+this.getQrCodePadding()),d+=e}d>500&&(d=0,f+=e+this.getQrCodePadding()),f>760&&(g+1<n.length&&l.addPage(),d=0,f=0),this.progress+=V}l.save(`tables-${N(new Date)??""}.pdf`),this.generating=!1,this.progress=void 0})}};r.\u0275fac=function(l){return new(l||r)(h(z),h(j))},r.\u0275cmp=P({type:r,selectors:[["app-print-table-qr-codes-modal"]],inputs:{tables:"tables"},standalone:!0,features:[D],decls:31,vars:24,consts:[[1,"modal-header"],["id","app-tables-qr-codes-title",1,"modal-title"],["type","button","aria-label","Close",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body","d-flex","flex-column","gap-3"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["name","printer"],["role","group","aria-label","QRCode size",1,"btn-group","flex-wrap"],["type","button",1,"btn","btn-sm","btn-outline-secondary",3,"click"],["type","primary","class","my-2","textType","white",3,"value","showValue"],["role","alert",1,"alert","alert-info","mb-2"],["class","alert alert-info","role","alert"],[1,"main"],[1,"d-flex","flex-wrap","justify-content-center"],[1,"modal-footer"],["type","button",1,"btn","btn-outline-secondary",3,"click"],["type","primary","textType","white",1,"my-2",3,"value","showValue"],["role","alert",1,"alert","alert-info"],[1,"qr-code-item"],["cssClass","text-center","elementType","canvas",3,"imageSrc","imageWidth","imageHeight","size","errorCorrectionLevel","margin","data"],[1,"text-center","text-black","qr-code-label"],["class","qr-code-item"]],template:function(l,e){l&1&&(o(0,"div",0)(1,"h4",1),s(2),c(3,"tr"),a(),o(4,"button",2),m("click",function(){return e.activeModal.dismiss()}),a()(),o(5,"div",3)(6,"scrollable-toolbar")(7,"div")(8,"button",4),m("click",function(){return e.pdf()}),C(9,"bi",5),s(10),c(11,"tr"),a()(),o(12,"div",6)(13,"button",7),m("click",function(){return e.qrCodeSize="SM"}),s(14),c(15,"tr"),a(),o(16,"button",7),m("click",function(){return e.qrCodeSize="MD"}),s(17),c(18,"tr"),a()()(),M(19,J,1,2,"ngb-progressbar",8),o(20,"div",9),s(21,"Deaktiviere m\xF6gliche Seitenr\xE4nder beim drucken."),a(),M(22,U,3,3,"div",10),o(23,"div",11)(24,"div",12),k(25,K,5,9,"div",20,G),a()()(),o(27,"div",13)(28,"button",14),m("click",function(){return e.activeModal.close()}),s(29),c(30,"tr"),a()()),l&2&&(t(2),x(p(3,14,"HOME_TABLE_PRINT_TITLE")),t(6),v("spinner",e.generating),_("disabled",e.generating),t(2),u(" ",p(11,16,"HOME_TABLE_PRINT_GENERATE")," "),t(3),v("active",e.qrCodeSize==="SM"),t(),u(" ",p(15,18,"HOME_TABLE_PRINT_SM")," "),t(2),v("active",e.qrCodeSize==="MD"),t(),u(" ",p(18,20,"HOME_TABLE_PRINT_MD")," "),t(2),T(19,e.progress?19:-1),t(3),T(22,e.generating?22:-1),t(3),q(e.tables),t(4),x(p(30,22,"CLOSE")))},dependencies:[L,Q,F,O,W,A,B,I],styles:[".main[_ngcontent-%COMP%]{background-color:#fff}.qr-code-item[_ngcontent-%COMP%]{border-style:dashed;border-color:#ccc;border-width:1px;padding:25px 31px 15px}.qr-code-label[_ngcontent-%COMP%]{font-size:40px}"]});let i=r;return i})();export{se as a};
