report fields

This commit is contained in:
denisdulici 2020-01-16 15:39:37 +03:00
parent 7d3c7619d1
commit 893970ffae
23 changed files with 233 additions and 230 deletions

View File

@ -2,6 +2,10 @@
namespace App\Abstracts;
use App\Events\Common\ReportFilterShowing;
use App\Events\Common\ReportFilterApplying;
use App\Events\Common\ReportGroupApplying;
use App\Events\Common\ReportGroupShowing;
use App\Exports\Common\Reports as Export;
use App\Models\Common\Report as Model;
use App\Traits\Charts;
@ -14,7 +18,13 @@ abstract class Report
{
use Charts, DateTime;
public $report;
public $model;
public $default_name = '';
public $category = 'reports.income_expense';
public $icon = 'fa fa-chart-pie';
public $year;
@ -28,12 +38,8 @@ abstract class Report
public $totals = [];
public $groups = [];
public $filters = [];
public $icon = 'fa fa-chart-pie';
public $indents = [
'table_header' => '0px',
'table_rows' => '0px',
@ -54,15 +60,15 @@ abstract class Report
'datasets' => [],
];
public function __construct(Model $report = null, $get_totals = true)
public function __construct(Model $model = null, $get_totals = true)
{
$this->setGroups();
if (!$report) {
if (!$model) {
return;
}
$this->report = $report;
$this->model = $model;
$this->setYear();
$this->setViews();
@ -80,12 +86,16 @@ abstract class Report
public function getDefaultName()
{
if (!empty($this->default_name)) {
return trans($this->default_name);
}
return Str::title(str_replace('_', ' ', Str::snake((new \ReflectionClass($this))->getShortName())));
}
public function getCategory()
{
return trans('reports.income_expense');
return trans($this->category);
}
public function getIcon()
@ -108,7 +118,7 @@ abstract class Report
public function getTableRowList()
{
$group_prl = Str::plural($this->report->group);
$group_prl = Str::plural($this->model->settings->group);
if ($group_filter = request($group_prl)) {
$rows = collect($this->filters[$group_prl])->filter(function ($value, $key) use ($group_filter) {
@ -125,13 +135,13 @@ abstract class Report
{
$chart = new Chartjs();
$config = $this->chart[$this->report->chart];
$config = $this->chart[$this->model->settings->chart];
$default_options = $this->getLineChartOptions();
$options = array_merge($default_options, (array) $config['options']);
$chart->type($this->report->chart)
$chart->type($this->model->settings->chart)
->width((int) $config['width'])
->height((int) $config['height'])
->options($options)
@ -147,7 +157,7 @@ abstract class Report
}
} else {
foreach ($this->totals as $total) {
$chart->dataset($this->report->name, 'line', array_values($total))
$chart->dataset($this->model->name, 'line', array_values($total))
->backgroundColor(isset($config['backgroundColor']) ? $config['backgroundColor'] : '#6da252')
->color(isset($config['color']) ? $config['color'] : '#6da252')
->options([
@ -173,7 +183,7 @@ abstract class Report
public function export()
{
return \Excel::download(new Export($this->views['content'], $this), $this->report->name . '.xlsx');
return \Excel::download(new Export($this->views['content'], $this), $this->model->name . '.xlsx');
}
public function setYear()
@ -208,12 +218,12 @@ abstract class Report
public function setDates()
{
$function = 'sub' . ucfirst(str_replace('ly', '', $this->report->period));
$function = 'sub' . ucfirst(str_replace('ly', '', $this->model->settings->period));
$start = $this->getFinancialStart()->copy()->$function();
for ($j = 1; $j <= 12; $j++) {
switch ($this->report->period) {
switch ($this->model->settings->period) {
case 'yearly':
$start->addYear();
@ -260,12 +270,14 @@ abstract class Report
public function setFilters()
{
event(new \App\Events\Common\ReportFilterShowing($this));
event(new ReportFilterShowing($this));
}
public function setGroups()
{
event(new \App\Events\Common\ReportGroupShowing($this));
$this->groups = [];
event(new ReportGroupShowing($this));
}
public function setRows()
@ -289,7 +301,7 @@ abstract class Report
$date = $this->getFormattedDate(Date::parse($item->$date_field));
$id_field = $this->report->group . '_id';
$id_field = $this->model->settings->group . '_id';
if (!isset($this->rows[$table][$item->$id_field]) ||
!isset($this->rows[$table][$item->$id_field][$date]) ||
@ -322,21 +334,21 @@ abstract class Report
public function applyFilters($model, $args = [])
{
event(new \App\Events\Common\ReportFilterApplying($this, $model, $args));
event(new ReportFilterApplying($this, $model, $args));
return $model;
}
public function applyGroups($model, $args = [])
{
event(new \App\Events\Common\ReportGroupApplying($this, $model, $args));
event(new ReportGroupApplying($this, $model, $args));
return $model;
}
public function getFormattedDate($date)
{
switch ($this->report->period) {
switch ($this->model->settings->period) {
case 'yearly':
$i = $date->copy()->format($this->getYearlyDateFormat());
break;
@ -356,7 +368,7 @@ abstract class Report
public function getUrl($action = 'print')
{
$print_url = 'common/reports/' . $this->report->id . '/' . $action . '?year='. $this->year;
$print_url = 'common/reports/' . $this->model->id . '/' . $action . '?year='. $this->year;
collect(request('accounts'))->each(function($item) use(&$print_url) {
$print_url .= '&accounts[]=' . $item;
@ -372,4 +384,86 @@ abstract class Report
return $print_url;
}
public function getFields()
{
return [
$this->getGroupField(),
$this->getPeriodField(),
$this->getBasisField(),
$this->getChartField(),
];
}
public function getGroupField()
{
$this->setGroups();
return [
'type' => 'selectGroup',
'name' => 'group',
'title' => trans('general.group_by'),
'icon' => 'folder',
'values' => $this->groups,
'selected' => 'category',
'attributes' => [
'required' => 'required',
],
];
}
public function getPeriodField()
{
return [
'type' => 'selectGroup',
'name' => 'period',
'title' => trans('general.period'),
'icon' => 'calendar',
'values' => [
'monthly' => trans('general.monthly'),
'quarterly' => trans('general.quarterly'),
'yearly' => trans('general.yearly'),
],
'selected' => 'quarterly',
'attributes' => [
'required' => 'required',
],
];
}
public function getBasisField()
{
return [
'type' => 'selectGroup',
'name' => 'basis',
'title' => trans('general.basis'),
'icon' => 'file',
'values' => [
'accrual' => trans('general.accrual'),
'cash' => trans('general.cash'),
],
'selected' => 'accrual',
'attributes' => [
'required' => 'required',
],
];
}
public function getChartField()
{
return [
'type' => 'selectGroup',
'name' => 'chart',
'title' => trans_choice('general.charts', 1),
'icon' => 'chart-pie',
'values' => [
'0' => trans('general.disabled'),
'line' => trans('reports.charts.line'),
],
'selected' => '0',
'attributes' => [
'required' => 'required',
],
];
}
}

View File

@ -13,8 +13,8 @@ class $NAME$ extends Provider
*/
public function boot()
{
$this->loadTranslations();
$this->loadViews();
$this->loadTranslations();
$this->loadMigrations();
}

View File

@ -21,7 +21,7 @@ class Reports extends Controller
{
$classes = $categories = [];
$reports = Report::collect();
$reports = Report::all();
foreach ($reports as $report) {
if (!Utility::canRead($report->class)) {
@ -62,15 +62,7 @@ class Reports extends Controller
{
$classes = Utility::getClasses();
$groups = Utility::getGroups();
$periods = Utility::getPeriods();
$basises = Utility::getBasises();
$charts = Utility::getCharts();
return view('common.reports.create', compact('classes', 'groups', 'periods', 'basises', 'charts'));
return view('common.reports.create', compact('classes'));
}
/**
@ -111,15 +103,9 @@ class Reports extends Controller
{
$classes = Utility::getClasses();
$groups = Utility::getGroups();
$class = Utility::getClassInstance($report);
$periods = Utility::getPeriods();
$basises = Utility::getBasises();
$charts = Utility::getCharts();
return view('common.reports.edit', compact('report', 'classes', 'groups', 'periods', 'basises', 'charts'));
return view('common.reports.edit', compact('report', 'classes', 'class'));
}
/**
@ -207,11 +193,11 @@ class Reports extends Controller
}
/**
* Get groups of the specified resource.
* Get fields of the specified resource.
*
* @return Response
*/
public function groups()
public function fields()
{
$class = request('class');
@ -219,16 +205,20 @@ class Reports extends Controller
return response()->json([
'success' => false,
'error' => true,
'data' => false,
'message' => "Class doesn't exist",
'message' => 'Class does not exist',
'html' => '',
]);
}
$fields = (new $class())->getFields();
$html = view('partials.reports.fields', compact('fields'))->render();
return response()->json([
'success' => true,
'error' => false,
'data' => (new $class())->groups,
'message' => '',
'html' => $html,
]);
}
}

View File

@ -259,58 +259,38 @@ class Version200 extends Listener
$rows = [
[
'company_id' => $company->id,
'class' => 'App\Reports\IncomeSummary',
'name' => trans('reports.summary.income'),
'description' => trans('demo.reports.income'),
'class' => 'App\Reports\IncomeSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'enabled' => 1,
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company->id,
'class' => 'App\Reports\ExpenseSummary',
'name' => trans('reports.summary.expense'),
'description' => trans('demo.reports.expense'),
'class' => 'App\Reports\ExpenseSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'enabled' => 1,
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company->id,
'class' => 'App\Reports\IncomeExpenseSummary',
'name' => trans('reports.summary.income_expense'),
'description' => trans('demo.reports.income_expense'),
'class' => 'App\Reports\IncomeExpenseSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'enabled' => 1,
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company->id,
'class' => 'App\Reports\ProfitLoss',
'name' => trans('reports.profit_loss'),
'description' => trans('demo.reports.profit_loss'),
'settings' => ['group' => 'category', 'period' => 'quarterly', 'basis' => 'accrual', 'chart' => '0'],
],
[
'company_id' => $company->id,
'class' => 'App\Reports\TaxSummary',
'name' => trans('reports.summary.tax'),
'description' => trans('demo.reports.tax'),
'class' => 'App\Reports\TaxSummary',
'group' => 'category',
'period' => 'quarterly',
'basis' => 'accrual',
'chart' => '0',
'enabled' => 1,
],
[
'company_id' => $company->id,
'name' => trans('reports.profit_loss'),
'description' => trans('demo.reports.pl'),
'class' => 'App\Reports\ProfitLoss',
'group' => 'category',
'period' => 'quarterly',
'basis' => 'accrual',
'chart' => '0',
'enabled' => 1,
'settings' => ['group' => 'category', 'period' => 'quarterly', 'basis' => 'accrual', 'chart' => '0'],
],
];

View File

@ -6,7 +6,6 @@ use App\Abstracts\Model;
class Report extends Model
{
protected $table = 'reports';
/**
@ -14,5 +13,14 @@ class Report extends Model
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'description', 'class', 'group', 'period', 'basis', 'chart'];
protected $fillable = ['company_id', 'class', 'name', 'description', 'settings'];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'settings' => 'object',
];
}

View File

@ -9,6 +9,8 @@ use App\Utilities\Recurring;
class ExpenseSummary extends Report
{
public $default_name = 'reports.summary.expense';
public $icon = 'fa fa-shopping-cart';
public $chart = [
@ -26,21 +28,11 @@ class ExpenseSummary extends Report
],
];
public function getDefaultName()
{
return trans('reports.summary.expense');
}
public function getCategory()
{
return trans('reports.income_expense');
}
public function getTotals()
{
$payments = $this->applyFilters(Transaction::type('expense')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
switch ($this->report->basis) {
switch ($this->model->settings->basis) {
case 'cash':
// Payments
$this->setTotals($payments, 'paid_at');

View File

@ -10,24 +10,16 @@ use App\Utilities\Recurring;
class IncomeExpenseSummary extends Report
{
public $default_name = 'reports.summary.income_expense';
public $icon = 'fa fa-chart-pie';
public function getDefaultName()
{
return trans('reports.summary.income_expense');
}
public function getCategory()
{
return trans('reports.income_expense');
}
public function getTotals()
{
$income_transactions = $this->applyFilters(Transaction::type('income')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
$expense_transactions = $this->applyFilters(Transaction::type('expense')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
switch ($this->report->basis) {
switch ($this->model->settings->basis) {
case 'cash':
// Income Transactions
$this->setTotals($income_transactions, 'paid_at', true);

View File

@ -9,6 +9,8 @@ use App\Utilities\Recurring;
class IncomeSummary extends Report
{
public $default_name = 'reports.summary.income';
public $icon = 'fa fa-money-bill';
public $chart = [
@ -26,21 +28,11 @@ class IncomeSummary extends Report
],
];
public function getDefaultName()
{
return trans('reports.summary.income');
}
public function getCategory()
{
return trans('reports.income_expense');
}
public function getTotals()
{
$transactions = $this->applyFilters(Transaction::type('income')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
switch ($this->report->basis) {
switch ($this->model->settings->basis) {
case 'cash':
// Transactions
$this->setTotals($transactions, 'paid_at');

View File

@ -11,20 +11,14 @@ use App\Utilities\Recurring;
class ProfitLoss extends Report
{
public $default_name = 'reports.profit_loss';
public $category = 'general.accounting';
public $icon = 'fa fa-heart';
public $chart = false;
public function getDefaultName()
{
return trans('reports.profit_loss');
}
public function getCategory()
{
return trans('general.accounting');
}
public function setViews()
{
parent::setViews();
@ -73,7 +67,7 @@ class ProfitLoss extends Report
$income_transactions = $this->applyFilters(Transaction::type('income')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
$expense_transactions = $this->applyFilters(Transaction::type('expense')->isNotTransfer(), ['date_field' => 'paid_at'])->get();
switch ($this->report->basis) {
switch ($this->model->settings->basis) {
case 'cash':
// Income Transactions
$this->setTotals($income_transactions, 'paid_at', true, $this->tables['income']);

View File

@ -15,20 +15,14 @@ class TaxSummary extends Report
{
use Currencies;
public $default_name = 'reports.summary.tax';
public $category = 'general.accounting';
public $icon = 'fa fa-percent';
public $chart = false;
public function getDefaultName()
{
return trans('reports.summary.tax');
}
public function getCategory()
{
return trans('general.accounting');
}
public function setViews()
{
parent::setViews();
@ -54,7 +48,7 @@ class TaxSummary extends Report
public function getTotals()
{
switch ($this->report->basis) {
switch ($this->model->settings->basis) {
case 'cash':
// Invoice Payments
$invoices = $this->applyFilters(Transaction::type('income')->isDocument()->with(['invoice', 'invoice.totals'])->isNotTransfer(), ['date_field' => 'paid_at'])->get();

View File

@ -41,38 +41,6 @@ class Reports
return $classes;
}
public static function getGroups()
{
return [
'category' => trans_choice('general.categories', 1),
];
}
public static function getPeriods()
{
return [
'monthly' => trans('general.monthly'),
'quarterly' => trans('general.quarterly'),
'yearly' => trans('general.yearly'),
];
}
public static function getBasises()
{
return [
'accrual' => trans('general.accrual'),
'cash' => trans('general.cash'),
];
}
public static function getCharts()
{
return [
'0' => trans('general.disabled'),
'line' => trans('reports.charts.line'),
];
}
public static function getClassInstance($model, $get_totals = true)
{
if (is_string($model)) {

View File

@ -110,8 +110,8 @@ class CoreV200 extends Migration
$table->integer('dashboard_id');
$table->string('class');
$table->string('name');
$table->text('settings')->nullable();
$table->integer('sort')->default(0);
$table->text('settings')->nullable();
$table->timestamps();
$table->softDeletes();
@ -170,10 +170,7 @@ class CoreV200 extends Migration
$table->string('class');
$table->string('name');
$table->text('description');
$table->string('group');
$table->string('period');
$table->string('basis');
$table->string('chart');
$table->text('settings')->nullable();
$table->timestamps();
$table->softDeletes();

View File

@ -29,53 +29,38 @@ class Reports extends Seeder
$rows = [
[
'company_id' => $company_id,
'class' => 'App\Reports\IncomeSummary',
'name' => trans('reports.summary.income'),
'description' => trans('demo.reports.income'),
'class' => 'App\Reports\IncomeSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company_id,
'class' => 'App\Reports\ExpenseSummary',
'name' => trans('reports.summary.expense'),
'description' => trans('demo.reports.expense'),
'class' => 'App\Reports\ExpenseSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company_id,
'class' => 'App\Reports\IncomeExpenseSummary',
'name' => trans('reports.summary.income_expense'),
'description' => trans('demo.reports.income_expense'),
'class' => 'App\Reports\IncomeExpenseSummary',
'group' => 'category',
'period' => 'monthly',
'basis' => 'accrual',
'chart' => 'line',
'settings' => ['group' => 'category', 'period' => 'monthly', 'basis' => 'accrual', 'chart' => 'line'],
],
[
'company_id' => $company_id,
'class' => 'App\Reports\ProfitLoss',
'name' => trans('reports.profit_loss'),
'description' => trans('demo.reports.profit_loss'),
'settings' => ['group' => 'category', 'period' => 'quarterly', 'basis' => 'accrual', 'chart' => '0'],
],
[
'company_id' => $company_id,
'class' => 'App\Reports\TaxSummary',
'name' => trans('reports.summary.tax'),
'description' => trans('demo.reports.tax'),
'class' => 'App\Reports\TaxSummary',
'group' => 'category',
'period' => 'quarterly',
'basis' => 'accrual',
'chart' => '0',
],
[
'company_id' => $company_id,
'name' => trans('reports.profit_loss'),
'description' => trans('demo.reports.pl'),
'class' => 'App\Reports\ProfitLoss',
'group' => 'category',
'period' => 'quarterly',
'basis' => 'accrual',
'chart' => '0',
'settings' => ['group' => 'category', 'period' => 'quarterly', 'basis' => 'accrual', 'chart' => '0'],
],
];

View File

@ -28,7 +28,7 @@ return [
'expense' => 'Monthly expense summary by category.',
'income_expense' => 'Monthly income vs expense by category.',
'tax' => 'Quarterly tax summary by category.',
'pl' => 'Quarterly profit & loss by category.',
'profit_loss' => 'Quarterly profit & loss by category.',
],
];

View File

@ -11,7 +11,7 @@
'@keydown' => 'form.errors.clear($event.target.name)',
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
'novalidate' => true,
]) !!}
<div class="card-body">
@ -22,13 +22,7 @@
{{ Form::textareaGroup('description', trans('general.description'), null, null, ['rows' => '3', 'required' => 'required']) }}
{{ Form::selectGroup('group', trans('general.group_by'), 'folder', $groups, 'category') }}
{{ Form::selectGroup('period', trans('general.period'), 'calendar', $periods, 'yearly') }}
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, 'accrual') }}
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, 'line') }}
<component v-bind:is="report_fields"></component>
</div>
</div>

View File

@ -12,7 +12,7 @@
'@keydown' => 'form.errors.clear($event.target.name)',
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
'novalidate' => true,
]) !!}
<div class="card-body">
@ -23,13 +23,21 @@
{{ Form::textareaGroup('description', trans('general.description'), null, null, ['rows' => '3', 'required' => 'required']) }}
{{ Form::selectGroup('group', trans('general.group_by'), 'folder', $groups, $report->group) }}
@foreach($class->getFields() as $field)
@php $type = $field['type']; @endphp
{{ Form::selectGroup('period', trans('general.period'), 'calendar', $periods, $report->period) }}
{{ Form::selectGroup('basis', trans('general.basis'), 'file', $basises, $report->basis) }}
{{ Form::selectGroup('chart', trans_choice('general.charts', 1), 'chart-pie', $charts, $report->chart) }}
@if (($type == 'textGroup') || ($type == 'emailGroup') || ($type == 'passwordGroup'))
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['icon'], $field['attributes']) }}
@elseif ($type == 'textareaGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title']) }}
@elseif ($type == 'selectGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['icon'], $field['values'], $report->settings->{$field['name']}, $field['attributes']) }}
@elseif ($type == 'radioGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], isset($report->settings->{$field['name']}) ? $report->settings->{$field['name']} : 1, $field['enable'], $field['disable'], $field['attributes']) }}
@elseif ($type == 'checkboxGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['items'], $report->settings->{$field['name']}, $field['id'], $field['attributes']) }}
@endif
@endforeach
</div>
</div>

View File

@ -0,0 +1,15 @@
@foreach($fields as $field)
@php $type = $field['type']; @endphp
@if (($type == 'textGroup') || ($type == 'emailGroup') || ($type == 'passwordGroup'))
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['icon'], $field['attributes']) }}
@elseif ($type == 'textareaGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title']) }}
@elseif ($type == 'selectGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['icon'], $field['values'], $field['selected'], $field['attributes']) }}
@elseif ($type == 'radioGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], 1, $field['enable'], $field['disable'], $field['attributes']) }}
@elseif ($type == 'checkboxGroup')
{{ Form::$type('settings[' . $field['name'] . ']', $field['title'], $field['items'], $field['value'], $field['id'], $field['attributes']) }}
@endif
@endforeach

View File

@ -1,6 +1,6 @@
<div class="card-header">
{!! Form::open([
'url' => 'common/reports/' . $class->report->id,
'url' => 'common/reports/' . $class->model->id,
'role' => 'form',
'method' => 'GET',
]) !!}

View File

@ -1,4 +1,4 @@
@section('title', $class->report->name)
@section('title', $class->model->name)
@section('new_button')
<span>

View File

@ -1,9 +1,9 @@
@extends('layouts.print')
@section('title', $class->report->name)
@section('title', $class->model->name)
@section('content')
@if($class->report->chart)
@if($class->model->settings->chart)
@include($class->views['chart'])
@endif

View File

@ -6,7 +6,7 @@
<div class="card">
@include($class->views['filter'])
@if($class->report->chart)
@if(!empty($class->model->settings->chart))
@include($class->views['chart'])
@endif

View File

@ -1,7 +1,7 @@
<thead class="thead-light">
<tr>
@if ($table == 'default')
<th>{{ $class->groups[$class->report->group] }}</th>
@if (($table == 'default') && !empty($class->groups))
<th>{{ $class->groups[$class->model->settings->group] }}</th>
@else
<th>{{ $table }}</th>
@endif

View File

@ -37,7 +37,7 @@ Route::group(['prefix' => 'common'], function () {
Route::get('reports/{report}/print', 'Common\Reports@print')->name('reports.print');
Route::get('reports/{report}/export', 'Common\Reports@export')->name('reports.export');
Route::get('reports/groups', 'Common\Reports@groups')->name('reports.groups');
Route::get('reports/fields', 'Common\Reports@fields')->name('reports.fields');
Route::resource('reports', 'Common\Reports');
});