Skip to content

Commit 60b7474

Browse files
committed
wip
1 parent e368648 commit 60b7474

15 files changed

Lines changed: 525 additions & 294 deletions

File tree

app/Filament/Resources/Profiles/Schemas/AreaInfolist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static function configure(Schema $schema): Schema
1717
->columns(1)
1818
->components([
1919
Subsection::make()
20-
->icon(Heroicon::MapPin)
20+
->icon(Heroicon::OutlinedMapPin)
2121
->columns()
2222
->components([
2323
TextEntry::make('activityCounty.name')

app/Filament/Widgets/StatsWidgets/AdminStatsWidget.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
use App\Filament\Resources\Appointments\AppointmentResource;
88
use App\Filament\Resources\Users\UserResource;
9+
use App\Filament\Widgets\Components\Stat;
910
use App\Models\Appointment;
1011
use App\Models\Beneficiary;
1112
use App\Models\Intervention;
1213
use App\Models\User;
1314
use App\Services\StatCount;
1415
use Filament\Support\Icons\Heroicon;
1516
use Filament\Widgets\StatsOverviewWidget;
16-
use Filament\Widgets\StatsOverviewWidget\Stat;
1717

1818
class AdminStatsWidget extends StatsOverviewWidget
1919
{
@@ -50,40 +50,41 @@ protected function getStats(): array
5050
];
5151
}
5252

53-
/**
54-
* @TODO: implement trend
55-
*/
5653
private function getAppointmentsStat(): Stat
5754
{
5855
$value = Appointment::select(StatCount::comparedBy('date'))
5956
->toBase()
6057
->first();
6158

62-
return Stat::make(__('dashboard.stats.appointments'), data_get($value, 'current'))
59+
$url = AppointmentResource::getUrl('index');
60+
61+
return Stat::make(__('dashboard.stats.appointments'))
6362
->icon(Heroicon::Calendar)
64-
->url(AppointmentResource::getUrl('index'));
63+
->value($value)
64+
->url($url);
6565
}
6666

67-
/**
68-
* @TODO: implement url
69-
*/
7067
private function getAllNursesStat(): Stat
7168
{
7269
$value = User::query()
7370
->onlyNurses()
7471
->count();
7572

76-
return Stat::make(__('dashboard.stats.nurses_total'), $value)
77-
->icon(Heroicon::UserGroup);
78-
// ->url(UserResource::getUrl('index'));
73+
$url = UserResource::getUrl('index');
74+
75+
return Stat::make(__('dashboard.stats.nurses_total'))
76+
->icon(Heroicon::UserGroup)
77+
->value($value)
78+
->url($url);
7979
}
8080

8181
private function getAllBeneficiariesStat(): Stat
8282
{
8383
$value = Beneficiary::count();
8484

85-
return Stat::make(__('dashboard.stats.beneficiaries_total'), $value)
86-
->icon(Heroicon::UserGroup);
85+
return Stat::make(__('dashboard.stats.beneficiaries_total'))
86+
->icon(Heroicon::UserGroup)
87+
->value($value);
8788
}
8889

8990
private function getActiveBeneficiariesStat(): Stat
@@ -92,13 +93,11 @@ private function getActiveBeneficiariesStat(): Stat
9293
->onlyActive()
9394
->count();
9495

95-
return Stat::make(__('dashboard.stats.beneficiaries_active'), $value)
96-
->icon(Heroicon::UserGroup);
96+
return Stat::make(__('dashboard.stats.beneficiaries_active'))
97+
->icon(Heroicon::Users)
98+
->value($value);
9799
}
98100

99-
/**
100-
* @TODO: implement trend
101-
*/
102101
private function getRealizedServicesStat(): Stat
103102
{
104103
$value = Intervention::select(StatCount::comparedBy('closed_at'))
@@ -107,7 +106,8 @@ private function getRealizedServicesStat(): Stat
107106
->toBase()
108107
->first();
109108

110-
return Stat::make(__('dashboard.stats.services'), data_get($value, 'current'))
111-
->icon(Heroicon::Bolt);
109+
return Stat::make(__('dashboard.stats.services'))
110+
->icon(Heroicon::Bolt)
111+
->trend($value);
112112
}
113113
}

app/Filament/Widgets/StatsWidgets/CoordinatorStatsWidget.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,42 @@ protected function getStats(): array
5050
];
5151
}
5252

