highlight invisible items (#2493)

This commit is contained in:
Kevin Papst
2021-04-07 19:14:33 +02:00
committed by GitHub
parent 68bb01d064
commit cdad5913ca
27 changed files with 218 additions and 155 deletions

View File

@@ -34,7 +34,7 @@
{% endif %}
<table class="table table-hover dataTable">
{% if not activity.visible %}
<tr>
<tr class="{{ widgets.class_activity_row(activity, now) }}">
<th>{{ 'label.visible'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(activity.visible) }}
@@ -42,7 +42,7 @@
</tr>
{% endif %}
{% if not activity.global %}
<tr>
<tr class="{{ widgets.class_customer_row(activity.project.customer, now) }}">
<th>{{ 'label.customer'|trans }}</th>
<td>
{{ widgets.label_customer(activity.project.customer) }}
@@ -54,7 +54,7 @@
{{ customerActions.customer(activity.project.customer, 'custom') }}
</td>
</tr>
<tr>
<tr class="{{ widgets.class_project_row(activity.project, now) }}">
<th>{{ 'label.project'|trans }}</th>
<td>
{{ widgets.label_project(activity.project) }}

View File

@@ -40,7 +40,13 @@
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.activityUpdate kimai.activityTeamUpdate'}) }}
{% for entry in entries %}
<tr{% if is_granted('view', entry) %} class="alternative-link open-edit" data-href="{{ path('activity_details', {'id': entry.id}) }}"{% endif %}>
{% set class = widgets.class_activity_row(entry, now) %}
{% set dataHref = '' %}
{% if is_granted('view', entry) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('activity_details', {'id': entry.id}) %}
{% endif %}
<tr class="{{ class }}" data-href="{{ dataHref }}">
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">{{ widgets.label_color_dot('activity', true, entry.name, null, entry.color) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
{# only none-global activities have a project and customer assigned #}

View File

@@ -29,7 +29,7 @@
{% endif %}
<table class="table table-hover dataTable">
{% if not customer.visible %}
<tr>
<tr class="{{ widgets.class_customer_row(customer, now) }}">
<th>{{ 'label.visible'|trans }}</th>
<td>{{ widgets.label_boolean(customer.visible) }}</td>
</tr>
@@ -85,7 +85,7 @@
{% if customer.timezone is not empty %}
<tr>
<th>{{ 'label.timezone'|trans }}</th>
<td>{{ now|date_full }} ({{ customer.timezone }})</td>
<td>{{ customer_now|date_full }} ({{ customer.timezone }})</td>
</tr>
{% endif %}
{% if customer.currency is not empty %}

View File

@@ -6,10 +6,10 @@
id="project_list_box" data-href="{{ path('customer_projects', {'id': customer.id}) }}" data-reload="kimai.projectUpdate"
{% endblock %}
{% block box_tools %}
{% if is_granted('view_reporting') and is_granted('budget_project') %}
<a class="btn btn-default btn-sm btn-pager" href="{{ path('report_project_view', {'customer': customer.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'report_project_view'|trans({}, 'reporting') }}"><i class="{{ 'reporting'|icon }}"></i></a>
{% endif %}
{% if customer.visible and is_granted('create_project') %}
{% if is_granted('view_reporting') and is_granted('budget_project') %}
<a class="btn btn-default btn-sm btn-pager" href="{{ path('report_project_view', {'customer': customer.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'report_project_view'|trans({}, 'reporting') }}"><i class="{{ 'reporting'|icon }}"></i></a>
{% endif %}
<a class="modal-ajax-form open-edit btn btn-default btn-sm btn-pager" data-href="{{ path('admin_project_create_with_customer', {'customer': customer.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'create'|trans }}"><i class="{{ 'create'|icon }}"></i></a>
{% endif %}
{% if projects|length > 0 %}
@@ -27,15 +27,19 @@
<tr>
<th>{{ 'label.name'|trans }}</th>
<th class="hidden-xs">{{ 'label.comment'|trans }}</th>
<th class="w-min text-center">{{ 'label.project_end'|trans }}</th>
<th class="w-min text-center">{{ 'label.visible'|trans }}</th>
<th class="w-min text-center">{{ 'label.team'|trans }}</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr>
<tr class="{{ widgets.class_project_row(project, now) }}">
<td>{{ widgets.label_project(project) }}</td>
<td class="hidden-xs">{{ project.comment|comment2html }}</td>
<td class="w-min text-center">{% if project.end is not null %}{{ project.end|date_short }}{% endif %}</td>
<td class="w-min text-center">{{ widgets.label_visible(project.visible) }}</td>
<td class="w-min text-center">{{ widgets.badge_team_access(project.teams) }}</td>
<td class="actions">{{ actions.project(project, 'custom') }}</td>
</tr>

View File

@@ -51,7 +51,13 @@
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.customerUpdate kimai.customerTeamUpdate'}) }}
{% for entry in entries %}
<tr{% if is_granted('view', entry) %} class="alternative-link open-edit" data-href="{{ path('customer_details', {'id': entry.id}) }}"{% endif %}>
{% set class = widgets.class_customer_row(entry, now) %}
{% set dataHref = '' %}
{% if is_granted('view', entry) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('customer_details', {'id': entry.id}) %}
{% endif %}
<tr class="{{ class }}" data-href="{{ dataHref }}">
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">{{ widgets.label_color_dot('customer', true, entry.name, null, entry.color) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'number') }}">{{ entry.number }}</td>

View File

@@ -90,7 +90,7 @@
</a>
{% endblock %}
{% block box_body %}
<table class="table table-striped table-hover dataTable">
<table class="table table-hover dataTable">
<thead>
<tr>
<th>{{ 'label.customer'|trans }}</th>

View File

@@ -46,7 +46,7 @@
{% set orderBy = false %}
{% set order = false %}
{% endif %}
{% set striped = options.striped ?? true %}
{% set striped = options.striped ?? false %}
{% set bordered = options.bordered ?? false %}
{% set reloadEvent = options.reload|default('') %}
{% set translationDomain = options.translationDomain|default('messages') %}
@@ -145,40 +145,6 @@
{% endapply %}
{% endmacro %}
{% macro data_table_header_options(name, columns, options) %}
{% deprecated 'The macro "data_table_header_options()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %}
{% set skipStripped = options.skipStripped|default(false) %}
{% set reloadEvent = options.reloadEvent|default('') %}
{% set translationDomain = options.translationDomain|default('messages') %}
{# |default does not work here, as the prefix might be an empty string #}
{% set translationPrefix = 'label.' %}
{% if options.translationPrefix is defined %}
{% set translationPrefix = options.translationPrefix %}
{% endif %}
{% import _self as macro %}
<div class="box box-{{ admin_lte_context.widget.type }} data_table" id="datatable_{{ name }}">
<div class="box-body no-padding">
<div class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table class="table {% if not skipStripped %}table-striped {% endif %}table-hover dataTable" role="grid" data-reload-event="{{ reloadEvent }}">
<thead>
<tr>
{%- for title, class in columns -%}
<th data-field="{{ title }}" class="{{ macro.data_table_column_class(name, columns, title) }}">{% if title is not empty and title != 'actions' %}{{ (translationPrefix ~ title)|trans({}, translationDomain) }}{% endif %}</th>
{%- endfor -%}
</tr>
</thead>
<tbody>
{% endmacro %}
{% macro data_table_header(name, columns, skipStripped, reloadEvent) %}
{% deprecated 'The macro "data_table_header()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %}
{% import _self as macro %}
{{ macro.data_table_header_options(name, columns, {'skipStripped': skipStripped, 'reloadEvent': reloadEvent}) }}
{% endmacro %}
{% macro data_table_footer(entries, route, multi_update_form) %}
</tbody>
</table>
@@ -199,7 +165,7 @@
{% endif %}
{% if route is not empty and entries is not null%}
<div class="navigation text-center no-print">
{{ pagination(entries, { routeName: route }) }}
{{ pagination(entries, { routeName: route, 'css_container_class': 'pagination' }) }}
</div>
{% endif %}
{% endmacro %}
@@ -220,3 +186,35 @@
{% macro datatable_multiupdate_row(id) %}
<input type="checkbox" name="id" value="{{ id }}" class="multi_update_single multiupdater">
{% endmacro %}
{% macro data_table_header(name, columns, skipStripped, reloadEvent) %}
{% deprecated 'The macro "data_table_header()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %}
{{ _self.data_table_header_options(name, columns, {'skipStripped': skipStripped, 'reloadEvent': reloadEvent}) }}
{% endmacro %}
{% macro data_table_header_options(name, columns, options) %}
{% deprecated 'The macro "data_table_header_options()" is deprecated since 1.3 and will be removed with 2.0, use "datatable_header()" instead' %}
{% set skipStripped = options.skipStripped|default(true) %}
{% set reloadEvent = options.reloadEvent|default('') %}
{% set translationDomain = options.translationDomain|default('messages') %}
{# |default does not work here, as the prefix might be an empty string #}
{% set translationPrefix = 'label.' %}
{% if options.translationPrefix is defined %}
{% set translationPrefix = options.translationPrefix %}
{% endif %}
<div class="box box-{{ admin_lte_context.widget.type }} data_table" id="datatable_{{ name }}">
<div class="box-body no-padding">
<div class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table class="table {% if not skipStripped %}table-striped {% endif %}table-hover dataTable" role="grid" data-reload-event="{{ reloadEvent }}">
<thead>
<tr>
{%- for title, class in columns -%}
<th data-field="{{ title }}" class="{{ _self.data_table_column_class(name, columns, title) }}">{% if title is not empty and title != 'actions' %}{{ (translationPrefix ~ title)|trans({}, translationDomain) }}{% endif %}</th>
{%- endfor -%}
</tr>
</thead>
<tbody>
{% endmacro %}

View File

@@ -503,3 +503,18 @@
</script>
{% endif %}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_customer_row(customer, now) }}"> #}
{% macro class_customer_row(customer, now) %}
{%- if not customer.visible %}warning{% endif -%}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_project_row(project, now) }}"> #}
{% macro class_project_row(project, now) %}
{%- if not project.visible or (project.end is not null and project.end < now) %}warning{% endif -%}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_activity_row(activity, now) }}"> #}
{% macro class_activity_row(activity, now) %}
{%- if not activity.visible %}warning{% endif -%}
{% endmacro %}

View File

@@ -29,14 +29,14 @@
{% endif %}
<table class="table table-hover dataTable">
{% if not project.visible %}
<tr>
<tr class="{{ widgets.class_project_row(project, now) }}">
<th>{{ 'label.visible'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(project.visible) }}
</td>
</tr>
{% endif %}
<tr>
<tr class="{{ widgets.class_customer_row(project.customer, now) }}">
<th>{{ 'label.customer'|trans }}</th>
<td>
{{ widgets.label_customer(project.customer) }}

View File

@@ -24,15 +24,17 @@
<tr>
<th>{{ 'label.name'|trans }}</th>
<th class="hidden-xs">{{ 'label.comment'|trans }}</th>
<th class="w-min text-center">{{ 'label.visible'|trans }}</th>
<th class="w-min text-center">{{ 'label.team'|trans }}</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
{% for activity in activities %}
<tr>
<tr class="{{ widgets.class_activity_row(activity, now) }}">
<td>{{ widgets.label_activity(activity) }}</td>
<td class="hidden-xs">{{ activity.comment|comment2html }}</td>
<td class="w-min text-center">{{ widgets.label_visible(activity.visible) }}</td>
<td class="w-min text-center">{{ widgets.badge_team_access(activity.teams) }}</td>
<td class="actions">{{ actions.activity(activity, 'custom') }}</td>
</tr>

View File

@@ -44,7 +44,13 @@
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.projectUpdate kimai.projectTeamUpdate'}) }}
{% for entry in entries %}
<tr{% if is_granted('view', entry) %} class="alternative-link open-edit" data-href="{{ path('project_details', {'id': entry.id}) }}"{% endif %}>
{% set class = widgets.class_project_row(entry, now) %}
{% set dataHref = '' %}
{% if is_granted('view', entry) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('project_details', {'id': entry.id}) %}
{% endif %}
<tr class="{{ class }}" data-href="{{ dataHref }}">
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">{{ widgets.label_color_dot('project', true, entry.name, null, entry.color) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.customer) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>

View File

@@ -49,7 +49,7 @@
{% if not hasData %}
{{ widgets.nothing_found() }}
{% else %}
{{ tables.datatable_header(tableName, columns, null, {'bordered': true, 'striped': false, 'boxClass': ''}) }}
{{ tables.datatable_header(tableName, columns, null, {'bordered': true, 'boxClass': ''}) }}
{% for id, mapping in entries|sort((a, b) => a.customer.name <=> b.customer.name) %}
<tr class="summary">

View File

@@ -59,7 +59,7 @@
{% if entries.count == 0 %}
{{ widgets.nothing_found('kimai.timesheetUpdate') }}
{% else %}
{{ tables.datatable_header(tableName, columns, query, {'striped': not showSummary, 'reload': 'kimai.timesheetUpdate'}) }}
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.timesheetUpdate'}) }}
{% set checkOverlappingDesc = false %}
{% set checkOverlappingAsc = false %}