Skip to content

Commit

Permalink
New-issues-20.03 (#91)
Browse files Browse the repository at this point in the history
resolves #90
resolves #89
resolves #88
resolves #87

---------

Co-authored-by: Robin Kaggl <[email protected]>
  • Loading branch information
kaggl and Robin Kaggl authored Mar 20, 2024
1 parent be354d6 commit 6b3c134
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 20 deletions.
2 changes: 1 addition & 1 deletion components/content/header-wrapper.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="mx-auto w-fit">
<div
class="mx-2 mb-8 flex w-fit flex-col justify-center truncate hyphens-auto border-b-4 pb-4 text-center text-3xl text-primary-600 sm:text-5xl lg:flex-row"
class="mx-2 mb-8 flex w-fit flex-col justify-center hyphens-auto border-b-4 pb-4 text-center text-3xl text-primary-600 sm:text-5xl lg:flex-row"
>
<slot />
</div>
Expand Down
7 changes: 5 additions & 2 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"add functions": "Institutionen + Funktionen",
"add functions and persons": "Institutionen + Funktionen + Personen",
"show institution hierarchy": "Institutionshierarchie",
"show amt and persons": "Amt und Personen"
"show amt and persons": "Amt und Personen",
"goto": "Zur Detail Seite"
},
"legend": {
"legend": "Legende",
Expand Down Expand Up @@ -157,7 +158,9 @@
"non_court_functions": " Sonstiger Bezug und Tätigkeiten",
"model": "Modell",
"functions": "Funktion",
"institutions": "Institution"
"institutions": "Institution",
"allowance": "Zahlungen",
"same_as": "Gleich wie"
},
"viecpro_courts": {
"model": "Modell",
Expand Down
7 changes: 5 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"add functions": "Institutions and functions",
"add functions and persons": "Institutions, functions and persons",
"show institution hierarchy": "Institutions hierarchy",
"show amt and persons": "Amt and persons"
"show amt and persons": "Amt and persons",
"goto": "Go to detail page"
},
"legend": {
"legend": "Legend",
Expand Down Expand Up @@ -156,7 +157,9 @@
"start_date": "Start",
"end_date": "End",
"functions": "Function",
"institutions": "Institution"
"institutions": "Institution",
"allowance": "Allowance",
"same_as": "Same as"
},
"viecpro_courts": {
"model": "Model",
Expand Down
37 changes: 35 additions & 2 deletions pages/detail/persons/[id].vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useQuery, useQueryClient } from "@tanstack/vue-query";
import { isEmpty } from "lodash-es";
import { Info, Loader2 } from "lucide-vue-next";
import { Info, Link, Loader2 } from "lucide-vue-next";
import type { SearchResponse } from "typesense/lib/Typesense/Documents";
import { useRoute } from "vue-router";
Expand Down Expand Up @@ -320,6 +320,25 @@ useHead({
:headers="[]"
:collection-name="collection"
/> -->
<GenericDisclosure
:title="t('collection-keys.viecpro_persons.same_as')"
:disabled="isEmpty(data.details.data.sameAs)"
>
<div class="p-2">
<div
v-for="url in data.details.data.sameAs"
:key="url"
class="border-t p-1 pl-0 first:border-0"
>
<NuxtLink class="flex items-center gap-1 font-semibold underline" :href="url">
<span>
{{ url }}
</span>
<Link class="h-5 w-5 shrink-0" />
</NuxtLink>
</div>
</div>
</GenericDisclosure>
</div>
<div v-else>{{ t("ui.no-data") }}.</div>
</template>
Expand Down Expand Up @@ -350,6 +369,21 @@ useHead({
grid-class="grid-cols-3"
:collection-name="collection"
/>
<GenericDisclosure
:title="t('collection-keys.viecpro_persons.allowance')"
:disabled="isEmpty(data.details.data.allowance)"
>
<div class="p-2">
<div
v-for="allowance in data.details.data.allowance"
:key="allowance"
class="border-t p-1 pl-0 first:border-0"
>
{{ allowance }}
</div>
</div>
</GenericDisclosure>
<h2 class="text-2xl text-gray-500">{{ t("detail-page.additional") }}</h2>
<DetailDisclosure
:title="t('detail-page.related_places')"
:rels="data.details.data.related_places"
Expand All @@ -358,7 +392,6 @@ useHead({
collection-name="place_person"
link-to
/>
<h2 class="text-2xl text-gray-500">{{ t("detail-page.additional") }}</h2>
<DetailDisclosure
:title="t('collection-keys.viecpro_persons.marriages_and_family_relations')"
:rels="data.details.data.marriages_and_family_relations"
Expand Down
37 changes: 24 additions & 13 deletions pages/hierarchy.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { useQuery } from "@tanstack/vue-query";
import { Loader2 } from "lucide-vue-next";
import { ArrowRight, Loader2 } from "lucide-vue-next";
import HierarchyWrapper from "@/components/hierarchy-wrapper.vue";
import { getTreeData } from "@/lib/get-tree-data";
Expand All @@ -9,6 +9,7 @@ const router = useRouter();
const route = useRoute();
const t = useTranslations();
const localePath = useLocalePath();
const comQuery = computed({
get() {
Expand Down Expand Up @@ -36,7 +37,7 @@ const comQuery = computed({
});
const showItems = computed(() => {
switch (route.query.model) {
switch (comQuery.value?.group) {
case "Institution": {
const instArgs = [
{
Expand Down Expand Up @@ -134,17 +135,27 @@ useHead({
<div class="container mx-auto flex flex-wrap justify-between">
<div class="flex flex-wrap">
<Autocomplete v-model="comQuery" />
<ClientOnly>
<GenericListbox v-model="show" class="m-2 w-full min-w-56 md:w-auto" :items="showItems" />
<GenericListbox
v-model="direction"
class="m-2 w-full min-w-48 md:w-auto"
:items="[
{ value: 'down', label: t('pages.hierarchy.options.down') },
{ value: 'up', label: t('pages.hierarchy.options.up') },
]"
/>
</ClientOnly>
<GenericListbox v-model="show" class="m-2 w-full min-w-56 md:w-auto" :items="showItems" />
<GenericListbox
v-if="comQuery?.group === 'Institution'"
v-model="direction"
class="m-2 w-full min-w-48 md:w-auto"
:items="[
{ value: 'down', label: t('pages.hierarchy.options.down') },
{ value: 'up', label: t('pages.hierarchy.options.up') },
]"
/>
<NuxtLink
v-if="comQuery && ['Person', 'Institution'].includes(comQuery.group)"
:href="localePath(`/detail/${comQuery.group.toLowerCase()}s/${comQuery.pk}`)"
>
<button
class="m-2 flex min-h-11 items-center gap-1 rounded border bg-white px-2 shadow-md transition hover:bg-slate-200 active:bg-slate-300"
>
<span>{{ t("pages.hierarchy.options.goto") }}</span>
<ArrowRight class="h-5 w-5 shrink-0" />
</button>
</NuxtLink>
</div>
<div class="m-2 min-h-11 w-full self-end rounded border bg-white p-2 shadow-lg md:w-fit">
<div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
Expand Down
2 changes: 2 additions & 0 deletions types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ export interface PersonDetail {
relations_to_church_and_orders: Array<DetailRelation>;
non_court_functions: Array<DetailRelation>;
related_places: Array<DetailRelation>;
sameAs: Array<string>;
allowance: Array<string>;
}

export interface GenericRelation {
Expand Down

0 comments on commit 6b3c134

Please sign in to comment.