Merge pull request #1337 from batuhawk/master

Reports data alignment updated
This commit is contained in:
Batuhan Baş 2020-03-09 17:18:46 +03:00 committed by GitHub
commit bc421a5887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 97 additions and 32 deletions

View File

@ -67,6 +67,9 @@ abstract class Report
'datasets' => [], 'datasets' => [],
]; ];
public $column_width = 'report-column';
public $head_column_width = 'head_report_column';
public function __construct(Model $model = null, $load_data = true) public function __construct(Model $model = null, $load_data = true)
{ {
$this->setGroups(); $this->setGroups();
@ -76,6 +79,8 @@ abstract class Report
} }
$this->model = $model; $this->model = $model;
$this->setHeadColumnWidth();
$this->setDataColumnWidth();
if (!$load_data) { if (!$load_data) {
return; return;
@ -198,6 +203,46 @@ abstract class Report
return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx'); return \Excel::download(new Export($this->views['content'], $this), \Str::filename($this->model->name) . '.xlsx');
} }
public function setHeadColumnWidth()
{
if (empty($this->model->settings->period)) {
return;
}
$head_width = 'head_report_column';
switch ($this->model->settings->period) {
case 'quarterly':
$head_width = 'col-sm-2';
break;
case 'yearly':
$head_width = 'col-sm-4';
break;
}
$this->head_column_width = $head_width;
}
public function setDataColumnWidth()
{
if (empty($this->model->settings->period)) {
return;
}
$width = 'report-column';
switch ($this->model->settings->period) {
case 'quarterly':
$width = 'col-sm-2';
break;
case 'yearly':
$width = 'col-sm-4';
break;
}
$this->column_width = $width;
}
public function setYear() public function setYear()
{ {
$this->year = request('year', Date::now()->year); $this->year = request('year', Date::now()->year);

View File

@ -2087,6 +2087,11 @@ div.required .form-control-label:not(span):after, td.required:after
box-shadow: rgba(248, 248, 255) 0 0 0 1px, rgba(248, 248, 255) 0 4px 16px; box-shadow: rgba(248, 248, 255) 0 0 0 1px, rgba(248, 248, 255) 0 4px 16px;
} }
.btn-icon-clipboard:focus
{
outline: none;
}
/*--Settings Board Icon Color--*/ /*--Settings Board Icon Color--*/
.btn-icon-clipboard i .btn-icon-clipboard i
{ {
@ -2323,7 +2328,7 @@ option:focus
/*--------Login Card Background Color Finish--------*/ /*--------Login Card Background Color Finish--------*/
/*--------General Progress Bar Color--------*/ /*--General Progress Bar Color---*/
#nprogress .bar #nprogress .bar
{ {
background: #3f3c72 !important; background: #3f3c72 !important;
@ -2340,10 +2345,10 @@ option:focus
{ {
box-shadow: 0 0 10px #3f3c72, 0 0 5px #3f3c72 !important; box-shadow: 0 0 10px #3f3c72, 0 0 5px #3f3c72 !important;
} }
/*--------General Progress Bar Color Finish--------*/ /*--General Progress Bar Color Finish---*/
/*--------List Group Item Active-------*/ /*--List Group Item Active---*/
.list-group-item.active .list-group-item.active
{ {
z-index: 2; z-index: 2;
@ -2351,7 +2356,7 @@ option:focus
background-color: #3c3f72 !important; background-color: #3c3f72 !important;
border-color: #3c3f72 !important; border-color: #3c3f72 !important;
} }
/*--------List Group Item Active Finish-------*/ /*--List Group Item Active Finish---*/
/*--Wizard Delete Button Text--*/ /*--Wizard Delete Button Text--*/

16
public/css/custom.css vendored
View File

@ -526,7 +526,6 @@ button:focus
box-shadow: none !important; box-shadow: none !important;
} }
/*--------Shadow None Focus Finish--------*/ /*--------Shadow None Focus Finish--------*/
/*--------Settings Index Page Finish--------*/ /*--------Settings Index Page Finish--------*/
@ -637,8 +636,19 @@ table .align-items-center td span.badge
/*--------Report Column--------*/ /*--------Report Column--------*/
.report-column .report-column
{ {
max-width: 100px; -webkit-box-flex: 0;
width: 160px !important; -ms-flex: 0 0 6.66%;
flex: 0 0 6.66%;
max-width: 6.66%;
}
.head_report_column
{
-webkit-box-flex: 0;
-ms-flex: 0 0 10%;
flex: 0 0 10%;
width: 10%;
max-width: 10%;
} }
/*--------Report Column Finish--------*/ /*--------Report Column Finish--------*/

View File

@ -141,6 +141,11 @@ th, td
float: right !important; float: right !important;
} }
.font-size-unset
{
font-size: unset;
}
.text .text
{ {
color: #3c3f72; color: #3c3f72;

View File

@ -1,11 +1,11 @@
<tfoot> <tfoot>
<tr class="rp-border-top-1"> <tr class="row rp-border-top-1 font-size-unset px-3">
<th class="report-column text-left text-uppercase">{{ trans_choice('general.totals', 1) }}</th> <th class="{{ $class->head_column_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
@php $grand_total = 0; @endphp @php $grand_total = 0; @endphp
@foreach($class->footer_totals[$table] as $total) @foreach($class->footer_totals[$table] as $total)
@php $grand_total += $total; @endphp @php $grand_total += $total; @endphp
<th class="report-column text-right px-0">@money($total, setting('default.currency'), true)</th> <th class="{{ $class->column_width }}">@money($total, setting('default.currency'), true)</th>
@endforeach @endforeach
<th class="report-column text-right">@money($grand_total, setting('default.currency'), true)</th> <th class="{{ $class->head_column_width }}">@money($grand_total, setting('default.currency'), true)</th>
</tr> </tr>
</tfoot> </tfoot>

View File

@ -1,13 +1,13 @@
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr class="row font-size-unset">
@if (($table == 'default') && !empty($class->groups)) @if (($table == 'default') && !empty($class->groups))
<th>{{ $class->groups[$class->model->settings->group] }}</th> <th class="{{ $class->head_column_width }}">{{ $class->groups[$class->model->settings->group] }}</th>
@else @else
<th>{{ $table }}</th> <th class="{{ $class->head_column_width }}">{{ $table }}</th>
@endif @endif
@foreach($class->dates as $date) @foreach($class->dates as $date)
<th class="text-right px-0">{{ $date }}</th> <th class="{{ $class->column_width }}">{{ $date }}</th>
@endforeach @endforeach
<th class="text-right">{{ trans_choice('general.totals', 1) }}</th> <th class="{{ $class->head_column_width }}">{{ trans_choice('general.totals', 1) }}</th>
</tr> </tr>
</thead> </thead>

View File

@ -1,9 +1,9 @@
@php $row_total = 0; @endphp @php $row_total = 0; @endphp
<tr class="rp-border-top-1"> <tr class="row rp-border-top-1 font-size-unset">
<td class="report-column" style="padding-left:{{ $class->indents['table_rows'] }}">{{ $class->row_names[$table][$id] }}</td> <td class="{{ $class->head_column_width }}">{{ $class->row_names[$table][$id] }}</td>
@foreach($rows as $row) @foreach($rows as $row)
@php $row_total += $row; @endphp @php $row_total += $row; @endphp
<td class="report-column text-right px-0">@money($row, setting('default.currency'), true)</td> <td class="{{ $class->column_width }}">@money($row, setting('default.currency'), true)</td>
@endforeach @endforeach
<td class="report-column text-right">@money($row_total, setting('default.currency'), true)</td> <td class="{{ $class->head_column_width }}">@money($row_total, setting('default.currency'), true)</td>
</tr> </tr>

View File

@ -1,12 +1,12 @@
<div class="table-responsive overflow-auto my-4"> <div class="table-responsive overflow-auto my-4">
<table class="table table-hover align-items-center rp-border-collapse"> <table class="table table-hover align-items-center rp-border-collapse">
<tfoot class="border-top-style"> <tfoot class="border-top-style">
<tr class="rp-border-top-1"> <tr class="row rp-border-top-1 font-size-unset px-3">
<th class="report-column text-uppercase text-left text-nowrap">{{ trans('reports.net_profit') }}</th> <th class="{{ $class->head_column_width }} text-uppercase text-nowrap">{{ trans('reports.net_profit') }}</th>
@foreach($class->net_profit as $profit) @foreach($class->net_profit as $profit)
<th class="report-column text-right px-0">@money($profit, setting('default.currency'), true)</th> <th class="{{ $class->column_width }}">@money($profit, setting('default.currency'), true)</th>
@endforeach @endforeach
<th class="report-column text-right"> <th class="{{ $class->head_column_width }}">
@money(array_sum($class->net_profit), setting('default.currency'), true) @money(array_sum($class->net_profit), setting('default.currency'), true)
</th> </th>
</tr> </tr>

View File

@ -1,12 +1,12 @@
<div class="table-responsive overflow-auto mt-4"> <div class="table-responsive overflow-auto mt-4">
<table class="table table-hover align-items-center rp-border-collapse"> <table class="table table-hover align-items-center rp-border-collapse">
<thead class="border-top-style"> <thead class="border-top-style">
<tr class="rp-border-bottom-1"> <tr class="row rp-border-bottom-1 font-size-unset px-3">
<th class="report-column text-right"></th> <th class="{{ $class->head_column_width }}"></th>
@foreach($class->dates as $date) @foreach($class->dates as $date)
<th class="report-column text-right px-0">{{ $date }}</th> <th class="{{ $class->column_width }}">{{ $date }}</th>
@endforeach @endforeach
<th class="report-column text-right text-uppercase"> <th class="{{ $class->head_column_width }} text-uppercase">
{{ trans_choice('general.totals', 1) }} {{ trans_choice('general.totals', 1) }}
</th> </th>
</tr> </tr>

View File

@ -1,11 +1,11 @@
<tfoot> <tfoot>
<tr class="rp-border-top-1"> <tr class="row rp-border-top-1 font-size-unset px-3">
<th class="report-column text-left text-uppercase">{{ trans_choice('general.totals', 1) }}</th> <th class="{{ $class->head_column_width }} text-uppercase">{{ trans_choice('general.totals', 1) }}</th>
@php $grand_total = 0; @endphp @php $grand_total = 0; @endphp
@foreach($class->footer_totals[$table] as $date => $total) @foreach($class->footer_totals[$table] as $date => $total)
@php $grand_total += $total; @endphp @php $grand_total += $total; @endphp
<th class="report-column text-right px-0">@money($total, setting('default.currency'), true)</th> <th class="{{ $class->column_width }}">@money($total, setting('default.currency'), true)</th>
@endforeach @endforeach
<th class="report-column text-right">@money($grand_total, setting('default.currency'), true)</th> <th class="{{ $class->head_column_width }}">@money($grand_total, setting('default.currency'), true)</th>
</tr> </tr>
</tfoot> </tfoot>