cols([ 'a.id', 'a.aufgabe' => 'title', 'adr.name' => 'employee_name', 'adr.mitarbeiternummer' => 'employee_number', 'a.abgabe_bis' => 'completion_date', 'a.startdatum' => 'start_date', 'a.startzeit' => 'start_time', 'a.prio' => 'priority', 'a.status' => 'state', ]) ->from('aufgabe AS a') ->innerJoin('wiedervorlage_aufgabe AS wa', 'wa.task_id = a.id') ->leftJoin('adresse AS adr', 'a.adresse = adr.id'); } /** * @param ColumnCollection $columns * * @return void */ public function configureColumns(ColumnCollection $columns) { $priority = Column::searchable('priority', 'Priorität', Column::ALIGN_CENTER); $priority->setFormatter(static function ($value) { $prio = (int)$value; if ($prio === 1) { return 'hoch'; } if ($prio === -1) { return 'niedrig'; } return 'mittel'; }); $employee = Column::searchable('employee', 'Mitarbeiter'); $employee->setFormatter(function ($value, $row) { if (!empty($row['employee_number'])) { return sprintf('%s %s', $row['employee_number'], $row['employee_name']); } return (string)$row['employee_name']; }); $menu = Column::fixed('menu', 'Menü', 'center', '1%'); $menu->setFormatter(function ($value, $row) { $stateText = $row['state'] === 'abgeschlossen' ? 'completed' : 'open'; $stateIcon = $row['state'] === 'abgeschlossen' ? 'check_circle_filled.svg' : 'check_circle_outlined.svg'; $html = '
' . '' . ' | ' . '' . '' . ' | ' . '' . '' . ' | ' . '