On-Boarding Date:
diff --git a/src/components/Tenant/SubScriptionHistory.jsx b/src/components/Tenant/SubScriptionHistory.jsx
index 2aa0a32d..56b7638b 100644
--- a/src/components/Tenant/SubScriptionHistory.jsx
+++ b/src/components/Tenant/SubScriptionHistory.jsx
@@ -64,78 +64,50 @@ const SubScriptionHistory = ({ tenantId }) => {
if (percentage < 80) return "warning";
return "danger";
};
- // const SubscriptionColumns = [
- // {
- // key: "createdAt",
- // label: "Date",
- // getValue: (e) => formatUTCToLocalTime(e?.createdAt),
- // align: "text-start",
- // },
- // {
- // key: "frequency",
- // label: "Type",
- // getValue: (e) => {
- // switch (e.frequency) {
- // case 1:
- // return "Monthly";
- // case 3:
- // return "Quarterly";
- // case 12:
- // return "Yearly";
- // default:
- // return "N/A";
- // }
- // },
- // align: "text-start",
- // },
- // {
- // key: "price",
- // label: "Amount",
- // getValue: (e) => (
- // <>
- // {e.currency?.symbol || "₹"} {e.price}
- // >
- // ),
- // align: "text-end",
- // },
- // {
- // key: "submittedBy",
- // label: "Submitted By",
- // getValue: (e) =>
- // `${e.createdBy?.firstName ?? ""} ${
- // e.createdBy?.lastName ?? ""
- // }`.trim() || "N/A",
- // customRender: (e) => (
- //
- //
- //
- // {`${e.createdBy?.firstName ?? ""} ${
- // e.createdBy?.lastName ?? ""
- // }`.trim() || "N/A"}
- //
- //
- // ),
- // align: "text-start",
- // },
- // {
- // key: "action",
- // label: "Action",
- // customRender: (e) => (
- //
- // ),
- // align: "text-center",
- // },
- // ];
+ const SubscriptionColumns = [
+ {
+ key: "createdAt",
+ label: "Date",
+ getValue: (e) => formatUTCToLocalTime(e?.createdAt),
+ align: "text-start",
+ },
+ {
+ key: "frequency",
+ label: "Type",
+ getValue: (e) =>
+ SUBSCRIPTION_PLAN_FREQUENCIES[e.frequency] || "N/A",
+ align: "text-start",
+ },
+ {
+ key: "price",
+ label: "Amount",
+ getValue: (e) => (
+ <>
+ {e.currency?.symbol || "₹"} {e.price}
+ >
+ ),
+ align: "text-end pe-4",
+ },
+ {
+ key: "planName",
+ label: "Plan Name",
+ getValue: (e) => e.planName,
+ align: "text-start ps-4",
+ },
+ {
+ key: "action",
+ label: "Action",
+ getValue: (e) => (
+
console.log("Download clicked for", e.id)}
+ role="button"
+ />
+ ),
+ align: "text-center",
+ },
+];
+
return (
@@ -186,37 +158,31 @@ const SubScriptionHistory = ({ tenantId }) => {
-
-
- | Date |
- Type |
- Amount |
- Plan Name |
- Action |
-
-
-
- {data?.subscriptionHistery?.map((item) => (
-
- | {formatUTCToLocalTime(item.createdAt)} |
-
- {SUBSCRIPTION_PLAN_FREQUENCIES[item.frequency] || "N/A"}
- |
-
-
- {" "}
- {item.currency?.symbol}
- {item.price}
-
- |
- {item.planName} |
-
-
- |
-
- ))}
-
-
+
+
+ {SubscriptionColumns.map((col) => (
+ |
+ {col.label}
+ |
+ ))}
+
+
+
+ {data?.subscriptionHistery
+ ?.slice()
+ .sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt)) // latest first
+ .map((item) => (
+
+ {SubscriptionColumns.map((col) => (
+ |
+ {col.getValue ? col.getValue(item) : item[col.key] || "N/A"}
+ |
+ ))}
+
+ ))}
+
+
+