143 lines
6.0 KiB
PHP
143 lines
6.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../includes/taxilanz.php';
|
|
app_boot();
|
|
|
|
$rides = recent_rides(12);
|
|
$bookings = recent_bookings(12);
|
|
$events = event_summary();
|
|
|
|
render_page_start(
|
|
'Operaciones',
|
|
'Panel ligero para revisar solicitudes, reservas y volumen minimo de eventos del MVP.',
|
|
'operations'
|
|
);
|
|
?>
|
|
<section class="row g-3 mb-4">
|
|
<div class="col-12 col-md-4">
|
|
<div class="metric-card full">
|
|
<span class="metric-label">Solicitudes</span>
|
|
<strong><?= count($rides) ?></strong>
|
|
<small>ultimos registros creados</small>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-md-4">
|
|
<div class="metric-card full">
|
|
<span class="metric-label">Reservas</span>
|
|
<strong><?= count($bookings) ?></strong>
|
|
<small>confirmadas en esta demo</small>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-md-4">
|
|
<div class="metric-card full">
|
|
<span class="metric-label">Eventos</span>
|
|
<strong><?= array_sum($events) ?></strong>
|
|
<small>tracking basico</small>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="row g-4">
|
|
<div class="col-12 col-xl-6">
|
|
<div class="card-shell p-4 h-100">
|
|
<div class="section-head mb-4">
|
|
<div>
|
|
<div class="eyebrow">Rides</div>
|
|
<h1 class="section-title mb-1">Solicitudes recientes</h1>
|
|
</div>
|
|
<a class="text-link" href="/">Nueva solicitud</a>
|
|
</div>
|
|
<?php if (!$rides): ?>
|
|
<div class="empty-state compact">
|
|
<strong>No hay rides aun.</strong>
|
|
<p class="mb-0 text-secondary">La tabla se llena automaticamente despues de crear una solicitud desde el inicio.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="table-responsive">
|
|
<table class="table table-app align-middle mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Ruta</th>
|
|
<th>ETA</th>
|
|
<th>Estado</th>
|
|
<th>Detalle</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($rides as $ride): ?>
|
|
<tr>
|
|
<td>
|
|
<strong><?= h($ride['pickup_label']) ?></strong>
|
|
<div class="text-secondary small">→ <?= h($ride['destination_label']) ?></div>
|
|
</td>
|
|
<td><?= h((string) $ride['eta_minutes']) ?> min</td>
|
|
<td><span class="status-badge subtle"><?= h(status_label($ride['status'])) ?></span></td>
|
|
<td><a class="text-link" href="/rides/confirmed.php?ride=<?= urlencode($ride['uuid']) ?>">Abrir</a></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12 col-xl-6">
|
|
<div class="card-shell p-4 h-100">
|
|
<div class="section-head mb-4">
|
|
<div>
|
|
<div class="eyebrow">Bookings</div>
|
|
<h2 class="section-title mb-1">Reservas recientes</h2>
|
|
</div>
|
|
<span class="status-badge">Live demo</span>
|
|
</div>
|
|
<?php if (!$bookings): ?>
|
|
<div class="empty-state compact">
|
|
<strong>No hay reservas aun.</strong>
|
|
<p class="mb-0 text-secondary">Abre una offer desde la pantalla confirmada y completa el formulario para ver conversiones aqui.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="table-responsive mb-4">
|
|
<table class="table table-app align-middle mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Oferta</th>
|
|
<th>Cliente</th>
|
|
<th>Importe</th>
|
|
<th>Detalle</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($bookings as $booking): ?>
|
|
<tr>
|
|
<td>
|
|
<strong><?= h($booking['offer_title']) ?></strong>
|
|
<div class="text-secondary small"><?= h(format_datetime($booking['created_at'])) ?></div>
|
|
</td>
|
|
<td><?= h($booking['customer_name'] ?: 'Pendiente') ?></td>
|
|
<td><?= h(format_currency($booking['amount'])) ?></td>
|
|
<td><a class="text-link" href="/bookings/success.php?booking=<?= urlencode($booking['uuid']) ?>">Abrir</a></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="detail-card">
|
|
<span class="detail-kicker">Eventos contabilizados</span>
|
|
<div class="event-grid mt-3">
|
|
<?php foreach (['request_created','recommendation_viewed','recommendation_clicked','booking_started','booking_completed'] as $eventType): ?>
|
|
<div>
|
|
<strong><?= $events[$eventType] ?? 0 ?></strong>
|
|
<small><?= h(str_replace('_', ' ', $eventType)) ?></small>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php render_page_end(); ?>
|