53-
/**
54-
* @TODO: implement trend
55-
*/
5653
private function getAppointmentsStat(): Stat
5754
{
5855
$value = Appointment::select(StatCount::comparedBy('date'))
5956
->toBase()
6057
->first();
6158

62-
data_set($value, 'previous', 5);
59+
$url = AppointmentResource::getUrl('index');
6360

6461
return Stat::make(__('dashboard.stats.appointments'))
6562
->icon(Heroicon::Calendar)
6663
->trend($value)
67-
->url(AppointmentResource::getUrl('index'));
64+
->url($url);
6865
}
6966

70-
/**
71-
* @TODO: implement url
72-
*/
7367
private function getAllNursesStat(): Stat
7468
{
7569
$value = User::query()
7670
->onlyNurses()
7771
->activatesInCounty(auth()->user()->county_id)
7872
->count();
7973

80-
return Stat::make(__('dashboard.stats.nurses_total'), $value)
81-
->icon(Heroicon::UserGroup);
82-
// ->url(UserResource::getUrl('index'));
74+
$url = UserResource::getUrl('index');
75+
76+
return Stat::make(__('dashboard.stats.nurses_total'))
77+
->icon(Heroicon::UserGroup)
78+
->value($value)
79+
->url($url);
8380
}
8481

8582
private function getAllBeneficiariesStat(): Stat
8683
{
8784
$value = Beneficiary::count();
8885

89-
return Stat::make(__('dashboard.stats.beneficiaries_total'), $value)
90-
->icon(Heroicon::UserGroup);
86+
return Stat::make(__('dashboard.stats.beneficiaries_total'))
87+
->icon(Heroicon::UserGroup)
88+
->value($value);
9189
}
9290

9391
private function getActiveBeneficiariesStat(): Stat
@@ -96,13 +94,11 @@ private function getActiveBeneficiariesStat(): Stat
9694
->onlyActive()
9795
->count();
9896

99-
return Stat::make(__('dashboard.stats.beneficiaries_active'), $value)
100-
->icon(Heroicon::UserGroup);
97+
return Stat::make(__('dashboard.stats.beneficiaries_active'))
98+
->icon(Heroicon::Users)
99+
->value($value);
101100
}
102101

103-
/**
104-
* @TODO: implement trend
105-
*/
106102
private function getRealizedServicesStat(): Stat
107103
{
108104
$value = Intervention::select(StatCount::comparedBy('closed_at'))
@@ -111,7 +107,8 @@ private function getRealizedServicesStat(): Stat
111107
->toBase()
112108
->first();
113109

114-
return Stat::make(__('dashboard.stats.services'), data_get($value, 'current'))
115-
->icon(Heroicon::Bolt);
110+
return Stat::make(__('dashboard.stats.services'))
111+
->icon(Heroicon::Bolt)
112+
->trend($value);
116113
}
117114
}

app/Filament/Widgets/StatsWidgets/NurseStatsWidget.php

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
use App\Filament\Resources\Appointments\AppointmentResource;
88
use App\Filament\Resources\Beneficiaries\BeneficiaryResource;
9+
use App\Filament\Widgets\Components\Stat;
910
use App\Models\Appointment;
1011
use App\Models\Beneficiary;
1112
use App\Models\Intervention;
1213
use App\Services\StatCount;
1314
use Filament\Support\Icons\Heroicon;
1415
use Filament\Widgets\StatsOverviewWidget;
15-
use Filament\Widgets\StatsOverviewWidget\Stat;
1616

