Merge pull request '#120-LOA-Extension-Bug' (#153) from #120-LOA-Extension-Bug into main
All checks were successful
Continuous Integration / Update Development (push) Successful in 2m40s

Reviewed-on: #153
This commit was merged in pull request #153.
This commit is contained in:
2026-01-17 09:24:05 -06:00

View File

@@ -75,15 +75,17 @@ function formatDate(date: Date): string {
});
}
function loaStatus(loa: LOARequest): "Upcoming" | "Active" | "Overdue" | "Closed" {
function loaStatus(loa: LOARequest): "Upcoming" | "Active" | "Extended" | "Overdue" | "Closed" {
if (loa.closed) return "Closed";
const now = new Date();
const start = new Date(loa.start_date);
const end = new Date(loa.end_date);
const extension = new Date(loa.extended_till);
if (now < start) return "Upcoming";
if (now >= start && now <= end) return "Active";
if (now >= start && (now <= end)) return "Active";
if (now >= start && (now <= extension)) return "Extended";
if (now > loa.extended_till || end) return "Overdue";
return "Overdue"; // fallback
@@ -191,6 +193,7 @@ function setPage(pagenum: number) {
<TableCell>
<Badge v-if="loaStatus(post) === 'Upcoming'" class="bg-blue-400">Upcoming</Badge>
<Badge v-else-if="loaStatus(post) === 'Active'" class="bg-green-500">Active</Badge>
<Badge v-else-if="loaStatus(post) === 'Extended'" class="bg-green-500">Extended</Badge>
<Badge v-else-if="loaStatus(post) === 'Overdue'" class="bg-yellow-400">Overdue</Badge>
<Badge v-else class="bg-gray-400">Ended</Badge>
</TableCell>
@@ -232,11 +235,34 @@ function setPage(pagenum: number) {
<TableRow v-if="expanded === post.id" @mouseenter="hoverID = post.id"
@mouseleave="hoverID = null" :class="{ 'bg-muted/50 border-t-0': hoverID === post.id }">
<TableCell :colspan="8" class="p-0">
<div class="w-full p-3 mb-6 space-y-3">
<div class="flex justify-between items-start gap-4">
<div class="space-y-3 w-full">
<div class="w-full p-4 mb-6 space-y-4">
<!-- Header -->
<!-- Dates -->
<div class="grid grid-cols-3 gap-4 text-sm">
<div>
<p class="text-muted-foreground">Start</p>
<p class="font-medium">
{{ formatDate(post.start_date) }}
</p>
</div>
<div>
<p class="text-muted-foreground">Original end</p>
<p class="font-medium">
{{ formatDate(post.end_date) }}
</p>
</div>
<div class="">
<p class="text-muted-foreground">Extended to</p>
<p class="font-medium text-foreground">
{{post.extended_till ? formatDate(post.extended_till) : 'N/A' }}
</p>
</div>
</div>
<!-- Reason -->
<div class="space-y-2">
<div class="flex items-center gap-2">
<h4 class="text-sm font-semibold text-foreground">
Reason
@@ -244,16 +270,13 @@ function setPage(pagenum: number) {
<Separator class="flex-1" />
</div>
<!-- Content -->
<div
class="rounded-lg border bg-muted/40 px-4 py-3 text-sm leading-relaxed whitespace-pre-wrap text-muted-foreground w-full">
class="rounded-lg border bg-muted/40 px-4 py-3 text-sm leading-relaxed whitespace-pre-wrap text-muted-foreground">
{{ post.reason || 'No reason provided.' }}
</div>
</div>
</div>
</div>
</TableCell>
</TableRow>