0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-01-25 17:38:31 +00:00
kevinpapst_kimai2/templates/plugin/index.html.twig
2023-09-23 18:15:22 +02:00

81 lines
4.4 KiB
Twig

{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% block main %}
{% if plugins|length == 0 %}
{{ widgets.callout('warning', 'plugin.none_installed'|trans({}, 'plugins')) }}
{% else %}
{% embed '@theme/embeds/card.html.twig' %}
{% block box_title %}{{ 'plugin.installed'|trans }}{% endblock %}
{% block box_body_class %}p-0{% endblock %}
{% block box_body %}
{% set columns = {
'name': {'class': 'alwaysVisible w-25'},
'description': {'class': 'd-none d-md-table-cell'},
'version': {'class': 'text-center w-min'},
} %}
{% set tableName = 'plugins' %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/widgets.html.twig" as widgets %}
{{ tables.datatable_header(tableName, columns, null, {columnConfig: false}) }}
{% for plugin in plugins|sort((p1, p2) => p1.name|lower <=> p2.name|lower) %}
<tr>
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">
<a href="{{ plugin.metadata.homepage }}" title="{{ 'homepage'|trans }}" target="_blank">{{ plugin.name }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">
{{ plugin.metadata.description }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'version') }}">
{{ widgets.label(plugin.metadata.version, 'primary', plugin.id) }}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(plugins) }}
{% endblock %}
{% endembed %}
{% endif %}
{% if extensions|length > 0 %}
{% embed '@theme/embeds/card.html.twig' %}
{% from "macros/widgets.html.twig" import card_tool_button %}
{% block box_title %}{{ 'plugin.marketplace'|trans({}, 'plugins') }}{% endblock %}
{% block box_body_class %}p-0{% endblock %}
{% block box_tools %}
{{ card_tool_button('shop', {'title': 'shop', 'translation_domain': 'plugins', 'target': '_blank', 'url': constant('App\\Constants::HOMEPAGE') ~ '/store/', 'icon': false, 'class': 'btn-warning'}) }}
{% endblock %}
{% block box_body %}
{% set columns = {
'name': {'class': 'alwaysVisible w-25'},
'description': {'class': 'd-none d-md-table-cell'},
'shop': {'class': 'w-min alwaysVisible'},
} %}
{% set tableName = 'extensions' %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/widgets.html.twig" as widgets %}
{{ tables.datatable_header(tableName, columns, null, {columnConfig: false}) }}
{% for extension in extensions|filter(e => e.bundle is not null and e.bundle not in installed) %}
<tr>
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">
<a href="{{ extension.url }}" title="{{ 'homepage'|trans }}" target="_blank">{{ extension.name }}</a>
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">{{ extension.description }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'shop') }}">
{% if extension.buy is defined and extension.buy is not empty and (extension.minimum_version is not defined or (extension.minimum_version is not empty and constant('App\\Constants::VERSION') >= extension.minimum_version)) %}
<a class="btn btn-icon btn-outline-secondary" href="{{ extension.buy }}" title="{{ 'buy'|trans({}, 'plugins') }}" target="_blank">{{ icon('shop') }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(plugins) }}
{% endblock %}
{% endembed %}
{% endif %}
{% endblock %}