Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPSH 1406 moved error alert into form wrapper #337

Merged
merged 16 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 63 additions & 57 deletions src/components/form/KlasseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const personenkontextStore: PersonenkontextStore = usePersonenkontextStore();

type Props = {
errorCode?: string;
schulen?: Array<{ value: string; title: string }>;
readonly?: boolean;
selectedSchuleProps?: BaseFieldProps & { error: boolean; 'error-messages': Array<string> };
Expand Down Expand Up @@ -82,70 +83,75 @@
:confirmUnsavedChangesAction="onHandleConfirmUnsavedChanges"
:createButtonLabel="$t('admin.klasse.create')"
:discardButtonLabel="$t('admin.klasse.discard')"
:hideActions="readonly"
:hideActions="readonly || !!props.errorCode"
id="klasse-form"
:onDiscard="onHandleDiscard"
@onShowDialogChange="onShowDialogChange"
:onSubmit="onSubmit"
:showUnsavedChangesDialog="showUnsavedChangesDialog"
>
<!-- Schule zuordnen -->
<v-row>
<h3 class="headline-3">1. {{ $t('admin.schule.assignSchule') }}</h3>
</v-row>
<FormRow
:errorLabel="selectedSchuleProps?.error || ''"
labelForId="schule-select"
:isRequired="true"
:label="$t('admin.schule.schule')"
>
<v-autocomplete
autocomplete="off"
:class="[{ 'filter-dropdown mb-4': hasAutoselectedSchule }, { selected: selectedSchule }]"
clearable
data-testid="schule-select"
density="compact"
:disabled="hasAutoselectedSchule || readonly"
id="schule-select"
:items="schulen"
item-value="value"
item-text="title"
:no-data-text="$t('noDataFound')"
:placeholder="$t('admin.schule.assignSchule')"
ref="schule-select"
required="true"
variant="outlined"
v-bind="selectedSchuleProps"
v-model="selectedSchule"
v-model:search="searchInputSchule"
hide-details
></v-autocomplete>
</FormRow>
<!-- Slot for SPSH alerts -->
<slot />

<!-- Klassenname eingeben -->
<v-row class="mt-8">
<h3 class="headline-3">2. {{ $t('admin.klasse.enterKlassenname') }}</h3>
</v-row>
<FormRow
:errorLabel="selectedKlassennameProps?.error || ''"
labelForId="klassenname-input"
:isRequired="true"
:label="$t('admin.klasse.klassenname')"
>
<v-text-field
clearable
data-testid="klassenname-input"
density="compact"
:disabled="!isEditActive"
id="klassenname-input"
:placeholder="$t('admin.klasse.enterKlassenname')"
ref="klassenname-input"
required="true"
variant="outlined"
v-bind="selectedKlassennameProps"
v-model="selectedKlassenname"
></v-text-field>
</FormRow>
<template v-if="!props.errorCode">
<!-- Schule zuordnen -->
<v-row>
<h3 class="headline-3">1. {{ $t('admin.schule.assignSchule') }}</h3>
</v-row>
<FormRow
:errorLabel="selectedSchuleProps?.error || ''"
labelForId="schule-select"
:isRequired="true"
:label="$t('admin.schule.schule')"
>
<v-autocomplete
autocomplete="off"
:class="[{ 'filter-dropdown mb-4': hasAutoselectedSchule }, { selected: selectedSchule }]"
clearable
data-testid="schule-select"
density="compact"
:disabled="hasAutoselectedSchule || readonly"
id="schule-select"
:items="schulen"
item-value="value"
item-text="title"
:no-data-text="$t('noDataFound')"
:placeholder="$t('admin.schule.assignSchule')"
ref="schule-select"
required="true"
variant="outlined"
v-bind="selectedSchuleProps"
v-model="selectedSchule"
v-model:search="searchInputSchule"
hide-details
></v-autocomplete>
</FormRow>

<!-- Klassenname eingeben -->
<v-row class="mt-8">
<h3 class="headline-3">2. {{ $t('admin.klasse.enterKlassenname') }}</h3>
</v-row>
<FormRow
:errorLabel="selectedKlassennameProps?.error || ''"
labelForId="klassenname-input"
:isRequired="true"
:label="$t('admin.klasse.klassenname')"
>
<v-text-field
clearable
data-testid="klassenname-input"
density="compact"
:disabled="!isEditActive"
id="klassenname-input"
:placeholder="$t('admin.klasse.enterKlassenname')"
ref="klassenname-input"
required="true"
variant="outlined"
v-bind="selectedKlassennameProps"
v-model="selectedKlassenname"
></v-text-field>
</FormRow>
</template>
</FormWrapper>
</template>

Expand Down
Loading
Loading