|
|
|
@ -7,6 +7,7 @@ use Filament\Forms\Form;
|
|
|
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
|
|
|
use Filament\Tables;
|
|
|
|
|
use Filament\Tables\Table;
|
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
|
|
|
|
|
|
class OrdersRelationManager extends RelationManager
|
|
|
|
|
{
|
|
|
|
@ -18,7 +19,7 @@ class OrdersRelationManager extends RelationManager
|
|
|
|
|
->schema([
|
|
|
|
|
Forms\Components\TextInput::make('customer_po')
|
|
|
|
|
->required()
|
|
|
|
|
->maxLength(255),
|
|
|
|
|
->maxLength(100),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -27,22 +28,36 @@ class OrdersRelationManager extends RelationManager
|
|
|
|
|
return $table
|
|
|
|
|
->recordTitleAttribute('customer_po')
|
|
|
|
|
->columns([
|
|
|
|
|
Tables\Columns\TextColumn::make('customer_po'),
|
|
|
|
|
Tables\Columns\TextColumn::make('customer_po')
|
|
|
|
|
->color('code')
|
|
|
|
|
->weight('bold'),
|
|
|
|
|
Tables\Columns\TextColumn::make('total_product_quantity'),
|
|
|
|
|
Tables\Columns\TextColumn::make('total_service_price')
|
|
|
|
|
->prefix('$'),
|
|
|
|
|
])
|
|
|
|
|
->filters([
|
|
|
|
|
//
|
|
|
|
|
])
|
|
|
|
|
->headerActions([
|
|
|
|
|
Tables\Actions\AssociateAction::make()
|
|
|
|
|
->multiple(),
|
|
|
|
|
->multiple()
|
|
|
|
|
->preloadRecordSelect()
|
|
|
|
|
->recordSelectOptionsQuery(fn (Builder $query) => $query->where('customer_id', $this->ownerRecord->customer->id))
|
|
|
|
|
->after(function () {
|
|
|
|
|
$this->ownerRecord->calculateTotals();
|
|
|
|
|
}),
|
|
|
|
|
])
|
|
|
|
|
->actions([
|
|
|
|
|
Tables\Actions\DeleteAction::make(),
|
|
|
|
|
Tables\Actions\DissociateAction::make()
|
|
|
|
|
->after(function () {
|
|
|
|
|
$this->ownerRecord->calculateTotals();
|
|
|
|
|
}),
|
|
|
|
|
])
|
|
|
|
|
->bulkActions([
|
|
|
|
|
Tables\Actions\BulkActionGroup::make([
|
|
|
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
|
Tables\Actions\DissociateBulkAction::make(),
|
|
|
|
|
]),
|
|
|
|
|
]);
|
|
|
|
|
])
|
|
|
|
|
->inverseRelationship('invoice');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|