0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-01-10 19:47:35 +00:00
kevinpapst_kimai2/templates/timesheet/multi-update.html.twig
Kevin Papst 38e37f1c2e
Release 2.1.0 (#4321)
* fix deprecations
* remove unused config
* replace invalid annotation type with attribute
* use AsDoctrineListener to fix deprecation
* new ModifiedSubscriber to support custom logic and fix deprecation
* removed inheritdoc comment
* new ModifiedSubscriber to support custom logic and fix deprecation
* cleanup event dispatcher interface
* re-order annotation params
* one more doctrine based deprecation
* fix query to count active timesheets
* link to "all times" to identify active timesheets
* link icon instead of text
* fix "skin" translation in wizard
* use duration filter to show duration
* added login link command and controller
* bump tabler theme to 1.0
* added wizard to force password reset by user
* allow to configure that new accounts need to reset their password
* prevent uploading twig templates by default
* bump composer packages
* enable sandbox and basic security measures for custom twig templates for invoice and export
* bump to symfony 6.3.5
* allow to export single user reports to excel
* removed broken method to reload twig cache
* added api parameter to fetch user collection fully serialized
* allow to replace or append description via timesheet batch update
* show api username above form
2023-10-19 11:21:50 +02:00

143 lines
6.3 KiB
Twig

{% extends 'base.html.twig' %}
{% block main %}
{% set formEditTemplate = 'default/_form.html.twig' %}
{% set formOptions = {
'title': 'update_multiple'|trans({'%action%': 'action.edit'|trans, '%count%': dto.entities|length}),
'form': form,
'back': path(back),
} %}
{% embed formEditTemplate with formOptions %}
{% block form_body %}
<fieldset class="form-fieldset pb-0">
<div class="row">
<div class="col-md-4">
{{ form_row(form.customer) }}
</div>
<div class="col-md-4">
{{ form_row(form.project) }}
</div>
<div class="col-md-4">
{{ form_row(form.activity) }}
</div>
</div>
</fieldset>
<fieldset class="form-fieldset pb-0 h-100">
{{ form_row(form.replaceDescription) }}
{{ form_row(form.description) }}
</fieldset>
<fieldset class="form-fieldset pb-0 h-100">
{{ form_row(form.replaceTags) }}
{{ form_row(form.tags) }}
</fieldset>
{% if form.user is defined %}
<fieldset class="form-fieldset pb-0">
{{ form_row(form.user) }}
</fieldset>
{% endif %}
{% if form.exported is defined %}
<fieldset class="form-fieldset pb-0">
{{ form_row(form.exported) }}
</fieldset>
{% endif %}
{% if form.billable is defined %}
<fieldset class="form-fieldset pb-0">
{{ form_row(form.billable) }}
</fieldset>
{% endif %}
{% if form.recalculateRates is defined %}
<fieldset class="form-fieldset pb-0">
{{ form_row(form.recalculateRates) }}
<div class="row">
<div class="col-md-6">
{{ form_row(form.fixedRate) }}
</div>
<div class="col-md-6">
{{ form_row(form.hourlyRate) }}
</div>
</div>
</fieldset>
{% endif %}
{% if form.metaFields is defined %}
<fieldset class="form-fieldset pb-0">
<div class="row">
<div class="col-md-6">
{{ form_row(form.updateMeta) }}
</div>
<div class="col-md-6">
{{ form_row(form.metaFields) }}
</div>
</div>
</fieldset>
{% endif %}
{{ form_rest(form) }}
{% endblock %}
{% endembed %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
window.addEventListener('load', function() {
{% if form.recalculateRates is defined %}
document.getElementById('{{ form.recalculateRates.vars.id }}').onchange = function() {
if (this.checked) {
document.getElementById('{{ form.fixedRate.vars.id }}').setAttribute('disabled', 'disabled');
document.getElementById('{{ form.hourlyRate.vars.id }}').setAttribute('disabled', 'disabled');
} else {
document.getElementById('{{ form.fixedRate.vars.id }}').removeAttribute('disabled');
document.getElementById('{{ form.hourlyRate.vars.id }}').removeAttribute('disabled');
}
};
{% endif %}
{% if form.metaFields is defined %}
let allElements = document.getElementsByName('{{ form.vars.name }}')[0].elements;
for (let i = 0; i < allElements.length; ++i) {
let el = allElements[i];
let elAttr = el.getAttribute('name');
if (elAttr === null) {
continue;
}
if (elAttr.indexOf('{{ form.metaFields.vars.full_name }}') !== -1) {
{# disable all custom fields, each one has to be activated before it can be used #}
el.setAttribute('disabled', 'disabled');
if (el.tomselect !== undefined) {
el.tomselect.disable();
}
} else if (elAttr.indexOf('{{ form.updateMeta.vars.full_name }}') !== -1) {
el.checked = false;
el.onclick = function() {
let searchElements = document.getElementsByName('{{ form.vars.name }}')[0].elements;
let metaCheckbox = this;
let metaName = metaCheckbox.value;
for (let s = 0; s < searchElements.length; ++s) {
let current = searchElements[s];
let currentAttr = current.getAttribute('name');
if (currentAttr === null) {
continue;
}
if (currentAttr.indexOf('{{ form.metaFields.vars.full_name }}') === -1) {
continue;
}
if (current.dataset.name === undefined || current.dataset.name !== metaName) {
continue;
}
if (metaCheckbox.checked) {
current.removeAttribute('disabled');
if (current.tomselect !== undefined) {
current.tomselect.enable();
}
} else {
current.setAttribute('disabled', 'disabled');
if (current.tomselect !== undefined) {
current.tomselect.disable();
}
}
}
};
}
}
{% endif %}
});
</script>
{% endblock %}