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,9 +1,3 @@
{% macro projects(view, query) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set event = actions(app.user, 'projects', view, {'query': query}) %}
{{ widgets.page_actions(event.actions) }}
{% endmacro %}
{% macro project(project, view, isTable) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set event = actions(app.user, 'project', view, {'project': project, 'token': csrf_token('project.duplicate')}) %}

View File

@@ -10,8 +10,8 @@
{% set currency = project.customer.currency %}
{% if project.isMonthlyBudget() %}
<h4>
{%- if showMoneyBudget %}{{ 'label.budget'|trans }}{% else %}{{ 'label.timeBudget'|trans }}{% endif -%}
: {{ 'label.budgetType_month'|trans }}
{%- if showMoneyBudget %}{{ 'budget'|trans }}{% else %}{{ 'timeBudget'|trans }}{% endif -%}
: {{ 'budgetType_month'|trans }}
</h4>
{% set chartData = [] %}
{% set chartLabels = [] %}
@@ -45,7 +45,7 @@
{{ bar_chart(chartPrefix, chartLabels, [chartData], {'height': '300px', 'renderEvent': 'render.' ~ chartPrefix}) }}
{% else %}
<h4>
{%- if showMoneyBudget %}{{ 'label.budget'|trans }}{% else %}{{ 'label.timeBudget'|trans }}{% endif -%}
{%- if showMoneyBudget %}{{ 'budget'|trans }}{% else %}{{ 'timeBudget'|trans }}{% endif -%}
</h4>
{% set chartData = [] %}
{% set chartLabels = [] %}
@@ -70,12 +70,9 @@
'label': (showMoneyBudget ? totalBudget|money(currency) : totalBudget|duration),
'value': (showMoneyBudget ? totalBudget|chart_money : totalBudget|chart_duration),
} %}
{# line chart do not support coloring negative areas #}
{#
{% if totalBudget < 0 %}
{% set chartValue = chartValue|merge({'color': 'red'}) %}
{% endif %}
#}
{% set chartData = chartData|merge([chartValue]) %}
{% endif %}
{% endfor %}

View File

@@ -1,23 +1,14 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "project/actions.html.twig" as actions %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_actions %}{{ actions.project(project, 'delete') }}{% endblock %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% block main %}
{% set inUse = (stats.counter > 0) %}
{% set params = {
'%records%': stats.counter,
'%duration%': stats.duration|duration
} %}
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
{{ include(kimai_context.modalRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
'message': ("delete_warning.short_stats"|trans(params) ~ "admin_entity.delete_confirm"|trans),
'form': form,
'used': inUse,
'used': (stats.counter > 0),
'back': path('admin_project')
}) }}
{% endblock %}

View File

