diff --git a/src/pages/Home/SubscriptionPlans.jsx b/src/pages/Home/SubscriptionPlans.jsx
index 0d44472c..7c06a751 100644
--- a/src/pages/Home/SubscriptionPlans.jsx
+++ b/src/pages/Home/SubscriptionPlans.jsx
@@ -1,113 +1,3 @@
-// // src/components/SubscriptionPlans.jsx
-// import React, { useState, useEffect } from "react";
-// import axios from "axios";
-
-// const SubscriptionPlans = () => {
-// const [plans, setPlans] = useState([]);
-// const [frequency, setFrequency] = useState(1); // 1=Monthly, 2=Quarterly, 3=Half-Yearly, 4=Yearly
-// const [loading, setLoading] = useState(false);
-
-// useEffect(() => {
-// const fetchPlans = async () => {
-// try {
-// setLoading(true);
-// const res = await axios.get(
-// `/api/market/list/subscription-plan?frequency=${frequency}`
-// );
-// setPlans(res.data?.data || []);
-// } catch (err) {
-// console.error("Error fetching plans:", err);
-// } finally {
-// setLoading(false);
-// }
-// };
-
-// fetchPlans();
-// }, [frequency]);
-
-// return (
-//
-// {/* Frequency Switcher */}
-//
-//
-// {["Monthly", "Quarterly", "Half-Yearly", "Yearly"].map((label, idx) => (
-//
-// ))}
-//
-//
-
-// {/* Cards */}
-//
-// {loading ? (
-//
Loading...
-// ) : plans.length === 0 ? (
-//
No plans found
-// ) : (
-// plans.map((plan) => (
-//
-//
-//
-//
{plan.planName}
-//
{plan.description}
-//
-//
-// {plan.currency?.symbol}
-// {plan.price}
-//
-// /mo
-//
-//
-// Max Users: {plan.maxUser} | Storage: {plan.maxStorage} MB
-//
-//
-
-//
-//
-// {plan.features?.modules &&
-// Object.values(plan.features.modules).map((mod) => (
-// -
-//
-// {mod.name}{" "}
-// {mod.enabled ? (
-// Enabled
-// ) : (
-// Disabled
-// )}
-//
-// ))}
-// -
-//
-// Support:{" "}
-// {plan.features?.supports?.prioritySupport
-// ? "Priority"
-// : plan.features?.supports?.phoneSupport
-// ? "Phone & Email"
-// : "Email Only"}
-//
-//
-//
-
-//
-//
-//
-//
-//
-// ))
-// )}
-//
-//
-// );
-// };
-
-// export default SubscriptionPlans;
-
import React, { useState, useEffect } from "react";
import axios from "axios";
@@ -120,11 +10,10 @@ const SubscriptionPlans = () => {
const fetchPlans = async () => {
try {
setLoading(true);
- const res = await axios.get(`http://localhost:5032/api/market/list/subscription-plan?frequency=${frequency}`, {
- headers: {
- "Content-Type": "application/json"
- }
- });
+ const res = await axios.get(
+ `http://localhost:5032/api/market/list/subscription-plan?frequency=${frequency}`,
+ { headers: { "Content-Type": "application/json" } }
+ );
setPlans(res.data?.data || []);
} catch (err) {
console.error("Error fetching plans:", err);
@@ -155,7 +44,7 @@ const SubscriptionPlans = () => {
key={idx}
type="button"
className={`btn btn-${frequency === idx ? "primary" : "outline-secondary"}`}
- onClick={() => setFrequency(idx)} // use idx directly (0,1,2,3)
+ onClick={() => setFrequency(idx)}
>
{label}
@@ -163,7 +52,6 @@ const SubscriptionPlans = () => {
-
{/* Cards */}
{loading ? (
@@ -173,54 +61,65 @@ const SubscriptionPlans = () => {
) : (
plans.map((plan) => (
-
-
-
{plan.planName}
-
{plan.description}
-
-
- {plan.currency?.symbol}{plan.price}
-
- /{frequencyLabel(frequency)}
-
-
- Max Users: {plan.maxUser} | Storage: {plan.maxStorage} MB
+
+ {/* Header */}
+
+
+
+
+ {plan.planName}
+
+
{plan.description}
-
-
- {plan.features?.modules &&
- Object.values(plan.features.modules).map((modGroup) =>
- Object.values(modGroup).map((mod) =>
- mod && mod.name ? (
- -
-
- {mod.name}{" "}
- {mod.enabled ? (
- Enabled
- ) : (
- Disabled
- )}
-
- ) : null
- )
- )}
-
- -
-
- Support:{" "}
- {plan.features?.supports?.prioritySupport
- ? "Priority"
- : plan.features?.supports?.phoneSupport
- ? "Phone & Email"
- : "Email Only"}
-
-
+ {/* Price */}
+
+
+ {plan.currency?.symbol} {plan.price}
+
-
-
+ {/* Storage & Trial */}
+
+
+
+ Storage {plan.maxStorage} MB
+
+
+
+ Trial Days {plan.trialDays}
+
+
+
+ {/* Features */}
+
+ Features
+
+
+ {plan.features?.modules &&
+ Object.values(plan.features.modules).map((mod) =>
+ mod && mod.name ? (
+ -
+ {mod.enabled ? (
+
+ ) : (
+
+ )}
+ {mod.name}
+
+ ) : null
+ )}
+
+
+ {/* Button */}
+
+
@@ -232,4 +131,3 @@ const SubscriptionPlans = () => {
};
export default SubscriptionPlans;
-