From 6e89fbd6809076521c742f803fd67b49dbe38c6c Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Wed, 15 Oct 2025 17:31:58 +0530 Subject: [PATCH] added xl, and doc file allow to upload and getSubscription plan api properly --- src/components/collections/AddPayment.jsx | 43 ++++++---- .../collections/ManageCollection.jsx | 70 +++++++++------- .../collections/collectionSchema.jsx | 5 ++ src/hooks/useAuth.jsx | 20 +++-- src/pages/Home/LandingPage.jsx | 4 +- src/pages/Home/SubscriptionPlans.jsx | 79 ++++++++++--------- src/pages/collections/CollectionPage.jsx | 2 +- src/repositories/AuthRepository.jsx | 5 +- src/utils/axiosClient.jsx | 13 ++- 9 files changed, 147 insertions(+), 94 deletions(-) diff --git a/src/components/collections/AddPayment.jsx b/src/components/collections/AddPayment.jsx index 91196dfa..a47200ee 100644 --- a/src/components/collections/AddPayment.jsx +++ b/src/components/collections/AddPayment.jsx @@ -75,6 +75,15 @@ const AddPayment = ({ onClose }) => { {errors.paymentReceivedDate && ( @@ -90,7 +99,7 @@ const AddPayment = ({ onClose }) => { className="form-label" required > - Payment Adjustment Head + Payment Adjustment Head @@ -152,9 +163,9 @@ const AddPayment = ({ onClose }) => { - ))} + {["Monthly", "Quarterly", "Half-Yearly", "Yearly"].map( + (label, idx) => ( + + ) + )} {/* Cards */}
- {loading ? ( + {isLoading ? ( // Show 3 skeletons <> - ) : plans.length === 0 ? ( + ) : data.length === 0 ? (
No plans found
+ ) : isError ? ( +
+

{error.message}

+

{error.name}

+
) : ( - plans.map((plan) => ( + data.map((plan) => (
{/* Header */}
-

{plan.planName}

+

+ {plan.planName} +

{plan.description}

@@ -80,7 +82,9 @@ const SubscriptionPlans = () => {

{plan.currency?.symbol} {plan.price} - / {frequencyLabel(frequency)} + + / {frequencyLabel(frequency)} +

@@ -133,7 +137,6 @@ const SubscriptionPlans = () => { )) )}
-
); }; diff --git a/src/pages/collections/CollectionPage.jsx b/src/pages/collections/CollectionPage.jsx index 4e9eaf6a..ce802acf 100644 --- a/src/pages/collections/CollectionPage.jsx +++ b/src/pages/collections/CollectionPage.jsx @@ -181,7 +181,7 @@ const CollectionPage = () => { handleMarkedPayment(processedPayment?.invoiceId)} diff --git a/src/repositories/AuthRepository.jsx b/src/repositories/AuthRepository.jsx index 700020fd..ba68946e 100644 --- a/src/repositories/AuthRepository.jsx +++ b/src/repositories/AuthRepository.jsx @@ -10,6 +10,7 @@ const AuthRepository = { verifyOTP: (data) => api.postPublic("/api/auth/login-otp", data), register: (data) => api.postPublic("/api/auth/register", data), sendMail: (data) => api.postPublic("/api/auth/sendmail", data), + getSubscription:(frequency)=> api.getPublic(`/api/market/list/subscription-plan?frequency=${frequency}`), // Protected routes (require auth token) logout: (data) => api.post("/api/auth/logout", data), @@ -17,7 +18,9 @@ const AuthRepository = { changepassword: (data) => api.post("/api/auth/change-password", data), appmenu: () => api.get('/api/appmenu/get/menu'), selectTenant: (tenantId) => api.post(`/api/Auth/select-tenant/${tenantId}`), - getTenantList: () => api.get("/api/Auth/get/user/tenants"), + getTenantList: () => api.get("/api/Auth/get/user/tenants"), + + // }; diff --git a/src/utils/axiosClient.jsx b/src/utils/axiosClient.jsx index bf26500e..0f2f14a2 100644 --- a/src/utils/axiosClient.jsx +++ b/src/utils/axiosClient.jsx @@ -72,7 +72,9 @@ axiosClient.interceptors.response.use( if (status === 401 && !isRefreshRequest) { originalRequest._retry = true; - const refreshToken = localStorage.getItem("refreshToken") || sessionStorage.getItem("refreshToken"); + const refreshToken = + localStorage.getItem("refreshToken") || + sessionStorage.getItem("refreshToken"); if ( !refreshToken || @@ -87,7 +89,9 @@ axiosClient.interceptors.response.use( try { // Refresh token call const res = await axiosClient.post("/api/Auth/refresh-token", { - token: localStorage.getItem("jwtToken") || sessionStorage.getItem("jwtToken"), + token: + localStorage.getItem("jwtToken") || + sessionStorage.getItem("jwtToken"), refreshToken, }); @@ -144,6 +148,11 @@ export const api = { headers: { ...customHeaders }, authRequired: false, }), + getPublic: (url, data = {}, customHeaders = {}) => + apiRequest("get", url, data, { + headers: { ...customHeaders }, + authRequired: false, + }), // Authenticated routes get: (url, params = {}, customHeaders = {}) =>