109 lines
3.5 KiB
HTML
109 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>Dashboard - Demo</title>
|
||
<style>
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
body {
|
||
font-family: Arial, sans-serif;
|
||
background: #f5f5f5;
|
||
padding: 20px;
|
||
}
|
||
.header {
|
||
background: white;
|
||
padding: 20px;
|
||
border-radius: 5px;
|
||
margin-bottom: 20px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
.btn {
|
||
padding: 10px 20px;
|
||
background: #667eea;
|
||
color: white;
|
||
text-decoration: none;
|
||
border-radius: 5px;
|
||
}
|
||
.sites {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||
gap: 20px;
|
||
}
|
||
.site-card {
|
||
background: white;
|
||
padding: 20px;
|
||
border-radius: 5px;
|
||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||
}
|
||
.status {
|
||
display: inline-block;
|
||
padding: 5px 10px;
|
||
border-radius: 3px;
|
||
font-size: 12px;
|
||
margin-top: 10px;
|
||
}
|
||
.status.draft { background: #ffc107; }
|
||
.status.pending { background: #ff9800; }
|
||
.status.published { background: #4caf50; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="header">
|
||
<h1>📊 Mi Panel de Control</h1>
|
||
<div>
|
||
<a href="/dashboard/admin" class="btn" style="background: #28a745;">⚙️ Admin</a>
|
||
<a href="/dashboard/create" class="btn">➕ Crear Sitio</a>
|
||
<a href="/logout" class="btn" style="background: #ff4d4d;">Salir</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="sites">
|
||
{% for site in sites %}
|
||
<div class="site-card">
|
||
<h3>{{ site.slug }}</h3>
|
||
<p>Tema: {{ site.theme }}</p>
|
||
<span class="status {{ site.status }}">{{ site.status }}</span>
|
||
<div style="margin-top: 15px;">
|
||
<a href="/customizer/{{ site.id }}" class="btn">✏️ Editar</a>
|
||
{% if site.status == 'draft' %}
|
||
<button onclick="submitSite({{ site.id }})" class="btn" style="background: #ff9800; border: none; cursor: pointer;">📤 Enviar</button>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
{% endfor %}
|
||
|
||
{% if not sites %}
|
||
<div class="site-card">
|
||
<p>No tienes sitios aún. <a href="/dashboard/create">Crear uno</a></p>
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
|
||
<script>
|
||
function submitSite(siteId) {
|
||
if (confirm('¿Enviar sitio para aprobación?')) {
|
||
fetch(`/dashboard/submit/${siteId}`, {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'}
|
||
})
|
||
.then(r => r.json())
|
||
.then(data => {
|
||
if (data.success) {
|
||
alert('✅ Sitio enviado para aprobación');
|
||
location.reload();
|
||
} else {
|
||
alert('❌ Error: ' + (data.error || 'Error al enviar'));
|
||
}
|
||
})
|
||
.catch(err => {
|
||
console.error('Error:', err);
|
||
alert('❌ Error de conexión');
|
||
});
|
||
}
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|