<?php
require_once 'php/config.php';
?>
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ver Traslados - Sufarma v3</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>”9Ý7</text></svg>">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-success shadow-sm">
    <div class="container">
        <a class="navbar-brand" href="traslados.php">Sufarma v3</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
              <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="traslados.php">Registrar Traslado</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="ver_traslados.php">Ver Traslados</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="recepcion.php">Recepcion <span class="badge bg-warning text-dark">!</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="https://sufarmas8.farmaciasjireh.com/index_simplificado.php">Regresar a Ventas </a>
                </li>
            </ul>
        </div>
    </div>
</nav>

<div class="container my-4">
    <div class="card shadow-sm mt-4">
        <div class="card-header bg-info text-dark d-flex justify-content-between align-items-center">
            <h4 class="mb-0">Historial de Traslados (<?php echo NOMBRE_SUCURSAL_ACTUAL; ?>)</h4>
            <div class="btn-group" role="group" aria-label="Filtro de traslados">
                <input type="radio" class="btn-check" name="tipo_traslado" id="ver_enviados" value="enviados" autocomplete="off" checked>
                <label class="btn btn-outline-primary" for="ver_enviados">Enviados</label>

                <input type="radio" class="btn-check" name="tipo_traslado" id="ver_recibidos" value="recibidos" autocomplete="off">
                <label class="btn btn-outline-primary" for="ver_recibidos">Recibidos</label>
            </div>
        </div>
        <div class="card-body">
            <p class="text-muted" id="descripcion_historial">Mostrando traslados enviados desde esta sucursal.</p>
            <div class="table-responsive" style="max-height: 600px; overflow-y: auto;">
                <table class="table table-sm table-striped table-hover">
                    <thead class="table-light sticky-top">
                        <tr>
                            <th>Producto</th>
                            <th>Presentacion</th>
                            <th>Cant.</th>
                            <th>Origen</th>
                            <th>Destino</th>
                            <th>Envio</th>
                            <th>Recibe</th>
                            <th>Facturable</th>
                            <th>Estado</th>
                            <th>Fecha</th>
                        </tr>
                    </thead>
                    <tbody id="tabla_historial_traslados">
                        <tr><td colspan="10" class="text-center text-muted">Cargando historial...</td></tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="js/ver_traslados.js"></script>

</body>
</html>