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