-
-
-
- {formatUTCToLocalTime(data?.transactionDate)}
+
-
-
-
-
{data?.expensesType?.name}
-
-
-
- {/* Row 2 */}
-
-
-
-
{data?.supplerName}
-
-
-
-
-
-
₹ {data.amount}
-
-
-
- {/* Row 3 */}
-
-
-
-
{data?.paymentMode?.name}
-
-
- {data?.gstNumber && (
-
-
-
-
{data?.gstNumber}
-
-
- )}
-
- {/* Row 4 */}
-
-
-
-
- {data?.status?.name}
-
-
-
-
-
-
-
{data.preApproved ? "Yes" : "No"}
-
-
-
-
-
-
-
{data?.project?.name}
-
-
-
-
-
-
- {formatUTCToLocalTime(data?.createdAt, true)}
-
-
-
-
- {/* Row 6 */}
- {data.createdBy && (
-
-
-
-
-
-
- {`${data.createdBy?.firstName ?? ""} ${
- data.createdBy?.lastName ?? ""
- }`.trim() || "N/A"}
-
-
-
-
- )}
-
-
-
-
-
-
- {`${data.paidBy?.firstName ?? ""} ${
- data.paidBy?.lastName ?? ""
- }`.trim() || "N/A"}
-
-
-
-
-
-
-
-
{data?.description}
-
-
-
-
-
-
-
- {data?.documents?.map((doc) => {
- const isImage = doc.contentType?.includes("image");
-
- return (
-
{
- if (isImage) {
- setDocumentView({
- IsOpen: true,
- Image: doc.preSignedUrl,
- });
- }
- }}
- >
-
-
+
+
- );
- })}
-
-
-
- {data.expensesReimburse && (
-
-
-
- {data.expensesReimburse.reimburseTransactionId || "N/A"}
-
-
-
- {formatUTCToLocalTime(data.expensesReimburse.reimburseDate)}
-
-
- {data.expensesReimburse && (
- <>
-
-
-
-
- {`${data?.expensesReimburse?.reimburseBy?.firstName} ${data?.expensesReimburse?.reimburseBy?.lastName}`.trim()}
-
-
- >
- )}
-
- )}
-
-
- {Array.isArray(data?.nextStatus) && data.nextStatus.length > 0 && (
- <>
- {IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
-
-
-
-
- {errors.reimburseTransactionId && (
-
- {errors.reimburseTransactionId.message}
-
- )}
-
-
-
-
- {errors.reimburseDate && (
-
- {errors.reimburseDate.message}
-
- )}
-
-
-
-
+
+ {formatUTCToLocalTime(data?.transactionDate)}
+
- )}
-
- {((nextStatusWithPermission.length > 0 && !IsRejectedExpense) ||
- (IsRejectedExpense && isCreatedBy)) && (
- <>
-
-
- {errors.comment && (
-
- {errors.comment.message}
-
- )}
- >
+
+
+
+
{data?.expensesType?.name}
+
+
+
+ {/* Row 2 */}
+
+
+
+
{data?.supplerName}
+
+
+
+
+
+
₹ {data.amount}
+
+
+
+ {/* Row 3 */}
+
+
+
+
{data?.paymentMode?.name}
+
+
+ {data?.gstNumber && (
+
+
+
+
{data?.gstNumber}
+
+
)}
- {nextStatusWithPermission?.length > 0 &&
- (!IsRejectedExpense || isCreatedBy) && (
-
- {nextStatusWithPermission.map((status, index) => (
-
- ))}
+ {/* Row 4 */}
+
+
+
+
+ {data?.status?.name}
+
+
+
+
+
+
+
+ {data.preApproved ? "Yes" : "No"}
- )}
-
- >
- )}
+
+
-
+
+
+
+
{data?.project?.name}
+
+
+
+
+
+
+ {formatUTCToLocalTime(data?.createdAt, true)}
+
+
+
+
+ {/* Row 6 */}
+ {data.createdBy && (
+
+
+
+
+
+
+ {`${data.createdBy?.firstName ?? ""} ${
+ data.createdBy?.lastName ?? ""
+ }`.trim() || "N/A"}
+
+
+
+
+ )}
+
+
+
+
+
+
+ {`${data.paidBy?.firstName ?? ""} ${
+ data.paidBy?.lastName ?? ""
+ }`.trim() || "N/A"}
+
+
+
+
+
+
+
+
{data?.description}
+
+
+
+
+
+
+ {data?.documents?.map((doc) => {
+ const isImage = doc.contentType?.includes("image");
+
+ return (
+
{
+ if (isImage) {
+ setDocumentView({
+ IsOpen: true,
+ Image: doc.preSignedUrl,
+ });
+ }
+ }}
+ >
+
+
+ {doc.fileName}
+
+
+ );
+ })}
+
+
+
+ {data.expensesReimburse && (
+
+
+
+ {data.expensesReimburse.reimburseTransactionId || "N/A"}
+
+
+
+ {formatUTCToLocalTime(data.expensesReimburse.reimburseDate)}
+
+
+ {data.expensesReimburse && (
+ <>
+
+
+
+
+ {`${data?.expensesReimburse?.reimburseBy?.firstName} ${data?.expensesReimburse?.reimburseBy?.lastName}`.trim()}
+
+
+ >
+ )}
+
+ )}
+ {Array.isArray(data?.nextStatus) && data.nextStatus.length > 0 && (
+ <>
+ {IsPaymentProcess && nextStatusWithPermission?.length > 0 && (
+
+
+
+
+ {errors.reimburseTransactionId && (
+
+ {errors.reimburseTransactionId.message}
+
+ )}
+
+
+
+
+ {errors.reimburseDate && (
+
+ {errors.reimburseDate.message}
+
+ )}
+
+
+
+
+
+
+ )}
+
+ {((nextStatusWithPermission.length > 0 &&
+ !IsRejectedExpense) ||
+ (IsRejectedExpense && isCreatedBy)) && (
+ <>
+
+
+ {errors.comment && (
+
+ {errors.comment.message}
+
+ )}
+ >
+ )}
+
+ {nextStatusWithPermission?.length > 0 &&
+ (!IsRejectedExpense || isCreatedBy) && (
+
+ {nextStatusWithPermission.map((status, index) => (
+
+ ))}
+
+ )}
+
+ >
+ )}
+
+
+
+
);
};
diff --git a/src/components/PaymentRequest/PaymentStatusLogs.jsx b/src/components/PaymentRequest/PaymentStatusLogs.jsx
new file mode 100644
index 00000000..9abb3fa5
--- /dev/null
+++ b/src/components/PaymentRequest/PaymentStatusLogs.jsx
@@ -0,0 +1,93 @@
+import { useState, useMemo } from "react";
+import Avatar from "../common/Avatar";
+import { formatUTCToLocalTime } from "../../utils/dateUtils";
+import Timeline from "../common/TimeLine";
+import moment from "moment";
+import { getColorNameFromHex } from "../../utils/appUtils";
+const PaymentStatusLogs = ({ data }) => {
+ const [visibleCount, setVisibleCount] = useState(4);
+
+ const sortedLogs = useMemo(() => {
+ if (!data?.updateLogs) return [];
+ return [...data.updateLogs].sort(
+ (a, b) => new Date(b.updatedAt) - new Date(a.updatedAt)
+ );
+ }, [data?.updateLogs]);
+
+ const logsToShow = useMemo(
+ () => sortedLogs.slice(0, visibleCount),
+ [sortedLogs, visibleCount]
+ );
+
+ const timelineData = useMemo(() => {
+ return logsToShow.map((log, index) => ({
+ id: index + 1,
+ title: log.nextStatus?.name || "Status Updated",
+ description: log.nextStatus?.description || "",
+ timeAgo: log.updatedAt,
+ color: getColorNameFromHex(log.nextStatus?.color) || "primary",
+ users: log.updatedBy
+ ? [
+ {
+ firstName: log.updatedBy.firstName || "",
+ lastName: log?.updatedBy?.lastName || "",
+ role: log.updatedBy.jobRoleName || "",
+ avatar: log.updatedBy.photo,
+ },
+ ]
+ : [],
+ }));
+ }, [logsToShow]);
+
+ const handleShowMore = () => {
+ setVisibleCount((prev) => prev + 4);
+ };
+
+ return (
+
+ {/*
+ {logsToShow.map((log) => (
+
+
+
+
+
+
+ {`${log.updatedBy.firstName} ${log.updatedBy.lastName}`}
+
+ {log.action}
+
+
+ {formatUTCToLocalTime(log.updateAt, true)}
+
+
+
+ {log.comment}
+
+
+
+
+ ))}
+
+
+ {sortedLogs.length > visibleCount && (
+
+
+
+ )} */}
+
+
+
+ );
+};
+
+export default PaymentStatusLogs;
diff --git a/src/components/PaymentRequest/ViewPaymentRequest.jsx b/src/components/PaymentRequest/ViewPaymentRequest.jsx
index debea3e0..becf950f 100644
--- a/src/components/PaymentRequest/ViewPaymentRequest.jsx
+++ b/src/components/PaymentRequest/ViewPaymentRequest.jsx
@@ -38,6 +38,7 @@ import {
defaultPaymentRequestActionValues,
PaymentRequestActionScheam,
} from "./PaymentRequestSchema";
+import PaymentStatusLogs from "./PaymentStatusLogs";
const ViewPaymentRequest = ({ requestId }) => {
const { data, isLoading, isError, error, isFetching } =
@@ -474,7 +475,7 @@ const ViewPaymentRequest = ({ requestId }) => {
{" "}
TimeLine