@@ -1,43 +1,39 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "project/actions.html.twig" as actions %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_actions %}{{ actions.project(project, 'project_details') }}{% endblock %}
{% block main %}
{% set can_edit = is_granted('edit', project) %}
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
{% embed '@theme/embeds/card.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "customer/actions.html.twig" as customerActions %}
{% block box_attributes %}id="project_details_box"{% endblock %}
{% block box_tools %}
{% if can_edit %}
<a class="modal-ajax-form open-edit btn btn-default btn-sm" data-href="{{ path('admin_project_edit', {'id': project.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'action.edit'|trans }}"><i class="{{ 'edit'|icon }}"></i></a>
{{ widgets.card_tool_button('edit', {'class': 'modal-ajax-form open-edit', 'title': 'action.edit', 'url': path('admin_project_edit', {'id': project.id})}) }}
{% endif %}
{% endblock %}
{% block box_title %}
{{ widgets.label_name(project.name, project.color) }}
{% endblock %}
{% block box_body_class %}no-padding{% endblock %}
{% block box_body_class %}p-0{% endblock %}
{% block box_body %}
{% if project.comment is not empty %}
<div class="comment">
<div class="comment p-3">
{{ project.comment|comment2html(true) }}
</div>
{% endif %}
<table class="table table-hover dataTable">
{% if not project.visible %}
<tr class="{{ widgets.class_project_row(project, now) }}">
<th>{{ 'label.visible'|trans }}</th>
<th>{{ 'visible'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(project.visible) }}
</td>
</tr>
{% endif %}
<tr {{ widgets.customer_row_attr(project.customer, now) }}>
<th>{{ 'label.customer'|trans }}</th>
<th>{{ 'customer'|trans }}</th>
<td>
{{ widgets.label_customer(project.customer) }}
</td>
@@ -51,7 +47,7 @@
{% if is_granted('details', project) %}
{% if not project.billable %}
<tr>
<th>{{ 'label.billable'|trans }}</th>
<th>{{ 'billable'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(project.billable) }}
</td>
@@ -59,7 +55,7 @@
{% endif %}
{% if project.orderNumber is not empty %}
<tr>
<th>{{ 'label.orderNumber'|trans }}</th>
<th>{{ 'orderNumber'|trans }}</th>
<td colspan="3">
{{ project.orderNumber }}
</td>
@@ -67,25 +63,25 @@
{% endif %}
{% if project.orderDate is not empty %}
<tr>
<th>{{ 'label.orderDate'|trans }}</th>
<th>{{ 'orderDate'|trans }}</th>
<td colspan="3">
{{ project.orderDate|date_full(true) }}
{{ project.orderDate|date_short }}
</td>
</tr>
{% endif %}
{% if project.start is not empty %}
<tr>
<th>{{ 'label.project_start'|trans }}</th>
<th>{{ 'project_start'|trans }}</th>
<td colspan="3">
{{ project.start|date_full(true) }}
{{ project.start|date_short }}
</td>
</tr>
{% endif %}
{% if project.end is not empty %}
<tr>
<th>{{ 'label.project_end'|trans }}</th>
<th>{{ 'project_end'|trans }}</th>
<td colspan="3">
{{ project.end|date_full(true) }}
{{ project.end|date_short }}
</td>
</tr>
{% endif %}
@@ -93,9 +89,9 @@
{% if project.hasBudget() and is_granted('budget', project) %}
<tr>
<th>
{{ 'label.budget'|trans }}
{{ 'budget'|trans }}
{% if project.isMonthlyBudget() %}
({{ 'label.budgetType_month'|trans }})
({{ 'budgetType_month'|trans }})
{% endif %}
</th>
<td colspan="3">
@@ -106,9 +102,9 @@
{% if project.hasTimeBudget() and is_granted('time', project) %}
<tr>
<th>
{{ 'label.timeBudget'|trans }}
{{ 'timeBudget'|trans }}
{% if project.isMonthlyBudget() %}
({{ 'label.budgetType_month'|trans }})
({{ 'budgetType_month'|trans }})
{% endif %}
</th>
<td colspan="3">
@@ -118,7 +114,7 @@
{% endif %}
{% if not project.globalActivities %}
<tr>
<th>{{ 'label.globalActivities'|trans }}</th>
<th>{{ 'globalActivities'|trans }}</th>
<td colspan="3">
{{ widgets.label_boolean(project.globalActivities) }}
</td>
@@ -136,6 +132,10 @@
{{ render(controller('App\\Controller\\ProjectController::activitiesAction', {'project': project.id, 'page': 1})) }}
{% if can_edit %}
{{ include('embeds/rates-table.html.twig', {'id': 'project_rates_box', 'entity': project, 'create_url': path('admin_project_rate_add', {'id': project.id}), 'delete_route': 'delete_project_rate', 'currency': project.customer.currency, 'edit_route': 'admin_project_rate_edit'}) }}
{% endif %}
{% if stats is not null %}
{{ include('embeds/budgets.html.twig', {'entity': project, 'stats': stats, 'currency': project.customer.currency}) }}
{% endif %}
@@ -144,10 +144,6 @@
{{ render(controller(controller, {'project': project, 'page': 1})) }}
{% endfor %}
{% if can_edit %}
{{ include('embeds/rates-table.html.twig', {'id': 'project_rates_box', 'entity': project, 'create_url': path('admin_project_rate_add', {'id': project.id}), 'delete_route': 'delete_project_rate', 'currency': project.customer.currency}) }}
{% endif %}
{% if teams is not null%}
{% set options = {'teams': teams, 'team': team} %}
{% if is_granted('permissions', project) %}

View File

@@ -1,11 +1,7 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "project/actions.html.twig" as actions %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_actions %}{{ actions.project(project, 'edit') }}{% endblock %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% block main %}
{% 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': (project.id is null ? 'create-project'|trans({}, 'actions') : 'edit'|trans({}, 'actions')),
'form': form,
@@ -14,10 +10,10 @@
{% embed formEditTemplate with formOptions %}
{% block form_body %}
<div class="row">
<div class="col-md-10">
<div class="col-md-9">
{{ form_row(form.name) }}
</div>
<div class="col-md-2">
<div class="col-md-3">
{{ form_row(form.color) }}
</div>
</div>
@@ -56,26 +52,38 @@
</div>
</div>
{% endif %}
{% if form.invoiceText is defined %}
{{ form_row(form.invoiceText) }}
{% if form.teams is defined %}
<div class="row">
<div class="col-12">
{{ form_row(form.teams) }}
</div>
</div>
{% endif %}
<div class="row">
<div class="col-md-4">
{{ form_row(form.visible) }}
</div>
<div class="col-md-4 text-center">
<div class="col-md-4">
{{ form_row(form.billable) }}
</div>
<div class="col-md-4 text-right">
<div class="col-md-4">
{{ form_row(form.globalActivities) }}
</div>
</div>
{% 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 %}
{{ form_row(form.metaFields) }}
{% endif %}
{{ form_widget(form) }}
{% embed '@theme/embeds/card.html.twig' with {collapsed: true} %}
{% import "macros/widgets.html.twig" as widgets %}
{% block box_title %}{{ 'invoices'|trans }}{% endblock %}
{% block box_body_class %}{% endblock %}
{% block box_body %}
{% if form.invoiceText is defined %}
{{ form_row(form.invoiceText) }}
{% endif %}
{% endblock %}
{% endembed %}
{{ form_rest(form) }}
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,20 +1,23 @@
{% embed '@AdminLTE/Widgets/box-widget.html.twig' with {'project': project, 'activities': activities, 'page': page} %}
{% embed '@theme/embeds/card.html.twig' with {'project': project, 'activities': activities, 'page': page} %}
{% import "activity/actions.html.twig" as actions %}
{% import "macros/widgets.html.twig" as widgets %}
{% block box_title %}{{ 'activities'|trans }}{% endblock %}
{% block box_attributes %}
id="activity_list_box" data-href="{{ path('project_activities', {'id': project.id}) }}" data-reload="kimai.activityUpdate kimai.activityDelete"
id="activity_list_box" data-reload="kimai.activityUpdate kimai.activityDelete"
{% endblock %}
{% block box_tools %}
{% if project.visible and project.customer.visible and is_granted('create_activity') %}
<a class="modal-ajax-form open-edit btn btn-default btn-sm btn-pager" data-href="{{ path('admin_activity_create_with_project', {'project': project.id}) }}" data-toggle="tooltip" data-placement="top" title="{{ 'create'|trans }}"><i class="{{ 'create'|icon }}"></i></a>
{% endif %}
{% if activities|length > 0 %}
{{ pagination(activities, { css_container_class: 'pagination pagination-sm inline', routeName: 'project_activities', routeParams: {'id': project.id} }) }}
{% endif %}
{%- if project.visible and project.customer.visible and is_granted('create_activity') -%}
{{ widgets.card_tool_button('create', {'class': 'modal-ajax-form open-edit', 'title': 'create', 'url': path('admin_activity_create_with_project', {'project': project.id})}) }}
{%- endif -%}
{% endblock %}
{% block box_body_class %}no-padding{% endblock %}
{% block box_tools_attributes %}data-page="{{ page }}"{% endblock %}
{% block box_footer %}
{%- if activities|length > 0 -%}
<div class="d-flex">
{{ pagination(activities, { css_container_class: 'pagination ms-auto m-0', routeName: 'project_activities', routeParams: {'id': project.id} }) }}
</div>
{%- endif -%}
{% endblock %}
{% block box_body_class %}{%- if activities|length > 0 -%}p-0{%- endif -%}{% endblock %}
{% block box_body %}
{% if activities|length == 0 %}
<div class="comment">{{ 'error.no_entries_found'|trans }}</div>
@@ -22,10 +25,10 @@
<table class="table table-hover dataTable">
<thead>
<tr>
<th>{{ 'label.name'|trans }}</th>
<th class="hidden-xs">{{ 'label.comment'|trans }}</th>
<th class="w-min text-center">{{ 'label.visible'|trans }}</th>
<th class="w-min text-center">{{ 'label.team'|trans }}</th>
<th>{{ 'name'|trans }}</th>
<th class="d-none d-md-table-cell">{{ 'comment'|trans }}</th>
<th class="d-none d-sm-table-cell w-min text-center">{{ 'visible'|trans }}</th>
<th class="d-none d-sm-table-cell w-min text-center">{{ 'team'|trans }}</th>
<th class="actions"></th>
</tr>
</thead>
@@ -33,9 +36,9 @@
{% for activity in activities %}
<tr {{ widgets.activity_row_attr(activity, now) }}>
<td>{{ widgets.label_activity(activity) }}</td>
<td class="hidden-xs">{{ activity.comment|comment1line(not app.user.smallLayout) }}</td>
<td class="w-min text-center">{{ widgets.label_visible(activity.visible) }}</td>
<td class="w-min text-center">{{ widgets.badge_team_access(activity.teams) }}</td>
<td class="d-none d-md-table-cell">{{ activity.comment|comment1line(false) }}</td>
<td class="d-none d-sm-table-cell w-min text-center">{{ widgets.label_visible(activity.visible) }}</td>
<td class="d-none d-sm-table-cell w-min text-center">{{ widgets.badge_team_access(activity.teams) }}</td>
<td class="actions">{{ actions.activity(activity, 'project_details', true) }}</td>
</tr>
{% endfor %}
@@ -45,7 +48,7 @@
{% endblock %}
{% endembed %}
<script type="text/javascript">
{% set eventName = app.request.xmlHttpRequest ? 'kimai.reloadPage' : 'kimai.initialized' %}
{% set eventName = kimai_context.javascriptRequest ? 'kimai.reloadPage' : 'kimai.initialized' %}
document.addEventListener('{{ eventName }}', function() {
KimaiPaginatedBoxWidget.create('#activity_list_box');
});

View File

@@ -1,93 +1,45 @@
{% extends 'base.html.twig' %}
{% extends 'datatable.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/search.html.twig" as search %}
{% import "project/actions.html.twig" as actions %}
{% set columns = {
'name': {'class': 'alwaysVisible'},
'customer': {'class': 'hidden-xs'},
'comment': {'class': 'hidden-xs hidden-sm', 'title': 'label.description'|trans},
'orderNumber': {'class': 'hidden-xs hidden-sm hidden'},
'orderDate': {'class': 'hidden-xs hidden-sm hidden'},
'project_start': {'class': 'hidden-xs hidden-sm hidden'},
'project_end': {'class': 'hidden-xs hidden-sm hidden'},
} %}
{% 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 is_granted('budget_money', 'project') %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden text-right w-min', 'title': 'label.budget'|trans},
}) %}
{% endif %}
{% if is_granted('budget_time', 'project') %}
{% set columns = columns|merge({
'timeBudget': {'class': 'hidden-xs hidden-sm hidden text-right w-min', 'title': 'label.timeBudget'|trans},
}) %}
{% endif %}
{% set columns = columns|merge({
'team': {'class': 'text-center w-min', 'orderBy': false},
'visible': {'class': 'text-center hidden w-min'},
'actions': {'class': 'actions alwaysVisible'},
}) %}
{% block datatable_row_attr %} {{ widgets.project_row_attr(entry, now) }}{% endblock %}
{% set tableName = 'project_admin' %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_search %}{{ search.searchModal(toolbarForm) }}{% endblock %}
{% block page_actions %}{{ actions.projects('index', query) }}{% endblock %}
{% block main_before %}
{{ tables.data_table_column_modal(tableName, columns) }}
{% endblock %}
{% block main %}
{% if entries.count == 0 %}
{{ widgets.nothing_found('kimai.projectUpdate kimai.projectTeamUpdate') }}
{% else %}
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.projectUpdate kimai.projectDelete kimai.projectTeamUpdate'}) }}
{% for entry in entries %}
<tr {{ widgets.project_row_attr(entry, now) }}>
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">
{{ widgets.label_name(entry.name, entry.color) }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.customer) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment1line }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'orderNumber') }}">{{ entry.orderNumber }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'orderDate') }}">{% if entry.orderDate is not null %}{{ entry.orderDate|date_full(true) }}{% endif %}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project_start') }}">{% if entry.start is not null %}{{ entry.start|date_full(true) }}{% endif %}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'project_end') }}">{% if entry.end is not null %}{{ entry.end|date_full(true) }}{% endif %}</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 %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">
{% if entry.hasBudget() and is_granted('budget', entry) %}
{{ entry.budget|money(entry.customer.currency) }}
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'timeBudget') }}">
{% if entry.hasTimeBudget() and is_granted('time', entry) %}
{{ entry.timeBudget|duration }}
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'team') }}">{{ widgets.badge_team_access(entry.teams) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.project(entry, 'index') }}</td>
</tr>
{% endfor %}
{{ tables.data_table_footer(entries, 'admin_project_paginated') }}
{% block datatable_column_value %}
{% if column == 'name' %}
{{ widgets.label_name(entry.name, entry.color|colorize(entry.name)) }}
{% elseif column == 'customer' %}
{{ widgets.label_customer(entry.customer) }}
{% elseif column == 'comment' %}
{{ entry.comment|comment1line }}
{% elseif column == 'orderNumber' %}
{{ entry.orderNumber }}
{% elseif column == 'orderDate' %}
{% if entry.orderDate is not null %}{{ entry.orderDate|date_short }}{% endif %}
{% elseif column == 'project_start' %}
{% if entry.start is not null %}{{ entry.start|date_short }}{% endif %}
{% elseif column == 'project_end' %}
{% if entry.end is not null %}{{ entry.end|date_short }}{% endif %}
{% elseif column == 'budget' %}
{% if entry.hasBudget() and is_granted('budget', entry) %}
{{ entry.budget|money(entry.customer.currency) }}
{% else %}
&ndash;
{% endif %}
{% elseif column == 'timeBudget' %}
{% if entry.hasTimeBudget() and is_granted('time', entry) %}
{{ entry.timeBudget|duration }}
{% else %}
&ndash;
{% endif %}
{% elseif column == 'billable' %}
{{ widgets.label_boolean(entry.billable) }}
{% elseif column == 'team' %}
{{ widgets.badge_team_access(entry.teams) }}
{% elseif column == 'visible' %}
{{ widgets.label_visible(entry.visible) }}
{% elseif column == 'actions' %}
{{ actions.project(entry, 'index') }}
{% elseif column starts with 'mf_' %}
{{ widgets.meta_field_value(entry, data) }}
{% endif %}
{% endblock %}

View File

@@ -1,11 +1,7 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "project/actions.html.twig" as actions %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_actions %}{{ actions.project(project, 'permissions') }}{% endblock %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% block main %}
{{ include(app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig', {
{{ include(kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig', {
'title': ('permissions'|trans({}, 'actions')) ~ ': ' ~ project.name,
'form': form,
'back': path('project_details', {'id': project.id})

View File

@@ -1,11 +1,7 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "project/actions.html.twig" as actions %}
{% block page_title %}{{ 'projects'|trans }}{% endblock %}
{% block page_actions %}{{ actions.project(project, 'rates') }}{% endblock %}
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
{% block main %}
{{ include(app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig', {
{{ include(kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig', {
'title': project.name,
'form': form,
'back': path('admin_project')