From b21a89362b4b798c65b060f1cc53af21c962ef81 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Tue, 9 May 2023 01:34:19 +0200 Subject: [PATCH] Add popup for deleting member --- resources/img/svg/danger.svg | 1 + resources/img/svg/info.svg | 1 + resources/img/svg/warning.svg | 1 + resources/js/components/Ui/Note.vue | 62 ++++++++++++++++++++++ resources/js/components/{ => Ui}/Popup.vue | 0 resources/js/views/activity/VForm.vue | 2 +- resources/js/views/activity/VIndex.vue | 2 +- resources/js/views/member/VForm.vue | 2 +- resources/js/views/member/VIndex.vue | 32 +++++++++-- tests/Feature/Member/IndexTest.php | 1 + 10 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 resources/img/svg/danger.svg create mode 100644 resources/img/svg/info.svg create mode 100644 resources/img/svg/warning.svg create mode 100644 resources/js/components/Ui/Note.vue rename resources/js/components/{ => Ui}/Popup.vue (100%) diff --git a/resources/img/svg/danger.svg b/resources/img/svg/danger.svg new file mode 100644 index 00000000..c3b38e04 --- /dev/null +++ b/resources/img/svg/danger.svg @@ -0,0 +1 @@ + diff --git a/resources/img/svg/info.svg b/resources/img/svg/info.svg new file mode 100644 index 00000000..172e192e --- /dev/null +++ b/resources/img/svg/info.svg @@ -0,0 +1 @@ + diff --git a/resources/img/svg/warning.svg b/resources/img/svg/warning.svg new file mode 100644 index 00000000..2797a621 --- /dev/null +++ b/resources/img/svg/warning.svg @@ -0,0 +1 @@ + diff --git a/resources/js/components/Ui/Note.vue b/resources/js/components/Ui/Note.vue new file mode 100644 index 00000000..f40420ff --- /dev/null +++ b/resources/js/components/Ui/Note.vue @@ -0,0 +1,62 @@ + + + diff --git a/resources/js/components/Popup.vue b/resources/js/components/Ui/Popup.vue similarity index 100% rename from resources/js/components/Popup.vue rename to resources/js/components/Ui/Popup.vue diff --git a/resources/js/views/activity/VForm.vue b/resources/js/views/activity/VForm.vue index 1bbd6705..6cf12084 100644 --- a/resources/js/views/activity/VForm.vue +++ b/resources/js/views/activity/VForm.vue @@ -56,7 +56,7 @@ export default { components: { 'checkboxes-label': () => import('../../components/Form/CheckboxesLabel'), 'subactivity-form': () => import('./SubactivityForm.vue'), - 'popup': () => import('../../components/Popup.vue'), + 'popup': () => import(/* webpackChunkName: "ui" */ '../../components/Ui/Popup.vue'), }, methods: { diff --git a/resources/js/views/activity/VIndex.vue b/resources/js/views/activity/VIndex.vue index 4c372a80..53f15a50 100644 --- a/resources/js/views/activity/VIndex.vue +++ b/resources/js/views/activity/VIndex.vue @@ -59,7 +59,7 @@ export default { }, components: { - popup: () => import('../../components/Popup.vue'), + popup: () => import(/* webpackChunkName: "ui" */ '../../components/Ui/Popup.vue'), }, mixins: [indexHelpers], diff --git a/resources/js/views/member/VForm.vue b/resources/js/views/member/VForm.vue index 432282e5..758c13f2 100644 --- a/resources/js/views/member/VForm.vue +++ b/resources/js/views/member/VForm.vue @@ -156,7 +156,7 @@ export default { }, components: { - popup: () => import('../../components/Popup.vue'), + popup: () => import(/* webpackChunkName: "ui" */ '../../components/Ui/Popup.vue'), }, computed: { diff --git a/resources/js/views/member/VIndex.vue b/resources/js/views/member/VIndex.vue index 9f8c1d1e..0fa6b239 100644 --- a/resources/js/views/member/VIndex.vue +++ b/resources/js/views/member/VIndex.vue @@ -5,6 +5,20 @@ Rechnungen erstellen Rechnungen versenden + +
+

Das Mitglied "{{ deleting.member.fullname }}" löschen?

+

Alle Zuordnungen (Ausbildungen, Rechnungen, Zahlungen, Tätigkeiten) werden ebenfalls entfernt.

+ Dieses Mitglied ist nicht in NaMi vorhanden und wird daher nur in der AdReMa gelöscht werden. + + Dieses Mitglied ist in NaMi vorhanden und wird daher in NaMi abgemeldet werden. Sofern "Datenweiterverwendung" eingeschaltet ist, wird das Mitglied auf inaktiv gesetzt. + + +
+
@@ -129,6 +143,7 @@ export default { return { sidebar: null, single: null, + deleting: null, }; }, @@ -141,16 +156,25 @@ export default { 'age-groups': () => import(/* webpackChunkName: "member" */ './AgeGroups'), 'tags': () => import(/* webpackChunkName: "member" */ './Tags'), 'actions': () => import(/* webpackChunkName: "member" */ './index/Actions'), + 'popup': () => import(/* webpackChunkName: "ui" */ '../../components/Ui/Popup.vue'), + 'note': () => import(/* webpackChunkName: "ui" */ '../../components/Ui/Note.vue'), }, methods: { exportMembers() { window.open(`/member-export?filter=${this.filterString}`); }, - remove(member) { - if (window.confirm('Mitglied löschen?')) { - this.$inertia.delete(`/member/${member.id}`); - } + 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; + }); }, openSidebar(index, name) { this.single = index; diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index e459ab26..9bafead5 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -31,6 +31,7 @@ class IndexTest extends TestCase $this->assertComponent('member/VIndex', $response); $this->assertInertiaHas('::firstname::', $response, 'data.data.0.firstname'); + $this->assertInertiaHas(false, $response, 'data.data.0.has_nami'); $this->assertInertiaHas('Kölner Str 3, 33333 Hilden', $response, 'data.data.0.full_address'); $this->assertInertiaHas($group->id, $response, 'data.data.0.group_id'); }