Actualizar crear-cita.html
This commit is contained in:
250
crear-cita.html
250
crear-cita.html
@@ -3,11 +3,16 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>Solicitar Asistencia - IntegraRepara</title>
|
||||
<title>Portal del Cliente - IntegraRepara</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<style>
|
||||
body { background-color: #f8fafc; }
|
||||
/* Fondo de puntitos como en la imagen */
|
||||
body {
|
||||
background-color: #f8fafc;
|
||||
background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
|
||||
background-size: 24px 24px;
|
||||
}
|
||||
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
||||
|
||||
@@ -18,104 +23,101 @@
|
||||
.toggle-label { background-color: #e2e8f0; transition: all 0.3s; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="text-slate-800 font-sans antialiased min-h-screen flex flex-col items-center justify-center p-4">
|
||||
<body class="text-slate-800 font-sans antialiased min-h-screen flex flex-col items-center py-10 px-4 relative">
|
||||
|
||||
<div class="w-full max-w-md bg-white rounded-[2rem] shadow-2xl overflow-hidden border border-slate-100 relative">
|
||||
<div class="flex flex-col items-center justify-center w-full mb-8 z-10 relative fade-in">
|
||||
<div id="logoContainer" class="w-28 h-28 bg-white rounded-3xl shadow-xl shadow-slate-200/50 flex items-center justify-center p-3 mb-6 border border-slate-50">
|
||||
<i data-lucide="image" class="text-slate-300 w-10 h-10" id="defaultLogo"></i>
|
||||
<img id="companyLogoImg" src="" class="hidden w-full h-full object-contain rounded-2xl">
|
||||
</div>
|
||||
<p class="text-[10px] font-black text-blue-500 uppercase tracking-widest mb-1">Portal del Cliente</p>
|
||||
<h1 id="companyNameDisplay" class="text-2xl font-black text-slate-800 tracking-tight text-center uppercase">
|
||||
Cargando...
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="bg-blue-600 p-8 text-center relative overflow-hidden transition-all duration-500" id="headerBox">
|
||||
<div class="absolute inset-0 opacity-10 bg-[url('https://www.transparenttextures.com/patterns/cubes.png')]"></div>
|
||||
<div class="relative z-10 flex flex-col items-center">
|
||||
<div class="w-16 h-16 bg-white rounded-2xl flex items-center justify-center shadow-lg mb-4 text-blue-600 transition-all duration-300" id="headerIconBox">
|
||||
<i data-lucide="smartphone" id="headerIcon" class="w-8 h-8"></i>
|
||||
</div>
|
||||
<h1 class="text-2xl font-black text-white tracking-tight" id="headerTitle">Bienvenido</h1>
|
||||
<p class="text-blue-100 text-sm mt-1 font-medium" id="headerSubtitle">Introduce tu móvil para empezar</p>
|
||||
<div id="welcomeBackBox" class="w-full max-w-md hidden mb-6 fade-in text-center md:text-left">
|
||||
<h2 class="text-4xl font-black text-slate-800 tracking-tight">Hola, <span id="clientFirstName" class="text-blue-600"></span></h2>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md bg-white rounded-[2rem] shadow-xl shadow-slate-200/50 border border-slate-100 relative p-6 md:p-8">
|
||||
|
||||
<div id="step1" class="fade-in space-y-6">
|
||||
<div class="text-center mb-6">
|
||||
<h3 class="text-lg font-bold text-slate-800">Identificación</h3>
|
||||
<p class="text-sm text-slate-500">Introduce tu móvil para empezar</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Teléfono Móvil</label>
|
||||
<input type="tel" id="cliPhone" placeholder="Ej: 600123456" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-4 rounded-xl text-lg text-center tracking-widest font-black focus:border-blue-500 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
<button type="button" onclick="requestOTP()" id="btnStep1" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-black py-4 rounded-xl shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm">
|
||||
<span>Recibir Código</span> <i data-lucide="message-circle" class="w-4 h-4"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="p-6 md:p-8 relative min-h-[300px]">
|
||||
<div id="step2" class="fade-in space-y-6 hidden">
|
||||
<div class="text-center mb-4">
|
||||
<h3 class="text-lg font-bold text-slate-800 mb-2">Verificación</h3>
|
||||
<p class="text-sm text-slate-500 font-medium">Hemos enviado un WhatsApp al <strong id="displayPhone" class="text-slate-800"></strong> con un código de 4 cifras.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Código de Seguridad</label>
|
||||
<input type="number" id="cliCode" placeholder="· · · ·" maxlength="4" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-4 rounded-xl text-3xl text-center tracking-[1em] font-black focus:border-blue-500 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
<button type="button" onclick="verifyOTP()" id="btnStep2" class="w-full bg-slate-800 hover:bg-slate-900 text-white font-black py-4 rounded-xl shadow-xl shadow-slate-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm">
|
||||
<span>Verificar Acceso</span> <i data-lucide="check-circle" class="w-4 h-4"></i>
|
||||
</button>
|
||||
<button type="button" onclick="goToStep(1)" class="w-full text-slate-400 text-xs font-bold uppercase tracking-wider mt-2 hover:text-slate-600">Cambiar número</button>
|
||||
</div>
|
||||
|
||||
<div id="step1" class="fade-in space-y-6">
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Teléfono Móvil</label>
|
||||
<input type="tel" id="cliPhone" placeholder="Ej: 600123456" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-4 rounded-xl text-lg text-center tracking-widest font-black focus:border-blue-500 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
<button type="button" onclick="requestOTP()" id="btnStep1" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-black py-4 rounded-xl shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm">
|
||||
<span>Recibir Código</span> <i data-lucide="message-circle" class="w-4 h-4"></i>
|
||||
</button>
|
||||
<form id="step3" class="fade-in space-y-6 hidden" onsubmit="submitFinalRequest(event)">
|
||||
|
||||
<div id="boxName">
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Tu Nombre Completo *</label>
|
||||
<input type="text" id="cliName" placeholder="Ej: Juan Pérez" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold focus:border-blue-500 outline-none">
|
||||
</div>
|
||||
|
||||
<div id="step2" class="fade-in space-y-6 hidden">
|
||||
<div class="text-center mb-4">
|
||||
<p class="text-sm text-slate-500 font-medium">Hemos enviado un WhatsApp al <strong id="displayPhone" class="text-slate-800"></strong> con un código de 4 cifras.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Código de Seguridad</label>
|
||||
<input type="number" id="cliCode" placeholder="· · · ·" maxlength="4" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-4 rounded-xl text-3xl text-center tracking-[1em] font-black focus:border-blue-500 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
<button type="button" onclick="verifyOTP()" id="btnStep2" class="w-full bg-slate-800 hover:bg-slate-900 text-white font-black py-4 rounded-xl shadow-xl shadow-slate-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm">
|
||||
<span>Verificar Acceso</span> <i data-lucide="check-circle" class="w-4 h-4"></i>
|
||||
</button>
|
||||
<button type="button" onclick="goToStep(1)" class="w-full text-slate-400 text-xs font-bold uppercase tracking-wider mt-2 hover:text-slate-600">Cambiar número</button>
|
||||
<div id="boxAddress">
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Dirección del Servicio *</label>
|
||||
<select id="cliAddressSelect" onchange="toggleNewAddressInput()" class="hidden w-full mt-1 mb-2 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold outline-none cursor-pointer text-blue-700"></select>
|
||||
<input type="text" id="cliAddressInput" placeholder="Calle, Número, Piso, Código Postal..." class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold focus:border-blue-500 outline-none">
|
||||
</div>
|
||||
|
||||
<form id="step3" class="fade-in space-y-6 hidden" onsubmit="submitFinalRequest(event)">
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">¿Qué profesional necesitas? *</label>
|
||||
<select id="cliGuild" required class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold text-slate-700 focus:border-blue-500 outline-none cursor-pointer">
|
||||
<option value="">Cargando gremios...</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="welcomeBackBox" class="hidden bg-emerald-50 border border-emerald-100 rounded-xl p-4 text-center">
|
||||
<span class="text-xs font-black text-emerald-600 uppercase tracking-widest">¡Hola de nuevo!</span>
|
||||
<p class="text-lg font-black text-emerald-800 mt-1" id="clientGreeting">--</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Describe el problema *</label>
|
||||
<textarea id="cliDesc" required rows="2" placeholder="Explícanos brevemente qué ocurre..." class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-medium focus:border-blue-500 outline-none resize-none"></textarea>
|
||||
</div>
|
||||
|
||||
<div id="boxName">
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Tu Nombre Completo *</label>
|
||||
<input type="text" id="cliName" placeholder="Ej: Juan Pérez" class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold focus:border-blue-500 outline-none">
|
||||
</div>
|
||||
|
||||
<div id="boxAddress">
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Dirección del Servicio *</label>
|
||||
<select id="cliAddressSelect" onchange="toggleNewAddressInput()" class="hidden w-full mt-1 mb-2 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold outline-none cursor-pointer text-blue-700"></select>
|
||||
<input type="text" id="cliAddressInput" placeholder="Calle, Número, Piso, Código Postal..." class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold focus:border-blue-500 outline-none">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">¿Qué profesional necesitas? *</label>
|
||||
<select id="cliGuild" required class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-bold text-slate-700 focus:border-blue-500 outline-none cursor-pointer">
|
||||
<option value="">Selecciona una especialidad...</option>
|
||||
<option value="1">Electricidad</option>
|
||||
<option value="2">Fontanería</option>
|
||||
<option value="3">Persianas</option>
|
||||
<option value="4">Cerrajería</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Describe el problema *</label>
|
||||
<textarea id="cliDesc" required rows="2" placeholder="Explícanos brevemente qué ocurre..." class="w-full mt-1 bg-slate-50 border-2 border-slate-100 px-4 py-3 rounded-xl text-sm font-medium focus:border-blue-500 outline-none resize-none"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="bg-red-50 border-2 border-red-100 rounded-2xl p-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-black text-red-700 text-sm flex items-center gap-1.5"><i data-lucide="flame" class="w-4 h-4"></i> ¿Es una Urgencia?</span>
|
||||
<span class="text-[10px] font-bold text-red-500 uppercase mt-0.5">Asistencia Inmediata</span>
|
||||
</div>
|
||||
<div class="relative inline-block w-12 mr-2 align-middle select-none">
|
||||
<input type="checkbox" id="cliUrgent" onchange="handleUrgency(this)" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/>
|
||||
<label for="cliUrgent" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
|
||||
</div>
|
||||
<div class="bg-red-50 border-2 border-red-100 rounded-2xl p-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-black text-red-700 text-sm flex items-center gap-1.5"><i data-lucide="flame" class="w-4 h-4"></i> ¿Es una Urgencia?</span>
|
||||
<span class="text-[10px] font-bold text-red-500 uppercase mt-0.5">Asistencia Inmediata</span>
|
||||
</div>
|
||||
<div class="relative inline-block w-12 mr-2 align-middle select-none">
|
||||
<input type="checkbox" id="cliUrgent" onchange="handleUrgency(this)" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/>
|
||||
<label for="cliUrgent" class="toggle-label block overflow-hidden h-6 rounded-full bg-red-200 cursor-pointer"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" id="btnSubmitFinal" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-black py-4 rounded-xl shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm mt-4">
|
||||
<span>Buscar Técnico</span> <i data-lucide="search" class="w-4 h-4"></i>
|
||||
</button>
|
||||
<button type="submit" id="btnSubmitFinal" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-black py-4 rounded-xl shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-2 active:scale-95 uppercase tracking-wider text-sm mt-4">
|
||||
<span>Buscar Técnico</span> <i data-lucide="search" class="w-4 h-4"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" onclick="logoutClient()" class="w-full text-slate-400 text-xs font-bold uppercase tracking-wider mt-4 hover:text-slate-600 transition-colors">
|
||||
Cambiar de número de teléfono
|
||||
</button>
|
||||
</form>
|
||||
<button type="button" onclick="logoutClient()" class="w-full text-slate-400 text-[10px] font-bold uppercase tracking-widest mt-4 hover:text-slate-600 transition-colors">
|
||||
Cambiar de número de teléfono
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="urgentModal" class="fixed inset-0 bg-slate-900/60 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
|
||||
@@ -135,8 +137,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="successScreen" class="fixed inset-0 bg-white z-[100] hidden flex-col items-center justify-center p-6 text-center">
|
||||
<div class="w-24 h-24 bg-emerald-100 text-emerald-500 rounded-full flex items-center justify-center mb-6">
|
||||
<div id="successScreen" class="fixed inset-0 bg-slate-50 z-[100] hidden flex-col items-center justify-center p-6 text-center">
|
||||
<div class="w-24 h-24 bg-emerald-100 text-emerald-500 rounded-[2rem] flex items-center justify-center mb-6 shadow-lg shadow-emerald-200">
|
||||
<i data-lucide="zap" class="w-12 h-12"></i>
|
||||
</div>
|
||||
<h2 class="text-3xl font-black text-slate-800 mb-2">¡Técnico Avisado!</h2>
|
||||
@@ -146,32 +148,29 @@
|
||||
<script>
|
||||
lucide.createIcons();
|
||||
|
||||
// 🔧 CONFIGURACIÓN
|
||||
// 🔧 CONFIGURACIÓN
|
||||
const API_URL = 'https://integrarepara-api.integrarepara.es';
|
||||
|
||||
// 🚀 MAGIA SAAS: Capturamos el ID de la empresa desde el enlace
|
||||
// Capturamos el ID de la empresa desde el enlace (o usamos 1 por defecto)
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
// Si entran con ?c=2, cogerá el 2. Si no ponen nada, usará el 1 por seguridad.
|
||||
const OWNER_ID = parseInt(urlParams.get('c')) || 1;
|
||||
|
||||
// Estado del cliente
|
||||
let currentClient = null;
|
||||
|
||||
// 🔄 AUTO-LOGIN: Comprobar sesión guardada al abrir la web
|
||||
// 🔄 AUTO-LOGIN Y CARGA DE DATOS DE EMPRESA AL ABRIR LA WEB
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loadCompanyData(); // Cargar logo, nombre y gremios
|
||||
|
||||
const sesionGuardada = localStorage.getItem('clienteSesion');
|
||||
if (sesionGuardada) {
|
||||
try {
|
||||
const datos = JSON.parse(sesionGuardada);
|
||||
// Comprobamos si la fecha actual es menor que la fecha de caducidad (10 días)
|
||||
if (Date.now() < datos.expires) {
|
||||
console.log("Sesión recuperada. Saltando validación...");
|
||||
// Rellenamos el teléfono por debajo para que el formulario final lo pueda leer
|
||||
document.getElementById('cliPhone').value = datos.phone;
|
||||
prepareStep3(datos.client);
|
||||
goToStep(3);
|
||||
} else {
|
||||
// Si pasaron 10 días, borramos la sesión
|
||||
localStorage.removeItem('clienteSesion');
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -180,11 +179,49 @@
|
||||
}
|
||||
});
|
||||
|
||||
// --- CARGAR DATOS PÚBLICOS DE LA EMPRESA Y GREMIOS ---
|
||||
async function loadCompanyData() {
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/public/company/${OWNER_ID}/guilds`);
|
||||
const data = await res.json();
|
||||
|
||||
if (data.ok) {
|
||||
// Actualizar Nombre
|
||||
document.getElementById('companyNameDisplay').innerText = data.name || "IntegraRepara";
|
||||
|
||||
// Actualizar Logo
|
||||
if (data.logo) {
|
||||
document.getElementById('defaultLogo').classList.add('hidden');
|
||||
const img = document.getElementById('companyLogoImg');
|
||||
img.src = data.logo;
|
||||
img.classList.remove('hidden');
|
||||
}
|
||||
|
||||
// Llenar Select de Gremios
|
||||
const selectGremio = document.getElementById('cliGuild');
|
||||
selectGremio.innerHTML = '<option value="">Selecciona un profesional...</option>';
|
||||
|
||||
if (data.guilds && data.guilds.length > 0) {
|
||||
data.guilds.forEach(g => {
|
||||
selectGremio.innerHTML += `<option value="${g.id}">${g.name}</option>`;
|
||||
});
|
||||
} else {
|
||||
selectGremio.innerHTML += `<option value="0">Servicio General</option>`;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error al cargar la empresa", e);
|
||||
document.getElementById('companyNameDisplay').innerText = "Servicio Técnico";
|
||||
document.getElementById('cliGuild').innerHTML = '<option value="0">Servicio General</option>';
|
||||
}
|
||||
}
|
||||
|
||||
// 🚪 FUNCIÓN PARA CERRAR SESIÓN
|
||||
function logoutClient() {
|
||||
localStorage.removeItem('clienteSesion');
|
||||
document.getElementById('cliPhone').value = "";
|
||||
document.getElementById('cliCode').value = "";
|
||||
document.getElementById('welcomeBackBox').classList.add('hidden');
|
||||
goToStep(1);
|
||||
}
|
||||
|
||||
@@ -194,32 +231,13 @@
|
||||
document.getElementById('step2').classList.add('hidden');
|
||||
document.getElementById('step3').classList.add('hidden');
|
||||
|
||||
const title = document.getElementById('headerTitle');
|
||||
const subtitle = document.getElementById('headerSubtitle');
|
||||
const iconBox = document.getElementById('headerIconBox');
|
||||
const icon = document.getElementById('headerIcon');
|
||||
const headerBox = document.getElementById('headerBox');
|
||||
|
||||
if (step === 1) {
|
||||
document.getElementById('step1').classList.remove('hidden');
|
||||
title.innerText = "Bienvenido"; subtitle.innerText = "Introduce tu móvil para empezar";
|
||||
headerBox.className = "bg-blue-600 p-8 text-center relative overflow-hidden transition-all duration-500";
|
||||
iconBox.className = "w-16 h-16 bg-white rounded-2xl flex items-center justify-center shadow-lg mb-4 text-blue-600 transition-all duration-300";
|
||||
icon.setAttribute('data-lucide', 'smartphone');
|
||||
} else if (step === 2) {
|
||||
document.getElementById('step2').classList.remove('hidden');
|
||||
title.innerText = "Verificación"; subtitle.innerText = "Introduce el código recibido";
|
||||
headerBox.className = "bg-slate-800 p-8 text-center relative overflow-hidden transition-all duration-500";
|
||||
iconBox.className = "w-16 h-16 bg-slate-700 rounded-2xl flex items-center justify-center shadow-lg mb-4 text-white transition-all duration-300";
|
||||
icon.setAttribute('data-lucide', 'lock');
|
||||
} else if (step === 3) {
|
||||
document.getElementById('step3').classList.remove('hidden');
|
||||
title.innerText = "¿En qué te ayudamos?"; subtitle.innerText = "Detalles del servicio";
|
||||
headerBox.className = "bg-emerald-600 p-8 text-center relative overflow-hidden transition-all duration-500";
|
||||
iconBox.className = "w-16 h-16 bg-white rounded-2xl flex items-center justify-center shadow-lg mb-4 text-emerald-600 transition-all duration-300";
|
||||
icon.setAttribute('data-lucide', 'wrench');
|
||||
}
|
||||
lucide.createIcons();
|
||||
}
|
||||
|
||||
// --- PASO 1: PEDIR OTP ---
|
||||
@@ -297,13 +315,18 @@
|
||||
|
||||
const nameBox = document.getElementById('boxName');
|
||||
const welcomeBox = document.getElementById('welcomeBackBox');
|
||||
const firstNameSpan = document.getElementById('clientFirstName');
|
||||
const selectAddr = document.getElementById('cliAddressSelect');
|
||||
const inputAddr = document.getElementById('cliAddressInput');
|
||||
|
||||
if (clientData) {
|
||||
// Ya lo conocemos
|
||||
welcomeBox.classList.remove('hidden');
|
||||
document.getElementById('clientGreeting').innerText = clientData.full_name;
|
||||
|
||||
// Extraemos solo el primer nombre (hasta el primer espacio)
|
||||
const firstName = clientData.full_name.split(' ')[0];
|
||||
firstNameSpan.innerText = firstName.toUpperCase();
|
||||
|
||||
nameBox.classList.add('hidden'); // Ocultamos pedir nombre
|
||||
document.getElementById('cliName').value = clientData.full_name; // Lo rellenamos oculto
|
||||
|
||||
@@ -355,7 +378,6 @@
|
||||
const btn = document.getElementById('btnSubmitFinal');
|
||||
btn.disabled = true; btn.innerHTML = '<i data-lucide="loader-2" class="w-5 h-5 animate-spin"></i> Procesando...'; lucide.createIcons();
|
||||
|
||||
// Averiguar qué dirección ha elegido
|
||||
let finalAddress = document.getElementById('cliAddressInput').value;
|
||||
if (document.getElementById('cliAddressSelect').value !== "NEW" && !document.getElementById('cliAddressSelect').classList.contains('hidden')) {
|
||||
finalAddress = document.getElementById('cliAddressSelect').value;
|
||||
|
||||
Reference in New Issue
Block a user