Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
{% macro teams(view, query) %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% set event = actions(app.user, 'teams', view, {'query': query}) %}
|
||||
{{ widgets.page_actions(event.actions) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro team(team, view) %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% set event = actions(app.user, 'team', view, {'team': team, 'token': csrf_token('team.duplicate')}) %}
|
||||
{% set event = actions(app.user, 'team', view, {'team': team}) %}
|
||||
{% if view == 'index' %}
|
||||
{{ widgets.table_actions(event.actions) }}
|
||||
{% else %}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "team/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'teams.title'|trans({}, 'teams') }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.team(team, 'edit') }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
@@ -11,15 +7,17 @@
|
||||
{% include 'team/member-form.html.twig' %}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{% if not customerForm is null %}
|
||||
{{ include('default/_form.html.twig', {
|
||||
{% set formEditTemplate = kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
|
||||
|
||||
{% if customerForm is defined and customerForm is not null %}
|
||||
{{ include(formEditTemplate, {
|
||||
'title': 'teams.customer_access'|trans({}, 'teams'),
|
||||
'form': customerForm,
|
||||
}) }}
|
||||
{% endif %}
|
||||
|
||||
{% if not projectForm is null %}
|
||||
{{ include('default/_form.html.twig', {
|
||||
{% if projectForm is defined and projectForm is not null %}
|
||||
{{ include(formEditTemplate, {
|
||||
'title': 'teams.project_access'|trans({}, 'teams'),
|
||||
'form': projectForm,
|
||||
}) }}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{% 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 %}
|
||||
{% import "team/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'teams.title'|trans({}, 'teams') }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.team(team, 'edit') }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'team/member-form.html.twig' %}
|
||||
|
||||
@@ -1,55 +1,36 @@
|
||||
{% 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 "team/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'teams.title'|trans({}, 'teams') }}{% endblock %}
|
||||
{% block page_search %}{{ search.searchModal(toolbarForm) }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.teams('index', query) }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% if teams|length == 0 %}
|
||||
{{ widgets.nothing_found('kimai.teamUpdate') }}
|
||||
{% else %}
|
||||
|
||||
{% set columns = {
|
||||
'name': {'class': ''},
|
||||
'teamlead': {'class': '', 'orderBy': false},
|
||||
'user': {'class': 'hidden-xs', 'orderBy': false},
|
||||
'actions': {'class': 'actions alwaysVisible'},
|
||||
} %}
|
||||
|
||||
{% set tableName = 'admin_teams' %}
|
||||
|
||||
{{ tables.datatable_header(tableName, columns, query, {'reload': 'kimai.teamUpdate'}) }}
|
||||
{% for team in teams %}
|
||||
<tr{% if is_granted('edit', team) %} class="open-edit alternative-link" data-href="{{ path('admin_team_edit', {'id': team.id}) }}"{% endif %}>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'name') }}">
|
||||
{{ widgets.label_name(team.name, team.color) }}
|
||||
</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'teamlead') }}">
|
||||
{% for member in team.members %}
|
||||
{% if member.teamlead %}
|
||||
{{ widgets.label_user(member.user) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'user') }}">
|
||||
{% for member in team.members %}
|
||||
{% if not member.teamlead %}
|
||||
{{ widgets.label_user(member.user) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">
|
||||
{{ actions.team(team, 'index') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{{ tables.data_table_footer(teams, 'admin_team_paginated') }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block datatable_row %}
|
||||
<tr{% if is_granted('edit', entry) %} class="open-edit alternative-link" data-href="{{ path('admin_team_edit', {'id': entry.id}) }}"{% endif %}>
|
||||
<td class="{{ tables.class(dataTable, 'name') }}">
|
||||
{{ widgets.label_name(entry.name, entry.color|colorize(entry.name)) }}
|
||||
</td>
|
||||
<td class="{{ tables.class(dataTable, 'teamlead') }}">
|
||||
{% for member in entry.members %}
|
||||
{% if member.teamlead %}
|
||||
{{ widgets.label_user(member.user) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="{{ tables.class(dataTable, 'teamlead_avatar') }}">
|
||||
{% for member in entry.members|sort((a, b) => b.teamlead <=> a.teamlead) %}
|
||||
{% set user = member.user %}
|
||||
{% set tooltip = member.teamlead ? ('teamlead'|trans ~ ': ' ~ user.displayName) : null %}
|
||||
{{ widgets.user_avatar(user, tooltip, 'avatar-rounded', (member.teamlead ? 'info' : null)) }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="{{ tables.class(dataTable, 'user') }}">
|
||||
{% for member in entry.members %}
|
||||
{% if not member.teamlead %}
|
||||
{{ widgets.label_user(member.user) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="{{ tables.class(dataTable, 'actions') }}">
|
||||
{% set event = actions(app.user, 'team', 'index', {'team': entry}) %}
|
||||
{{ widgets.table_actions(event.actions) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% 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': team.name|default('create'|trans),
|
||||
'form': form,
|
||||
@@ -17,28 +17,6 @@
|
||||
</div>
|
||||
{{ form_row(form.users) }}
|
||||
{{ form_row(form.members) }}
|
||||
{{ form_widget(form) }}
|
||||
{% endblock %}
|
||||
{% block form_after %}
|
||||
{% set blockPrefix = form.vars.id %}
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery('#{{ blockPrefix }}_users').change(function (e) {
|
||||
var select = jQuery(e.target);
|
||||
var selected = select.find(':selected');
|
||||
var username = selected.text();
|
||||
var userid = select.val();
|
||||
selected.remove();
|
||||
|
||||
var prototype = jQuery('#{{ blockPrefix }}_members');
|
||||
var counter = prototype.data('widget-counter') || prototype.children().length;
|
||||
var newWidget = prototype.attr('data-prototype');
|
||||
newWidget = newWidget.replace(/__name__/g, counter);
|
||||
newWidget = newWidget.replace(/__USERNAME__/g, username);
|
||||
prototype.data('widget-counter', ++counter);
|
||||
jQuery(newWidget).prependTo(prototype).find('input[type=hidden]').val(userid);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ form_rest(form) }}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
Reference in New Issue
Block a user