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

🛠️ [v2.0] : Fixed Issue #1787 #1907

Open
wants to merge 2 commits into
base: 2.0
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions packages/Webkul/Admin/src/Helpers/Reporting/Lead.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ class Lead extends AbstractReporting
protected array $stageIds;

/**
* The channel ids.
* The all stage ids.
*/
protected array $allStageIds;

/**
* The won stage ids.
*/
protected array $wonStageIds;

/**
* The channel ids.
* The lost stage ids.
*/
protected array $lostStageIds;

Expand All @@ -32,6 +37,8 @@ public function __construct(
protected LeadRepository $leadRepository,
protected StageRepository $stageRepository
) {
$this->allStageIds = $this->stageRepository->pluck('id')->toArray();

$this->wonStageIds = $this->stageRepository->where('code', 'won')->pluck('id')->toArray();

$this->lostStageIds = $this->stageRepository->where('code', 'lost')->pluck('id')->toArray();
Expand All @@ -46,7 +53,7 @@ public function __construct(
*/
public function getTotalLeadsOverTime($period = 'auto'): array
{
$this->stageIds = [];
$this->stageIds = $this->allStageIds;

return $this->getOverTimeStats($this->startDate, $this->endDate, 'leads.id', 'created_at', $period);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class="flex w-full items-end"

props: {
labels: {
type: Array,
type: Array,
default: [],
},

datasets: {
type: Array,
default: true,
type: Array,
default: [],
},

aspectRatio: {
type: Number,
type: Number,
default: 3.23,
},
},
Expand All @@ -47,6 +47,12 @@ class="flex w-full items-end"

methods: {
prepare() {
const barCount = this.datasets.length;

this.datasets.forEach((dataset) => {
dataset.barThickness = Math.max(4, 36 / barCount);
});

if (this.chart) {
this.chart.destroy();
}
Expand All @@ -59,7 +65,7 @@ class="flex w-full items-end"

datasets: this.datasets,
},

options: {
aspectRatio: this.aspectRatio,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ class="text-xs font-semibold text-green-500"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'over-all';
filters.type = 'over-all';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ class="dark:mix-blend-exclusion dark:invert"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'revenue-by-sources';
filters.type = 'revenue-by-sources';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ class="dark:mix-blend-exclusion dark:invert"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'revenue-by-types';
filters.type = 'revenue-by-types';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="flex gap-4">
<!-- Total Revenue -->
<div class="flex flex-col gap-2">
<!-- Won Reveneue Card -->
<!-- Won Revenue Card -->
<div class="flex flex-col gap-2 rounded-lg border border-gray-200 px-4 py-5 dark:border-gray-800">
<p class="text-xs font-medium text-gray-600 dark:text-gray-300">
@lang('admin::app.dashboard.index.revenue.won-revenue')
Expand Down Expand Up @@ -130,15 +130,15 @@ class="w-full max-w-full items-end"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'revenue-stats';
filters.type = 'revenue-stats';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ class="dark:mix-blend-exclusion dark:invert"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'top-persons';
filters.type = 'top-persons';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ class="dark:mix-blend-exclusion dark:invert"
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'top-selling-products';
filters.type = 'top-selling-products';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@
},

methods: {
getStats(filtets) {
getStats(filters) {
this.isLoading = true;

var filtets = Object.assign({}, filtets);
var filters = Object.assign({}, filters);

filtets.type = 'total-leads';
filters.type = 'total-leads';

this.$axios.get("{{ route('admin.dashboard.stats') }}", {
params: filtets
params: filters
})
.then(response => {
this.report = response.data;
Expand Down
Loading