mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 05:24:28 +02:00
Show icon before part name in Parts table to mark if a part has favorite or needs review status
This commit is contained in:
parent
bd12185b44
commit
56c6157013
1 changed files with 14 additions and 2 deletions
|
@ -150,10 +150,22 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
->add('name', TextColumn::class, [
|
->add('name', TextColumn::class, [
|
||||||
'label' => $this->translator->trans('part.table.name'),
|
'label' => $this->translator->trans('part.table.name'),
|
||||||
'render' => function ($value, Part $context) {
|
'render' => function ($value, Part $context) {
|
||||||
|
$icon = '';
|
||||||
|
|
||||||
|
//Depending on the part status we show a different icon (the later conditions have higher priority)
|
||||||
|
if ($context->isFavorite()) {
|
||||||
|
$icon = sprintf('<i class="fa-solid fa-star fa-fw me-1" title="%s"></i>', $this->translator->trans('part.favorite.badge'));
|
||||||
|
}
|
||||||
|
if ($context->isNeedsReview()) {
|
||||||
|
$icon = sprintf('<i class="fa-solid fa-ambulance fa-fw me-1" title="%s"></i>', $this->translator->trans('part.needs_review.badge'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s%s</a>',
|
||||||
$this->urlGenerator->infoURL($context),
|
$this->urlGenerator->infoURL($context),
|
||||||
$context->getName()
|
$icon,
|
||||||
|
htmlentities($context->getName())
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue