From cf3513cf13f85320689ad27452f9e1ace7f61d38 Mon Sep 17 00:00:00 2001 From: Spitfire Date: Fri, 5 Jan 2024 13:57:54 -0600 Subject: [PATCH 1/2] Entity List Widget: Filter on user. --- app/Models/CampaignDashboardWidget.php | 8 ++++++++ lang/en/dashboard.php | 2 ++ .../views/dashboard/widgets/forms/_recent.blade.php | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Models/CampaignDashboardWidget.php b/app/Models/CampaignDashboardWidget.php index 3b2fa85cb4..18fd460074 100644 --- a/app/Models/CampaignDashboardWidget.php +++ b/app/Models/CampaignDashboardWidget.php @@ -248,6 +248,14 @@ public function entities() ; } + if ($this->conf('created_by')) { + $base = $base->where('created_by', $this->conf('created_by')); + } + + if ($this->conf('updated_by')) { + $base = $base->where('updated_by', $this->conf('updated_by')); + } + // Ordering $order = Arr::get($this->config, 'order', null); if (empty($order)) { diff --git a/lang/en/dashboard.php b/lang/en/dashboard.php index b4cb524f63..d003c473b3 100644 --- a/lang/en/dashboard.php +++ b/lang/en/dashboard.php @@ -124,12 +124,14 @@ ], 'fields' => [ 'class' => 'CSS class', + 'created_by' => 'Created by', 'dashboard' => 'Dashboard', 'name' => 'Custom widget name', 'optional-entity' => 'Link to entity', 'order' => 'Ordering', 'size' => 'Size', 'text' => 'Text', + 'updated_by' => 'Last updated by', 'width' => 'Width', ], 'helpers' => [ diff --git a/resources/views/dashboard/widgets/forms/_recent.blade.php b/resources/views/dashboard/widgets/forms/_recent.blade.php index 57f528739f..b7b01562a0 100644 --- a/resources/views/dashboard/widgets/forms/_recent.blade.php +++ b/resources/views/dashboard/widgets/forms/_recent.blade.php @@ -71,7 +71,7 @@ @include('dashboard.widgets.forms._name') @include('dashboard.widgets.forms._width') - + {!! Form::select('config[order]', [ '' => __('dashboard.widgets.orders.recent'), 'oldest' => __('dashboard.widgets.orders.oldest'), @@ -80,6 +80,14 @@ ], null, ['class' => '']) !!} @includeWhen(!empty($dashboards), 'dashboard.widgets.forms._dashboard') + + + {!! Form::select('config[created_by]', ['' => ''] + $campaign->membersList(), null, ['class' => 'w-full']) !!} + + + + {!! Form::select('config[updated_by]', ['' => ''] + $campaign->membersList(), null, ['class' => 'w-full']) !!} +
From 665fbce16dd4b3640afa684b3d02d395e6126593 Mon Sep 17 00:00:00 2001 From: Spitfire Date: Fri, 5 Jan 2024 18:15:48 -0600 Subject: [PATCH 2/2] Implemented requested changes --- app/Models/CampaignDashboardWidget.php | 8 -------- lang/en/dashboard.php | 2 -- resources/views/dashboard/widgets/forms/_recent.blade.php | 8 -------- 3 files changed, 18 deletions(-) diff --git a/app/Models/CampaignDashboardWidget.php b/app/Models/CampaignDashboardWidget.php index 18fd460074..3b2fa85cb4 100644 --- a/app/Models/CampaignDashboardWidget.php +++ b/app/Models/CampaignDashboardWidget.php @@ -248,14 +248,6 @@ public function entities() ; } - if ($this->conf('created_by')) { - $base = $base->where('created_by', $this->conf('created_by')); - } - - if ($this->conf('updated_by')) { - $base = $base->where('updated_by', $this->conf('updated_by')); - } - // Ordering $order = Arr::get($this->config, 'order', null); if (empty($order)) { diff --git a/lang/en/dashboard.php b/lang/en/dashboard.php index d003c473b3..b4cb524f63 100644 --- a/lang/en/dashboard.php +++ b/lang/en/dashboard.php @@ -124,14 +124,12 @@ ], 'fields' => [ 'class' => 'CSS class', - 'created_by' => 'Created by', 'dashboard' => 'Dashboard', 'name' => 'Custom widget name', 'optional-entity' => 'Link to entity', 'order' => 'Ordering', 'size' => 'Size', 'text' => 'Text', - 'updated_by' => 'Last updated by', 'width' => 'Width', ], 'helpers' => [ diff --git a/resources/views/dashboard/widgets/forms/_recent.blade.php b/resources/views/dashboard/widgets/forms/_recent.blade.php index b7b01562a0..8db764b53d 100644 --- a/resources/views/dashboard/widgets/forms/_recent.blade.php +++ b/resources/views/dashboard/widgets/forms/_recent.blade.php @@ -80,14 +80,6 @@ ], null, ['class' => '']) !!} @includeWhen(!empty($dashboards), 'dashboard.widgets.forms._dashboard') - - - {!! Form::select('config[created_by]', ['' => ''] + $campaign->membersList(), null, ['class' => 'w-full']) !!} - - - - {!! Form::select('config[updated_by]', ['' => ''] + $campaign->membersList(), null, ['class' => 'w-full']) !!} -