Skip to content

Commit

Permalink
fix Klassenmanagement
Browse files Browse the repository at this point in the history
  • Loading branch information
pkleybolte committed Dec 13, 2024
1 parent 84204bb commit 1c02796
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/components/admin/ResultTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
:items-length="totalItems"
:items-per-page="itemsPerPage"
:items-per-page-options="[30, 50, 100, 300]"
:items-per-page-text="$t('itemsPerPage')"
:items-per-page-text="'itemsPerPage'"
:item-value="itemValuePath"
:page="currentPage"
ref="v-data-table-server"
Expand All @@ -147,7 +147,7 @@
@update:options="onUpdateOptions"
@update:page="(page: number) => $emit('onPageUpdate', page)"
@update:itemsPerPage="(limit: number) => $emit('onItemsPerPageUpdate', limit)"
:no-data-text="$t('noDataFound')"
:no-data-text="'noDataFound'"
>
<template
v-for="(_, name) in $slots as unknown as Readonly<Slots>"
Expand Down
32 changes: 22 additions & 10 deletions src/views/admin/KlassenManagementView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch, type ComputedRef, type Ref } from 'vue';
import ResultTable, { type TableRow } from '@/components/admin/ResultTable.vue';
import { type Composer, useI18n } from 'vue-i18n';
import type { VDataTableServer } from 'vuetify/lib/components/index.mjs';
import {
Expand All @@ -8,11 +9,14 @@
type Organisation,
type OrganisationStore,
} from '@/stores/OrganisationStore';
import LayoutCard from '@/components/cards/LayoutCard.vue';
import { useAuthStore, type AuthStore } from '@/stores/AuthStore';
import type { UserinfoPersonenkontext } from '@/stores/PersonenkontextStore';
import { useSearchFilterStore, type SearchFilterStore } from '@/stores/SearchFilterStore';
import { type TranslatedObject } from '@/types.d';
import { onBeforeRouteLeave, useRouter, type Router } from 'vue-router';
import KlasseDelete from '@/components/admin/klassen/KlasseDelete.vue';
import SpshAlert from '@/components/alert/SpshAlert.vue';
const authStore: AuthStore = useAuthStore();
const organisationStore: OrganisationStore = useOrganisationStore();
Expand Down Expand Up @@ -71,6 +75,22 @@
}))
.sort((a: TranslatedObject, b: TranslatedObject) => a.title.localeCompare(b.title));
});
const errorTitle: ComputedRef<string> = computed(() => {
if (!organisationStore.errorCode) {
return '';
}
return organisationStore.errorCode === 'UNSPECIFIED_ERROR'
? t('admin.klasse.loadingErrorTitle')
: t(`admin.klasse.title.${organisationStore.errorCode}`);
});
const errorText: ComputedRef<string> = computed(() => {
if (!organisationStore.errorCode) {
return '';
}
return organisationStore.errorCode === 'UNSPECIFIED_ERROR'
? t('admin.klasse.loadingErrorText')
: t(`admin.klasse.errors.${organisationStore.errorCode}`);
});
async function fetchKlassenBySelectedSchuleId(schuleId: string | null): Promise<void> {
// Fetch Klassen related to the selected Schule
Expand Down Expand Up @@ -475,18 +495,10 @@
<!-- Error Message Display -->
<SpshAlert
:model-value="!!organisationStore.errorCode"
:title="
organisationStore.errorCode === 'UNSPECIFIED_ERROR'
? $t('admin.klasse.loadingErrorTitle')
: $t(`admin.klasse.title.${organisationStore.errorCode}`)
"
:title="errorTitle"
:type="'error'"
:closable="false"
:text="
organisationStore.errorCode === 'UNSPECIFIED_ERROR'
? $t('admin.klasse.loadingErrorText')
: $t(`admin.klasse.errors.${organisationStore.errorCode}`)
"
:text="errorText"
:showButton="true"
:buttonText="$t('nav.backToList')"
:buttonAction="handleAlertClose"
Expand Down

0 comments on commit 1c02796

Please sign in to comment.