diff --git a/src/Axios/Axios.ts b/src/Axios/Axios.ts index 25381f2..9956946 100644 --- a/src/Axios/Axios.ts +++ b/src/Axios/Axios.ts @@ -26,7 +26,7 @@ export const apiCall = async ( return response.data; } catch (error: any) { const errorMessage = error?.response?.data?.error; - // console.log(error?.response?.data.error, '---------------------------api error message'); + if (error?.response?.statusCode === 401) { store.dispatch(setToken({})); diff --git a/src/Screens/Auction/LiveAuction.tsx b/src/Screens/Auction/LiveAuction.tsx index a1831d9..28c900b 100644 --- a/src/Screens/Auction/LiveAuction.tsx +++ b/src/Screens/Auction/LiveAuction.tsx @@ -27,6 +27,7 @@ const LiveAuction = () => { try { setAllBoolean(prev => ({ ...prev, isLoading: true })) const res = await apiCall('get', `${GET_MY_AUCTION}`,); + if (res?.statusCode === 200) { const purchasedIds = new Set(res.data.map((item: any) => item.auctionId)); const filteredLive = data?.result.map((item: any) => ({ ...item, active: !purchasedIds.has(item.auctionId) })); diff --git a/src/Screens/Auction/Modal/AuctionDetail.tsx b/src/Screens/Auction/Modal/AuctionDetail.tsx index ef53a15..2b10fbe 100644 --- a/src/Screens/Auction/Modal/AuctionDetail.tsx +++ b/src/Screens/Auction/Modal/AuctionDetail.tsx @@ -13,6 +13,7 @@ import moment from 'moment'; interface Props { visible: boolean; onClose: () => void; data?: any } const AuctionFullDetail: React.FC = ({ visible, onClose, data }) => { + const inset = useSafeAreaInsets() const { data: auctionData, isLoading } = useGetAuciton({ auctionId: data?.auctionId }) const [aucitonDetail, setAuciotnDetail] = useState(auctionData) @@ -52,10 +53,10 @@ const AuctionFullDetail: React.FC = ({ visible, onClose, data }) => { const path = `${dirs.DownloadDir}/${fileName}.pdf`; - // console.log('Saving to:', path); + const downloadUrl = `${AUCTION_DOCUMENT_DOWNLOAD}?documentId=${id}&isAmendment=false`; - // console.log('Download URL:', downloadUrl); + const response = await ReactNativeBlobUtil.config({ fileCache: false, @@ -163,7 +164,7 @@ const AuctionFullDetail: React.FC = ({ visible, onClose, data }) => { Purchase Deadline (End) - {formatDate(data?.purchaseEnd)} + {formatDate(data?.keyDates?.auctionPurchase?.startDateTime)} diff --git a/src/Screens/Auction/Modal/AuctionItemDetail.tsx b/src/Screens/Auction/Modal/AuctionItemDetail.tsx index f26063d..2ab20a3 100644 --- a/src/Screens/Auction/Modal/AuctionItemDetail.tsx +++ b/src/Screens/Auction/Modal/AuctionItemDetail.tsx @@ -41,10 +41,10 @@ const AuctionItemDetail: React.FC = ({ visible, onClose, data }) => { const path = `${dirs.DownloadDir}/${fileName}.pdf`; - // console.log('Saving to:', path); + const downloadUrl = `${AUCTION_ITEM_DOCUMENT_DOWNLOAD}?auctionItemId=${id}`; - // console.log('Download URL:', downloadUrl); + const response = await ReactNativeBlobUtil.config({ fileCache: false, diff --git a/src/Screens/Auction/PurchaseAuctionList.tsx b/src/Screens/Auction/PurchaseAuctionList.tsx index bc4f927..8b678e6 100644 --- a/src/Screens/Auction/PurchaseAuctionList.tsx +++ b/src/Screens/Auction/PurchaseAuctionList.tsx @@ -142,7 +142,9 @@ const PurchaseAuctionList = () => { ); purchaseListMutation({ auctionNumbers, contractorId: LoginUser.contractorId }, { onSuccess: (res) => { + console.log("purchaseListMutation",res) if (res.statusCode == 200) { + setList(res.data) } }, diff --git a/src/Screens/Auction/PurchaseList.tsx b/src/Screens/Auction/PurchaseList.tsx index a33700f..32b6498 100644 --- a/src/Screens/Auction/PurchaseList.tsx +++ b/src/Screens/Auction/PurchaseList.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { View, Text, StyleSheet, ScrollView, TouchableOpacity } from 'react-native'; import Animated, { FadeIn, FadeOut, Layout, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'; import { ChevronDown, Trash2, Info } from 'lucide-react-native'; @@ -17,6 +17,13 @@ const PurchaseList = () => { const toggleExpand = (index: number) => { setExpandedIndex(prev => (prev === index ? null : index)); }; +useEffect(() => { + if (!SelectedPurchaseList || SelectedPurchaseList.length < 1) { + Navigation.goBack(); + } +}, [SelectedPurchaseList]); + + return ( diff --git a/src/Screens/Home/Home.tsx b/src/Screens/Home/Home.tsx index 91e08c7..736e335 100644 --- a/src/Screens/Home/Home.tsx +++ b/src/Screens/Home/Home.tsx @@ -4,7 +4,7 @@ import Animated, { useSharedValue, useAnimatedStyle, withDelay, withTiming } fro import { Layers, Clock, ShoppingCart, X, FileText } from 'lucide-react-native'; import { Header } from '../../Component/Index'; import colors from '../../Constant/Color'; -import { useDashboard, useESetuAdharVarification } from '../../Services/BBPS/Hooks'; +import { useDashboard, useESetuAdharVarification, useTenderDashboard } from '../../Services/BBPS/Hooks'; import { useSelector } from 'react-redux'; import ConfirmDialog from '../../Constant/Dialog/ConfirmDialog'; import { generateTransactionId } from '../../Helper/uniqueId'; @@ -62,13 +62,16 @@ const StatCard = ({ item, index, isLoading }: any) => { const Home = () => { const { data, isLoading } = useDashboard(); + const { data: tenderData, isLoading: tenderLoading } = useTenderDashboard(); + const Navigation: any = useNavigation(); const user = useSelector((state: any) => state.token?.token); const { mutateAsync: eSetuAdharVarification, isPending } = useESetuAdharVarification(); const dashboard = data?.data || {}; const [showDialog, setShowDialog] = useState(false); const [isNavigating, setIsNavigating] = useState(false); - useFocusEffect(()=>{ + const [DASHBOARD_CARDS,setDASHBOARD_CARDS]=useState([]) + useFocusEffect(() => { setIsNavigating(false) }) useEffect(() => { @@ -80,7 +83,7 @@ const Home = () => { const handleProceedVerification = async () => { try { setIsNavigating(true); - + const payload = { contId: user.id, transactionId: generateTransactionId(), @@ -91,84 +94,95 @@ const Home = () => { }; console.log("Payload:", payload); - + const res = await eSetuAdharVarification(payload); console.log("Verification response:", res); - + setShowDialog(false); - + Navigation.navigate(NavigationString.KycWebViewScreen, { res }); - + } catch (err) { console.log("Verification error:", err); Alert.alert('Error', 'Failed to initiate verification. Please try again.'); setIsNavigating(false); } }; + - const DASHBOARD_CARDS = [ + + + +useEffect(()=>{ +if (user?.userType === "auction") { + setDASHBOARD_CARDS([ { title: 'Total Auctions', - value: dashboard.myAuctionCount ?? 0, + value: dashboard?.myAuctionCount ?? 0, desc: 'Auctions purchased by you', icon: Layers, color: '#2563EB', }, { title: 'Live Auctions', - value: dashboard.liveAuctionCount ?? 0, + value: dashboard?.liveAuctionCount ?? 0, desc: 'Currently live', icon: Clock, color: '#0284C7', }, { title: 'Participated Auctions', - value: dashboard.currentBiddingCount ?? 0, + value: dashboard?.currentBiddingCount ?? 0, desc: 'Participated in auction', icon: ShoppingCart, color: '#7C3AED', }, { title: 'Cancelled Auctions', - value: dashboard.cancelledAuctionCount ?? 0, + value: dashboard?.cancelledAuctionCount ?? 0, desc: 'Cancelled by department', icon: X, color: '#DC2626', }, + ]); +} else { + setDASHBOARD_CARDS([ { title: 'Total Tenders', - value: 0, + value: tenderData?.data?.[0]?.totalTender ?? 0, desc: 'Tenders assigned', icon: FileText, color: '#16A34A', }, { title: 'Live Tenders', - value: 0, + value: tenderData?.data?.[0]?.liveTender ?? 0, desc: 'Currently live', icon: Clock, color: '#059669', }, { title: 'Participated Tenders', - value: 0, + value: tenderData?.data?.[0]?.totalParticipate ?? 0, desc: 'Participated in tender', icon: ShoppingCart, color: '#0EA5E9', }, { title: 'Cancelled Tenders', - value: 0, + value: tenderData?.data?.[0]?.cancelledTender ?? 0, desc: 'Cancelled by authority', icon: X, color: '#EF4444', }, - ]; + ]); +} +},[tenderData,dashboard]) return (
- + { numColumns={2} columnWrapperStyle={styles.row} contentContainerStyle={styles.list} - renderItem={({ item, index }) => ( - - )} + renderItem={({ item, index }) => { + return ( + + ) + }} showsVerticalScrollIndicator={false} /> diff --git a/src/Screens/Login/ForgotPassword.tsx b/src/Screens/Login/ForgotPassword.tsx index 88bc600..8c2adaa 100644 --- a/src/Screens/Login/ForgotPassword.tsx +++ b/src/Screens/Login/ForgotPassword.tsx @@ -15,6 +15,8 @@ import { } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import colors from '../../Constant/Color'; +import { showToast } from '../../Constant/ShowDailog'; +import NavigationString from '../../Constant/NavigationString'; interface ForgotModalProps { visible: boolean; @@ -28,7 +30,7 @@ const ForgotModal: React.FC = ({ visible, onClose }) => { - const navigation = useNavigation() as Navigation; + const Navigation = useNavigation(); const [email, setEmail] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); @@ -67,20 +69,10 @@ const ForgotModal: React.FC = ({ ); if (response.ok) { - Alert.alert( - 'Success', - 'OTP has been sent to your email address. Please check your inbox.', - [ - { - text: 'OK', - onPress: () => { - onClose(); - navigation.navigate('ResetPassword', { email }); - } - } - ] - ); - setEmail(''); + showToast('OTP has been sent to your email address. Please check your inbox.') + onClose(); + Navigation.navigate(NavigationString.ResetPassword, { email }); + } else { const errorData = await response.text(); console.error('API Error:', errorData); diff --git a/src/Screens/Login/Login.tsx b/src/Screens/Login/Login.tsx index 7334792..0e0a510 100644 --- a/src/Screens/Login/Login.tsx +++ b/src/Screens/Login/Login.tsx @@ -123,11 +123,13 @@ const Login = () => { Dispatch(setToken({ ...res.data, token: res.token, userType: activeType })); handleGetData(); } else { + setLoginLoading(false); showErrorAlert(res.message) } }, onError: err => { + setLoginLoading(false); showErrorAlert(err.message); }, }, diff --git a/src/Screens/Login/ResetPassword.tsx b/src/Screens/Login/ResetPassword.tsx index c9b30af..e51aea0 100644 --- a/src/Screens/Login/ResetPassword.tsx +++ b/src/Screens/Login/ResetPassword.tsx @@ -16,8 +16,10 @@ import { TextInputKeyPressEventData, ToastAndroid, } from 'react-native'; +import { Eye, EyeOff } from 'lucide-react-native'; import { BASE_URL } from '../../Services/BBPS/ApiUrls'; import colors from '../../Constant/Color'; + interface ResetPasswordProps { route?: any; navigation?: any; @@ -45,12 +47,10 @@ const ResetPassword: React.FC = ({ route, navigation }) => { const confirmPasswordRef = useRef(null); const resendTimerRef = useRef(null); - // Initialize resend cooldown from storage or set to 0 useEffect(() => { checkResendCooldown(); }, []); - // Clean up timer on unmount useEffect(() => { return () => { if (resendTimerRef.current) { @@ -59,7 +59,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { }; }, []); - // Update timer every second useEffect(() => { if (resendCooldown > 0) { resendTimerRef.current = setInterval(() => { @@ -98,13 +97,12 @@ const ResetPassword: React.FC = ({ route, navigation }) => { }; const startResendCooldown = async () => { - const cooldownTime = 300; // 5 minutes in seconds + const cooldownTime = 300; setResendCooldown(cooldownTime); await AsyncStorage.setItem('otpResendTime', Date.now().toString()); }; useEffect(() => { - // Auto-submit OTP when all fields are filled const fullOtp = otp.join(''); if (fullOtp.length === 6 && !isOtpVerified) { handleSubmitOtp(); @@ -112,14 +110,13 @@ const ResetPassword: React.FC = ({ route, navigation }) => { }, [otp]); const handleOtpChange = (value: string, index: number) => { - if (!/^\d*$/.test(value)) return; // Only allow numbers + if (!/^\d*$/.test(value)) return; const newOtp = [...otp]; newOtp[index] = value; setOtp(newOtp); setOtpError(''); - // Auto-focus to next input if (value && index < 5) { otpInputs.current[index + 1]?.focus(); } @@ -127,7 +124,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { const handleOtpKeyPress = (e: NativeSyntheticEvent, index: number) => { if (e.nativeEvent.key === 'Backspace' && !otp[index] && index > 0) { - // Move focus to previous input on backspace otpInputs.current[index - 1]?.focus(); } }; @@ -149,7 +145,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { setOtpError(''); try { - // Make the API request to verify OTP const res = await axios.post( `${BASE_URL}eproc/verify-otp?email=${encodeURIComponent(email)}&otp=${fullOtp}`, null, @@ -167,7 +162,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { ToastAndroid.show('OTP verified successfully!', ToastAndroid.SHORT); setIsOtpVerified(true); - // Focus on password field after successful OTP verification setTimeout(() => { newPasswordRef.current?.focus(); }, 100); @@ -193,19 +187,16 @@ const ResetPassword: React.FC = ({ route, navigation }) => { const validateForm = (): boolean => { let isValid = true; - // Validate OTP if (!isOtpVerified) { setOtpError('Please verify OTP first'); isValid = false; } - // Validate password if (newPassword.length < 8) { setPasswordError('Password must be at least 8 characters long'); isValid = false; } - // Validate confirm password if (newPassword !== confirmPassword) { setConfirmPasswordError('Passwords do not match'); isValid = false; @@ -225,7 +216,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { setLoading(true); try { - // Make API call to reset password according to curl const res = await axios.post( `${BASE_URL}eproc/reset-password?email=${encodeURIComponent(email)}&otp=${otp.join('')}&newPassword=${encodeURIComponent(newPassword)}&confirmPassword=${encodeURIComponent(confirmPassword)}`, null, @@ -245,7 +235,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { 'Your password has been reset successfully.', [{ text: 'OK', onPress: () => { - // Navigate to login screen navigation.navigate('Login'); } }] @@ -273,9 +262,8 @@ const ResetPassword: React.FC = ({ route, navigation }) => { setResendLoading(true); try { - // Make API call to resend OTP const res = await axios.post( - `${BASE_URL}eproc/send-otp-forgot-password?email=${encodeURIComponent(email)}`, + `https://procurelinc.in/EProcurementSB/eproc/send-otp-forgot-password?email=${encodeURIComponent(email)}`, null, { headers: { @@ -285,12 +273,11 @@ const ResetPassword: React.FC = ({ route, navigation }) => { ); if (res.data?.statusCode === 200) { + console.log("ress",res) ToastAndroid.show('OTP sent successfully', ToastAndroid.SHORT); - // Clear OTP fields setOtp(['', '', '', '', '', '']); setIsOtpVerified(false); setOtpError(''); - // Start the cooldown timer startResendCooldown(); } else { throw new Error(res.data?.message || 'Failed to resend OTP'); @@ -325,7 +312,6 @@ const ResetPassword: React.FC = ({ route, navigation }) => { Enter the OTP sent to {email} and your new password - {/* OTP Input Section */} OTP Code @@ -363,10 +349,8 @@ const ResetPassword: React.FC = ({ route, navigation }) => { )} )} - - {/* Password Input Section - Only enabled after OTP verification */} New Password @@ -374,7 +358,7 @@ const ResetPassword: React.FC = ({ route, navigation }) => { ref={newPasswordRef} style={[styles.input, passwordError ? styles.inputError : null, !isOtpVerified && styles.disabledInput]} placeholder="Enter new password" - placeholderTextColor={!isOtpVerified ? '#4f058bff' : '#000'} + placeholderTextColor={!isOtpVerified ? colors.lightText : colors.black} value={newPassword} onChangeText={(text) => { setNewPassword(text); @@ -390,9 +374,11 @@ const ResetPassword: React.FC = ({ route, navigation }) => { style={styles.eyeIcon} onPress={() => setNewPasswordVisible(!newPasswordVisible)} > - - {newPasswordVisible ? '🙈' : '👁️'} - + {newPasswordVisible ? ( + + ) : ( + + )} )} @@ -404,7 +390,7 @@ const ResetPassword: React.FC = ({ route, navigation }) => { ref={confirmPasswordRef} style={[styles.input, confirmPasswordError ? styles.inputError : null, !isOtpVerified && styles.disabledInput]} placeholder="Confirm new password" - placeholderTextColor={!isOtpVerified ? '#4f058bff' : '#000'} + placeholderTextColor={!isOtpVerified ? colors.lightText : colors.black} value={confirmPassword} onChangeText={(text) => { setConfirmPassword(text); @@ -420,9 +406,11 @@ const ResetPassword: React.FC = ({ route, navigation }) => { style={styles.eyeIcon} onPress={() => setConfirmPasswordVisible(!confirmPasswordVisible)} > - - {confirmPasswordVisible ? '🙈' : '👁️'} - + {confirmPasswordVisible ? ( + + ) : ( + + )} )} @@ -445,7 +433,7 @@ const ResetPassword: React.FC = ({ route, navigation }) => { )} - 0 && styles.disabledResendButton]} onPress={handleResendOtp} disabled={resendLoading || resendCooldown > 0} @@ -459,7 +447,7 @@ const ResetPassword: React.FC = ({ route, navigation }) => { ) : ( Resend OTP )} - + } ); @@ -550,12 +538,9 @@ const styles = StyleSheet.create({ eyeIcon: { position: 'absolute', right: 15, - top: 13, + top: 15, zIndex: 1, }, - eyeIconText: { - fontSize: 20, - }, errorText: { color: '#ff3b30', fontSize: 14, @@ -616,4 +601,4 @@ const styles = StyleSheet.create({ }, }); -export default ResetPassword; \ No newline at end of file +export default ResetPassword; diff --git a/src/Screens/Tender/LiveTenderDetail.tsx b/src/Screens/Tender/LiveTenderDetail.tsx index f676353..6812407 100644 --- a/src/Screens/Tender/LiveTenderDetail.tsx +++ b/src/Screens/Tender/LiveTenderDetail.tsx @@ -27,6 +27,7 @@ import { } from 'lucide-react-native'; import moment from 'moment'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import { showSuccessAlert, showToast } from '../../Constant/ShowDailog'; const InfoRow = ({ label, value }: any) => ( @@ -78,7 +79,7 @@ const LiveTenderDetail = () => { Accept: 'application/pdf', }); const stat = await ReactNativeBlobUtil.fs.stat(path); - Alert.alert('Download complete', `File saved to: ${path}`); + showToast('Download complete'); setDownloadingId(null); } catch (error: any) { setDownloadingId(null); diff --git a/src/Screens/Tender/ProceedToBidDetail.tsx b/src/Screens/Tender/ProceedToBidDetail.tsx index af26cbf..40bb383 100644 --- a/src/Screens/Tender/ProceedToBidDetail.tsx +++ b/src/Screens/Tender/ProceedToBidDetail.tsx @@ -217,7 +217,7 @@ const ProceedToBidDetail = () => { - {/* Feature Flags */} + {/* Feature Flags Available Features @@ -228,7 +228,7 @@ const ProceedToBidDetail = () => { - + */} {/* Final Status */} @@ -266,9 +266,7 @@ const ProceedToBidDetail = () => { ) : // One time bidding is completed - navigation.navigate('ViewTenderDetail', tenderData)} style={[styles.actionButton, { borderColor: colors.primary, borderWidth: 1 }]}> - View Tender Bid Detail - + null } diff --git a/src/Screens/Tender/PurchaseTenderTile.tsx b/src/Screens/Tender/PurchaseTenderTile.tsx index ef9baa4..53c1d05 100644 --- a/src/Screens/Tender/PurchaseTenderTile.tsx +++ b/src/Screens/Tender/PurchaseTenderTile.tsx @@ -12,7 +12,7 @@ const PurchaseTenderTile = ({ item, onPressDetails }: any) => { const scale = useSharedValue(1); const elevation = useSharedValue(8); const navigation = useNavigation(); - + console.log("obj000ect",item) const animatedStyle = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }], elevation: elevation.value, diff --git a/src/Screens/Tender/ViewTenderDetail.tsx b/src/Screens/Tender/ViewTenderDetail.tsx index bea8f99..34be432 100644 --- a/src/Screens/Tender/ViewTenderDetail.tsx +++ b/src/Screens/Tender/ViewTenderDetail.tsx @@ -32,17 +32,19 @@ import ReactNativeBlobUtil from 'react-native-blob-util'; import { GET_DOCID } from '../../Services/BBPS/ApiUrls' import { useSelector } from 'react-redux' import EnvelopeCExcelPreview from './Component/EnvelopeCExcelPreview' +import { showSuccessAlert } from '../../Constant/ShowDailog' const ViewTenderDetail = () => { - const route: any = useRoute() + const route = useRoute() + console.log("jjo",route?.params?.tenderId) const { data: tenderResponse }: any = useFetchLiveTenderById(route?.params?.tenderId); - const tender = tenderResponse?.data; + const tender = tenderResponse?.data || {}; console.log("tender data : ", tender) const { data } = useFetchTenderBidDetailById(route?.params?.tenderId) const Token = useSelector((state: any) => state.token.token) - console.log("dasdddddddddddddddddddd : ", data) + // console.log("dasdddddddddddddddddddd:", data) const formatDate = (dateArray: any) => { if (!dateArray) return "N/A"; const [year, month, day, hour, minute] = dateArray; @@ -95,7 +97,7 @@ const ViewTenderDetail = () => { const stat = await ReactNativeBlobUtil.fs.stat(path); console.log('File size:', stat.size); console.log("start : ", stat) - Alert.alert('Download complete', `File saved to: ${path}`); + showSuccessAlert(`Download complete `); console.log("file response : ", response) } catch (error: any) { Alert.alert('Error', error?.message || 'Something went wrong while downloading.'); @@ -111,7 +113,7 @@ const ViewTenderDetail = () => { {title} - {data.map((item: any, index: number) => ( + {data&& data.map((item: any, index: number) => ( @@ -278,7 +280,7 @@ const ViewTenderDetail = () => { {/* Department User ID: {item.deptUserId} */} - {item.documentFileName && ( + {item?.documentFileName && ( {/* */} diff --git a/src/Screens/Tender/tenderBidding/TenderBidding.tsx b/src/Screens/Tender/tenderBidding/TenderBidding.tsx index 517b986..f2faf68 100644 --- a/src/Screens/Tender/tenderBidding/TenderBidding.tsx +++ b/src/Screens/Tender/tenderBidding/TenderBidding.tsx @@ -41,9 +41,9 @@ interface InfoRowProps { const TenderBidding = () => { const route = useRoute(); const navigation = useNavigation(); - console.log("-=-=-=-=-=",route) + - console.log("ROUTE DATA",route) + const tenderId = useState(route.params?.tenderId || null); @@ -51,12 +51,11 @@ const TenderBidding = () => { const bidData= tenderResponse?.data; - console.log(" --------------1",bidData) + const { data:tender, refetch } = useProceedToBid(route.params?.tenderId); const tenderData= tender?.data - console.log(" --------------2",tenderData) - const [activeEnvelope, setActiveEnvelope] = useState('A'); +const [activeEnvelope, setActiveEnvelope] = useState('A'); const [envelopForm, setEnvelopForm] = useState({ A: {}, B: {}, @@ -331,7 +330,7 @@ const TenderBidding = () => { const handleSubmitEnvelopeA = async () => { - console.log("hitting here ",envelopForm?.[activeEnvelope]) + if (!validateEnvelope()) { Alert.alert('Validation Error', 'Please fill all mandatory fields'); return; @@ -339,7 +338,7 @@ const TenderBidding = () => { const payload = buildEnvelopePayload(); if (envelopForm?.[activeEnvelope]?.[3]) { - console.log("----",) + const result = await handleSubmitEnvelopeFile(SUBMIT_ENVELOPE_FILE_A) if (result && result?.statusCode === 200) { @@ -441,7 +440,7 @@ const TenderBidding = () => { // console.log( `bold ${tenderData?.[`tenderEnvelope${activeEnvelope}List`]}`,tenderData?.[`tenderEnvelope${activeEnvelope}List`]) return ( - + {/* Tender Info */} @@ -551,42 +550,43 @@ const TenderBidding = () => { )} - - {hasEnvelopes() && activeEnvelope !== 'C' ? ( - { - + + {hasEnvelopes() && activeEnvelope !== 'C' && + !(activeEnvelope === 'A' && bidData.envelopeASubmittStatus) && + !(activeEnvelope === 'B' && bidData.envelopeBSubmittStatus) ? ( + { + if (!check) { + Alert.alert('Info', 'check first terms & condition'); + return; + } + + if (activeEnvelope === 'A') { + handleSubmitEnvelopeA(); + } else if (activeEnvelope === 'B') { + handleSubmitEnvelopeB(); + } + }} + > + + {loading ? ( + + ) : ( + `Submit Bid (${activeEnvelope})` + )} + + + ) : ( + navigation.goBack()} + > + Go Back + + )} + - if (activeEnvelope === 'A') { - if (!check) { - Alert.alert('Info', 'check first terms & condition'); - return; - } - handleSubmitEnvelopeA(); - } else if (activeEnvelope === 'B') { - if (!check) { - Alert.alert('Info', 'check first terms & condition'); - return; - } - handleSubmitEnvelopeB(); - } - }} - - > - - {loading ? : `Submit Bid (${activeEnvelope})`} - - - ) : ( - navigation.goBack()} - > - Go Back - - )} - diff --git a/src/Services/BBPS/ApiUrls.tsx b/src/Services/BBPS/ApiUrls.tsx index e02aae6..301b4d6 100644 --- a/src/Services/BBPS/ApiUrls.tsx +++ b/src/Services/BBPS/ApiUrls.tsx @@ -63,6 +63,7 @@ const ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocu // Rohit const DASHBOARD_COUNT = `${BASE_URL_Auction}api/auction/home/dashboard/counts` +const TENDER_DASHBOARD = `${BASE_URL}contractor/getAllContractorDashboradDetails` const AUCTION_ONE_TIME_BID = `${BASE_URL_Auction}api/bidding/getBidForAuction` const AUCITON_SINGLE_EMD = `${BASE_URL_Auction}api/auction/addEMDDocumentsAuctionWise` const PURCHASE_AUCTION_LIST = `${BASE_URL_Auction}api/auction/proceedToPurchase` @@ -165,6 +166,7 @@ export { GET_TENDER_BY_ID, GET_CONTRACTOR_PROFILE, ESETU_VARIFICATION, - TENDER_BID_DETAIL + TENDER_BID_DETAIL, + TENDER_DASHBOARD }; diff --git a/src/Services/BBPS/Hooks.ts b/src/Services/BBPS/Hooks.ts index 88add72..f93a06b 100644 --- a/src/Services/BBPS/Hooks.ts +++ b/src/Services/BBPS/Hooks.ts @@ -1,5 +1,5 @@ import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query'; -import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, fetchTenderById, getAuction, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, partnerShipSubmit, proceedToBid, registerContractor, sendAadhaarOtp, submitEnvelopeA, submitEnvelopeB, uploadEnvelopeFile, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage, tenderDetails, fetchLiveTenderById, fetchContractorProfile, updateUserProfile, eSetuAdharVarification, fetchTenderBidDetailById } from './apis'; +import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, fetchTenderById, getAuction, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, partnerShipSubmit, proceedToBid, registerContractor, sendAadhaarOtp, submitEnvelopeA, submitEnvelopeB, uploadEnvelopeFile, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage, tenderDetails, fetchLiveTenderById, fetchContractorProfile, updateUserProfile, eSetuAdharVarification, fetchTenderBidDetailById, fetchTenderDashboard } from './apis'; // User @@ -21,7 +21,12 @@ export const useDashboard = () => { queryFn: () => fetchDashboard() }); }; - +export const useTenderDashboard = () => { + return useQuery({ + queryKey: ['fetchTenderDashboard'], + queryFn: () => fetchTenderDashboard() + }); +}; // Auction & Tender export const useFetchPurchaseTender = () => { diff --git a/src/Services/BBPS/apis.ts b/src/Services/BBPS/apis.ts index 96655ac..ef13f88 100644 --- a/src/Services/BBPS/apis.ts +++ b/src/Services/BBPS/apis.ts @@ -1,6 +1,7 @@ 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, STAGETHREE, REJ_STAGE_TWO, GETCONTRACTORBYSTATE, GET_MASTER_DATA, ALL_DESIGNATION, GET_REGISTRATION_STATE, PARTNER_API_ENDPOINT, SAVE_CONTRACTOR_STAGE1, VERIFY_GST, VERIFY_ADHAR, SEND_ADHAROTP, SUBMIT_ENVELOPE_FILE_B, SUBMIT_ENVELOPE_FILE_A, SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_B, VERIFY_ORGPAN, PURCHASE_AUCTION_PAGE, GET_TENDER_BY_ID, GET_CONTRACTOR_PROFILE, CONTRACTOR_PROFILE_UPDATE, - ESETU_VARIFICATION, TENDER_BID_DETAIL } from "./ApiUrls"; + ESETU_VARIFICATION, TENDER_BID_DETAIL, + TENDER_DASHBOARD} from "./ApiUrls"; import { apiCall } from "../../Axios/Axios"; // User @@ -47,12 +48,17 @@ export const fetchDashboard = async (): Promise => { return data } +export const fetchTenderDashboard = async (): Promise => { + const data = await apiCall('get', `${TENDER_DASHBOARD}`); + return data +} + export const fetchPurchaseAuction = async (): Promise => { const data = await apiCall('get', `${GET_MY_AUCTION}`); return data } export const fetchPurchaseAuctionPage = async (payload: any): Promise => { - console.log(payload,'[[[[[[[[[[[[[[[[[[[[[[[['); + const data = await apiCall('get', `${PURCHASE_AUCTION_PAGE}`, {}, payload); return data @@ -157,7 +163,7 @@ export const proceedToBid = async (tenderId: string): Promise => { 'get', `${PROCEED_TO_BID}${tenderId}` ); - console.log("-=-=-=-=-89",data) + return data; } @@ -239,7 +245,7 @@ export const fetchCityDropdown = async (stateId: number): Promise => { 'get', `${GETCONTRACTORBYSTATE}?stateId=${stateId}`, ); -console.log("--",res) + if (res.statusCode !== 200 || !res.data) { throw new Error('Failed load cities'); } @@ -273,14 +279,13 @@ export const getRagistrationState = async (): Promise => { export const eSetuAdharVarification = async (payLoad:any ): Promise => { - console.log("klkllklklklk",payLoad) + const data = await apiCall( 'post', `${ESETU_VARIFICATION}`, payLoad, ); - console.log("ghghghghghhgg",data) return data; } @@ -295,9 +300,11 @@ export const partnerShipSubmit = ( }; export const registerContractor = async (payload: any): Promise => { - console.log("registerContractor payload : ", payload) + try { + console.log("ragitration PayLoad " ,payload) const response = await axios.post(SAVE_CONTRACTOR_STAGE1, { ...payload, device: "mobileApp" }); + console.log("ragitration response " ,response) return response.data; } catch (error: any) { throw error.response?.data || error.message; @@ -349,15 +356,15 @@ export const verifyGstNumber = ( export const submitEnvelopeA = async (payload: any) => { - console.log('SUBMIT ENVELOPE A API CALLED', payload) + const { data } = await apiCall('post', SUBMIT_ENVELOPE_A, payload) - console.log("data : ", data) + return data } export const submitEnvelopeB = async (payload: any) => { - console.log('SUBMIT ENVELOPE B API CALLED', payload) + const { data } = await apiCall('post', SUBMIT_ENVELOPE_B, payload) - console.log("data : ", data) + return data } diff --git a/{ b/{ new file mode 100644 index 0000000..e69de29