83 lines
3.0 KiB
HTML
83 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>Crear Sitio - Demo</title>
|
||
<style>
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
body {
|
||
font-family: Arial, sans-serif;
|
||
background: #f5f5f5;
|
||
padding: 20px;
|
||
}
|
||
.container {
|
||
max-width: 600px;
|
||
margin: 0 auto;
|
||
background: white;
|
||
padding: 30px;
|
||
border-radius: 10px;
|
||
}
|
||
h1 { margin-bottom: 20px; }
|
||
input, select {
|
||
width: 100%;
|
||
padding: 12px;
|
||
margin-bottom: 15px;
|
||
border: 1px solid #ddd;
|
||
border-radius: 5px;
|
||
}
|
||
.btn {
|
||
padding: 12px 30px;
|
||
background: #667eea;
|
||
color: white;
|
||
border: none;
|
||
border-radius: 5px;
|
||
cursor: pointer;
|
||
}
|
||
.btn:hover { background: #5568d3; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<h1>➕ Crear Nuevo Sitio</h1>
|
||
<form id="createForm">
|
||
<input type="text" id="site_name" placeholder="Nombre del sitio" required>
|
||
<input type="text" id="slug" placeholder="Slug (URL)" required>
|
||
<input type="text" id="hero_title" placeholder="Título principal" required>
|
||
<textarea id="hero_description" placeholder="Descripción" style="width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 5px; margin-bottom: 15px;"></textarea>
|
||
<select id="theme">
|
||
<option value="default">Tema Default</option>
|
||
<option value="modern">Tema Moderno</option>
|
||
</select>
|
||
<button type="submit" class="btn">Crear Sitio</button>
|
||
</form>
|
||
<a href="/dashboard" style="display: inline-block; margin-top: 15px; color: #667eea;">← Volver</a>
|
||
</div>
|
||
|
||
<script>
|
||
document.getElementById('createForm').addEventListener('submit', async (e) => {
|
||
e.preventDefault();
|
||
const data = {
|
||
site_name: document.getElementById('site_name').value,
|
||
slug: document.getElementById('slug').value,
|
||
hero_title: document.getElementById('hero_title').value,
|
||
hero_description: document.getElementById('hero_description').value,
|
||
theme: document.getElementById('theme').value
|
||
};
|
||
|
||
const res = await fetch('/dashboard/create', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify(data)
|
||
});
|
||
|
||
const result = await res.json();
|
||
if (result.success) {
|
||
window.location.href = `/customizer/${result.site_id}`;
|
||
} else {
|
||
alert(result.error || 'Error al crear sitio');
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|