Fix#140 One month free Plan Updated
This commit is contained in:
parent
3f52918a09
commit
c18c4ebd2c
|
|
@ -27,7 +27,7 @@ import ExtendSubscriptionModal from './Pages/ExtentedModal/ExtendSubscriptionMod
|
|||
const AppRoutes = () => {
|
||||
const ItemCard = useSelector(GlobalItemCard);
|
||||
const { sessionData, logout } = useSessionManager(ItemCard);
|
||||
const { remainingDays, handleCancel, handlePay, freeExtend, extendModel } = useSubscriptionManager(sessionData, logout);
|
||||
const { remainingDays, handleCancel, freeExtend, extendModel,setExtendModel } = useSubscriptionManager(sessionData, logout);
|
||||
|
||||
useEffect(() => {
|
||||
const handlePopState = () => {
|
||||
|
|
@ -69,8 +69,7 @@ const AppRoutes = () => {
|
|||
return (
|
||||
<ExtendSubscriptionModal
|
||||
onClose={handleCancel}
|
||||
onPayNow={handlePay}
|
||||
onContinueWithCredits={freeExtend}
|
||||
setExtendModel={setExtendModel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ const BookingPage = () => {
|
|||
const UserType = getSession('UserType');
|
||||
const AuthToken = sessionStorage.getItem('auth');
|
||||
const SessionMobileNo = getSession('MobileNo');
|
||||
const UserName = getSession("UserName");
|
||||
const SessionId =getSession("SessionId")
|
||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||
const Scantemplatedata = useSelector(GlobalScanTemplate);
|
||||
|
||||
|
|
@ -128,6 +130,8 @@ const BookingPage = () => {
|
|||
AuthToken,
|
||||
SessionMobileNo,
|
||||
FeatureAddonData,
|
||||
UserName,
|
||||
SessionId
|
||||
};
|
||||
dispatch(changeSessionData(SessionData));
|
||||
}, [BranchId, FeatureAddonData]);
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ const BSLayout1 = () => {
|
|||
const BranchId = SessionData?.BranchId;
|
||||
const UserId = SessionData?.UserId;
|
||||
const UserType = SessionData?.UserType;
|
||||
const AppName = SessionData?.AppName;
|
||||
|
||||
const GlobalLayoutColorDetail = useSelector(SelectedGlobalLayoutColorDetail);
|
||||
const GlobalsalesDetailData = useSelector(GlobalSalesDetailData);
|
||||
const SelectedCatgColor = useSelector(SelectedGlobalCatgColorDetail);
|
||||
|
|
@ -134,7 +132,7 @@ const BSLayout1 = () => {
|
|||
const SelectedBillColor = useSelector(SelectedGlobalBillingColorDetail);
|
||||
|
||||
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
const [count, setcount] = useState(0);
|
||||
|
||||
const [popOverOpen, setPopOverOpen] = useState(false);
|
||||
const appPreferences = useSelector(ApplicationPreferences);
|
||||
const salespagefields = appPreferences?.find(
|
||||
|
|
@ -159,16 +157,15 @@ const BSLayout1 = () => {
|
|||
(i) => i.SettingIdName === 'DineIn'
|
||||
)?.[0];
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '575px'
|
||||
: '595px'
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '96vh'
|
||||
: '99vh';
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
let ss = animations[count];
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId && UserId) {
|
||||
|
|
@ -227,14 +224,6 @@ const BSLayout1 = () => {
|
|||
// setBadgeCount(length);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
|
||||
|
||||
const onComplete = useCallback(() => {
|
||||
|
|
@ -317,8 +306,8 @@ const BSLayout1 = () => {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
<div
|
||||
className="BSLayout1-Master"
|
||||
|
|
|
|||
|
|
@ -182,16 +182,15 @@ const BSLayout2 = () => {
|
|||
(i) => i.SettingIdName === 'DineIn'
|
||||
)?.[0];
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '575px'
|
||||
: ''
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '96vh'
|
||||
: '99vh';
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
const [count, setcount] = useState(0);
|
||||
|
||||
const [ListOfInvoices, setListOfInvoices] = useState(false);
|
||||
const appPreferences = useSelector(ApplicationPreferences);
|
||||
const salespagefields = appPreferences?.find(
|
||||
|
|
@ -211,7 +210,6 @@ const BSLayout2 = () => {
|
|||
preference?.PreferredStatus == 'Y'
|
||||
);
|
||||
|
||||
let ss = animations[count];
|
||||
|
||||
useEffect(() => {
|
||||
fetchAmount();
|
||||
|
|
@ -228,15 +226,6 @@ const BSLayout2 = () => {
|
|||
fetchBookingStatus();
|
||||
}
|
||||
}, [AppId, CompId, BranchId, UserId]);
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
|
||||
const fetchAmount = async () => {
|
||||
let data = {
|
||||
|
|
@ -345,9 +334,9 @@ const BSLayout2 = () => {
|
|||
<div ref={elementRef} style={{ backgroundColor: '#fff' }}>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<Suspense fallback={<div>Loading...</div>}>
|
||||
<PlanExpireNotification ss={ss} />
|
||||
<PlanExpireNotification/>
|
||||
</Suspense>
|
||||
)}
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ const BSLayout3 = () => {
|
|||
const AppExpDate = useSelector(GlobalAppExpDateData);
|
||||
// const [AppExpDate, setAppExpDate] = useState(0);
|
||||
const [Kioskopen, setKioskopen] = useState(false);
|
||||
const [count, setcount] = useState(0);
|
||||
const BookingStatus = useSelector(GlobalBookingStatus);
|
||||
const appPreferences = useSelector(ApplicationPreferences);
|
||||
const commonModulePreference = appPreferences?.find(
|
||||
|
|
@ -125,8 +124,7 @@ const BSLayout3 = () => {
|
|||
const BookingSubCategory = BSLayout3Data?.BookingSubCategory;
|
||||
const BookingCard = BSLayout3Data?.BookingCard;
|
||||
const BookingBilling = BSLayout3Data?.BookingBilling?.[0];
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
let ss = animations[count];
|
||||
|
||||
const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'DineIn'
|
||||
)?.[0];
|
||||
|
|
@ -138,12 +136,12 @@ const BSLayout3 = () => {
|
|||
const UserType = SessionData?.UserType;
|
||||
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '576px'
|
||||
: '590px'
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '95vh'
|
||||
: '99vh';
|
||||
const SAdminuserPin = useSelector(GLobalSadminUserPin);
|
||||
|
|
@ -164,14 +162,7 @@ const BSLayout3 = () => {
|
|||
}
|
||||
}, [SessionData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
|
||||
const fetchKioskDatas = async () => {
|
||||
let data = {
|
||||
CompId: CompId,
|
||||
|
|
@ -278,8 +269,8 @@ const BSLayout3 = () => {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
<div
|
||||
className="BSLayout3-Master"
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ import { CiShop } from 'react-icons/ci';
|
|||
import BranchName from '../BranchName.jsx';
|
||||
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
|
||||
import PlanExpireNotification from '../PlanExpireNotification.jsx';
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
|
||||
const BSLayout4 = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -111,7 +110,6 @@ const BSLayout4 = () => {
|
|||
);
|
||||
// const [AppExpDate, setAppExpDate] = useState(0);
|
||||
const [Kioskopen, setKioskopen] = useState(false);
|
||||
const [count, setcount] = useState(0);
|
||||
const BookingStatus = useSelector(GlobalBookingStatus);
|
||||
const CheckBookingStatus =
|
||||
BookingStatus?.find((item) => item.ScreenType === 'Booking')
|
||||
|
|
@ -122,11 +120,9 @@ const BSLayout4 = () => {
|
|||
const BookingCard = BSLayout4Data?.BookingCard;
|
||||
const BookingBilling = BSLayout4Data?.BookingBilling?.[0];
|
||||
console.log('BSLayout4Data', BookingBilling);
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'DineIn'
|
||||
)?.[0];
|
||||
const AppName = SessionData?.AppName;
|
||||
const AppId = SessionData?.AppId;
|
||||
const CompId = SessionData?.CompId;
|
||||
const BranchId = SessionData?.BranchId;
|
||||
|
|
@ -134,15 +130,14 @@ const BSLayout4 = () => {
|
|||
const UserType = SessionData?.UserType;
|
||||
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '575px'
|
||||
: '590px'
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '96vh'
|
||||
: '99vh';
|
||||
let ss = animations[count];
|
||||
const [ListOfInvoices, setListOfInvoices] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -160,15 +155,7 @@ const BSLayout4 = () => {
|
|||
fetchBookingStatus();
|
||||
}
|
||||
}, [AppId, CompId, BranchId, UserId]);
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
const OpenListOfInvoices = () => {
|
||||
setListOfInvoices(true);
|
||||
};
|
||||
|
|
@ -278,8 +265,8 @@ const BSLayout4 = () => {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
<div
|
||||
className="BsLayout4-Master"
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import {
|
|||
globalKioskSalesCount,
|
||||
} from '../../../../Features/Kiosk/kiosk.js';
|
||||
import SalesCountComponent from '../SalesCountComponent.jsx';
|
||||
import '../../../../Styles/BookingScreen/Template/BSLayout5/BSLayout5.scss';
|
||||
import PozoKioskIcon from '../../Components/UtillComponents/Pozo retail icons/PozoKioskIcon.jsx';
|
||||
import {
|
||||
GLobalSadminUserPin,
|
||||
|
|
@ -78,8 +79,6 @@ import { CiShop } from 'react-icons/ci';
|
|||
import BranchName from '../BranchName.jsx';
|
||||
import ComboSalesBillTable from '../../Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx';
|
||||
import PlanExpireNotification from '../PlanExpireNotification.jsx';
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
const BSLayout5 = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -107,7 +106,6 @@ const BSLayout5 = () => {
|
|||
// const [AppExpDate, setAppExpDate] = useState(0);
|
||||
const [screenHeight, setScreenHeight] = useState(window.innerHeight);
|
||||
const [Kioskopen, setKioskopen] = useState(false);
|
||||
const [count, setcount] = useState(0);
|
||||
const PricingAppPricingName = useSelector(GlobalPricingAppPricingName);
|
||||
const SAdminuserPin = useSelector(GLobalSadminUserPin);
|
||||
const BookingNavbar = BSLayout5Data?.BookingNavbar?.[0];
|
||||
|
|
@ -117,22 +115,20 @@ const BSLayout5 = () => {
|
|||
const DineInAccess = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'DineIn'
|
||||
)?.[0];
|
||||
const AppName = SessionData?.AppName;
|
||||
const AppId = SessionData?.AppId;
|
||||
const CompId = SessionData?.CompId;
|
||||
const BranchId = SessionData?.BranchId;
|
||||
const UserId = SessionData?.UserId;
|
||||
const UserType = SessionData?.UserType;
|
||||
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
let ss = animations[count];
|
||||
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '580px'
|
||||
: '590px'
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '96vh'
|
||||
: '99vh';
|
||||
const [ListOfInvoices, setListOfInvoices] = useState(false);
|
||||
|
|
@ -160,15 +156,7 @@ const BSLayout5 = () => {
|
|||
fetchKioskDatas();
|
||||
}
|
||||
}, [SessionData]);
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId && UserId) {
|
||||
fetchBookingStatus();
|
||||
|
|
@ -293,8 +281,8 @@ const BSLayout5 = () => {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
<div
|
||||
className="BSLayout5-Master"
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import {
|
|||
import { Messages } from '../../../../Components/Notifications/Messages.jsx';
|
||||
import SAdminUserNotification from '../../Components/BookingFunctionality/SAdminUserNotification.jsx';
|
||||
import SalesCountComponent from '../SalesCountComponent.jsx';
|
||||
import '../../../../Styles/BookingScreen/Template/BSLayout6/BSLayout6.scss';
|
||||
import {
|
||||
getBookingStatus,
|
||||
GlobalBookingStatus,
|
||||
|
|
@ -68,10 +69,6 @@ import BSEwayBillicon from '../../Components/UtillComponents/BSEwayBillicon.jsx'
|
|||
import BSComboItemCard from '../../Components/BSItemCards/BSComboItemCard.jsx';
|
||||
import BranchTransferComponent from '../../Components/UtillComponents/BSQuickBranchToBranchTransferComponent.jsx';
|
||||
import BSExpireProductsList from '../../Components/UtillComponents/BSExpireProductsList.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
import BSOtherServiceItemCard from '../../Components/BSItemCards/BSOtherServiceItemCard.jsx';
|
||||
import BSOtherServicesHorizontalcat from '../../Components/BSCategories/BSOtherServicesHorizontalcat';
|
||||
import BSNavbar3 from '../../Components/BSNavbar/BSNavbar3.jsx';
|
||||
|
|
@ -115,12 +112,10 @@ const BSLayout6 = () => {
|
|||
const AppExpDate = useSelector(GlobalAppExpDateData);
|
||||
const [screenHeight, setScreenHeight] = useState(window?.innerHeight);
|
||||
// const [AppExpDate, setAppExpDate] = useState(0);
|
||||
const [count, setcount] = useState(0);
|
||||
const BookingNavbar = BSLayout6Data?.BookingNavbar?.[0];
|
||||
const BookingCategory = BSLayout6Data?.BookingCategory;
|
||||
const BookingCard = BSLayout6Data?.BookingCard;
|
||||
const BookingBilling = BSLayout6Data?.BookingBilling?.[0];
|
||||
const AppName = SessionData?.AppName;
|
||||
const AppId = SessionData?.AppId;
|
||||
const CompId = SessionData?.CompId;
|
||||
const BranchId = SessionData?.BranchId;
|
||||
|
|
@ -154,15 +149,7 @@ const BSLayout6 = () => {
|
|||
}
|
||||
}, [SessionData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId && UserId) {
|
||||
fetchBookingStatus();
|
||||
|
|
@ -198,18 +185,16 @@ const BSLayout6 = () => {
|
|||
};
|
||||
|
||||
let containerHeight = isMobile
|
||||
? AppExpDate?.RemainingDays <= 7
|
||||
? AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '577px'
|
||||
: '595px'
|
||||
: UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
AppExpDate?.RemainingDays <= 7
|
||||
AppExpDate?.RemainingDays <= 7 || AppExpDate?.PlanType?.toLowerCase() === 'extend'
|
||||
? '96vh'
|
||||
: '99vh';
|
||||
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
|
||||
let ss = animations[count];
|
||||
useEffect(() => {
|
||||
function handleResize() {
|
||||
setScreenHeight(window.innerHeight);
|
||||
|
|
@ -300,8 +285,8 @@ const BSLayout6 = () => {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 30 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 30 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ import VerfiedProducts from '../../Components/BSNavbar/verfiedProduct/VerfiedPro
|
|||
import ShortcutKeyHelper from '../../Components/UtillComponents/ShortcutKeyHelper.jsx';
|
||||
import PlanExpireNotification from '../PlanExpireNotification.jsx';
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
export default function BSCombo1() {
|
||||
const dispatch = useDispatch();
|
||||
const { action, selectedProducts } = useSelector(
|
||||
|
|
@ -114,7 +111,6 @@ export default function BSCombo1() {
|
|||
|
||||
// const [AppExpDate, setAppExpDate] = useState(0);
|
||||
const [Kioskopen, setKioskopen] = useState(false);
|
||||
const [count, setcount] = useState(0);
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const [multiple, setMultiple] = useState(false);
|
||||
|
|
@ -127,7 +123,6 @@ export default function BSCombo1() {
|
|||
item.SettingIdName === 'VerifyProduct' && item?.SettingValue === 'Y'
|
||||
);
|
||||
|
||||
const AppName = SessionData?.AppName;
|
||||
const AppId = SessionData?.AppId;
|
||||
const CompId = SessionData?.CompId;
|
||||
const BranchId = SessionData?.BranchId;
|
||||
|
|
@ -139,8 +134,7 @@ export default function BSCombo1() {
|
|||
?.ScreenStatus ?? 'Open';
|
||||
const [BookingModalOpen, setBookingModalOpen] = useState(false);
|
||||
const currentDateValue = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
let ss = animations[count];
|
||||
|
||||
const [ListOfInvoices, setListOfInvoices] = useState(false);
|
||||
const [ComboDropDown, setComboDropDown] = useState();
|
||||
|
||||
|
|
@ -155,15 +149,7 @@ export default function BSCombo1() {
|
|||
}
|
||||
}, [SessionData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (AppExpDate?.RemainingDays <= 7) {
|
||||
const interval = setInterval(() => {
|
||||
setcount((prevCount) => (prevCount >= 2 ? 0 : prevCount + 1));
|
||||
}, 22000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [count == 2]);
|
||||
useEffect(() => {
|
||||
Combodata();
|
||||
if (AppId && CompId && BranchId && UserId) {
|
||||
|
|
@ -298,8 +284,8 @@ export default function BSCombo1() {
|
|||
/>
|
||||
{UserType != 'Super Admin' &&
|
||||
UserType != 'Super Admin User' &&
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined') && (
|
||||
<PlanExpireNotification ss={ss}/>
|
||||
(AppExpDate?.RemainingDays <= 7 || AppExpDate === 'undefined' || AppExpDate?.PlanType?.toLowerCase() === 'extend') && (
|
||||
<PlanExpireNotification />
|
||||
)}
|
||||
|
||||
{/* Combo Container */}
|
||||
|
|
|
|||
|
|
@ -1,222 +1,62 @@
|
|||
// import { useSelector } from "react-redux";
|
||||
// import { GlobalAppExpDateData } from "../../../Features/BookingScreen/BookingData/BookingData";
|
||||
// import { useNavigate } from "react-router-dom";
|
||||
// import { ArrowUpOutlined } from '@ant-design/icons';
|
||||
// import { StoredSessionData } from "../../../Features/ThemeChange/ThemeChange";
|
||||
// import ExtendSubscriptionModal from "../../ExtentedModal/ExtendSubscriptionModal";
|
||||
// import { useDispatch } from "react-redux";
|
||||
// import { getPurchasedAppDetails, postInvoice } from "../../../Features/BookingScreen/Pricing/Pricing";
|
||||
// import { sendSms } from "../../../Features/Payment/PaymentDetails/PaymentDetails";
|
||||
// import { useState } from "react";
|
||||
// const subDirectory = import.meta.env.BASE_URL;
|
||||
// const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
// const PlanExpireNotification = ({ss}) => {
|
||||
// const navigate = useNavigate();
|
||||
// const dispatch = useDispatch();
|
||||
|
||||
// const AppExpDate = useSelector(GlobalAppExpDateData);
|
||||
// const SessionData = useSelector(StoredSessionData);
|
||||
// const [extendModel, setExtendModel] = useState(false);
|
||||
// console.log("AppExpDate", AppExpDate);
|
||||
// const navigateFun = () => {
|
||||
// navigate(`${subDirectory}PricingPage`, { state: { AppName: SessionData?.AppName } });
|
||||
// };
|
||||
|
||||
// const navigatePublicFun = () => {
|
||||
// navigate(`${commonDirectory}`);
|
||||
// };
|
||||
// const formatDate = (dateStr) => {
|
||||
// const date = new Date(dateStr);
|
||||
// const year = date.getFullYear();
|
||||
// const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based
|
||||
// const day = String(date.getDate()).padStart(2, '0');
|
||||
// return `${day}-${month}-${year}`;
|
||||
// };
|
||||
// const freeExtend = async () => {
|
||||
// try {
|
||||
// const { CompId, AppId, BranchId, UserType,UserId } = SessionData;
|
||||
|
||||
// // Current date
|
||||
// const now = new Date();
|
||||
// const currentDate = formatDate(now);
|
||||
|
||||
// // 1️⃣ Get purchased app details
|
||||
// const response1 = await dispatch(
|
||||
// getPurchasedAppDetails({ AppId, UserId })
|
||||
// ).unwrap();
|
||||
|
||||
// const PurchasedDetails = response1?.data?.data;
|
||||
|
||||
// if (!PurchasedDetails || !PurchasedDetails.length) {
|
||||
// console.error('No purchased details found');
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // 2️⃣ Prepare post data
|
||||
// const postData = {
|
||||
// UserId: UserId,
|
||||
// AppId: AppId,
|
||||
// PricingId: PurchasedDetails[0]?.PricingId,
|
||||
// PurDate: currentDate,
|
||||
// NoofDays: 30,
|
||||
// PaymentMode: 27,
|
||||
// PaymentStatus: 'S',
|
||||
// LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
|
||||
// Price: PurchasedDetails[0]?.Price ?? 0,
|
||||
// TaxId: PurchasedDetails[0]?.TaxId ?? 0,
|
||||
// NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
|
||||
// ValidityStart: currentDate,
|
||||
// ValidityEnd: addDays(
|
||||
// currentDate,
|
||||
// PurchasedDetails[0]?.NoOfDays
|
||||
// ),
|
||||
// CreatedBy: UserId,
|
||||
// TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
||||
// MobileNo: getSession('MobileNo'),
|
||||
// MailId: 'ts@gmmail.com',
|
||||
// Type: "FreeExtend"
|
||||
// };
|
||||
|
||||
// // 3️⃣ Post invoice
|
||||
// const response = await dispatch(postInvoice(postData)).unwrap();
|
||||
|
||||
// // 4️⃣ Send SMS if required
|
||||
// if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
||||
// await dispatch(
|
||||
// sendSms({ body: response.data.SMSbody })
|
||||
// );
|
||||
// setExtendModel(false)
|
||||
|
||||
// }
|
||||
|
||||
// } catch (error) {
|
||||
// console.error('freeExtend error:', error);
|
||||
// }
|
||||
// };
|
||||
// const handleCancel = () => {
|
||||
// Logout();
|
||||
// setExtendModel(false)
|
||||
|
||||
// }
|
||||
// const handlePay = () => {
|
||||
// setExtendModel(false)
|
||||
// let AppName = getSession("AppName")
|
||||
// navigate(`${subDirectory}PricingPage`, { state: { AppName: AppName } });
|
||||
// }
|
||||
|
||||
// return(
|
||||
// <>
|
||||
// <div className={`${ss}`}>
|
||||
// <p>
|
||||
// {(AppExpDate?.RemainingDays < 30 &&
|
||||
// AppExpDate?.RemainingHours < 30 &&
|
||||
// AppExpDate?.RemainingMinutes < 50 &&
|
||||
// AppExpDate?.RemainingSeconds < 60
|
||||
// ) ||
|
||||
// AppExpDate === 'undefined' ? (
|
||||
// (AppExpDate?.PlanType?.toLowerCase() == "extend expired")?(
|
||||
|
||||
// <span className="ExpiredMessage">
|
||||
// Subscription expired
|
||||
// <a
|
||||
// onClick={() => {
|
||||
// navigatePublicFun();
|
||||
// }}
|
||||
// className="upgrdbtn"
|
||||
// >
|
||||
// RENEWAL NOW <ArrowUpOutlined />
|
||||
// </a>
|
||||
// </span>
|
||||
// ) : (
|
||||
|
||||
// )
|
||||
// ) : AppExpDate?.RemainingDays < 1 ? (
|
||||
// <p>
|
||||
// Your application subscription will expire within
|
||||
// <span className="Expired">
|
||||
// {AppExpDate?.RemainingHours >= 1
|
||||
// ? AppExpDate?.RemainingHours
|
||||
// : AppExpDate?.RemainingMinutes}
|
||||
// </span>{' '}
|
||||
// {AppExpDate?.RemainingHours >= 1 ? 'Hrs' : 'Min'} .
|
||||
// <a
|
||||
// onClick={() => {
|
||||
// navigateFun();
|
||||
// }}
|
||||
// className="upgrdbtn"
|
||||
// >
|
||||
// RENEWAL NOW <ArrowUpOutlined />
|
||||
// </a>
|
||||
// </p>
|
||||
// ) : (
|
||||
// <p>
|
||||
// Your application subscription will expire within
|
||||
// <span className="NosDays">
|
||||
// {AppExpDate?.RemainingDays}
|
||||
// </span>{' '}
|
||||
// days.
|
||||
// <a
|
||||
// onClick={() => {
|
||||
// navigateFun();
|
||||
// }}
|
||||
// className="upgrdbtn"
|
||||
// >
|
||||
// RENEWAL NOW <ArrowUpOutlined />
|
||||
// </a>
|
||||
// </p>
|
||||
// )}
|
||||
// </p>
|
||||
// </div>
|
||||
// {extendModel && (
|
||||
// <ExtendSubscriptionModal
|
||||
// onClose={handleCancel}
|
||||
// onPayNow={handlePay}
|
||||
// onContinueWithCredits={freeExtend}
|
||||
// />
|
||||
// )}
|
||||
// </>
|
||||
// )
|
||||
// }
|
||||
// export default PlanExpireNotification;
|
||||
import { useSelector } from "react-redux";
|
||||
import { GlobalAppExpDateData } from "../../../Features/BookingScreen/BookingData/BookingData";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSelector } from 'react-redux';
|
||||
import { GlobalAppExpDateData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { ArrowUpOutlined } from '@ant-design/icons';
|
||||
import { StoredSessionData } from "../../../Features/ThemeChange/ThemeChange";
|
||||
import ExtendSubscriptionModal from "../../ExtentedModal/ExtendSubscriptionModal";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { getPurchasedAppDetails, postInvoice } from "../../../Features/BookingScreen/Pricing/Pricing";
|
||||
import { sendSms } from "../../../Features/Payment/PaymentDetails/PaymentDetails";
|
||||
import { useEffect, useState, useMemo } from "react";
|
||||
import { getSession } from "../../../Services/Others";
|
||||
import { StoredSessionData } from '../../../Features/ThemeChange/ThemeChange';
|
||||
import ExtendSubscriptionModal from '../../ExtentedModal/ExtendSubscriptionModal';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import {
|
||||
getPurchasedAppDetails,
|
||||
postInvoice,
|
||||
} from '../../../Features/BookingScreen/Pricing/Pricing';
|
||||
import { sendSms } from '../../../Features/Payment/PaymentDetails/PaymentDetails';
|
||||
import { useEffect, useState, useMemo } from 'react';
|
||||
import { encryptObject, getSession } from '../../../Services/Others';
|
||||
import { GenerateLogout } from '../../../Features/BrachLogin/BranchLogin';
|
||||
import { PublicQrCodepost } from '../../../Features/ConfigMasterPage/ConfigMasterPage';
|
||||
|
||||
const subDirectory = import.meta.env.BASE_URL;
|
||||
const commonDirectory = import.meta.env.COMMON_BASE_URL;
|
||||
|
||||
const PlanExpireNotification = ({ ss }) => {
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const commonDirectory = import.meta.env.ENV_COMMON_BASE_URL;
|
||||
console.log('commonDirectory', commonDirectory);
|
||||
const PlanExpireNotification = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const AppExpDate = useSelector(GlobalAppExpDateData);
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
const [extendModel, setExtendModel] = useState(false);
|
||||
const { AppId, UserId } = SessionData;
|
||||
console.log("AppExpDate", AppExpDate);
|
||||
const {
|
||||
AppId,
|
||||
UserId,
|
||||
AppName,
|
||||
SessionId,
|
||||
AuthToken,
|
||||
CompId,
|
||||
SessionMobileNo,
|
||||
UserName,
|
||||
UserType,
|
||||
} = SessionData;
|
||||
console.log('SessionData', AppExpDate);
|
||||
const [count, setcount] = useState(0);
|
||||
const animations = ['example1', 'example2', 'example3'];
|
||||
let ss = animations[count];
|
||||
|
||||
// ================= NAVIGATION =================
|
||||
const navigateFun = () => {
|
||||
navigate(`${subDirectory}PricingPage`, { state: { AppName: SessionData?.AppName } });
|
||||
};
|
||||
|
||||
const navigatePublicFun = () => {
|
||||
navigate(`${commonDirectory}`);
|
||||
};
|
||||
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]);
|
||||
|
||||
// ================= DATE FORMAT =================
|
||||
const formatDate = (dateStr) => {
|
||||
const date = new Date(dateStr);
|
||||
return `${String(date.getDate()).padStart(2, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${date.getFullYear()}`;
|
||||
return `${String(date.getDate()).padStart(2, '0')}-${String(date.getMonth() + 1).padStart(2, '0')}-${date.getFullYear()}`;
|
||||
};
|
||||
|
||||
// ================= CHECK STATUS FLAGS =================
|
||||
|
|
@ -229,115 +69,117 @@ const PlanExpireNotification = ({ ss }) => {
|
|||
);
|
||||
}, [AppExpDate]);
|
||||
|
||||
const isExtendExpired = useMemo(() => {
|
||||
return AppExpDate?.PlanType?.toLowerCase() === "extend expired";
|
||||
const isExtend = useMemo(() => {
|
||||
return AppExpDate?.PlanType?.toLowerCase() === 'extend';
|
||||
}, [AppExpDate]);
|
||||
|
||||
const isExpiringToday = AppExpDate?.RemainingDays < 1 && !isExpired;
|
||||
const isExpiringSoon = AppExpDate?.RemainingDays >= 1 && AppExpDate?.RemainingDays <= 30;
|
||||
const isExpiringToday =
|
||||
AppExpDate?.RemainingDays < 1 && !isExpired && !isExtend;
|
||||
const isExpiringSoon =
|
||||
AppExpDate?.RemainingDays >= 1 &&
|
||||
AppExpDate?.RemainingDays <= 30 &&
|
||||
!isExtend;
|
||||
|
||||
// ================= AUTO OPEN EXTEND MODAL =================
|
||||
useEffect(() => {
|
||||
if (isExpired && !isExtendExpired) {
|
||||
if (isExpired && !isExtend) {
|
||||
setExtendModel(true);
|
||||
}
|
||||
}, [isExpired, isExtendExpired]);
|
||||
|
||||
// ================= FREE EXTEND =================
|
||||
const freeExtend = async () => {
|
||||
try {
|
||||
|
||||
const now = new Date();y
|
||||
const currentDate = formatDate(now);
|
||||
|
||||
const response1 = await dispatch(getPurchasedAppDetails({ AppId, UserId })).unwrap();
|
||||
const PurchasedDetails = response1?.data?.data;
|
||||
|
||||
if (!PurchasedDetails?.length) return;
|
||||
|
||||
const postData = {
|
||||
UserId,
|
||||
AppId,
|
||||
PricingId: PurchasedDetails[0]?.PricingId,
|
||||
PurDate: currentDate,
|
||||
NoofDays: 30,
|
||||
PaymentMode: 27,
|
||||
PaymentStatus: "S",
|
||||
LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
|
||||
Price: PurchasedDetails[0]?.Price ?? 0,
|
||||
TaxId: PurchasedDetails[0]?.TaxId ?? 0,
|
||||
NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
|
||||
ValidityStart: currentDate,
|
||||
ValidityEnd: addDays(currentDate, PurchasedDetails[0]?.NoOfDays),
|
||||
CreatedBy: UserId,
|
||||
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
||||
MobileNo: getSession("MobileNo"),
|
||||
MailId: "ts@gmail.com",
|
||||
Type: "FreeExtend"
|
||||
};
|
||||
|
||||
const response = await dispatch(postInvoice(postData)).unwrap();
|
||||
|
||||
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
||||
await dispatch(sendSms({ body: response.data.SMSbody }));
|
||||
setExtendModel(false);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("freeExtend error:", error);
|
||||
}
|
||||
};
|
||||
}, [isExpired, isExtend]);
|
||||
|
||||
const handleCancel = () => {
|
||||
Logout();
|
||||
setExtendModel(false);
|
||||
};
|
||||
const Logout = async () => {
|
||||
const UserId = UserId;
|
||||
const Logout = async () => {
|
||||
const status = 'N';
|
||||
try {
|
||||
const res = await dispatch(GenerateLogout({ UserId, status })).unwrap();
|
||||
if (res?.data?.statusCode === 1) {
|
||||
sessionStorage.clear();
|
||||
window.location.replace(`${commonSubDir}`);
|
||||
window.location.replace(`${commonDirectory}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Logout failed:', error);
|
||||
}
|
||||
};
|
||||
const handlePay = () => {
|
||||
setExtendModel(false);
|
||||
navigate(`${subDirectory}PricingPage`, { state: { AppName: getSession("AppName") } });
|
||||
const handlePay = async () => {
|
||||
const response1 = await dispatch(
|
||||
getPurchasedAppDetails({ AppId, UserId })
|
||||
).unwrap();
|
||||
const PurchasedDetails = response1?.data?.data;
|
||||
let data = {
|
||||
MN: SessionMobileNo,
|
||||
UN: UserName,
|
||||
UD: UserId,
|
||||
UT: UserType,
|
||||
CD: CompId,
|
||||
SD: SessionId || '',
|
||||
AU: AuthToken,
|
||||
Plandetails: PurchasedDetails?.[0],
|
||||
};
|
||||
const encrypted = encryptObject(data);
|
||||
const postData = { Url: encrypted, CreatedBy: UserId };
|
||||
try {
|
||||
const res = await dispatch(PublicQrCodepost(postData)).unwrap();
|
||||
// navigate(`${commonDirectory}invoice-details`);
|
||||
if (res?.data?.statusCode == 1) {
|
||||
navigate(`${commonDirectory}invoice-details/${res?.data?.ReferenceNo}`);
|
||||
setExtendModel(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error generating QR code:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// ================= UI BLOCKS =================
|
||||
const ExpiredBlock = () => (
|
||||
<span className="ExpiredMessage">
|
||||
<div
|
||||
className="ExpiredMessage"
|
||||
style={{
|
||||
backgroundColor: '#ff4d4f',
|
||||
color: '#fff',
|
||||
fontSize: '13px',
|
||||
fontWeight: '500',
|
||||
fontFamily: 'Poppins',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
Subscription expired
|
||||
<a onClick={navigatePublicFun} className="upgrdbtn">
|
||||
<a onClick={handlePay} className="upgrdbtn">
|
||||
RENEWAL NOW <ArrowUpOutlined />
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
const ExpiringTodayBlock = () => (
|
||||
<p>
|
||||
Your application subscription will expire within
|
||||
<span className="Expired">
|
||||
{AppExpDate?.RemainingHours >= 1 ? AppExpDate?.RemainingHours : AppExpDate?.RemainingMinutes}
|
||||
</span>{" "}
|
||||
{AppExpDate?.RemainingHours >= 1 ? "Hrs" : "Min"}
|
||||
<a onClick={navigateFun} className="upgrdbtn">
|
||||
{AppExpDate?.RemainingHours >= 1
|
||||
? AppExpDate?.RemainingHours
|
||||
: AppExpDate?.RemainingMinutes}
|
||||
</span>{' '}
|
||||
{AppExpDate?.RemainingHours >= 1 ? 'Hrs' : 'Min'}
|
||||
<a onClick={handlePay} className="upgrdbtn">
|
||||
RENEWAL NOW <ArrowUpOutlined />
|
||||
</a>
|
||||
</p>
|
||||
);
|
||||
|
||||
const ExpiringDaysBlock = () => (
|
||||
<p>
|
||||
<p
|
||||
style={{
|
||||
backgroundColor: '#ff4d4f',
|
||||
color: '#fff',
|
||||
fontSize: '13px',
|
||||
fontWeight: '500',
|
||||
fontFamily: 'Poppins',
|
||||
}}
|
||||
>
|
||||
Your application subscription will expire within
|
||||
<span className="NosDays">{AppExpDate?.RemainingDays}</span> days.
|
||||
<a onClick={navigateFun} className="upgrdbtn">
|
||||
<a onClick={handlePay} className="upgrdbtn">
|
||||
RENEWAL NOW <ArrowUpOutlined />
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -346,8 +188,9 @@ const PlanExpireNotification = ({ ss }) => {
|
|||
// ================= RETURN =================
|
||||
return (
|
||||
<>
|
||||
<div className={ss}>
|
||||
{isExpired && isExtendExpired && <ExpiredBlock />}
|
||||
{/* <div className={ ss : 'dd'}> */}
|
||||
<div className={isExtend ? 'dd' : ss} style={{ width: '100%' }}>
|
||||
{isExtend && <ExpiredBlock />}
|
||||
|
||||
{isExpiringToday && <ExpiringTodayBlock />}
|
||||
|
||||
|
|
@ -357,8 +200,9 @@ const PlanExpireNotification = ({ ss }) => {
|
|||
{extendModel && (
|
||||
<ExtendSubscriptionModal
|
||||
onClose={handleCancel}
|
||||
onPayNow={handlePay}
|
||||
onContinueWithCredits={freeExtend}
|
||||
setExtendModel={setExtendModel}
|
||||
// onPayNow={handlePay}
|
||||
// onContinueWithCredits={freeExtend}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,124 @@
|
|||
import { Tooltip } from "antd";
|
||||
import "./extendSubscribtionModel.scss";
|
||||
import { IoClose } from "react-icons/io5";
|
||||
import { getPurchasedAppDetails, postInvoice } from "../../Features/BookingScreen/Pricing/Pricing";
|
||||
import { GlobalAppExpDateData } from "../../Features/BookingScreen/BookingData/BookingData";
|
||||
import { StoredSessionData } from "../../Features/ThemeChange/ThemeChange";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { sendSms } from "../../Features/Payment/PaymentDetails/PaymentDetails";
|
||||
import { useSelector } from "react-redux";
|
||||
import { encryptObject } from "../../Services/Others";
|
||||
import { PublicQrCodepost } from "../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||
|
||||
const ExtendSubscriptionModal = ({
|
||||
onClose,
|
||||
onPayNow,
|
||||
onContinueWithCredits
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
const {
|
||||
AppId,
|
||||
UserId,
|
||||
AppName,
|
||||
SessionId,
|
||||
AuthToken,
|
||||
CompId,
|
||||
SessionMobileNo,
|
||||
UserName,
|
||||
UserType,
|
||||
} = SessionData;
|
||||
// ================= DATE FORMAT =================
|
||||
const formatDate = (dateStr) => {
|
||||
const date = new Date(dateStr);
|
||||
return `${String(date.getDate()).padStart(2, '0')}-${String(date.getMonth() + 1).padStart(2, '0')}-${date.getFullYear()}`;
|
||||
};
|
||||
// ================= DATE ADDITION =================
|
||||
function addDays(dateString, days) {
|
||||
// Make it ISO-safe for iOS / WebView
|
||||
const isoDate = dateString.replace(' ', 'T');
|
||||
const currentDate = new Date(isoDate);
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + Number(days));
|
||||
|
||||
return formatDate(currentDate);
|
||||
}
|
||||
|
||||
|
||||
// ================= FREE EXTEND =================
|
||||
const freeExtend = async () => {
|
||||
try {
|
||||
const now = new Date();
|
||||
const currentDate = formatDate(now);
|
||||
|
||||
const response1 = await dispatch(
|
||||
getPurchasedAppDetails({ AppId, UserId })
|
||||
).unwrap();
|
||||
const PurchasedDetails = response1?.data?.data;
|
||||
|
||||
if (!PurchasedDetails?.length) return;
|
||||
|
||||
const postData = {
|
||||
UserId,
|
||||
AppId,
|
||||
PricingId: PurchasedDetails[0]?.PricingId,
|
||||
PurDate: currentDate,
|
||||
NoofDays: 30,
|
||||
PaymentMode: 27,
|
||||
PaymentStatus: 'S',
|
||||
LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
|
||||
Price: PurchasedDetails[0]?.Price ?? 0,
|
||||
TaxId: PurchasedDetails[0]?.TaxId ?? 0,
|
||||
NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
|
||||
ValidityStart: currentDate,
|
||||
ValidityEnd: addDays(currentDate, PurchasedDetails[0]?.NoOfDays),
|
||||
CreatedBy: UserId,
|
||||
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
||||
MobileNo: SessionMobileNo,
|
||||
MailId: 'ts@gmail.com',
|
||||
Type: 'FreeExtend',
|
||||
};
|
||||
|
||||
const response = await dispatch(postInvoice(postData)).unwrap();
|
||||
|
||||
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
||||
await dispatch(sendSms({ body: response.data.SMSbody }));
|
||||
setExtendModel(false)
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('freeExtend error:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePay = async () => {
|
||||
const response1 = await dispatch(
|
||||
getPurchasedAppDetails({ AppId, UserId })
|
||||
).unwrap();
|
||||
const PurchasedDetails = response1?.data?.data;
|
||||
let data = {
|
||||
MN: SessionMobileNo,
|
||||
UN: UserName,
|
||||
UD: UserId,
|
||||
UT: UserType,
|
||||
CD: CompId,
|
||||
SD: SessionId || "3308120220260447406469360642222",
|
||||
AU: AuthToken,
|
||||
Plandetails: PurchasedDetails?.[0],
|
||||
};
|
||||
const encrypted = encryptObject(data);
|
||||
const postData = { Url: encrypted, CreatedBy: UserId };
|
||||
try{
|
||||
const res = await dispatch(PublicQrCodepost(postData)).unwrap();
|
||||
// navigate(`${commonDirectory}invoice-details`);
|
||||
if (res?.data?.statusCode == 1) {
|
||||
navigate(`${commonDirectory}invoice-details/${res?.data?.ReferenceNo}`);
|
||||
setExtendModel(false)
|
||||
|
||||
}
|
||||
}catch(error){console.error('Error generating QR code:', error); }
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="extendmodal-backdrop">
|
||||
<div className="extendmodal">
|
||||
|
|
@ -28,14 +140,14 @@ const ExtendSubscriptionModal = ({
|
|||
<div className="extendmodal-actions">
|
||||
<button
|
||||
className="CreditsBTN"
|
||||
onClick={onContinueWithCredits}
|
||||
onClick={freeExtend}
|
||||
>
|
||||
Continue with Credits
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="PayNowBTN"
|
||||
onClick={onPayNow}
|
||||
onClick={handlePay}
|
||||
>
|
||||
Pay Now
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue