added API for handling work contract times (#4016)

This commit is contained in:
Kevin Papst
2023-05-13 01:24:15 +02:00
committed by GitHub
parent 4b2a3669e6
commit 43bd7bf1ab
53 changed files with 2684 additions and 27 deletions

View File

@@ -14,6 +14,7 @@ use App\Entity\UserPreference;
use App\Event\PrepareUserEvent;
use App\Form\Model\TotpActivation;
use App\Form\UserApiTokenType;
use App\Form\UserContractType;
use App\Form\UserEditType;
use App\Form\UserPasswordType;
use App\Form\UserPreferencesForm;
@@ -178,6 +179,32 @@ final class ProfileController extends AbstractController
]);
}
#[Route(path: '/{username}/contract', name: 'user_profile_contract', methods: ['GET', 'POST'])]
#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[IsGranted('contract', 'profile')]
public function contractAction(User $profile, Request $request, UserRepository $userRepository): Response
{
$form = $this->createForm(UserContractType::class, $profile, [
'action' => $this->generateUrl('user_profile_contract', ['username' => $profile->getUserIdentifier()]),
'method' => 'POST',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$userRepository->saveUser($profile);
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('user_profile_contract', ['username' => $profile->getUserIdentifier()]);
}
return $this->render('user/contract.html.twig', [
'tab' => 'contract',
'user' => $profile,
'form' => $form->createView(),
]);
}
#[Route(path: '/{username}/teams', name: 'user_profile_teams', methods: ['GET', 'POST'])]
#[IsGranted('teams', 'profile')]
public function teamsAction(User $profile, Request $request, UserRepository $userRepository, TeamRepository $teamRepository): Response