Remove expense section from dashboard if module is disabled

This commit is contained in:
Hillel Coren 2017-12-07 14:53:32 +02:00
parent 32864bdb10
commit 476fdff958
2 changed files with 4 additions and 3 deletions

View File

@ -83,6 +83,7 @@ class DashboardController extends BaseController
'tasks' => $tasks,
'showBlueVinePromo' => $showBlueVinePromo,
'showWhiteLabelExpired' => $showWhiteLabelExpired,
'showExpenses' => count($expenses) && $account->isModuleEnabled(ENTITY_EXPENSE),
'headerClass' => in_array(\App::getLocale(), ['lt', 'pl', 'cs', 'sl', 'tr_TR']) ? 'in-large' : 'in-thin',
'footerClass' => in_array(\App::getLocale(), ['lt', 'pl', 'cs', 'sl', 'tr_TR']) ? '' : 'in-thin',
];

View File

@ -170,7 +170,7 @@
});
function loadData() {
var includeExpenses = "{{ count($expenses) ? 'true' : 'false' }}";
var includeExpenses = "{{ $showExpenses ? 'true' : 'false' }}";
var url = "{!! url('/dashboard_chart_data') !!}/" + chartGroupBy + '/' + chartStartDate.format('YYYY-MM-DD') + '/' + chartEndDate.format('YYYY-MM-DD') + '/' + chartCurrencyId + '/' + includeExpenses;
$.get(url, function(response) {
response = JSON.parse(response);
@ -290,7 +290,7 @@
<div class="panel panel-default">
<div class="panel-body expenses-panel">
<div style="overflow:hidden">
@if (count($expenses))
@if ($showExpenses)
<div class="{{ $headerClass }}">
{{ trans('texts.total_expenses') }}
</div>
@ -415,7 +415,7 @@
<div class="panel panel-default dashboard" style="height:320px;">
<div class="panel-heading" style="margin:0; background-color: #f5f5f5 !important;">
<h3 class="panel-title" style="color: black !important">
@if (count($expenses) && count($averageInvoice))
@if ($showExpenses && count($averageInvoice))
<div class="pull-right" style="font-size:14px;padding-top:4px;font-weight:bold">
@foreach ($averageInvoice as $item)
<span class="currency currency_{{ $item->currency_id ?: $account->getCurrencyId() }}" style="display:none">