1717
class NurseStatsWidget extends StatsOverviewWidget
1818
{
@@ -44,9 +44,12 @@ private function getAllBeneficiariesStat(): Stat
4444
{
4545
$value = Beneficiary::count();
4646

47-
return Stat::make(__('dashboard.stats.beneficiaries_total'), $value)
47+
$url = BeneficiaryResource::getUrl('index');
48+
49+
return Stat::make(__('dashboard.stats.beneficiaries_total'))
4850
->icon(Heroicon::UserGroup)
49-
->url(BeneficiaryResource::getUrl('index'));
51+
->value($value)
52+
->url($url);
5053
}
5154

5255
private function getActiveBeneficiariesStat(): Stat
@@ -55,24 +58,22 @@ private function getActiveBeneficiariesStat(): Stat
5558
->onlyActive()
5659
->count();
5760

58-
return Stat::make(__('dashboard.stats.beneficiaries_active'), $value)
59-
->icon(Heroicon::UserGroup)
60-
->url(
61-
BeneficiaryResource::getUrl('index', [
62-
'filters' => [
63-
'status' => [
64-
'values' => [
65-
'active',
66-
],
67-
],
61+
$url = BeneficiaryResource::getUrl('index', [
62+
'filters' => [
63+
'status' => [
64+
'values' => [
65+
'active',
6866
],
69-
])
70-
);
67+
],
68+
],
69+
]);
70+
71+
return Stat::make(__('dashboard.stats.beneficiaries_active'), $value)
72+
->icon(Heroicon::Users)
73+
->value($value)
74+
->url($url);
7175
}
7276

73-
/**
74-
* @TODO: implement trend
75-
*/
7677
private function getRealizedServicesStat(): Stat
7778
{
7879
$value = Intervention::select(StatCount::comparedBy('closed_at'))
@@ -81,21 +82,22 @@ private function getRealizedServicesStat(): Stat
8182
->toBase()
8283
->first();
8384

84-
return Stat::make(__('dashboard.stats.services'), data_get($value, 'current'))
85-
->icon(Heroicon::Bolt);
85+
return Stat::make(__('dashboard.stats.services'))
86+
->icon(Heroicon::Bolt)
87+
->trend($value);
8688
}
8789

88-
/**
89-
* @TODO: implement trend
90-
*/
9190
private function getAppointmentsStat(): Stat
9291
{
9392
$value = Appointment::select(StatCount::comparedBy('date'))
9493
->toBase()
9594
->first();
9695

96+
$url = AppointmentResource::getUrl('index');
97+
9798
return Stat::make(__('dashboard.stats.appointments'), data_get($value, 'current'))
98-
->icon(Heroicon::Calendar)
99-
->url(AppointmentResource::getUrl('index'));
99+
->icon(Heroicon::CalendarDays)
100+
->trend($value)
101+
->url($url);
100102
}
101103
}

app/Providers/Filament/AdminPanelProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function panel(Panel $panel): Panel
4848
])
4949
->maxContentWidth(Width::Full)
5050
->viteTheme('resources/css/app.css')
51-
->brandLogo(fn () => view('filament.brand'))
51+
->brandLogo(fn () => view('components.brand'))
5252
->brandLogoHeight('3rem')
5353
->topNavigation()
5454
->globalSearch(false)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"blade-ui-kit/blade-heroicons": "^2.6",
1212
"commitglobal/app-version": "^v1.0",
1313
"commitglobal/enum-utils": "^v1.0",
14-
"filament/filament": "^4.1",
15-
"filament/spatie-laravel-media-library-plugin": "^4.1",
14+
"filament/filament": "^4.2",
15+
"filament/spatie-laravel-media-library-plugin": "^4.2",
1616
"guava/calendar": "^2.0",
1717
"guzzlehttp/guzzle": "^7.10",
1818
"jeffgreco13/filament-breezy": "^3.0",
@@ -39,7 +39,7 @@
3939
"friendsofphp/php-cs-fixer": "^3.89",
4040
"itsgoingd/clockwork": "^5.3",
4141
"laradumps/laradumps": "^4.5",
42-
"larastan/larastan": "^3.7",
42+
"larastan/larastan": "^3.8",
4343
"laravel/sail": "^1.47",
4444
"laravel/telescope": "^5.15",
4545
"mockery/mockery": "^1.6",

0 commit comments

Comments
 (0)