From 05120a94b465fe6d5565f23de7588d288a9a4499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sat, 7 Aug 2021 15:32:01 +0300 Subject: [PATCH] Accounts show see performance button development start.. --- app/Http/Controllers/Banking/Accounts.php | 18 ++++++++++++++++++ resources/lang/en-GB/accounts.php | 2 ++ .../views/banking/accounts/show.blade.php | 4 ++-- routes/admin.php | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php index 559bf379c..aa14a215c 100644 --- a/app/Http/Controllers/Banking/Accounts.php +++ b/app/Http/Controllers/Banking/Accounts.php @@ -10,6 +10,7 @@ use App\Jobs\Banking\UpdateAccount; use App\Models\Banking\Account; use App\Models\Banking\Transaction; use App\Models\Banking\Transfer; +use App\Utilities\Reports as Utility; use App\Models\Setting\Currency; class Accounts extends Controller @@ -243,6 +244,23 @@ class Accounts extends Controller return redirect()->route('transfers.create')->withInput($data); } + public function seePerformance(Account $account) + { + $data['account_id'] = $account->id; + + $report = Utility::getClassInstance('App\Reports\IncomeExpenseSummary'); + + if (empty($report) || empty($report->model)) { + $message = trans('accounts.create_report'); + + flash($message)->warning()->important(); + + return redirect()->route('reports.create'); + } + + return redirect()->route('reports.show', $report->model->id)->withInput($data); + } + public function currency() { $account_id = (int) request('account_id'); diff --git a/resources/lang/en-GB/accounts.php b/resources/lang/en-GB/accounts.php index 98b9c65a4..c497e6a79 100644 --- a/resources/lang/en-GB/accounts.php +++ b/resources/lang/en-GB/accounts.php @@ -10,5 +10,7 @@ return [ 'bank_phone' => 'Bank Phone', 'bank_address' => 'Bank Address', 'default_account' => 'Default Account', + 'see_performance' => 'See Performance', + 'create_report' => 'If you want to see account performance. You can create Income vs Expense report instance.', ]; diff --git a/resources/views/banking/accounts/show.blade.php b/resources/views/banking/accounts/show.blade.php index e12529263..7fc7c784b 100644 --- a/resources/views/banking/accounts/show.blade.php +++ b/resources/views/banking/accounts/show.blade.php @@ -49,8 +49,8 @@ @stack('performance_button_start') @can('read-banking-accounts') - - See Performance + + {{ trans('accounts.see_performance') }} @endcan @stack('performance_button_end') diff --git a/routes/admin.php b/routes/admin.php index 86afc89df..39152ee28 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -131,6 +131,7 @@ Route::group(['prefix' => 'banking'], function () { Route::get('accounts/{account}/create-revenue', 'Banking\Accounts@createRevenue')->name('accounts.create-revenue'); Route::get('accounts/{account}/create-payment', 'Banking\Accounts@createPayment')->name('accounts.create-payment'); Route::get('accounts/{account}/create-transfer', 'Banking\Accounts@createTransfer')->name('accounts.create-transfer'); + Route::get('accounts/{account}/see-performance', 'Banking\Accounts@seePerformance')->name('accounts.see-performance'); Route::get('accounts/{account}/enable', 'Banking\Accounts@enable')->name('accounts.enable'); Route::get('accounts/{account}/disable', 'Banking\Accounts@disable')->name('accounts.disable'); Route::get('accounts/{account}/duplicate', 'Banking\Accounts@duplicate')->name('accounts.duplicate');