Skip to content

Commit

Permalink
Accounts show see performance button development start..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Aug 7, 2021
1 parent 98566cf commit 05120a9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
18 changes: 18 additions & 0 deletions app/Http/Controllers/Banking/Accounts.php
Expand Up @@ -10,6 +10,7 @@
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
Expand Down Expand Up @@ -243,6 +244,23 @@ public function createTransfer(Account $account)
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');
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en-GB/accounts.php
Expand Up @@ -10,5 +10,7 @@
'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.',

];
4 changes: 2 additions & 2 deletions resources/views/banking/accounts/show.blade.php
Expand Up @@ -49,8 +49,8 @@

@stack('performance_button_start')
@can('read-banking-accounts')
<a class="dropdown-item" href="#">
See Performance
<a class="dropdown-item" href="{{ route('accounts.see-performance', $account->id) }}">
{{ trans('accounts.see_performance') }}
</a>
@endcan
@stack('performance_button_end')
Expand Down
1 change: 1 addition & 0 deletions routes/admin.php
Expand Up @@ -131,6 +131,7 @@
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');
Expand Down

0 comments on commit 05120a9

Please sign in to comment.