mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado
This commit is contained in:
@ -169,12 +169,21 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
dataTable.row($row).data(rowData).draw(false); // Redibujar la fila SIN perder scroll ni filtros
|
||||
}
|
||||
|
||||
let html = skUrl
|
||||
? `La fila se importó exitosamente.<br><br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
|
||||
: 'La fila se importó exitosamente.';
|
||||
let icon = 'success';
|
||||
|
||||
if (result.price_warning) {
|
||||
html = skUrl ? `La fila se importó exitosamente, pero el precio no se ha podido ajustar (debajo de costes).<br><br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
|
||||
: 'La fila se importó exitosamente, pero el precio no se ha podido ajustar (debajo de costes).';
|
||||
icon = 'warning';
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: 'Importado correctamente',
|
||||
html: skUrl
|
||||
? `La fila se importó exitosamente.<br><br><a href="${skUrl}" target="_blank" class="btn btn-primary mt-2">Ver presupuesto</a>`
|
||||
: 'La fila se importó exitosamente.',
|
||||
icon: 'success',
|
||||
html: html,
|
||||
icon: icon,
|
||||
confirmButtonText: 'Aceptar',
|
||||
buttonsStyling: true,
|
||||
customClass: { confirmButton: 'btn btn-success' }
|
||||
@ -252,6 +261,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}).then(async (result) => {
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
// array para contener los IDs que no se han podido ajustar
|
||||
let idsNoAjustados = [];
|
||||
|
||||
for (const fila of filasAptas) {
|
||||
try {
|
||||
const response = await fetch('/importador/catalogo/importar-fila', {
|
||||
@ -268,6 +280,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (response.ok && result.status === 200) {
|
||||
const skUrl = result.data?.sk_url?.replace('presupuestocliente', 'presupuestoadmin') ?? null;
|
||||
|
||||
if (result.price_warning) {
|
||||
idsNoAjustados.push(result.data.sk_id);
|
||||
}
|
||||
|
||||
if (skUrl) {
|
||||
fila.rowData[6] = `<a href="${skUrl}" target="_blank" class="btn btn-sm btn-primary">Ver presupuesto</a>`;
|
||||
} else {
|
||||
@ -286,10 +302,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
}
|
||||
|
||||
let text = 'Se han procesado todas las filas seleccionadas.';
|
||||
let icon = 'success';
|
||||
if (idsNoAjustados.length > 0) {
|
||||
text = 'Se han procesado todas las filas seleccionadas, pero no se han podido ajustar los precios de los siguientes presupuestos: ' + idsNoAjustados.join(', ');
|
||||
icon = 'warning';
|
||||
}
|
||||
Swal.fire({
|
||||
title: 'Importación finalizada',
|
||||
text: 'Se han procesado todas las filas seleccionadas.',
|
||||
icon: 'success',
|
||||
text: text,
|
||||
icon: icon,
|
||||
confirmButtonText: 'Aceptar',
|
||||
buttonsStyling: true,
|
||||
customClass: { confirmButton: 'btn btn-success' }
|
||||
|
||||
Reference in New Issue
Block a user