update
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ProcesoAcabadoResource\Pages;
|
||||
use App\Filament\Resources\ProcesoAcabadoResource\RelationManagers;
|
||||
use App\Models\ProcesoAcabado;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\{
|
||||
Select,
|
||||
TextInput,
|
||||
DatePicker,
|
||||
Textarea,
|
||||
Section
|
||||
};
|
||||
use Filament\Tables\Columns\{
|
||||
TextColumn,
|
||||
BadgeColumn
|
||||
};
|
||||
|
||||
|
||||
class ProcesoAcabadoResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ProcesoAcabado::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Administración';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form->schema([
|
||||
Section::make('Proceso de Acabado')
|
||||
->schema([
|
||||
Select::make('orden_produccion_id')
|
||||
->label('Orden de Producción')
|
||||
->relationship('ordenProduccion', 'numero_orden')
|
||||
->searchable()
|
||||
->required(),
|
||||
|
||||
TextInput::make('tipo_proceso')
|
||||
->label('Tipo de proceso')
|
||||
->required(),
|
||||
|
||||
Select::make('proveedor_id')
|
||||
->label('Proveedor (opcional)')
|
||||
->relationship('proveedor', 'nombre')
|
||||
->searchable()
|
||||
->nullable(),
|
||||
|
||||
TextInput::make('responsable_interno')
|
||||
->label('Responsable interno')
|
||||
->nullable(),
|
||||
|
||||
TextInput::make('cantidad_enviada')
|
||||
->numeric()
|
||||
->required(),
|
||||
|
||||
TextInput::make('cantidad_recibida')
|
||||
->numeric(),
|
||||
|
||||
DatePicker::make('fecha_envio')
|
||||
->required(),
|
||||
|
||||
DatePicker::make('fecha_recepcion'),
|
||||
|
||||
Textarea::make('observaciones')
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('ordenProduccion.numero_orden')
|
||||
->label('OP')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('tipo_proceso'),
|
||||
|
||||
TextColumn::make('proveedor.nombre')
|
||||
->label('Proveedor')
|
||||
->toggleable(),
|
||||
|
||||
TextColumn::make('responsable_interno')
|
||||
->toggleable(),
|
||||
|
||||
TextColumn::make('cantidad_enviada'),
|
||||
|
||||
TextColumn::make('cantidad_recibida'),
|
||||
|
||||
BadgeColumn::make('fecha_recepcion')
|
||||
->label('Estado')
|
||||
->formatStateUsing(fn($state) => $state ? 'Completado' : 'Pendiente')
|
||||
->colors([
|
||||
'warning' => null,
|
||||
'success' => fn($state) => $state !== null,
|
||||
]),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListProcesoAcabados::route('/'),
|
||||
'create' => Pages\CreateProcesoAcabado::route('/create'),
|
||||
'edit' => Pages\EditProcesoAcabado::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user