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..2e929f13 100644 --- a/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx +++ b/src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx @@ -41,14 +41,16 @@ 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) { diff --git a/src/Configuration/Customers/CustomerDetailView/tests/CustomerPlanContainer.test.jsx b/src/Configuration/Customers/CustomerDetailView/tests/CustomerPlanContainer.test.jsx index 4d3be26e..b3fd899b 100644 --- a/src/Configuration/Customers/CustomerDetailView/tests/CustomerPlanContainer.test.jsx +++ b/src/Configuration/Customers/CustomerDetailView/tests/CustomerPlanContainer.test.jsx @@ -53,8 +53,6 @@ describe('CustomerPlanContainer', () => { expirationDate: '2024-09-02T20:02:57.651943Z', uuid: 'test-uuid', }], - countOfActivePlans: 2, - countOfAllPlans: 3, inactiveSubscriptions: [], inactiveSubsidies: [{ activeDatetime: '2024-08-23T20:02:57.651943Z',