57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\CajasResource\RelationManagers;
|
|
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
|
|
class DetallesRelationManagerRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'movimientoscaja';
|
|
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form->schema([
|
|
Forms\Components\Select::make('tipo')
|
|
->required()
|
|
->options([
|
|
'Ingreso' => 'Ingreso',
|
|
'Egreso' => 'Egreso',
|
|
])
|
|
->placeholder('Selecciona un tipo'),
|
|
Forms\Components\TextInput::make('monto')
|
|
->numeric()
|
|
->required(),
|
|
Forms\Components\TextInput::make('descripcion')
|
|
->maxLength(255),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table->columns([
|
|
Tables\Columns\TextColumn::make('tipo')
|
|
->sortable()
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('monto')
|
|
->sortable()
|
|
->numeric(),
|
|
Tables\Columns\TextColumn::make('descripcion'),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable(),
|
|
])
|
|
->filters([
|
|
// Aquí puedes agregar filtros si es necesario.
|
|
])
|
|
->headerActions([
|
|
Tables\Actions\CreateAction::make(),
|
|
]);
|
|
}
|
|
}
|