@extends('layouts.app')
@section('content')
@php
if (!function_exists('stockLevel')) {
function stockLevel($total, $current)
{
// Evitar división por cero y manejar $total o $current igual a 0
if ($total == 0) {
return 'text-secondary'; // Sin stock o sin información
}
if ($current == 0) {
return 'text-danger'; // Sin stock (rojo)
}
$perc = ($current / $total) * 100;
if ($perc <= 20) {
return 'text-danger'; // Critical (red)
} elseif ($perc <= 50) {
return 'text-warning'; // Warning (yellow/orange)
} elseif ($perc <= 100) {
return 'text-success'; // Normal (blue)
} else {
return 'text-primary'; // Good (green)
}
}
}
@endphp
LOTES DE PRODUCTOS
@if(auth()->user()->work_department_id == 1 || auth()->user()->work_department_id == 5)
@endif
@include('layouts.alert')
# |
Producto |
N° Lote |
Almacén |
Cantidad registro |
Stock |
Caducidad |
Período |
@if (auth()->user()->work_department_id == 1)
|
@endif
@forelse ($lots as $index => $lot)
{{ ++$index }} |
{{ $lot->product->name ?? 'Sin producto' }}
{{ $lot->product->presentation->name ?? 'Sin presentación' }}
|
{{ $lot->registration_number }}
|
{{ $lot->warehouse->name ?? 'Sin almacén' }}
|
{{ number_format($lot->amount, 2) }}
{{ $lot->product->metric->value ?? '' }}
|
{{ number_format($lot->countProducts(), 2) }}
{{ $lot->product->metric->value ?? '' }}
|
@if ($lot->expiration_date)
{{ date('d/m/Y', strtotime($lot->expiration_date)) }}
@if ($lot->isExpired())
CADUCADO
@else
VIGENTE
@endif
@else
Sin fecha
@endif
|
{{ $lot->start_date && $lot->end_date
? date('d/m/Y', strtotime($lot->start_date)) . ' - ' . date('d/m/Y', strtotime($lot->end_date))
: ($lot->start_date
? 'Desde: ' . date('d/m/Y', strtotime($lot->start_date))
: ($lot->end_date
? 'Hasta: ' . date('d/m/Y', strtotime($lot->end_date))
: '-')) }}
|
|
@empty
No hay lotes para mostrar
No se encontraron lotes en el sistema.
|
@endforelse
@if ($lots->hasPages())
Mostrando {{ $lots->firstItem() ?? 0 }} a {{ $lots->lastItem() ?? 0 }} de {{ $lots->total() }} lotes
{{ $lots->links('pagination::bootstrap-5') }}
@endif
@if ($lots->isEmpty() && request()->has('search'))