File size: 28,668 Bytes
03dee78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard Pedidos & Chatwoot</title>
<script src="https://cdn.tailwindcss.com"></script>
<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: '#4F46E5',
secondary: '#10B981',
danger: '#EF4444',
warning: '#F59E0B',
}
}
}
}
</script>
<style>
/* Custom CSS for printer-friendly version */
@media print {
body * {
visibility: hidden;
}
.print-content, .print-content * {
visibility: visible;
}
.print-content {
position: absolute;
left: 0;
top: 0;
width: 100%;
font-family: 'Courier New', monospace;
}
.no-print {
display: none;
}
}
/* Animation for status changes */
@keyframes pulse {
0% { opacity: 0.6; }
50% { opacity: 1; }
100% { opacity: 0.6; }
}
.pulse-animation {
animation: pulse 1.5s infinite;
}
/* Smooth transitions for status changes */
.status-change {
transition: background-color 0.3s ease, color 0.3s ease;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<!-- Header with Developer Logo and Client Logo Area -->
<header class="bg-gradient-to-r from-red-600 to-red-800 shadow-lg">
<div class="max-w-7xl mx-auto px-4 py-3 flex justify-between items-center">
<div class="flex items-center space-x-4">
<img src="https://cdn-icons-png.flaticon.com/512/2819/2819205.png"
alt="Restaurant Logo" class="h-12">
<div>
<h1 class="text-2xl font-bold text-white">Restaurant Dashboard</h1>
<p class="text-xs text-red-100">Painel de pedidos em tempo real</p>
</div>
</div>
<div id="clientLogoArea" class="flex items-center">
<div class="bg-white/20 p-2 rounded-lg backdrop-blur-sm">
<img id="restaurantLogo" src="" alt="Restaurant Logo" class="h-10 max-w-xs object-contain hidden">
<span class="text-white text-sm" id="logoPlaceholder">Logo Restaurante</span>
</div>
</div>
<div>
<button id="adminBtn" class="bg-white/20 hover:bg-white/30 text-white px-4 py-2 rounded-full backdrop-blur-sm transition-all">
<i class="fas fa-cog mr-2"></i>Administração
</button>
</div>
</div>
</header>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 py-6">
<!-- Tabs Navigation -->
<div class="flex mb-6">
<button id="ordersTab" class="px-6 py-3 font-medium text-white bg-red-600 rounded-t-lg shadow-sm">
<i class="fas fa-utensils mr-2"></i>Pedidos
</button>
<button id="chatwootTab" class="px-6 py-3 font-medium text-red-800 bg-white ml-1 rounded-t-lg shadow-sm hover:bg-gray-100 transition-colors">
<i class="fas fa-comments mr-2"></i>Chatwoot
</button>
</div>
<!-- Orders Dashboard -->
<div id="ordersDashboard" class="">
<!-- Filters and Search -->
<div class="bg-white rounded-lg shadow p-4 mb-6">
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
<div class="flex space-x-2">
<select class="border rounded px-3 py-2">
<option>Todos os status</option>
<option>Pendente</option>
<option>Em produção</option>
<option>Saiu para entrega</option>
<option>Entregue</option>
</select>
<input type="date" class="border rounded px-3 py-2">
</div>
<div class="relative flex-1 max-w-md">
<input type="text" placeholder="Buscar pedido..." class="border rounded px-3 py-2 pl-10 w-full">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
</div>
<!-- Orders List -->
<div class="bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200">
<div class="grid grid-cols-12 bg-red-600 text-white p-4 font-medium">
<div class="col-span-1 font-bold">Nº</div>
<div class="col-span-2 font-bold">Cliente</div>
<div class="col-span-2 font-bold">Data/Hora</div>
<div class="col-span-2 font-bold">Total</div>
<div class="col-span-2 font-bold">Pagamento</div>
<div class="col-span-2 font-bold">Status</div>
<div class="col-span-1 font-bold">Ações</div>
</div>
<!-- Order Item (Repeater) -->
<div class="order-item grid grid-cols-12 items-center p-4 border-b border-gray-200 hover:bg-red-50 transition-colors duration-200">
<div class="col-span-1 font-bold text-red-600">#1234</div>
<div class="col-span-2">João da Silva</div>
<div class="col-span-2 text-sm text-gray-600">10/06/2023 14:30</div>
<div class="col-span-2 font-semibold">R$ 59,90</div>
<div class="col-span-2">
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-blue-100 text-blue-800">
<i class="fas fa-credit-card mr-1"></i> Cartão
</span>
</div>
<div class="col-span-2">
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 animate-pulse status-change">
<i class="fas fa-clock mr-1"></i> Pendente
</span>
</div>
<div class="col-span-1 flex justify-center">
<button class="view-details-btn text-red-600 hover:text-red-800 transition-colors">
<i class="fas fa-eye hover:scale-110 transition-transform"></i>
</button>
</div>
</div>
<!-- More order items would go here -->
</div>
</div>
<!-- Chatwoot Dashboard (Hidden by default) -->
<div id="chatwootDashboard" class="hidden">
<div class="bg-white rounded-lg shadow p-6">
<h2 class="text-xl font-bold mb-4">Conversas do Chatwoot</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="col-span-1">
<div class="bg-gray-100 p-4 rounded-lg">
<h3 class="font-medium mb-2">Conversas Ativas</h3>
<div class="space-y-2" id="activeChats">
<!-- Active chats would appear here -->
</div>
</div>
</div>
<div class="col-span-2">
<div class="bg-gray-100 p-4 rounded-lg h-96 overflow-y-auto">
<h3 class="font-medium mb-2">Mensagens</h3>
<div id="chatMessages">
<!-- Chat messages would appear here -->
</div>
</div>
<div class="mt-4">
<textarea class="w-full border rounded p-3" placeholder="Digite sua mensagem..."></textarea>
<button class="mt-2 bg-primary text-white px-4 py-2 rounded hover:bg-indigo-700">Enviar</button>
</div>
</div>
</div>
</div>
</div>
<!-- Order Details Modal (Hidden by default) -->
<div id="orderDetailsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-start mb-4">
<h3 class="text-xl font-bold">Detalhes do Pedido #1234</h3>
<button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<h4 class="font-medium mb-2 text-gray-700">Informações do Cliente</h4>
<div class="bg-gray-50 p-4 rounded-lg">
<p><span class="font-medium">Nome:</span> João da Silva</p>
<p><span class="font-medium">Telefone:</span> (11) 98765-4321</p>
<p><span class="font-medium">Endereço:</span> Rua Exemplo, 123 - Centro</p>
<p><span class="font-medium">Referência:</span> Próximo à praça</p>
</div>
</div>
<div>
<h4 class="font-medium mb-2 text-gray-700">Resumo do Pedido</h4>
<div class="bg-gray-50 p-4 rounded-lg">
<p><span class="font-medium">Data/Hora:</span> 10/06/2023 14:30</p>
<p><span class="font-medium">Pagamento:</span> Cartão (Crédito)</p>
<p><span class="font-medium">Entrega:</span> R$ 5,00</p>
<p><span class="font-medium">Total:</span> R$ 59,90</p>
<div class="mt-2">
<span class="font-medium">Status:</span>
<span id="orderStatus" class="px-2 py-1 rounded-full text-xs bg-yellow-100 text-yellow-800">Pendente</span>
</div>
</div>
</div>
</div>
<div class="mb-6">
<h4 class="font-medium mb-2 text-gray-700">Itens do Pedido</h4>
<div class="border rounded-lg overflow-hidden">
<div class="grid grid-cols-12 bg-gray-100 p-3 font-medium">
<div class="col-span-6">Item</div>
<div class="col-span-2 text-center">Qtd</div>
<div class="col-span-2 text-right">Preço</div>
<div class="col-span-2 text-right">Subtotal</div>
</div>
<div class="item-list">
<!-- Items would be listed here -->
<div class="grid grid-cols-12 p-3 border-b">
<div class="col-span-6">Pizza Margherita</div>
<div class="col-span-2 text-center">1</div>
<div class="col-span-2 text-right">R$ 35,90</div>
<div class="col-span-2 text-right">R$ 35,90</div>
</div>
<div class="grid grid-cols-12 p-3 border-b">
<div class="col-span-6">Refrigerante 2L</div>
<div class="col-span-2 text-center">1</div>
<div class="col-span-2 text-right">R$ 10,00</div>
<div class="col-span-2 text-right">R$ 10,00</div>
</div>
<div class="grid grid-cols-12 p-3 font-medium bg-gray-50">
<div class="col-span-10 text-right">Total:</div>
<div class="col-span-2 text-right">R$ 45,90</div>
</div>
</div>
</div>
</div>
<div class="flex flex-wrap justify-between gap-4">
<button id="printOrderBtn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded flex items-center">
<i class="fas fa-print mr-2"></i> Imprimir Comanda
</button>
<div class="flex space-x-2">
<button id="preparingBtn" class="bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded flex items-center">
<i class="fas fa-utensils mr-2"></i> Em Produção
</button>
<button id="deliveryBtn" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded flex items-center">
<i class="fas fa-motorcycle mr-2"></i> Saiu para Entrega
</button>
<button id="deliveredBtn" class="bg-purple-500 hover:bg-purple-600 text-white px-4 py-2 rounded flex items-center">
<i class="fas fa-check-circle mr-2"></i> Entregue
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Print Content (Hidden until print button is clicked) -->
<div id="printContent" class="print-content hidden">
<div class="p-4">
<div class="text-center mb-4">
<h2 class="text-xl font-bold" id="printRestaurantName">NOME DO RESTAURANTE</h2>
<p class="text-sm" id="printRestaurantInfo">Endereço: Rua Exemplo, 123 | Tel: (11) 1234-5678</p>
</div>
<div class="border-t-2 border-b-2 border-black py-2 mb-2">
<p class="text-center font-medium">COMANDA #<span id="printOrderNumber">1234</span></p>
<p class="text-center text-sm"><span id="printOrderDate">10/06/2023 14:30</span></p>
</div>
<div class="mb-2">
<p><span class="font-medium">Cliente:</span> <span id="printCustomerName">João da Silva</span></p>
<p><span class="font-medium">Endereço:</span> <span id="printCustomerAddress">Rua Exemplo, 123 - Centro</span></p>
<p><span class="font-medium">Referência:</span> <span id="printCustomerRef">Próximo à praça</span></p>
<p><span class="font-medium">Telefone:</span> <span id="printCustomerPhone">(11) 98765-4321</span></p>
</div>
<table class="w-full mb-2">
<thead>
<tr class="border-b border-black">
<th class="text-left">Item</th>
<th class="text-right">Qtd</th>
<th class="text-right">Preço</th>
<th class="text-right">Subtotal</th>
</tr>
</thead>
<tbody id="printOrderItems">
<tr>
<td>Pizza Margherita</td>
<td class="text-right">1</td>
<td class="text-right">35,90</td>
<td class="text-right">35,90</td>
</tr>
<tr>
<td>Refrigerante 2L</td>
<td class="text-right">1</td>
<td class="text-right">10,00</td>
<td class="text-right">10,00</td>
</tr>
<tr class="font-bold">
<td class="border-t border-black">Entrega</td>
<td class="border-t border-black"></td>
<td class="border-t border-black"></td>
<td class="border-t border-black text-right">5,00</td>
</tr>
<tr class="font-bold">
<td class="border-t border-black">Total</td>
<td class="border-t border-black"></td>
<td class="border-t border-black"></td>
<td class="border-t border-black text-right">50,90</td>
</tr>
</tbody>
</table>
<div class="text-center mt-4">
<p>__________________________________________</p>
<p>Assinatura do Entregador</p>
</div>
<div class="text-center mt-4 text-xs">
<p>Muito obrigado pela preferência!</p>
<p>Volte sempre!</p>
</div>
</div>
</div>
<!-- Admin Modal (Hidden by default) -->
<div id="adminModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-start mb-4">
<h3 class="text-xl font-bold">Configurações de Administração</h3>
<button id="closeAdminModalBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="space-y-6">
<div>
<h4 class="font-medium mb-2 text-gray-700">Informações do Estabelecimento</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-1">Nome do Estabelecimento</label>
<input type="text" class="w-full border rounded px-3 py-2" value="Meu Restaurante">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Endereço</label>
<input type="text" class="w-full border rounded px-3 py-2" value="Rua Exemplo, 123">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Telefone</label>
<input type="text" class="w-full border rounded px-3 py-2" value="(11) 1234-5678">
</div>
</div>
</div>
<div>
<h4 class="font-medium mb-2 text-gray-700">Logo do Estabelecimento</h4>
<div class="flex items-center space-x-4">
<div id="clientLogoPreview" class="h-20 w-20 bg-gray-200 rounded flex items-center justify-center overflow-hidden">
<span class="text-gray-500 text-xs">Logo do Cliente</span>
</div>
<div>
<input type="file" id="logoUpload" class="hidden" accept="image/*">
<button id="uploadLogoBtn" class="bg-primary text-white px-4 py-2 rounded hover:bg-indigo-700">
<i class="fas fa-upload mr-2"></i> Carregar Logo
</button>
<p class="text-xs text-gray-500 mt-1">Max. 1MB (Recomendado: 200x200px)</p>
</div>
</div>
</div>
<div>
<h4 class="font-medium mb-2 text-gray-700">Configurações de Webhook</h4>
<div class="space-y-2">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">URL Webhook Pedido em Produção</label>
<input type="text" class="w-full border rounded px-3 py-2" placeholder="https://exemplo.com/webhook/producao">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">URL Webhook Pedido Saiu para Entrega</label>
<input type="text" class="w-full border rounded px-3 py-2" placeholder="https://exemplo.com/webhook/entrega">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">URL Webhook Pedido Entregue</label>
<input type="text" class="w-full border rounded px-3 py-2" placeholder="https://exemplo.com/webhook/entregue">
</div>
</div>
</div>
<div class="pt-4 border-t">
<button class="bg-primary text-white px-6 py-2 rounded-lg hover:bg-indigo-700">
Salvar Configurações
</button>
</div>
</div>
</div>
</div>
</div>
</main>
<script>
// DOM Elements
const ordersTab = document.getElementById('ordersTab');
const chatwootTab = document.getElementById('chatwootTab');
const ordersDashboard = document.getElementById('ordersDashboard');
const chatwootDashboard = document.getElementById('chatwootDashboard');
const viewDetailsBtns = document.querySelectorAll('.view-details-btn');
const orderDetailsModal = document.getElementById('orderDetailsModal');
const closeModalBtn = document.getElementById('closeModalBtn');
const printOrderBtn = document.getElementById('printOrderBtn');
const preparingBtn = document.getElementById('preparingBtn');
const deliveryBtn = document.getElementById('deliveryBtn');
const deliveredBtn = document.getElementById('deliveredBtn');
const orderStatus = document.getElementById('orderStatus');
const printContent = document.getElementById('printContent');
const adminBtn = document.getElementById('adminBtn');
const adminModal = document.getElementById('adminModal');
const closeAdminModalBtn = document.getElementById('closeAdminModalBtn');
const uploadLogoBtn = document.getElementById('uploadLogoBtn');
const logoUpload = document.getElementById('logoUpload');
const clientLogoPreview = document.getElementById('clientLogoPreview');
const clientLogoArea = document.getElementById('clientLogoArea');
// Status Change Functions
function updateOrderStatus(newStatus, newClass, newText) {
orderStatus.textContent = newText;
orderStatus.className = 'px-2 py-1 rounded-full text-xs ' + newClass;
// Atualize o status no item da lista também
const orderItem = document.querySelector('.order-item');
const statusSpan = orderItem.querySelector('span');
statusSpan.textContent = newText;
statusSpan.className = 'inline-flex items-center px-3 py-1 rounded-full text-xs font-medium ' + newClass;
// Se for "Entregue", remover a animação
if (newStatus === 'delivered') {
statusSpan.classList.remove('animate-pulse');
}
}
// Event Listeners
preparingBtn.addEventListener('click', () => {
updateOrderStatus('preparing', 'bg-orange-100 text-orange-800', 'Em Produção');
});
deliveryBtn.addEventListener('click', () => {
updateOrderStatus('delivery', 'bg-green-100 text-green-800', 'Saiu para Entrega');
});
deliveredBtn.addEventListener('click', () => {
updateOrderStatus('delivered', 'bg-purple-100 text-purple-800', 'Entregue');
});
ordersTab.addEventListener('click', () => {
ordersDashboard.classList.remove('hidden');
chatwootDashboard.classList.add('hidden');
ordersTab.classList.add('border-primary', 'text-primary');
chatwootTab.classList.remove('border-primary', 'text-primary');
});
chatwootTab.addEventListener('click', () => {
ordersDashboard.classList.add('hidden');
chatwootDashboard.classList.remove('hidden');
chatwootTab.classList.add('border-primary', 'text-primary');
ordersTab.classList.remove('border-primary', 'text-primary');
});
viewDetailsBtns.forEach(btn => {
btn.addEventListener('click', () => {
orderDetailsModal.classList.remove('hidden');
document.body.style.overflow = 'hidden';
});
});
closeModalBtn.addEventListener('click', () => {
orderDetailsModal.classList.add('hidden');
document.body.style.overflow = 'auto';
});
printOrderBtn.addEventListener('click', () => {
// Prepare print content
printContent.classList.remove('hidden');
// Use printContent for the comanda
const printWindow = window.open('', '', 'width=600,height=800');
printWindow.document.write('<html><head><title>Comanda #1234</title>');
printWindow.document.write('<style>body { font-family: "Courier New", monospace; padding: 20px; } table { width: 100%; border-collapse: collapse; } th, td { padding: 4px; } .text-right { text-align: right; } .text-center { text-align: center; } .font-bold { font-weight: bold; } .border-black { border-color: black; } .border-t { border-top-width: 1px; } .border-b { border-bottom-width: 1px; }</style>');
printWindow.document.write('</head><body>');
printWindow.document.write(printContent.innerHTML);
printWindow.document.write('<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=LHSS/teste" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html> |