reports data alignment updated
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user