diff --git a/app/Filament/Resources/OjalPresillaResource.php b/app/Filament/Resources/OjalPresillaResource.php index a4de873..acea31f 100644 --- a/app/Filament/Resources/OjalPresillaResource.php +++ b/app/Filament/Resources/OjalPresillaResource.php @@ -18,8 +18,8 @@ class OjalPresillaResource extends Resource protected static ?string $model = Ojal::class; protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationGroup = 'Gestión'; - protected static ?string $navigationLabel = 'Ojales y Prensillas'; - protected static ?string $pluralModelLabel = 'Ojales y Prensillas'; + protected static ?string $navigationLabel = 'Ojales y Presillas'; + protected static ?string $pluralModelLabel = 'Ojales y Presillas'; protected static ?int $navigationSort = 4; protected static bool $shouldRegisterNavigation = false; @@ -35,7 +35,7 @@ class OjalPresillaResource extends Resource ->label('Tipo de Proceso') ->options([ 'Ojal' => 'Ojal', - 'Prensilla' => 'Prensilla', + 'Prensilla' => 'Presilla', ]) ->required() ->reactive() diff --git a/app/Filament/Resources/OjalResource.php b/app/Filament/Resources/OjalResource.php index 2fd8950..1baf753 100644 --- a/app/Filament/Resources/OjalResource.php +++ b/app/Filament/Resources/OjalResource.php @@ -99,7 +99,7 @@ class OjalResource extends Resource Forms\Components\Checkbox::make('terminada') ->label('Marcar como terminado') - ->helperText('\u2713 Al terminar Ojales, las prendas quedar\u00e1n disponibles para Prensillas') + ->helperText('✓ Al terminar Ojales, las prendas quedarán disponibles para Presillas') ->reactive() ->default(false), ]); diff --git a/app/Filament/Resources/PrensillaResource.php b/app/Filament/Resources/PrensillaResource.php index 7932745..1a5ce83 100644 --- a/app/Filament/Resources/PrensillaResource.php +++ b/app/Filament/Resources/PrensillaResource.php @@ -16,7 +16,7 @@ class PrensillaResource extends Resource protected static ?string $model = Prensilla::class; protected static ?string $navigationIcon = 'heroicon-o-scissors'; protected static ?string $navigationGroup = 'Gestión'; - protected static ?string $navigationLabel = 'Prensillas'; + protected static ?string $navigationLabel = 'Presillas'; protected static ?int $navigationSort = 5; public static function canViewAny(): bool @@ -86,7 +86,7 @@ class PrensillaResource extends Resource Forms\Components\Checkbox::make('terminada') ->label('Marcar como terminado') - ->helperText('✓ Al terminar Prensillas, las prendas quedarán disponibles para Tintorería') + ->helperText('✓ Al terminar Presillas, las prendas quedarán disponibles para Tintorería') ->reactive() ->default(false), ]); diff --git a/app/Filament/Resources/PrensillaResource/Pages/CreatePrensilla.php b/app/Filament/Resources/PrensillaResource/Pages/CreatePrensilla.php index 8dd2f29..7af9744 100644 --- a/app/Filament/Resources/PrensillaResource/Pages/CreatePrensilla.php +++ b/app/Filament/Resources/PrensillaResource/Pages/CreatePrensilla.php @@ -12,7 +12,7 @@ class CreatePrensilla extends CreateRecord protected function mutateFormDataBeforeCreate(array $data): array { $data['fecha_envio'] = now(); - $data['tipo'] = 'Prensilla'; + $data['tipo'] = 'Presilla'; return $data; } diff --git a/app/Filament/Resources/PrensillaResource/Pages/ListPrensillas.php b/app/Filament/Resources/PrensillaResource/Pages/ListPrensillas.php index 2099dc4..91f8dd0 100644 --- a/app/Filament/Resources/PrensillaResource/Pages/ListPrensillas.php +++ b/app/Filament/Resources/PrensillaResource/Pages/ListPrensillas.php @@ -14,7 +14,7 @@ class ListPrensillas extends ListRecords { return [ Actions\CreateAction::make() - ->label('Crear Prensilla'), + ->label('Crear Presilla'), ]; } } diff --git a/app/Filament/Resources/SeguimientoProcesoResource.php b/app/Filament/Resources/SeguimientoProcesoResource.php index a03a6d3..38dbfc8 100644 --- a/app/Filament/Resources/SeguimientoProcesoResource.php +++ b/app/Filament/Resources/SeguimientoProcesoResource.php @@ -80,9 +80,7 @@ class SeguimientoProcesoResource extends Resource ->alignCenter() ->state(function (OrdenProduccion $record): string { $enviadas = $record->confecciones()->sum('cantidad_enviada'); - $recibidas = $record->confecciones() - ->whereNotNull('fecha_recepcion') - ->sum('cantidad_recibida'); + $recibidas = $record->confecciones()->sum('cantidad_recibida'); // Calcular disponibles (recibidas - arreglos - cobros - enviadas a ojales) $arreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) @@ -117,6 +115,19 @@ class SeguimientoProcesoResource extends Resource ->color(fn (OrdenProduccion $record) => self::getPendienteOjales($record) > 0 ? 'warning' : 'gray') ->tooltip('E=Enviadas, T=Terminadas, P=Pendientes'), + Tables\Columns\TextColumn::make('presillas') + ->label('⚫ Presillas') + ->alignCenter() + ->state(function (OrdenProduccion $record): string { + $enviadas = $record->prensillas()->sum('cantidad_enviada'); + $terminadas = $record->prensillas()->where('terminada', true)->sum('cantidad_enviada'); + $pendientes = max(0, $enviadas - $terminadas); + + return "E:{$enviadas} T:{$terminadas} P:{$pendientes}"; + }) + ->color(fn (OrdenProduccion $record) => self::getPendientePresillas($record) > 0 ? 'warning' : 'gray') + ->tooltip('E=Enviadas, T=Terminadas, P=Pendientes'), + Tables\Columns\TextColumn::make('tintoreria') ->label('🎨 Tintorería') ->alignCenter() @@ -199,9 +210,7 @@ class SeguimientoProcesoResource extends Resource protected static function getPendienteConfeccion(OrdenProduccion $record): int { - $recibidas = $record->confecciones() - ->whereNotNull('fecha_recepcion') - ->sum('cantidad_recibida'); + $recibidas = $record->confecciones()->sum('cantidad_recibida'); $arreglos = \App\Models\Ajuste::where('referencia_type', \App\Models\Confeccion::class) ->whereHas('referencia', function($q) use ($record) { @@ -226,6 +235,14 @@ class SeguimientoProcesoResource extends Resource return max(0, $enviadas - $terminadas); } + + protected static function getPendientePresillas(OrdenProduccion $record): int + { + $enviadas = $record->prensillas()->sum('cantidad_enviada'); + $terminadas = $record->prensillas()->where('terminada', true)->sum('cantidad_enviada'); + + return max(0, $enviadas - $terminadas); + } protected static function getPendienteTintoreria(OrdenProduccion $record): int {