{% extends 'page_setup.html.twig' %} {% import "macros/widgets.html.twig" as widgets %} {% block form_addon %} {% set event = actions(app.user, 'contract_links', 'index', {year: year, user: user}) %} {{ widgets.actions(event.actions, {button_class: '', large: false}) }} {% endblock %} {% block main %} {% set withWorkHourConfiguration = user.hasWorkHourConfiguration() %} {% if not withWorkHourConfiguration %} {% set warningMsg %} {{ 'work_times_should.none_configured'|trans }} {% if is_granted('contract', user) %} {{ 'action.edit'|trans }} {% endif %} {% endset %} {% from '@theme/components/alert.html.twig' import alert %} {{ alert({type: 'info', description: warningMsg|raw, important: true}) }} {% endif %} {% if summaries|length > 0 %} {% embed '@theme/embeds/card.html.twig' with {'fullsize': true} %} {% from "macros/status.html.twig" import status_duration %} {% from "macros/widgets.html.twig" import work_times_result %} {% block box_title %} {{ 'export.summary'|trans }} {{ status_duration(work_times_result(summaries.expectedTime, summaries.actualTime, decimal)) }} {% endblock %} {% block box_body_classes %}card-table table-responsive{% endblock %} {% block box_body %} {% for month in year.months %} {% endfor %} {% set monthTotalShould = {'_01': 0, '_02': 0, '_03': 0, '_04': 0, '_05': 0, '_06': 0, '_07': 0, '_08': 0, '_09': 0, '_10': 0, '_11': 0, '_12': 0} %} {% set monthTotalIs = {'_01': 0, '_02': 0, '_03': 0, '_04': 0, '_05': 0, '_06': 0, '_07': 0, '_08': 0, '_09': 0, '_10': 0, '_11': 0, '_12': 0} %} {% for summary in summaries %} {% for month in summary.months %} {% set monthShould = month.expectedTime %} {% set monthIs = month.actualTime %} {% set dateKey = '_' ~ month.month.format('m') %} {% set monthTotalShouldTmp = monthTotalShould[dateKey] + monthShould %} {% set monthTotalIsTmp = monthTotalIs[dateKey] + monthIs %} {% set monthTotalShould = monthTotalShould|merge({(dateKey): monthTotalShouldTmp}) %} {% set monthTotalIs = monthTotalIs|merge({(dateKey): monthTotalIsTmp}) %} {% endfor %} {% endfor %} {% for month in year.months %} {% set dateKey = '_' ~ month.month.format('m') %} {% endfor %}
{{ 'sum.total'|trans }}{{ month.month|month_name }}
{{ summary.title|trans }} {% if summary.expectedTime > 0 %} {{ work_times_result(summary.expectedTime, summary.actualTime, decimal) }} {% else %} {{ summary.actualTime|duration(decimal) }} {% endif %} {% if now < month.month and monthShould > 0 %} {{ monthShould|duration(decimal) }} {% else %} {{ work_times_result(monthShould, monthIs, decimal) }} {% endif %}
{{ 'sum.total'|trans }} {{ work_times_result(summaries.expectedTime, summaries.actualTime, decimal) }} {{ work_times_result(monthTotalShould[dateKey], monthTotalIs[dateKey], decimal) }}
{% endblock %} {% endembed %} {% endif %} {% if year is defined %} {% embed '@theme/embeds/collapsible.html.twig' with {id: 'working_time_detail_box', border: false, item: {options: {bodyExtraClass: 'border-top', open: not box_configuration.collapsed}, bodyClasses: 'p-0 table-responsive'}} %} {% set yearShould = 0 %} {% set yearIs = 0 %} {% set approved = 0 %} {% for month in year.months %} {% set monthShould = month.expectedTime(now) %} {% set monthIs = month.actualTime %} {% set showStats = now > month.month or monthIs > 0 %} {% if showStats %} {% set yearShould = yearShould + monthShould %} {% endif %} {% set yearIs = yearIs + monthIs %} {% if month.locked %} {% set approved = approved + 1 %} {% endif %} {% endfor %} {% from "macros/widgets.html.twig" import work_times_result, table_actions, card_tool_button, username %} {% from "macros/status.html.twig" import status_count %} {% block title %} {{ 'work_times'|trans }} {% if withWorkHourConfiguration %}   {{ status_count(approved ~ '/' ~ year.months|length) }} {% endif %} {% endblock %} {% block body %} {% if withWorkHourConfiguration %} {% endif %} {% for day in 1..31 %} {% endfor %} {% for month in year.months %} {% set monthShould = month.expectedTime(now) %} {% set monthIs = month.actualTime %} {% set showStats = now > month.month or monthIs > 0 %} {% if withWorkHourConfiguration %} {% endif %} {% set dayCount = 0 %} {% for day in month.days %} {% set class = 'text-end contractDay text-nowrap' %} {% if day.day is weekend(user) %} {% set class = class ~ ' weekend' %} {% endif %} {% if day.workingTime.expectedTime > 0 and day.workingTime.actualTime == 0 and now > day.day %} {% set class = class ~ ' bg-orange-lt' %} {% elseif day.workingTime.expectedTime == 0 and day.workingTime.actualTime > 0 and now > day.day %} {% set class = class ~ ' bg-yellow-lt' %} {% endif %} {% set dayCount = dayCount + 1 %} {% endfor %} {% if dayCount < 31 %} {% for day in 1..(31-dayCount)%} {% endfor %} {% endif %} {% endfor %} {% if withWorkHourConfiguration %} {% endif %} {% for day in 1..31 %} {% endfor %}
{{ 'month'|trans }} {{ 'sum.total'|trans }} {{ 'work_times_should'|trans }} {{ 'work_times_is'|trans }}{% if day < 10 %}0{% endif %}{{ day }}
{% if month.locked %} {% else %} {% endif %} {{ month.month|month_name }} {% if showStats %} {{ work_times_result(monthShould, monthIs, decimal) }} {% endif %} {{ monthShould|duration(decimal) }} {{ monthIs|duration(decimal) }} {% if (day.workingTime.expectedTime != 0 or day.workingTime.actualTime != 0) and (now > day.day or day.workingTime.actualTime > 0) %} {% if day.hasAddons() %} {% set statusTitle = '' %} {% for addon in day.getAddons() %} {% set statusTitle = statusTitle ~ (addon.title|trans) ~ ' (' ~ addon.visibleDuration|duration(decimal) ~ ')' %} {% if not loop.last %} {% set statusTitle = statusTitle ~ ', ' %} {% endif %} {% endfor %} {% endif %} {{ work_times_result(day.workingTime.expectedTime, day.workingTime.actualTime, decimal) }} {% endif %} {% set event = actions(app.user, 'contract_month', 'index', {'year': year, 'month': month}) %} {{ table_actions(event.actions) }}
{{ work_times_result(yearShould, yearIs, decimal) }} {{ yearShould|duration(decimal) }} {{ yearIs|duration(decimal) }}
{% endblock %} {% endembed %} {% endif %} {% if withWorkHourConfiguration %} {% set expectedWeekTimes = user.workHoursMonday + user.workHoursTuesday + user.workHoursWednesday + user.workHoursThursday + user.workHoursFriday + user.workHoursSaturday + user.workHoursSunday %} {% embed '@theme/embeds/collapsible.html.twig' with {id: 'work_contract_should_preview', border: false, item: {options: {bodyExtraClass: 'border-top'}}} %} {% from "macros/status.html.twig" import status_duration %} {% block title %} {{ 'work_times_should'|trans }}   {{ status_duration(expectedWeekTimes|duration) }} {% endblock %} {% block body %}
{{ 'Monday'|trans({}, 'system-configuration') }}
{{ user.workHoursMonday|duration }}
{{ 'Tuesday'|trans({}, 'system-configuration') }}
{{ user.workHoursTuesday|duration }}
{{ 'Wednesday'|trans({}, 'system-configuration') }}
{{ user.workHoursWednesday|duration }}
{{ 'Thursday'|trans({}, 'system-configuration') }}
{{ user.workHoursThursday|duration }}
{{ 'Friday'|trans({}, 'system-configuration') }}
{{ user.workHoursFriday|duration }}
{{ 'Saturday'|trans({}, 'system-configuration') }}
{{ user.workHoursSaturday|duration }}
{{ 'Sunday'|trans({}, 'system-configuration') }}
{{ user.workHoursSunday|duration }}
{% endblock %} {% endembed %} {% endif %} {% for controller in boxes %} {{ render(controller(controller, {'year': year, 'boxConfiguration': box_configuration})) }} {% endfor %} {% endblock %} {% block javascripts %} {{ parent() }} {% endblock %}