Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Build - Dec 24, 2024 #3752

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Modules/Prospect/Entities/Prospect.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ public function getProspectDisplayName()
return $this->organization_name ?? optional($this->client)->name ?? 'N/A';
}

public function formattedAmount($amount)
public function getFormattedBudgetAttribute()
{
$formattedAmount = preg_replace('/\B(?=(\d{2})+(?!\d))/', ',', substr($amount, 0, -3)) .
',' . substr($amount, -3);
$budget = (string) $this->budget;
$currency = $this->currency;

return $formattedAmount;
// if currency is less than one thousand
if (strlen($budget) <= 3) {
return $budget;
}

$numberFormat = $currency == 'INR' ? 'en_IN' : 'en_US';
$formatter = new \NumberFormatter($numberFormat, \NumberFormatter::DECIMAL);
$formattedBudget = $formatter->format($budget);

return $formattedBudget;
}

public function insights()
Expand Down
18 changes: 8 additions & 10 deletions Modules/Prospect/Http/Controllers/ProspectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ public function index()
public function create()
{
$countries = Country::all();
$user = new User();
$client = new Client();
$activeUsers = $user->active_users;
$users = User::orderBy('name')->get();
$clients = Client::orderBy('name')->get();

return view('prospect::create', [
'users' => $activeUsers,
'users' => $users,
'countries' => $countries,
'clients' => $client->clients,
'clients' => $clients,
]);
}

Expand Down Expand Up @@ -88,15 +87,14 @@ public function edit($id)
{
$prospect = Prospect::with(['comments'])->find($id);
$countries = Country::all();
$user = new User();
$activeUsers = $user->active_users;
$client = new Client();
$users = User::orderBy('name')->get();
$clients = Client::orderBy('name')->get();

return view('prospect::edit', [
'prospect' => $prospect,
'users' => $activeUsers,
'users' => $users,
'countries' => $countries,
'clients' => $client->clients,
'clients' => $clients,
]);
}

Expand Down
44 changes: 19 additions & 25 deletions Modules/Prospect/Resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
</button>
</div>
@endif
<div class="mb-2 d-md-flex justify-content-between">
<div class='d-flex justify-content-between align-items-md-center mt-5 mb-5 mb-xl-0'>
<h4 class="">
Active Prospect
</h4>
<div class="my-4 d-md-flex justify-content-between">
<div class='d-flex justify-content-between align-items-md-center'>
<h4 class="mb-0">Prospects</h4>
</div>
<div class="d-flex align-items-center">
<a href="{{ route('prospect.create') }}" class="btn btn-success text-white"><i class="fa fa-plus"></i>
{{ __('Add new prospect') }}</a>
{{ __('Add prospect') }}</a>
</div>
</div>
<div class='d-md-none mb-2'>
Expand All @@ -33,46 +31,42 @@
<table class="table table-bordered table-striped">
<thead class="thead-dark">
<tr>
<th class="sticky-top">Organization Name</th>
<th class="sticky-top">Name</th>
<th class="sticky-top">POC</th>
<th class="sticky-top">Proposal Sent Date</th>
<th class="sticky-top">Domain</th>
<th class="sticky-top">Customer Type</th>
<th class="sticky-top">Budget</th>
<th class="sticky-top">Prospect Status</th>
<th class="sticky-top">Status</th>
</tr>
</thead>
<tbody>
@foreach ($prospects as $prospect)
<tr>
<td class="w-30p">
<div>
<a
href="{{ route('prospect.show', $prospect->id) }}">{{ $prospect->organization_name ?? ($prospect->client->name ?? '-') }}</a>
<a href="{{ route('prospect.show', $prospect->id) }}" class="text-decoration-none">
{{ $prospect->project_name ?? $prospect->organization_name }}
</a>
<br>
<span class="text-secondary fz-14">
{{ $prospect->organization_name ?? $prospect->client->name }}
</span>
</div>
</td>
<td class="w-15p">
<td class="w-10p">
<img src="{{ $prospect->pocUser->avatar ?? '' }}" class="rounded-circle" width="30"
height="30" alt="{{ $prospect->pocUser->name ?? '-' }}" data-toggle="tooltip"
data-placement="top" title="{{ $prospect->pocUser->name ?? '-' }}">
</td>
<td class="w-30p">
<span>{{ $prospect->getFormattedDate($prospect->proposal_sent_date) }}</span>
</td>
<td class="w-20p">
<span>{{ $prospect->domain ?? '-' }}</span>
data-placement="top" title="{{ $prospect->pocUser->name ?? '' }}" />
</td>
<td class="w-20p">
<span>{{ ucfirst($prospect->customer_type) ?? '-' }}</span>
<span>{{ $prospect->getFormattedDate($prospect->proposal_sent_date) }}</span>
</td>

