From 3cb9f2b36b0ef7ebafe8c4e7e2c2277af275499f Mon Sep 17 00:00:00 2001 From: katrinan029 Date: Wed, 25 Sep 2024 21:29:52 +0000 Subject: [PATCH] fix: update logic to show subsidy cards --- .../Customers/CustomerDetailView/CustomerPlanContainer.jsx | 2 +- .../Customers/CustomerDetailView/CustomerViewContainer.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Configuration/Customers/CustomerDetailView/CustomerPlanContainer.jsx b/src/Configuration/Customers/CustomerDetailView/CustomerPlanContainer.jsx index 34f5881e..86eaa706 100644 --- a/src/Configuration/Customers/CustomerDetailView/CustomerPlanContainer.jsx +++ b/src/Configuration/Customers/CustomerDetailView/CustomerPlanContainer.jsx @@ -14,7 +14,7 @@ const CustomerPlanContainer = ({ }) => { const [showInactive, setShowInactive] = useState(false); const countOfActivePlans = activeSubscriptions.length + activeSubsidies.length; - const countOfInactivePlans = inactiveSubscriptions.length + activeSubsidies.length; + const countOfInactivePlans = inactiveSubscriptions.length + inactiveSubsidies.length; const countOfAllPlans = countOfActivePlans + countOfInactivePlans; useEffect(() => { if (!countOfActivePlans && countOfAllPlans) { diff --git a/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx b/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx index 23716a27..ad0f79ab 100644 --- a/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx +++ b/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx @@ -41,14 +41,14 @@ const CustomerViewContainer = () => { }, [fetchData]); const renderPlanContainer = () => { - if (!isLoading && !associatedPlans.isLoading && associatedPlans.countOfAllPlans) { + if (!isLoading && !associatedPlans.isLoading && (associatedPlans.activeSubsidies.length > 0 || associatedPlans.activeSubscriptions.length > 0)) { return ( ); } - if (!associatedPlans.isLoading && !associatedPlans.countOfAllPlans) { + if (!associatedPlans.isLoading && (!associatedPlans.activeSubsidies.length || !associatedPlans.activeSubscriptions.length)) { return false; } if (associatedPlans.isLoading) {