Skip to content

Commit

Permalink
Merge pull request #1372 from jitendra-webkul/lead-index-page
Browse files Browse the repository at this point in the history
Dashboard
  • Loading branch information
jitendra-webkul authored Aug 20, 2024
2 parents ac9e2e8 + 5e163e9 commit 198e676
Show file tree
Hide file tree
Showing 56 changed files with 6,210 additions and 3,650 deletions.
1 change: 1 addition & 0 deletions packages/Webkul/Admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@vee-validate/i18n": "^4.9.1",
"@vee-validate/rules": "^4.9.1",
"@vitejs/plugin-vue": "^4.2.3",
"chartjs-chart-funnel": "^4.2.1",
"flatpickr": "^4.6.13",
"mitt": "^3.0.1",
"vee-validate": "^4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function prepareColumns(): void
'closure' => function ($row) {
$route = urldecode(route('admin.contacts.persons.index', ['id[eq]' => $row->person_id]));

return "<a href='".$route."'>".$row->person_name."</a>";
return "<a href='".$route."'>".$row->person_name.'</a>';
},
]);

Expand Down
81 changes: 77 additions & 4 deletions packages/Webkul/Admin/src/Helpers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Webkul\Admin\Helpers;

use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Webkul\Admin\Helpers\Reporting\Activity;
use Webkul\Admin\Helpers\Reporting\Lead;
use Webkul\Admin\Helpers\Reporting\Organization;
Expand All @@ -26,19 +27,91 @@ public function __construct(
protected Quote $quoteReporting,
) {}

/**
* Returns the overall revenue statistics.
*/
public function getRevenueStats(): array
{
return [
'total_won_revenue' => $this->leadReporting->getTotalWonLeadValueProgress(),
'total_lost_revenue' => $this->leadReporting->getTotalLostLeadValueProgress(),
];
}

/**
* Returns the overall statistics.
*/
public function getOverAllStats(): array
{
return [
'total_leads' => $this->leadReporting->getTotalLeadsProgress(),
'total_quotations' => $this->quoteReporting->getTotalQuotesProgress(),
'total_persons' => $this->personReporting->getTotalPersonsProgress(),
'total_organizations' => $this->organizationReporting->getTotalOrganizationsProgress(),
'total_leads' => $this->leadReporting->getTotalLeadsProgress(),
'average_lead_value' => $this->leadReporting->getAverageLeadValueProgress(),
'average_leads_per_day' => $this->leadReporting->getAverageLeadsPerDayProgress(),
'total_quotations' => $this->quoteReporting->getTotalQuotesProgress(),
'total_persons' => $this->personReporting->getTotalPersonsProgress(),
'total_organizations' => $this->organizationReporting->getTotalOrganizationsProgress(),
];
}

/**
* Returns leads statistics.
*/
public function getTotalLeadsStats(): array
{
return [
'all' => [
'over_time' => $this->leadReporting->getTotalLeadsOverTime(),
],

'won' => [
'over_time' => $this->leadReporting->getTotalWonLeadsOverTime(),
],
'lost' => [
'over_time' => $this->leadReporting->getTotalLostLeadsOverTime(),
],
];
}

/**
* Returns leads revenue statistics by sources.
*/
public function getLeadsStatsBySources(): mixed
{
return $this->leadReporting->getTotalWonLeadValueBySources();
}

/**
* Returns leads revenue statistics by types.
*/
public function getLeadsStatsByTypes(): mixed
{
return $this->leadReporting->getTotalWonLeadValueByTypes();
}

/**
* Returns open leads statistics by states.
*/
public function getOpenLeadsByStates(): mixed
{
return $this->leadReporting->getOpenLeadsByStates();
}

/**
* Returns top selling products statistics.
*/
public function getTopSellingProducts(): Collection
{
return $this->productReporting->getTopSellingProductsByRevenue(5);
}

/**
* Returns top selling products statistics.
*/
public function getTopPersons(): Collection
{
return $this->personReporting->getTopCustomersByRevenue(5);
}

/**
* Get the start date.
*
Expand Down
Loading

0 comments on commit 198e676

Please sign in to comment.