This commit is contained in:
lizandrogd
2026-01-19 18:24:35 -05:00
parent edcd51e651
commit 084b644714
10 changed files with 412 additions and 66 deletions
@@ -4,26 +4,51 @@ $op = \App\Models\OrdenProduccion::find($opId);
$events = [];
if ($op) {
$confecciones = $op->confeccions()->orderBy('fecha_recepcion')->get();
$confecciones = $op->confeccions()->get();
foreach ($confecciones as $c) {
// Evento principal de la confección (creación/envío)
$events[] = [
'tipo' => 'Confección',
'id' => $c->id,
'fecha' => $c->fecha_recepcion ?? $c->created_at,
'detalle' => "Enviado: {$c->cantidad_enviada} - Recibido: {$c->cantidad_recibida} - Defectos: {$c->prendas_defectuosas}",
'fecha' => $c->fecha_envio ?? $c->created_at,
'detalle' => "Enviado: {$c->cantidad_enviada} - Recibido total: {$c->cantidad_recibida} - Defectos: {$c->prendas_defectuosas}",
'link' => route('filament.admin.resources.confeccions.edit', ['record' => $c->id]),
];
// Eventos por cada recepción
$recepciones = $c->recepciones()->orderBy('fecha_recepcion')->get();
foreach ($recepciones as $r) {
$events[] = [
'tipo' => 'Recepción (Confección)',
'id' => $r->id,
'fecha' => $r->fecha_recepcion ?? $r->created_at,
'detalle' => "Recibido: {$r->cantidad} - Notas: " . ($r->notas ?? '—'),
'link' => route('filament.admin.resources.confeccions.edit', ['record' => $c->id]),
];
}
}
$tints = $op->tintorerias()->orderBy('fecha_recepcion')->get();
$tints = $op->tintorerias()->get();
foreach ($tints as $t) {
$events[] = [
'tipo' => 'Tintorería',
'id' => $t->id,
'fecha' => $t->fecha_recepcion ?? $t->created_at,
'detalle' => "Enviado: {$t->cantidad_enviada} - Recibido: {$t->cantidad_recibida} - Perdidas: {$t->perdidas}",
'fecha' => $t->fecha_envio ?? $t->created_at,
'detalle' => "Enviado: {$t->cantidad_enviada} - Recibido total: {$t->cantidad_recibida} - Perdidas: {$t->perdidas}",
'link' => route('filament.admin.resources.tintorerias.edit', ['record' => $t->id]),
];
// Eventos por cada recepción
$recepciones = $t->recepciones()->orderBy('fecha_recepcion')->get();
foreach ($recepciones as $r) {
$events[] = [
'tipo' => 'Recepción (Tintorería)',
'id' => $r->id,
'fecha' => $r->fecha_recepcion ?? $r->created_at,
'detalle' => "Recibido: {$r->cantidad} - Notas: " . ($r->notas ?? '—'),
'link' => route('filament.admin.resources.tintorerias.edit', ['record' => $t->id]),
];
}
}
$acabados = $op->procesosAcabado()->orderBy('fecha_recepcion')->get();
@@ -89,6 +114,11 @@ if ($op) {
<p class="mb-4 text-base font-normal text-gray-500 dark:text-gray-300">{{ $e['detalle'] }}</p>
{{-- Acciones rápidas --}}
@if(in_array($e['tipo'], ['Confección','Tintorería']))
<div class="flex gap-2">
<a href="{{ $e['link'] }}#recepciones" class="inline-flex items-center px-2 py-1 bg-blue-600 text-white rounded text-sm">Agregar recepción</a>
</div>
@endif
@if($e['tipo'] === 'Traslado')
@php $tr = \App\Models\TrasladoPrenda::find($e['id']); @endphp
<div class="flex gap-2">