Skip to content

Commit

Permalink
fix(*): fix the query and for getting the prospects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush8923 committed Nov 3, 2024
1 parent d451515 commit ce85ab1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Modules/Prospect/Services/ProspectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ce85ab1

Please sign in to comment.