<?php
session_start();
if (!isset($_SESSION['rol']) || !in_array($_SESSION['rol'], ['admin', 'adminTi'])) {
  header('Location: ../../index.php');
  exit;
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8" />
  <title>Deducciones</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <!-- Bootstrap + FontAwesome -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet" />
  <link href="../assets/css/recruiter.css" rel="stylesheet" />
</head>
<body class="bg-light">

<div class="d-flex">
  <?php include '../includes/sidebar.php'; ?>

  <div class="main-content flex-grow-1 p-4">
    <?php include '../includes/topbar.php'; ?>

    <div class="container mt-4">
      <div class="d-flex justify-content-between align-items-center mb-3">
        <h3 class="mb-0"><i class="fas fa-file-invoice text-primary me-2"></i>Prestamos y descuentos</h3>
        <div>
          <button id="btnNuevo" class="btn btn-success"><i class="fas fa-plus me-1"></i>Nuevo</button>
        </div>
      </div>

      <div class="table-responsive">
        <table class="table table-bordered align-middle text-center" id="tablaDeducciones">
          <thead class="table-light">
            <tr>
              <th>Descripción</th>
              <th>Monto</th>
              <th>Parcialidad a cubrir</th>
              <th>Parcialidades pendientes</th>
              <th>Parcialidades totales</th>
              <th>Interés fijo</th>
              <th>Inicio de pago</th>
              <th>Fecha fin</th>
              <th>Solicitante</th>
              <th>Activo</th>
              <th>Acciones</th>
            </tr>
          </thead>
          <tbody></tbody>
        </table>
      </div>
    </div>
  </div>
</div>


<!-- jQuery y DataTables antes del script principal -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>

<!-- SweetAlert2 -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>


<!-- Tu script modular principal -->
<script type="module" src="assets/js/deducciones.js"></script>

</body>
</html>
