mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2025-12-13 17:44:44 -05:00
Badge colors!
This commit is contained in:
@@ -58,6 +58,7 @@ async function InvoiceContent({ invoiceId }: { invoiceId: string }) {
|
|||||||
const getStatusType = (): StatusType => {
|
const getStatusType = (): StatusType => {
|
||||||
if (invoice.status === "paid") return "paid";
|
if (invoice.status === "paid") return "paid";
|
||||||
if (invoice.status === "draft") return "draft";
|
if (invoice.status === "draft") return "draft";
|
||||||
|
if (invoice.status === "overdue") return "overdue";
|
||||||
if (invoice.status === "sent") {
|
if (invoice.status === "sent") {
|
||||||
return isOverdue ? "overdue" : "sent";
|
return isOverdue ? "overdue" : "sent";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import { Button } from "~/components/ui/button";
|
|||||||
import { StatusBadge, type StatusType } from "~/components/data/status-badge";
|
import { StatusBadge, type StatusType } from "~/components/data/status-badge";
|
||||||
import { PDFDownloadButton } from "~/app/dashboard/invoices/[id]/_components/pdf-download-button";
|
import { PDFDownloadButton } from "~/app/dashboard/invoices/[id]/_components/pdf-download-button";
|
||||||
import { DataTable, DataTableColumnHeader } from "~/components/data/data-table";
|
import { DataTable, DataTableColumnHeader } from "~/components/data/data-table";
|
||||||
import { EmptyState } from "~/components/layout/page-layout";
|
import { Eye, Edit } from "lucide-react";
|
||||||
import { Plus, FileText, Eye, Edit } from "lucide-react";
|
|
||||||
|
|
||||||
// Type for invoice data
|
// Type for invoice data
|
||||||
interface Invoice {
|
interface Invoice {
|
||||||
@@ -57,6 +56,7 @@ interface InvoicesDataTableProps {
|
|||||||
const getStatusType = (invoice: Invoice): StatusType => {
|
const getStatusType = (invoice: Invoice): StatusType => {
|
||||||
if (invoice.status === "paid") return "paid";
|
if (invoice.status === "paid") return "paid";
|
||||||
if (invoice.status === "draft") return "draft";
|
if (invoice.status === "draft") return "draft";
|
||||||
|
if (invoice.status === "overdue") return "overdue";
|
||||||
if (invoice.status === "sent") {
|
if (invoice.status === "sent") {
|
||||||
const dueDate = new Date(invoice.dueDate);
|
const dueDate = new Date(invoice.dueDate);
|
||||||
return dueDate < new Date() ? "overdue" : "sent";
|
return dueDate < new Date() ? "overdue" : "sent";
|
||||||
@@ -95,8 +95,10 @@ export function InvoicesDataTable({ invoices }: InvoicesDataTableProps) {
|
|||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const invoice = row.original;
|
const invoice = row.original;
|
||||||
return (
|
return (
|
||||||
<div className="min-w-0 max-w-[80px] sm:max-w-[200px] lg:max-w-[300px]">
|
<div className="max-w-[80px] min-w-0 sm:max-w-[200px] lg:max-w-[300px]">
|
||||||
<p className="truncate font-medium">{invoice.client?.name ?? "—"}</p>
|
<p className="truncate font-medium">
|
||||||
|
{invoice.client?.name ?? "—"}
|
||||||
|
</p>
|
||||||
<p className="text-muted-foreground truncate text-xs sm:text-sm">
|
<p className="text-muted-foreground truncate text-xs sm:text-sm">
|
||||||
{invoice.invoiceNumber}
|
{invoice.invoiceNumber}
|
||||||
</p>
|
</p>
|
||||||
@@ -149,7 +151,9 @@ export function InvoicesDataTable({ invoices }: InvoicesDataTableProps) {
|
|||||||
const amount = row.getValue("totalAmount");
|
const amount = row.getValue("totalAmount");
|
||||||
return (
|
return (
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<p className="font-semibold text-sm">{formatCurrency(amount as number)}</p>
|
<p className="text-sm font-semibold">
|
||||||
|
{formatCurrency(amount as number)}
|
||||||
|
</p>
|
||||||
<p className="text-muted-foreground text-xs">
|
<p className="text-muted-foreground text-xs">
|
||||||
{row.original.items?.length ?? 0} items
|
{row.original.items?.length ?? 0} items
|
||||||
</p>
|
</p>
|
||||||
@@ -168,9 +172,9 @@ export function InvoicesDataTable({ invoices }: InvoicesDataTableProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-end gap-1">
|
<div className="flex items-center justify-end gap-1">
|
||||||
<Link href={`/dashboard/invoices/${invoice.id}`}>
|
<Link href={`/dashboard/invoices/${invoice.id}`}>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-8 w-8 p-0"
|
className="h-8 w-8 p-0"
|
||||||
data-action-button="true"
|
data-action-button="true"
|
||||||
>
|
>
|
||||||
@@ -178,9 +182,9 @@ export function InvoicesDataTable({ invoices }: InvoicesDataTableProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href={`/dashboard/invoices/${invoice.id}/edit`}>
|
<Link href={`/dashboard/invoices/${invoice.id}/edit`}>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-8 w-8 p-0"
|
className="h-8 w-8 p-0"
|
||||||
data-action-button="true"
|
data-action-button="true"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -19,14 +19,19 @@ interface StatusBadgeProps
|
|||||||
}
|
}
|
||||||
|
|
||||||
const statusClassMap: Record<StatusType, string> = {
|
const statusClassMap: Record<StatusType, string> = {
|
||||||
draft: "status-badge-draft",
|
draft:
|
||||||
sent: "status-badge-sent",
|
"border-slate-400 bg-slate-100/90 text-slate-800 shadow-md dark:border-slate-600 dark:bg-slate-700/90 dark:text-slate-200",
|
||||||
paid: "status-badge-paid",
|
sent: "border-blue-400 bg-blue-100/90 text-blue-800 shadow-md dark:border-blue-600 dark:bg-blue-700/90 dark:text-blue-200",
|
||||||
overdue: "status-badge-overdue",
|
paid: "border-green-400 bg-green-100/90 text-green-800 shadow-md dark:border-green-600 dark:bg-green-700/90 dark:text-green-200",
|
||||||
success: "badge-success",
|
overdue:
|
||||||
warning: "badge-warning",
|
"border-red-400 bg-red-100/90 text-red-800 shadow-md dark:border-red-600 dark:bg-red-700/90 dark:text-red-200",
|
||||||
error: "badge-error",
|
success:
|
||||||
info: "badge-features",
|
"border-green-400 bg-green-100/90 text-green-800 shadow-md dark:border-green-600 dark:bg-green-700/90 dark:text-green-200",
|
||||||
|
warning:
|
||||||
|
"border-yellow-400 bg-yellow-100/90 text-yellow-800 shadow-md dark:border-yellow-600 dark:bg-yellow-700/90 dark:text-yellow-200",
|
||||||
|
error:
|
||||||
|
"border-red-400 bg-red-100/90 text-red-800 shadow-md dark:border-red-600 dark:bg-red-700/90 dark:text-red-200",
|
||||||
|
info: "border-blue-400 bg-blue-100/90 text-blue-800 shadow-md dark:border-blue-600 dark:bg-blue-700/90 dark:text-blue-200",
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusLabelMap: Record<StatusType, string> = {
|
const statusLabelMap: Record<StatusType, string> = {
|
||||||
|
|||||||
Reference in New Issue
Block a user