Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -1,21 +0,0 @@
{% macro timesheets(view, query) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set event = actions(app.user, 'timesheets', view, {'query': query}) %}
{{ widgets.page_actions(event.actions) }}
{% endmacro %}
{% macro timesheet(timesheet, view, options) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set event = actions(app.user, 'timesheet', view, {'timesheet': timesheet}) %}
{% if view == 'index' or view == 'custom' %}
{{ widgets.table_actions(event.actions) }}
{% else %}
{{ widgets.page_actions(event.actions) }}
{% endif %}
{% endmacro %}
{% macro timesheets_multi_update(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set event = actions(app.user, 'timesheets_multi_update', view) %}
{{ widgets.page_actions(event.actions) }}
{% endmacro %}

View File

@@ -0,0 +1,95 @@
{% block timesheet_form %}
{% form_theme form 'form/horizontal.html.twig' %}
{% embed formOptions.template with formOptions %}
{% block form_body %}
{% if form.begin_date is defined %}
<div class="mb-3 row">
<label class="col-form-label col-sm-2 required" for="{{ form.vars.name }}_begin_date">{{ 'begin'|trans }}</label>
<div class="col-sm-5">
{{ form_widget(form.begin_date, {'label': false}) }}
{{ form_errors(form.begin_date, {'label': false}) }}
</div>
<div class="col-sm-5">
{{ form_widget(form.begin_time, {'label': false}) }}
{{ form_errors(form.begin_time, {'label': false}) }}
</div>
</div>
{% endif %}
{% if form.end_time is defined or form.duration is defined %}
<div class="mb-3 row">
<label class="col-form-label col-sm-2" for="{{ form.vars.name }}_duration">{{ 'duration'|trans }} / {{ 'endtime'|trans }}</label>
{% set size = form.duration is defined ? 5 : 10 %}
{% if form.duration is defined %}
<div class="col-sm-{{ size }}">
{{ form_widget(form.duration, {'label': false}) }}
{{ form_errors(form.duration, {'label': false}) }}
</div>
{% endif %}
{% if form.end_time is defined %}
<div class="col-sm-{{ size }}">
{{ form_widget(form.end_time, {'label': false}) }}
{{ form_errors(form.end_time, {'label': false}) }}
</div>
{% endif %}
</div>
{% else %}
{% if form.duration is defined %}
{{ form_row(form.duration, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.duration.vars.name}}) }}
{% endif %}
{% endif %}
{% if form.customer is defined %}
{{ form_row(form.customer, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.customer.vars.name}}) }}
{% endif %}
{% if form.project is defined %}
{{ form_row(form.project, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.project.vars.name}}) }}
{% endif %}
{% if form.activity is defined %}
{{ form_row(form.activity, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.activity.vars.name}}) }}
{% endif %}
{% if form.description is defined %}
{{ form_row(form.description, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.description.vars.name}}) }}
{% endif %}
{% if form.tags is defined %}
{{ form_row(form.tags, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.tags.vars.name}}) }}
{% endif %}
{% if form.user is defined %}
{{ form_row(form.user, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.user.vars.name}}) }}
{% endif %}
{% if form.users is defined %}
{{ form_row(form.users, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.users.vars.name}}) }}
{% endif %}
{% if form.teams is defined %}
{{ form_row(form.teams, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.teams.vars.name}}) }}
{% endif %}
{% if form.metaFields is defined and form.metaFields is not empty %}
{{ form_row(form.metaFields) }}
{% endif %}
{% if form.fixedRate is defined or form.hourlyRate is defined or form.billable is defined or form.billableMode is defined or form.exported is defined %}
{% embed '@theme/embeds/card.html.twig' with {collapsed: true} %}
{% import "macros/widgets.html.twig" as widgets %}
{% block box_title %}{{ 'extended_settings'|trans }}{% endblock %}
{% block box_body_class %}{% endblock %}
{% block box_body %}
{% if form.fixedRate is defined %}
{{ form_row(form.fixedRate, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.fixedRate.vars.name}}) }}
{% endif %}
{% if form.hourlyRate is defined %}
{{ form_row(form.hourlyRate, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.hourlyRate.vars.name}}) }}
{% endif %}
{% if form.billable is defined %}
{{ form_row(form.billable, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.billable.vars.name}}) }}
{% elseif form.billableMode is defined %}
{{ form_row(form.billableMode, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.billableMode.vars.name}}) }}
{% endif %}
{% if form.exported is defined %}
{{ form_row(form.exported, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.exported.vars.name}}) }}
{% endif %}
{% endblock %}
{% endembed %}
{% endif %}
{{ form_rest(form) }}
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,7 +1,20 @@
{% extends 'timesheet/layout-edit.html.twig' %}
{% import "timesheet/actions.html.twig" as actions %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% from "macros/widgets.html.twig" import alert %}
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
{% block page_actions %}{{ actions.timesheet(timesheet, 'edit') }}{% endblock %}
{% set route_back = 'timesheet' %}
{% block main %}
{% if timesheet.exported %}
{{ alert('warning', ('timesheet.locked.warning'|trans({}, 'flashmessages')), null, 'warning') }}
{% endif %}
{% set formOptions = {
'template': kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig',
'title': (timesheet.id ? 'timesheet.edit'|trans : 'create'|trans),
'form': form
} %}
{% if route_back is defined and route_back is not null %}
{% set formOptions = formOptions|merge({'back': path(route_back)}) %}
{% endif %}
{% if template is not defined %}
{% set template = 'timesheet/edit-default.html.twig' %}
{% endif %}
{% include template %}
{% endblock %}

