BillBage: implemented proof-of-payment indicator
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
import { FC } from "react"
|
||||
import { Bill } from "@/app/lib/db-types"
|
||||
import Link from "next/link"
|
||||
import { TicketIcon } from "@heroicons/react/24/outline"
|
||||
|
||||
export interface BillBadgeProps {
|
||||
locationId: string,
|
||||
bill: Bill
|
||||
};
|
||||
|
||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, hasAttachment }}) =>
|
||||
<Link href={`/home/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||
{name}
|
||||
</Link>;
|
||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, hasAttachment, proofOfPayment }}) => {
|
||||
|
||||
const className = `badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`;
|
||||
|
||||
return (
|
||||
<Link href={`/home/bill/${locationId}-${billId}/edit`} className={className}>
|
||||
{name}
|
||||
{
|
||||
proofOfPayment?.uploadedAt ?
|
||||
<TicketIcon className="h-[1em] w-[1em] inline-block ml-1" /> : null
|
||||
}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user