allow switching user displayed in calendar (#3314)
This commit is contained in:
@@ -11,8 +11,12 @@ namespace App\Controller;
|
|||||||
|
|
||||||
use App\Calendar\CalendarService;
|
use App\Calendar\CalendarService;
|
||||||
use App\Configuration\SystemConfiguration;
|
use App\Configuration\SystemConfiguration;
|
||||||
|
use App\Entity\User;
|
||||||
|
use App\Form\CalendarForm;
|
||||||
use App\Timesheet\TrackingModeService;
|
use App\Timesheet\TrackingModeService;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,20 +28,43 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||||||
class CalendarController extends AbstractController
|
class CalendarController extends AbstractController
|
||||||
{
|
{
|
||||||
private $calendarService;
|
private $calendarService;
|
||||||
|
private $configuration;
|
||||||
|
private $service;
|
||||||
|
|
||||||
public function __construct(CalendarService $calendarService)
|
public function __construct(CalendarService $calendarService, SystemConfiguration $configuration, TrackingModeService $service)
|
||||||
{
|
{
|
||||||
$this->calendarService = $calendarService;
|
$this->calendarService = $calendarService;
|
||||||
|
$this->configuration = $configuration;
|
||||||
|
$this->service = $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(path="/", name="calendar", methods={"GET"})
|
* @Route(path="/", name="calendar", methods={"GET"})
|
||||||
|
* @Route(path="/{profile}", name="calendar_user", methods={"GET"})
|
||||||
*/
|
*/
|
||||||
public function userCalendar(SystemConfiguration $configuration, TrackingModeService $service)
|
public function userCalendar(Request $request): Response
|
||||||
{
|
{
|
||||||
$mode = $service->getActiveMode();
|
$form = null;
|
||||||
|
$profile = $this->getUser();
|
||||||
|
|
||||||
|
if ($this->isGranted('view_other_timesheet')) {
|
||||||
|
$form = $this->createFormForGetRequest(CalendarForm::class, ['user' => $profile], [
|
||||||
|
'action' => $this->generateUrl('calendar'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$values = $form->getData();
|
||||||
|
if ($values['user'] instanceof User) {
|
||||||
|
$profile = $values['user'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mode = $this->service->getActiveMode();
|
||||||
$factory = $this->getDateTimeFactory();
|
$factory = $this->getDateTimeFactory();
|
||||||
$defaultStart = $factory->createDateTime($configuration->getTimesheetDefaultBeginTime());
|
$defaultStart = $factory->createDateTime($this->configuration->getTimesheetDefaultBeginTime());
|
||||||
|
|
||||||
$config = $this->calendarService->getConfiguration();
|
$config = $this->calendarService->getConfiguration();
|
||||||
|
|
||||||
@@ -46,16 +73,18 @@ class CalendarController extends AbstractController
|
|||||||
|
|
||||||
if ($mode->canEditBegin()) {
|
if ($mode->canEditBegin()) {
|
||||||
try {
|
try {
|
||||||
$dragAndDrop = $this->calendarService->getDragAndDropResources($this->getUser());
|
$dragAndDrop = $this->calendarService->getDragAndDropResources($profile);
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->logException($ex);
|
$this->logException($ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('calendar/user.html.twig', [
|
return $this->render('calendar/user.html.twig', [
|
||||||
|
'form' => ($form === null ? null : $form->createView()),
|
||||||
|
'user' => $profile,
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'dragAndDrop' => $dragAndDrop,
|
'dragAndDrop' => $dragAndDrop,
|
||||||
'google' => $this->calendarService->getGoogleSources($this->getUser()),
|
'google' => $this->calendarService->getGoogleSources($profile),
|
||||||
'now' => $factory->createDateTime(),
|
'now' => $factory->createDateTime(),
|
||||||
'defaultStartTime' => $defaultStart->format('h:i:s'),
|
'defaultStartTime' => $defaultStart->format('h:i:s'),
|
||||||
'is_punch_mode' => $isPunchMode,
|
'is_punch_mode' => $isPunchMode,
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ use App\Form\MultiUpdate\MultiUpdateTableDTO;
|
|||||||
use App\Form\MultiUpdate\TimesheetMultiUpdate;
|
use App\Form\MultiUpdate\TimesheetMultiUpdate;
|
||||||
use App\Form\MultiUpdate\TimesheetMultiUpdateDTO;
|
use App\Form\MultiUpdate\TimesheetMultiUpdateDTO;
|
||||||
use App\Form\TimesheetEditForm;
|
use App\Form\TimesheetEditForm;
|
||||||
|
use App\Form\TimesheetPreCreateForm;
|
||||||
use App\Form\Toolbar\TimesheetExportToolbarForm;
|
use App\Form\Toolbar\TimesheetExportToolbarForm;
|
||||||
use App\Form\Toolbar\TimesheetToolbarForm;
|
use App\Form\Toolbar\TimesheetToolbarForm;
|
||||||
use App\Repository\ActivityRepository;
|
|
||||||
use App\Repository\ProjectRepository;
|
|
||||||
use App\Repository\Query\TimesheetQuery;
|
use App\Repository\Query\TimesheetQuery;
|
||||||
use App\Repository\TagRepository;
|
use App\Repository\TagRepository;
|
||||||
use App\Repository\TimesheetRepository;
|
use App\Repository\TimesheetRepository;
|
||||||
@@ -147,48 +146,14 @@ abstract class TimesheetAbstractController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTags(TagRepository $tagRepository, $tagNames)
|
protected function create(Request $request, string $renderTemplate): Response
|
||||||
{
|
|
||||||
$tags = [];
|
|
||||||
if (!\is_array($tagNames)) {
|
|
||||||
$tagNames = explode(',', $tagNames);
|
|
||||||
}
|
|
||||||
foreach ($tagNames as $tagName) {
|
|
||||||
$tag = $tagRepository->findTagByName($tagName);
|
|
||||||
if (!$tag) {
|
|
||||||
$tag = new Tag();
|
|
||||||
$tag->setName($tagName);
|
|
||||||
}
|
|
||||||
$tags[] = $tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function create(Request $request, string $renderTemplate, ProjectRepository $projectRepository, ActivityRepository $activityRepository, TagRepository $tagRepository): Response
|
|
||||||
{
|
{
|
||||||
$entry = $this->service->createNewTimesheet($this->getUser());
|
$entry = $this->service->createNewTimesheet($this->getUser());
|
||||||
|
|
||||||
if ($request->query->get('project')) {
|
$preForm = $this->createFormForGetRequest(TimesheetPreCreateForm::class, $entry, [
|
||||||
$project = $projectRepository->find($request->query->get('project'));
|
'include_user' => $this->includeUserInForms('create'),
|
||||||
$entry->setProject($project);
|
]);
|
||||||
}
|
$preForm->submit($request->query->all(), false);
|
||||||
|
|
||||||
if ($request->query->get('activity')) {
|
|
||||||
$activity = $activityRepository->find($request->query->get('activity'));
|
|
||||||
$entry->setActivity($activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->query->get('description')) {
|
|
||||||
$description = $request->query->get('description');
|
|
||||||
$entry->setDescription($description);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->query->get('tags')) {
|
|
||||||
foreach ($this->getTags($tagRepository, $request->query->get('tags')) as $tag) {
|
|
||||||
$entry->addTag($tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->service->prepareNewTimesheet($entry, $request);
|
$this->service->prepareNewTimesheet($entry, $request);
|
||||||
$createForm = $this->getCreateForm($entry);
|
$createForm = $this->getCreateForm($entry);
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ use App\Entity\Timesheet;
|
|||||||
use App\Event\TimesheetMetaDisplayEvent;
|
use App\Event\TimesheetMetaDisplayEvent;
|
||||||
use App\Export\ServiceExport;
|
use App\Export\ServiceExport;
|
||||||
use App\Form\TimesheetEditForm;
|
use App\Form\TimesheetEditForm;
|
||||||
use App\Repository\ActivityRepository;
|
|
||||||
use App\Repository\ProjectRepository;
|
|
||||||
use App\Repository\TagRepository;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -90,9 +87,9 @@ class TimesheetController extends TimesheetAbstractController
|
|||||||
* @Route(path="/create", name="timesheet_create", methods={"GET", "POST"})
|
* @Route(path="/create", name="timesheet_create", methods={"GET", "POST"})
|
||||||
* @Security("is_granted('create_own_timesheet')")
|
* @Security("is_granted('create_own_timesheet')")
|
||||||
*/
|
*/
|
||||||
public function createAction(Request $request, ProjectRepository $projectRepository, ActivityRepository $activityRepository, TagRepository $tagRepository): Response
|
public function createAction(Request $request): Response
|
||||||
{
|
{
|
||||||
return $this->create($request, 'timesheet/edit.html.twig', $projectRepository, $activityRepository, $tagRepository);
|
return $this->create($request, 'timesheet/edit.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCreateForm(Timesheet $entry): FormInterface
|
protected function getCreateForm(Timesheet $entry): FormInterface
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ use App\Export\ServiceExport;
|
|||||||
use App\Form\Model\MultiUserTimesheet;
|
use App\Form\Model\MultiUserTimesheet;
|
||||||
use App\Form\TimesheetAdminEditForm;
|
use App\Form\TimesheetAdminEditForm;
|
||||||
use App\Form\TimesheetMultiUserEditForm;
|
use App\Form\TimesheetMultiUserEditForm;
|
||||||
use App\Repository\ActivityRepository;
|
|
||||||
use App\Repository\ProjectRepository;
|
|
||||||
use App\Repository\Query\TimesheetQuery;
|
use App\Repository\Query\TimesheetQuery;
|
||||||
use App\Repository\TagRepository;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
@@ -83,9 +80,9 @@ class TimesheetTeamController extends TimesheetAbstractController
|
|||||||
* @Route(path="/create", name="admin_timesheet_create", methods={"GET", "POST"})
|
* @Route(path="/create", name="admin_timesheet_create", methods={"GET", "POST"})
|
||||||
* @Security("is_granted('create_other_timesheet')")
|
* @Security("is_granted('create_other_timesheet')")
|
||||||
*/
|
*/
|
||||||
public function createAction(Request $request, ProjectRepository $projectRepository, ActivityRepository $activityRepository, TagRepository $tagRepository): Response
|
public function createAction(Request $request): Response
|
||||||
{
|
{
|
||||||
return $this->create($request, 'timesheet-team/edit.html.twig', $projectRepository, $activityRepository, $tagRepository);
|
return $this->create($request, 'timesheet-team/edit.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
34
src/Form/CalendarForm.php
Normal file
34
src/Form/CalendarForm.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai time-tracking app.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Form\Type\UserType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class CalendarForm extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder->add('user', UserType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'attr' => ['onchange' => 'this.form.submit()']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'csrf_protection' => false,
|
||||||
|
'method' => 'GET',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/Form/TimesheetPreCreateForm.php
Normal file
46
src/Form/TimesheetPreCreateForm.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai time-tracking app.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Form\Type\DescriptionType;
|
||||||
|
use App\Form\Type\TagsInputType;
|
||||||
|
use App\Form\Type\UserType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values that are allowed to be pre-set via URL.
|
||||||
|
*/
|
||||||
|
class TimesheetPreCreateForm extends AbstractType
|
||||||
|
{
|
||||||
|
use FormTrait;
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$this->addProject($builder, true, null, null, ['required' => false]);
|
||||||
|
$this->addActivity($builder, null, null, ['required' => false]);
|
||||||
|
$builder->add('description', DescriptionType::class, ['required' => false]);
|
||||||
|
$builder->add('tags', TagsInputType::class, ['required' => false]);
|
||||||
|
if ($options['include_user']) {
|
||||||
|
$builder->add('user', UserType::class, ['required' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'csrf_protection' => false,
|
||||||
|
'include_user' => false,
|
||||||
|
'method' => 'GET',
|
||||||
|
'validation_groups' => ['none'] // otherwise the default timesheet validations would trigger
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,9 +17,6 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|||||||
|
|
||||||
final class TimesheetZeroDurationValidator extends ConstraintValidator
|
final class TimesheetZeroDurationValidator extends ConstraintValidator
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var SystemConfiguration
|
|
||||||
*/
|
|
||||||
private $configuration;
|
private $configuration;
|
||||||
|
|
||||||
public function __construct(SystemConfiguration $configuration)
|
public function __construct(SystemConfiguration $configuration)
|
||||||
@@ -45,7 +42,16 @@ final class TimesheetZeroDurationValidator extends ConstraintValidator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($timesheet->getDuration() == 0) {
|
if ($timesheet->isRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$duration = 0;
|
||||||
|
if ($timesheet->getEnd() !== null && $timesheet->getBegin() !== null) {
|
||||||
|
$duration = $timesheet->getEnd()->getTimestamp() - $timesheet->getBegin()->getTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($duration <= 0) {
|
||||||
$this->context->buildViolation($constraint->message)
|
$this->context->buildViolation($constraint->message)
|
||||||
->atPath('duration')
|
->atPath('duration')
|
||||||
->setTranslationDomain('validators')
|
->setTranslationDomain('validators')
|
||||||
|
|||||||
@@ -11,8 +11,17 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% set hasDragAndDrop = (config.dragDropAmount > 0 and dragAndDrop is not empty and (dragAndDrop|filter(s => s.entries|length > 0)|length > 0)) %}
|
{% set hasDragAndDrop = (config.dragDropAmount > 0 and dragAndDrop is not empty and (dragAndDrop|filter(s => s.entries|length > 0)|length > 0)) %}
|
||||||
{% if hasDragAndDrop %}
|
{% if hasDragAndDrop or form is not null %}
|
||||||
<div class="hidden-xs col-sm-5 col-md-4 col-lg-3 no-print">
|
<div class="hidden-xs col-sm-5 col-md-4 col-lg-3 no-print">
|
||||||
|
{% if form is not null %}
|
||||||
|
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
||||||
|
{% block box_body %}
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_widget(form) }}
|
||||||
|
{{ form_end(form) }}
|
||||||
|
{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endif %}
|
||||||
{% for source in dragAndDrop|filter(s => s.entries|length > 0) %}
|
{% for source in dragAndDrop|filter(s => s.entries|length > 0) %}
|
||||||
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
||||||
{% block box_title %}{{ source.title|trans }}{% endblock %}
|
{% block box_title %}{{ source.title|trans }}{% endblock %}
|
||||||
@@ -58,6 +67,19 @@
|
|||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
{% set calendarSelector = '#timesheet_calendar' %}
|
{% set calendarSelector = '#timesheet_calendar' %}
|
||||||
|
{% set createParams = '' %}
|
||||||
|
{% set createRoute = 'timesheet_create' %}
|
||||||
|
{% set canDelete = is_granted('delete_own_timesheet') %}
|
||||||
|
{% set canCreate = is_granted('create_own_timesheet') %}
|
||||||
|
{% set canEdit = is_granted('edit_own_timesheet') %}
|
||||||
|
{% if user != app.user %}
|
||||||
|
{% set createParams = '&user=' ~ user.id %}
|
||||||
|
{% set createRoute = 'admin_timesheet_create' %}
|
||||||
|
{% set canDelete = is_granted('delete_other_timesheet') %}
|
||||||
|
{% set canCreate = is_granted('create_other_timesheet') %}
|
||||||
|
{% set canEdit = is_granted('edit_other_timesheet') %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
<script>
|
<script>
|
||||||
activatePopover();
|
activatePopover();
|
||||||
@@ -237,7 +259,7 @@
|
|||||||
googleCalendarApiKey: '{{ google.apiKey }}',
|
googleCalendarApiKey: '{{ google.apiKey }}',
|
||||||
{% endif %}
|
{% endif %}
|
||||||
header : {
|
header : {
|
||||||
left : 'prev,next today{% if is_granted('delete_own_timesheet') %} deleteButton{% endif %}',
|
left : 'prev,next today{% if canDelete %} deleteButton{% endif %}',
|
||||||
center: 'title',
|
center: 'title',
|
||||||
right : 'month,agendaWeek,agendaDay'
|
right : 'month,agendaWeek,agendaDay'
|
||||||
},
|
},
|
||||||
@@ -347,7 +369,7 @@
|
|||||||
events: function(start, end, timezone, callback) {
|
events: function(start, end, timezone, callback) {
|
||||||
let from = moment(start.format()).format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
let from = moment(start.format()).format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
||||||
let to = moment(end.format()).format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
let to = moment(end.format()).format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
||||||
API.get('{{ path('get_timesheets') }}?size=1000&full=true&begin='+from+'&end='+to, {}, function(result) {
|
API.get('{{ path('get_timesheets') }}?user={{ user.id }}&size=1000&full=true&begin='+from+'&end='+to, {}, function(result) {
|
||||||
let apiEvents = [];
|
let apiEvents = [];
|
||||||
for (const record of result) {
|
for (const record of result) {
|
||||||
apiEvents.push(convertApiTimesheetToCalendar(record));
|
apiEvents.push(convertApiTimesheetToCalendar(record));
|
||||||
@@ -436,7 +458,7 @@
|
|||||||
$element.data('ids', event.id + ' ' + ids);
|
$element.data('ids', event.id + ' ' + ids);
|
||||||
$element.text(DATES.formatSeconds(duration));
|
$element.text(DATES.formatSeconds(duration));
|
||||||
},
|
},
|
||||||
{% if not is_punch_mode and is_granted('create_own_timesheet') %}
|
{% if not is_punch_mode and canCreate %}
|
||||||
dayClick: function(date, jsEvent, view) {
|
dayClick: function(date, jsEvent, view) {
|
||||||
{#
|
{#
|
||||||
Day-clicks are always triggered, unless a selection was created.
|
Day-clicks are always triggered, unless a selection was created.
|
||||||
@@ -447,7 +469,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let createUrl = '{{ path('timesheet_create') }}?begin=' + date.format();
|
let createUrl = '{{ path(createRoute) }}?begin=' + date.format() + '{{ createParams|raw }}';
|
||||||
kimai.getPlugin('modal').openUrlInModal(createUrl);
|
kimai.getPlugin('modal').openUrlInModal(createUrl);
|
||||||
},
|
},
|
||||||
selectable: true,
|
selectable: true,
|
||||||
@@ -459,11 +481,11 @@
|
|||||||
#}
|
#}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let createUrl = '{{ path('timesheet_create') }}' + '?from=' + start.format() + '&to=' + end.format();
|
let createUrl = '{{ path(createRoute) }}' + '?from=' + start.format() + '&to=' + end.format() + '{{ createParams|raw }}';
|
||||||
kimai.getPlugin('modal').openUrlInModal(createUrl);
|
kimai.getPlugin('modal').openUrlInModal(createUrl);
|
||||||
},
|
},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('edit_own_timesheet') %}
|
{% if canEdit %}
|
||||||
eventClick: function(eventObj, jsEvent, view) {
|
eventClick: function(eventObj, jsEvent, view) {
|
||||||
if (eventObj.source.ajaxSettings !== undefined) {
|
if (eventObj.source.ajaxSettings !== undefined) {
|
||||||
jsEvent.preventDefault();
|
jsEvent.preventDefault();
|
||||||
@@ -479,7 +501,7 @@
|
|||||||
},
|
},
|
||||||
eventDragStop: function(event, jsEvent, ui, view) {
|
eventDragStop: function(event, jsEvent, ui, view) {
|
||||||
activatePopover();
|
activatePopover();
|
||||||
{% if is_granted('delete_own_timesheet') %}
|
{% if canDelete %}
|
||||||
var trash = jQuery('.fc-deleteButton-button');
|
var trash = jQuery('.fc-deleteButton-button');
|
||||||
var offset = trash.offset();
|
var offset = trash.offset();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user