reports data alignment updated

This commit is contained in:
batuhanbas
2020-03-09 17:17:42 +03:00
parent 0c3db525dd
commit e14486154c
10 changed files with 97 additions and 32 deletions

View File

@@ -67,6 +67,9 @@ abstract class Report
'datasets' => [],
];
public $column_width = 'report-column';
public $head_column_width = 'head_report_column';
public function __construct(Model $model = null, $load_data = true)
{
$this->setGroups();
@@ -76,6 +79,8 @@ abstract class Report
}
$this->model = $model;
$this->setHeadColumnWidth();
$this->setDataColumnWidth();
if (!$load_data) {
return;
@@ -198,6 +203,46 @@ abstract class Report
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()
{
$this->year = request('year', Date::now()->year);