optimizations (#2904)
* calc once, then re-use * prevent invalid theme switch * allow to turn off weekly-quick-entries by permissions * remove 00:00 from date-times that likely do not need a time * fix datepicker out of window
This commit is contained in:
@@ -34,6 +34,7 @@ export default class KimaiDatePicker extends KimaiPlugin {
|
||||
singleDatePicker: true,
|
||||
showDropdowns: true,
|
||||
autoUpdateInput: false,
|
||||
drops: 'down',
|
||||
locale: {
|
||||
format: localeFormat,
|
||||
firstDay: firstDow,
|
||||
@@ -47,7 +48,8 @@ export default class KimaiDatePicker extends KimaiPlugin {
|
||||
|
||||
jQuery(this).on('show.daterangepicker', function (ev, picker) {
|
||||
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
|
||||
picker.drops = 'up';
|
||||
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
|
||||
picker.drops = 'auto';
|
||||
picker.move();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,6 +52,7 @@ export default class KimaiDateRangePicker extends KimaiPlugin {
|
||||
autoUpdateInput: false,
|
||||
autoApply: false,
|
||||
linkedCalendars: true,
|
||||
drops: 'down',
|
||||
locale: {
|
||||
separator: separator,
|
||||
format: localeFormat,
|
||||
@@ -68,7 +69,8 @@ export default class KimaiDateRangePicker extends KimaiPlugin {
|
||||
|
||||
jQuery(this).on('show.daterangepicker', function (ev, picker) {
|
||||
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
|
||||
picker.drops = 'up';
|
||||
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
|
||||
picker.drops = 'auto';
|
||||
picker.move();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,6 +37,7 @@ export default class KimaiDateTimePicker extends KimaiPlugin {
|
||||
timePicker24Hour: is24hours,
|
||||
showDropdowns: true,
|
||||
autoUpdateInput: false,
|
||||
drops: 'down',
|
||||
locale: {
|
||||
format: localeFormat,
|
||||
firstDay: firstDow,
|
||||
@@ -50,7 +51,8 @@ export default class KimaiDateTimePicker extends KimaiPlugin {
|
||||
|
||||
jQuery(this).on('show.daterangepicker', function (ev, picker) {
|
||||
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
|
||||
picker.drops = 'up';
|
||||
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
|
||||
picker.drops = 'auto';
|
||||
picker.move();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ kimai:
|
||||
CUSTOMERS_TEAMLEAD: ['view_teamlead_customer','budget_teamlead_customer','comments_teamlead_customer','comments_create_teamlead_customer','details_teamlead_customer']
|
||||
INVOICE: ['view_invoice','create_invoice']
|
||||
INVOICE_ADMIN: ['manage_invoice_template']
|
||||
TIMESHEET: ['view_own_timesheet','start_own_timesheet','stop_own_timesheet','create_own_timesheet','edit_own_timesheet','export_own_timesheet','delete_own_timesheet']
|
||||
TIMESHEET: ['view_own_timesheet','start_own_timesheet','stop_own_timesheet','create_own_timesheet','edit_own_timesheet','export_own_timesheet','delete_own_timesheet','weekly_own_timesheet']
|
||||
TIMESHEET_OTHER: ['view_other_timesheet','start_other_timesheet','stop_other_timesheet','create_other_timesheet','edit_other_timesheet','export_other_timesheet','delete_other_timesheet']
|
||||
PROFILE: ['view_own_profile','edit_own_profile','password_own_profile','preferences_own_profile','api-token_own_profile']
|
||||
PROFILE_OTHER: ['view_other_profile','edit_other_profile','password_other_profile','roles_other_profile','preferences_other_profile','api-token_other_profile','teams_other_profile']
|
||||
|
||||
@@ -48,5 +48,6 @@
|
||||
},
|
||||
"browserslist": [
|
||||
"defaults"
|
||||
]
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
2
public/build/app.3947eaef.js
Normal file
2
public/build/app.3947eaef.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
|
||||
"app": {
|
||||
"js": [
|
||||
"build/runtime.b8e7bb04.js",
|
||||
"build/app.da44b7f8.js"
|
||||
"build/app.3947eaef.js"
|
||||
],
|
||||
"css": [
|
||||
"build/app.3bc2b4d9.css"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"build/app.css": "build/app.3bc2b4d9.css",
|
||||
"build/app.js": "build/app.da44b7f8.js",
|
||||
"build/app.js": "build/app.3947eaef.js",
|
||||
"build/invoice.css": "build/invoice.ff32661a.css",
|
||||
"build/invoice.js": "build/invoice.19f36eca.js",
|
||||
"build/invoice-pdf.css": "build/invoice-pdf.9a7468ef.css",
|
||||
|
||||
@@ -25,7 +25,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Controller used to enter times in weekly form.
|
||||
*
|
||||
* @Route(path="/quick_entry")
|
||||
* @Security("is_granted('edit_own_timesheet')")
|
||||
* @Security("is_granted('weekly_own_timesheet') and is_granted('edit_own_timesheet')")
|
||||
*/
|
||||
class QuickEntryController extends AbstractController
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ final class MenuSubscriber implements EventSubscriberInterface
|
||||
$timesheets->setChildRoutes(['timesheet_export', 'timesheet_edit', 'timesheet_create', 'timesheet_multi_update']);
|
||||
$menu->addItem($timesheets);
|
||||
|
||||
if ($auth->isGranted('edit_own_timesheet')) {
|
||||
if ($auth->isGranted('weekly_own_timesheet') && $auth->isGranted('edit_own_timesheet')) {
|
||||
$mode = $this->trackingModeService->getActiveMode();
|
||||
if ($mode->canEditDuration() || $mode->canEditEnd()) {
|
||||
$menu->addItem(
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace App\EventSubscriber;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use App\Form\Type\SkinType;
|
||||
use KevinPapst\AdminLTEBundle\Helper\ContextHelper;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\KernelEvent;
|
||||
@@ -70,7 +71,7 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
$name = $ref->getName();
|
||||
switch ($name) {
|
||||
case UserPreference::SKIN:
|
||||
if (!empty($ref->getValue())) {
|
||||
if (!empty($ref->getValue()) && \in_array($ref->getValue(), SkinType::THEMES)) {
|
||||
$this->helper->setOption('skin', 'skin-' . $ref->getValue());
|
||||
}
|
||||
break;
|
||||
@@ -79,7 +80,7 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
if ($ref->getValue() === 'boxed') {
|
||||
$this->helper->setOption('boxed_layout', true);
|
||||
$this->helper->setOption('fixed_layout', false);
|
||||
} elseif ($ref->getValue() === 'fixed') {
|
||||
} else {
|
||||
$this->helper->setOption('boxed_layout', false);
|
||||
$this->helper->setOption('fixed_layout', true);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,21 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
class SkinType extends AbstractType
|
||||
{
|
||||
public const THEMES = [
|
||||
'blue' => 'blue',
|
||||
'black' => 'black',
|
||||
'green' => 'green',
|
||||
'purple' => 'purple',
|
||||
'red' => 'red',
|
||||
'yellow' => 'yellow',
|
||||
'blue-light' => 'blue-light',
|
||||
'black-light' => 'black-light',
|
||||
'green-light' => 'green-light',
|
||||
'purple-light' => 'purple-light',
|
||||
'red-light' => 'red-light',
|
||||
'yellow-light' => 'yellow-light',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -25,20 +40,7 @@ class SkinType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'required' => true,
|
||||
'choices' => [
|
||||
'blue' => 'blue',
|
||||
'black' => 'black',
|
||||
'green' => 'green',
|
||||
'purple' => 'purple',
|
||||
'red' => 'red',
|
||||
'yellow' => 'yellow',
|
||||
'blue-light' => 'blue-light',
|
||||
'black-light' => 'black-light',
|
||||
'green-light' => 'green-light',
|
||||
'purple-light' => 'purple-light',
|
||||
'red-light' => 'red-light',
|
||||
'yellow-light' => 'yellow-light',
|
||||
]
|
||||
'choices' => self::THEMES,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,11 +164,12 @@ final class LocaleFormatExtensions extends AbstractExtension
|
||||
|
||||
/**
|
||||
* @param DateTime|string $date
|
||||
* @param bool $stripMidnight
|
||||
* @return bool|false|string
|
||||
*/
|
||||
public function dateTimeFull($date)
|
||||
public function dateTimeFull($date, bool $stripMidnight = false)
|
||||
{
|
||||
return $this->getFormatter()->dateTimeFull($date);
|
||||
return $this->getFormatter()->dateTimeFull($date, $stripMidnight);
|
||||
}
|
||||
|
||||
public function createDate(string $date, ?User $user = null): \DateTime
|
||||
|
||||
@@ -239,9 +239,10 @@ final class LocaleFormatter
|
||||
|
||||
/**
|
||||
* @param DateTime|string $date
|
||||
* @param bool $stripMidnight
|
||||
* @return bool|false|string
|
||||
*/
|
||||
public function dateTimeFull($date)
|
||||
public function dateTimeFull($date, bool $stripMidnight = false)
|
||||
{
|
||||
if (null === $this->dateTimeTypeFormat) {
|
||||
$this->dateTimeTypeFormat = $this->localeFormats->getDateTimeTypeFormat();
|
||||
@@ -255,13 +256,19 @@ final class LocaleFormatter
|
||||
}
|
||||
}
|
||||
|
||||
$format = $this->dateTimeTypeFormat;
|
||||
|
||||
if ($stripMidnight && $date->format('H') == '00' && $date->format('i') == '00') {
|
||||
$format = $this->localeFormats->getDateTypeFormat();
|
||||
}
|
||||
|
||||
$formatter = new IntlDateFormatter(
|
||||
$this->locale,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
IntlDateFormatter::MEDIUM,
|
||||
date_default_timezone_get(),
|
||||
IntlDateFormatter::GREGORIAN,
|
||||
$this->dateTimeTypeFormat
|
||||
$format
|
||||
);
|
||||
|
||||
return $formatter->format($date);
|
||||
|
||||
@@ -478,15 +478,16 @@
|
||||
{% elseif '\\LanguageType' in type %}
|
||||
{{ value|language }}
|
||||
{% elseif '\\MoneyType' in type %}
|
||||
{% set classname = class_name(entity) %}
|
||||
{% if entity is null %}
|
||||
{{ value }}
|
||||
{% elseif class_name(entity) == 'App\\Entity\\Timesheet' %}
|
||||
{% elseif classname == 'App\\Entity\\Timesheet' %}
|
||||
{{ value|money(entity.project.customer.currency) }}
|
||||
{% elseif class_name(entity) == 'App\\Entity\\Customer' %}
|
||||
{% elseif classname == 'App\\Entity\\Customer' %}
|
||||
{{ value|money(entity.currency) }}
|
||||
{% elseif class_name(entity) == 'App\\Entity\\Project' %}
|
||||
{% elseif classname == 'App\\Entity\\Project' %}
|
||||
{{ value|money(entity.customer.currency) }}
|
||||
{% elseif class_name(entity) == 'App\\Entity\\Activity' and entity.project is not null %}
|
||||
{% elseif classname == 'App\\Entity\\Activity' and entity.project is not null %}
|
||||
{{ value|money(entity.project.customer.currency) }}
|
||||
{% else %}
|
||||
{{ value }}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<tr>
|
||||
<th>{{ 'label.orderDate'|trans }}</th>
|
||||
<td colspan="3">
|
||||
{{ project.orderDate|date_full }}
|
||||
{{ project.orderDate|date_full(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
@@ -69,7 +69,7 @@
|
||||
<tr>
|
||||
<th>{{ 'label.project_start'|trans }}</th>
|
||||
<td colspan="3">
|
||||
{{ project.start|date_full }}
|
||||
{{ project.start|date_full(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
@@ -77,7 +77,7 @@
|
||||
<tr>
|
||||
<th>{{ 'label.project_end'|trans }}</th>
|
||||
<td colspan="3">
|
||||
{{ project.end|date_full }}
|
||||
{{ project.end|date_full(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
<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 }}{% endif %}</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'project_start') }}">{% if entry.start is not null %}{{ entry.start|date_full }}{% endif %}</td>
|
||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'project_end') }}">{% if entry.end is not null %}{{ entry.end|date_full }}{% endif %}</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) }}
|
||||
|
||||
@@ -35,7 +35,7 @@ class PermissionControllerTest extends ControllerBaseTest
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
|
||||
$this->assertAccessIsGranted($client, '/admin/permissions');
|
||||
$this->assertHasDataTable($client);
|
||||
$this->assertDataTableRowCount($client, 'datatable_user_admin_permissions', 119);
|
||||
$this->assertDataTableRowCount($client, 'datatable_user_admin_permissions', 120);
|
||||
$this->assertPageActions($client, [
|
||||
//'back' => $this->createUrl('/admin/user/'),
|
||||
'create modal-ajax-form' => $this->createUrl('/admin/permissions/roles/create'),
|
||||
|
||||
@@ -1919,9 +1919,9 @@ caniuse-api@^3.0.0:
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001214:
|
||||
version "1.0.30001219"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001219.tgz#5bfa5d0519f41f993618bd318f606a4c4c16156b"
|
||||
integrity sha512-c0yixVG4v9KBc/tQ2rlbB3A/bgBFRvl8h8M4IeUbqCca4gsiCfvtaheUssbnux/Mb66Vjz7x8yYjDgYcNQOhyQ==
|
||||
version "1.0.30001276"
|
||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001276.tgz"
|
||||
integrity sha512-psUNoaG1ilknZPxi8HuhQWobuhLqtYSRUxplfVkEJdgZNB9TETVYGSBtv4YyfAdGvE6gn2eb0ztiXqHoWJcGnw==
|
||||
|
||||
caseless@~0.12.0:
|
||||
version "0.12.0"
|
||||
|
||||
Reference in New Issue
Block a user