up
This commit is contained in:
@@ -138,6 +138,10 @@ class ConfeccionResource extends Resource
|
||||
|
||||
TextColumn::make('cantidad_recibida'),
|
||||
|
||||
TextColumn::make('faltantes')
|
||||
->label('Faltan')
|
||||
->sortable(),
|
||||
|
||||
BadgeColumn::make('estado')
|
||||
->colors([
|
||||
'warning' => 'pendiente',
|
||||
@@ -165,7 +169,7 @@ class ConfeccionResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
RelationManagers\RecepcionesRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ConfeccionResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
|
||||
class RecepcionesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'recepciones';
|
||||
protected static ?string $recordTitleAttribute = 'id';
|
||||
|
||||
public function form(Forms\Form $form): Forms\Form
|
||||
{
|
||||
return $form->schema([
|
||||
DateTimePicker::make('fecha_recepcion')->required(),
|
||||
TextInput::make('cantidad')->numeric()->required()->minValue(1),
|
||||
Textarea::make('notas'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Tables\Table $table): Tables\Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')->label('#'),
|
||||
TextColumn::make('fecha_recepcion')->dateTime()->label('Fecha'),
|
||||
TextColumn::make('cantidad')->label('Cantidad'),
|
||||
TextColumn::make('usuario.name')->label('Usuario'),
|
||||
TextColumn::make('notas')->limit(50)->wrap(),
|
||||
TextColumn::make('created_at')->dateTime()->label('Creado'),
|
||||
])
|
||||
->headerActions([])
|
||||
->actions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([]);
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,10 @@ class TintoreriaResource extends Resource
|
||||
|
||||
TextColumn::make('cantidad_recibida'),
|
||||
|
||||
TextColumn::make('faltantes')
|
||||
->label('Faltan')
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('perdidas')
|
||||
->label('Pérdidas'),
|
||||
|
||||
@@ -146,7 +150,7 @@ class TintoreriaResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
RelationManagers\RecepcionesRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TintoreriaResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
|
||||
class RecepcionesRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'recepciones';
|
||||
protected static ?string $recordTitleAttribute = 'id';
|
||||
|
||||
public function form(Forms\Form $form): Forms\Form
|
||||
{
|
||||
return $form->schema([
|
||||
DateTimePicker::make('fecha_recepcion')->required(),
|
||||
TextInput::make('cantidad')->numeric()->required()->minValue(1),
|
||||
Textarea::make('notas'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Tables\Table $table): Tables\Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')->label('#'),
|
||||
TextColumn::make('fecha_recepcion')->dateTime()->label('Fecha'),
|
||||
TextColumn::make('cantidad')->label('Cantidad'),
|
||||
TextColumn::make('usuario.name')->label('Usuario'),
|
||||
TextColumn::make('notas')->limit(50)->wrap(),
|
||||
TextColumn::make('created_at')->dateTime()->label('Creado'),
|
||||
])
|
||||
->headerActions([])
|
||||
->actions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user