Actualizar asignados.html
This commit is contained in:
@@ -477,7 +477,7 @@
|
||||
return diffDays;
|
||||
}
|
||||
|
||||
function renderServices() {
|
||||
function renderServices() {
|
||||
const container = document.getElementById('servicesList');
|
||||
const noDateSec = document.getElementById('noDateSection');
|
||||
|
||||
@@ -509,7 +509,7 @@
|
||||
|
||||
// 🔥 AÑADIDO: Extraer y limpiar la descripción de avería
|
||||
let desc = raw["Descripción"] || raw["DESCRIPCION"] || raw["Averia"] || "Sin descripción de avería en el expediente.";
|
||||
// Quitar posibles saltos de línea molestos y limitarlo a ~100 caracteres visuales
|
||||
// Quitar posibles saltos de línea molestos y limitarlo visualmente
|
||||
desc = desc.replace(/(\r\n|\n|\r)/gm, " ");
|
||||
|
||||
const calledTimes = parseInt(raw.called_times || 0);
|
||||
@@ -557,23 +557,27 @@
|
||||
lucide.createIcons();
|
||||
}
|
||||
|
||||
// 🔥 MEJORA: El "Mata-Fantasmas" por si se intenta abrir un aviso que ya no está en BD
|
||||
// 🔥 MEJORA MATA-FANTASMAS
|
||||
async function openActionModal(id) {
|
||||
let s = localServices.find(x => x.id === id);
|
||||
|
||||
// Si el operario hace click en algo que justo acaba de desaparecer de la BD...
|
||||
if (!s) {
|
||||
try {
|
||||
showToast("Cargando datos...");
|
||||
showToast("Sincronizando...");
|
||||
const res = await fetch(`${API_URL}/services/active`, { headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` } });
|
||||
const data = await res.json();
|
||||
if (data.ok) {
|
||||
s = data.services.find(x => x.id === id);
|
||||
if (s) localServices.push(s);
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
// Si definitivamente el aviso fue borrado/reasignado por la oficina
|
||||
if (!s) {
|
||||
showToast("El aviso ya no está disponible", true);
|
||||
refreshData();
|
||||
showToast("Este aviso ya no está en tu bandeja", true);
|
||||
refreshData(); // Limpiamos la pantalla para que desaparezca visualmente
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -585,7 +589,7 @@
|
||||
document.getElementById('detAddress').innerText = `${raw["Dirección"] || ""}, ${raw["Población"] || ""}`;
|
||||
|
||||
const rawPhone = raw["Teléfono"] || raw["TELEFONOS"] || raw["TELEFONO"] || "";
|
||||
const matchPhone = rawPhone.toString().match(/[6789]\d{8}/);
|
||||
const matchPhone = String(rawPhone).match(/[6789]\d{8}/);
|
||||
document.getElementById('detPhoneRaw').value = matchPhone ? matchPhone[0] : "";
|
||||
|
||||
document.getElementById('durationInput').value = "60";
|
||||
|
||||
Reference in New Issue
Block a user