Feat: Add description field to availability
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 Version20231018151251 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 availability ADD description LONGTEXT DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE availability DROP description');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,9 @@ class Availability implements BlameableEntityInterface, TimestampableEntityInter
|
|||||||
#[Assert\GreaterThan(propertyPath: 'dateFrom', message: 'Das Datum muss nach dem Beginndatum liegen')]
|
#[Assert\GreaterThan(propertyPath: 'dateFrom', message: 'Das Datum muss nach dem Beginndatum liegen')]
|
||||||
private ?\DateTimeImmutable $dateTo = null;
|
private ?\DateTimeImmutable $dateTo = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||||
|
private ?string $description = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'customAvailabilities')]
|
#[ORM\ManyToOne(inversedBy: 'customAvailabilities')]
|
||||||
private ?Teamer $owner = null;
|
private ?Teamer $owner = null;
|
||||||
|
|
||||||
@@ -76,6 +79,18 @@ class Availability implements BlameableEntityInterface, TimestampableEntityInter
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDescription(): ?string
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription(?string $description): static
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getOwner(): ?Teamer
|
public function getOwner(): ?Teamer
|
||||||
{
|
{
|
||||||
return $this->owner;
|
return $this->owner;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Form;
|
|||||||
|
|
||||||
use App\Entity\Availability;
|
use App\Entity\Availability;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
@@ -20,6 +21,10 @@ class AvailabilityType extends AbstractType
|
|||||||
'label' => 'Datum bis',
|
'label' => 'Datum bis',
|
||||||
'min_date' => new \DateTimeImmutable(),
|
'min_date' => new \DateTimeImmutable(),
|
||||||
])
|
])
|
||||||
|
->add('description', TextType::class, [
|
||||||
|
'label' => 'Anmerkung',
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div class="flex flex-col space-y-4 pb-8">
|
<div class="flex flex-col space-y-4 pb-8">
|
||||||
{{ form_row(form.dateFrom) }}
|
{{ form_row(form.dateFrom) }}
|
||||||
{{ form_row(form.dateTo) }}
|
{{ form_row(form.dateTo) }}
|
||||||
|
{{ form_row(form.description) }}
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn">
|
<button type="submit" class="btn">
|
||||||
Speichern
|
Speichern
|
||||||
|
|||||||
@@ -11,12 +11,15 @@
|
|||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="w-1/3">
|
<th class="w-1/4">
|
||||||
{{ knp_pagination_sortable(pagination, 'Datum von', 'availability.dateFrom') }}
|
{{ knp_pagination_sortable(pagination, 'Datum von', 'availability.dateFrom') }}
|
||||||
</th>
|
</th>
|
||||||
<th class="w-1/3">
|
<th class="w-1/4">
|
||||||
{{ knp_pagination_sortable(pagination, 'Datum bis', 'availability.dateTo') }}
|
{{ knp_pagination_sortable(pagination, 'Datum bis', 'availability.dateTo') }}
|
||||||
</th>
|
</th>
|
||||||
|
<th class="w-1/4">
|
||||||
|
{{ knp_pagination_sortable(pagination, 'Beschreibung', 'availability.description') }}
|
||||||
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -29,6 +32,9 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ availability.dateTo|date('d.m.Y') }}
|
{{ availability.dateTo|date('d.m.Y') }}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ availability.description|default('-') }}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="flex items-center space-x-2 justify-end">
|
<div class="flex items-center space-x-2 justify-end">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div class="flex flex-col space-y-4 pb-8">
|
<div class="flex flex-col space-y-4 pb-8">
|
||||||
{{ form_row(form.dateFrom) }}
|
{{ form_row(form.dateFrom) }}
|
||||||
{{ form_row(form.dateTo) }}
|
{{ form_row(form.dateTo) }}
|
||||||
|
{{ form_row(form.description) }}
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn">
|
<button type="submit" class="btn">
|
||||||
Speichern
|
Speichern
|
||||||
|
|||||||
Reference in New Issue
Block a user