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

RISDEV-6143 Add 'documentType category #70

Merged
merged 7 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions frontend/e2e/RubrikenPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ test(
amtlicheLangüberschriftElement.fill('my long title')
await expect(amtlicheLangüberschriftElement).toHaveValue('my long title')

// const dokumentTyp = page.getByText('Dokumenttyp')
// await expect(dokumentTyp).toHaveCount(1)
// dokumentTyp.selectOption({ label: 'VR' }) // select by visible text option
// await expect(dokumentTyp).toHaveValue('vr') // confirm selection by value
const dokumentTyp = page.getByText('Dokumenttyp')
await expect(dokumentTyp).toHaveCount(1)
await dokumentTyp.fill('V')
await expect(page.getByText('VR')).toHaveCount(1)
await page.getByText('VR').click()
await expect(dokumentTyp).toHaveValue('VR') // confirm selection by value

// const inkrafttretedatumElement = page.getByText('Inkrafttretedatum')
// await expect(inkrafttretedatumElement).toHaveCount(1)
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/input/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LabelPosition } from '@/components/input/InputField.vue'
import LegalPeriodical from '@/domain/legalPeriodical'
import type { Court } from '@/domain/documentUnit'
import type { Court, DocumentType } from '@/domain/documentUnit'
import type { Ref } from 'vue'
import type { ComboboxResult } from '@/domain/comboboxResult.ts'

Expand Down Expand Up @@ -118,7 +118,7 @@ export interface DropdownInputField extends BaseInputField {
}

//COMBOBOX
export type ComboboxInputModelType = LegalPeriodical | Court
export type ComboboxInputModelType = LegalPeriodical | Court | DocumentType
andreas-deazevedo marked this conversation as resolved.
Show resolved Hide resolved

export type ComboboxItem = {
label: string
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/domain/documentUnit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import type DocumentationOffice from './documentationOffice'

export type DocumentType = {
uuid?: string
jurisShortcut: string
label: string
}

export type Court = {
type?: string
location?: string
Expand Down
17 changes: 15 additions & 2 deletions frontend/src/routes/documentUnit/[documentNumber]/RubrikenPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Textarea from 'primevue/textarea'

const selectedCourt = ref()
const zitierdatum = ref()
const selectedDocumentType = ref()
</script>

<template>
Expand All @@ -21,7 +22,7 @@ const zitierdatum = ref()
<DateInput
id="zitierdatum"
v-model="zitierdatum"
aria-label="fasdf"
ariaLabel="fasdf"
class="ds-input-medium"
></DateInput>
</InputField>
Expand All @@ -37,7 +38,7 @@ const zitierdatum = ref()
</InputField>
</div>
</div>
<div class="flex flex-col">
<div class="flex flex-row gap-24">
<InputField id="langue" label="Amtl. Langüberschrift *">
<Textarea
id="langue"
Expand All @@ -48,6 +49,18 @@ const zitierdatum = ref()
/>
</InputField>
</div>
<div class="border-b-1 border-b-gray-400"></div>
andreas-deazevedo marked this conversation as resolved.
Show resolved Hide resolved
<div class="flex flex-row gap-24">
<InputField id="documentType" class="w-[calc(50%-10px)]" label="Dokumenttyp *">
<ComboboxInput
id="documentType"
v-model="selectedDocumentType"
aria-label="Dokumenttyp"
:item-service="ComboboxItemService.getDocumentTypes"
></ComboboxInput>
</InputField>
</div>
<div class="mt-4">* Pflichtfelder für die Veröffentlichung</div>
</div>
</div>
</template>
18 changes: 17 additions & 1 deletion frontend/src/services/comboboxItemService.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { Ref } from 'vue'
import type { ComboboxItem } from '@/components/input/types'
import LegalPeriodical from '@/domain/legalPeriodical.ts'
import type { Court } from '@/domain/documentUnit'
import type { Court, DocumentType } from '@/domain/documentUnit'
import type { ComboboxResult } from '@/domain/comboboxResult.ts'
import { computed, ref } from 'vue'

type ComboboxItemService = {
getLegalPeriodicals: (filter: Ref<string | undefined>) => ComboboxResult<ComboboxItem[]>
getCourts: (filter: Ref<string | undefined>) => ComboboxResult<ComboboxItem[]>
getDocumentTypes: (filter: Ref<string | undefined>) => ComboboxResult<ComboboxItem[]>
}

const service: ComboboxItemService = {
Expand Down Expand Up @@ -82,6 +83,21 @@ const service: ComboboxItemService = {
}
return result
},
getDocumentTypes: (filter: Ref<string | undefined>) => {
const documentTypeValues = ['VR', 'VE', 'VV', 'ST']
const documentTypes = documentTypeValues.map((v) => <DocumentType>{ label: v })
const items = ref(documentTypes.map((dt) => <ComboboxItem>{ label: dt.label, value: dt }))
const execute = async () => {
return service.getDocumentTypes(filter)
}
const result: ComboboxResult<ComboboxItem[]> = {
data: items,
execute: execute,
canAbort: computed(() => false),
abort: () => {},
}
return result
},
}

export default service
Loading