enhance: enable deletion of protocol content
This commit is contained in:
parent
5b7a9a3ace
commit
2ce66da1d1
5 changed files with 124 additions and 9 deletions
64
src/components/DoubleConfirmClick.vue
Normal file
64
src/components/DoubleConfirmClick.vue
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="cursor-pointer"
|
||||||
|
:class="{ 'text-white': light, 'animate-pulse': isSensitive }"
|
||||||
|
:title="`2 mal klicken für ${action}`"
|
||||||
|
@click.prevent="handleClick"
|
||||||
|
>
|
||||||
|
<slot :isSensitive="isSensitive">
|
||||||
|
<CursorArrowRaysIcon v-if="!isSensitive" class="h-5 w-5" />
|
||||||
|
<CursorArrowRippleIcon v-else class="h-5 w-5" />
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { CursorArrowRaysIcon, CursorArrowRippleIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
props: {
|
||||||
|
light: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
action: {
|
||||||
|
type: String,
|
||||||
|
default: "Bestätigung",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
emits: ["click:first", "click:submit", "click:reset"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isSensitive: false as boolean,
|
||||||
|
timeout: undefined as any,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
if (this.isSensitive) {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
this.isSensitive = false;
|
||||||
|
this.$emit("click:submit");
|
||||||
|
} else {
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.isSensitive = true;
|
||||||
|
this.$emit("click:first");
|
||||||
|
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.isSensitive = false;
|
||||||
|
this.$emit("click:reset");
|
||||||
|
}, 2000);
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -31,6 +31,16 @@
|
||||||
:disabled="!can('create', 'club', 'protocol')"
|
:disabled="!can('create', 'club', 'protocol')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DoubleConfirmClick
|
||||||
|
v-if="can('create', 'club', 'protocol')"
|
||||||
|
light
|
||||||
|
v-slot="{ isSensitive }"
|
||||||
|
@click:submit="removeFromArray(item.id)"
|
||||||
|
>
|
||||||
|
<TrashIcon v-if="!isSensitive" class="h-5 w-5" />
|
||||||
|
<TrashIconSolid v-else class="h-5 w-5" />
|
||||||
|
</DoubleConfirmClick>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<ChevronUpIcon
|
<ChevronUpIcon
|
||||||
v-if="index != 0"
|
v-if="index != 0"
|
||||||
|
@ -73,7 +83,9 @@ import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
||||||
import { toolbarOptions } from "@/helpers/quillConfig";
|
import { toolbarOptions } from "@/helpers/quillConfig";
|
||||||
import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAgenda";
|
import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAgenda";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
|
import { ChevronDownIcon, ChevronUpIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { TrashIcon as TrashIconSolid } from "@heroicons/vue/24/solid";
|
||||||
|
import DoubleConfirmClick from "@/components/DoubleConfirmClick.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -109,6 +121,9 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
removeFromArray(thisId: number) {
|
||||||
|
this.agenda = this.agenda.filter((item) => item.id !== thisId);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -31,6 +31,16 @@
|
||||||
:disabled="!can('create', 'club', 'protocol')"
|
:disabled="!can('create', 'club', 'protocol')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DoubleConfirmClick
|
||||||
|
v-if="can('create', 'club', 'protocol')"
|
||||||
|
light
|
||||||
|
v-slot="{ isSensitive }"
|
||||||
|
@click:submit="removeFromArray(item.id)"
|
||||||
|
>
|
||||||
|
<TrashIcon v-if="!isSensitive" class="h-5 w-5" />
|
||||||
|
<TrashIconSolid v-else class="h-5 w-5" />
|
||||||
|
</DoubleConfirmClick>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<ChevronUpIcon
|
<ChevronUpIcon
|
||||||
v-if="index != 0"
|
v-if="index != 0"
|
||||||
|
@ -73,7 +83,9 @@ import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
||||||
import { toolbarOptions } from "@/helpers/quillConfig";
|
import { toolbarOptions } from "@/helpers/quillConfig";
|
||||||
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
|
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
|
import { ChevronDownIcon, ChevronUpIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { TrashIcon as TrashIconSolid } from "@heroicons/vue/24/solid";
|
||||||
|
import DoubleConfirmClick from "@/components/DoubleConfirmClick.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -109,6 +121,9 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
removeFromArray(thisId: number) {
|
||||||
|
this.decision = this.decision.filter((item) => item.id !== thisId);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -42,11 +42,15 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<TrashIcon
|
<DoubleConfirmClick
|
||||||
v-if="can('create', 'club', 'protocol')"
|
v-if="can('create', 'club', 'protocol')"
|
||||||
class="w-5 h-5 p-1 box-content cursor-pointer"
|
light
|
||||||
@click="removeSelected(member.memberId)"
|
v-slot="{ isSensitive }"
|
||||||
/>
|
@click:submit="removeSelected(member.memberId)"
|
||||||
|
>
|
||||||
|
<TrashIcon v-if="!isSensitive" class="h-5 w-5" />
|
||||||
|
<TrashIconSolid v-else class="h-5 w-5" />
|
||||||
|
</DoubleConfirmClick>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,10 +61,12 @@ import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState, mapWritableState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import { TrashIcon } from "@heroicons/vue/24/outline";
|
import { TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { TrashIcon as TrashIconSolid } from "@heroicons/vue/24/solid";
|
||||||
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
|
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import MemberSearchSelect from "@/components/admin/MemberSearchSelect.vue";
|
import MemberSearchSelect from "@/components/admin/MemberSearchSelect.vue";
|
||||||
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
||||||
|
import DoubleConfirmClick from "@/components/DoubleConfirmClick.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -31,6 +31,16 @@
|
||||||
:disabled="!can('create', 'club', 'protocol')"
|
:disabled="!can('create', 'club', 'protocol')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DoubleConfirmClick
|
||||||
|
v-if="can('create', 'club', 'protocol')"
|
||||||
|
light
|
||||||
|
v-slot="{ isSensitive }"
|
||||||
|
@click:submit="removeFromArray(item.id)"
|
||||||
|
>
|
||||||
|
<TrashIcon v-if="!isSensitive" class="h-5 w-5" />
|
||||||
|
<TrashIconSolid v-else class="h-5 w-5" />
|
||||||
|
</DoubleConfirmClick>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<ChevronUpIcon
|
<ChevronUpIcon
|
||||||
v-if="index != 0"
|
v-if="index != 0"
|
||||||
|
@ -83,14 +93,16 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import { QuillEditor } from "@vueup/vue-quill";
|
import { QuillEditor } from "@vueup/vue-quill";
|
||||||
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
||||||
import { toolbarOptions } from "@/helpers/quillConfig";
|
import { toolbarOptions } from "@/helpers/quillConfig";
|
||||||
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
|
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
|
import { ChevronDownIcon, ChevronUpIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { TrashIcon as TrashIconSolid } from "@heroicons/vue/24/solid";
|
||||||
|
import DoubleConfirmClick from "@/components/DoubleConfirmClick.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -99,7 +111,7 @@ export default defineComponent({
|
||||||
protocolId: String,
|
protocolId: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useProtocolVotingStore, ["voting", "loading"]),
|
...mapWritableState(useProtocolVotingStore, ["voting", "loading"]),
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
sortedVoting() {
|
sortedVoting() {
|
||||||
return this.voting.slice().sort((a, b) => a.sort - b.sort);
|
return this.voting.slice().sort((a, b) => a.sort - b.sort);
|
||||||
|
@ -126,6 +138,9 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
removeFromArray(thisId: number) {
|
||||||
|
this.voting = this.voting.filter((item) => item.id !== thisId);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue