cols([
'wfk.id',
'wfk.title',
'wsa.name' => 'available_from_stage',
'wsr.name' => 'required_from_stage',
'wfk.show_in_pipeline',
'wfk.show_in_tables',
])
->from('wiedervorlage_freifeld_konfiguration AS wfk')
->leftJoin('wiedervorlage_stages AS wsa', 'wsa.id = wfk.available_from_stage_id')
->leftJoin('wiedervorlage_stages AS wsr', 'wsr.id = wfk.required_from_stage_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;
});
$availableFromStage = Column::searchable('available_from_stage', 'Verfügbar ab Stage');
$availableFromStage->setFormatter(ColumnFormatter::ifEmpty('- Immer -'));
$requiredFromStage = Column::searchable('required_from_stage', 'Pflichtfeld ab Stage');
$requiredFromStage->setFormatter(ColumnFormatter::ifEmpty('- Nie -'));
$showInPipeline = Column::sortable('show_in_pipeline', 'Anzeigen in Pipeline');
$showInPipeline->setFormatter(static function ($value) {
return (int)$value === 1 ? 'Ja' : 'Nein';
});
$showInTables = Column::sortable('show_in_tables', 'Anzeigen in Tabellen');
$showInTables->setFormatter(static function ($value) {
return (int)$value === 1 ? 'Ja' : 'Nein';
});
$columns->add(Column::searchable('title', 'Bezeichnung'));
$columns->add($availableFromStage);
$columns->add($requiredFromStage);
$columns->add($showInPipeline);
$columns->add($showInTables);
$columns->add($menu);
}
/**
* @param DataTableOptions $options
*
* @return void
*/
public function configureOptions(DataTableOptions $options)
{
$options->setDefaultSorting(['available_from_stage' => 'ASC', 'required_from_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();
}
}