new file: .env

new file:   bot.db
	new file:   db/db.go
	new file:   go.mod
	new file:   go.sum
	new file:   handlers/dashboard.go
	new file:   handlers/webhook.go
	new file:   main.go
	new file:   services/openrouter.go
	new file:   services/whatsapp.go
	new file:   templates/dashboard.html
	new file:   types/types.go
This commit is contained in:
2026-03-01 05:07:40 -03:00
parent 3412ff41ec
commit 7a5f5d86f4
12 changed files with 443 additions and 0 deletions

71
templates/dashboard.html Normal file
View File

@@ -0,0 +1,71 @@
{{ define "dashboard.html" }}
<!DOCTYPE html>
<html>
<head>
<title>SekiBot Admin</title>
<style>
body { font-family: 'Segoe UI', sans-serif; background: #121212; color: white; padding: 40px; }
.card { background: #1e1e1e; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #333; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #333; }
button { background: #3498db; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; }
button.delete { background: #e74c3c; }
input { padding: 8px; border-radius: 4px; border: 1px solid #444; background: #222; color: white; width: 70%; }
#ai-response { margin-top: 10px; padding: 10px; background: #2c3e50; border-radius: 4px; display: none; }
</style>
</head>
<body>
<h1>SekiBot Business Analytics</h1>
<!-- AI Test Section -->
<div class="card">
<h2>Test OpenRouter AI</h2>
<input type="text" id="ai-input" placeholder="Ask the bot something...">
<button onclick="testAI()">Send</button>
<div id="ai-response"></div>
</div>
<!-- Appointments Management -->
<div class="card">
<h2>Manage Appointments</h2>
<table>
<tr><th>ID</th><th>Customer</th><th>Date</th><th>Status</th><th>Actions</th></tr>
{{range .Appointments}}
<tr id="appt-{{.ID}}">
<td>{{.ID}}</td>
<td>{{.CustomerPhone}}</td>
<td>{{.Date}}</td>
<td>{{.Status}}</td>
<td>
<button class="delete" onclick="deleteAppt({{.ID}})">Cancel</button>
</td>
</tr>
{{end}}
</table>
</div>
<script>
async function testAI() {
const input = document.getElementById('ai-input').value;
const resDiv = document.getElementById('ai-response');
resDiv.style.display = 'block';
resDiv.innerText = 'Thinking... (Wait for it, seki)';
const res = await fetch('/admin/test-ai', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: input})
});
const data = await res.json();
resDiv.innerText = data.response;
}
async function deleteAppt(id) {
if(!confirm('Really cancel this?')) return;
await fetch(`/admin/appointment/${id}`, { method: 'DELETE' });
document.getElementById(`appt-${id}`).remove();
}
</script>
</body>
</html>
{{ end }}