-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathSignerRow.vue
More file actions
88 lines (74 loc) · 1.99 KB
/
SignerRow.vue
File metadata and controls
88 lines (74 loc) · 1.99 KB
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
<!--
- SPDX-FileCopyrightText: 2024 LibreCode coop and LibreCode contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcListItem v-bind="{ ...$attrs, to, 'counter-number': hasElement ? '📎' : undefined }"
:name="displayName"
:details="signDate"
:class="`signer-row signer-row-${status}`"
@click="signerClickAction">
<template #icon>
<NcAvatar is-no-user
:size="44"
:user="signer.email ?? undefined"
:display-name="displayName" />
</template>
<template #subname>
<span class="signer-status">{{ status }}</span>
</template>
<template v-if="$slots.actions" #actions>
<slot name="actions" />
</template>
</NcListItem>
</template>
<script setup lang="ts">
import { t } from '@nextcloud/l10n'
import { computed } from 'vue'
import { emit } from '@nextcloud/event-bus'
import Moment from '@nextcloud/moment'
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import type { SignerDetailRecord } from '../../../../types/index'
defineOptions({
name: 'SignerRow',
inheritAttrs: false,
})
const props = withDefaults(defineProps<{
signer: SignerDetailRecord
elementId?: number
to?: Record<string, unknown>
event?: string
}>(), {
elementId: undefined,
to: undefined,
event: '',
})
const displayName = computed(() => {
if (props.signer.displayName) {
return props.signer.displayName
}
if (props.signer.email) {
return props.signer.email
}
return t('libresign', 'Account does not exist')
})
const status = computed(() => (props.signer.signed ? 'signed' : 'pending'))
const signDate = computed(() => (
props.signer.signed
? Moment(props.signer.signed, 'YYYY-MM-DD').toDate()
: ''
))
const hasElement = computed(() => (props.elementId || 0) > 0)
function signerClickAction() {
emit(props.event, props.signer)
}
</script>
<style>
.signer-row-signed .signer-status {
font-weight: bold;
}
.signer-row-pending .signer-status {
color: var(--color-warning, #eca700)
}
</style>