up
This commit is contained in:
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\VentaResource\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 = 'detalles';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('detalles')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('detalles')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('producto.nombre')->label('Producto'),
|
||||
Tables\Columns\TextColumn::make('variante')
|
||||
->label('Variante')
|
||||
->formatStateUsing(function ($record) {
|
||||
if ($record->variante) {
|
||||
return $record->variante->color->name . ' / ' . $record->variante->size->name;
|
||||
}
|
||||
return '—';
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('cantidad')->label('Cantidad'),
|
||||
Tables\Columns\TextColumn::make('precio_unitario')->label('Precio Unitario'),
|
||||
Tables\Columns\TextColumn::make('subtotal')->label('Subtotal'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
/* Tables\Actions\CreateAction::make(), */
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user