BillBage: implemented proof-of-payment indicator

This commit is contained in:
Knee Cola
2025-12-07 16:04:09 +01:00
parent 7994f9ebdb
commit 25865cfae4
2 changed files with 28 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import { FC } from "react"
import { Bill } from "@/app/lib/db-types"
import Link from "next/link"
import { DocumentIcon, TicketIcon } from "@heroicons/react/24/outline";
import { FC } from "react";
import { Bill } from "@/app/lib/db-types";
import Link from "next/link";
import { TicketIcon } from "@heroicons/react/24/outline";
import { useLocale } from "next-intl";
export interface ViewBillBadgeProps {
@@ -9,13 +9,19 @@ export interface ViewBillBadgeProps {
bill: Bill
};
export const ViewBillBadge: FC<ViewBillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, attachment } }) => {
export const ViewBillBadge: FC<ViewBillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, attachment, proofOfPayment } }) => {
const currentLocale = useLocale();
const className = `badge badge-lg p-[1em] ${paid ? "badge-success" : " badge-outline"} ${!paid && !!attachment ? "btn-outline btn-success" : ""} cursor-pointer`;
return (
<Link href={`/${currentLocale}//share/bill/${locationId}-${billId}`} className={`badge badge-lg p-[1em] ${paid ? "badge-success" : " badge-outline"} ${!paid && !!attachment ? "btn-outline btn-success" : ""} cursor-pointer`}>
<TicketIcon className="h-[1em] w-[1em] inline-block mr-1" /> {name}
<Link href={`/${currentLocale}//share/bill/${locationId}-${billId}`} className={className}>
{name}
{
proofOfPayment?.uploadedAt ?
<TicketIcon className="h-[1em] w-[1em] inline-block ml-1" /> : null
}
</Link>
);
}