Added after create logic inside the rfq transporter bid
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m14s
Laravel Pint / pint (pull_request) Failing after 2m15s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Larastan / larastan (pull_request) Failing after 2m14s
Laravel Pint / pint (pull_request) Failing after 2m15s
This commit is contained in:
@@ -21,28 +21,29 @@ class CreateRfqTransporterBid extends CreateRecord
|
|||||||
$record = $this->record;
|
$record = $this->record;
|
||||||
|
|
||||||
// Calculate rank based on total_freight_charge
|
// Calculate rank based on total_freight_charge
|
||||||
$rank = RfqTransporterBid::where('request_quotation_id', $record->request_quotation_id)
|
$rank = RfqTransporterBid::where('request_quotation_id', $this->record->request_quotation_id)
|
||||||
->orderBy('total_freight_charge')
|
->orderBy('total_freight_charge')
|
||||||
->pluck('id')
|
->pluck('id')
|
||||||
->search($record->id) + 1;
|
->search($this->record->id) + 1;
|
||||||
|
|
||||||
|
$recipients = User::role(['Super Admin', 'Rfq Supervisor'])->get();
|
||||||
$currentUser = Filament::auth()->user();
|
$currentUser = Filament::auth()->user();
|
||||||
|
|
||||||
// Get recipients
|
|
||||||
$recipients = User::whereHas('roles', function ($q) {
|
|
||||||
$q->whereIn('name', ['Super Admin', 'Rfq Supervisor'])
|
|
||||||
->where('guard_name', 'web');
|
|
||||||
})->get();
|
|
||||||
|
|
||||||
// Exclude creator
|
if ($currentUser && ! $recipients->contains('id', $currentUser->id)) {
|
||||||
$recipients = $recipients->where('id', '!=', $currentUser->id);
|
$recipients->push($currentUser);
|
||||||
|
}
|
||||||
|
|
||||||
$body = "{$currentUser->name} added a new bid. Current rank is #{$rank}";
|
// $user1 = Filament::auth()->user();
|
||||||
|
|
||||||
|
|
||||||
|
$body = "{$currentUser->name} current rank is #{$rank}";
|
||||||
|
|
||||||
|
$rfqNumber = $this->record->requestQuotation->rfq_number;
|
||||||
|
|
||||||
// Filament DB notification
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('New Bid Added')
|
->title('Rank Updated')
|
||||||
->body($body)
|
->body("{$currentUser->name} has updated the bid for RFQ No '{$rfqNumber}'. The current rank is #{$rank}.")
|
||||||
->success()
|
->success()
|
||||||
->sendToDatabase($recipients);
|
->sendToDatabase($recipients);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user