import React from "react"; import { useCollectionContext } from "../../pages/collections/CollectionPage"; import { useCollection } from "../../hooks/useCollections"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; import { formatFigure } from "../../utils/appUtils"; import Avatar from "../common/Avatar"; const ViewCollection = () => { const { viewCollection } = useCollectionContext(); const { data, isLoading, isError, error } = useCollection(viewCollection); if (isLoading) return
isLoading...
; if (isError) return
{error.message}
; return (

Collection Details

{data?.title}

{data?.description}

Invoice Number: {data?.invoiceNumber}
E-Invoice Number: {data?.eInvoiceNumber}
Project: {data?.project?.name}
Status: {data?.isActive ? "Active" : "Inactive"}
Invoice Date:{" "} {formatUTCToLocalTime(data?.invoiceDate)}
Client Submitted Date:{" "} {formatUTCToLocalTime(data?.clientSubmitedDate)}
Expected Payment Date:{" "} {formatUTCToLocalTime(data?.exceptedPaymentDate)}
Mark as Completed:{" "} {data?.markAsCompleted ? "Yes" : "No"}
Basic Amount:{" "} {formatFigure(data?.basicAmount, { type: "currency", currency: "INR", })}
Tax Amount:{" "} {formatFigure(data?.taxAmount, { type: "currency", currency: "INR", })}
Balance Amount:{" "} {formatFigure(data?.balanceAmount, { type: "currency", currency: "INR", })}
Created At: {formatUTCToLocalTime(data?.createdAt)}
Created By:{" "}
{data?.createdBy?.firstName} {data?.createdBy?.lastName} ( {data?.createdBy?.jobRoleName})
{" "}
{/*
Updated At: {data?.updatedAt ? formatUTCToLocalTime(data?.updatedAt) : "-"}
*/}
{data?.receivedInvoicePayments?.length > 0 && (

Received Payments

{data.receivedInvoicePayments.map((payment, index) => ( ))}
Sr,No Transaction ID Received Date Amount Received By
{index + 1} {payment.transactionId} {formatUTCToLocalTime(payment.paymentReceivedDate)} {formatFigure(payment.amount, { type: "currency", currency: "INR", })}
{payment.createdBy?.firstName}{" "} {payment.createdBy?.lastName}
)}
); }; export default ViewCollection;