0
0
mirror of https://github.com/kevinpapst/kimai2.git synced 2024-12-22 04:08:29 +00:00
kevinpapst_kimai2/templates/base.html.twig
2024-04-12 19:03:09 +02:00

202 lines
7.4 KiB
Twig

{% extends '@theme/layout/default-layout.html.twig' %}
{% block body_start %}
data-title="{{- get_title()|e('html_attr') -}}"
{%- endblock -%}
{% block after_body_start %}
{% embed '@theme/embeds/modal.html.twig' %}
{% block modal_id %}remote_form_modal{% endblock %}
{% block modal_title %}{% endblock %}
{% block modal_body %}{% endblock %}
{% block modal_footer %}{% endblock %}
{% block modal_effects %}{% endblock %}
{% endembed %}
{% embed '@theme/embeds/modal.html.twig' %}
{% block modal_id %}remote_modal{% endblock %}
{% block modal_title %}{% endblock %}
{% block modal_body %}{% endblock %}
{% block modal_effects %}{% endblock %}
{% block modal_footer %}
<button type="button" class="btn btn-cancel" data-bs-dismiss="modal">{{ 'action.close'|trans }}</button>
{% endblock %}
{% endembed %}
{% block page_search %}{% endblock %}
<div id="toast-container" class="toast-container position-fixed top-0 start-50 translate-middle-x p-3" style="z-index: 11"></div>
{% endblock %}
{% block page_content_class %}{{ parent() }} {% block page_class %}{% endblock %}{% endblock %}
{% block page_content_start %}
{% if app.session and app.session.started and app.session.flashbag.peekAll|length > 0 %}
{% set domain = 'flashmessages' %}
<script type="text/javascript">
document.addEventListener('kimai.initialized', function(options) {
const ALERT = options.detail.kimai.getPlugin('alert');
{% for type, messages in app.session.flashbag.all %}
{% for message in messages %}
{% if type == 'error' %}
ALERT.error('{{ message|trans({}, domain)|e('js') }}');
{% elseif type == 'warning' %}
ALERT.warning('{{ message|trans({}, domain)|e('js') }}');
{% elseif type == 'success' %}
ALERT.success('{{ message|trans({}, domain)|e('js') }}');
{% else %}
ALERT.info('{{ message|trans({}, domain)|e('js') }}');
{% endif %}
{% endfor %}
{% endfor %}
});
</script>
{% endif %}
{% endblock %}
{% block page_content_before %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::CONTENT_BEFORE')) %}
{{ event.content|raw }}
<div class="d-print-none hidden-no-space">
{% block main_before %}{% endblock %}
</div>
{% endblock %}
{% block page_content_after %}
{% block main_after %}{% endblock %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::CONTENT_AFTER')) %}
{{ event.content|raw }}
{% if page_setup is defined and page_setup.help is not null %}
<div class="float-help">
<a href="{% if '://' in page_setup.help %}{{ page_setup.help }}{% else %}{{ page_setup.help|docu_link }}{% endif %}" target="_blank" accesskey="h" title="{{ 'help'|trans }}">
<i class="fas fa-question"></i>
</a>
</div>
<div class="mb-4"></div>
{% endif %}
{% endblock %}
{% block page_content %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::CONTENT_START')) %}
{{ event.content|raw }}
{% block main %}{% endblock %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::CONTENT_END')) %}
{{ event.content|raw }}
{% endblock %}
{% block title %}
{{- get_title() -}}
{% endblock %}
{% block footer %}
{% if 'dashboard' in app.request.attributes.get('_route') %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block navbar_start %}
{% if app.user is not null and is_granted('IS_AUTHENTICATED_REMEMBERED') %}
{% block navbar_extensions %}{% endblock %}
{% if is_granted('create_own_timesheet') %}
{% include 'partials/ticktack.html.twig' %}
{% endif %}
{% if is_granted('view_own_timesheet') %}
{% include 'partials/recent-activities.html.twig' %}
{% endif %}
{% include 'partials/user-shortcuts.html.twig' %}
{% block navbar_extensions_after %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::TOOLBAR')) %}
{{ event.content|raw }}
{% endblock %}
{% endif %}
{% endblock %}
{# deactivated blocks from the original theme #}
{% block page_pretitle %}{% endblock %}
{% block stylesheets %}
{% if tabler_bundle.isRightToLeft() %}
{{ encore_entry_link_tags('app-rtl') }}
{% else %}
{{ encore_entry_link_tags('app') }}
{% endif %}
{% set event = trigger(constant('App\\Event\\ThemeEvent::STYLESHEET')) %}
{{ event.content|raw }}
{% endblock %}
{% block head %}
{% include 'partials/head.html.twig' %}
{{ encore_entry_script_tags('app') }}
{% set event = trigger(constant('App\\Event\\ThemeEvent::HTML_HEAD')) %}
{{ event.content|raw }}
{% endblock %}
{% block javascripts %}
{# no call to parent(), as we use a custom built for the frontend assets and don't want the default <script> #}
{% import "macros/webloader.html.twig" as webloader %}
{{ webloader.init_frontend_loader() }}
{% set event = trigger(constant('App\\Event\\ThemeEvent::JAVASCRIPT')) %}
{{ event.content|raw }}
{% endblock %}
{% block navbar_brand_class %} d-none d-lg-inline-flex{% endblock %}
{% block app_logo %}
{% set mylogo %}{{ parent() }}{% endset %}
{# only for mobile view #}
<div class="d-flex justify-content-start flex-fill d-lg-none">
<h2 class="page-title d-lg-none ps-2 text-white">
{{- block('page_title') -}}
</h2>
{{ mylogo }}
</div>
{{ mylogo }}
{% endblock %}
{% block navbar_search %}
{# normal desktop view #}
<h2 class="page-title me-2">
{{- block('page_title') -}}
</h2>
{%- if block('status') is defined -%}<div class="btn-list">{{ block('status') }}</div>{%- endif -%}
{%- if block('subtitle') is defined -%}{{ block('subtitle') }}{%- endif -%}
{%- if block('breadcrumb') is defined and block('table_actions') is defined -%}{{ block('breadcrumb') }}{%- endif -%}
{% endblock %}
{% block page_intro %}
{% if block('table_actions') is defined %}
{{ block('table_actions') }}
{% elseif block('breadcrumb') is defined %}
<div class="text-body-secondary mt-1">
{{ block('breadcrumb') }}
</div>
{% endif %}
{% endblock %}
{% block page_title %}
{%- if page_setup is defined -%}
{{ page_setup.title|trans({}, page_setup.translationDomain) }}
{%- else -%}
{{ get_title() }}
{%- endif -%}
{% endblock %}
{% block page_actions %}
{% from "macros/widgets.html.twig" import page_actions, table_actions %}
{%- if page_setup is defined and page_setup.actionName is not null -%}
{% set event = actions(app.user, page_setup.actionName, page_setup.actionView, page_setup.actionPayload) %}
{% if page_setup.tableAction() %}
{{ table_actions(event.actions) }}
{% else %}
{{ page_actions(event.actions) }}
{% endif %}
{%- endif -%}
{% endblock %}
{% block page_header %}
{%- if page_setup is defined -%}
{%- if page_setup.actionName is not null or page_setup.hasSearchForm() -%}
{{ parent() }}
{%- endif -%}
{%- else -%}
{{ parent() }}
{%- endif -%}
{% endblock %}