"use strict";define(["app","handlebars","View","text!/v2/webapps/FirstAccess/Report/Templates/ReportTemplate.html","utils"],function(c,f,e,b,a){var d=e.extend({id:"reportView",overlay:null,report:"",reportTemplate:f.compile(b),events:{"click #continue":"closeView"},closeView:function(g){this.trigger("view:close");this.overlay.close();},initialize:function(g){e.prototype.initialize.apply(this,arguments);this.options=g||{};this.overlay=this.options.parent;},render:function(p,i,l,g,m){e.prototype.render.apply(this,arguments);this.setParent(p);this.report=i;this.$el.html(this.reportTemplate({msg:(g?a.localize(this,["report.receiptIsPrinting"]):"")}));this.overlay.render(true).$el.find("#overlay").html(this.$el);p.$el.prepend(this.overlay.$el);this.overlay.$el.css("visibility","visible");$("body").css("overflow","auto");this.overlay.$el.find("#overlay").css({width:"100%",height:"100%"});p.$el.css("visibility","hidden");this.$el.find("#continue").prop("disabled",true);$(window).scrollTop(0);var r=$("iframe");var q=r.contents();var o=r.get(0).contentDocument||(r.get(0).contentWindow?r.get(0).contentWindow.document:r.get(0).document);o.open();o.writeln(this.report);o.close();q.find("head").prepend('<meta name="format-detection" content="telephone=no" />');if(m===true){this.$el.find("#report").css({height:"100vh","max-height":"600px",background:"white",display:"block"});$("#report-container").removeClass();}else{q.find("html").css("overflow","hidden");var n=q.find(".crystalstyle > div:first");n.css("max-width","1200px");var j=n.last().css("height");this.$el.find("#report").css({height:isNaN(parseInt(j,10))?0:parseInt(j,10)+100+"px",display:"block"});this.$el.find("#report").css({height:isNaN(parseInt(j,10))?0:parseInt(j,10)+100+"px",display:"block"});}q.on("click",function(){$("body").trigger("mousemove");});if(g){var k=document.getElementById("report").contentWindow;k.focus();k.print();}if(g&&!l){this.overlay.$el.find("#overlay").css({width:"0",height:"0"});this.$el.css({width:"0",height:"0"});p.$el.css({visibility:"visible",overflow:"inherit"});$("#successPage").css({display:"block"});$("body").css("overflow","inherit");this.trigger("view:close");}this.$el.find("#continue").prop("disabled",false);this.overlay.hideSpinner();return this;}});return d;});