2021-04-30 06:32:20 +00:00
|
|
|
<template>
|
2021-05-20 18:11:15 +00:00
|
|
|
<div class="card note-wrap">
|
2021-10-25 13:05:58 +00:00
|
|
|
<div class="header">
|
2021-04-30 06:32:20 +00:00
|
|
|
<div class="meta">
|
2021-10-25 13:05:58 +00:00
|
|
|
<thumbnail
|
|
|
|
:title="noteAuthorName"
|
|
|
|
:src="noteAuthor.thumbnail"
|
|
|
|
:username="noteAuthorName"
|
|
|
|
size="20px"
|
|
|
|
/>
|
2021-04-30 06:32:20 +00:00
|
|
|
<div class="date-wrap">
|
2021-10-25 13:05:58 +00:00
|
|
|
<span class="fw-medium"> {{ noteAuthorName }} </span>
|
|
|
|
<span> {{ $t('NOTES.LIST.LABEL') }} </span>
|
|
|
|
<span class="fw-medium"> {{ readableTime }} </span>
|
2021-04-30 06:32:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<woot-button
|
2021-10-25 13:05:58 +00:00
|
|
|
v-tooltip="$t('NOTES.CONTENT_HEADER.DELETE')"
|
2021-06-09 08:31:43 +00:00
|
|
|
variant="smooth"
|
2021-06-09 12:55:05 +00:00
|
|
|
size="tiny"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="delete"
|
2021-04-30 06:32:20 +00:00
|
|
|
color-scheme="secondary"
|
2022-03-28 08:49:12 +00:00
|
|
|
@click="toggleDeleteModal"
|
2021-04-30 06:32:20 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2022-03-28 08:49:12 +00:00
|
|
|
<woot-delete-modal
|
|
|
|
v-if="showDeleteModal"
|
|
|
|
:show.sync="showDeleteModal"
|
|
|
|
:on-close="closeDelete"
|
|
|
|
:on-confirm="confirmDeletion"
|
|
|
|
:title="$t('DELETE_NOTE.CONFIRM.TITLE')"
|
|
|
|
:message="$t('DELETE_NOTE.CONFIRM.MESSAGE')"
|
|
|
|
:confirm-text="$t('DELETE_NOTE.CONFIRM.YES')"
|
|
|
|
:reject-text="$t('DELETE_NOTE.CONFIRM.NO')"
|
|
|
|
/>
|
2021-04-30 06:32:20 +00:00
|
|
|
</div>
|
2022-04-21 05:57:28 +00:00
|
|
|
<p v-dompurify-html="formatMessage(note || '')" class="note__content" />
|
2021-04-30 06:32:20 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-06-09 12:55:05 +00:00
|
|
|
import Thumbnail from 'dashboard/components/widgets/Thumbnail';
|
2021-04-30 06:32:20 +00:00
|
|
|
import timeMixin from 'dashboard/mixins/time';
|
2021-10-25 13:05:58 +00:00
|
|
|
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Thumbnail,
|
|
|
|
},
|
|
|
|
|
2021-10-25 13:05:58 +00:00
|
|
|
mixins: [timeMixin, messageFormatterMixin],
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
props: {
|
2021-05-05 08:06:45 +00:00
|
|
|
id: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
2021-04-30 06:32:20 +00:00
|
|
|
note: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-10-25 13:05:58 +00:00
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
2021-10-25 13:05:58 +00:00
|
|
|
createdAt: {
|
2021-04-30 06:32:20 +00:00
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-28 08:49:12 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showDeleteModal: false,
|
|
|
|
};
|
|
|
|
},
|
2021-04-30 06:32:20 +00:00
|
|
|
computed: {
|
|
|
|
readableTime() {
|
2021-10-25 13:05:58 +00:00
|
|
|
return this.dynamicTime(this.createdAt);
|
|
|
|
},
|
|
|
|
noteAuthor() {
|
|
|
|
return this.user || {};
|
|
|
|
},
|
|
|
|
noteAuthorName() {
|
|
|
|
return this.noteAuthor.name || this.$t('APP_GLOBAL.DELETED_USER');
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-03-28 08:49:12 +00:00
|
|
|
toggleDeleteModal() {
|
|
|
|
this.showDeleteModal = !this.showDeleteModal;
|
|
|
|
},
|
2021-04-30 06:32:20 +00:00
|
|
|
onDelete() {
|
2021-05-05 08:06:45 +00:00
|
|
|
this.$emit('delete', this.id);
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
2022-03-28 08:49:12 +00:00
|
|
|
confirmDeletion() {
|
|
|
|
this.onDelete();
|
|
|
|
this.closeDelete();
|
|
|
|
},
|
|
|
|
closeDelete() {
|
|
|
|
this.showDeleteModal = false;
|
|
|
|
},
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-05-20 18:11:15 +00:00
|
|
|
.note__content {
|
2021-10-25 13:05:58 +00:00
|
|
|
margin-top: var(--space-normal);
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 13:05:58 +00:00
|
|
|
.header {
|
2021-04-30 06:32:20 +00:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
2021-06-09 12:55:05 +00:00
|
|
|
align-items: flex-end;
|
2021-10-25 13:05:58 +00:00
|
|
|
font-size: var(--font-size-mini);
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
.meta {
|
|
|
|
display: flex;
|
2021-10-25 13:05:58 +00:00
|
|
|
align-items: center;
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
.date-wrap {
|
|
|
|
margin-left: var(--space-smaller);
|
|
|
|
padding: var(--space-micro);
|
|
|
|
color: var(--color-body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.actions {
|
2021-05-20 18:11:15 +00:00
|
|
|
display: flex;
|
|
|
|
visibility: hidden;
|
|
|
|
|
2021-06-09 08:31:43 +00:00
|
|
|
.button {
|
|
|
|
margin-left: var(--space-small);
|
|
|
|
}
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.note-wrap:hover {
|
|
|
|
.actions {
|
2021-05-20 18:11:15 +00:00
|
|
|
visibility: visible;
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|