Merge pull request 'FIX#210 Plan Expire Modal and Redirection Issue solving' (#212) from Uomdisplayinprint into main

Reviewed-on: Pozomind/pozo-retail-app#212
This commit is contained in:
karthikalakshmi 2026-03-03 10:28:39 +05:30
commit fe88e0445a
9 changed files with 90 additions and 47 deletions

View File

@ -101,11 +101,10 @@ const ComboSalesBillTable = lazy(
() =>
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
);
const SalesCountComponent = lazy(() => import('../SalesCountComponent.jsx'));
const PlanExpireNotification = lazy(
() => import('../PlanExpireNotification.jsx')
);
const SalesCountComponent = lazy(() => import('../SalesCountComponent.jsx'));
// const PlanExpireNotification = lazy(() => import('../PlanExpireNotification.jsx'));
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSLayout1 = () => {
const dispatch = useDispatch();
@ -319,9 +318,8 @@ const BSLayout1 = () => {
const handleInvoiceClose = () => {
setListOfInvoices(false);
};
return (
<Suspense fallback={<CardSkeleton />}>
{' '}
return (
<Suspense fallback={<CardSkeleton />}>
<>
<Messages
messageType={messageType}
@ -673,7 +671,7 @@ const BSLayout1 = () => {
/>
)}
</>
</Suspense>
</Suspense>
);
};

View File

@ -133,10 +133,10 @@ const BranchTransferComponent = lazy(
const BSExpireProductsList = lazy(
() => import('../../Components/UtillComponents/BSExpireProductsList.jsx')
);
const PlanExpireNotification = lazy(
() => import('../PlanExpireNotification.jsx')
);
// const PlanExpireNotification = lazy(
// () => import('../PlanExpireNotification.jsx')
// );
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSLayout2 = () => {
const dispatch = useDispatch();
const elementRef = useRef(null);
@ -328,7 +328,7 @@ const BSLayout2 = () => {
setListOfInvoices(false);
};
return (
<Suspense fallback={<CardSkeleton />}>
<Suspense fallback={<CardSkeleton />}>
<>
<Messages
messageType={messageType}
@ -684,7 +684,7 @@ const BSLayout2 = () => {
<LayoutSubCategoryFetcher />
</>
</Suspense>
</Suspense>
);
};

View File

@ -102,17 +102,17 @@ const ComboSalesBillTable = lazy(
() =>
import('../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx')
);
const PlanExpireNotification = lazy(
() => import('../PlanExpireNotification.jsx')
);
// const PlanExpireNotification = lazy(
// () => import('../PlanExpireNotification.jsx')
// );
import PlanExpireNotification from '../PlanExpireNotification.jsx';
const BSNavbar1 = lazy(() => import('../../Components/BSNavbar/BSNavbar1'));
const BSNavbar2 = lazy(() => import('../../Components/BSNavbar/BSNavbar2'));
// Scss
import '../../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss';
import CardSkeleton from '../../../../Components/Skeleton/CardSkeleton.jsx';
const subDirectory = import.meta.env.BASE_URL;
const commonDirectory = import.meta.env.COMMON_BASE_URL;
const BSLayout3 = () => {
const dispatch = useDispatch();
@ -625,7 +625,7 @@ const BSLayout3 = () => {
/>
)}
</>
</Suspense>
</Suspense>
);
};

View File

@ -612,7 +612,7 @@ const BSLayout4 = () => {
/>
)}
</>
</Suspense>
</Suspense>
);
};

View File

@ -603,7 +603,7 @@ const BSLayout5 = () => {
/>
)}
</>
</Suspense>
</Suspense>
);
};

View File

@ -625,7 +625,7 @@ const BSLayout6 = () => {
)}
</div>
</>
</Suspense>
</Suspense>
);
};
export default BSLayout6;

View File

