Add unique fields for mmebership filters
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2024-05-27 20:39:06 +02:00
parent db640c8185
commit 5bd52e7b51
1 changed files with 62 additions and 50 deletions

View File

@ -1,21 +1,16 @@
<template> <template>
<page-layout page-class="pb-6"> <page-layout page-class="pb-6">
<template #toolbar> <template #toolbar>
<page-toolbar-button :href="meta.links.create" color="primary" icon="plus">Mitglied <page-toolbar-button :href="meta.links.create" color="primary" icon="plus">Mitglied anlegen</page-toolbar-button>
anlegen</page-toolbar-button> <page-toolbar-button v-if="hasModule('bill')" :href="meta.links.allpayment" color="primary" icon="invoice">Rechnungen erstellen</page-toolbar-button>
<page-toolbar-button v-if="hasModule('bill')" :href="meta.links.allpayment" color="primary"
icon="invoice">Rechnungen erstellen</page-toolbar-button>
</template> </template>
<ui-popup v-if="deleting !== null" heading="Mitglied löschen?" @close="deleting.reject()"> <ui-popup v-if="deleting !== null" heading="Mitglied löschen?" @close="deleting.reject()">
<div> <div>
<p class="mt-4">Das Mitglied "{{ deleting.member.fullname }}" löschen?</p> <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 <p class="mt-2">Alle Zuordnungen (Ausbildungen, Rechnungen, Zahlungen, Tätigkeiten) werden ebenfalls entfernt.</p>
entfernt.</p> <ui-note v-if="!deleting.member.has_nami" class="mt-5" type="warning"> Dieses Mitglied ist nicht in NaMi vorhanden und wird daher nur in der AdReMa gelöscht werden. </ui-note>
<ui-note v-if="!deleting.member.has_nami" class="mt-5" type="warning"> Dieses Mitglied ist nicht in NaMi
vorhanden und wird daher nur in der AdReMa gelöscht werden. </ui-note>
<ui-note v-if="deleting.member.has_nami" class="mt-5" type="danger"> <ui-note v-if="deleting.member.has_nami" class="mt-5" type="danger">
Dieses Mitglied ist in NaMi vorhanden und wird daher in NaMi abgemeldet werden. Sofern Dieses Mitglied ist in NaMi vorhanden und wird daher in NaMi abgemeldet werden. Sofern "Datenweiterverwendung" eingeschaltet ist, wird das Mitglied auf inaktiv gesetzt.
"Datenweiterverwendung" eingeschaltet ist, wird das Mitglied auf inaktiv gesetzt.
</ui-note> </ui-note>
<div class="grid grid-cols-2 gap-3 mt-6"> <div class="grid grid-cols-2 gap-3 mt-6">
<a href="#" class="text-center btn btn-danger" @click.prevent="deleting.resolve">Mitglied loschen</a> <a href="#" class="text-center btn btn-danger" @click.prevent="deleting.resolve">Mitglied loschen</a>
@ -23,39 +18,62 @@
</div> </div>
</div> </div>
</ui-popup> </ui-popup>
<ui-popup v-if="membershipFilters !== null" heading="Nach Mitgliedschaften filtern" full <ui-popup v-if="membershipFilters !== null" heading="Nach Mitgliedschaften filtern" full @close="membershipFilters = null">
@close="membershipFilters = null"> <button class="btn btn-primary label mt-2" @click.prevent="membershipFilters.push({...meta.default_membership_filter})">
<button class="btn btn-primary label mt-2"
@click.prevent="membershipFilters.push({ ...meta.default_membership_filter })">
<ui-sprite class="w-3 h-3 xl:mr-2" src="plus"></ui-sprite> <ui-sprite class="w-3 h-3 xl:mr-2" src="plus"></ui-sprite>
<span class="hidden xl:inline">Hinzufügen</span> <span class="hidden xl:inline">Hinzufügen</span>
</button> </button>
<div v-for="(filter, index) in membershipFilters" :key="index" class="flex space-x-2 mt-2"> <div v-for="(filter, index) in membershipFilters" :key="index" class="flex space-x-2 mt-2">
<f-multipleselect id="group_id" v-model="filter.group_ids" :options="meta.groups" label="Gruppierung" <f-multipleselect :id="`group_ids-${index}`" v-model="filter.group_ids" :options="meta.groups" label="Gruppierung" size="sm" :name="`group_ids-${index}`"></f-multipleselect>
size="sm" name="group_id"></f-multipleselect> <f-multipleselect
<f-multipleselect id="activity_ids" v-model="filter.activity_ids" :options="meta.filterActivities" :id="`activity_ids-${index}`"
label="Tätigkeiten" size="sm" name="activity_ids"></f-multipleselect> v-model="filter.activity_ids"
<f-multipleselect id="subactivity_ids" v-model="filter.subactivity_ids" :options="meta.filterSubactivities" :options="meta.filterActivities"
label="Untertätigkeiten" size="sm" name="subactivity_ids"></f-multipleselect> label="Tätigkeiten"
size="sm"
:name="`activity_ids-${index}`"
></f-multipleselect>
<f-multipleselect
:id="`subactivity_ids-${index}`"
v-model="filter.subactivity_ids"
:options="meta.filterSubactivities"
label="Untertätigkeiten"
size="sm"
:name="`subactivity_ids-${index}`"
></f-multipleselect>
</div> </div>
<button class="btn btn-primary label mt-3" @click.prevent=" <button
setFilter('memberships', membershipFilters); class="btn btn-primary label mt-3"
membershipFilters = null; @click.prevent="
"> setFilter('memberships', membershipFilters);
membershipFilters = null;
"
>
<span class="hidden xl:inline">Anwenden</span> <span class="hidden xl:inline">Anwenden</span>
</button> </button>
</ui-popup> </ui-popup>
<page-filter breakpoint="xl"> <page-filter breakpoint="xl">
<f-text id="search" :model-value="getFilter('search')" name="search" label="Suchen …" size="sm" <f-text id="search" :model-value="getFilter('search')" name="search" label="Suchen …" size="sm" @update:model-value="setFilter('search', $event)"></f-text>
@update:model-value="setFilter('search', $event)"></f-text> <f-switch v-show="hasModule('bill')" id="ausstand" :model-value="getFilter('ausstand')" label="Nur Ausstände" size="sm" @update:model-value="setFilter('ausstand', $event)"></f-switch>
<f-switch v-show="hasModule('bill')" id="ausstand" :model-value="getFilter('ausstand')" label="Nur Ausstände" <f-multipleselect
size="sm" @update:model-value="setFilter('ausstand', $event)"></f-switch> id="group_ids"
<f-multipleselect id="group_ids" :options="meta.groups" :model-value="getFilter('group_ids')" :options="meta.groups"
label="Gruppierungen" size="sm" name="group_ids" :model-value="getFilter('group_ids')"
@update:model-value="setFilter('group_ids', $event)"></f-multipleselect> label="Gruppierungen"
<f-select v-show="hasModule('bill')" id="billKinds" name="billKinds" :options="meta.billKinds" size="sm"
:model-value="getFilter('bill_kind')" label="Rechnung" size="sm" name="group_ids"
@update:model-value="setFilter('bill_kind', $event)"></f-select> @update:model-value="setFilter('group_ids', $event)"
></f-multipleselect>
<f-select
v-show="hasModule('bill')"
id="billKinds"
name="billKinds"
:options="meta.billKinds"
:model-value="getFilter('bill_kind')"
label="Rechnung"
size="sm"
@update:model-value="setFilter('bill_kind', $event)"
></f-select>
<button class="btn btn-primary label mr-2" @click.prevent="membershipFilters = getFilter('memberships')"> <button class="btn btn-primary label mr-2" @click.prevent="membershipFilters = getFilter('memberships')">
<ui-sprite class="w-3 h-3 xl:mr-2" src="filter"></ui-sprite> <ui-sprite class="w-3 h-3 xl:mr-2" src="filter"></ui-sprite>
<span class="hidden xl:inline">Mitgliedschaften</span> <span class="hidden xl:inline">Mitgliedschaften</span>
@ -108,14 +126,11 @@
<div class="text-xs text-gray-200" v-text="member.full_address"></div> <div class="text-xs text-gray-200" v-text="member.full_address"></div>
<div class="flex items-center mt-1 space-x-4"> <div class="flex items-center mt-1 space-x-4">
<tags :member="member"></tags> <tags :member="member"></tags>
<ui-label v-show="hasModule('bill')" class="text-gray-100 block" :value="member.pending_payment" <ui-label v-show="hasModule('bill')" class="text-gray-100 block" :value="member.pending_payment" fallback=""></ui-label>
fallback=""></ui-label>
</div> </div>
<actions class="mt-2" :member="member" @sidebar="openSidebar($event, member)" @remove="remove(member)"> <actions class="mt-2" :member="member" @sidebar="openSidebar($event, member)" @remove="remove(member)"> </actions>
</actions>
<div class="absolute right-0 top-0 h-full flex items-center mr-2"> <div class="absolute right-0 top-0 h-full flex items-center mr-2">
<i-link v-tooltip="`Details`" :href="member.links.show"><ui-sprite src="chevron" <i-link v-tooltip="`Details`" :href="member.links.show"><ui-sprite src="chevron" class="w-6 h-6 text-teal-100 -rotate-90"></ui-sprite></i-link>
class="w-6 h-6 text-teal-100 -rotate-90"></ui-sprite></i-link>
</div> </div>
</ui-box> </ui-box>
</div> </div>
@ -125,12 +140,9 @@
</div> </div>
<ui-sidebar v-if="single !== null" @close="closeSidebar"> <ui-sidebar v-if="single !== null" @close="closeSidebar">
<member-invoice-positions v-if="single.type === 'invoicePosition'" <member-invoice-positions v-if="single.type === 'invoicePosition'" :url="single.model.links.invoiceposition_index" @close="closeSidebar"></member-invoice-positions>
:url="single.model.links.invoiceposition_index" @close="closeSidebar"></member-invoice-positions> <member-memberships v-if="single.type === 'membership'" :url="single.model.links.membership_index" @close="closeSidebar"></member-memberships>
<member-memberships v-if="single.type === 'membership'" :url="single.model.links.membership_index" <member-courses v-if="single.type === 'courses'" :url="single.model.links.course_index" @close="closeSidebar"></member-courses>
@close="closeSidebar"></member-memberships>
<member-courses v-if="single.type === 'courses'" :url="single.model.links.course_index"
@close="closeSidebar"></member-courses>
</ui-sidebar> </ui-sidebar>
</page-layout> </page-layout>
</template> </template>
@ -141,15 +153,15 @@ import MemberMemberships from './MemberMemberships.vue';
import MemberCourses from './MemberCourses.vue'; import MemberCourses from './MemberCourses.vue';
import Tags from './Tags.vue'; import Tags from './Tags.vue';
import Actions from './index/Actions.vue'; import Actions from './index/Actions.vue';
import { indexProps, useIndex } from '../../composables/useIndex.js'; import {indexProps, useIndex} from '../../composables/useIndex.js';
import { ref, defineProps } from 'vue'; import {ref, defineProps} from 'vue';
const single = ref(null); const single = ref(null);
const deleting = ref(null); const deleting = ref(null);
const membershipFilters = ref(null); const membershipFilters = ref(null);
const props = defineProps(indexProps); const props = defineProps(indexProps);
var { router, data, meta, getFilter, setFilter, filterString, reloadPage } = useIndex(props.data, 'member'); var {router, data, meta, getFilter, setFilter, filterString, reloadPage} = useIndex(props.data, 'member');
function exportMembers() { function exportMembers() {
window.open(`/member-export?filter=${filterString.value}`); window.open(`/member-export?filter=${filterString.value}`);
@ -157,7 +169,7 @@ function exportMembers() {
async function remove(member) { async function remove(member) {
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
deleting.value = { resolve, reject, member }; deleting.value = {resolve, reject, member};
}) })
.then(() => { .then(() => {
router.delete(`/member/${member.id}`); router.delete(`/member/${member.id}`);