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

Inactive member organ members and fixes to installation/discharge UX #183

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 6 additions & 4 deletions module/Checker/src/Service/Installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ public function getActiveMembers(?MeetingModel $meeting): array

$members = [];
foreach ($installations as $installation) {
$member = $installation->getMember()->getLidnr();
if ('Inactief Lid' !== $installation->getFunction()) {
$member = $installation->getMember()->getLidnr();

// Doing checks against the keys is a lot faster, and we do not need a lot of information.
if (!array_key_exists($member, $members)) {
$members[$member] = '';
// Doing checks against the keys is a lot faster, and we do not need a lot of information.
if (!array_key_exists($member, $members)) {
$members[$member] = '';
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion module/Database/src/Controller/MeetingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function decisionformAction(): Response|ViewModel
*/
public function deleteAction(): ViewModel
{
$type = $this->params()->fromRoute('type');
$type = MeetingTypes::from($this->params()->fromRoute('type'));
$number = (int) $this->params()->fromRoute('number');
$point = (int) $this->params()->fromRoute('point');
$decision = (int) $this->params()->fromRoute('decision');
Expand Down
12 changes: 10 additions & 2 deletions module/Database/src/Controller/OrganController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ public function infoAction(): JsonModel

foreach ($foundation->getReferences() as $reference) {
if ($reference instanceof InstallationModel) {
$data['members'][] = [
$member = $reference->getMember();

if (!array_key_exists($member->getLidnr(), $data['members'])) {
$data['members'][$member->getLidnr()] = [
'member' => $member->toArray(),
'installations' => [],
];
}

$data['members'][$member->getLidnr()]['installations'][] = [
'meeting_type' => $reference->getDecision()->getMeeting()->getType(),
'meeting_number' => $reference->getDecision()->getMeeting()->getNumber(),
'decision_point' => $reference->getDecision()->getPoint(),
'decision_number' => $reference->getDecision()->getNumber(),
'subdecision_number' => $reference->getNumber(),
'function' => $reference->getFunction(),
'member' => $reference->getMember()->toArray(),
];
}
}
Expand Down
1 change: 1 addition & 0 deletions module/Database/src/Form/Fieldset/MemberFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ protected function getValueOptions(

if ($withmember) {
$array['Lid'] = 'Lid';
$array['Inactief Lid'] = 'Inactief Lid';
}

foreach ($service->getAllFunctions() as $function) {
Expand Down
5 changes: 4 additions & 1 deletion module/Database/src/Hydrator/Foundation.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public function hydrate(array $data, $object): DecisionModel
foreach ($data['members'] as $install) {
// if an installation has a different function than 'member'
// also add a member installation
if ($install['function'] != 'Lid') {
if (
'Lid' !== $install['function']
&& 'Inactief Lid' !== $install['function']
) {
$installation = new InstallationModel();
$installation->setNumber($num++);
$installation->setFoundation($foundation);
Expand Down
2 changes: 1 addition & 1 deletion module/Database/src/Mapper/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function find(int $lidnr): ?MemberModel
->where('m.lidnr = :lidnr')
->leftJoin('m.installations', 'r')
->leftJoin('m.lists', 'l')
->andWhere('(r.function = \'Lid\' OR r.function IS NULL)');
->andWhere('(r.function = \'Lid\' OR r.function = \'Inactief Lid\' OR r.function IS NULL)');

// discharges
$qbn = $this->em->createQueryBuilder();
Expand Down
27 changes: 25 additions & 2 deletions module/Database/view/database/meeting/abolishform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,31 @@ $(document).ready(function () {
// show all members
$('#div-members-abolish').show();
var content = '';
$.each(data.json.members, function(idx, install) {
content += '<li>' + install.member.fullName + ' (' + install.function + ')</li>';
$.each(data.json.members, function(idx, member) {
var installationCount = member.installations.length;
var functionCount = 0;
content += '<li>' + member.member.fullName + ' (';

$.each(member.installations, function (idx, install) {
content += install.function;

if (
2 === installationCount
&& 0 === functionCount
) {
content += ' en ';
} else if (2 < installationCount) {
content += ', ';

if (functionCount === installationCount - 1) {
content += 'en ';
}
}

functionCount++;
});

content += ')</li>';
});
$('#members-abolish').html(content);

Expand Down
4 changes: 2 additions & 2 deletions module/Database/view/database/meeting/delete.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Besluit verwijderd.
$form->prepare();

$form->setAttribute('action', $this->url('meeting/decision/delete', array(
'type' => $type,
'type' => $type->value,
'number' => $number,
'point' => $point,
'decision' => $decision
Expand All @@ -24,7 +24,7 @@ echo $this->form()->openTag($form);

<p>
Weet je zeker dat besluit
<?= $type . " $number.$point.$decision " ?>
<?= $type->value . " $number.$point.$decision " ?>
verwijderd moet worden?
</p>
<div class="form-group">
Expand Down
Loading