feat: extend and refactor feedback providing for role house manager
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20231206154001 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE feedback DROP comment_public');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE feedback ADD comment_public TINYINT(1) NOT NULL');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20231206164142 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE feedback ADD job_profile_name VARCHAR(255) NOT NULL, CHANGE assignment_destination destination_name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE feedback ADD assignment_destination VARCHAR(255) NOT NULL, DROP destination_name, DROP job_profile_name');
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
+45
-13
@@ -8,6 +8,7 @@ use App\Repository\FeedbackRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FeedbackRepository::class)]
|
||||
class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
@@ -33,23 +34,30 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
private ?Teamer $teamer = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $assignmentDestination = null;
|
||||
private ?string $destinationName;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $jobProfileName;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||
private ?\DateTimeImmutable $assignmentDate = null;
|
||||
private ?\DateTimeImmutable $assignmentDate;
|
||||
|
||||
#[ORM\Column]
|
||||
#[Assert\Count(min: 1, minMessage: 'Bitte gib eine Bewertung ab')]
|
||||
private array $ratings = [];
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $comment = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $commentPublic = false;
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $commentInternal = null;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(Assignment $assignment)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->destinationName = $assignment->getDestination()->getProduct();
|
||||
$this->assignmentDate = $assignment->getEffectiveDateFrom();
|
||||
$this->jobProfileName = $assignment->getJobProfile()->getName();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -86,14 +94,26 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAssignmentDestination(): ?string
|
||||
public function getDestination(): ?Destination
|
||||
{
|
||||
return $this->assignmentDestination;
|
||||
return $this->destination;
|
||||
}
|
||||
|
||||
public function setAssignmentDestination(string $assignmentDestination): static
|
||||
public function setDestination(?Destination $destination): static
|
||||
{
|
||||
$this->assignmentDestination = $assignmentDestination;
|
||||
$this->destination = $destination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDestinationName(): ?string
|
||||
{
|
||||
return $this->destinationName;
|
||||
}
|
||||
|
||||
public function setDestinationName(string $destinationName): static
|
||||
{
|
||||
$this->destinationName = $destinationName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -110,6 +130,18 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getJobProfileName(): ?string
|
||||
{
|
||||
return $this->jobProfileName;
|
||||
}
|
||||
|
||||
public function setJobProfileName(?string $jobProfileName): static
|
||||
{
|
||||
$this->jobProfileName = $jobProfileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRatings(): array
|
||||
{
|
||||
return $this->ratings;
|
||||
@@ -149,14 +181,14 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isCommentPublic(): ?bool
|
||||
public function getCommentInternal(): ?string
|
||||
{
|
||||
return $this->commentPublic;
|
||||
return $this->commentInternal;
|
||||
}
|
||||
|
||||
public function setCommentPublic(bool $commentPublic): static
|
||||
public function setCommentInternal(?string $commentInternal): static
|
||||
{
|
||||
$this->commentPublic = $commentPublic;
|
||||
$this->commentInternal = $commentInternal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,15 @@ class FeedbackType extends AbstractType
|
||||
'feedback_set' => $options['feedback_set'],
|
||||
])
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'Kommentar',
|
||||
'label' => 'Kommentar (öffentlich)',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'rows' => 5,
|
||||
],
|
||||
'help' => 'Bitte formuliere deinen Kommentar so, dass er an das Team weitergegeben werden kann',
|
||||
])
|
||||
->add('commentInternal', TextareaType::class, [
|
||||
'label' => 'Kommentar (intern)',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'rows' => 5,
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<div class="py-4">
|
||||
{{ form_row(form.comment) }}
|
||||
</div>
|
||||
<div class="py-4">
|
||||
{{ form_row(form.commentInternal) }}
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn">
|
||||
Speichern
|
||||
|
||||
Reference in New Issue
Block a user