|
|
@ -3,10 +3,10 @@
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Filament\Resources\InvoiceResource\Pages;
|
|
|
|
use App\Filament\Resources\InvoiceResource\Pages;
|
|
|
|
|
|
|
|
use App\Filament\Resources\InvoiceResource\RelationManagers\OrdersRelationManager;
|
|
|
|
use App\Filament\Resources\InvoiceResource\RelationManagers\ProductServicesRelationManager;
|
|
|
|
use App\Filament\Resources\InvoiceResource\RelationManagers\ProductServicesRelationManager;
|
|
|
|
use App\Models\Customer;
|
|
|
|
use App\Models\Customer;
|
|
|
|
use App\Models\Invoice;
|
|
|
|
use App\Models\Invoice;
|
|
|
|
use App\Models\Order;
|
|
|
|
|
|
|
|
use Filament\Forms\Components\DatePicker;
|
|
|
|
use Filament\Forms\Components\DatePicker;
|
|
|
|
use Filament\Forms\Components\Grid;
|
|
|
|
use Filament\Forms\Components\Grid;
|
|
|
|
use Filament\Forms\Components\Section;
|
|
|
|
use Filament\Forms\Components\Section;
|
|
|
@ -43,15 +43,6 @@ class InvoiceResource extends Resource
|
|
|
|
->searchable()
|
|
|
|
->searchable()
|
|
|
|
->columnSpan(2),
|
|
|
|
->columnSpan(2),
|
|
|
|
|
|
|
|
|
|
|
|
Select::make('orders')
|
|
|
|
|
|
|
|
->options(fn ($get): array => Order::where('customer_id', $get('customer_id') ?? null)->whereNull('invoice_id')
|
|
|
|
|
|
|
|
->get()
|
|
|
|
|
|
|
|
->pluck('customer_po', 'id')
|
|
|
|
|
|
|
|
->toArray())
|
|
|
|
|
|
|
|
->multiple()
|
|
|
|
|
|
|
|
->searchable()
|
|
|
|
|
|
|
|
->columnSpan(2),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Split::make([
|
|
|
|
Split::make([
|
|
|
|
DatePicker::make('date')
|
|
|
|
DatePicker::make('date')
|
|
|
|
->required()
|
|
|
|
->required()
|
|
|
@ -114,9 +105,6 @@ class InvoiceResource extends Resource
|
|
|
|
->defaultSort('created_at', 'desc')
|
|
|
|
->defaultSort('created_at', 'desc')
|
|
|
|
->actions([
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
// ->after(function (Invoice $record) {
|
|
|
|
|
|
|
|
// return redirect(EditInvoice::getUrl(['record' => $record->id]));
|
|
|
|
|
|
|
|
// }),
|
|
|
|
|
|
|
|
])
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
->bulkActions([
|
|
|
|
Tables\Actions\BulkActionGroup::make([
|
|
|
|
Tables\Actions\BulkActionGroup::make([
|
|
|
@ -128,6 +116,7 @@ class InvoiceResource extends Resource
|
|
|
|
public static function getRelations(): array
|
|
|
|
public static function getRelations(): array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
|
|
|
|
OrdersRelationManager::class,
|
|
|
|
ProductServicesRelationManager::class,
|
|
|
|
ProductServicesRelationManager::class,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|