View File

@@ -1,8 +1,8 @@
{% extends 'invoice/layout.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% extends 'invoice/layout.html.twig' %}
{% block title %}{{ 'menu.export'|trans }}{% endblock %}
{% block title %}{{ 'export'|trans }}{% endblock %}
{% block invoice %}
{% set decimal = decimal|default(false) %}
{% set showUserColumn = true %}
@@ -38,15 +38,15 @@
<table class="table">
<thead>
<tr>
<th>{{ 'label.date'|trans }}</th>
<th>{{ 'date'|trans }}</th>
{% if showUserColumn %}
<th>{{ 'label.username'|trans }}</th>
<th>{{ 'username'|trans }}</th>
{% endif %}
<th>{{ 'label.description'|trans }}</th>
<th>{{ 'description'|trans }}</th>
{% for field in timesheetMetaFields %}
<th class="text-nowrap">{{ field.label|trans }}</th>
{% endfor %}
<th>{{ 'label.hours'|trans }}</th>
<th>{{ 'hours'|trans }}</th>
</tr>
</thead>
<tbody>
@@ -65,9 +65,9 @@
</div>
{% endif %}
<span class="small">
{% if entry.activity is not null %}{{ 'label.activity'|trans }}: {{ entry.activity.name }} |{% endif %}
{{ 'label.project'|trans }}: {{ entry.project.name }} |
{{ 'label.customer'|trans }}: {{ entry.project.customer.name }}
{% if entry.activity is not null %}{{ 'activity'|trans }}: {{ entry.activity.name }} |{% endif %}
{{ 'project'|trans }}: {{ entry.project.name }} |
{{ 'customer'|trans }}: {{ entry.project.customer.name }}
</span>
</td>
{% for field in timesheetMetaFields %}

View File

@@ -1,16 +1,196 @@
{% extends 'timesheet/layout-listing.html.twig' %}
{% import "timesheet/actions.html.twig" as actions %}
{% extends 'datatable.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% set tableName = 'timesheet' %}
{% set paginationRoute = 'timesheet_paginated' %}
{% set editRoute = 'timesheet_edit' %}
{% set canSeeRate = is_granted('view_rate_own_timesheet') %}
{% set canSeeUsername = false %}
{% set allowMarkdown = true %}
{% set checkOverlappingDesc = false %}
{% set checkOverlappingAsc = false %}
{% set query = dataTable.getQuery() %}
{% if query.orderBy == 'begin' or query.orderBy == 'end' %}
{% set checkOverlappingDesc = (query.order == 'DESC') %}
{% set checkOverlappingAsc = not checkOverlappingDesc %}
{% endif %}
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
{% block page_actions %}{{ actions.timesheets('index', query) }}{% endblock %}
{% set day = null %}
{% set dayDuration = 0 %}
{% set dayRate = {} %}
{% set dayHourlyRate = 0 %}
{% set lastEntry = null %}
{% block row_action %}
{{- actions.timesheet(entry, 'index') -}}
{% block status %}
{% from "macros/status.html.twig" import status_duration %}
{{ status_duration(stats.duration|duration) }}
{% endblock %}
{% block datatable_after %}
{% if showSummary %}
{{ _self.summary(day, dayDuration, dayHourlyRate, dayRate, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) }}
{% endif %}
{% endblock %}
{% block datatable_row %}
{%- set customerCurrency = entry.project.customer.currency -%}
{%- set entryHourlyRate = entry.hourlyRate|money(customerCurrency) -%}
{%- if day is same as(null) -%}
{% set day = entry.begin|date_short %}
{% endif %}
{%- if showSummary and day is not same as(entry.begin|date_short) -%}
{{ _self.summary(day, dayDuration, dayHourlyRate, dayRate, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) }}
{% set day = entry.begin|date_short %}
{% set dayDuration = 0 %}
{% set dayRate = {} %}
{% set dayHourlyRate = 0 %}
{%- endif -%}
{% set class = '' %}
{% if checkOverlappingDesc or checkOverlappingAsc %}
{% if lastEntry is not null and entry.end is not null and entry.user is same as (lastEntry.user) %}
{% if checkOverlappingDesc and entry.end.timestamp > lastEntry.begin.timestamp %}
{% set class = class ~ ' overlapping' %}
{% elseif checkOverlappingAsc and entry.begin.timestamp < lastEntry.end.timestamp %}
{% set class = class ~ ' overlapping' %}
{% endif %}
{% endif %}
{% endif %}
{% if not entry.end %}
{% set class = class ~ ' recording' %}
{% endif %}
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit{{ class }}" data-href="{{ path(editRoute, {'id': entry.id}) }}"{% endif %}>
<td class="text-nowrap">
{% if is_granted('edit', entry) or is_granted('delete', entry) %}
{{ tables.datatable_multiupdate_row(entry.id) }}
{% endif %}
</td>
<td class="text-nowrap {{ tables.class(dataTable, 'date') }}">{{ entry.begin|date_short }}</td>
{% if showStartEndTime %}
<td class="text-nowrap {{ tables.class(dataTable, 'starttime') }}">{{ entry.begin|time }}</td>
<td class="text-nowrap {{ tables.class(dataTable, 'endtime') }}">
{% if entry.end %}
{{ entry.end|time }}
{% else %}
&dash;
{% endif %}
</td>
{% endif %}
{% if entry.end %}
<td class="text-nowrap {{ tables.class(dataTable, 'duration') }}">{{ entry.duration|duration }}</td>
{% else %}
<td class="text-nowrap {{ tables.class(dataTable, 'duration') }}">
<i data-since="{{ entry.begin.format(constant('DATE_ISO8601')) }}">{{ entry|duration }}</i>
</td>
{% endif %}
{% if canSeeRate %}
<td class="text-nowrap {{ tables.class(dataTable, 'hourlyRate') }}">
{{ entryHourlyRate }}
</td>
<td class="text-nowrap {{ tables.class(dataTable, 'rate') }}">
{% if not entry.end or not is_granted('view_rate', entry) %}
&dash;
{% else %}
{{ entry.rate|money(customerCurrency) }}
{% endif %}
</td>
{% endif %}
<td class="{{ tables.class(dataTable, 'customer') }}">
{{ widgets.label_customer(entry.project.customer) }}
</td>
<td class="{{ tables.class(dataTable, 'project') }}">
{{ widgets.label_project(entry.project) }}
</td>
<td class="{{ tables.class(dataTable, 'activity') }}">
{% if entry.activity is not null %}
{{ widgets.label_activity(entry.activity) }}
{% endif %}
</td>
<td class="{{ tables.class(dataTable, 'description') }} timesheet-description">
{% if allowMarkdown %}
{{ entry.description|desc2html }}
{% else %}
{{ entry.description|nl2br }}
{% endif %}
</td>
<td class="{{ tables.class(dataTable, 'tags') }}">{{ widgets.tag_list(entry.tags) }}</td>
{% for field in metaColumns %}
<td class="{{ tables.class(dataTable, 'mf_' ~ field.name) }}">
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
{% if canSeeUsername %}
<td class="{{ tables.class(dataTable, 'username') }}">
{{ widgets.label_user(entry.user) }}
</td>
{% endif %}
<td class="{{ tables.class(dataTable, 'billable') }}">
{{ widgets.label_boolean(entry.billable) }}
</td>
<td class="{{ tables.class(dataTable, 'exported') }}">
{{ widgets.label_boolean(entry.exported) }}
</td>
<td class="{{ tables.class(dataTable, 'actions') }}">
{% set event = actions(app.user, action_single, 'index', {'timesheet': entry}) %}
{{ widgets.table_actions(event.actions) }}
</td>
</tr>
{%- if entry.end -%}
{% if dayRate[customerCurrency] is not defined %}
{% set dayRate = dayRate|merge({(customerCurrency): 0}) %}
{% endif %}
{% set dayRate = dayRate|merge({(customerCurrency): dayRate[customerCurrency] + entry.rate}) %}
{%- endif -%}
{% if dayHourlyRate is not null %}
{% if dayHourlyRate == 0 %}
{% set dayHourlyRate = entryHourlyRate %}
{% elseif dayHourlyRate != entryHourlyRate %}
{% set dayHourlyRate = null %}
{% endif %}
{% endif %}
{%- set dayDuration = dayDuration + entry.duration -%}
{% set lastEntry = entry %}
{% endblock %}
{% macro summary(day, duration, dayHourlyRate, dayRates, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) %}
{% import "macros/datatables.html.twig" as tables %}
<tr class="summary info">
<td></td>
<td class="text-nowrap">{{ day }}</td>
{% if showStartEndTime %}
<td class="{{ tables.class(dataTable, 'starttime') }}"></td>
<td class="{{ tables.class(dataTable, 'endtime') }}"></td>
{% endif %}
<td class="text-nowrap {{ tables.class(dataTable, 'duration') }}">{{ duration|duration }}</td>
{% if canSeeRate %}
<td class="text-nowrap {{ tables.class(dataTable, 'hourlyRate') }}">
{% if dayHourlyRate is not null and dayHourlyRate != 0 %}
{{ dayHourlyRate }}
{% endif %}
</td>
<td class="text-nowrap {{ tables.class(dataTable, 'rate') }}">
{% for currency, rate in dayRates %}
{{ rate|money(currency) }}
{% if not loop.last %}
<br>
{% endif %}
{% endfor %}
</td>
{% endif %}
<td class="{{ tables.class(dataTable, 'customer') }}"></td>
<td class="{{ tables.class(dataTable, 'project') }}"></td>
<td class="{{ tables.class(dataTable, 'activity') }}"></td>
<td class="{{ tables.class(dataTable, 'description') }}"></td>
<td class="{{ tables.class(dataTable, 'tags') }}"></td>
{% for field in metaColumns %}
<td class="{{ tables.class(dataTable, 'mf_' ~ field.name) }}"></td>
{% endfor %}
{% if canSeeUsername %}
<td class="{{ tables.class(dataTable, 'username') }}"></td>
{% endif %}
<td class="{{ tables.class(dataTable, 'billable') }}"></td>
<td class="{{ tables.class(dataTable, 'exported') }}"></td>
<td class="actions"></td>
</tr>
{% endmacro %}

View File

@@ -1,324 +0,0 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% block main %}
{% if timesheet.exported %}
{{ widgets.alert('warning', ('timesheet.locked.warning'|trans({}, 'flashmessages')), ('warning'|trans({}, 'flashmessages')), 'warning') }}
{% endif %}
{% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
{% set formOptions = {
'title': (timesheet.id ? 'timesheet.edit'|trans : 'create'|trans),
'form': form,
'back': path(route_back)
} %}
{% embed formEditTemplate with formOptions %}
{% set length = 6 %}
{% if form.begin is defined and form.end is defined and form.duration is defined %}
{% set length = 5 %}
{% elseif form.begin is defined and form.end is defined and form.duration is not defined %}
{% set length = 6 %}
{% elseif form.begin is defined and form.end is not defined and form.duration is defined %}
{% set length = 10 %}
{% elseif form.begin is not defined and form.end is defined and form.duration is defined %}
{% set length = 10 %}
{% endif %}
{% block form_body %}
{% if form.begin is defined or form.end is defined or form.duration is defined %}
<div class="row">
{% if form.begin is defined %}
<div class="col-md-{{ length }}">
{{ form_row(form.begin) }}
</div>
{% endif %}
{% if form.end is defined %}
<div class="col-md-{{ length }}">
{{ form_row(form.end) }}
</div>
{% endif %}
{% if form.duration is defined %}
<div class="col-md-2">
{{ form_row(form.duration) }}
</div>
{% endif %}
</div>
{% endif %}
{% if form.customer is defined %}
{{ form_row(form.customer, {'row_attr': {'class': 'timesheet_edit_form_row_customer'}}) }}
{% endif %}
{% if form.project is defined %}
{{ form_row(form.project, {'row_attr': {'class': 'timesheet_edit_form_row_project'}}) }}
{% endif %}
{% if form.activity is defined %}
{{ form_row(form.activity, {'row_attr': {'class': 'timesheet_edit_form_row_activity'}}) }}
{% endif %}
{% if form.description is defined %}
{{ form_row(form.description, {'row_attr': {'class': 'timesheet_edit_form_row_description'}}) }}
{% endif %}
{% if form.tags is defined %}
{{ form_row(form.tags, {'row_attr': {'class': 'timesheet_edit_form_row_tags'}}) }}
{% endif %}
{% if form.user is defined %}
{{ form_row(form.user, {'row_attr': {'class': 'timesheet_edit_form_row_user'}}) }}
{% endif %}
{% if form.users is defined or form.teams is defined %}
{% set uLength = 12 %}
{% if form.users is defined and form.teams is defined %}
{% set uLength = 6 %}
{% endif %}
<div class="row">
{% if form.users is defined %}
<div class="col-md-{{ uLength }}">
{{ form_row(form.users) }}
</div>
{% endif %}
{% if form.teams is defined %}
<div class="col-md-{{ uLength }}">
{{ form_row(form.teams) }}
</div>
{% endif %}
</div>
{% endif %}
{% set colWidth = 0 %}
{% if form.fixedRate is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if form.hourlyRate is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if form.billable is defined %}
{% set colWidth = colWidth + 1 %}
{% elseif form.billableMode is defined %}
{% set colWidth = colWidth + 1 %}
{% endif %}
{% if colWidth > 0 %}
<div class="row">
{% if form.fixedRate is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.fixedRate, {'row_attr': {'class': 'timesheet_edit_form_row_fixedRate'}}) }}
</div>
{% endif %}
{% if form.hourlyRate is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.hourlyRate, {'row_attr': {'class': 'timesheet_edit_form_row_hourlyRate'}}) }}
</div>
{% endif %}
{% if form.billable is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.billable, {'row_attr': {'class': 'timesheet_edit_form_row_billable'}}) }}
</div>
{% elseif form.billableMode is defined %}
<div class="col-md-{{ 12 / colWidth }}">
{{ form_row(form.billableMode, {'row_attr': {'class': 'timesheet_edit_form_row_billable'}}) }}
</div>
{% endif %}
</div>
{% endif %}
{% if form.metaFields is defined and form.metaFields is not empty %}
{% for meta in form.metaFields|sort((a, b) => a.vars.data.order <=> b.vars.data.order) %}
{{ form_row(meta) }}
{% endfor %}
{% endif %}
{% if form.exported is defined %}
<div class="row">
<div class="col-md-12">
{{ form_row(form.exported, {'row_attr': {'class': 'timesheet_edit_form_row_exported'}}) }}
</div>
</div>
{% endif %}
{{ form_widget(form) }}
{% endblock %}
{% block form_after %}
{% if form.begin is defined and form.end is defined and form.duration is defined %}
{% set blockPrefix = form.vars.id %}
<script type="text/javascript">
jQuery('body').on('change', '#{{ blockPrefix }}_begin', function(ev) {
changedBegin(jQuery(this).val());
});
jQuery('body').on('change', '#{{ blockPrefix }}_end', function(ev) {
changedEnd(jQuery(this).val());
});
jQuery('body').on('change', '#{{ blockPrefix }}_duration', function(ev) {
changedDuration();
});
function getDurationField()
{
return document.getElementById('{{ blockPrefix }}_duration');
}
{#
Ruleset:
- invalid begin => skip
- empty end => set end to begin (only if duration > 0 = running record)
- invalid end => skip
- calculate duration
#}
function changedBegin(value)
{
var endField = document.getElementById('{{ blockPrefix }}_end');
var format = endField.dataset.format;
var momentDuration = getParsedDuration();
var momentBegin = moment(value, format);
if (!momentBegin.isValid()) {
setDurationAsString(null);
}
if (endField.value === '' && momentDuration.asSeconds() > 0) {
applyDateToField(endField, momentBegin, format);
}
var momentEnd = moment(endField.value, format);
if (!momentEnd.isValid()) {
return;
}
if (momentEnd.isBefore(momentBegin)) {
applyDateToField(endField, momentBegin.add(momentDuration), format);
}
momentBegin = moment(value, format);
momentEnd = moment(endField.value, format);
var durationMoment = moment.duration(momentEnd.diff(momentBegin));
setDurationAsString(durationMoment);
}
{#
Ruleset:
- invalid end => skip
- empty begin => set begin to end
- invalid begin => skip
- calculate duration
#}
function changedEnd(value)
{
var beginField = document.getElementById('{{ blockPrefix }}_begin');
var format = beginField.dataset.format;
var momentDuration = getParsedDuration();
var momentEnd = moment(value, format);
if (!momentEnd.isValid()) {
setDurationAsString(null);
}
if (beginField.value === '') {
applyDateToField(beginField, momentEnd, format);
}
var momentBegin = moment(beginField.value, format);
if (!momentBegin.isValid()) {
return;
}
if (momentEnd.isBefore(momentBegin)) {
applyDateToField(beginField, momentEnd.subtract(momentDuration), format);
}
momentBegin = moment(beginField.value, format);
momentEnd = moment(value, format);
var durationMoment = moment.duration(momentEnd.diff(momentBegin));
setDurationAsString(durationMoment);
}
{#
Ruleset:
- invalid duration => skip
- if begin and end are empty: set begin to now and end to duration
- if begin is empty and end is not empty: set begin to end minus duration
- if begin is not empty and end is empty and duration is > 0 (running records = 0): set end to begin plus duration
#}
function changedDuration()
{
var momentDuration = getParsedDuration();
if (!momentDuration.isValid()) {
return;
}
var beginField = document.getElementById('{{ blockPrefix }}_begin');
var endField = document.getElementById('{{ blockPrefix }}_end');
var format = endField.dataset.format;
var begin = beginField.value;
var end = endField.value;
var duration = momentDuration.asSeconds();
if (begin === '' && end === '') {
applyDateToField(beginField, moment(), format);
applyDateToField(endField, moment(beginField.value, format).add(duration, 'seconds'), format);
} else if (begin === '' && end !== '') {
applyDateToField(beginField, moment(end, format).subtract(duration, 'seconds'), format);
} else if (begin !== '' && duration > 0) {
applyDateToField(endField, moment(beginField.value, format).add(duration, 'seconds'), format);
}
}
{# writes the value of a moment-duration object as human readable string into the duration field #}
function setDurationAsString(durationMoment)
{
if (durationMoment === null) {
getDurationField().value = '';
return;
}
if (!durationMoment.isValid()) {
return;
}
var hours = Math.floor(durationMoment.asHours());
if (hours < 10) {
hours = '0' + hours;
}
getDurationField().value = hours + ':' + ('0' + durationMoment.minutes()).slice(-2);
}
{# returns a moment duration object from the duration input field #}
function getParsedDuration()
{
var duration = getDurationField().value.toUpperCase();
var momentDuration = moment.duration(NaN);
if (duration.indexOf(':') !== -1) {
momentDuration = moment.duration(duration);
} else if (duration.indexOf('.') !== -1 || duration.indexOf(',') !== -1) {
duration = duration.replace(/,/, '.');
duration = parseFloat(duration) * 3600;
momentDuration = moment.duration('PT' + duration + 'S');
} else if (duration.indexOf('H') !== -1 || duration.indexOf('M') !== -1 || duration.indexOf('S') !== -1) {
{# D for days does not work, because 'PT1H' but with days 'P1D' is used #}
momentDuration = moment.duration('PT' + duration);
} else {
let c = parseInt(duration);
let d = parseInt(duration).toFixed();
if (!isNaN(c) && duration === d) {
duration = c * 3600;
momentDuration = moment.duration('PT' + duration + 'S');
}
}
return momentDuration;
}
function applyDateToField(field, momentObj, format)
{
field.value = momentObj.format(format);
if (jQuery(field).data('daterangepicker') !== undefined) {
jQuery(field).data('daterangepicker').setStartDate(momentObj);
jQuery(field).data('daterangepicker').setEndDate(momentObj);
{# make sure that the project list is reloaded and the dates can be compared against the project end date #}
jQuery('#{{ blockPrefix }}_customer').trigger('change');
}
}
</script>
{% endif %}
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,30 +1,28 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% block page_title %}{{ 'menu.export'|trans }}{% endblock %}
{% block main %}
{% if stats.count > 1000 %}
{{ widgets.alert('warning', ('export.warn_result_amount'|trans({'%count%': stats.count})), null, 'warning') }}
{% endif %}
{% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
{% set formEditTemplate = kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
{% set formOptions = {
'title': 'menu.export'|trans,
'title': 'export'|trans,
'form': form,
'back': path(route_back),
'formStartOptions': {'attr': {'class': 'form-narrow searchform', 'target': '_blank'}},
'formStartOptions': {'attr': {'class': 'searchform', 'target': '_blank'}},
} %}
{% embed formEditTemplate with formOptions %}
{% form_theme form 'form/search-form.html.twig' %}
{% form_theme form 'form/search.html.twig' %}
{% block modal_size %}{% endblock %}
{% block form_body %}
{% set orderHasError = form.orderBy.vars.errors|length > 0 or form.order.vars.errors|length > 0 %}
{% set orderBy = form_widget(form.orderBy) %}
{% set order = form_widget(form.order) %}
{{ form_widget(form) }}
<div class="form-group{% if orderHasError %} has-error{% endif %}">
{{ form_rest(form) }}
<div class="row mb-3{% if orderHasError %} is-invalid{% endif %}">
{{ form_label(form.orderBy) }}
<div class="col-sm-5 col-xs-5">
<div class="col-sm-4 col-xs-4">
{{ orderBy|raw }}
{{ form_errors(form.orderBy) }}
</div>

View File

@@ -1,251 +0,0 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/search.html.twig" as search %}
{% if not showSummary is defined %}
{% set showSummary = false %}
{% endif %}
{% if not showStartEndTime is defined %}
{% set showStartEndTime = true %}
{% endif %}
{% set columns = {
'id': {'class': 'alwaysVisible multiCheckbox', 'orderBy': false, 'title': false, 'html_before': tables.datatable_multiupdate_all()},
'date': {'class': 'alwaysVisible', 'orderBy': 'begin'},
} %}
{% if showStartEndTime %}
{% set columns = columns|merge({
'starttime': {'class': 'hidden-xs text-center', 'orderBy': 'begin'},
'endtime': {'class': 'hidden-xs text-center', 'orderBy': 'end'}
}) %}
{% endif %}
{% set columns = columns|merge({'duration': {'class': 'text-right'}}) %}
{% if canSeeRate %}
{% set columns = columns|merge({
'hourlyRate': {'class': 'text-right hidden'},
'rate': {'class': 'text-right'}
}) %}
{% endif %}
{% set columns = columns|merge({
'customer': {'class': 'hidden-xs hidden-sm hidden-md'},
'project': {'class': 'hidden-xs hidden-sm hidden-md'},
'activity': {'class': 'hidden-xs hidden-sm'},
'description': {'class': 'hidden-xs hidden-sm'},
'tags': {'class': 'hidden-xs hidden-sm', 'orderBy': false},
}) %}
{% for field in metaColumns %}
{% set columns = columns|merge({
('mf_' ~ field.name): {'title': field.label|trans, 'class': 'hidden-xs hidden-sm mf_' ~ field.name, 'orderBy': false}
}) %}
{% endfor %}
{% if canSeeUsername %}
{% set columns = columns|merge({
'username': {'class': 'hidden-xs', 'orderBy': false},
}) %}
{% endif %}
{% set columns = columns|merge({
'billable': {'class': 'text-center hidden w-min', 'orderBy': false},
'exported': {'class': 'text-center hidden w-min', 'orderBy': false},
'actions': {'class': 'actions alwaysVisible'},
}) %}
{% block page_search %}{{ search.searchModal(toolbarForm) }}{% endblock %}
{% block main_before %}
{{ tables.data_table_column_modal(tableName, columns) }}
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.nothing_found('kimai.timesheetUpdate') }}
{% else %}
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.timesheetUpdate kimai.timesheetDelete'}) }}
{% set checkOverlappingDesc = false %}
{% set checkOverlappingAsc = false %}
{% if query.orderBy == 'begin' or query.orderBy == 'end' %}
{% set checkOverlappingDesc = (query.order == 'DESC') %}
{% set checkOverlappingAsc = not checkOverlappingDesc %}
{% endif %}
{% set day = null %}
{% set dayDuration = 0 %}
{% set dayRate = {} %}
{% set dayHourlyRate = 0 %}
{% set lastEntry = null %}
{% for entry in entries %}
{%- set customerCurrency = entry.project.customer.currency -%}
{%- set entryHourlyRate = entry.hourlyRate|money(customerCurrency) -%}
{%- if day is same as(null) -%}
{% set day = entry.begin|date_short %}
{% endif %}
{%- if showSummary and day is not same as(entry.begin|date_short) -%}
{{ _self.summary(day, dayDuration, dayHourlyRate, dayRate, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) }}
{% set day = entry.begin|date_short %}
{% set dayDuration = 0 %}
{% set dayRate = {} %}
{% set dayHourlyRate = 0 %}
{%- endif -%}
{% set class = '' %}
{% if checkOverlappingDesc or checkOverlappingAsc %}
{% if lastEntry is not null and entry.end is not null and entry.user is same as (lastEntry.user) %}
{% if checkOverlappingDesc and entry.end.timestamp > lastEntry.begin.timestamp %}
{% set class = class ~ ' overlapping' %}
{% elseif checkOverlappingAsc and entry.begin.timestamp < lastEntry.end.timestamp %}
{% set class = class ~ ' overlapping' %}
{% endif %}
{% endif %}
{% endif %}
{% if not entry.end %}
{% set class = class ~ ' recording' %}
{% endif %}
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit{{ class }}" data-href="{{ path(editRoute, {'id': entry.id}) }}"{% endif %}>
<td class="text-nowrap">
{% if is_granted('edit', entry) or is_granted('delete', entry) %}
{{ tables.datatable_multiupdate_row(entry.id) }}
{% endif %}
</td>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
{% if showStartEndTime %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|time }}</td>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'endtime') }}">
{% if entry.end %}
{{ entry.end|time }}
{% else %}
&dash;
{% endif %}
</td>
{% endif %}
{% if entry.end %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ entry.duration|duration }}</td>
{% else %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">
<i data-since="{{ entry.begin.format(constant('DATE_ISO8601')) }}">{{ entry|duration }}</i>
</td>
{% endif %}
{% if canSeeRate %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'hourlyRate') }}">
{{ entryHourlyRate }}
</td>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'rate') }}">
{% if not entry.end or not is_granted('view_rate', entry) %}
&dash;
{% else %}
{{ entry.rate|money(customerCurrency) }}
{% endif %}
</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
{{ widgets.label_customer(entry.project.customer) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
{{ widgets.label_project(entry.project) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">
{{ widgets.label_activity(entry.activity) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }} timesheet-description">
{% if allowMarkdown %}
{{ entry.description|desc2html }}
{% else %}
{{ entry.description|nl2br }}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'tags') }}">{{ widgets.tag_list(entry.tags) }}</td>
{% for field in metaColumns %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'mf_' ~ field.name) }}">
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
{% if canSeeUsername %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}">
{{ widgets.label_user(entry.user) }}
</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'billable') }}">
{{ widgets.label_boolean(entry.billable) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'exported') }}">
{{ widgets.label_boolean(entry.exported) }}
</td>
<td class="actions">
{{ block('row_action') }}
</td>
</tr>
{%- if entry.end -%}
{% if dayRate[customerCurrency] is not defined %}
{% set dayRate = dayRate|merge({(customerCurrency): 0}) %}
{% endif %}
{% set dayRate = dayRate|merge({(customerCurrency): dayRate[customerCurrency] + entry.rate}) %}
{%- endif -%}
{% if dayHourlyRate is not null %}
{% if dayHourlyRate == 0 %}
{% set dayHourlyRate = entryHourlyRate %}
{% elseif dayHourlyRate != entryHourlyRate %}
{% set dayHourlyRate = null %}
{% endif %}
{% endif %}
{%- set dayDuration = dayDuration + entry.duration -%}
{% set lastEntry = entry %}
{% endfor %}
{% if showSummary %}
{{ _self.summary(day, dayDuration, dayHourlyRate, dayRate, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) }}
{% endif %}
{{ tables.data_table_footer(entries, paginationRoute, multiUpdateForm) }}
{% endif %}
{% endblock %}
{% macro summary(day, duration, dayHourlyRate, dayRates, columns, canSeeRate, canSeeUsername, showStartEndTime, tableName, metaColumns) %}
{% import "macros/datatables.html.twig" as tables %}
<tr class="summary info">
<td></td>
<td class="text-nowrap">{{ day }}</td>
{% if showStartEndTime %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'endtime') }}"></td>
{% endif %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'duration') }}">{{ duration|duration }}</td>
{% if canSeeRate %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'hourlyRate') }}">
{% if dayHourlyRate is not null and dayHourlyRate != 0 %}
{{ dayHourlyRate }}
{% endif %}
</td>
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'rate') }}">
{% for currency, rate in dayRates %}
{{ rate|money(currency) }}
{% if not loop.last %}
<br>
{% endif %}
{% endfor %}
</td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'tags') }}"></td>
{% for field in metaColumns %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'mf_' ~ field.name) }}"></td>
{% endfor %}
{% if canSeeUsername %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'username') }}"></td>
{% endif %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'billable') }}"></td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'exported') }}"></td>
<td class="actions"></td>
</tr>
{% endmacro %}

