Skip to content

Commit

Permalink
Fixed Issue #1787
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-webkul committed Dec 27, 2024
1 parent 1f90616 commit cfbbac7
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 37 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class="primary-button"
['code', 'IN', ['price']],
['code' , '!=', 'quantity']
])"
:custom-validations="[
'price' => [
'min:0',
],
]"
/>

{!! view_render_event('admin.products.create.accordion.content.attributes.after') !!}
Expand Down

0 comments on commit cfbbac7

Please sign in to comment.