@ -1,5 +1,5 @@
import { useSelector } from 'react-redux';
import { GlobalAppExpDateData } from '../../../Features/BookingScreen/BookingData/BookingData';
import { ChangeAppExpDateData, getAppSubscriptionDate, GlobalAppExpDateData } from '../../../Features/BookingScreen/BookingData/BookingData';
import { useNavigate } from 'react-router-dom';
import { ArrowUpOutlined } from '@ant-design/icons';
import { StoredSessionData } from '../../../Features/ThemeChange/ThemeChange';
@ -38,22 +38,65 @@ const PlanExpireNotification = () => {
UserName,
UserType,
} = SessionData;
console.log('SessionData', AppExpDate);
const [count, setcount] = useState(0);
const animations = ['example1', 'example2', 'example3'];
let ss = animations[count];
useEffect(() => {
if (
AppExpDate?.RemainingDays <= 7 ||
AppExpDate?.PlanType?.toLowerCase() === 'extend'
) {
const interval = setInterval(() => {
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
}, 22000);
return () => clearInterval(interval);
// useEffect(() => {
// if (
// AppExpDate?.RemainingDays <= 7 ||
// AppExpDate?.PlanType?.toLowerCase() === 'extend'
// ) {
// const interval = setInterval(() => {
// setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
// }, 22000);
// return () => clearInterval(interval);
// }
// }, [count == 2]);
useEffect(() => {
if (!AppExpDate || !SessionData) return;
let interval;
const fetchExpDate = async () => {
const { CompId, BranchId, AppId } = SessionData;
const res = await dispatch(
getAppSubscriptionDate({ CompId, BranchId, AppId })
).unwrap();
const expData = res?.data?.data?.[0];
if (!expData) return;
dispatch(ChangeAppExpDateData(expData));
// If renewed stop interval
if (expData.RemainingDays > 1 && interval) {
clearInterval(interval);
}
}, [count == 2]);
};
// 🎯 Only when less than 1 day start checking
if (AppExpDate.RemainingDays <= 1) {
interval = setInterval(fetchExpDate, 60000); // 1 minute
}
return () => {
if (interval) clearInterval(interval);
};
}, [AppExpDate?.RemainingDays]);
useEffect(() => {
if (AppExpDate?.RemainingDays <= 7) {
const interval = setInterval(() => {
setcount((prev) => (prev >= 2 ? 0 : prev + 1));
}, 22000);
return () => clearInterval(interval);
}
}, [AppExpDate?.RemainingDays]);
// ================= DATE FORMAT =================
const formatDate = (dateStr) => {
@ -126,7 +169,7 @@ const PlanExpireNotification = () => {
const res = await dispatch(PublicQrCodepost(postData)).unwrap();
// navigate(`${commonDirectory}invoice-details`);
if (res?.data?.statusCode == 1) {
navigate(`${commonDirectory}invoice-detail/${res?.data?.ReferenceNo}`);
navigate(`${commonDirectory}/home/invoice-detail/${res?.data?.ReferenceNo}`);
setExtendModel(false);
}
} catch (error) {
@ -149,7 +192,7 @@ const PlanExpireNotification = () => {
>
Subscription expired &nbsp;
<a onClick={handlePay} className="upgrdbtn">
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</div>
);
@ -164,7 +207,7 @@ const PlanExpireNotification = () => {
</span>{' '}
{AppExpDate?.RemainingHours >= 1 ? 'Hrs' : 'Min'} &nbsp;
<a onClick={handlePay} className="upgrdbtn">
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</p>
);
@ -182,7 +225,7 @@ const PlanExpireNotification = () => {
Your application subscription will expire within &nbsp;
<span className="NosDays">{AppExpDate?.RemainingDays}</span> days. &nbsp;
<a onClick={handlePay} className="upgrdbtn">
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</p>
);

View File

@ -82,9 +82,11 @@ const ExtendSubscriptionModal = ({
const response = await dispatch(postInvoice(postData)).unwrap();
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
await dispatch(sendSms({ body: response.data.SMSbody }));
setExtendModel(false)
if (response?.data?.statusCode === 1) {
if(response?.data?.SMSbody){
await dispatch(sendSms({ body: response.data.SMSbody }));
}
setExtendModel(false)
navigate(`${subDirectory}app-page/home`);
}
} catch (error) {
@ -113,7 +115,7 @@ const ExtendSubscriptionModal = ({
const res = await dispatch(PublicQrCodepost(postData)).unwrap();
// navigate(`${commonDirectory}invoice-details`);
if (res?.data?.statusCode == 1) {
navigate(`${commonDirectory}invoice-detail/${res?.data?.ReferenceNo}`);
navigate(`${commonDirectory}/home/invoice-detail/${res?.data?.ReferenceNo}`);
setExtendModel(false)
}

View File

@ -748,7 +748,7 @@ const WholesaleBookingPage = () => {
}}
className="upgrdbtn"
>
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</span>
) : AppExpDate?.RemainingDays < 1 ? (
@ -766,7 +766,7 @@ const WholesaleBookingPage = () => {
}}
className="upgrdbtn"
>
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</p>
) : (
@ -782,7 +782,7 @@ const WholesaleBookingPage = () => {
}}
className="upgrdbtn"
>
RENEWAL NOW <ArrowUpOutlined />
RENEW NOW <ArrowUpOutlined />
</a>
</p>
)}