import { prisma } from "@/lib/prisma"; import { ApprovalActions } from "./approval-actions"; import { CheckCircle2, Clock, Calendar, Search, Filter, ArrowRight } from "lucide-react"; import { Card } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { formatCurrency } from "@/lib/utils"; export default async function ApprovalsPage() { const [reimbursements, overtimes] = await Promise.all([ prisma.reimbursement.findMany({ where: { status: 'PENDING' }, include: { user: true }, orderBy: { createdAt: 'desc' } }), prisma.overtime.findMany({ where: { status: 'PENDING' }, include: { user: true }, orderBy: { date: 'desc' } }) ]); const allRequests = [ ...reimbursements.map(r => ({ ...r, type: 'reimbursement' as const })), ...overtimes.map(o => ({ ...o, type: 'overtime' as const, amount: o.hours * 45, description: o.reason })) ].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); return (
Review and process worker reimbursement and overtime requests.
| User | Type | Description | Amount | Actions |
|---|---|---|---|---|
|
{req.user.name[0]}
{req.user.name} {req.user.department} |
{req.type === 'reimbursement' ? |
{req.description} {new Date(req.createdAt).toLocaleDateString()} |
{formatCurrency(req.amount.toString())} |
|
All worker requests have been processed.