View File

@@ -1,132 +0,0 @@
{% 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,
} %}
{% embed formEditTemplate with formOptions %}
{% block form_body %}
<fieldset>
<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>
{{ form_row(form.replaceTags) }}
{{ form_row(form.tags) }}
</fieldset>
{% if form.user is defined %}
<fieldset>
{{ form_row(form.user) }}
</fieldset>
{% endif %}
{% if form.exported is defined %}
<fieldset>
{{ form_row(form.exported) }}
</fieldset>
{% endif %}
{% if form.billable is defined %}
<fieldset>
{{ form_row(form.billable) }}
</fieldset>
{% endif %}
{% if form.recalculateRates is defined %}
<fieldset>
{{ 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>
<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 %}
{% 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 %}
var allElements = document.getElementsByName('{{ form.vars.name }}')[0].elements;
for (var i = 0; i < allElements.length; ++i) {
var el = allElements[i];
var 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');
} else if (elAttr.indexOf('{{ form.updateMeta.vars.full_name }}') !== -1) {
el.checked = false;
el.onclick = function() {
var searchElements = document.getElementsByName('{{ form.vars.name }}')[0].elements;
var metaCheckbox = this;
var metaName = metaCheckbox.value;
for (var s = 0; s < searchElements.length; ++s) {
var current = searchElements[s];
var 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');
} else {
current.setAttribute('disabled', 'disabled');
}
}
};
}
}
{% endif %}
});
</script>
{% endblock %}

View File

@@ -1,7 +1,130 @@
{% extends 'timesheet/layout-multi-update.html.twig' %}
{% extends 'base.html.twig' %}
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
{% block page_actions %}
{% import "timesheet/actions.html.twig" as actions %}
{{ actions.timesheets_multi_update('multi-update') }}
{% 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>
<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>
{{ form_row(form.replaceTags) }}
{{ form_row(form.tags) }}
</fieldset>
{% if form.user is defined %}
<fieldset>
{{ form_row(form.user) }}
</fieldset>
{% endif %}
{% if form.exported is defined %}
<fieldset>
{{ form_row(form.exported) }}
</fieldset>
{% endif %}
{% if form.billable is defined %}
<fieldset>
{{ form_row(form.billable) }}
</fieldset>
{% endif %}
{% if form.recalculateRates is defined %}
<fieldset>
{{ 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>
<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');
} 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');
} else {
current.setAttribute('disabled', 'disabled');
}
}
};
}
}
{% endif %}
});
</script>
{% endblock %}