Añadir crear-cita.html
This commit is contained in:
162
crear-cita.html
Normal file
162
crear-cita.html
Normal file
@@ -0,0 +1,162 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<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>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<style>
|
||||
body { background-color: #f8fafc; }
|
||||
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
||||
|
||||
/* Toggle Switch Custom */
|
||||
.toggle-checkbox:checked { right: 0; border-color: #ef4444; }
|
||||
.toggle-checkbox:checked + .toggle-label { background-color: #ef4444; }
|
||||
.toggle-checkbox { right: 0; z-index: 1; border-color: #e2e8f0; transition: all 0.3s; }
|
||||
.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">
|
||||
|
||||
<div class="w-full max-w-md bg-white rounded-[2rem] shadow-2xl overflow-hidden fade-in border border-slate-100">
|
||||
|
||||
<div class="bg-blue-600 p-8 text-center relative overflow-hidden">
|
||||
<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">
|
||||
<i data-lucide="wrench" class="w-8 h-8"></i>
|
||||
</div>
|
||||
<h1 class="text-2xl font-black text-white tracking-tight">Solicitar Asistencia</h1>
|
||||
<p class="text-blue-100 text-sm mt-1 font-medium">Te enviaremos al mejor profesional</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="requestForm" onsubmit="submitForm(event)" class="p-6 md:p-8 space-y-6">
|
||||
|
||||
<div class="space-y-4">
|
||||
<h2 class="text-xs font-black text-slate-400 uppercase tracking-widest flex items-center gap-2 border-b pb-2">
|
||||
<i data-lucide="user" class="w-4 h-4"></i> Tus Datos
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Teléfono Móvil *</label>
|
||||
<input type="tel" id="cliPhone" required placeholder="Ej: 600123456" 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 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Nombre Completo *</label>
|
||||
<input type="text" id="cliName" required 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 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="text-[10px] font-bold text-slate-500 uppercase ml-1">Dirección del Servicio *</label>
|
||||
<input type="text" id="cliAddress" required 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 focus:bg-white outline-none transition-all">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4 pt-4">
|
||||
<h2 class="text-xs font-black text-slate-400 uppercase tracking-widest flex items-center gap-2 border-b pb-2">
|
||||
<i data-lucide="alert-circle" class="w-4 h-4"></i> Sobre la Avería
|
||||
</h2>
|
||||
|
||||
<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 focus:bg-white outline-none transition-all 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="3" 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 focus:bg-white outline-none transition-all resize-none"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-red-50 border-2 border-red-100 rounded-2xl p-4 mt-2">
|
||||
<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 transition duration-200 ease-in">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<button type="submit" id="btnSubmit" 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>Continuar</span> <i data-lucide="arrow-right" class="w-4 h-4"></i>
|
||||
</button>
|
||||
</form>
|
||||
</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">
|
||||
<div class="bg-white rounded-3xl p-6 md:p-8 max-w-sm w-full shadow-2xl text-center fade-in">
|
||||
<div class="w-16 h-16 bg-red-100 text-red-600 rounded-full flex items-center justify-center mx-auto mb-4 animate-pulse">
|
||||
<i data-lucide="alert-triangle" class="w-8 h-8"></i>
|
||||
</div>
|
||||
<h3 class="text-xl font-black text-slate-800 mb-2">Servicio de Urgencia</h3>
|
||||
<p class="text-sm text-slate-600 mb-6 font-medium">
|
||||
Los servicios de urgencia <strong>no requieren cita previa</strong>. Un técnico acudirá a tu domicilio a la mayor brevedad posible.<br><br>
|
||||
Ten en cuenta que esta modalidad conlleva un <strong>coste adicional de tarifa de urgencia</strong>.
|
||||
</p>
|
||||
<div class="flex gap-3">
|
||||
<button type="button" onclick="cancelUrgency()" class="flex-1 bg-slate-100 hover:bg-slate-200 text-slate-600 font-bold py-3 rounded-xl transition-all">Cancelar</button>
|
||||
<button type="button" onclick="acceptUrgency()" class="flex-1 bg-red-600 hover:bg-red-700 text-white font-bold py-3 rounded-xl shadow-lg shadow-red-200 transition-all">Acepto</button>
|
||||
</div>
|
||||
</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">
|
||||
<i data-lucide="check-circle" class="w-12 h-12"></i>
|
||||
</div>
|
||||
<h2 class="text-3xl font-black text-slate-800 mb-2">¡Técnico Avisado!</h2>
|
||||
<p class="text-slate-500 font-medium max-w-sm">Tu solicitud de urgencia ha entrado en nuestra bolsa prioritaria. El primer operario disponible aceptará tu aviso y se pondrá en camino de inmediato.</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
lucide.createIcons();
|
||||
|
||||
// 🔧 CONFIGURACIÓN DE TU BACKEND
|
||||
// Cambia esto a la URL de tu servidor en producción (ej. https://api.integrarepara.es)
|
||||
const API_URL = 'http://127.0.0.1:3000';
|
||||
|
||||
// Lógica del Modal de Urgencia
|
||||
const urgentToggle = document.getElementById('cliUrgent');
|
||||
const urgentModal = document.getElementById('urgentModal');
|
||||
|
||||
function handleUrgency(checkbox) {
|
||||
if (checkbox.checked) {
|
||||
urgentModal.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function cancelUrgency() {
|
||||
urgentToggle.checked = false;
|
||||
urgentModal.classList.add('hidden');
|
||||
}
|
||||
|
||||
function acceptUrgency() {
|
||||
urgentModal.classList.add('hidden');
|
||||
}
|
||||
|
||||
// Lógica de Envío
|
||||
async function submitForm(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const btn = document.getElementById('btnSubmit');
|
||||
const originalText = btn.innerHTML;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<i data-lucide="loader-2" class="w-5 h-5 animate-spin"></i> Procesando...';
|
||||
lucide.createIcons();
|
||||
|
||||
const payload = {
|
||||
phone: document.getElementById
|
||||
Reference in New Issue
Block a user