Merge pull request 'Fix 145 Issue solving' (#146) from ExtendIntegration into main
Reviewed-on: Pozomind/pozo-retail-app#146
This commit is contained in:
commit
8a28447915
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
tbody {
|
||||
>tr:last-child {
|
||||
background-color: #e5d434 !important;
|
||||
// background-color: #e5d434 !important;
|
||||
background-color: #ffffff !important;
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ import {
|
|||
} from '../../../../../Features/ProductPage/ProductPage.js';
|
||||
import { PostBlockSlots } from '../../../../../Features/Kiosk/kiosk.js';
|
||||
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
|
||||
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||
const RetailApiurl = import.meta.env.ENV_API_URL;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import { useEffect, useState, useMemo } from 'react';
|
|||
import { encryptObject, getSession } from '../../../Services/Others';
|
||||
import { GenerateLogout } from '../../../Features/BrachLogin/BranchLogin';
|
||||
import { PublicQrCodepost } from '../../../Features/ConfigMasterPage/ConfigMasterPage';
|
||||
//
|
||||
import "../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss";
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const commonDirectory = import.meta.env.ENV_COMMON_BASE_URL;
|
||||
|
|
|
|||
|
|
@ -7,50 +7,50 @@ 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 { encryptObject, getSession } from "../../Services/Others";
|
||||
import { PublicQrCodepost } from "../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||
|
||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||
const commonDirectory = import.meta.env.ENV_COMMON_BASE_URL;
|
||||
const ExtendSubscriptionModal = ({
|
||||
onClose,
|
||||
onClose,setExtendModel
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
const {
|
||||
AppId,
|
||||
UserId,
|
||||
AppName,
|
||||
SessionId,
|
||||
AuthToken,
|
||||
CompId,
|
||||
SessionMobileNo,
|
||||
UserName,
|
||||
UserType,
|
||||
} = SessionData;
|
||||
const AppId =getSession("AppId");
|
||||
const UserId =getSession("UserId");
|
||||
const SessionId =getSession("SessionId");
|
||||
const AuthToken =sessionStorage.getItem('auth');
|
||||
const CompId =getSession("CompId");
|
||||
const SessionMobileNo =getSession("MobileNo");
|
||||
const UserName =getSession("userName");
|
||||
const UserType =getSession("UserType");
|
||||
|
||||
// ================= 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);
|
||||
|
||||
function addDaysDDMMYYYY(dateString, days) {
|
||||
const [day, month, year] = dateString.split('-').map(Number);
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + Number(days));
|
||||
const date = new Date(year, month - 1, day);
|
||||
date.setDate(date.getDate() + Number(days));
|
||||
|
||||
return formatDate(currentDate);
|
||||
}
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const y = date.getFullYear();
|
||||
|
||||
return `${d}-${m}-${y}`;
|
||||
}
|
||||
|
||||
// ================= FREE EXTEND =================
|
||||
const freeExtend = async () => {
|
||||
try {
|
||||
const now = new Date();
|
||||
const currentDate = formatDate(now);
|
||||
|
||||
console.log('Current Date1:', currentDate,now);
|
||||
const response1 = await dispatch(
|
||||
getPurchasedAppDetails({ AppId, UserId })
|
||||
).unwrap();
|
||||
|
|
@ -65,13 +65,14 @@ const ExtendSubscriptionModal = ({
|
|||
PurDate: currentDate,
|
||||
NoofDays: 30,
|
||||
PaymentMode: 27,
|
||||
PaymentType:PurchasedDetails[0]?.PaymentMode,
|
||||
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),
|
||||
ValidityEnd: addDaysDDMMYYYY(currentDate, 30),
|
||||
CreatedBy: UserId,
|
||||
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
||||
MobileNo: SessionMobileNo,
|
||||
|
|
@ -84,7 +85,7 @@ const ExtendSubscriptionModal = ({
|
|||
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
||||
await dispatch(sendSms({ body: response.data.SMSbody }));
|
||||
setExtendModel(false)
|
||||
|
||||
navigate(`${subDirectory}app-page/home`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('freeExtend error:', error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue