From bb434268c173dd27fa648091db5b25201f07d035 Mon Sep 17 00:00:00 2001 From: Muhammad Jawaid Shamshad <8084794+mjawaids@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:03:46 +0500 Subject: [PATCH] XW-73 Update dashboard --- app/Http/Controllers/HomeController.php | 10 +- resources/views/dashboard.blade.php | 576 +----------------- .../transactions/add-edit-modal.blade.php | 107 ++++ .../transactions/create-widget.blade.php | 44 +- resources/views/transactions/index.blade.php | 280 +-------- resources/views/transactions/list.blade.php | 171 ++++++ 6 files changed, 339 insertions(+), 849 deletions(-) create mode 100644 resources/views/transactions/add-edit-modal.blade.php create mode 100644 resources/views/transactions/list.blade.php diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index b14e952..298c2e4 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -5,6 +5,7 @@ use App\Models\Account; use App\Models\Category; use App\Models\Wallet; +use Carbon\Carbon; use Illuminate\Support\Facades\Auth; class HomeController extends Controller @@ -24,11 +25,16 @@ public function index() { $pageTitle = "Transactions"; - $transactions = Auth::user()->transactions()->orderByDesc('id')->get(); + $paginatedTransactions = Auth::user()->transactions()->orderByDesc('transaction_date')->paginate(10); + + $transactions = $paginatedTransactions->getCollection()->groupBy(function ($transaction) { + return Carbon::parse($transaction->transaction_date)->format('d M Y'); + }); + $categories = Category::where('user_id', '=', auth()->id())->get(); $accounts = Account::where('user_id', '=', auth()->id())->get(); $wallets = Wallet::where('user_id', '=', auth()->id())->get(); - return view('dashboard', compact(['transactions', 'categories', 'accounts', 'wallets', 'pageTitle'])); + return view('dashboard', compact(['paginatedTransactions', 'transactions', 'categories', 'accounts', 'wallets', 'pageTitle'])); } } diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 4e31f05..6738828 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -1,573 +1,31 @@ @extends('layouts.app') @section('content') -
Card Holder
-Expires
-Built by developers
-From colors, cards, typography to complex elements, you will - find the full documentation.
- - Read More - - -Wealth creation is an evolutionarily recent positive-sum game. It - is all about who take the opportunity first.
- - Read More - - -(+23%) than last week -
-Users
-Clicks
-Sales
-Items
-- - 4% more in 2021 -
-You have no transactions to display at the moment. Start adding - transactions to see them here.
-