feat: add internship status history to internship editor for admins

This commit is contained in:
Veronika Fehérvíziová
2025-11-01 16:26:16 +01:00
parent 1d315c0811
commit 3106ebce6c
2 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<script setup lang="ts">
import { prettyInternshipStatus, type InternshipStatusData } from '~/types/internship_status';
const props = defineProps({
internship: {
type: Number,
required: true,
default: -1
},
});
const headers = [
{ title: 'Stav', key: 'status', align: 'left' },
{ title: 'Zmenené', key: 'changed', align: 'left' },
{ title: 'Poznámka', key: 'start', align: 'left' },
{ title: 'Zmenu vykonal', key: 'modified_by', align: 'left' },
];
const route = useRoute();
const { data, error, pending } = await useSanctumFetch<InternshipStatusData[]>(`/api/internships/${route.params.id}/statuses`);
</script>
<template>
<div>
<!-- Čakajúca hláška -->
<v-alert v-if="pending" density="compact" text="Prosím čakajte..." title="Spracovávam" type="info"
id="login-error-alert" class="mx-auto alert"></v-alert>
<!-- Chybová hláška -->
<v-alert v-if="error" density="compact" :text="error?.message" title="Chyba" type="error" id="login-error-alert"
class="mx-auto alert"></v-alert>
<v-table v-else>
<thead>
<tr>
<th v-for="header in headers" :class="'text-' + header.align">
<strong>{{ header.title }}</strong>
</th>
</tr>
</thead>
<tbody>
<tr v-for="item in data">
<td>{{ prettyInternshipStatus(item.status) }}</td>
<td>{{ item.changed }}</td>
<td>{{ item.note }}</td>
<td>{{ item.modified_by.name }}</td>
</tr>
</tbody>
</v-table>
</div>
</template>
<style scoped></style>

View File

@@ -79,8 +79,11 @@ const { data, error } = await useSanctumFetch<Internship>(`/api/internships/${ro
<p>{{ prettyInternshipStatus(data?.status.status!) }}</p>
<p>Poznámka: <em>{{ data?.status.note }}</em></p>
<p>Posledná zmena: <em>{{ data?.status.changed }}, {{ data?.status.modified_by.name }}</em></p>
<br />
<h4>História</h4>
<InternshipStatusHistoryView :internship="data?.id" />
</div>
<hr />