adrema/resources/js/views/member/VForm.vue

300 lines
12 KiB
Vue
Raw Normal View History

2021-06-22 00:22:30 +02:00
<template>
2022-02-10 02:18:57 +01:00
<form class="flex grow relative" @submit.prevent="submit">
2022-04-29 00:23:28 +02:00
<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>
<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>
</div>
</div>
</popup>
2021-06-22 00:22:30 +02:00
<!-- ****************************** menu links ******************************* -->
2022-09-06 00:36:14 +02:00
<v-tabs v-model="active" :entries="menu">
<div slot="bottom">
2022-04-28 23:20:41 +02:00
<button
type="button"
v-show="mode !== 'create'"
@click.prevent="confirm"
class="btn block w-full btn-primary"
>
Daten bestätigen
</button>
2021-06-28 22:09:41 +02:00
<button type="submit" class="mt-3 btn block w-full btn-primary">Speichern</button>
2021-06-22 00:22:30 +02:00
</div>
2022-09-06 00:36:14 +02:00
</v-tabs>
2021-06-22 00:22:30 +02:00
<!-- ***************************** Hauptbereich ****************************** -->
2022-02-10 02:18:57 +01:00
<div class="grow">
2022-05-17 00:04:00 +02:00
<div class="grid grid-cols-2 gap-3 p-4" v-show="menuTitle == 'Stammdaten'">
2022-08-23 23:49:19 +02:00
<f-select
id="gender_id"
name="gender_id"
:options="genders"
v-model="inner.gender_id"
label="Geschlecht"
></f-select>
2021-06-22 00:22:30 +02:00
<f-text id="firstname" v-model="inner.firstname" label="Vorname" required></f-text>
<f-text id="lastname" v-model="inner.lastname" label="Nachname" required></f-text>
<f-text id="address" v-model="inner.address" label="Adresse" required></f-text>
<f-text id="further_address" v-model="inner.further_address" label="Adresszusatz"></f-text>
<f-text id="zip" v-model="inner.zip" label="PLZ" required></f-text>
<f-text id="location" v-model="inner.location" label="Ort" required></f-text>
<f-text type="date" id="birthday" v-model="inner.birthday" label="Geburtsdatum" required></f-text>
2022-08-23 23:49:19 +02:00
<f-select
:options="regions"
name="region_id"
id="region_id"
v-model="inner.region_id"
label="Bundesland"
></f-select>
2022-04-28 23:20:41 +02:00
<f-select
:options="countries"
id="country_id"
v-model="inner.country_id"
label="Land"
2022-08-23 23:49:19 +02:00
name="country_id"
2022-04-28 23:20:41 +02:00
required
></f-select>
<f-select
:options="nationalities"
id="nationality_id"
v-model="inner.nationality_id"
label="Staatsangehörigkeit"
2022-08-23 23:49:19 +02:00
name="nationality_id"
2022-04-28 23:20:41 +02:00
required
></f-select>
<f-text
class="col-span-2"
id="other_country"
v-model="inner.other_country"
label="Andere Staatsangehörigkeit"
></f-text>
2021-06-23 01:05:17 +02:00
2021-07-05 13:22:35 +02:00
<div class="contents">
2021-06-23 01:05:17 +02:00
<h2 class="col-span-full font-semibold text-lg text-white">Erste Gruppierung</h2>
2022-04-28 23:20:41 +02:00
<f-select
:options="activities"
id="first_activity_id"
v-model="inner.first_activity_id"
label="Erste Tätigkeit"
2022-08-23 23:49:19 +02:00
name="first_activity_id"
2022-04-28 23:20:41 +02:00
required
></f-select>
<f-select
v-if="inner.first_activity_id"
:options="subactivities[inner.first_activity_id]"
id="first_subactivity_id"
v-model="inner.first_subactivity_id"
label="Erste Untertätigkeit"
2022-08-23 23:49:19 +02:00
name="first_subactivity_id"
2022-04-28 23:20:41 +02:00
required
></f-select>
2021-06-23 01:05:17 +02:00
</div>
2021-06-22 00:22:30 +02:00
</div>
2022-05-17 00:04:00 +02:00
<div class="grid grid-cols-2 gap-3 p-4" v-show="menuTitle == 'Kontakt'">
2021-06-28 22:55:55 +02:00
<f-text id="main_phone" v-model="inner.main_phone" label="Telefon (Eltern)"></f-text>
<f-text id="mobile_phone" v-model="inner.mobile_phone" label="Handy (Eltern)"></f-text>
<f-text id="work_phone" v-model="inner.work_phone" label="Tel geschäftlich (Eltern)"></f-text>
<f-text id="children_phone" v-model="inner.children_phone" label="Telefon (Kind)"></f-text>
2021-06-22 00:22:30 +02:00
<f-text id="email" v-model="inner.email" label="E-Mail"></f-text>
<f-text id="email_parents" v-model="inner.email_parents" label="E-Mail eltern"></f-text>
<f-text id="fax" v-model="inner.fax" label="Fax"></f-text>
</div>
2022-05-17 00:04:00 +02:00
<div class="grid grid-cols-2 gap-3 p-4" v-show="menuTitle == 'System'">
2022-04-28 23:20:41 +02:00
<f-select
:options="billKinds"
id="bill_kind_id"
v-model="inner.bill_kind_id"
label="Rechnung versenden über"
2022-08-23 23:49:19 +02:00
name="bill_kind_id"
2022-04-28 23:20:41 +02:00
></f-select>
</div>
2022-05-17 00:04:00 +02:00
<div class="grid grid-cols-2 gap-3 p-4" v-show="menuTitle == 'Prävention'">
2022-04-28 23:20:41 +02:00
<div class="grid grid-cols-[max-content_1fr] col-span-2 gap-3">
<f-switch id="has_efz" v-model="hasEfz" label="Führungszeugnis eingesehen"></f-switch>
<div>
<f-text
v-if="inner.efz !== null"
type="date"
id="efz"
v-model="inner.efz"
label="Führungszeugnis eingesehen am"
></f-text>
</div>
<f-switch id="has_ps" v-model="hasPs" 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="Präventionsschulung am"
></f-text>
</div>
<f-switch id="has_more_ps" v-model="hasMorePs" 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="Vertiefungsschulung am"
></f-text>
</div>
<f-switch
id="has_without_education"
v-model="hasWithoutEducation"
label="Einsatz ohne Schulung"
></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="Einsatz ohne Schulung am"
></f-text>
</div>
<f-switch id="has_without_efz" 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="Einsatz ohne EFZ am"
></f-text>
</div>
</div>
<div class="flex col-span-full space-x-3">
<f-switch id="has_svk" v-model="inner.has_svk" label="SVK unterschrieben"></f-switch>
<f-switch id="has_vk" 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"
></f-switch>
<f-switch
id="multiply_more_pv"
v-model="inner.multiply_more_pv"
label="Multiplikator*in Vertierungsschulung"
></f-switch>
</div>
2021-06-22 00:22:30 +02:00
</div>
2022-05-17 00:04:00 +02:00
<div class="grid grid-cols-4 gap-3 p-4" v-show="menuTitle == 'Verwaltung'">
2021-06-22 00:22:30 +02:00
<f-switch id="has_nami" v-model="inner.has_nami" label="In Nami eintragen"></f-switch>
2022-03-15 16:56:54 +01:00
<f-switch id="send_newspaper" v-model="inner.send_newspaper" label="Mittendrin versenden"></f-switch>
2022-04-28 23:20:41 +02:00
<f-text
class="col-span-2"
type="date"
id="joined_at"
v-model="inner.joined_at"
label="Eintrittsdatum"
></f-text>
<f-select
class="col-span-2"
:options="subscriptions"
id="subscription_id"
v-model="inner.subscription_id"
label="Beitrag"
2022-08-23 23:49:19 +02:00
name="subscription_id"
2022-04-28 23:20:41 +02:00
></f-select>
<f-textarea
class="col-span-2"
rows="4"
id="letter_address"
v-model="inner.letter_address"
label="Brief-Adresse"
></f-textarea>
2021-06-22 00:22:30 +02:00
</div>
</div>
</form>
</template>
<script>
2022-04-28 23:20:41 +02:00
function issetComputed(val) {
return {
set(v) {
this.inner[val] = v ? '' : null;
},
get() {
return this.inner[val] !== null;
},
};
}
2021-06-22 00:22:30 +02:00
export default {
2022-04-28 23:20:41 +02:00
data: function () {
2021-06-22 00:22:30 +02:00
return {
inner: {},
active: 0,
menu: [
2022-04-28 23:20:41 +02:00
{id: 'stammdaten', title: 'Stammdaten'},
{id: 'kontakt', title: 'Kontakt'},
{id: 'praevention', title: 'Prävention'},
{id: 'system', title: 'System'},
{id: 'verwaltung', title: 'Verwaltung'},
],
2021-06-22 00:22:30 +02:00
};
},
props: {
2021-06-23 01:05:17 +02:00
subactivities: {},
activities: {},
2021-06-22 00:22:30 +02:00
mode: {},
genders: {},
2021-07-04 12:09:30 +02:00
subscriptions: {},
2021-06-22 00:22:30 +02:00
data: {},
regions: {},
countries: {},
nationalities: {},
confessions: {},
billKinds: {},
2022-04-29 00:23:28 +02:00
conflict: {},
2021-06-22 00:22:30 +02:00
},
methods: {
2021-06-28 22:09:41 +02:00
confirm() {
this.$inertia.post(`/member/${this.inner.id}/confirm`);
},
2021-06-22 00:22:30 +02:00
submit() {
this.mode === 'create'
2021-06-22 23:00:14 +02:00
? this.$inertia.post(`/member`, this.inner)
: this.$inertia.patch(`/member/${this.inner.id}`, this.inner);
2022-04-28 23:20:41 +02:00
},
2022-04-29 00:57:24 +02:00
resync() {
this.$inertia.get(`/member/${this.inner.id}/resync`);
},
2022-04-29 00:23:28 +02:00
forceWrite() {},
},
components: {
2022-09-06 00:36:14 +02:00
'popup': () => import('../../components/Popup.vue'),
'v-tabs': () => import('../../components/VTabs.vue'),
2021-06-22 00:22:30 +02:00
},
computed: {
menuTitle() {
return this.menu[this.active].title;
2022-03-15 16:56:54 +01:00
},
2022-04-28 23:20:41 +02:00
hasEfz: issetComputed('efz'),
hasPs: issetComputed('ps_at'),
hasMorePs: issetComputed('more_ps_at'),
hasWithoutEfz: issetComputed('without_efz_at'),
hasWithoutEducation: issetComputed('without_education_at'),
2021-06-22 00:22:30 +02:00
},
created() {
2021-06-22 23:00:14 +02:00
this.inner = this.data;
2022-04-28 23:20:41 +02:00
},
2021-06-22 00:22:30 +02:00
};
</script>