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

Feature/minutes decision #402

Merged
merged 1 commit into from
Jun 19, 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
15 changes: 15 additions & 0 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions .idea/gewisdb.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 6 additions & 85 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions module/Database/src/Controller/MeetingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ protected function getDecisionForms(
'install' => $this->meetingService->getInstallForm(),
'key_grant' => $this->meetingService->getKeyGrantForm(),
'key_withdraw' => $this->meetingService->getKeyWithdrawForm(),
'minutes' => $this->meetingService->getMinutesForm(),
'other' => $this->meetingService->getOtherForm(),
'board_install' => $this->meetingService->getBoardInstallForm(),
'board_release' => $this->meetingService->getBoardReleaseForm(),
Expand Down Expand Up @@ -204,6 +205,9 @@ public function decisionformAction(): Response|ViewModel
'other' => new ViewModel(
$this->meetingService->otherDecision($this->getRequest()->getPost()->toArray()),
),
'minutes' => new ViewModel(
$this->meetingService->minutesDecision($this->getRequest()->getPost()->toArray()),
),
default => $this->redirect()->toRoute('meeting'),
};
}
Expand Down
4 changes: 2 additions & 2 deletions module/Database/src/Controller/OrganController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function viewAction(): ViewModel
(int) $this->params()->fromRoute('number'),
(int) $this->params()->fromRoute('point'),
(int) $this->params()->fromRoute('decision'),
(int) $this->params()->fromRoute('subdecision'),
(int) $this->params()->fromRoute('sequence'),
),
]);
}
Expand All @@ -54,7 +54,7 @@ public function infoAction(): JsonModel
(int) $this->params()->fromRoute('number'),
(int) $this->params()->fromRoute('point'),
(int) $this->params()->fromRoute('decision'),
(int) $this->params()->fromRoute('subdecision'),
(int) $this->params()->fromRoute('sequence'),
);

$data = $foundation->toArray();
Expand Down
88 changes: 88 additions & 0 deletions module/Database/src/Form/Minutes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

declare(strict_types=1);

namespace Database\Form;

use Database\Form\Fieldset\Meeting as MeetingFieldset;
use Database\Form\Fieldset\Member as MemberFieldset;
use Laminas\Form\Element\Radio;
use Laminas\Form\Element\Submit;
use Laminas\Form\Element\Text;
use Laminas\InputFilter\InputFilterProviderInterface;
use Laminas\Mvc\I18n\Translator;

class Minutes extends AbstractDecision implements InputFilterProviderInterface
{
public function __construct(
private readonly Translator $translator,
MeetingFieldset $meeting,
MemberFieldset $member,
MeetingFieldset $minutes,
) {
parent::__construct($meeting);

$this->add([
'name' => 'name',
'type' => Text::class,
'options' => [
'label' => $this->translator->translate('Meeting'),
],
]);

$member->setName('author');
$member->setLabel($this->translator->translate('Author'));
$this->add($member);

$this->add([
'name' => 'submit',
'type' => Submit::class,
'attributes' => [
'value' => $this->translator->translate('Submit'),
],
]);

$this->add([
'name' => 'approve',
'type' => Radio::class,
'options' => [
'label' => $this->translator->translate('Approval'),
'value_options' => [
'1' => $this->translator->translate('Approve'),
'0' => $this->translator->translate('Disapprove'),
],
],
]);

$this->add([
'name' => 'changes',
'type' => Radio::class,
'options' => [
'label' => $this->translator->translate('Modifications'),
'value_options' => [
'1' => $this->translator->translate('With Modifications'),
'0' => $this->translator->translate('Without Modifications'),
],
],
]);

$minutes->setName('fmeeting');
$this->add($minutes);
}

public function getInputFilterSpecification(): array
{
return [
'approve' => [
'required' => true,
'allow_empty' => false,
'fallback_value' => false,
],
'changes' => [
'required' => true,
'allow_empty' => false,
'fallback_value' => false,
],
];
}
}
41 changes: 41 additions & 0 deletions module/Database/src/Hydrator/Minutes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace Database\Hydrator;

use Database\Model\Decision as DecisionModel;
use Database\Model\SubDecision\Minutes as MinutesModel;
use InvalidArgumentException;

use function boolval;

class Minutes extends AbstractDecision
{
/**
* Minutes hydration
*
* @param DecisionModel $object
*
* @throws InvalidArgumentException when $object is not a Decision.
*/
public function hydrate(
array $data,
$object,
): DecisionModel {
$object = parent::hydrate($data, $object);

$subdecision = new MinutesModel();

$subdecision->setTarget($data['fmeeting']);

$subdecision->setMember($data['author']);
$subdecision->setApproval(boolval($data['approve']));
$subdecision->setChanges(boolval($data['changes']));

$subdecision->setDecision($object);
$subdecision->setSequence(1);

return $object;
}
}
Loading
Loading