Spaces:
Running
Running
redise帽a esta pagina mas moderna posible pero deja las conexiones de la api postman <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <title>Inventario Electr贸nico | Gestor de Productos</title> <style> :root { --primary-color: #4361ee; --secondary-color: #3f37c9; --accent-color: #4895ef; --light-color: #f8f9fa; --dark-color: #212529; --success-color: #4cc9f0; --error-color: #f72585; --border-radius: 8px; --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); --transition: all 0.3s ease; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Montserrat', sans-serif; background-color: #f5f7fa; color: var(--dark-color); line-height: 1.6; padding: 0; margin: 0; min-height: 100vh; display: flex; flex-direction: column; } .container { max-width: 1200px; margin: 0 auto; padding: 2rem; width: 100%; } header { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); background-color: var(--primary-color); color: white; padding: 1.5rem 0; box-shadow: var(--box-shadow); position: relative; z-index: 10; } .header-content { display: flex; justify-content: space-between; align-items: center; } .logo { font-size: 1.8rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; } .logo-icon { font-size: 2rem; } .auth-section { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 200px); } .card { background: white; border-radius: var(--border-radius); box-shadow: var(--box-shadow); padding: 2.5rem; width: 100%; max-width: 500px; margin: 2rem auto; transition: var(--transition); } .card:hover { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); } h1, h2 { color: var(--dark-color); margin-bottom: 1.5rem; text-align: center; } h1 { font-size: 2.2rem; font-weight: 600; color: var(--primary-color); } h2 { font-size: 1.8rem; font-weight: 500; } form { display: flex; flex-direction: column; gap: 1.5rem; } .form-group { display: flex; flex-direction: column; gap: 0.5rem; } label { font-weight: 500; color: var(--dark-color); } input { padding: 0.8rem 1rem; border: 1px solid #ddd; border-radius: var(--border-radius); font-size: 1rem; transition: var(--transition); } input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2); } button { background-color: var(--primary-color); color: white; border: none; padding: 1rem; border-radius: var(--border-radius); font-size: 1rem; font-weight: 600; cursor: pointer; transition: var(--transition); text-transform: uppercase; letter-spacing: 0.5px; } button:hover { background-color: var(--secondary-color); transform: translateY(-2px); } button:active { transform: translateY(0); } #formSection { display: none; animation: fadeIn 0.5s ease; }
@keyframes
fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .status-message { padding: 1rem; border-radius: var(--border-radius); margin-top: 1rem; text-align: center; display: none; } .success { background-color: rgba(76, 201, 240, 0.2); color: #0a6c74; display: block; } .error { background-color: rgba(247, 37, 133, 0.2); color: #a4133c; display: block; } footer { background-color: var(--dark-color); color: white; text-align: center; padding: 1.5rem; margin-top: auto; } .footer-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; } .copyright { font-size: 0.9rem; } .social-links { display: flex; gap: 1rem; } .social-icon { color: white; font-size: 1.2rem; transition: var(--transition); } .social-icon:hover { color: var(--accent-color); }
@media
(max-width: 768px) { .container { padding: 1rem; } .card { padding: 1.5rem; } h1 { font-size: 1.8rem; } h2 { font-size: 1.5rem; } .header-content { flex-direction: column; gap: 1rem; } .footer-content { flex-direction: column; gap: 1rem; } } </style> </head> <body> <header> <div class="container header-content"> <div class="logo"> <span class="logo-icon">馃摝</span> <span>Inventario Electr贸nico</span> </div> <div> <label for="languageSelect">Idioma:</label> <select id="languageSelect"> <option value="es">Espa帽ol</option> <option value="en">English</option> </select> </div> </div> </header> <main class="container"> <section class="auth-section"> <div class="card"> <h1>Iniciar Sesi贸n</h1> <form id="loginForm"> <div class="form-group"> <label for="username">Usuario</label> <input type="text" id="username" required> </div> <div class="form-group"> <label for="password">Contrase帽a</label> <input type="password" id="password" required> </div> <button type="submit">Acceder al Sistema</button> </form> </div> <div id="formSection" class="card" style="display: none;"> <h2>Registrar Nuevo Producto</h2> <form id="productoForm"> <input type="text" id="nombre" placeholder="Nombre del producto" required> <input type="text" id="descripcion" placeholder="Descripci贸n" required> <input type="number" id="precio" placeholder="Precio unitario" required> <input type="number" id="stock" placeholder="Cantidad en stock" required> <button type="submit">Guardar Producto</button> </form> <div id="statusMessage" class="status-message"></div> </div> </section> </main> <footer> <div class="container"> <p>漏 2025 Gestor de Inventario Electr贸nico</p> </div> </footer> <script> let authHeader = ""; function encodeBasicAuth(username, password) { return btoa(username + ":" + password); } // Login document.getElementById('loginForm').addEventListener('submit', function(e) { e.preventDefault(); const user = document.getElementById('username').value; const pass = document.getElementById('password').value; authHeader = "Basic " + encodeBasicAuth(user, pass); document.getElementById('formSection').style.display = 'block'; document.getElementById('loginForm').parentElement.style.display = 'none'; }); // Env铆o de producto con i18n document.getElementById('productoForm').addEventListener('submit', async function(e) { e.preventDefault(); const lang = document.getElementById('languageSelect').value; const producto = { nombre: document.getElementById('nombre').value, descripcion: document.getElementById('descripcion').value, precio: parseFloat(document.getElementById('precio').value), stock: parseInt(document.getElementById('stock').value) }; try { const res = await fetch('http://localhost:8080/api/productos', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': authHeader, 'Accept-Language': lang }, body: JSON.stringify(producto) }); const data = await res.json(); showStatus(data.message || 'Operaci贸n completada.', res.ok ? 'success' : 'error'); if (res.ok) document.getElementById('productoForm').reset(); } catch (err) { showStatus('Error de conexi贸n con el servidor', 'error'); } }); function showStatus(message, type) { const status = document.getElementById('statusMessage'); status.textContent = message; status.className = 'status-message ' + type; status.style.display = 'block'; setTimeout(() => { status.style.display = 'none'; }, 5000); } </script> </body> </html> - Initial Deployment
a7be866
verified
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Inventario Electr贸nico | Gestor de Productos</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
<script> | |
tailwind.config = { | |
theme: { | |
extend: { | |
colors: { | |
primary: { | |
50: '#f0f4ff', | |
100: '#e0e8ff', | |
200: '#c7d2fe', | |
300: '#a5b4fc', | |
400: '#818cf8', | |
500: '#6366f1', | |
600: '#4f46e5', | |
700: '#4338ca', | |
800: '#3730a3', | |
900: '#312e81', | |
}, | |
}, | |
fontFamily: { | |
sans: ['Inter', 'sans-serif'], | |
}, | |
animation: { | |
'fade-in': 'fadeIn 0.3s ease-in-out', | |
}, | |
keyframes: { | |
fadeIn: { | |
'0%': { opacity: '0', transform: 'translateY(10px)' }, | |
'100%': { opacity: '1', transform: 'translateY(0)' }, | |
} | |
} | |
} | |
} | |
} | |
</script> | |
<style> | |
@keyframes float { | |
0% { transform: translateY(0px); } | |
50% { transform: translateY(-10px); } | |
100% { transform: translateY(0px); } | |
} | |
.gradient-text { | |
background: linear-gradient(90deg, #6366f1, #8b5cf6); | |
-webkit-background-clip: text; | |
background-clip: text; | |
color: transparent; | |
} | |
.electron-bg { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
z-index: -1; | |
opacity: 0.1; | |
background-image: radial-gradient(#4338ca 1px, transparent 1px); | |
background-size: 20px 20px; | |
} | |
</style> | |
</head> | |
<body class="bg-gray-50 min-h-screen flex flex-col font-sans"> | |
<div class="electron-bg"></div> | |
<!-- Header --> | |
<header class="bg-gradient-to-r from-primary-700 to-primary-800 shadow-lg"> | |
<div class="container mx-auto px-6 py-4"> | |
<div class="flex items-center justify-between"> | |
<div class="flex items-center space-x-2"> | |
<div class="text-white p-2 bg-primary-600 rounded-lg shadow"> | |
<i class="fas fa-microchip text-xl"></i> | |
</div> | |
<h1 class="text-2xl font-bold text-white">Inventario<span class="font-light">Electr贸nico</span></h1> | |
</div> | |
<div class="flex items-center space-x-4"> | |
<div class="relative"> | |
<label class="sr-only" for="languageSelect">Idioma</label> | |
<div class="relative"> | |
<select id="languageSelect" class="appearance-none bg-white bg-opacity-20 border border-white border-opacity-20 text-white pl-4 pr-8 py-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200 cursor-pointer"> | |
<option value="es" class="text-gray-900">馃嚜馃嚫 Espa帽ol</option> | |
<option value="en" class="text-gray-900">馃嚞馃嚙 English</option> | |
</select> | |
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-white"> | |
<i class="fas fa-chevron-down text-sm"></i> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</header> | |
<main class="flex-grow flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8"> | |
<!-- Login Card --> | |
<div id="loginCard" class="w-full max-w-md bg-white rounded-xl shadow-2xl overflow-hidden transition-all duration-300 transform animate-fade-in"> | |
<div class="p-8"> | |
<div class="flex justify-center mb-6"> | |
<div class="p-3 bg-primary-100 rounded-full animate-float"> | |
<i class="fas fa-lock text-primary-600 text-3xl"></i> | |
</div> | |
</div> | |
<h2 class="text-center text-2xl font-bold text-gray-800 mb-6"> | |
<span class="gradient-text">Acceso al Sistema</span> | |
</h2> | |
<form id="loginForm" class="space-y-6"> | |
<div> | |
<label for="username" class="block text-sm font-medium text-gray-700 mb-1">Usuario</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-user text-gray-400"></i> | |
</div> | |
<input id="username" name="username" type="text" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="Ingrese su usuario"> | |
</div> | |
</div> | |
<div> | |
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">Contrase帽a</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-key text-gray-400"></i> | |
</div> | |
<input id="password" name="password" type="password" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="Ingrese su contrase帽a"> | |
</div> | |
</div> | |
<div> | |
<button type="submit" | |
class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition duration-300 transform hover:scale-[1.02]"> | |
<i class="fas fa-sign-in-alt mr-2"></i> Iniciar Sesi贸n | |
</button> | |
</div> | |
</form> | |
</div> | |
<div class="bg-gray-50 px-8 py-4 border-t border-gray-200"> | |
<p class="text-xs text-gray-500 text-center"> | |
驴Necesitas ayuda? <a href="#" class="font-medium text-primary-600 hover:text-primary-700">Cont谩ctanos</a> | |
</p> | |
</div> | |
</div> | |
<!-- Product Form Card (initially hidden) --> | |
<div id="formSection" class="w-full max-w-md bg-white rounded-xl shadow-2xl overflow-hidden transition-all duration-300 transform animate-fade-in hidden"> | |
<div class="p-8"> | |
<div class="flex justify-center mb-6"> | |
<div class="p-3 bg-primary-100 rounded-full animate-float"> | |
<i class="fas fa-boxes text-primary-600 text-3xl"></i> | |
</div> | |
</div> | |
<h2 class="text-center text-2xl font-bold text-gray-800 mb-6"> | |
<span class="gradient-text">Registrar Producto</span> | |
</h2> | |
<form id="productoForm" class="space-y-4"> | |
<div> | |
<label for="nombre" class="block text-sm font-medium text-gray-700 mb-1">Nombre del producto</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-tag text-gray-400"></i> | |
</div> | |
<input id="nombre" name="nombre" type="text" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="Ej: Resistor 1k惟"> | |
</div> | |
</div> | |
<div> | |
<label for="descripcion" class="block text-sm font-medium text-gray-700 mb-1">Descripci贸n</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-align-left text-gray-400"></i> | |
</div> | |
<input id="descripcion" name="descripcion" type="text" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="Especificaciones t茅cnicas"> | |
</div> | |
</div> | |
<div class="grid grid-cols-2 gap-4"> | |
<div> | |
<label for="precio" class="block text-sm font-medium text-gray-700 mb-1">Precio unitario</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-dollar-sign text-gray-400"></i> | |
</div> | |
<input id="precio" name="precio" type="number" step="0.01" min="0" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="0.00"> | |
</div> | |
</div> | |
<div> | |
<label for="stock" class="block text-sm font-medium text-gray-700 mb-1">Cantidad en stock</label> | |
<div class="relative"> | |
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> | |
<i class="fas fa-cubes text-gray-400"></i> | |
</div> | |
<input id="stock" name="stock" type="number" min="0" required | |
class="w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition duration-300" | |
placeholder="0"> | |
</div> | |
</div> | |
</div> | |
<div class="pt-2"> | |
<button type="submit" | |
class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition duration-300 transform hover:scale-[1.02]"> | |
<i class="fas fa-save mr-2"></i> Guardar Producto | |
</button> | |
</div> | |
</form> | |
<div id="statusMessage" class="mt-4 hidden"> | |
<div id="statusContent" class="p-3 rounded-lg text-sm"></div> | |
</div> | |
</div> | |
<div class="bg-gray-50 px-8 py-4 border-t border-gray-200"> | |
<p class="text-xs text-gray-500 text-center"> | |
<a href="#" id="backToLogin" class="font-medium text-primary-600 hover:text-primary-700 flex items-center justify-center"> | |
<i class="fas fa-arrow-left mr-1"></i> Volver al inicio de sesi贸n | |
</a> | |
</p> | |
</div> | |
</div> | |
</main> | |
<footer class="bg-gray-800 text-white py-6"> | |
<div class="container mx-auto px-6"> | |
<div class="flex flex-col md:flex-row justify-between items-center"> | |
<div class="text-center md:text-left mb-4 md:mb-0"> | |
<p class="text-sm">漏 2025 <span class="font-medium">Inventario Electr贸nico</span>. Todos los derechos reservados.</p> | |
</div> | |
<div class="flex space-x-6"> | |
<a href="#" class="text-gray-400 hover:text-primary-400 transition duration-300"> | |
<i class="fab fa-github"></i> | |
</a> | |
<a href="#" class="text-gray-400 hover:text-primary-400 transition duration-300"> | |
<i class="fab fa-linkedin"></i> | |
</a> | |
<a href="#" class="text-gray-400 hover:text-primary-400 transition duration-300"> | |
<i class="fab fa-twitter"></i> | |
</a> | |
<a href="#" class="text-gray-400 hover:text-primary-400 transition duration-300"> | |
<i class="fas fa-envelope"></i> | |
</a> | |
</div> | |
</div> | |
</div> | |
</footer> | |
<script> | |
let authHeader = ""; | |
// Floating animation for icons | |
document.querySelectorAll('.animate-float').forEach(el => { | |
el.style.animation = 'float 3s ease-in-out infinite'; | |
}); | |
function encodeBasicAuth(username, password) { | |
return btoa(username + ":" + password); | |
} | |
// Login | |
document.getElementById('loginForm').addEventListener('submit', function(e) { | |
e.preventDefault(); | |
const user = document.getElementById('username').value; | |
const pass = document.getElementById('password').value; | |
// Basic animation to hide login and show product form | |
const loginCard = document.getElementById('loginCard'); | |
const formSection = document.getElementById('formSection'); | |
loginCard.classList.add('-translate-y-2', 'opacity-0'); | |
setTimeout(() => { | |
loginCard.classList.add('hidden'); | |
loginCard.classList.remove('-translate-y-2', 'opacity-0'); | |
formSection.classList.remove('hidden'); | |
formSection.classList.add('animate-fade-in'); | |
authHeader = "Basic " + encodeBasicAuth(user, pass); | |
}, 300); | |
}); | |
// Back to login button | |
document.getElementById('backToLogin').addEventListener('click', function(e) { | |
e.preventDefault(); | |
const loginCard = document.getElementById('loginCard'); | |
const formSection = document.getElementById('formSection'); | |
formSection.classList.add('hidden'); | |
loginCard.classList.remove('hidden'); | |
loginCard.classList.add('animate-fade-in'); | |
}); | |
// Product form submission with i18n | |
document.getElementById('productoForm').addEventListener('submit', async function(e) { | |
e.preventDefault(); | |
const lang = document.getElementById('languageSelect').value; | |
const statusMessage = document.getElementById('statusMessage'); | |
const statusContent = document.getElementById('statusContent'); | |
const producto = { | |
nombre: document.getElementById('nombre').value, | |
descripcion: document.getElementById('descripcion').value, | |
precio: parseFloat(document.getElementById('precio').value), | |
stock: parseInt(document.getElementById('stock').value) | |
}; | |
// Show loading state | |
const submitBtn = e.target.querySelector('button[type="submit"]'); | |
const originalBtnText = submitBtn.innerHTML; | |
submitBtn.innerHTML = '<i class="fas fa-circle-notch fa-spin mr-2"></i> Procesando...'; | |
submitBtn.disabled = true; | |
try { | |
const res = await fetch('http://localhost:8080/api/productos', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': authHeader, | |
'Accept-Language': lang | |
}, | |
body: JSON.stringify(producto) | |
}); | |
const data = await res.json(); | |
// Show status message with appropriate styling | |
statusMessage.classList.remove('hidden'); | |
statusContent.textContent = data.message || (res.ok ? 'Operaci贸n completada exitosamente!' : 'Hubo un error'); | |
if (res.ok) { | |
statusContent.className = 'p-3 rounded-lg text-sm bg-green-100 text-green-800'; | |
document.getElementById('productoForm').reset(); | |
} else { | |
statusContent.className = 'p-3 rounded-lg text-sm bg-red-100 text-red-800'; | |
} | |
// Hide status message after 5 seconds | |
setTimeout(() => { | |
statusMessage.classList.add('hidden'); | |
}, 5000); | |
} catch (err) { | |
statusMessage.classList.remove('hidden'); | |
statusContent.className = 'p-3 rounded-lg text-sm bg-red-100 text-red-800'; | |
statusContent.textContent = 'Error de conexi贸n con el servidor'; | |
setTimeout(() => { | |
statusMessage.classList.add('hidden'); | |
}, 5000); | |
} finally { | |
submitBtn.innerHTML = originalBtnText; | |
submitBtn.disabled = false; | |
} | |
}); | |
</script> | |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 馃К <a href="https://enzostvs-deepsite.hf.space?remix=fakesisalg/test23" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
</html> |