From d7d2ac557ba4ff37360003d19d449b8ee1e27b48 Mon Sep 17 00:00:00 2001
From: kovakmedya
Date: Fri, 22 May 2026 16:02:13 +0300
Subject: [PATCH] =?UTF-8?q?feat(jobs):=20due-date=20awareness=20=E2=80=94?=
=?UTF-8?q?=20DueBadge=20+=20dashboard=20'Geciken=20=C4=B0=C5=9Fler'=20wid?=
=?UTF-8?q?get?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
dueDate was sitting on every job but the UI never warned anyone about
it. Added a small badge primitive and surfaced it everywhere a job is
listed plus a dedicated dashboard card.
- lib/appwrite/due-date.ts: dueState() buckets a job into overdue /
today / soon (1-3 days) / future / none, with delivered + cancelled
jobs always resolving to none. dueLabel() returns the Turkish text.
- components/due-badge.tsx: renders nothing for future/none, a
secondary badge for today/soon, a destructive badge for overdue.
Drop-in (job, className).
- JobsTable (inbound + outbound): new 'Termin' column shows the date
and the DueBadge stacked. Sorting still on createdAt for now —
explicit ordering by dueDate will come with the filter task.
- Job detail header: badge stack now has the DueBadge before the
status pill so a glance at the page shows whether the case is
behind schedule.
- Dashboard: getDashboardData fetches up to 10 overdue jobs in
parallel (lessThan('dueDate', now), excluding delivered/cancelled).
Added a destructive-tinted 'Geciken İşler' card above the rest of
the widgets when the list is non-empty, with quick links into each
job's detail page.
---
src/app/(dashboard)/dashboard/page.tsx | 32 ++++++++++-
src/app/(dashboard)/jobs/[jobId]/page.tsx | 10 +++-
.../jobs/_components/jobs-table.tsx | 12 ++++
src/components/due-badge.tsx | 27 +++++++++
src/lib/appwrite/dashboard-queries.ts | 36 +++++++++++-
src/lib/appwrite/due-date.ts | 56 +++++++++++++++++++
6 files changed, 166 insertions(+), 7 deletions(-)
create mode 100644 src/components/due-badge.tsx
create mode 100644 src/lib/appwrite/due-date.ts
diff --git a/src/app/(dashboard)/dashboard/page.tsx b/src/app/(dashboard)/dashboard/page.tsx
index 5e376a0..f424d6c 100644
--- a/src/app/(dashboard)/dashboard/page.tsx
+++ b/src/app/(dashboard)/dashboard/page.tsx
@@ -1,6 +1,8 @@
import Link from "next/link";
import { redirect } from "next/navigation";
-import { ArrowRight, FlaskConical, Link2, Plus, Stethoscope } from "lucide-react";
+import { AlertCircle, ArrowRight, FlaskConical, Link2, Plus, Stethoscope } from "lucide-react";
+
+import { DueBadge } from "@/components/due-badge";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
@@ -109,6 +111,34 @@ export default async function DashboardPage() {
/>
+ {data.overdueJobs.length > 0 && (
+
+
+
+
+ Geciken İşler ({data.overdueJobs.length})
+
+
+ Termin tarihi geçmiş ve henüz teslim edilmemiş işler.
+
+
+
+