This commit is contained in:
2025-04-11 11:27:30 -06:00
parent 00c1b28be6
commit cd7321ec96
4 changed files with 55 additions and 83 deletions

View File

@@ -5,7 +5,7 @@
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"SPLASH_CUSTOMER": "Sultanes",
"SPLASH_CUSTOMER": "LC",
"SPLASH_SKIP_WORKER": "false"
},
"nativeDebugging": true,

View File

@@ -2,7 +2,7 @@
"ConnectionStrings": {
//"Default": "Server=172.21.4.113;Database=SplashPageBase;User=Jordi;Password=SqlS3rv3r;Encrypt=True;TrustServerCertificate=True;",
//"Default": "Server=45.168.234.22;Port=5000;Database=SULTANES_db_Splash;Password=Bpusr001;User=root",
"Default": "User ID=mysql;Password=Bpusr001;Host=45.168.234.22;Port=5001;Database=sultanes_db_splash;Pooling=true;Minimum Pool Size=10;Maximum Pool Size=100;Connection Idle Lifetime=300;Connection Pruning Interval=5;Timeout=30;Command Timeout=360;"
"Default": "User ID=mysql;Password=Bpusr001;Host=45.168.234.22;Port=5001;Database=lc_db_splash;Pooling=true;Minimum Pool Size=10;Maximum Pool Size=100;Connection Idle Lifetime=300;Connection Pruning Interval=5;Timeout=30;Command Timeout=360;"
//"Default": "User ID=mysql;Password=Bpusr001;Host=2.tcp.ngrok.io;Port=11925;Database=nazan_db_splash;Pooling=true;Command Timeout=360;"
},
"Authentication": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -858,37 +858,37 @@ function selectImage(imagePath, section) {
const imageType = section === 'bg' ? 'background' : section;
console.log('Tipo de imagen corregido:', imageType);
// Usar jQuery AJAX directamente con el formato de form-data para mayor compatibilidad
// Actualizar la UI para mostrar la selección antes de enviar la solicitud al servidor
const radioInputs = document.querySelectorAll(`input[name="form-imagecheck-${section}"]`);
radioInputs.forEach(input => {
const imgContainer = input.closest('.col-6');
const img = imgContainer.querySelector('img');
if (img && img.src.includes(imagePath)) {
input.checked = true;
} else {
input.checked = false;
}
});
// Actualizar la configuración local primero
if (section === 'logo') {
currentConfig.SelectedLogoImagePath = imagePath;
} else {
currentConfig.SelectedBackgroundImagePath = imagePath;
}
// Usar jQuery AJAX directamente con el formato correcto
$.ajax({
url: '/CaptivePortal/SelectImage',
type: 'POST',
contentType: 'application/json; charset=UTF-8',
data: {
data: JSON.stringify({
imagePath: imagePath,
imageType: imageType
},
}),
success: function (result) {
console.log('Respuesta exitosa:', result);
// Actualizar la UI para mostrar la selección
const radioInputs = document.querySelectorAll(`input[name="form-imagecheck-${section}"]`);
radioInputs.forEach(input => {
const imgContainer = input.closest('.col-6');
const img = imgContainer.querySelector('img');
if (img.src.includes(imagePath)) {
input.checked = true;
} else {
input.checked = false;
}
});
// Actualizar la configuración local
if (section === 'logo') {
currentConfig.SelectedLogoImagePath = imagePath;
} else {
currentConfig.SelectedBackgroundImagePath = imagePath;
}
// Actualizar la vista previa en el iframe
updatePreview();
@@ -897,6 +897,9 @@ function selectImage(imagePath, section) {
error: function (error) {
console.error('Error en selectImage:', error);
abp.notify.error(`Error al seleccionar la imagen: ${error.responseText || 'Error desconocido'}`);
// Si hay error, restaurar el estado anterior (opcional)
loadExistingImages(section);
},
complete: function () {
abp.ui.clearBusy(document.body);
@@ -904,6 +907,7 @@ function selectImage(imagePath, section) {
});
}
// Configurar el manejador de eventos para la carga de imágenes
// Corrección de la función setupImageUploader en CaptivePortal.js
function setupImageUploader(input, container, section) {
@@ -927,15 +931,15 @@ function setupImageUploader(input, container, section) {
const imageType = section === 'bg' ? 'background' : section;
formData.append('imageType', imageType);
console.log('Subiendo imagen:', file.name, 'tipo:', imageType); // Para depuración
console.log('Subiendo imagen:', file.name, 'tipo:', imageType);
// Enviar el archivo al servidor
abp.ajax({
url: '/CaptivePortal/UploadImage',
type: 'POST',
data: formData,
processData: false, // No procesar los datos
contentType: false // No establecer el tipo de contenido
processData: false,
contentType: false
}).done(function (result) {
if (result.success) {
const imageId = `img-${section}-${Date.now()}`;
@@ -974,7 +978,7 @@ function setupImageUploader(input, container, section) {
// Si es la primera imagen, seleccionarla automáticamente
if (isFirst) {
currentConfig.selectedLogoImagePath = result.path;
currentConfig.SelectedLogoImagePath = result.path;
updatePreview();
}
} else if (section === 'bg') {
@@ -983,7 +987,7 @@ function setupImageUploader(input, container, section) {
// Si es la primera imagen, seleccionarla automáticamente
if (isFirst) {
currentConfig.selectedBackgroundImagePath = result.path;
currentConfig.SelectedBackgroundImagePath = result.path;
updatePreview();
}
}
@@ -991,7 +995,7 @@ function setupImageUploader(input, container, section) {
abp.notify.success('Imagen subida correctamente');
}
}).fail(function (error) {
console.error('Error al subir imagen:', error); // Para depuración
console.error('Error al subir imagen:', error);
abp.notify.error('Error al subir la imagen: ' + (error.responseText || 'Error desconocido'));
}).always(function () {
abp.ui.clearBusy(`#${container.id}`);
@@ -1003,53 +1007,7 @@ function setupImageUploader(input, container, section) {
}
// También debemos actualizar la función selectImage para usar el tipo correcto
function selectImage(imagePath, section) {
abp.ui.setBusy(document.body);
// Corregir el tipo de imagen: convertir 'bg' a 'background'
const imageType = section === 'bg' ? 'background' : section;
abp.ajax({
url: '/CaptivePortal/SelectImage',
type: 'POST',
data: JSON.stringify({
imagePath: imagePath,
imageType: imageType
}),
contentType: 'application/json'
}).done(function (result) {
if (result.success) {
// Actualizar la UI para mostrar la selección
const radioInputs = document.querySelectorAll(`input[name="form-imagecheck-${section}"]`);
radioInputs.forEach(input => {
const imgContainer = input.closest('.col-6');
const img = imgContainer.querySelector('img');
if (img.src.includes(imagePath)) {
input.checked = true;
} else {
input.checked = false;
}
});
// Actualizar la configuración local
if (section === 'logo') {
currentConfig.selectedLogoImagePath = imagePath;
} else {
currentConfig.selectedBackgroundImagePath = imagePath;
}
// Actualizar la vista previa en el iframe
updatePreview();
abp.notify.success(`Imagen de ${section === 'bg' ? 'fondo' : section} seleccionada correctamente`);
}
}).fail(function (error) {
console.error('Error al seleccionar imagen:', error); // Para depuración
abp.notify.error(`Error al seleccionar la imagen de ${section === 'bg' ? 'fondo' : section}: ` + error.responseText);
}).always(function () {
abp.ui.clearBusy(document.body);
});
}
// Actualizar la función loadExistingImages también
// Continuación de la función loadExistingImages
@@ -1064,6 +1022,7 @@ function loadExistingImages(section) {
type: 'GET',
data: { imageType: imageType }
}).done(function (result) {
debugger
if (result.success) {
const container = section === 'logo' ? logoContainer : bgContainer;
// Limpiar el contenedor primero
@@ -1101,17 +1060,17 @@ function loadExistingImages(section) {
// Actualizar contador
if (section === 'logo') {
logoImageCount = result.images.length;
// Actualizar configuración
// Actualizar configuración, usar SelectedLogoImagePath
const selectedImage = result.images.find(img => img.isSelected);
if (selectedImage) {
currentConfig.selectedLogoImagePath = selectedImage.path;
currentConfig.SelectedLogoImagePath = selectedImage.path;
}
} else {
bgImageCount = result.images.length;
// Actualizar configuración
// Actualizar configuración, usar SelectedBackgroundImagePath
const selectedImage = result.images.find(img => img.isSelected);
if (selectedImage) {
currentConfig.selectedBackgroundImagePath = selectedImage.path;
currentConfig.SelectedBackgroundImagePath = selectedImage.path;
}
}
@@ -1133,7 +1092,7 @@ function loadExistingImages(section) {
}
}
}).fail(function (error) {
console.error('Error al cargar imágenes existentes:', error); // Para depuración
console.error('Error al cargar imágenes existentes:', error);
abp.notify.error('Error al cargar las imágenes existentes: ' + (error.responseText || 'Error desconocido'));
}).always(function () {
abp.ui.clearBusy(`#${section}-preview-container`);
@@ -1164,7 +1123,7 @@ function loadConfiguration() {
// Cargar las imágenes
loadExistingImages('logo');
loadExistingImages('background');
loadExistingImages('bg');
abp.ui.clearBusy(document.body);
}
@@ -1263,7 +1222,20 @@ document.addEventListener('DOMContentLoaded', function () {
const modelData = document.getElementById('config-data');
if (modelData) {
try {
currentConfig = JSON.parse(modelData.textContent);
// Cargar la configuración desde el servidor
const loadedConfig = JSON.parse(modelData.textContent);
// Asegurarse de que usamos las propiedades con S mayúscula
if (loadedConfig.selectedLogoImagePath && !loadedConfig.SelectedLogoImagePath) {
loadedConfig.SelectedLogoImagePath = loadedConfig.selectedLogoImagePath;
}
if (loadedConfig.selectedBackgroundImagePath && !loadedConfig.SelectedBackgroundImagePath) {
loadedConfig.SelectedBackgroundImagePath = loadedConfig.selectedBackgroundImagePath;
}
// Actualizar currentConfig
currentConfig = loadedConfig;
} catch (e) {
console.error('Error parsing config data', e);
}