Files
kimai2/templates/macros/webloader.html.twig
Kevin Papst c0168ecc5b 1.18 (#3158)
* bump version
* fix translation ids
* added css classes to modify form with custom css
* improve export pdf file names
* respect financial year in new report
* added new InvoiceCalculator: price
* upgrade packages and node-sass to v7
* title pattern for customer, project and activity via API
* support negative money without currency
* fix sub-locale in print export template
* fix overbooking validation for monthly budget
* fix copying entities with different set of custom-fields compared to the current configuration
2022-02-25 20:41:56 +01:00

32 lines
1.4 KiB
Twig

{% macro init_frontend_loader() %}
{% set configurations = javascript_configurations(app.user)|merge({
login: path('fos_user_security_login'),
locale: app.request.locale,
first_dow_iso: iso_day_by_name(app.user.firstDayOfWeek),
autoComplete: kimai_config.themeAutocompleteCharacters,
}) %}
<script type="text/javascript">
window.addEventListener('load', function() {
const loader = new KimaiWebLoader({
{%- for name, value in configurations -%}
{%- if value is same as (true) -%}
{{ name }}:true
{%- elseif value is same as (false) -%}
{{ name }}:false
{%- elseif value is number -%}
{{ name }}:{{ value }}
{%- else -%}
{{ name }}:'{{ value }}'
{%- endif -%}
{%- if not loop.last %},{% endif -%}
{%- endfor -%}
},{
{%- for key, translation in javascript_translations() -%}
'{{ key }}': '{{ translation.0|trans({}, translation.1)|escape('js') }}'{% if not loop.last %},{% endif %}
{%- endfor -%}
});
window.kimai = loader.getKimai();
});
</script>
{% endmacro %}