<td class="w-30p">
<td class="w-25p">
<span>
{{ isset($prospect->currency) && isset($currencySymbols[$prospect->currency]) ? $currencySymbols[$prospect->currency] : '' }}
{{ $prospect->budget ? $prospect->formattedAmount($prospect->budget) : '-' }}
{{ $prospect->budget ? $prospect->formatted_budget : '-' }}
</span>
</td>
<td class="w-20p">
<td class="w-15p">
<span
class="">{{ config('prospect.status')[$prospect->proposal_status] ?? '-' }}</span>
</td>
Expand Down
33 changes: 11 additions & 22 deletions Modules/Prospect/Resources/views/menu-header.blade.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
<ul class="nav nav-pills mt-3 mb-2">
<ul class="nav nav-pills mt-3 mb-2" role="navigation" aria-label="Prospect statuses">
@php
$filters = request()->except('page');
$currentStatus = request()->input('status') ?? 'open';
$currentStatus = request('status', 'open');
$prospectStatuses = ['open' => 'Open', 'converted' => 'Converted', 'rejected' => 'Rejected', 'client-unresponsive' => 'Unresponsive'];
@endphp

<li class="nav-item mr-3">
<a class="nav-link {{ $currentStatus == 'open' ? 'active' : '' }}"
href="{{ route('prospect.index', array_merge($filters, ['status' => 'open'])) }}">
Open Prospects
</a>
</li>

<li class="nav-item">
<a class="nav-link {{ $currentStatus == 'converted' ? 'active' : '' }}"
href="{{ route('prospect.index', array_merge($filters, ['status' => 'converted'])) }}">
Converted Prospects
</a>
</li>

<li class="nav-item">
<a class="nav-link {{ $currentStatus == 'rejected' ? 'active' : '' }}"
href="{{ route('prospect.index', array_merge($filters, ['status' => 'rejected'])) }}">
Rejected Prospects
</a>
</li>
@foreach($prospectStatuses as $status => $label)
<li class="nav-item {{ $loop->iteration ? 'mx-1' : 'mr-1' }}">
<a class="nav-link {{ $currentStatus == $status ? 'active' : '' }}"
href="{{ route('prospect.index', array_merge($filters, ['status' => $status])) }}" aria-current="{{ $currentStatus == $status ? 'page' : 'false'}}">
{{ $label }}
</a>
</li>
@endforeach
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class="ml-2">{{ config('prospect.customer-types')[$prospect->customer_type] ?? '
<label for="budget" class="font-weight-bold">Budget:</label>
<span class="ml-2">
{{ isset($prospect->currency) && isset($currencySymbols[$prospect->currency]) ? $currencySymbols[$prospect->currency] : '' }}
{{ $prospect->budget ? $prospect->formattedAmount($prospect->budget) : 'N/A' }}
{{ $prospect->budget ? $prospect->formatted_budget : 'N/A' }}
</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Modules/Prospect/Services/ProspectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function getFilteredProspects(array $requestData = [])
return Prospect::query()->when(
$filter === 'open',
fn ($query) => $query->where(function ($query) {
$query->whereNotIn('proposal_status', ['rejected', 'converted'])
$query->whereNotIn('proposal_status', ['rejected', 'converted', 'client-unresponsive'])
->orWhereNull('proposal_status')
->orWhere('proposal_status', '');
}),
Expand Down
Loading