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 {
|
tbody {
|
||||||
>tr:last-child {
|
>tr:last-child {
|
||||||
background-color: #e5d434 !important;
|
// background-color: #e5d434 !important;
|
||||||
|
background-color: #ffffff !important;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,7 @@ import {
|
||||||
} from '../../../../../Features/ProductPage/ProductPage.js';
|
} from '../../../../../Features/ProductPage/ProductPage.js';
|
||||||
import { PostBlockSlots } from '../../../../../Features/Kiosk/kiosk.js';
|
import { PostBlockSlots } from '../../../../../Features/Kiosk/kiosk.js';
|
||||||
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
|
import CustomerOrders from '../../BookingFunctionality/CustomerOrders.jsx';
|
||||||
|
import { getEmpAccess } from '../../../../../Features/AppPage/CenterPage.js';
|
||||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||||
const RetailApiurl = import.meta.env.ENV_API_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 { encryptObject, getSession } from '../../../Services/Others';
|
||||||
import { GenerateLogout } from '../../../Features/BrachLogin/BranchLogin';
|
import { GenerateLogout } from '../../../Features/BrachLogin/BranchLogin';
|
||||||
import { PublicQrCodepost } from '../../../Features/ConfigMasterPage/ConfigMasterPage';
|
import { PublicQrCodepost } from '../../../Features/ConfigMasterPage/ConfigMasterPage';
|
||||||
|
//
|
||||||
|
import "../../../Styles/BookingScreen/Template/BSLayout3/BSLayout3.scss";
|
||||||
|
|
||||||
const subDirectory = import.meta.env.ENV_BASE_URL;
|
const subDirectory = import.meta.env.ENV_BASE_URL;
|
||||||
const commonDirectory = import.meta.env.ENV_COMMON_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 { useNavigate } from "react-router-dom";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { sendSms } from "../../Features/Payment/PaymentDetails/PaymentDetails";
|
import { sendSms } from "../../Features/Payment/PaymentDetails/PaymentDetails";
|
||||||
import { useSelector } from "react-redux";
|
import { encryptObject, getSession } from "../../Services/Others";
|
||||||
import { encryptObject } from "../../Services/Others";
|
|
||||||
import { PublicQrCodepost } from "../../Features/ConfigMasterPage/ConfigMasterPage";
|
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 = ({
|
const ExtendSubscriptionModal = ({
|
||||||
onClose,
|
onClose,setExtendModel
|
||||||
}) => {
|
}) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const SessionData = useSelector(StoredSessionData);
|
const AppId =getSession("AppId");
|
||||||
const {
|
const UserId =getSession("UserId");
|
||||||
AppId,
|
const SessionId =getSession("SessionId");
|
||||||
UserId,
|
const AuthToken =sessionStorage.getItem('auth');
|
||||||
AppName,
|
const CompId =getSession("CompId");
|
||||||
SessionId,
|
const SessionMobileNo =getSession("MobileNo");
|
||||||
AuthToken,
|
const UserName =getSession("userName");
|
||||||
CompId,
|
const UserType =getSession("UserType");
|
||||||
SessionMobileNo,
|
|
||||||
UserName,
|
|
||||||
UserType,
|
|
||||||
} = SessionData;
|
|
||||||
// ================= DATE FORMAT =================
|
// ================= DATE FORMAT =================
|
||||||
const formatDate = (dateStr) => {
|
const formatDate = (dateStr) => {
|
||||||
const date = new Date(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()}`;
|
||||||
};
|
};
|
||||||
// ================= DATE ADDITION =================
|
// ================= DATE ADDITION =================
|
||||||
function addDays(dateString, days) {
|
|
||||||
// Make it ISO-safe for iOS / WebView
|
function addDaysDDMMYYYY(dateString, days) {
|
||||||
const isoDate = dateString.replace(' ', 'T');
|
const [day, month, year] = dateString.split('-').map(Number);
|
||||||
const currentDate = new Date(isoDate);
|
|
||||||
|
|
||||||
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 =================
|
// ================= FREE EXTEND =================
|
||||||
const freeExtend = async () => {
|
const freeExtend = async () => {
|
||||||
try {
|
try {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const currentDate = formatDate(now);
|
const currentDate = formatDate(now);
|
||||||
|
console.log('Current Date1:', currentDate,now);
|
||||||
const response1 = await dispatch(
|
const response1 = await dispatch(
|
||||||
getPurchasedAppDetails({ AppId, UserId })
|
getPurchasedAppDetails({ AppId, UserId })
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
@ -65,13 +65,14 @@ const ExtendSubscriptionModal = ({
|
||||||
PurDate: currentDate,
|
PurDate: currentDate,
|
||||||
NoofDays: 30,
|
NoofDays: 30,
|
||||||
PaymentMode: 27,
|
PaymentMode: 27,
|
||||||
|
PaymentType:PurchasedDetails[0]?.PaymentMode,
|
||||||
PaymentStatus: 'S',
|
PaymentStatus: 'S',
|
||||||
LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
|
LicenseStatus: PurchasedDetails[0]?.LicenseStatus,
|
||||||
Price: PurchasedDetails[0]?.Price ?? 0,
|
Price: PurchasedDetails[0]?.Price ?? 0,
|
||||||
TaxId: PurchasedDetails[0]?.TaxId ?? 0,
|
TaxId: PurchasedDetails[0]?.TaxId ?? 0,
|
||||||
NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
|
NetPrice: PurchasedDetails[0]?.ExistingPlanNetPrice ?? 0,
|
||||||
ValidityStart: currentDate,
|
ValidityStart: currentDate,
|
||||||
ValidityEnd: addDays(currentDate, PurchasedDetails[0]?.NoOfDays),
|
ValidityEnd: addDaysDDMMYYYY(currentDate, 30),
|
||||||
CreatedBy: UserId,
|
CreatedBy: UserId,
|
||||||
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
TaxAmount: PurchasedDetails[0]?.TaxAmount ?? 0,
|
||||||
MobileNo: SessionMobileNo,
|
MobileNo: SessionMobileNo,
|
||||||
|
|
@ -84,7 +85,7 @@ const ExtendSubscriptionModal = ({
|
||||||
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
if (response?.data?.statusCode === 1 && response?.data?.SMSbody) {
|
||||||
await dispatch(sendSms({ body: response.data.SMSbody }));
|
await dispatch(sendSms({ body: response.data.SMSbody }));
|
||||||
setExtendModel(false)
|
setExtendModel(false)
|
||||||
|
navigate(`${subDirectory}app-page/home`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('freeExtend error:', error);
|
console.error('freeExtend error:', error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue