/
QuickViewRecordInfoView.vue
88 lines (80 loc) · 1.96 KB
/
QuickViewRecordInfoView.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
<QuickViewCardOverview
:title="t('datasets.quickView.recordInformation')"
:sections="recordInformationSections"
/>
</template>
<script setup lang="ts">
import { computed, defineProps, withDefaults } from 'vue';
import { useI18n } from 'vue-i18n';
import QuickViewCardOverview from './QuickViewCardOverview.vue';
const { t } = useI18n();
const props = withDefaults(
defineProps<{
lastUpdate: string;
active: boolean;
odhActive: boolean;
}>(),
{
lastUpdate: '',
active: false,
odhActive: false,
}
);
const recordInformationSections = computed(() => {
const lastUpdate = props.lastUpdate;
if (!lastUpdate) {
return [];
}
const lastUpdateDate = new Date(lastUpdate).toISOString();
const [year, month, day] = lastUpdateDate.split('T')[0].split('-');
const isSourceActive = props.active;
const isODHActive = props.odhActive;
// FIXME: change based on dataset
const isSuedtirolInfoActive = false;
return [
{
icon: 'IconEditFilled',
content: [
{
title: t('datasets.quickView.lastChanged'),
text: `${day}.${month}.${year}`,
},
],
},
{
icon: 'IconServer',
content: [
{
title: t('datasets.quickView.activeOnSource'),
tag: getTagActiveInfoObject({
active: isSourceActive,
}),
},
{
title: t('datasets.quickView.activeOnODH'),
tag: getTagActiveInfoObject({
active: isODHActive,
}),
},
{
title: t('datasets.quickView.suedtirolInfoActive'),
tag: getTagActiveInfoObject({
active: isSuedtirolInfoActive,
}),
},
],
},
];
});
const getTagActiveInfoObject = ({ active }) => {
return {
size: 'md',
type: active ? 'blue' : 'red',
text: active
? t('datasets.quickView.active')
: t('datasets.quickView.inactive'),
hasDot: true,
};
};
</script>