// 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( // <> //
// {(AppExpDate?.RemainingDays < 30 &&
// AppExpDate?.RemainingHours < 30 &&
// AppExpDate?.RemainingMinutes < 50 &&
// AppExpDate?.RemainingSeconds < 60
// ) ||
// AppExpDate === 'undefined' ? (
// (AppExpDate?.PlanType?.toLowerCase() == "extend expired")?(
//
// Subscription expired
// {
// navigatePublicFun();
// }}
// className="upgrdbtn"
// >
// RENEWAL NOW
// Your application subscription will expire within
//
// {AppExpDate?.RemainingHours >= 1
// ? AppExpDate?.RemainingHours
// : AppExpDate?.RemainingMinutes}
// {' '}
// {AppExpDate?.RemainingHours >= 1 ? 'Hrs' : 'Min'} .
// {
// navigateFun();
// }}
// className="upgrdbtn"
// >
// RENEWAL NOW
// Your application subscription will expire within
//
// {AppExpDate?.RemainingDays}
// {' '}
// days.
// {
// navigateFun();
// }}
// className="upgrdbtn"
// >
// RENEWAL NOW
Your application subscription will expire within
{AppExpDate?.RemainingHours >= 1 ? AppExpDate?.RemainingHours : AppExpDate?.RemainingMinutes}
{" "}
{AppExpDate?.RemainingHours >= 1 ? "Hrs" : "Min"}
RENEWAL NOW
Your application subscription will expire within
{AppExpDate?.RemainingDays} days.
RENEWAL NOW