Added rfq transporter bid resource pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Failing after 2m42s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Failing after 2m42s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateRfqTransporterBid extends CreateRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use App\Models\User;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditRfqTransporterBid extends EditRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function afterSave(): void
|
||||
{
|
||||
if (! $this->record->wasChanged('total_freight_charge')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rank = RfqTransporterBid::where('request_quotation_id', $this->record->request_quotation_id)
|
||||
->orderBy('total_freight_charge')
|
||||
->pluck('id')
|
||||
->search($this->record->id) + 1;
|
||||
|
||||
$recipients = User::role(['Super Admin', 'Rfq Supervisor'])->get();
|
||||
$currentUser = Filament::auth()->user();
|
||||
|
||||
if ($currentUser && ! $recipients->contains('id', $currentUser->id)) {
|
||||
$recipients->push($currentUser);
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Rank Updated')
|
||||
->body("Your current rank is #{$rank}")
|
||||
->success()
|
||||
->sendToDatabase($recipients);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListRfqTransporterBids extends ListRecords
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewRfqTransporterBid extends ViewRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user