latest code with fix modal back Press problem
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
arguments=
|
||||||
|
auto.sync=false
|
||||||
|
build.scans.enabled=false
|
||||||
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
||||||
|
connection.project.dir=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
gradle.user.home=
|
||||||
|
java.home=
|
||||||
|
jvm.arguments=
|
||||||
|
offline.mode=false
|
||||||
|
override.workspace.settings=false
|
||||||
|
show.console.view=false
|
||||||
|
show.executions.view=false
|
||||||
@@ -2,13 +2,13 @@ import React, { useEffect } from 'react';
|
|||||||
import { View, Text, StyleSheet, TouchableOpacity, Dimensions, Image } from 'react-native';
|
import { View, Text, StyleSheet, TouchableOpacity, Dimensions, Image } from 'react-native';
|
||||||
import Modal from 'react-native-modal';
|
import Modal from 'react-native-modal';
|
||||||
import Animated, { useSharedValue, useAnimatedStyle, withTiming, withDelay } from 'react-native-reanimated';
|
import Animated, { useSharedValue, useAnimatedStyle, withTiming, withDelay } from 'react-native-reanimated';
|
||||||
import { X, Home, Gavel, FileText, User, LogOut, ChevronRight } from 'lucide-react-native';
|
import { Home, Gavel, FileText, User, LogOut, ChevronRight } from 'lucide-react-native';
|
||||||
import { CommonActions, useNavigation } from '@react-navigation/native';
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { removeToken } from '../../Redux/Slices/Token';
|
import { removeToken } from '../../Redux/Slices/Token';
|
||||||
import NavigationString from '../../Constant/NavigationString';
|
import NavigationString from '../../Constant/NavigationString';
|
||||||
|
|
||||||
const { width } = Dimensions.get('window');
|
const { width, height } = Dimensions.get('window');
|
||||||
const DRAWER_WIDTH = width * 0.78;
|
const DRAWER_WIDTH = width * 0.78;
|
||||||
|
|
||||||
interface Props { visible: boolean; onClose: () => void; }
|
interface Props { visible: boolean; onClose: () => void; }
|
||||||
@@ -22,7 +22,7 @@ const SideDrawer: React.FC<Props> = ({ visible, onClose }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
translateX.value = visible
|
translateX.value = visible
|
||||||
? withTiming(0, { duration: 300 })
|
? withTiming(0, { duration: 0 })
|
||||||
: withTiming(-DRAWER_WIDTH, { duration: 250 });
|
: withTiming(-DRAWER_WIDTH, { duration: 250 });
|
||||||
}, [visible]);
|
}, [visible]);
|
||||||
|
|
||||||
@@ -45,12 +45,12 @@ const SideDrawer: React.FC<Props> = ({ visible, onClose }) => {
|
|||||||
label: 'Tenders',
|
label: 'Tenders',
|
||||||
icon: FileText,
|
icon: FileText,
|
||||||
onPress: () => navigation.navigate(NavigationString.Tender),
|
onPress: () => navigation.navigate(NavigationString.Tender),
|
||||||
},
|
}
|
||||||
{
|
// {
|
||||||
label: 'Profile',
|
// label: 'Profile',
|
||||||
icon: User,
|
// icon: User,
|
||||||
onPress: () => { },
|
// onPress: () => { },
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -63,13 +63,17 @@ const SideDrawer: React.FC<Props> = ({ visible, onClose }) => {
|
|||||||
animationOut="fadeOut"
|
animationOut="fadeOut"
|
||||||
style={styles.modal}
|
style={styles.modal}
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
|
coverScreen={false}
|
||||||
|
propagateSwipe
|
||||||
>
|
>
|
||||||
<Animated.View style={[styles.drawer, drawerStyle]}>
|
<Animated.View style={[styles.drawer, drawerStyle]}>
|
||||||
{/* ================= Header / Profile ================= */}
|
{/* ================= Header / Profile ================= */}
|
||||||
<View style={styles.profileHeader}>
|
<View style={styles.profileHeader}>
|
||||||
<TouchableOpacity style={styles.closeBtn} onPress={onClose}>
|
{/* <TouchableOpacity style={styles.closeBtn} onPress={() => {
|
||||||
|
console.log('sdfadsfdsf');
|
||||||
|
}}>
|
||||||
<X size={20} color="#111827" />
|
<X size={20} color="#111827" />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity> */}
|
||||||
|
|
||||||
<Image source={{ uri: user.avatar }} style={styles.avatar} />
|
<Image source={{ uri: user.avatar }} style={styles.avatar} />
|
||||||
|
|
||||||
@@ -151,7 +155,7 @@ const styles = StyleSheet.create({
|
|||||||
|
|
||||||
drawer: {
|
drawer: {
|
||||||
width: DRAWER_WIDTH,
|
width: DRAWER_WIDTH,
|
||||||
height: '100%',
|
height: height - 80,
|
||||||
backgroundColor: '#FFFFFF',
|
backgroundColor: '#FFFFFF',
|
||||||
borderTopRightRadius: 24,
|
borderTopRightRadius: 24,
|
||||||
borderBottomRightRadius: 24,
|
borderBottomRightRadius: 24,
|
||||||
@@ -171,6 +175,8 @@ const styles = StyleSheet.create({
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 20,
|
top: 20,
|
||||||
right: 16,
|
right: 16,
|
||||||
|
padding: 10,
|
||||||
|
zIndex: 20
|
||||||
},
|
},
|
||||||
|
|
||||||
avatar: {
|
avatar: {
|
||||||
|
|||||||
@@ -16,5 +16,6 @@ const NavigationString = {
|
|||||||
TenderBidding:'TenderBidding',
|
TenderBidding:'TenderBidding',
|
||||||
ProceedToBidDetail:'ProceedToBidDetail',
|
ProceedToBidDetail:'ProceedToBidDetail',
|
||||||
LiveTenderDetail:'LiveTenderDetail',
|
LiveTenderDetail:'LiveTenderDetail',
|
||||||
|
AuctionDetail: 'AuctionDetail',
|
||||||
}
|
}
|
||||||
export default NavigationString
|
export default NavigationString
|
||||||
@@ -19,13 +19,9 @@ const Auction = () => {
|
|||||||
const { data: purchaseAuctionData = {} } = useFetchPurchaseAuction();
|
const { data: purchaseAuctionData = {} } = useFetchPurchaseAuction();
|
||||||
const SelectedPurchaseList = useSelector((state: any) => state.selectPurchaseAuction);
|
const SelectedPurchaseList = useSelector((state: any) => state.selectPurchaseAuction);
|
||||||
|
|
||||||
const liveCount = Array.isArray(liveAuctionData?.result)
|
const liveCount = Array.isArray(liveAuctionData?.result) ? liveAuctionData?.pages[0]?.totalCount : 0;
|
||||||
? liveAuctionData?.pages[0]?.totalCount
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
const purchaseCount = Array.isArray(purchaseAuctionData?.data)
|
const purchaseCount = Array.isArray(purchaseAuctionData?.data) ? purchaseAuctionData.data.length : 0;
|
||||||
? purchaseAuctionData.data.length
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
const [selectedTab, setSelectedTab] = useState<'live' | 'purchase'>('live');
|
const [selectedTab, setSelectedTab] = useState<'live' | 'purchase'>('live');
|
||||||
|
|
||||||
@@ -44,7 +40,7 @@ const Auction = () => {
|
|||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<InsideHeader title="Auction" showArrow />
|
<InsideHeader title="Auction" showArrow />
|
||||||
|
|
||||||
{/* Switch Tabs */}
|
{/* Tabs */}
|
||||||
<View style={{ flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center' }}>
|
<View style={{ flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center' }}>
|
||||||
<View style={styles.switchWrapper}>
|
<View style={styles.switchWrapper}>
|
||||||
<Animated.View
|
<Animated.View
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import React, { memo, useEffect, useState } from 'react';
|
import React, { memo, useEffect, useState } from 'react';
|
||||||
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, SafeAreaView, Platform, StatusBar } from 'react-native';
|
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform, StatusBar, Modal } from 'react-native';
|
||||||
import Modal from 'react-native-modal';
|
|
||||||
import moment from 'moment';
|
|
||||||
import { Briefcase, Calendar, FileText, Download, Eye, Layers, ArrowLeft, Clock } from 'lucide-react-native';
|
import { Briefcase, Calendar, FileText, Download, Eye, Layers, ArrowLeft, Clock } from 'lucide-react-native';
|
||||||
import colors from '../../../Constant/Color';
|
import { useAuctionItem, useGetAuciton, useGetAucitonDocument } from '../../../Services/BBPS/Hooks';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import AuctionItemDetail from './AuctionItemDetail';
|
import { AUCTION_DOCUMENT_DOWNLOAD } from '../../../Services/BBPS/ApiUrls';
|
||||||
import { useAucitonDocDownload, useAuctionItem, useGetAuciton, useGetAucitonDocument } from '../../../Services/BBPS/Hooks';
|
|
||||||
import ReactNativeBlobUtil from 'react-native-blob-util';
|
import ReactNativeBlobUtil from 'react-native-blob-util';
|
||||||
import { AUCTION_DOCUMENT_DOWNLOAD, ITEM_DOCUMENT_DOWNLOAD } from '../../../Services/BBPS/ApiUrls';
|
import AuctionItemDetail from './AuctionItemDetail';
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
import { Loader } from '../../../Component/Index';
|
import { Loader } from '../../../Component/Index';
|
||||||
|
import colors from '../../../Constant/Color';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
interface Props { visible: boolean; onClose: () => void; data?: any }
|
interface Props { visible: boolean; onClose: () => void; data?: any }
|
||||||
|
|
||||||
@@ -20,8 +18,8 @@ const AuctionFullDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
const [aucitonDetail, setAuciotnDetail] = useState<any>(auctionData)
|
const [aucitonDetail, setAuciotnDetail] = useState<any>(auctionData)
|
||||||
const [allBoolean, setAllBoolean] = useState({ showItemDetail: false, selectedItem: {}, fileLoading: false });
|
const [allBoolean, setAllBoolean] = useState({ showItemDetail: false, selectedItem: {}, fileLoading: false });
|
||||||
const { data: auctionDocuments } = useGetAucitonDocument({ auctionId: data?.auctionId })
|
const { data: auctionDocuments } = useGetAucitonDocument({ auctionId: data?.auctionId })
|
||||||
const { mutate: downloadDocument, isPending } = useAucitonDocDownload()
|
|
||||||
const { mutate } = useAuctionItem()
|
const { mutate } = useAuctionItem()
|
||||||
|
|
||||||
const formatDate = (date?: string) => {
|
const formatDate = (date?: string) => {
|
||||||
if (!date) return '-';
|
if (!date) return '-';
|
||||||
return moment(date, 'DD-MM-YYYY HH:mm:ss').format('DD MMM YYYY, hh:mm A');
|
return moment(date, 'DD-MM-YYYY HH:mm:ss').format('DD MMM YYYY, hh:mm A');
|
||||||
@@ -47,23 +45,20 @@ const AuctionFullDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleDownload = async (id: number, fileName: string) => {
|
const handleDownload = async (id: number, fileName: string) => {
|
||||||
try {
|
try {
|
||||||
setAllBoolean((prev: any) => ({ ...prev, fileLoading: true }));
|
setAllBoolean((prev: any) => ({ ...prev, fileLoading: true }));
|
||||||
const { dirs } = ReactNativeBlobUtil.fs;
|
const { dirs } = ReactNativeBlobUtil.fs;
|
||||||
|
|
||||||
// ✅ PUBLIC DOWNLOADS DIRECTORY
|
|
||||||
const path = `${dirs.DownloadDir}/${fileName}.pdf`;
|
const path = `${dirs.DownloadDir}/${fileName}.pdf`;
|
||||||
|
|
||||||
console.log('📂 Saving to:', path);
|
// console.log('Saving to:', path);
|
||||||
|
|
||||||
const downloadUrl = `${AUCTION_DOCUMENT_DOWNLOAD}?documentId=${id}&isAmendment=false`;
|
const downloadUrl = `${AUCTION_DOCUMENT_DOWNLOAD}?documentId=${id}&isAmendment=false`;
|
||||||
console.log('🌐 Download URL:', downloadUrl);
|
// console.log('Download URL:', downloadUrl);
|
||||||
|
|
||||||
const response = await ReactNativeBlobUtil.config({
|
const response = await ReactNativeBlobUtil.config({
|
||||||
fileCache: false, // important for public folder
|
fileCache: false,
|
||||||
addAndroidDownloads: {
|
addAndroidDownloads: {
|
||||||
useDownloadManager: true,
|
useDownloadManager: true,
|
||||||
notification: true,
|
notification: true,
|
||||||
@@ -71,23 +66,17 @@ const AuctionFullDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
mime: 'application/pdf',
|
mime: 'application/pdf',
|
||||||
title: `${fileName}.pdf`,
|
title: `${fileName}.pdf`,
|
||||||
description: 'Downloading document',
|
description: 'Downloading document',
|
||||||
mediaScannable: true, // 👈 makes it visible instantly
|
mediaScannable: true,
|
||||||
},
|
},
|
||||||
}).fetch('GET', downloadUrl, {
|
}).fetch('GET', downloadUrl, {
|
||||||
Accept: 'application/pdf',
|
Accept: 'application/pdf',
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('✅ Download completed');
|
|
||||||
console.log('📦 Status:', response.info().status);
|
|
||||||
console.log('📦 Headers:', response.info().headers);
|
|
||||||
console.log('📍 Saved at:', path);
|
|
||||||
|
|
||||||
const stat = await ReactNativeBlobUtil.fs.stat(path);
|
const stat = await ReactNativeBlobUtil.fs.stat(path);
|
||||||
console.log('📦 File size:', stat.size);
|
console.log('File size:', stat.size);
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log('❌ Download failed');
|
console.log('Error:', error?.message || error);
|
||||||
console.log('❌ Error:', error?.message || error);
|
|
||||||
} finally {
|
} finally {
|
||||||
setAllBoolean((prev: any) => ({ ...prev, fileLoading: false }));
|
setAllBoolean((prev: any) => ({ ...prev, fileLoading: false }));
|
||||||
}
|
}
|
||||||
@@ -106,15 +95,11 @@ const AuctionFullDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isVisible={visible}
|
visible={visible}
|
||||||
style={styles.fullModal}
|
transparent={false}
|
||||||
animationIn="fadeIn"
|
animationType="none"
|
||||||
animationOut="fadeOut"
|
|
||||||
animationInTiming={360}
|
|
||||||
animationOutTiming={280}
|
|
||||||
statusBarTranslucent
|
statusBarTranslucent
|
||||||
backdropColor="transparent"
|
onRequestClose={onClose}
|
||||||
backdropOpacity={0}
|
|
||||||
>
|
>
|
||||||
<View style={styles.safeArea}>
|
<View style={styles.safeArea}>
|
||||||
<StatusBar barStyle="dark-content" />
|
<StatusBar barStyle="dark-content" />
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { memo, useState } from 'react';
|
import React, { memo, useState } from 'react';
|
||||||
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform } from 'react-native';
|
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform, Modal } from 'react-native';
|
||||||
import Modal from 'react-native-modal';
|
|
||||||
import { Package, IndianRupee, FileText, Download, ArrowLeft, Info, } from 'lucide-react-native';
|
import { Package, IndianRupee, FileText, Download, ArrowLeft, Info, } from 'lucide-react-native';
|
||||||
import colors from '../../../Constant/Color';
|
import colors from '../../../Constant/Color';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
@@ -40,16 +39,15 @@ const AuctionItemDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
setAllBoolean((prev: any) => ({ ...prev, fileLoading: true }));
|
setAllBoolean((prev: any) => ({ ...prev, fileLoading: true }));
|
||||||
const { dirs } = ReactNativeBlobUtil.fs;
|
const { dirs } = ReactNativeBlobUtil.fs;
|
||||||
|
|
||||||
// ✅ PUBLIC DOWNLOADS DIRECTORY
|
|
||||||
const path = `${dirs.DownloadDir}/${fileName}.pdf`;
|
const path = `${dirs.DownloadDir}/${fileName}.pdf`;
|
||||||
|
|
||||||
console.log('📂 Saving to:', path);
|
// console.log('Saving to:', path);
|
||||||
|
|
||||||
const downloadUrl = `${AUCTION_ITEM_DOCUMENT_DOWNLOAD}?auctionItemId=${id}`;
|
const downloadUrl = `${AUCTION_ITEM_DOCUMENT_DOWNLOAD}?auctionItemId=${id}`;
|
||||||
console.log('🌐 Download URL:', downloadUrl);
|
// console.log('Download URL:', downloadUrl);
|
||||||
|
|
||||||
const response = await ReactNativeBlobUtil.config({
|
const response = await ReactNativeBlobUtil.config({
|
||||||
fileCache: false, // important for public folder
|
fileCache: false,
|
||||||
addAndroidDownloads: {
|
addAndroidDownloads: {
|
||||||
useDownloadManager: true,
|
useDownloadManager: true,
|
||||||
notification: true,
|
notification: true,
|
||||||
@@ -57,41 +55,30 @@ const AuctionItemDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
|||||||
mime: 'application/pdf',
|
mime: 'application/pdf',
|
||||||
title: `${fileName}.pdf`,
|
title: `${fileName}.pdf`,
|
||||||
description: 'Downloading document',
|
description: 'Downloading document',
|
||||||
mediaScannable: true, // 👈 makes it visible instantly
|
mediaScannable: true,
|
||||||
},
|
},
|
||||||
}).fetch('GET', downloadUrl, {
|
}).fetch('GET', downloadUrl, {
|
||||||
Accept: 'application/pdf',
|
Accept: 'application/pdf',
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('✅ Download completed');
|
|
||||||
console.log('📦 Status:', response.info().status);
|
|
||||||
console.log('📦 Headers:', response.info().headers);
|
|
||||||
console.log('📍 Saved at:', path);
|
|
||||||
|
|
||||||
const stat = await ReactNativeBlobUtil.fs.stat(path);
|
const stat = await ReactNativeBlobUtil.fs.stat(path);
|
||||||
console.log('📦 File size:', stat.size);
|
console.log(' File size:', stat.size);
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log('❌ Download failed');
|
console.log('Error:', error?.message || error);
|
||||||
console.log('❌ Error:', error?.message || error);
|
|
||||||
} finally {
|
} finally {
|
||||||
setAllBoolean((prev: any) => ({ ...prev, fileLoading: false }));
|
setAllBoolean((prev: any) => ({ ...prev, fileLoading: false }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(data, 'kkkkk---');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
isVisible={visible}
|
visible={visible}
|
||||||
style={styles.fullModal}
|
transparent={false}
|
||||||
animationIn="fadeIn"
|
animationType="none"
|
||||||
animationOut="fadeOut"
|
|
||||||
animationInTiming={360}
|
|
||||||
animationOutTiming={280}
|
|
||||||
statusBarTranslucent
|
statusBarTranslucent
|
||||||
backdropColor="transparent"
|
onRequestClose={onClose}
|
||||||
backdropOpacity={0}
|
|
||||||
useNativeDriver
|
|
||||||
>
|
>
|
||||||
<View style={styles.safeArea}>
|
<View style={styles.safeArea}>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { useEffect, useState, useCallback, memo } from 'react';
|
import React, { useEffect, useState, useCallback, memo, useRef } from 'react';
|
||||||
import { View, Text, StyleSheet, FlatList, RefreshControl } from 'react-native';
|
import { View, Text, StyleSheet, FlatList, RefreshControl, ActivityIndicator } from 'react-native';
|
||||||
import LiveAuctionTile from './LiveAuctionTile';
|
import LiveAuctionTile from './LiveAuctionTile';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { useFetchPurchaseAuction } from '../../Services/BBPS/Hooks';
|
import { useFetchLiveAuctionPage, useFetchPurchaseAuction } from '../../Services/BBPS/Hooks';
|
||||||
import PurchaseAuctionTile from './PurchaseAuctionTile';
|
import PurchaseAuctionTile from './PurchaseAuctionTile';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { setAuction } from '../../Redux/Slices/SelectedAuction';
|
import { setAuction } from '../../Redux/Slices/SelectedAuction';
|
||||||
@@ -12,12 +12,14 @@ import { Skelton } from '../../Component/Index';
|
|||||||
import { allBooleanProps } from './types/types';
|
import { allBooleanProps } from './types/types';
|
||||||
import FilterModal from './Modal/FilterModal';
|
import FilterModal from './Modal/FilterModal';
|
||||||
import NavigationString from '../../Constant/NavigationString';
|
import NavigationString from '../../Constant/NavigationString';
|
||||||
|
import colors from '../../Constant/Color';
|
||||||
|
|
||||||
|
|
||||||
const PurchaseAuction = () => {
|
const PurchaseAuction = () => {
|
||||||
const navigation = useNavigation() as any;
|
const navigation = useNavigation() as any;
|
||||||
const Dispatch = useDispatch()
|
const Dispatch = useDispatch()
|
||||||
const { data = {}, isPending } = useFetchPurchaseAuction();
|
const onEndReachedCalledDuringMomentum = useRef(true);
|
||||||
|
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch, isPending }: any = useFetchLiveAuctionPage();
|
||||||
const [allBoolean, setAllBoolean] = useState<allBooleanProps>({ isShowFilter: false })
|
const [allBoolean, setAllBoolean] = useState<allBooleanProps>({ isShowFilter: false })
|
||||||
const format = 'DD-MM-YYYY HH:mm:ss';
|
const format = 'DD-MM-YYYY HH:mm:ss';
|
||||||
|
|
||||||
@@ -40,28 +42,90 @@ const PurchaseAuction = () => {
|
|||||||
return now.isAfter(end);
|
return now.isAfter(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadMore = useCallback(() => {
|
||||||
|
if (onEndReachedCalledDuringMomentum.current) return;
|
||||||
|
|
||||||
|
if (!hasNextPage || isFetchingNextPage) return;
|
||||||
|
|
||||||
|
fetchNextPage();
|
||||||
|
onEndReachedCalledDuringMomentum.current = true;
|
||||||
|
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
||||||
|
|
||||||
|
const renderFooter = useCallback(() => {
|
||||||
|
if (!isFetchingNextPage) return null;
|
||||||
|
return (
|
||||||
|
<View style={{ paddingVertical: 12 }}>
|
||||||
|
<ActivityIndicator size="small" color={colors.primary} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}, [isFetchingNextPage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<SearchInput onChange={() => { }} placeholder='Search....' filterPress={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: !prev.isShowFilter })) }} />
|
<SearchInput onChange={() => { }} placeholder='Search....' filterPress={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: !prev.isShowFilter })) }} />
|
||||||
{isPending ? <Skelton /> : <FlatList
|
{isPending ? <Skelton />
|
||||||
data={data?.data.slice(0, 10) || []}
|
:
|
||||||
keyExtractor={(_, index) => index.toString()}
|
// <FlatList
|
||||||
showsVerticalScrollIndicator={false}
|
// data={data.data ||[]}
|
||||||
contentContainerStyle={{ paddingBottom: 200, paddingHorizontal: 10 }}
|
// keyExtractor={(_, index) => index.toString()}
|
||||||
renderItem={({ item, index }) => (
|
// showsVerticalScrollIndicator={false}
|
||||||
<PurchaseAuctionTile
|
// contentContainerStyle={{ paddingBottom: 200, paddingHorizontal: 10 }}
|
||||||
item={item}
|
// renderItem={({ item, index }) => (
|
||||||
onPressDetails={() => {
|
// <PurchaseAuctionTile
|
||||||
}}
|
// item={item}
|
||||||
onStartBidding={() => {
|
// onPressDetails={() => {
|
||||||
Dispatch(setAuction(item))
|
// }}
|
||||||
navigation.navigate(NavigationString.Emd)
|
// onStartBidding={() => {
|
||||||
}}
|
// Dispatch(setAuction(item))
|
||||||
buttonEnable={isAuctionActive(item)}
|
// navigation.navigate(NavigationString.Emd)
|
||||||
isAuctionEnd={isAuctionEnd(item)}
|
// }}
|
||||||
/>
|
// buttonEnable={isAuctionActive(item)}
|
||||||
)}
|
// isAuctionEnd={isAuctionEnd(item)}
|
||||||
/>}
|
// />
|
||||||
|
// )}
|
||||||
|
// />
|
||||||
|
<FlatList
|
||||||
|
data={data.result ?? []}
|
||||||
|
renderItem={({ item, index }) => (
|
||||||
|
<PurchaseAuctionTile
|
||||||
|
item={item}
|
||||||
|
onPressDetails={() => {
|
||||||
|
}}
|
||||||
|
onStartBidding={() => {
|
||||||
|
Dispatch(setAuction(item))
|
||||||
|
navigation.navigate(NavigationString.Emd)
|
||||||
|
}}
|
||||||
|
buttonEnable={isAuctionActive(item)}
|
||||||
|
isAuctionEnd={isAuctionEnd(item)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
showsVerticalScrollIndicator={false}
|
||||||
|
contentContainerStyle={{ paddingBottom: 50, paddingTop: 10 }}
|
||||||
|
|
||||||
|
onEndReached={loadMore}
|
||||||
|
onEndReachedThreshold={0.1}
|
||||||
|
|
||||||
|
onMomentumScrollBegin={() => {
|
||||||
|
onEndReachedCalledDuringMomentum.current = false;
|
||||||
|
}}
|
||||||
|
|
||||||
|
ListFooterComponent={renderFooter}
|
||||||
|
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={isRefetching}
|
||||||
|
onRefresh={refetch}
|
||||||
|
tintColor="transparent"
|
||||||
|
colors={[colors.primary]}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
|
initialNumToRender={6}
|
||||||
|
maxToRenderPerBatch={6}
|
||||||
|
windowSize={7}
|
||||||
|
removeClippedSubviews
|
||||||
|
/>
|
||||||
|
}
|
||||||
{allBoolean.isShowFilter && <View style={{ flex: 1 }}>
|
{allBoolean.isShowFilter && <View style={{ flex: 1 }}>
|
||||||
<FilterModal visible={allBoolean.isShowFilter} onClose={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: false })) }} onApply={() => { }} />
|
<FilterModal visible={allBoolean.isShowFilter} onClose={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: false })) }} onApply={() => { }} />
|
||||||
</View>}
|
</View>}
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
export const spreadHtml = `
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
|
|
||||||
<link
|
|
||||||
href="https://cdn.grapecity.com/spreadjs/15.2.2/css/gc.spread.sheets.excel2013white.css"
|
|
||||||
rel="stylesheet"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<script src="https://cdn.grapecity.com/spreadjs/15.2.2/gc.spread.sheets.all.min.js"></script>
|
|
||||||
<script src="https://cdn.grapecity.com/spreadjs/15.2.2/plugins/gc.spread.sheets.charts.min.js"></script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
#spread {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="spread"></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
let spread;
|
|
||||||
|
|
||||||
document.addEventListener('message', function (e) {
|
|
||||||
const base64 = e.data;
|
|
||||||
|
|
||||||
spread = new GC.Spread.Sheets.Workbook(
|
|
||||||
document.getElementById('spread'),
|
|
||||||
{ sheetCount: 1 }
|
|
||||||
);
|
|
||||||
|
|
||||||
GC.Spread.Excel.IO.open(base64, spread, function () {
|
|
||||||
console.log('Excel loaded');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function exportExcel() {
|
|
||||||
const excelIO = new GC.Spread.Excel.IO();
|
|
||||||
excelIO.save(spread, function (blob) {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = function () {
|
|
||||||
const base64 = reader.result.split(',')[1];
|
|
||||||
window.ReactNativeWebView.postMessage(base64);
|
|
||||||
};
|
|
||||||
reader.readAsDataURL(blob);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
`;
|
|
||||||
@@ -28,6 +28,7 @@ const GET_MASTER_DATA = `${BASE_URL}contractor/masterdata/all`
|
|||||||
const LOG_IN_URL = `${BASE_URL_Auction}auction/loginWithoutDecryption`
|
const LOG_IN_URL = `${BASE_URL_Auction}auction/loginWithoutDecryption`
|
||||||
const LIVE_TENDER = `${BASE_URL}liveTender/getAllLiveTenders`
|
const LIVE_TENDER = `${BASE_URL}liveTender/getAllLiveTenders`
|
||||||
const LIVE_AUCTION = `${BASE_URL_Auction}api/auction/getLiveAuctionForMobile`
|
const LIVE_AUCTION = `${BASE_URL_Auction}api/auction/getLiveAuctionForMobile`
|
||||||
|
const PURCHASE_AUCTION_PAGE = `${BASE_URL_Auction}api/auction/getMyAuctionForMobile`
|
||||||
const PROCEED_PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/proceedToPurchase`
|
const PROCEED_PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/proceedToPurchase`
|
||||||
const PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuction`
|
const PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuction`
|
||||||
const PURCHASE_OFFLINE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuctionOffline`
|
const PURCHASE_OFFLINE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuctionOffline`
|
||||||
@@ -83,6 +84,7 @@ const SUBMIT_ENVELOPE_FILE_B = `${BASE_URL}tenderBidding/addDocumentsEnvelopeB?r
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
// Rohit
|
// Rohit
|
||||||
|
PURCHASE_AUCTION_PAGE,
|
||||||
VIEW_AUCTION_ITEM_DETAIL,
|
VIEW_AUCTION_ITEM_DETAIL,
|
||||||
AUCTION_ITEM_DOCUMENT_DOWNLOAD,
|
AUCTION_ITEM_DOCUMENT_DOWNLOAD,
|
||||||
AUCTION_DOCUMENT_DOWNLOAD,
|
AUCTION_DOCUMENT_DOWNLOAD,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments } from './apis';
|
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage } from './apis';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
|
|
||||||
@@ -63,6 +63,36 @@ export const useFetchPurchaseAuction = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useFetchLiveAuctionPage = () => {
|
||||||
|
return useInfiniteQuery<any>({
|
||||||
|
queryKey: ['fetchPurchaseAuctionPage'],
|
||||||
|
queryFn: ({ pageParam = 0 }) =>
|
||||||
|
fetchPurchaseAuctionPage({
|
||||||
|
page: pageParam,
|
||||||
|
size: 10,
|
||||||
|
}),
|
||||||
|
initialPageParam: 0,
|
||||||
|
|
||||||
|
getNextPageParam: (lastPage, allPages) => {
|
||||||
|
const { size, totalCount } = lastPage;
|
||||||
|
const totalPages = Math.ceil(totalCount / size);
|
||||||
|
const nextPage = allPages.length;
|
||||||
|
return nextPage < totalPages ? nextPage : undefined;
|
||||||
|
},
|
||||||
|
|
||||||
|
select: (data) => {
|
||||||
|
const mergedResults = data.pages.flatMap(
|
||||||
|
(page: any) => page?.data ?? []
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
result: mergedResults,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const useFetchLiveAuction = () => {
|
export const useFetchLiveAuction = () => {
|
||||||
return useInfiniteQuery<any>({
|
return useInfiniteQuery<any>({
|
||||||
queryKey: ['fetchLiveAuction'],
|
queryKey: ['fetchLiveAuction'],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL } from "./ApiUrls";
|
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL, PURCHASE_AUCTION_PAGE } from "./ApiUrls";
|
||||||
import { apiCall } from "../../Axios/Axios";
|
import { apiCall } from "../../Axios/Axios";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@@ -23,6 +23,11 @@ export const fetchPurchaseAuction = async (): Promise<any> => {
|
|||||||
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`);
|
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`);
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
export const fetchPurchaseAuctionPage = async (payload: any): Promise<any> => {
|
||||||
|
const data = await apiCall<any>('get', `${PURCHASE_AUCTION_PAGE}`, {}, payload);
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
export const fetchLiveAuction = async (payload: any): Promise<any> => {
|
export const fetchLiveAuction = async (payload: any): Promise<any> => {
|
||||||
const data = await apiCall<any>('get', `${LIVE_AUCTION}`, {}, payload);
|
const data = await apiCall<any>('get', `${LIVE_AUCTION}`, {}, payload);
|
||||||
return data
|
return data
|
||||||
|
|||||||
Reference in New Issue
Block a user