diff --git a/.gitignore b/.gitignore index 5ef6a52..45254b6 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +/app/generated/prisma diff --git a/app/admin/approvals/approval-actions.tsx b/app/admin/approvals/approval-actions.tsx new file mode 100644 index 0000000..3655524 --- /dev/null +++ b/app/admin/approvals/approval-actions.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Check, X, Eye, Loader2 } from "lucide-react"; +import { updateRequestStatus } from "@/app/lib/actions"; + +export function ApprovalActions({ id, type }: { id: string, type: 'reimbursement' | 'overtime' }) { + const [isUpdating, setIsUpdating] = useState<'APPROVED' | 'REJECTED' | null>(null); + + async function handleUpdate(status: 'APPROVED' | 'REJECTED') { + setIsUpdating(status); + try { + await updateRequestStatus(id, type, status); + } catch (e) { + alert("Failed to update status."); + } finally { + setIsUpdating(null); + } + } + + 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.
+Set and monitor expenditure limits across the organization.
+FY 2024 • Q1 ACTIVE
+Overall Utilization
+78%
+Total Limit
+$510,000.00
+Spent to Date
+$400,000.00
+Automated analysis of current spend
+Marketing Budget at 96%
+Marketing spend is significantly higher than projected. Approvals for non-essential spend restricted.
+HR Savings Opportunity
+Current HR spend is 45% below budget. Consider reallocating $15k to Engineering Q2.
+Current Period
+ +Real-time overview of company finances and worker requests.
+{stat.label}
++ {stat.trend} +
+{tx.description}
+{new Date(tx.date).toLocaleDateString()}
++ {tx.type === 'DEBIT' ? '-' : '+'}{formatCurrency(tx.amount.toString())} +
+ Success ++ Total budget utilization is at 68%. Marketing and Sales are nearing their monthly limits. +
+ + + +Full transaction history and cash flow tracking.
+{stat.label}
+| Transaction | +Account | +Category | +Amount | +Date | +
|---|---|---|---|---|
|
+
+
+
+ {tx.type === 'DEBIT' ?
+
+
+ {tx.description} +TX-{tx.id.substring(0, 8).toUpperCase()} + |
+ + {tx.account.name} + | ++ + {tx.category?.name || 'Uncategorized'} + + | ++ + {tx.type === 'DEBIT' ? '-' : '+'}{formatCurrency(tx.amount.toString())} + + | +
+ {new Date(tx.date).toLocaleDateString()} +14:20 PM + |
+
Start recording financial activities to see them here.
+Detailed P&L and Cash Flow analysis for the current fiscal year.
+Comparison of gross inflows vs primary outflows
+{stat.label}
+{stat.value}
+Generate a comprehensive profit and loss statement for external audit in minutes.
+Logged in as: {session?.user?.email}
+ +$124,500.00
+-$24,300.00
+5
+Your financial activity and pending requests at a glance.
+{stat.label}
+
+
{item.description}
+{formatCurrency(item.amount.toString())}
+ {item.status} ++ You have {pendingClaimsCount} pending reimbursement requests. Claims are usually processed within 48 hours. +
+ + + +Log your extra hours and track approval status.
+{log.reason}
+Payroll: Current Cycle
+{totalYTD}h
+Relative to monthly capacity
++ Overtime logs must be submitted within 48 hours of completion. All logs are subject to manager approval before being processed for payroll. +
+Securely access and download your past salary statements.
+| Statement Ref | +Period | +Net Pay | +Date Issued | +Actions | +
|---|---|---|---|---|
|
+
+
+
+
+
+
+ PAY-{slip.year}-{slip.month.substring(0, 3).toUpperCase()} +PDF Statement + |
+
+ {slip.month} {slip.year} + |
+ + + {formatCurrency(slip.amount.toString())} + + | ++ {new Date(slip.createdAt).toLocaleDateString()} + | ++ + + | +
Your payslips will appear here once issued by payroll.
++ Your salary is deposited into your primary bank account ending in ****4590 on the last business day of each month. +
+Manage and track your business expense claims.
+| Status | +Details | +Category | +Date | +Amount | +
|---|---|---|---|---|
|
+
+ {item.status === 'PAID' &&
+ |
+
+ {item.description} +Ref: #{item.id.slice(-8)} + |
+
+
+ |
+
+
+ |
+ + + {formatCurrency(item.amount.toString())} + + | +
- Looking for a starting point or more instructions? Head over to{" "} - - Templates - {" "} - or the{" "} - - Learning - {" "} - center. -
-{user.name || 'User Name'}
+{user.email}
++ Vers. 2.4.0 • Secured +
+