link reporting screen for users and month charts (#1842)

This commit is contained in:
Kevin Papst
2020-07-26 20:28:48 +02:00
committed by GitHub
parent 130e6ac057
commit 599b18ac99
9 changed files with 80 additions and 23 deletions

View File

@@ -64,21 +64,23 @@ final class ReportingController extends AbstractController
$values->setDate($this->dateTimeFactory->getStartOfMonth());
$form = $this->createForm(MonthByUserForm::class, $values, [
'method' => 'POST',
'include_user' => $this->isGranted('view_other_timesheet') && $user->hasTeamAssignment(),
]);
$form->handleRequest($request);
$form->submit($request->query->all(), false);
if ($form->isSubmitted() && !$form->isValid()) {
if ($values->getUser() === null) {
$values->setUser($user);
$values->setDate($this->dateTimeFactory->getStartOfMonth());
}
if ($user !== $values->getUser() && !$this->isGranted('view_other_timesheet')) {
throw new AccessDeniedException('User is not allowed to see other users timesheet');
}
if ($values->getDate() === null) {
$values->setDate($this->dateTimeFactory->getStartOfMonth());
}
$start = $values->getDate();
$start->modify('first day of 00:00:00');
@@ -124,16 +126,18 @@ final class ReportingController extends AbstractController
$values = new MonthlyUserList();
$values->setDate($this->dateTimeFactory->getStartOfMonth());
$form = $this->createForm(MonthlyUserListForm::class, $values, [
'method' => 'POST',
]);
$form = $this->createForm(MonthlyUserListForm::class, $values, []);
$form->handleRequest($request);
$form->submit($request->query->all(), false);
if ($form->isSubmitted() && !$form->isValid()) {
$values->setDate($this->dateTimeFactory->getStartOfMonth());
}
if ($values->getDate() === null) {
$values->setDate($this->dateTimeFactory->getStartOfMonth());
}
$start = $values->getDate();
$start->modify('first day of 00:00:00');