rmoved console

This commit is contained in:
pramod.mahajan 2025-10-14 13:42:21 +05:30
parent 272645f0b4
commit f91c7d6da1

View File

@ -1,20 +1,17 @@
import React from 'react' import React from "react";
import { useCollectionContext } from '../../pages/collections/CollectionPage'; import { useCollectionContext } from "../../pages/collections/CollectionPage";
import { useCollection } from '../../hooks/useCollections'; import { useCollection } from "../../hooks/useCollections";
import { formatUTCToLocalTime } from '../../utils/dateUtils'; import { formatUTCToLocalTime } from "../../utils/dateUtils";
import { formatFigure } from '../../utils/appUtils'; import { formatFigure } from "../../utils/appUtils";
import Avatar from '../common/Avatar'; import Avatar from "../common/Avatar";
const ViewCollection = () => { const ViewCollection = () => {
const { viewCollection } = useCollectionContext(); const { viewCollection } = useCollectionContext();
const { data, isLoading, isError, error } = useCollection( const { data, isLoading, isError, error } = useCollection(viewCollection);
viewCollection if (isLoading) return <div>isLoading...</div>;
); if (isError) return <div>{error.message}</div>;
console.log(data)
if(isLoading) return <div>isLoading...</div>;
if(isError) return <div>{error.message}</div>;
return ( return (
<div className="container p-3"> <div className="container p-3">
<p className="fs-5 fw-semibold">Collection Details</p> <p className="fs-5 fw-semibold">Collection Details</p>
<div className="text-start "> <div className="text-start ">
<div className="mb-3"> <div className="mb-3">
@ -23,47 +20,98 @@ const ViewCollection = () => {
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Invoice Number:</strong> {data?.invoiceNumber}</div> <div className="col-md-6">
<div className="col-md-6"><strong>E-Invoice Number:</strong> {data?.eInvoiceNumber}</div> <strong>Invoice Number:</strong> {data?.invoiceNumber}
</div>
<div className="col-md-6">
<strong>E-Invoice Number:</strong> {data?.eInvoiceNumber}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Project:</strong> {data?.project?.name}</div> <div className="col-md-6">
<div className="col-md-6"><strong>Status:</strong> {data?.isActive ? "Active" : "Inactive"}</div> <strong>Project:</strong> {data?.project?.name}
</div>
<div className="col-md-6">
<strong>Status:</strong> {data?.isActive ? "Active" : "Inactive"}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Invoice Date:</strong> {formatUTCToLocalTime(data?.invoiceDate)}</div> <div className="col-md-6">
<div className="col-md-6"><strong>Client Submitted Date:</strong> {formatUTCToLocalTime(data?.clientSubmitedDate)}</div> <strong>Invoice Date:</strong>{" "}
{formatUTCToLocalTime(data?.invoiceDate)}
</div>
<div className="col-md-6">
<strong>Client Submitted Date:</strong>{" "}
{formatUTCToLocalTime(data?.clientSubmitedDate)}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Expected Payment Date:</strong> {formatUTCToLocalTime(data?.exceptedPaymentDate)}</div> <div className="col-md-6">
<div className="col-md-6"><strong>Mark as Completed:</strong> {data?.markAsCompleted ? "Yes" : "No"}</div> <strong>Expected Payment Date:</strong>{" "}
{formatUTCToLocalTime(data?.exceptedPaymentDate)}
</div>
<div className="col-md-6">
<strong>Mark as Completed:</strong>{" "}
{data?.markAsCompleted ? "Yes" : "No"}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Basic Amount:</strong> {formatFigure(data?.basicAmount, { type: "currency", currency: "INR" })}</div> <div className="col-md-6">
<div className="col-md-6"><strong>Tax Amount:</strong> {formatFigure(data?.taxAmount, { type: "currency", currency: "INR" })}</div> <strong>Basic Amount:</strong>{" "}
{formatFigure(data?.basicAmount, {
type: "currency",
currency: "INR",
})}
</div>
<div className="col-md-6">
<strong>Tax Amount:</strong>{" "}
{formatFigure(data?.taxAmount, {
type: "currency",
currency: "INR",
})}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Balance Amount:</strong> {formatFigure(data?.balanceAmount, { type: "currency", currency: "INR" })}</div> <div className="col-md-6">
<div className="col-md-6"><strong>Created At:</strong> {formatUTCToLocalTime(data?.createdAt)}</div> <strong>Balance Amount:</strong>{" "}
{formatFigure(data?.balanceAmount, {
type: "currency",
currency: "INR",
})}
</div>
<div className="col-md-6">
<strong>Created At:</strong> {formatUTCToLocalTime(data?.createdAt)}
</div>
</div> </div>
<div className="row mb-3"> <div className="row mb-3">
<div className="col-md-6"><strong>Created By:</strong> <div className='d-flex align-items-center'><Avatar size='xs' firstName={data.createdBy?.firstName} lastName={data.createdBy?.lastName}/>{data?.createdBy?.firstName} {data?.createdBy?.lastName} ({data?.createdBy?.jobRoleName})</div> </div> <div className="col-md-6">
<strong>Created By:</strong>{" "}
<div className="d-flex align-items-center">
<Avatar
size="xs"
firstName={data.createdBy?.firstName}
lastName={data.createdBy?.lastName}
/>
{data?.createdBy?.firstName} {data?.createdBy?.lastName} (
{data?.createdBy?.jobRoleName})
</div>{" "}
</div>
{/* <div className="col-md-6"><strong>Updated At:</strong> {data?.updatedAt ? formatUTCToLocalTime(data?.updatedAt) : "-"}</div> */} {/* <div className="col-md-6"><strong>Updated At:</strong> {data?.updatedAt ? formatUTCToLocalTime(data?.updatedAt) : "-"}</div> */}
</div> </div>
{data?.receivedInvoicePayments?.length > 0 && ( {data?.receivedInvoicePayments?.length > 0 && (
<div className="mt-4"> <div className="mt-4">
<h5>Received Payments</h5> <p className="fw-semibold fs-6">Received Payments</p>
<table className="table table-bordered mt-2"> <table className="table table-bordered mt-2">
<thead className="table-light"> <thead className="table-light">
<tr> <tr>
<th className=''>Sr,No</th> <th className="">Sr,No</th>
<th>Transaction ID</th> <th>Transaction ID</th>
<th> Received Date</th> <th> Received Date</th>
<th>Amount</th> <th>Amount</th>
@ -76,10 +124,23 @@ const ViewCollection = () => {
<td>{index + 1}</td> <td>{index + 1}</td>
<td>{payment.transactionId}</td> <td>{payment.transactionId}</td>
<td>{formatUTCToLocalTime(payment.paymentReceivedDate)}</td> <td>{formatUTCToLocalTime(payment.paymentReceivedDate)}</td>
<td className='text-end'>{formatFigure(payment.amount, { type: "currency", currency: "INR" })}</td> <td className="text-end">
<td><div className='d-flex align-items-center'> {formatFigure(payment.amount, {
<Avatar size='xs' firstName={payment.createdBy?.firstName} lastName={payment.createdBy?.lastName}/>{payment.createdBy?.firstName} {payment.createdBy?.lastName} type: "currency",
</div></td> currency: "INR",
})}
</td>
<td>
<div className="d-flex align-items-center">
<Avatar
size="xs"
firstName={payment.createdBy?.firstName}
lastName={payment.createdBy?.lastName}
/>
{payment.createdBy?.firstName}{" "}
{payment.createdBy?.lastName}
</div>
</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
@ -88,7 +149,7 @@ const ViewCollection = () => {
)} )}
</div> </div>
</div> </div>
) );
} };
export default ViewCollection export default ViewCollection;