function PopupIt(url,title,size) // small o full
{
let popup;
//console.log('showing poput to '+url);
//console.log('size ',size);
// $('.popup-datos').load(url);
$('#modalIcon'+size).modal('show').find('.modal-body').load(url, function(responseTxt, statusTxt, xhr){
if(statusTxt == "success")
// $('#modalIconButtons').on('shown.bs.modal', function (e) {
// console.log('modal shown');
var modal = $(this) ;
//console.log('title:',title);
//modal.find('#modalTitleIcons').text(title);
$('#modalIcon'+size).find('.modal-title').text( decodeURI( title ) );
//$('#modalTitleIcons').text(title);
// })
});
}
function ShowInPanelFrame(url,title ='',size = 'small')
{
ShowLoader();
$('#panel-'+size).modal('show');
document.getElementById('frame').src = url;
$('#panel-'+size).on('shown.bs.modal', function (e) {
//console.log('modal shown','panel-'+size);
var modal = $(this) ;
modal.find('.modal-title').text(title);
}) ;
}
async function ShowInPanel(url,title ='',size = 'small')
{
//console.log('modal loading url => ',url);
//console.log('modal loading size => ',size);
//console.log('modal loading title => ',title);
//console.log('size', size);
//ShowLoader();
$('#panel-'+size).modal('show').find('.modal-body').load(url,
function(responseTxt, statusTxt, xhr){
var err = xhr.status ;
var errtxt = xhr.statusText;
// if(statusTxt == "success")
// alert("External content loaded successfully!");
if(statusTxt == "error") {
$('#panel-'+size).modal('show').find('.modal-body').html(
`
Ocurrio un error inesperado al cargar los datos
Error:` + err + `: ` + errtxt +`
`);
$('#guarda_datos').hide();
}
}
);
$('#panel-'+size).on('shown.bs.modal', function (e) {
//console.log('modal shown','panel-'+size);
var modal = $(this) ;
modal.find('.modal-title').text(title);
}).on('hide.bs.modal', function (e) {
//onCloseModal();
if(typeof onCloseModal === 'function') {
//console.log('closing modal from js');
onCloseModal();
}
}) ;
}
// la misma funcion que show pero recibiendo el url sin Url.Content("~/")
function RPanel(url,title ='')
{
//console.log('modal loading url => ',url);
myApp.views.main.router.navigate('/rpanel/');
var rightPanelView = myApp.views.create('.panel-right', {
pushState: true,
url: '/' // Define la URL inicial de esta vista, si es necesario
});
myApp.off('panelOpened');
myApp.on('panelOpened', function (rpanel) {
//console.log('rpanel.name',rpanel);
if (rpanel.side === 'right') {
// console.log('El panel derecho está abierto', rpanel);
// Establece el título
$('.rpanel-title').text(decodeURIComponent(title));
//console.log('open rpanel url:', url);
$('#data-panel').load('/'+url,
function(responseTxt, statusTxt, xhr) {
var err = xhr.status;
var errtxt = xhr.statusText;
if (xhr.status == 401) {
var Url = '/login/';
window.location.href = Url;
}
if (statusTxt == "error") {
$('#data-panel').html(
`
Ocurrio un error inesperado al cargar los datos
Error:` + err + `: ` + errtxt + `
`
);
$('#guarda_datos').hide();
}
});
rpanel.off('close'); // remuevo la definicion anterior para que no se acumulen
rpanel.on('close', function(e) {
//console.log('closing panel from js');
if (typeof onCloseModal === 'function') {
if (!onCloseModal()) {
myApp.panel.close('.panel-right', true);
}
}
});
}
});
}
/*
// la misma funcion que show pero recibiendo el url sin Url.Content("~/")
function RPanel(url,title ='')
{
//console.log('modal loading url => ','/'+url);
myApp.views.main.router.navigate('/rpanel/');
var rpanel = myApp.panel.get('.panel-right');
var rightPanelView = myApp.views.create('.panel-right', {
pushState: true,
url: '/'
});
//console.log('panel view created');
//console.log('panel',rpanel);
if (rpanel.opened) {
//console.log('panel derecho abierto!');
// set title
$('.rpanel-title').text( decodeURIComponent(title ) );
//console.log('open rpanel url:',url);
$('#data-panel').load('/'+url,
function(responseTxt, statusTxt, xhr){
var err = xhr.status ;
var errtxt = xhr.statusText;
if (xhr.status == 401) // si es error de autenticacion lo envio al login
{
var Url = '/login/';
window.location.href = Url;
}
if(statusTxt == "error") {
$('#data-panel').html(
`
Ocurrio un error inesperado al cargar los datos
Error:` + err + `: ` + errtxt +`
`);
$('#guarda_datos').hide();
}
}
);
}
rpanel.on('close', function (e) {
//console.log('closing panel from js');
if (typeof onCloseModal === 'function') {
if (!onCloseModal()) {
myApp.panel.close('.panel-right', true);
}
}
} );
}
*/