Files
pos_heidiver/resources/views/emails/alerta-stock.blade.php
T
2026-01-06 15:35:59 -05:00

190 lines
7.1 KiB
PHP

<!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</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.header {
text-align: center;
color: #333;
border-bottom: 2px solid #007bff;
padding-bottom: 10px;
margin-bottom: 20px;
}
.alert-section {
margin-bottom: 30px;
}
.alert-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
padding: 10px;
border-radius: 5px;
}
.alert-minimo {
background-color: #fff3cd;
color: #856404;
border: 1px solid #ffeaa7;
}
.alert-maximo {
background-color: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}
.product-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.product-table th,
.product-table td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
.product-table th {
background-color: #007bff;
color: white;
}
.product-table tr:nth-child(even) {
background-color: #f2f2f2;
}
.stock-warning {
color: #dc3545;
font-weight: bold;
}
.stock-info {
color: #17a2b8;
font-weight: bold;
}
.footer {
margin-top: 30px;
text-align: center;
color: #666;
font-size: 14px;
border-top: 1px solid #ddd;
padding-top: 15px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🚨 Alerta de Niveles de Stock</h1>
<p>Fecha: {{ now()->format('d/m/Y H:i:s') }}</p>
</div>
@if($productosStockMinimo->isNotEmpty())
<div class="alert-section">
<div class="alert-title alert-minimo">
⚠️ Productos con Stock Mínimo o Inferior ({{ $productosStockMinimo->count() }} productos)
</div>
<table class="product-table">
<thead>
<tr>
<th>Producto</th>
<th>Categoría</th>
<th>Stock Actual</th>
<th>Stock Mínimo</th>
<th>Stock Máximo</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
@foreach($productosStockMinimo as $producto)
@php
$stockActual = $producto->variants()->exists()
? $producto->variants()->sum('stock')
: $producto->stock;
@endphp
<tr>
<td>{{ $producto->nombre }}</td>
<td>{{ $producto->categoria->nombre ?? 'Sin categoría' }}</td>
<td class="stock-warning">{{ $stockActual }}</td>
<td>{{ $producto->stock_minimo }}</td>
<td>{{ $producto->stock_maximo ?? 'No definido' }}</td>
<td>
@if($stockActual == 0)
<span style="color: #dc3545;">🔴 Sin Stock</span>
@elseif($stockActual < $producto->stock_minimo)
<span style="color: #fd7e14;">🟠 Por debajo del mínimo</span>
@else
<span style="color: #ffc107;">🟡 En mínimo</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@if($productosStockMaximo->isNotEmpty())
<div class="alert-section">
<div class="alert-title alert-maximo">
📈 Productos que Exceden el Stock Máximo ({{ $productosStockMaximo->count() }} productos)
</div>
<table class="product-table">
<thead>
<tr>
<th>Producto</th>
<th>Categoría</th>
<th>Stock Actual</th>
<th>Stock Mínimo</th>
<th>Stock Máximo</th>
<th>Exceso</th>
</tr>
</thead>
<tbody>
@foreach($productosStockMaximo as $producto)
@php
$stockActual = $producto->variants()->exists()
? $producto->variants()->sum('stock')
: $producto->stock;
$exceso = $stockActual - $producto->stock_maximo;
@endphp
<tr>
<td>{{ $producto->nombre }}</td>
<td>{{ $producto->categoria->nombre ?? 'Sin categoría' }}</td>
<td class="stock-info">{{ $stockActual }}</td>
<td>{{ $producto->stock_minimo }}</td>
<td>{{ $producto->stock_maximo }}</td>
<td style="color: #007bff; font-weight: bold;">+{{ $exceso }} unidades</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@if($productosStockMinimo->isEmpty() && $productosStockMaximo->isEmpty())
<div style="text-align: center; padding: 40px; color: #28a745;">
<h2> Todos los productos están en niveles normales de stock</h2>
<p>No hay productos que requieran atención inmediata.</p>
</div>
@endif
<div class="footer">
<p><strong>Sistema de Gestión POS</strong></p>
<p>Este es un correo automático. No responda a este mensaje.</p>
<p>Para más información, acceda al sistema de administración.</p>
</div>
</div>
</body>
</html>