From ce85ab103d2b03e00fcd54498e3ca428ed313a6c Mon Sep 17 00:00:00 2001 From: Ayush8923 Date: Sun, 3 Nov 2024 17:31:51 +0530 Subject: [PATCH] fix(*): fix the query and for getting the prospects --- Modules/Prospect/Services/ProspectService.php | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Modules/Prospect/Services/ProspectService.php b/Modules/Prospect/Services/ProspectService.php index 2415fca77d..ba56196d1b 100644 --- a/Modules/Prospect/Services/ProspectService.php +++ b/Modules/Prospect/Services/ProspectService.php @@ -61,20 +61,23 @@ private function getFilteredProspects(array $requestData = []) { $filter = $requestData['status'] ?? 'open'; - return Prospect::query() - ->when($filter === 'open', function ($query) { - $query->whereNotIn('proposal_status', ['rejected', 'converted']); - }, function ($query) use ($filter) { - $query->where('proposal_status', $filter); - }) - ->orderBy('created_at', 'desc') - ->paginate(config('constants.pagination_size')) - ->appends($requestData); + return Prospect::query()->when( + $filter === 'open', + fn ($query) => $query->where(function ($query) { + $query->whereNotIn('proposal_status', ['rejected', 'converted']) + ->orWhereNull('proposal_status') + ->orWhere('proposal_status', ''); + }), + fn ($query) => $query->where('proposal_status', $filter) + ) + ->orderBy('created_at', 'desc') + ->paginate(config('constants.pagination_size')) + ->appends($requestData); } private function getCurrencySymbols() { - return Country::all()->pluck('currency_symbol', 'currency'); + return Country::pluck('currency_symbol', 'currency'); } private function saveProspectData($prospect, $validated)