Nextcloud-App/src/components/TicketList.vue

116 lines
2.6 KiB
Vue

<template>
<div class="ticketlist">
<div class="header-bar">
<button @click="newTicket">
{{ t('upschooling', 'Neues Ticket') }}
</button>
</div>
<table
id="ticketlist"
class="list-container has-controls">
<thead>
<tr>
<th id="headerName" class="column-name">
<div id="headerName-container">
<a class="name sort columntitle" data-sort="name">
<span>{{ t('upschooling', 'Titel (#Ticket-Nummer)') }}</span>
<span class="sort-indicator icon-triangle-n" />
</a>
</div>
</th>
<th id="headerStatus" class="column-status">
<a class="status sort columntitle" data-sort="status">
<span>{{ t('upschooling', 'Status') }}</span>
<span class="sort-indicator hidden icon-triangle-s" />
</a>
</th>
<th id="headerDate" class="column-mtime">
<a id="modified" class="columntitle" data-sort="mtime">
<span>{{ t('upschooling', 'Zuletzt Geändert') }}</span>
<span class="sort-indicator hidden icon-triangle-s" />
</a>
</th>
</tr>
</thead>
<tbody id="tickettbody">
<tr v-for="item in tickets" :key="item.ticketId">
<td class="filename ui-draggable ui-draggable-handle">
<a class="name" :href="'#ticket-' + item.ticketId" @click="openTicket(item.ticketId)">
<span class="nametext">
<span class="innernametext">{{ item.title }}</span>
<span class="ticket-number"> (<span class="icon icon-ticket" />#{{ item.ticketId }})</span>
</span>
</a>
</td>
<td class="status">
{{ item.status }}
</td>
<td class="date">
<span
class="modified live-relative-timestamp"
:title="toLocaleDate(item.lastModified)"
:data-timestamp="item.lastModified"
style="color:rgb(81,81,81)">
{{ toLocaleDate(item.lastModified) }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
export default {
name: 'TicketList',
props: {
tickets: {
type: Array,
default() {
return []
},
},
},
methods: {
toLocaleDate(timestamp) {
const date = new Date(timestamp)
return date.toLocaleString()
},
openTicket(ticketId) {
this.$emit('open-ticket', ticketId)
},
newTicket() {
this.$emit('new-ticket')
}
},
}
</script>
<style scoped>
table {
width: 100%;
}
td {
border-bottom: solid #000 1px;
}
tr:nth-child(2n) {
background: #f0f0f0;
}
a .ticket-number {
opacity: 0.5;
}
a:hover .ticket-number, a:focus .ticket-number, a:active .ticket-number {
opacity: 1;
}
.header-bar {
display: flex;
width: 100%;
flex-direction: row-reverse;
}
</style>