/** * Componente para chamada da tela de informar um problema no sistema * @author Arlindo Rodrigues */ "use strict"; class InformarProblemaButton extends HTMLElement { constructor() { super(); } getAttributes(){ var data = {}; data['usuario'] = this.getAttribute('data-usuario') ? this.getAttribute('data-usuario') : "-"; data['idUsuario'] = this.getAttribute('data-id')? this.getAttribute('data-id') : "0"; data['sistema'] = this.getAttribute('data-sistema') ? this.getAttribute('data-sistema'): "0"; data['urlBase'] = this.getAttribute('data-url') ? this.getAttribute('data-url') : ""; data['url'] = window.location.href; data['email'] = this.getAttribute('data-email') ? this.getAttribute('data-email') : "-"; data['modulo'] = this.getAttribute('data-modulo')? this.getAttribute('data-modulo') : "INDEFINIDO"; data['registroEntrada'] = this.getAttribute('data-registro-entrada') ? this.getAttribute('data-registro-entrada') : "0"; data['dialog'] = this.getAttribute('data-dialog') ? this.getAttribute('data-dialog') : 'yahoo'; return data; } createContent(params){ var iframe = ""; var content ="
Carregando...';
jQuery("#dialog-info-problema").find('iframe').html("").attr("src","javascript:'"+htmlLoading+"'");
}
submeterRelatorio(params){
this.showLoading();
submeter(params);
}
}
var dialogInfoProblema = (function() {
var painel;
return {
show : function(){
jQuery("#dialog-info-problema").attr('style', 'display:inline');
painel = new YAHOO.ext.BasicDialog("dialog-info-problema", {
modal: true,
width: 930,
height: 760,
shadow: false,
fixedcenter: true,
resizable: false,
closable: true
});
painel.show();
jQuery("#dialog-info-problema .ydlg-close").html("");
}
};
})();
document.registerElement("informar-problema", InformarProblemaButton);
function redirectPost(params){
var form = '';
jQuery.each( params, function( key, value ) {
value = value.split('"').join('\"')
form += '';
});
var formHtml = jQuery('').appendTo(jQuery(document.body));
formHtml.submit();
}
var submeter = function(params) {
html2canvas(document.body, {
onrendered: function (canvas) {
if (params['dialog'] == 'yahoo')
dialogInfoProblema.show();
params['print'] = canvas.toDataURL("image/png");;
redirectPost(params);
}
});
}