enhance: provide latest inserted internal Id

This commit is contained in:
Julian Krauser 2025-04-30 12:22:41 +02:00
parent e607f8c599
commit bbf5b65aab
2 changed files with 20 additions and 2 deletions

View file

@ -69,7 +69,15 @@
<input type="date" id="birthdate" required /> <input type="date" id="birthdate" required />
</div> </div>
<div> <div>
<label for="internalId">Interne ID (optional)</label> <div class="flex flex-row">
<label for="internalId" class="grow">
Interne ID (optional{{ lastId ? ` - zuletzte verwendet: ${lastId}` : "" }})
</label>
<div title="Es empfiehlt sich, die Interne Id mit Platzhaltern wie '0' vorne aufzufüllen.">
<InformationCircleIcon class="h-5 w-5" />
</div>
</div>
<input type="text" id="internalId" /> <input type="text" id="internalId" />
</div> </div>
<div class="flex flex-row gap-2"> <div class="flex flex-row gap-2">
@ -103,6 +111,7 @@ import { useMemberStore } from "@/stores/admin/club/member/member";
import type { CreateMemberViewModel } from "@/viewmodels/admin/club/member/member.models"; import type { CreateMemberViewModel } from "@/viewmodels/admin/club/member/member.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation"; import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models"; import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
</script> </script>
<script lang="ts"> <script lang="ts">
@ -112,6 +121,7 @@ export default defineComponent({
status: null as null | "loading" | { status: "success" | "failed"; reason?: string }, status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
timeout: undefined as any, timeout: undefined as any,
selectedSalutation: null as null | SalutationViewModel, selectedSalutation: null as null | SalutationViewModel,
lastId: "" as string,
}; };
}, },
computed: { computed: {
@ -119,6 +129,11 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.fetchSalutations(); this.fetchSalutations();
this.fetchLastInternalId()
.then((res) => {
this.lastId = res.data;
})
.catch(() => {});
}, },
beforeUnmount() { beforeUnmount() {
try { try {
@ -127,7 +142,7 @@ export default defineComponent({
}, },
methods: { methods: {
...mapActions(useModalStore, ["closeModal"]), ...mapActions(useModalStore, ["closeModal"]),
...mapActions(useMemberStore, ["createMember"]), ...mapActions(useMemberStore, ["createMember", "fetchLastInternalId"]),
...mapActions(useSalutationStore, ["fetchSalutations"]), ...mapActions(useSalutationStore, ["fetchSalutations"]),
triggerCreate(e: any) { triggerCreate(e: any) {
if (!this.selectedSalutation) return; if (!this.selectedSalutation) return;

View file

@ -87,6 +87,9 @@ export const useMemberStore = defineStore("member", {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
fetchLastInternalId() {
return http.get(`/admin/member/last/internalId`);
},
async printMemberByActiveId() { async printMemberByActiveId() {
return http.get(`/admin/member/${this.activeMember}/print`, { return http.get(`/admin/member/${this.activeMember}/print`, {
responseType: "blob", responseType: "blob",