Add Recertification field for members
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Philipp Lang 2023-11-24 13:28:54 +01:00
parent 1e836b2a28
commit a1790e7126
10 changed files with 137 additions and 61 deletions

View File

@ -61,7 +61,7 @@ class Member extends Model implements Geolocatable
/**
* @var array<int, string>
*/
public $dates = ['try_created_at', 'joined_at', 'birthday', 'efz', 'ps_at', 'more_ps_at', 'without_education_at', 'without_efz_at'];
public $dates = ['try_created_at', 'recertified_at', 'joined_at', 'birthday', 'efz', 'ps_at', 'more_ps_at', 'without_education_at', 'without_efz_at'];
/**
* @var array<string, string>

View File

@ -69,6 +69,7 @@ class MemberRequest extends FormRequest
'efz' => 'nullable|date_format:Y-m-d',
'without_education_at' => 'nullable|date_format:Y-m-d',
'without_efz_at' => 'nullable|date_format:Y-m-d',
'recertified_at' => 'nullable|date_format:Y-m-d',
'multiply_pv' => 'boolean',
'multiply_more_pv' => 'boolean',
'send_newspaper' => 'boolean',

View File

@ -83,6 +83,7 @@ class MemberResource extends JsonResource
'efz' => $this->efz?->format('Y-m-d'),
'efz_human' => $this->efz?->format('d.m.Y') ?: null,
'ps_at_human' => $this->ps_at?->format('d.m.Y') ?: null,
'recertified_at_human' => $this->recertified_at?->format('d.m.Y') ?: null,
'more_ps_at_human' => $this->more_ps_at?->format('d.m.Y') ?: null,
'without_education_at_human' => $this->without_education_at?->format('d.m.Y') ?: null,
'without_efz_at_human' => $this->without_efz_at?->format('d.m.Y') ?: null,
@ -94,6 +95,7 @@ class MemberResource extends JsonResource
'has_vk' => $this->has_vk,
'without_education_at' => $this->without_education_at?->format('Y-m-d'),
'without_efz_at' => $this->without_efz_at?->format('Y-m-d'),
'recertified_at' => $this->recertified_at?->format('Y-m-d'),
'multiply_pv' => $this->multiply_pv,
'multiply_more_pv' => $this->multiply_more_pv,
'age' => $this->getModel()->getAge(),

View File

@ -37,6 +37,7 @@ class MemberFactory extends Factory
'zip' => $this->faker->postcode,
'location' => $this->faker->city,
'email' => $this->faker->safeEmail(),
'recertified_at' => null,
];
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('members', function (Blueprint $table) {
$table->date('recertified_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('members', function (Blueprint $table) {
$table->dropColumn('recertified_at');
});
}
};

View File

@ -2,7 +2,8 @@
<page-layout>
<template #toolbar>
<page-toolbar-button :href="meta.links.index" color="primary" icon="undo">zurück</page-toolbar-button>
<page-toolbar-button v-if="mode === 'edit'" :href="data.links.show" color="primary" icon="eye">anschauen</page-toolbar-button>
<page-toolbar-button v-if="mode === 'edit'" :href="data.links.show" color="primary"
icon="eye">anschauen</page-toolbar-button>
</template>
<template #right>
<f-save-button form="memberedit"></f-save-button>
@ -10,8 +11,10 @@
<form class="flex grow relative" id="memberedit" @submit.prevent="submit">
<ui-popup heading="Ein Konflikt ist aufgetreten" v-if="conflict === true">
<div>
<p class="mt-4">Dieses Mitglied wurde vorher bereits aktualisiert. Daher könnte ein Update zu Datenverlust führen.</p>
<p class="mt-2">Wir empfehlen, die Daten aus NaMi zunächst neu zu synchronisieren und dann die Änderungen hier in der Adrema erneut vorzunehmen.</p>
<p class="mt-4">Dieses Mitglied wurde vorher bereits aktualisiert. Daher könnte ein Update zu
Datenverlust führen.</p>
<p class="mt-2">Wir empfehlen, die Daten aus NaMi zunächst neu zu synchronisieren und dann die
Änderungen hier in der Adrema erneut vorzunehmen.</p>
<div class="grid grid-cols-2 gap-3 mt-6">
<a href="#" @click.prevent="resync" class="text-center btn btn-primary">Neu synchronisieren</a>
<a href="#" @click.prevent="forceWrite" class="text-center btn btn-danger">Änderungen schreiben</a>
@ -24,62 +27,64 @@
<ui-box heading="Stammdaten">
<div class="grid sm:grid-cols-2 gap-3">
<div class="grid grid-cols-2 gap-3">
<f-select id="gender_id" name="gender_id" :options="meta.genders" v-model="inner.gender_id" label="Geschlecht" size="sm"></f-select>
<f-select id="gender_id" name="gender_id" :options="meta.genders" v-model="inner.gender_id"
label="Geschlecht" size="sm"></f-select>
<f-text id="salutation" v-model="inner.salutation" size="sm" label="Anrede"></f-text>
</div>
<f-select :options="meta.nationalities" id="nationality_id" v-model="inner.nationality_id" label="Staatsangehörigkeit" name="nationality_id" size="sm"></f-select>
<f-select :options="meta.nationalities" id="nationality_id" v-model="inner.nationality_id"
label="Staatsangehörigkeit" name="nationality_id" size="sm"></f-select>
<f-text id="firstname" v-model="inner.firstname" size="sm" label="Vorname" required></f-text>
<f-text id="lastname" v-model="inner.lastname" size="sm" label="Nachname" required></f-text>
<f-text id="address" v-model="inner.address" size="sm" label="Adresse"></f-text>
<f-text id="further_address" v-model="inner.further_address" size="sm" label="Adresszusatz"></f-text>
<f-text id="further_address" v-model="inner.further_address" size="sm"
label="Adresszusatz"></f-text>
<f-text id="zip" v-model="inner.zip" size="sm" label="PLZ"></f-text>
<f-text id="location" v-model="inner.location" size="sm" label="Ort"></f-text>
<f-text type="date" id="birthday" v-model="inner.birthday" size="sm" label="Geburtsdatum"></f-text>
<f-select :options="meta.regions" name="region_id" id="region_id" v-model="inner.region_id" label="Bundesland" size="sm"></f-select>
<f-select :options="meta.countries" id="country_id" v-model="inner.country_id" label="Land" name="country_id" size="sm" required></f-select>
<f-text id="other_country" v-model="inner.other_country" label="Andere Staatsangehörigkeit" size="sm"></f-text>
<f-select :options="meta.regions" name="region_id" id="region_id" v-model="inner.region_id"
label="Bundesland" size="sm"></f-select>
<f-select :options="meta.countries" id="country_id" v-model="inner.country_id" label="Land"
name="country_id" size="sm" required></f-select>
<f-text id="other_country" v-model="inner.other_country" label="Andere Staatsangehörigkeit"
size="sm"></f-text>
</div>
</ui-box>
<ui-box heading="Kontakt">
<div class="grid gap-3 sm:grid-cols-2">
<f-text id="main_phone" v-model="inner.main_phone" size="sm" label="Telefon (Eltern)"></f-text>
<f-text id="mobile_phone" v-model="inner.mobile_phone" size="sm" label="Handy (Eltern)"></f-text>
<f-text id="work_phone" v-model="inner.work_phone" size="sm" label="Tel geschäftlich (Eltern)"></f-text>
<f-text id="children_phone" v-model="inner.children_phone" size="sm" label="Telefon (Kind)"></f-text>
<f-text id="work_phone" v-model="inner.work_phone" size="sm"
label="Tel geschäftlich (Eltern)"></f-text>
<f-text id="children_phone" v-model="inner.children_phone" size="sm"
label="Telefon (Kind)"></f-text>
<f-text id="email" v-model="inner.email" size="sm" label="E-Mail"></f-text>
<f-text id="email_parents" v-model="inner.email_parents" size="sm" label="E-Mail eltern"></f-text>
<f-text id="fax" v-model="inner.fax" size="sm" label="Fax"></f-text>
<f-textarea class="sm:col-span-2" rows="3" id="letter_address" v-model="inner.letter_address" label="Brief-Adresse" size="sm"></f-textarea>
<f-textarea class="sm:col-span-2" rows="3" id="letter_address" v-model="inner.letter_address"
label="Brief-Adresse" size="sm"></f-textarea>
</div>
</ui-box>
<ui-box heading="System">
<div class="grid gap-3">
<f-select :options="meta.billKinds" id="bill_kind" v-model="inner.bill_kind" label="Rechnung versenden über" name="bill_kind" size="sm"></f-select>
<f-select :options="meta.subscriptions" id="subscription_id" v-model="inner.subscription_id" label="Beitrag" name="subscription_id" size="sm"></f-select>
<f-select :options="meta.billKinds" id="bill_kind" v-model="inner.bill_kind"
label="Rechnung versenden über" name="bill_kind" size="sm"></f-select>
<f-select :options="meta.subscriptions" id="subscription_id" v-model="inner.subscription_id"
label="Beitrag" name="subscription_id" size="sm"></f-select>
<f-switch id="has_nami" size="sm" v-model="inner.has_nami" label="In Nami eintragen"></f-switch>
<f-switch id="send_newspaper" v-model="inner.send_newspaper" label="Mittendrin versenden" size="sm"></f-switch>
<f-text class="sm:col-span-2" type="date" id="joined_at" v-model="inner.joined_at" label="Eintrittsdatum" size="sm" required></f-text>
<f-textarea rows="3" id="comment" class="col-span-2" v-model="inner.comment" label="Kommentar" size="sm"></f-textarea>
<f-switch id="send_newspaper" v-model="inner.send_newspaper" label="Mittendrin versenden"
size="sm"></f-switch>
<f-text class="sm:col-span-2" type="date" id="joined_at" v-model="inner.joined_at"
label="Eintrittsdatum" size="sm" required></f-text>
<f-textarea rows="3" id="comment" class="col-span-2" v-model="inner.comment" label="Kommentar"
size="sm"></f-textarea>
<div class="contents" v-if="mode === 'create'">
<f-select
:options="meta.formCreateActivities"
id="first_activity_id"
v-model="inner.first_activity_id"
label="Erste Tätigkeit"
name="first_activity_id"
size="sm"
required
></f-select>
<f-select
v-if="inner.first_activity_id"
:options="meta.formCreateSubactivities[inner.first_activity_id]"
id="first_subactivity_id"
v-model="inner.first_subactivity_id"
label="Erste Untertätigkeit"
name="first_subactivity_id"
size="sm"
required
></f-select>
<f-select :options="meta.formCreateActivities" id="first_activity_id"
v-model="inner.first_activity_id" label="Erste Tätigkeit" name="first_activity_id" size="sm"
required></f-select>
<f-select v-if="inner.first_activity_id"
:options="meta.formCreateSubactivities[inner.first_activity_id]" id="first_subactivity_id"
v-model="inner.first_subactivity_id" label="Erste Untertätigkeit"
name="first_subactivity_id" size="sm" required></f-select>
</div>
</div>
</ui-box>
@ -88,30 +93,47 @@
<div class="grid grid-cols-[minmax(min-content,max-content)_8rem] gap-1">
<f-switch id="has_efz" v-model="hasEfz" size="sm" label="Führungszeugnis eingesehen"></f-switch>
<div>
<f-text v-if="inner.efz !== null" type="date" id="efz" v-model="inner.efz" label="am" size="sm"></f-text>
<f-text v-if="inner.efz !== null" type="date" id="efz" v-model="inner.efz" label="am"
size="sm"></f-text>
</div>
<f-switch id="has_ps" v-model="hasPs" size="sm" label="Hat Präventionsschulung"></f-switch>
<div>
<f-text v-if="inner.ps_at !== null" type="date" id="ps_at" v-model="inner.ps_at" label="am" size="sm"></f-text>
<f-text v-if="inner.ps_at !== null" type="date" id="ps_at" v-model="inner.ps_at" label="am"
size="sm"></f-text>
</div>
<f-switch id="has_more_ps" v-model="hasMorePs" size="sm" label="Hat Vertierungsschulung"></f-switch>
<f-switch id="has_more_ps" v-model="hasMorePs" size="sm"
label="Hat Vertierungsschulung"></f-switch>
<div>
<f-text v-if="inner.more_ps_at !== null" type="date" id="more_ps_at" v-model="inner.more_ps_at" label="am" size="sm"></f-text>
<f-text v-if="inner.more_ps_at !== null" type="date" id="more_ps_at"
v-model="inner.more_ps_at" label="am" size="sm"></f-text>
</div>
<f-switch id="has_without_education" v-model="hasWithoutEducation" label="Einsatz ohne Schulung" size="sm"></f-switch>
<f-switch id="is_recertified" v-model="isRecertified" size="sm"
label="Hat Rezertifizierung"></f-switch>
<div>
<f-text v-if="inner.without_education_at !== null" type="date" id="without_education_at" v-model="inner.without_education_at" label="am" size="sm"></f-text>
<f-text v-if="inner.recertified_at !== null" type="date" id="recertified_at"
v-model="inner.recertified_at" label="am" size="sm"></f-text>
</div>
<f-switch id="has_without_efz" size="sm" v-model="hasWithoutEfz" label="Einsatz ohne EFZ"></f-switch>
<f-switch id="has_without_education" v-model="hasWithoutEducation" label="Einsatz ohne Schulung"
size="sm"></f-switch>
<div>
<f-text v-if="inner.without_efz_at !== null" type="date" id="without_efz_at" v-model="inner.without_efz_at" label="am" size="sm"></f-text>
<f-text v-if="inner.without_education_at !== null" type="date" id="without_education_at"
v-model="inner.without_education_at" label="am" size="sm"></f-text>
</div>
<f-switch id="has_without_efz" size="sm" v-model="hasWithoutEfz"
label="Einsatz ohne EFZ"></f-switch>
<div>
<f-text v-if="inner.without_efz_at !== null" type="date" id="without_efz_at"
v-model="inner.without_efz_at" label="am" size="sm"></f-text>
</div>
</div>
<div class="grid gap-1">
<f-switch id="has_svk" size="sm" v-model="inner.has_svk" label="SVK unterschrieben"></f-switch>
<f-switch id="has_vk" size="sm" v-model="inner.has_vk" label="Verhaltenskodex unterschrieben"></f-switch>
<f-switch id="multiply_pv" v-model="inner.multiply_pv" label="Multiplikator*in Präventionsschulung" size="sm"></f-switch>
<f-switch id="multiply_more_pv" v-model="inner.multiply_more_pv" label="Multiplikator*in Vertierungsschulung" size="sm"></f-switch>
<f-switch id="has_vk" size="sm" v-model="inner.has_vk"
label="Verhaltenskodex unterschrieben"></f-switch>
<f-switch id="multiply_pv" v-model="inner.multiply_pv"
label="Multiplikator*in Präventionsschulung" size="sm"></f-switch>
<f-switch id="multiply_more_pv" v-model="inner.multiply_more_pv"
label="Multiplikator*in Vertierungsschulung" size="sm"></f-switch>
</div>
</div>
</ui-box>
@ -135,7 +157,7 @@ function issetComputed(val) {
export default {
data: function () {
return {
inner: {...this.data},
inner: { ...this.data },
active: 0,
};
},
@ -154,13 +176,14 @@ export default {
resync() {
this.$inertia.get(`/member/${this.inner.id}/resync`);
},
forceWrite() {},
forceWrite() { },
},
computed: {
hasEfz: issetComputed('efz'),
hasPs: issetComputed('ps_at'),
hasMorePs: issetComputed('more_ps_at'),
isRecertified: issetComputed('recertified_at'),
hasWithoutEfz: issetComputed('without_efz_at'),
hasWithoutEducation: issetComputed('without_education_at'),
},

View File

@ -1,17 +1,27 @@
<template>
<div class="flex gap-3">
<div class="grid gap-3">
<ui-text-display class="col-start-1" label="Führungszeugnis eingesehen" :value="inner.efz_human ? inner.efz_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Präventionsschulung" :value="inner.ps_at_human ? inner.ps_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Vertiefungsschulung" :value="inner.more_ps_at_human ? inner.more_ps_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Einsatz ohne Schulung" :value="inner.without_education_at_human ? inner.without_education_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Einsatz ohne EFZ" :value="inner.without_efz_at_human ? inner.without_efz_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Führungszeugnis eingesehen"
:value="inner.efz_human ? inner.efz_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Präventionsschulung"
:value="inner.ps_at_human ? inner.ps_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Rezertifizierung"
:value="inner.recertified_at_human ? inner.recertified_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Vertiefungsschulung"
:value="inner.more_ps_at_human ? inner.more_ps_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Einsatz ohne Schulung"
:value="inner.without_education_at_human ? inner.without_education_at_human : 'nie'"></ui-text-display>
<ui-text-display class="col-start-1" label="Einsatz ohne EFZ"
:value="inner.without_efz_at_human ? inner.without_efz_at_human : 'nie'"></ui-text-display>
</div>
<div class="grid gap-3 content-start">
<ui-boolean-display :value="inner.has_vk" long-label="Verhaltenskodex unterschrieben" label="VK"></ui-boolean-display>
<ui-boolean-display :value="inner.has_vk" long-label="Verhaltenskodex unterschrieben"
label="VK"></ui-boolean-display>
<ui-boolean-display :value="inner.has_svk" long-label="SVK unterschrieben" label="SVK"></ui-boolean-display>
<ui-boolean-display :value="inner.multiply_pv" long-label="Multiplikator*in Präventionsschulung" label="Multipl. PS"></ui-boolean-display>
<ui-boolean-display :value="inner.multiply_more_pv" long-label="Multiplikator*in Vertierungsschulung" label="Multipl. VS"></ui-boolean-display>
<ui-boolean-display :value="inner.multiply_pv" long-label="Multiplikator*in Präventionsschulung"
label="Multipl. PS"></ui-boolean-display>
<ui-boolean-display :value="inner.multiply_more_pv" long-label="Multiplikator*in Vertierungsschulung"
label="Multipl. VS"></ui-boolean-display>
</div>
</div>
</template>

View File

@ -43,6 +43,7 @@ class EditTest extends TestCase
'more_ps_at' => '2022-06-02',
'without_education_at' => '2022-06-03',
'without_efz_at' => '2022-06-04',
'recertified_at' => '2022-06-04',
'has_vk' => true,
'has_svk' => true,
'multiply_pv' => true,
@ -57,6 +58,7 @@ class EditTest extends TestCase
'more_ps_at' => '2022-06-02',
'without_education_at' => '2022-06-03',
'without_efz_at' => '2022-06-04',
'recertified_at' => '2022-06-04',
'has_vk' => true,
'has_svk' => true,
'multiply_pv' => true,

View File

@ -59,6 +59,7 @@ class ShowTest extends TestCase
'efz' => '2022-09-20',
'ps_at' => '2022-04-20',
'more_ps_at' => '2022-06-02',
'recertified_at' => '2022-06-13',
'without_education_at' => '2022-06-03',
'without_efz_at' => '2022-06-04',
'has_vk' => true,
@ -93,6 +94,7 @@ class ShowTest extends TestCase
'more_ps_at_human' => '02.06.2022',
'without_education_at_human' => '03.06.2022',
'without_efz_at_human' => '04.06.2022',
'recertified_at_human' => '13.06.2022',
'has_vk' => true,
'has_svk' => true,
'multiply_pv' => true,

View File

@ -32,9 +32,10 @@ class UpdateTest extends TestCase
->patch("/member/{$member->id}", array_merge($member->getAttributes(), ['has_nami' => true]));
$response->assertRedirect('/member');
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(fn (Member $memberParam, ?Activity $activityParam, ?Subactivity $subactivityParam) => $memberParam->is($member)
&& null === $activityParam
&& null === $subactivityParam
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(
fn (Member $memberParam, ?Activity $activityParam, ?Subactivity $subactivityParam) => $memberParam->is($member)
&& null === $activityParam
&& null === $subactivityParam
)->once();
}
@ -120,6 +121,7 @@ class UpdateTest extends TestCase
'efz' => '2021-02-03',
'without_education_at' => '2021-02-04',
'without_efz_at' => '2021-02-05',
'recertified_at' => '2021-02-08',
'has_nami' => false,
'multiply_pv' => true,
'multiply_more_pv' => true,
@ -135,6 +137,7 @@ class UpdateTest extends TestCase
$this->assertEquals('2021-02-03', $member->fresh()->efz->format('Y-m-d'));
$this->assertEquals('2021-02-04', $member->fresh()->without_education_at->format('Y-m-d'));
$this->assertEquals('2021-02-05', $member->fresh()->without_efz_at->format('Y-m-d'));
$this->assertEquals('2021-02-08', $member->fresh()->recertified_at->format('Y-m-d'));
$this->assertEquals('Doktor', $member->fresh()->salutation);
}