File "stock.php"
Full Path: C:/wamp64/www/APPSST/Admin/dotacion/stock.php
File size: 4.95 KB
MIME-type: text/html
Charset: utf-8
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alerta de Stock Bajo</title>
<link rel="icon" type="image/png" href="../../img/icono.png"><!-- Cambia el icono de los titulos en las pestañas ico 16X16 -->
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- SweetAlert2 CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
<!-- Para Font Awesome 6 (CDN gratuito) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<style>
body {
background-image: linear-gradient(to right, #e2e2e2, #ffe5c9);
padding-top: 40px;
}
.main-container {
background-color: white;
border-radius: 10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
padding: 30px;
margin-bottom: 30px;
}
.header-info {
text-align: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 1px solid #eee;
}
.btn-back {
background-color: #6c757d;
color: white;
margin-bottom: 20px;
}
.btn-back:hover {
background-color: #5a6268;
color: white;
}
.boton-alerta {
display: flex;
justify-content: center;
margin-top: 20px; /* opcional, para dar espacio arriba */
}
</style>
</head>
<body>
<div class="container">
<div class="main-container">
<!-- Botón de regresar -->
<a href="MENUP.PHP" class="btn btn-secondary">
<i class="bi bi-arrow-left"></i> Regresar
</a>
<!-- Información del sistema -->
<div class="header-info">
<h1 class="mb-3">
<i class="fa-solid fa-bullhorn"></i>
Sistema de Stock EPP
</h1>
<p class="lead text-muted">Esta página mostrará alertas cuando el stock esté por debajo de 10 Unidades</p>
</div>
<!-- Botón de Generar Alerta -->
<div class="boton-alerta">
<a href="stock.php" class="btn btn-secondary" style="background-color: #d82727; border: 1px solid #d82727;">
<i class="fa-solid fa-bullhorn"></i> Generar Alerta
</a>
</div>
<!-- Aquí podrías agregar más contenido si lo necesitas -->
</div>
</div>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- SweetAlert2 JS -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<?PHP
session_start();
header("Cache-control: private"); // Arregla IE 6
//*******Datos de Conexion Base de Datos************
include("../../bd/conexion.php");
/* $result = $conexion->query("DELETE FROM `entregaspp` WHERE `ENTREGA`IS NULL"); */
// Consulta para obtener las prendas cuyo stock (CANTIDAD) es menor o igual a 20
$consultaPrendasBajoStock = "SELECT DESCRIPCION, CANTIDAD FROM inventario WHERE CANTIDAD <= 10";
$resultadoPrendasBajoStock = $conexion->query($consultaPrendasBajoStock);
if ($resultadoPrendasBajoStock && $resultadoPrendasBajoStock->num_rows > 0) {
?>
<script>
$(document).ready(function() {
Swal.fire({
title: "¡Cuidado!",
icon: "warning",
confirmButtonText: "Entendido",
html: `<ul class="list-group">
<h3>Las siguientes prendas están a punto de agotarse:</h3>
<?php
// Iterar sobre las prendas con bajo stock
while ($prenda = $resultadoPrendasBajoStock->fetch_assoc()) {
?>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong><?php echo $prenda['DESCRIPCION'] ?></strong>
<span class="badge bg-danger badge-lg rounded-pill text-light">
<strong><?php echo $prenda['CANTIDAD'] ?></strong>
</span>
</li>
<?php
}
?>
</ul>`
});
});
</script>
<?php
} else {
echo "";
}
?>
</body>
</html>