cols([
'wav.id',
'wav.title',
'a.name',
'wav.submission_date_days',
'wsr.name' => 'required_from_stage',
'wsa.name' => 'add_task_at_stage',
'wav.state'
])
->from('wiedervorlage_aufgabe_vorlage AS wav')
->leftJoin('wiedervorlage_stages AS wsr', 'wsr.id = wav.required_from_stage_id')
->leftJoin('wiedervorlage_stages AS wsa', 'wsa.id = wav.add_task_at_stage_id')
->leftJoin('adresse AS a', 'a.id = wav.employee_address_id');
}
/**
* @param ColumnCollection $columns
*
* @return void
*/
public function configureColumns(ColumnCollection $columns)
{
$menu = Column::fixed('menu', 'Menü', 'center', '1%');
$menu->setFormatter(static function ($value, $row) {
$html =
'
';
$html = str_replace('{ID}', $row['id'], $html);
return $html;
});
$requiredFromStage = Column::searchable('required_from_stage', 'Pflichtfeld ab');
$requiredFromStage->setFormatter(ColumnFormatter::ifEmpty('- Nie -'));
$columns->add(Column::searchable('title', 'Bezeichnung'));
$columns->add(Column::searchable('name', 'Bearbeiter'));
$columns->add(Column::searchable('submission_date_days', 'Intervall'));
$columns->add($requiredFromStage);
$columns->add(Column::searchable('add_task_at_stage', 'Hinzufügen ab'));
$state = Column::searchable('state', 'Status');
$state->setFormatter(function ($value, $row) {
if ($row['state'] == 'open') {
return 'Offen';
}elseif ($row['state'] == 'processing') {
return 'In Bearbeitung';
}elseif ($row['state'] == 'completed') {
return 'Abgeschlossen';
}
return (string)$row['state'];
});
$columns->add($state);
$columns->add($menu);
}
/**
* @param DataTableOptions $options
*
* @return void
*/
public function configureOptions(DataTableOptions $options)
{
$options->setDefaultSorting(['required_from_stage' => 'ASC', 'add_task_at_stage' => 'ASC']);
}
/**
* @param FeatureCollection $features
*
* @return void
*/
public function configureFeatures(FeatureCollection $features)
{
parent::configureFeatures($features);
/** @var TableControlFeature $control */
$control = $features->get(TableControlFeature::class);
$control->hideButtons();
}
}