Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra informatie toevoegen bij lid #161

Merged
merged 3 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions migrations/Version20240303195249.php
Original file line number Diff line number Diff line change
@@ -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 Version20240303195249 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 admin_member ADD comments 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 admin_member DROP comments');
}
}
4 changes: 3 additions & 1 deletion src/Controller/Admin/MemberCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public function configureFields(string $pageName): iterable
DateField::new('registrationTime', 'Inschrijfdatum')
->setFormat(DateTimeField::FORMAT_SHORT)
->hideOnIndex(),
TextField::new('comments', 'Extra informatie'),
];

if ($isAdmin) {
Expand All @@ -183,7 +184,7 @@ public function configureFields(string $pageName): iterable
$fields[] = BooleanField::new('isAdmin', 'Toegang tot administratie')
->hideOnIndex();
}
array_push($fields,
array_push($fields,
FormField::addPanel('Contactinformatie'),
EmailField::new('email', 'E-mailadres')->setDisabled(!$isAdmin),
TextField::new('phone', 'Telefoonnummer')->setDisabled(!$isAdmin),
Expand Down Expand Up @@ -214,4 +215,5 @@ public function configureFields(string $pageName): iterable
);
return $fields;
}

}
1 change: 1 addition & 0 deletions src/DataFixtures/MemberFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function load(ObjectManager $manager)
$admin->setIsAdmin(true);
$admin->setContributionPerPeriodInEuros(5);
$admin->setPasswordHash(password_hash("admin", PASSWORD_DEFAULT));
$admin->setComments("Dit is de Baas");
$manager->persist($admin);

// Add Division (Groep) with contact member and new member
Expand Down
8 changes: 8 additions & 0 deletions src/Entity/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ class Member implements UserInterface {
*/
private bool $acceptUsePersonalInformation = true;

/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $comments = null;

public function __construct() {
$this->registrationTime = new DateTime;
$this->contributionPayments = new ArrayCollection;
Expand Down Expand Up @@ -296,6 +301,9 @@ public function getManagingEmails(): Collection {
return $this->managingEmails;
}

public function getComments(): ?string { return $this->comments; }
public function setComments(?string $comments): void { $this->comments = $comments; }

public function getCurrentMembershipStatus(): ?MembershipStatus {
return $this->currentMembershipStatus;
}
Expand Down
1 change: 1 addition & 0 deletions src/Form/MemberDetailsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('address')
->add('city')
->add('postCode')
->add('comments')
;
}

Expand Down
5 changes: 5 additions & 0 deletions templates/user/details.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
{{ form_widget(form.division, { attr: { class: 'text-input' }}) }}
</div>

<div class="form-row">
{{ form_label(form.comments, 'Extra informatie') }}
{{ form_widget(form.comments, { attr: { class: 'text-input' }}) }}
</div>

<button type="submit" class="button">Opslaan</button>

{{ form_end(form) }}
Expand Down
Loading
Loading