File "eliminarEntrega-20260419204432.php"
Full Path: C:/wamp64/www/APPSST/Admin/firmadot/eliminarEntrega-20260419204432.php
File size: 6.62 KB
MIME-type: text/x-php
Charset: utf-8
<?PHP
session_start();
header("Cache-control: private"); // Arregla IE 6
//*******Datos de Conexion Base de Datos************
include("../../bd/conexion.php");
// Procesar búsqueda
$cedula_busqueda = isset($_GET['cedula']) ? $_GET['cedula'] : '';
$resultados = [];
if (!empty($cedula_busqueda)) {
// Modificada la consulta para mostrar solo registros con firma pendiente
$query = "SELECT * FROM entregasst WHERE cedula = '$cedula_busqueda' AND FIRMA IS NULL ORDER BY fEntrega DESC";
$result = $conexion->query($query);
if ($result) {
$resultados = $result->fetch_all(MYSQLI_ASSOC);
}
}
// Procesar eliminación
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['eliminar_id'])) {
$id_eliminar = $conexion->real_escape_string($_POST['eliminar_id']);
$delete_query = "DELETE FROM entregasst WHERE ID = '$id_eliminar'";
if ($conexion->query($delete_query)) {
// Recargar la página para ver los cambios
header("Location: eliminarEntrega.php?cedula=$cedula_busqueda");
exit();
} else {
$error_eliminacion = "Error al eliminar el registro: " . $conexion->error;
}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Eliminacion de Entrega EPP</title>
<link rel="icon" type="image/png" href="../../img/icono.png">
<!-- Estilos y scripts -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-image: linear-gradient(to right, #e2e2e2, #ffe5c9);
padding: 20px;
}
.container {
max-width: 1000px;
margin: 20px auto;
}
.signature-container {
border: 1px solid #ddd;
margin: 20px 0;
}
#signature-pad {
width: 100%;
height: 200px;
background-color: white;
border: 1px solid #e0e0e0;
touch-action: none;
}
.signature-display {
max-width: 300px;
max-height: 100px;
}
.table-responsive {
overflow-x: auto;
}
.btn-group-sm > .btn, .btn-sm {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
.status-pending {
background-color: #fff3cd;
}
.status-signed {
background-color: #d1e7dd;
}
.btn-eliminar {
background-color: #dc3545;
color: white;
}
.btn-eliminar:hover {
background-color: #bb2d3b;
color: white;
}
</style>
</head>
<body>
<div class="container">
<h2 class="text-center mb-4"
<h2> </h2>
<a href="../dotacion/MENUP.PHP" class="btn btn-secondary"><i class="fas fa-home"></i> Menú Principal</a>
<!-- Formulario de búsqueda -->
<div class="card mb-4">
<div <div class="card-header" style="background-color: #d82727; color: white;">
<h2>ELIMINACION DE ENTREGA EPP PERSONAL</h2>
<hr>
<h5>Buscar Operario</h5>
</div>
<div class="card-body">
<form method="get" class="row g-3">
<div class="col-md-8">
<input type="text" class="form-control" name="cedula" placeholder="Ingrese número de cédula" value="<?= htmlspecialchars($cedula_busqueda) ?>">
</div>
<div class="col-md-4">
<button type="submit" class="btn w-100" style="background-color: #d82727; color: white;">
<i class="fas fa-search"></i> Buscar
</button>
</div>
</form>
</div>
</div>
<!-- Resultados de búsqueda -->
<?php if (!empty($cedula_busqueda)): ?>
<?php if (isset($error_eliminacion)): ?>
<div class="alert alert-danger"><?= $error_eliminacion ?></div>
<?php endif; ?>
<div class="card">
<div class="card-header bg-danger bg-opacity-25 text-dark d-flex justify-content-between align-items-center">
<h5 class="mb-0">Resultados para: <?= htmlspecialchars($cedula_busqueda) ?></h5>
</div>
<div class="card-body">
<?php if (empty($resultados)): ?>
<div class="alert alert-warning">
No se encontraron entregas pendientes para este operario.
</div>
<?php else: ?>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Cédula</th>
<th>Nombre</th>
<th>Fecha Entrega</th>
<th>Tipo Entrega</th>
<th>Estado</th>
<th>Devolutivo</th>
<th>Entrega EPP</th>
<th>Quien Entrego EPP</th>
<th>Firma</th>
<th>Acción</th>
</tr>
</thead>
<tbody>
<?php foreach ($resultados as $entrega): ?>
<tr class="status-pending">
<td><?= htmlspecialchars($entrega['cedula']) ?></td>
<td><?= htmlspecialchars($entrega['nombre'] ?? '') ?></td>
<td><?= htmlspecialchars($entrega['fEntrega']) ?></td>
<td><?= htmlspecialchars($entrega['tpEntrega']) ?></td>
<td><?= htmlspecialchars($entrega['tpEstado']) ?></td>
<td><?= htmlspecialchars($entrega['tpDevolutivo']) ?></td>
<td><?= htmlspecialchars($entrega['epp']) ?></td>
<td><?= htmlspecialchars($entrega['userEntrega']) ?></td>
<td>
<span class="text-muted">Pendiente</span>
</td>
<td>
<form method="post" onsubmit="return confirm('¿Está seguro que desea eliminar este registro?');">
<input type="hidden" name="eliminar_id" value="<?= $entrega['ID'] ?>">
<button type="submit" class="btn btn-sm btn-eliminar">
<i class="fas fa-trash-alt"></i> Eliminar
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>