Skip to content

Commit

Permalink
Add field for members to put extra info in
Browse files Browse the repository at this point in the history
  • Loading branch information
rrooij committed Jul 20, 2023
1 parent 422495d commit 22ce792
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Controller/Admin/MemberCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function configureFields(string $pageName): iterable
->setFormat(DateTimeField::FORMAT_SHORT)
->hideOnIndex(),
AssociationField::new('workGroups', 'Werkgroepen'),
TextField::new('comments', 'Extra informatie'),
];

if (in_array('ROLE_ADMIN', $this->getUser()->getRoles(), true)) {
Expand Down
9 changes: 9 additions & 0 deletions src/Entity/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,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 @@ -340,6 +345,10 @@ public function setCurrentMembershipStatus(?MembershipStatus $membershipStatus)
$this->currentMembershipStatus = $membershipStatus;
}


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

/** @see UserInterface */
public function getUsername(): string { return $this->id; }

Expand Down
1 change: 1 addition & 0 deletions src/Form/MemberDetailsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('dateOfBirth', null, ['widget' => 'single_text'])
->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 @@ -69,6 +69,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

0 comments on commit 22ce792

Please sign in to comment.