feat: extend and refactor feedback providing for role house manager
This commit is contained in:
@@ -30,20 +30,29 @@ class ProvideController extends AbstractController
|
||||
{
|
||||
$assignment = $disposition->getAssignment();
|
||||
$destination = $assignment->getDestination();
|
||||
|
||||
if (null !== $disposition->getFeedback()) {
|
||||
$this->addFlash('error', 'Es liegt schon ein Feedback vor.');
|
||||
|
||||
return $this->redirectToRoute('app_house_manager_feedback_index');
|
||||
}
|
||||
|
||||
$feedbackSet = $assignment
|
||||
->getJobProfile()
|
||||
->getFeedbackSet()
|
||||
;
|
||||
$feedback = new Feedback();
|
||||
|
||||
$feedback = new Feedback($assignment);
|
||||
|
||||
$form = $this->createForm(FeedbackType::class, $feedback, ['feedback_set' => $feedbackSet]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$feedback
|
||||
->setAssignmentDestination($destination)
|
||||
->setAssignmentDate($assignment->getEffectivePeriod()->start->toDateTimeImmutable())
|
||||
;
|
||||
// Feedbacks without comments are published immediately
|
||||
if (empty($feedback->getComment())) {
|
||||
$feedback->setStatus(Feedback::STATUS_PUBLISHED);
|
||||
}
|
||||
|
||||
$teamer = $disposition->getTeamer();
|
||||
$teamer->addFeedback($feedback);
|
||||
$disposition->setFeedback($feedback);
|
||||
|
||||
Reference in New Issue
Block a user