|
1 | 1 | <script lang="ts"> |
2 | 2 | import type { Entry } from "$models/entry.model" |
3 | 3 | |
4 | | - import { academicTitleMapping } from "$lib/entryMappings" |
| 4 | + import { academicTitleMapping, makeTranslatedMapping, subjectMapping, offerMapping, attributeMapping, accessibleMapping, typeMapping } from "$lib/entryMappings" |
5 | 5 | |
6 | 6 | import axios from "axios" |
7 | 7 | import { getObjChanges, replaceFields } from "$lib/utils" |
8 | | - import { t } from "$lib/localization" |
| 8 | + import { t, tEntry } from "$lib/localization" |
9 | 9 | import { popupOk, popupError } from "$components/popup.svelte" |
10 | 10 | |
11 | 11 | import EditableInputField from "$components/database/editableInputField.svelte" |
|
21 | 21 | import XIcon from "lucide-icons-svelte/x.svelte" |
22 | 22 | import LinkIcon from "lucide-icons-svelte/link.svelte" |
23 | 23 | |
24 | | - const { subjectMapping, typeMapping, offerMapping, attributeMapping, accessibleMapping } = t("entryMapping"); |
25 | | -
|
26 | 24 | let edit: boolean = false; |
27 | 25 | export let entry: Entry = null; |
28 | 26 | |
|
139 | 137 | <div class="auto-grid"> |
140 | 138 | <div class="header"> |
141 | 139 | <EditableInputField label="Name des Eintrags" bind:value={ _entry.name } { edit } /> |
142 | | - <EditableSelectField label="Kategorie" bind:value={ _entry.type } mapping={ typeMapping } { edit } /> |
| 140 | + <EditableSelectField label="Kategorie" bind:value={ _entry.type } mapping={ makeTranslatedMapping(typeMapping, tEntry("typeMapping")) } { edit } /> |
143 | 141 | <EditableCheckbox label="Blockiert" bind:checked={ _entry.blocked } { edit } class="narrow"/> |
144 | 142 | <EditableCheckbox label="Freigeschaltet" bind:checked={ _entry.approved } { edit } class="narrow"/> |
145 | 143 | </div> |
|
168 | 166 | <span class="group-title"> Kontaktdaten </span> |
169 | 167 |
|
170 | 168 | <div class="sub-grid"> |
171 | | - <EditableSelectField label="Titel" bind:value={ _entry.academicTitle } mapping={ academicTitleMapping } nullMapping="Kein Titel" { edit } /> |
| 169 | + <EditableSelectField label="Titel" bind:value={ _entry.academicTitle } mapping={ makeTranslatedMapping(academicTitleMapping, tEntry("academicTitleMapping")) } nullMapping="Kein Titel" { edit } /> |
172 | 170 | <EditableInputField label="Vorname" bind:value={ _entry.firstName } { edit } /> |
173 | 171 | <EditableInputField label="Nachname" bind:value={ _entry.lastName } { edit } /> |
174 | 172 |
|
|
185 | 183 | </div> |
186 | 184 |
|
187 | 185 | <div class="sub-grid"> |
188 | | - <EditableRadioList label="Angebote" bind:value={ _entry.meta.offers } mapping={ offerMapping[_entry.type] } { edit } /> |
189 | | - <EditableRadioList label="Attribute" bind:value={ _entry.meta.attributes } mapping={ attributeMapping[_entry.type] } { edit } /> |
| 186 | + <EditableRadioList label="Angebote" bind:value={ _entry.meta.offers } mapping={ makeTranslatedMapping(offerMapping[_entry.type], tEntry("offerMapping")) } { edit } /> |
| 187 | + <EditableRadioList label="Attribute" bind:value={ _entry.meta.attributes } mapping={ makeTranslatedMapping(attributeMapping[_entry.type], tEntry("attributeMapping")) } { edit } /> |
190 | 188 | </div> |
191 | 189 |
|
192 | 190 | <div class="sub-grid"> |
193 | 191 | <EditableInputField label="Besonderheiten" bind:value={ _entry.meta.specials } { edit } /> |
194 | 192 | <EditableInputField label="Mindestalter" number bind:value={ _entry.meta.minAge } { edit } /> |
195 | 193 |
|
196 | 194 | {#if subjectMapping[_entry.type]} |
197 | | - <EditableSelectField label="Fachrichtung" bind:value={ _entry.meta.subject } mapping={ subjectMapping[_entry.type] } { edit } /> |
| 195 | + <EditableSelectField label="Fachrichtung" bind:value={ _entry.meta.subject } mapping={ makeTranslatedMapping(subjectMapping[_entry.type], tEntry("subjectMapping")) } { edit } /> |
198 | 196 | {/if} |
199 | 197 |
|
200 | | - <EditableSelectField label="Barrierefrei" bind:value={ _entry.accessible } mapping={ accessibleMapping } { edit } /> |
| 198 | + <EditableSelectField label="Barrierefrei" bind:value={ _entry.accessible } mapping={ makeTranslatedMapping(accessibleMapping, tEntry("accessibleMapping")) } { edit } /> |
201 | 199 | </div> |
202 | 200 |
|
203 | 201 | <div class="sub-grid grid-full-width"> |
|
0 commit comments