2021-08-22 22:23:17 +02:00
|
|
|
<template>
|
|
|
|
<div class="sidebar flex flex-col">
|
2022-08-23 23:49:19 +02:00
|
|
|
<sidebar-header
|
|
|
|
:links="links"
|
|
|
|
@create="
|
|
|
|
mode = 'create';
|
2023-02-25 19:49:53 +01:00
|
|
|
single = {...def};
|
2022-08-23 23:49:19 +02:00
|
|
|
"
|
|
|
|
@close="$emit('close')"
|
|
|
|
title="Mitgliedschaften"
|
|
|
|
></sidebar-header>
|
2021-08-22 22:23:17 +02:00
|
|
|
|
|
|
|
<form v-if="single" class="p-6 grid gap-4 justify-start" @submit.prevent="submit">
|
2023-02-25 19:49:53 +01:00
|
|
|
<f-select
|
|
|
|
id="group_id"
|
|
|
|
name="group_id"
|
|
|
|
:options="groups"
|
|
|
|
v-model="single.group_id"
|
|
|
|
label="Gruppierung"
|
|
|
|
size="sm"
|
|
|
|
required
|
|
|
|
></f-select>
|
2022-08-23 23:49:19 +02:00
|
|
|
<f-select
|
|
|
|
id="activity_id"
|
|
|
|
name="activity_id"
|
|
|
|
:options="activities"
|
|
|
|
v-model="single.activity_id"
|
|
|
|
label="Tätigkeit"
|
2022-12-11 21:00:48 +01:00
|
|
|
size="sm"
|
2022-08-23 23:49:19 +02:00
|
|
|
required
|
|
|
|
></f-select>
|
|
|
|
<f-select
|
|
|
|
v-if="single.activity_id"
|
|
|
|
name="subactivity_id"
|
|
|
|
:options="subactivities[single.activity_id]"
|
|
|
|
id="subactivity_id"
|
|
|
|
v-model="single.subactivity_id"
|
|
|
|
label="Untertätigkeit"
|
2022-12-11 21:00:48 +01:00
|
|
|
size="sm"
|
2022-08-23 23:49:19 +02:00
|
|
|
></f-select>
|
2022-12-11 21:00:48 +01:00
|
|
|
<f-switch
|
|
|
|
id="has_promise"
|
|
|
|
:items="single.promised_at !== null"
|
|
|
|
@input="single.promised_at = $event ? '2000-02-02' : null"
|
|
|
|
size="sm"
|
|
|
|
label="Hat Versprechen"
|
|
|
|
></f-switch>
|
|
|
|
<f-text
|
|
|
|
v-show="single.promised_at !== null"
|
|
|
|
type="date"
|
|
|
|
id="promised_at"
|
|
|
|
v-model="single.promised_at"
|
|
|
|
label="Versprechensdatum"
|
|
|
|
size="sm"
|
|
|
|
></f-text>
|
2021-08-22 22:23:17 +02:00
|
|
|
<button type="submit" class="btn btn-primary">Absenden</button>
|
|
|
|
</form>
|
|
|
|
|
2022-02-10 02:18:57 +01:00
|
|
|
<div class="grow" v-else>
|
|
|
|
<table class="custom-table custom-table-light custom-table-sm text-sm">
|
|
|
|
<thead>
|
|
|
|
<th>Tätigkeit</th>
|
|
|
|
<th>Untertätigkeit</th>
|
|
|
|
<th>Datum</th>
|
|
|
|
<th></th>
|
|
|
|
</thead>
|
2021-08-22 22:23:17 +02:00
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
<tr v-for="(membership, index) in value.memberships" :key="index">
|
2022-02-10 02:18:57 +01:00
|
|
|
<td v-text="membership.activity_name"></td>
|
|
|
|
<td v-text="membership.subactivity_name"></td>
|
|
|
|
<td v-text="membership.human_date"></td>
|
|
|
|
<td class="flex">
|
2022-08-23 23:49:19 +02:00
|
|
|
<a
|
|
|
|
href="#"
|
|
|
|
@click.prevent="
|
|
|
|
single = membership;
|
|
|
|
mode = 'edit';
|
|
|
|
"
|
|
|
|
class="inline-flex btn btn-warning btn-sm"
|
|
|
|
><svg-sprite src="pencil"></svg-sprite
|
|
|
|
></a>
|
|
|
|
<i-link href="#" @click.prevent="remove(membership)" class="inline-flex btn btn-danger btn-sm"
|
|
|
|
><svg-sprite src="trash"></svg-sprite
|
|
|
|
></i-link>
|
2022-02-10 02:18:57 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-08-22 22:23:17 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import SidebarHeader from '../../components/SidebarHeader.vue';
|
|
|
|
|
|
|
|
export default {
|
2022-08-23 23:49:19 +02:00
|
|
|
data: function () {
|
2021-08-22 22:23:17 +02:00
|
|
|
return {
|
|
|
|
mode: null,
|
|
|
|
single: null,
|
2022-08-23 23:49:19 +02:00
|
|
|
links: [{event: 'create', label: 'Neu'}],
|
2021-08-22 22:23:17 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
components: {SidebarHeader},
|
2021-08-22 22:23:17 +02:00
|
|
|
|
2023-02-25 19:49:53 +01:00
|
|
|
computed: {
|
|
|
|
def() {
|
|
|
|
return {
|
|
|
|
group_id: this.value.group_id,
|
|
|
|
activity_id: null,
|
|
|
|
subactivity_id: null,
|
|
|
|
promised_at: null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2021-08-22 22:23:17 +02:00
|
|
|
methods: {
|
2021-08-22 23:32:54 +02:00
|
|
|
remove(membership) {
|
|
|
|
this.$inertia.delete(`/member/${this.value.id}/membership/${membership.id}`);
|
2021-08-22 22:23:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
accept(payment) {
|
2022-08-23 23:49:19 +02:00
|
|
|
this.$inertia.patch(`/member/${this.value.id}/payment/${payment.id}`, {...payment, status_id: 3});
|
2021-08-22 22:23:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
openLink(link) {
|
|
|
|
if (link.disabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window.open(link.href);
|
|
|
|
},
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
var _self = this;
|
|
|
|
|
|
|
|
var options = {
|
2022-11-16 23:39:44 +01:00
|
|
|
onSuccess() {
|
2021-08-22 22:23:17 +02:00
|
|
|
_self.single = null;
|
|
|
|
_self.mode = null;
|
2022-08-23 23:49:19 +02:00
|
|
|
},
|
2021-08-22 22:23:17 +02:00
|
|
|
};
|
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
this.mode === 'create'
|
2021-08-22 22:23:17 +02:00
|
|
|
? this.$inertia.post(`/member/${this.value.id}/membership`, this.single, options)
|
|
|
|
: this.$inertia.patch(`/member/${this.value.id}/membership/${this.single.id}`, this.single, options);
|
2022-08-23 23:49:19 +02:00
|
|
|
},
|
2021-08-22 22:23:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
value: {},
|
|
|
|
activities: {},
|
|
|
|
subactivities: {},
|
2023-02-25 19:49:53 +01:00
|
|
|
groups: {},
|
2022-08-23 23:49:19 +02:00
|
|
|
},
|
2021-08-22 22:23:17 +02:00
|
|
|
};
|
|
|
|
</script>
|