{% set headers = _args.headers|default([
{
title: 'Name',
sort: constant('SORTS__NAME', search),
},
{
title: 'Contacts',
spacing: 10,
},
{
title: 'Type',
spacing: 10,
sort: constant('SORTS__TYPE', search),
},
{
title: 'Last Modified',
spacing: 15,
sort: constant('SORTS__TIMESTAMP', search),
},
]) %}
{% embed '@ui2022/table--search.html.twig' with {
form: form,
headers: headers,
pagination: pagination|default(null),
} %}
{% block items %}
{% if lists is empty %}
{% include '@ui2022/table__empty.html.twig' with {
title: 'No lists found',
message: 'No lists matching the criteria were found in the system.'
} %}
{% else %}
{% for list in lists %}
{% set isGranted = is_granted('app.notifications.lists.admin', list) %}
<tr>
{% include '@ui2022/table__item__cell--status.html.twig' with {
title: list.name,
link: isGranted ? path('app.notifications.dashboard.lists.view', {
list: list.id,
}) : null,
subtext: 'by %s'|format(
list.touchedBy ? list.touchedBy.displayName : 'SYSTEM'
),
actions: (isGranted and not list.fixed) ? [
{
text: 'Edit',
link: path('app.notifications.dashboard.lists.update', {
list: list.id,
}),
},
{
text: 'More',
dropdown: {
items: [
{
text: 'Delete',
link: path('app.notifications.dashboard.lists.delete', {
list: list.id,
}),
modal: 'modal__result_delete',
},
],
},
},
] : [],
} %}
<td>
{% if isGranted %}<a href="{{- path('app.notifications.dashboard.lists.view', {
list: list.id,
}) -}}">{% endif %}
{{- (list.count is not null) ? list.count|number_format : '—' -}}
{% if isGranted %}</a>{% endif %}
</td>
<td>
{% if list.discr == 'condition' %}
{{ list.typeNames|map(t => 'app.oneroster.enums.role_type.%s'|format(t)|trans)|join(', ') }}
{% else %}
{{- 'app.notifications.lists.types.%s'|format(list.discr)|trans -}}
{% endif %}
</td>
<td>
{{- list.timestampedAt|ui_relativeDate -}}
</td>
</tr>
{% endfor %}
{% endif %}
{% endblock %}
{% endembed %}