From 7c4ef04346b54138de7c27cdb3477a75bfe3d271 Mon Sep 17 00:00:00 2001 From: Martin Cornel Date: Sun, 7 Feb 2021 18:20:15 +0300 Subject: [PATCH] Sidenav setup. --- app/Http/Controllers/CreditController.php | 5 + app/Http/Controllers/HomeController.php | 10 +- app/Http/Controllers/PatientController.php | 11 +- app/Utils.php | 1 + database/seeds/UsersTableSeeder.php | 1 + resources/views/layouts/backend.blade.php | 4 +- resources/views/layouts/sidenav.blade.php | 221 +++------------------ resources/views/patient/index.blade.php | 2 +- 8 files changed, 52 insertions(+), 203 deletions(-) diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index a991ad0..f1de5c0 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -34,6 +34,11 @@ public function index($status_filter=null) return $credit->cleared == true; })->values();; break; + case HC::CREDITS_OVERPAID: + $credits = Credit::all()->filter(function ($credit) { + return $credit->amount_due < 0; + })->values();; + break; default: $credits = Credit::all(); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 31ab1e6..f8aa4a1 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,10 +23,14 @@ public function __construct() $this->middleware('auth'); } - public const WIDGET_U5 = 'Clients Under 5'; - public const WIDGET_O5 = 'Clients Over 5'; + public const WIDGET_U5 = 'Under 5'; + public const WIDGET_O5 = 'Over 5'; + public const PATIENTS_WITH_DEBT = 'With Outstanding Debts'; + public const WIDGET_OUTSTANDING = 'Total Outstanding Debts'; - public const WIDGET_CLEARED = 'Total Cleared Debts'; + public const WIDGET_CLEARED = 'Cleared Debt'; + public const CREDITS_OVERPAID = 'Overpaid Debt'; + public const WIDGET_DUE = 'Debts Due Soon'; public const WIDGET_DEBT_TREND = 'Debts Trend'; diff --git a/app/Http/Controllers/PatientController.php b/app/Http/Controllers/PatientController.php index f7906c1..abd696f 100644 --- a/app/Http/Controllers/PatientController.php +++ b/app/Http/Controllers/PatientController.php @@ -23,9 +23,9 @@ public function __construct() * * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\Response|\Illuminate\View\View */ - public function index($age_filter=null) + public function index($filter=null) { - switch ($age_filter) { + switch ($filter) { case HC::WIDGET_O5: $patients = Patient::all()->filter(function ($patient) { return $patient->years >= 5; @@ -36,11 +36,16 @@ public function index($age_filter=null) return $patient->years < 5; })->values();; break; + case HC::PATIENTS_WITH_DEBT: + $patients = Patient::all()->filter(function ($patient) { + return $patient->credit_due > 0; + })->values();; + break; default: $patients = Patient::all(); } $context = [ - 'age_filter' =>$age_filter, + 'list_filter' =>$filter, 'patients' => $patients ]; return view('patient.index', $context); diff --git a/app/Utils.php b/app/Utils.php index 5529379..101d262 100644 --- a/app/Utils.php +++ b/app/Utils.php @@ -6,6 +6,7 @@ class Utils extends Model { + const SUPER_ADMIN_ID = 1; public static function safe_divide($numerator, $denominator, $decimals=2){ if ($numerator == 0 or $denominator == 0){ return round(0,$decimals); diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php index 533ff1f..ac220bb 100644 --- a/database/seeds/UsersTableSeeder.php +++ b/database/seeds/UsersTableSeeder.php @@ -14,6 +14,7 @@ public function run() { if ($this->command) $this->command->info('Creating Default Users'); User::create([ + 'id'=>\App\Utils::SUPER_ADMIN_ID, 'name' => 'System Admin', 'email' => "sadmin@mcornel.com", 'password' => bcrypt('Sy5@dm!n') diff --git a/resources/views/layouts/backend.blade.php b/resources/views/layouts/backend.blade.php index a4c41d1..45e7e7b 100644 --- a/resources/views/layouts/backend.blade.php +++ b/resources/views/layouts/backend.blade.php @@ -1,4 +1,4 @@ - + @@ -27,6 +27,8 @@ {{-- --}} {{-- --}} + + diff --git a/resources/views/layouts/sidenav.blade.php b/resources/views/layouts/sidenav.blade.php index 198cd58..4981d63 100644 --- a/resources/views/layouts/sidenav.blade.php +++ b/resources/views/layouts/sidenav.blade.php @@ -1,4 +1,3 @@ -
@@ -6,219 +5,51 @@

diff --git a/resources/views/patient/index.blade.php b/resources/views/patient/index.blade.php index 9b05652..0a5d258 100644 --- a/resources/views/patient/index.blade.php +++ b/resources/views/patient/index.blade.php @@ -2,7 +2,7 @@ @section('page_content')
-
{{ $age_filter }} Patients +
Patients {{ $list_filter }} Add Patient