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

194 lines
9.0 KiB
Vue
Raw Normal View History

2020-06-02 23:45:25 +02:00
<template>
2023-04-29 23:41:26 +02:00
<page-layout page-class="pb-6">
2023-05-02 23:13:00 +02:00
<div class="flex" slot="toolbar">
<toolbar-button :href="data.meta.links.create" color="primary" icon="plus">Mitglied anlegen</toolbar-button>
<toolbar-button :href="data.meta.links.allpayment" color="primary" icon="invoice" v-if="hasModule('bill')">Rechnungen erstellen</toolbar-button>
<toolbar-button :href="data.meta.links.sendpayment" color="info" icon="envelope" v-if="hasModule('bill')">Rechnungen versenden</toolbar-button>
</div>
2023-05-09 01:34:19 +02:00
<popup heading="Mitglied löschen?" v-if="deleting !== null" @close="deleting.reject()">
<div>
<p class="mt-4">Das Mitglied "{{ deleting.member.fullname }}" löschen?</p>
<p class="mt-2">Alle Zuordnungen (Ausbildungen, Rechnungen, Zahlungen, Tätigkeiten) werden ebenfalls entfernt.</p>
<note class="mt-5" type="warning" v-if="!deleting.member.has_nami"> Dieses Mitglied ist nicht in NaMi vorhanden und wird daher nur in der AdReMa gelöscht werden. </note>
<note class="mt-5" type="danger" v-if="deleting.member.has_nami">
Dieses Mitglied ist in NaMi vorhanden und wird daher in NaMi abgemeldet werden. Sofern "Datenweiterverwendung" eingeschaltet ist, wird das Mitglied auf inaktiv gesetzt.
</note>
<div class="grid grid-cols-2 gap-3 mt-6">
<a href="#" @click.prevent="deleting.resolve()" class="text-center btn btn-danger">Mitglied loschen</a>
<a href="#" @click.prevent="deleting.reject()" class="text-center btn btn-primary">Abbrechen</a>
</div>
</div>
</popup>
2023-03-15 00:08:20 +01:00
<div class="px-6 py-2 flex border-b border-gray-600 items-center space-x-3">
2023-03-15 11:16:52 +01:00
<f-text :value="getFilter('search')" @input="setFilter('search', $event)" id="search" name="search" label="Suchen …" size="sm"></f-text>
2023-03-14 23:27:15 +01:00
<f-switch v-show="hasModule('bill')" id="ausstand" @input="setFilter('ausstand', $event)" :items="getFilter('ausstand')" label="Nur Ausstände" size="sm"></f-switch>
2023-04-25 00:28:44 +02:00
<f-select id="group_id" @input="setFilter('group_id', $event)" :options="data.meta.groups" :value="getFilter('group_id')" label="Gruppierung" size="sm" name="group_id"></f-select>
2023-03-14 23:27:15 +01:00
<f-select
v-show="hasModule('bill')"
name="billKinds"
id="billKinds"
@input="setFilter('bill_kind', $event)"
2023-05-02 23:49:16 +02:00
:options="data.meta.billKinds"
2023-03-14 23:27:15 +01:00
:value="getFilter('bill_kind')"
label="Rechnung"
size="sm"
></f-select>
<f-select
id="activity_id"
@input="setFilter('activity_id', $event)"
2023-05-02 23:49:16 +02:00
:options="data.meta.filterActivities"
2023-03-14 23:27:15 +01:00
:value="getFilter('activity_id')"
label="Tätigkeit"
size="sm"
name="activity_id"
></f-select>
<f-select
id="subactivity_id"
@input="setFilter('subactivity_id', $event)"
2023-05-02 23:49:16 +02:00
:options="data.meta.filterSubactivities"
2023-03-14 23:27:15 +01:00
:value="getFilter('subactivity_id')"
label="Untertätigkeit"
size="sm"
name="subactivity_id"
></f-select>
2023-03-15 00:08:20 +01:00
<button class="btn btn-primary label mr-2" @click.prevent="exportMembers">
<svg-sprite class="w-3 h-3 xl:mr-2" src="save"></svg-sprite>
<span class="hidden xl:inline">Exportieren</span>
</button>
2023-03-14 23:27:15 +01:00
</div>
2021-08-22 05:51:25 +02:00
2022-11-24 00:59:40 +01:00
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm hidden md:table">
2021-08-22 19:31:20 +02:00
<thead>
<th></th>
<th>Nachname</th>
<th>Vorname</th>
2022-11-23 23:49:07 +01:00
<th class="hidden 2xl:table-cell">Ort</th>
2021-08-22 19:31:20 +02:00
<th>Tags</th>
2022-11-23 23:49:07 +01:00
<th class="hidden xl:table-cell">Alter</th>
<th class="hidden xl:table-cell" v-show="hasModule('bill')">Rechnung</th>
2021-11-19 00:53:19 +01:00
<th v-show="hasModule('bill')">Ausstand</th>
2021-08-22 19:31:20 +02:00
<th></th>
</thead>
2021-04-11 02:55:26 +02:00
2023-03-14 23:27:15 +01:00
<tr v-for="(member, index) in inner.data" :key="index">
2022-11-24 00:05:56 +01:00
<td><age-groups :member="member"></age-groups></td>
2021-08-22 19:31:20 +02:00
<td v-text="member.lastname"></td>
<td v-text="member.firstname"></td>
2022-11-23 23:49:07 +01:00
<td class="hidden 2xl:table-cell" v-text="member.full_address"></td>
2022-11-24 00:22:01 +01:00
<td><tags :member="member"></tags></td>
2022-11-23 23:49:07 +01:00
<td class="hidden xl:table-cell" v-text="member.age"></td>
<td class="hidden xl:table-cell" v-show="hasModule('bill')">
2022-11-24 00:59:40 +01:00
<v-label :value="member.bill_kind_name" fallback="kein"></v-label>
2021-08-22 19:31:20 +02:00
</td>
2021-11-19 00:53:19 +01:00
<td v-show="hasModule('bill')">
2022-11-24 00:59:40 +01:00
<v-label :value="member.pending_payment" fallback="---"></v-label>
2021-08-22 19:31:20 +02:00
</td>
2022-11-18 15:55:44 +01:00
<td>
2022-12-05 00:21:24 +01:00
<actions :member="member" @sidebar="openSidebar(index, $event)" @remove="remove(member)"></actions>
2021-08-22 19:31:20 +02:00
</td>
</tr>
</table>
2021-04-11 02:55:26 +02:00
2022-11-24 00:59:40 +01:00
<div class="md:hidden p-3 grid gap-3">
<box class="relative" :heading="member.fullname" v-for="(member, index) in data.data" :key="index">
<div slot="in-title">
<age-groups class="ml-2" :member="member" icon-class="w-4 h-4"></age-groups>
</div>
<div class="text-xs text-gray-200" v-text="member.full_address"></div>
2022-12-05 00:21:24 +01:00
<div class="flex items-center mt-1 space-x-4">
2022-11-24 00:59:40 +01:00
<tags :member="member"></tags>
2023-03-14 23:27:15 +01:00
<v-label class="text-gray-100 block" v-show="hasModule('bill')" :value="member.pending_payment" fallback=""></v-label>
2022-11-24 00:59:40 +01:00
</div>
2023-03-14 23:27:15 +01:00
<actions class="mt-2" :member="member" @sidebar="openSidebar(index, $event)" @remove="remove(member)"></actions>
2022-11-24 00:59:40 +01:00
<div class="absolute right-0 top-0 h-full flex items-center mr-2">
2023-03-14 23:27:15 +01:00
<i-link :href="member.links.show" v-tooltip="`Details`"><svg-sprite src="chevron-down" class="w-6 h-6 text-teal-100 -rotate-90"></svg-sprite></i-link>
2022-11-24 00:59:40 +01:00
</div>
</box>
</div>
2021-04-11 02:55:26 +02:00
<div class="px-6">
2022-02-12 15:12:08 +01:00
<v-pages class="mt-4" :value="data.meta" :only="['data']"></v-pages>
2021-04-11 02:55:26 +02:00
</div>
2021-07-04 16:56:07 +02:00
<transition name="sidebar">
2022-05-13 10:33:57 +02:00
<member-payments
v-if="single !== null && sidebar === 'payment.index'"
@close="closeSidebar"
2023-05-02 23:49:16 +02:00
:subscriptions="data.meta.subscriptions"
:statuses="data.meta.statuses"
2022-05-13 10:33:57 +02:00
:value="data.data[single]"
></member-payments>
<member-memberships
v-if="single !== null && sidebar === 'membership.index'"
@close="closeSidebar"
:groups="data.meta.groups"
2023-05-02 23:49:16 +02:00
:activities="data.meta.formActivities"
:subactivities="data.meta.formSubactivities"
2022-05-13 10:33:57 +02:00
:value="data.data[single]"
></member-memberships>
2023-05-02 23:49:16 +02:00
<member-courses v-if="single !== null && sidebar === 'courses.index'" @close="closeSidebar" :courses="data.meta.courses" :value="data.data[single]"></member-courses>
2021-07-04 16:56:07 +02:00
</transition>
2023-04-29 23:41:26 +02:00
</page-layout>
2020-06-02 23:45:25 +02:00
</template>
<script>
2022-02-12 14:47:07 +01:00
import MemberPayments from './MemberPayments.vue';
import MemberMemberships from './MemberMemberships.vue';
2022-02-12 14:28:56 +01:00
import MemberCourses from './MemberCourses.vue';
2023-03-14 23:27:15 +01:00
import indexHelpers from '../../mixins/indexHelpers.js';
2023-05-02 23:13:00 +02:00
import hasModule from '../../mixins/hasModule.js';
2020-06-02 23:45:25 +02:00
2021-04-11 02:55:26 +02:00
export default {
2022-05-13 10:33:57 +02:00
data: function () {
2021-08-22 05:15:56 +02:00
return {
sidebar: null,
single: null,
2023-05-09 01:34:19 +02:00
deleting: null,
2021-08-22 05:15:56 +02:00
};
},
2023-05-02 23:13:00 +02:00
mixins: [indexHelpers, hasModule],
2022-11-24 00:05:56 +01:00
components: {
MemberMemberships,
MemberPayments,
MemberCourses,
2022-11-24 00:22:01 +01:00
'age-groups': () => import(/* webpackChunkName: "member" */ './AgeGroups'),
'tags': () => import(/* webpackChunkName: "member" */ './Tags'),
2022-12-05 00:21:24 +01:00
'actions': () => import(/* webpackChunkName: "member" */ './index/Actions'),
2023-05-18 23:22:45 +02:00
'popup': () => import(/* webpackChunkName: "ui" */ '../../components/ui/Popup.vue'),
'note': () => import(/* webpackChunkName: "ui" */ '../../components/ui/Note.vue'),
2022-11-24 00:05:56 +01:00
},
2021-07-04 16:56:07 +02:00
2021-07-04 19:09:59 +02:00
methods: {
2023-03-15 00:08:20 +01:00
exportMembers() {
window.open(`/member-export?filter=${this.filterString}`);
},
2023-05-09 01:34:19 +02:00
async remove(member) {
new Promise((resolve, reject) => {
this.deleting = {resolve, reject, member};
})
.then(() => {
this.$inertia.delete(`/member/${member.id}`);
this.deleting = null;
})
.catch(() => {
this.deleting = null;
});
2021-08-22 05:15:56 +02:00
},
openSidebar(index, name) {
this.single = index;
this.sidebar = name;
},
closeSidebar() {
this.single = null;
this.sidebar = null;
2022-05-13 10:33:57 +02:00
},
2021-07-04 19:09:59 +02:00
},
2021-08-22 05:51:25 +02:00
props: {
query: {},
2022-05-13 10:33:57 +02:00
},
};
2020-06-02 23:45:25 +02:00
</script>