"use client"; import { DocumentIcon, CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/outline"; import { Bill, BillingLocation } from "../lib/db-types"; import { FC } from "react"; import Link from "next/link"; import { formatYearMonth } from "../lib/format"; import { useTranslations } from "next-intl"; import { Pdf417Barcode } from "./Pdf417Barcode"; export interface ViewBillCardProps { location: BillingLocation, bill?: Bill, } export const ViewBillCard:FC = ({ location, bill }) => { const t = useTranslations("bill-edit-form"); const { _id: billID, name, paid, attachment, notes, payedAmount, barcodeImage, hub3aText } = bill ?? { _id:undefined, name:"", paid:false, notes:"" }; const { _id: locationID } = location; return(

{`${formatYearMonth(location.yearMonth)} ${location.name}`}

{name}

{t("paid-checkbox")} {paid ? : }

{t("payed-amount")} {payedAmount ? payedAmount/100 : ""}

{ notes ?

{t("notes-placeholder")}

{notes}

: null } { attachment ?

{t("attachment")}

{decodeURIComponent(attachment.fileName)}
: null } { hub3aText ?

{t.rich('barcode-disclaimer', { br: () =>
})}

: ( // LEGACY SUPPORT ... untill all bills have been migrated barcodeImage ?

{t.rich('barcode-disclaimer', { br: () =>
})}

: null ) }
{t("back-button")}
); }