mirror of
https://github.com/kevinpapst/kimai2.git
synced 2024-12-22 12:18:29 +00:00
3a5d7a62de
- added "today" as selector in date-range dropdown - added feature to prevent auto-select of dropdowns with only one entry - added hint that no changes were detected in batch update - added negative invoice sums are possible (e.g. for credit notes) - fix project list is expanded after submission - fix invalid date parsing causes 500 - fix: prevent auto-select of activities in export and invoice form (in case only one global activity exists) - fix team assignments for customer and project were not saved (using API now) - fix form fieldset with legend styling (e.g. team project assignment) - fix required meta-field were forced to have a value in batch update - fix tomselect meta-field was not disabled in batch update - fix unset internal rate is shown as 0 - fix one minute rounding problem in duration-only mode with "now" being default time - fix column width and label for duration-only mode - tech debt: cleanup invoice template (remove invoice layout) - tech debt: reorder for simpler comparison with invoice form - possible BC for devs: remove unused methods from form trait - bump composer packages (includes new translations for auth screens)
100 lines
4.8 KiB
Twig
100 lines
4.8 KiB
Twig
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
|
|
{% import "macros/widgets.html.twig" as widgets %}
|
|
|
|
{% block main %}
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
{% include 'team/member-form.html.twig' %}
|
|
</div>
|
|
<div class="col-md-6">
|
|
{% if customerForm is defined and customerForm is not null %}
|
|
{% embed '@theme/embeds/card.html.twig' with {collapsible: true, collapsed: (team.customers|length == 0)} %}
|
|
{% from "macros/status.html.twig" import status_count %}
|
|
{% block box_title %}
|
|
{{ 'teams.customer_access'|trans({}, 'teams') }}
|
|
{{ status_count(team.customers|length) }}
|
|
{% endblock %}
|
|
{% block box_body %}
|
|
{{ form(customerForm) }}
|
|
{% endblock %}
|
|
{% endembed %}
|
|
{% endif %}
|
|
|
|
{% if projectForm is defined and projectForm is not null %}
|
|
{% embed '@theme/embeds/card.html.twig' with {collapsible: true, collapsed: (team.projects|length == 0)} %}
|
|
{% from "macros/status.html.twig" import status_count %}
|
|
{% block box_title %}
|
|
{{ 'teams.project_access'|trans({}, 'teams') }}
|
|
{{ status_count(team.projects|length) }}
|
|
{% endblock %}
|
|
{% block box_body %}
|
|
{{ form(projectForm) }}
|
|
{% endblock %}
|
|
{% endembed %}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block javascripts %}
|
|
{{ parent() }}
|
|
<script type="text/javascript">
|
|
document.addEventListener('kimai.initialized', (event) => {
|
|
/** @type {KimaiAPI} API */
|
|
const API = event.detail.kimai.getPlugin('api');
|
|
/** @type {KimaiAlert} ALERT */
|
|
const ALERT = event.detail.kimai.getPlugin('alert');
|
|
|
|
{% if customerForm is defined and customerForm is not null %}
|
|
document.getElementById('team_customer_form').addEventListener('change',
|
|
(event) => {
|
|
if (event.target.matches('input[type=checkbox]')) {
|
|
const checkbox = event.target;
|
|
const customerId = checkbox.value;
|
|
if (checkbox.checked) {
|
|
API.post(
|
|
'{{ path('post_team_customer', {'id': team.id, 'customerId': '000'}) }}'.replace(/000/, customerId),
|
|
{},
|
|
(json) => {ALERT.success('action.update.success');},
|
|
(error) => {ALERT.error('action.update.error', error);}, // TODO test me
|
|
);
|
|
} else {
|
|
API.delete(
|
|
'{{ path('delete_team_customer', {'id': team.id, 'customerId': '000'}) }}'.replace(/000/, customerId),
|
|
(json) => {ALERT.success('action.delete.success');},
|
|
(error) => {ALERT.error('action.delete.error', error);}, // TODO test me
|
|
);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
{% endif %}
|
|
|
|
{% if projectForm is defined and customerForm is not null %}
|
|
document.getElementById('team_project_form').addEventListener('change',
|
|
(event) => {
|
|
if (event.target.matches('input[type=checkbox]')) {
|
|
const checkbox = event.target;
|
|
const projectId = checkbox.value;
|
|
if (checkbox.checked) {
|
|
API.post(
|
|
'{{ path('post_team_project', {'id': team.id, 'projectId': '000'}) }}'.replace(/000/, projectId),
|
|
{},
|
|
(json) => {ALERT.success('action.update.success');},
|
|
(error) => {ALERT.error('action.update.error', error);}, // TODO test me
|
|
);
|
|
} else {
|
|
API.delete(
|
|
'{{ path('delete_team_project', {'id': team.id, 'projectId': '000'}) }}'.replace(/000/, projectId),
|
|
(json) => {ALERT.success('action.delete.success');},
|
|
(error) => {ALERT.error('action.delete.error', error);}, // TODO test me
|
|
);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
{% endif %}
|
|
});
|
|
</script>
|
|
{% endblock %}
|