commit
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ export const apiCall = async <R, D = {}>(
|
||||
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({}));
|
||||
|
||||
@@ -27,6 +27,7 @@ const LiveAuction = () => {
|
||||
try {
|
||||
setAllBoolean(prev => ({ ...prev, isLoading: true }))
|
||||
const res = await apiCall<any>('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) }));
|
||||
|
||||
@@ -13,6 +13,7 @@ import moment from 'moment';
|
||||
interface Props { visible: boolean; onClose: () => void; data?: any }
|
||||
|
||||
const AuctionFullDetail: React.FC<Props> = ({ visible, onClose, data }) => {
|
||||
|
||||
const inset = useSafeAreaInsets()
|
||||
const { data: auctionData, isLoading } = useGetAuciton({ auctionId: data?.auctionId })
|
||||
const [aucitonDetail, setAuciotnDetail] = useState<any>(auctionData)
|
||||
@@ -52,10 +53,10 @@ const AuctionFullDetail: React.FC<Props> = ({ 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<Props> = ({ visible, onClose, data }) => {
|
||||
<View style={[styles.iconCircle, { backgroundColor: '#fee2e2' }]}><Clock size={16} color="#ef4444" /></View>
|
||||
<View>
|
||||
<Text style={styles.label}>Purchase Deadline (End)</Text>
|
||||
<Text style={styles.value}>{formatDate(data?.purchaseEnd)}</Text>
|
||||
<Text style={styles.value}>{formatDate(data?.keyDates?.auctionPurchase?.startDateTime)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -41,10 +41,10 @@ const AuctionItemDetail: React.FC<Props> = ({ 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,
|
||||
|
||||
@@ -142,7 +142,9 @@ const PurchaseAuctionList = () => {
|
||||
);
|
||||
purchaseListMutation({ auctionNumbers, contractorId: LoginUser.contractorId }, {
|
||||
onSuccess: (res) => {
|
||||
console.log("purchaseListMutation",res)
|
||||
if (res.statusCode == 200) {
|
||||
|
||||
setList(res.data)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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 (
|
||||
<View style={styles.screen}>
|
||||
|
||||
+30
-14
@@ -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<boolean>(false);
|
||||
const [isNavigating, setIsNavigating] = useState<boolean>(false);
|
||||
useFocusEffect(()=>{
|
||||
const [DASHBOARD_CARDS,setDASHBOARD_CARDS]=useState<any>([])
|
||||
useFocusEffect(() => {
|
||||
setIsNavigating(false)
|
||||
})
|
||||
useEffect(() => {
|
||||
@@ -106,64 +109,75 @@ const Home = () => {
|
||||
}
|
||||
};
|
||||
|
||||
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 (
|
||||
<View style={styles.screen}>
|
||||
@@ -193,13 +207,15 @@ const Home = () => {
|
||||
numColumns={2}
|
||||
columnWrapperStyle={styles.row}
|
||||
contentContainerStyle={styles.list}
|
||||
renderItem={({ item, index }) => (
|
||||
renderItem={({ item, index }) => {
|
||||
return (
|
||||
<StatCard
|
||||
item={item}
|
||||
index={index}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
)}
|
||||
)
|
||||
}}
|
||||
showsVerticalScrollIndicator={false}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -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<ForgotModalProps> = ({
|
||||
visible,
|
||||
onClose
|
||||
}) => {
|
||||
const navigation = useNavigation() as Navigation;
|
||||
const Navigation = useNavigation<any>();
|
||||
const [email, setEmail] = useState<string>('');
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [error, setError] = useState<string>('');
|
||||
@@ -67,20 +69,10 @@ const ForgotModal: React.FC<ForgotModalProps> = ({
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
Alert.alert(
|
||||
'Success',
|
||||
'OTP has been sent to your email address. Please check your inbox.',
|
||||
[
|
||||
{
|
||||
text: 'OK',
|
||||
onPress: () => {
|
||||
showToast('OTP has been sent to your email address. Please check your inbox.')
|
||||
onClose();
|
||||
navigation.navigate('ResetPassword', { email });
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
setEmail('');
|
||||
Navigation.navigate(NavigationString.ResetPassword, { email });
|
||||
|
||||
} else {
|
||||
const errorData = await response.text();
|
||||
console.error('API Error:', errorData);
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
const confirmPasswordRef = useRef<TextInput>(null);
|
||||
const resendTimerRef = useRef<NodeJS.Timeout | null>(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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Update timer every second
|
||||
useEffect(() => {
|
||||
if (resendCooldown > 0) {
|
||||
resendTimerRef.current = setInterval(() => {
|
||||
@@ -98,13 +97,12 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
|
||||
const handleOtpKeyPress = (e: NativeSyntheticEvent<TextInputKeyPressEventData>, 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
Enter the OTP sent to {email} and your new password
|
||||
</Text>
|
||||
|
||||
{/* OTP Input Section */}
|
||||
<View style={styles.otpSection}>
|
||||
<Text style={styles.sectionLabel}>OTP Code</Text>
|
||||
<View style={styles.otpContainer}>
|
||||
@@ -363,10 +349,8 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
</View>
|
||||
|
||||
{/* Password Input Section - Only enabled after OTP verification */}
|
||||
<View style={styles.passwordSection}>
|
||||
<Text style={styles.sectionLabel}>New Password</Text>
|
||||
<View style={styles.passwordInputContainer}>
|
||||
@@ -374,7 +358,7 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
style={styles.eyeIcon}
|
||||
onPress={() => setNewPasswordVisible(!newPasswordVisible)}
|
||||
>
|
||||
<Text style={styles.eyeIconText}>
|
||||
{newPasswordVisible ? '🙈' : '👁️'}
|
||||
</Text>
|
||||
{newPasswordVisible ? (
|
||||
<EyeOff size={20} color={colors.primary} />
|
||||
) : (
|
||||
<Eye size={20} color={colors.primary} />
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
@@ -404,7 +390,7 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ 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<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
style={styles.eyeIcon}
|
||||
onPress={() => setConfirmPasswordVisible(!confirmPasswordVisible)}
|
||||
>
|
||||
<Text style={styles.eyeIconText}>
|
||||
{confirmPasswordVisible ? '🙈' : '👁️'}
|
||||
</Text>
|
||||
{confirmPasswordVisible ? (
|
||||
<EyeOff size={20} color={colors.primary} />
|
||||
) : (
|
||||
<Eye size={20} color={colors.primary} />
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
@@ -445,7 +433,7 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity
|
||||
{!isOtpVerified&&<TouchableOpacity
|
||||
style={[styles.resendButton, resendCooldown > 0 && styles.disabledResendButton]}
|
||||
onPress={handleResendOtp}
|
||||
disabled={resendLoading || resendCooldown > 0}
|
||||
@@ -459,7 +447,7 @@ const ResetPassword: React.FC<ResetPasswordProps> = ({ route, navigation }) => {
|
||||
) : (
|
||||
<Text style={styles.resendButtonText}>Resend OTP</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>}
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
@@ -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,
|
||||
|
||||
@@ -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) => (
|
||||
<View style={styles.row}>
|
||||
@@ -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);
|
||||
|
||||
@@ -217,7 +217,7 @@ const ProceedToBidDetail = () => {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Feature Flags */}
|
||||
{/* Feature Flags
|
||||
<View style={styles.section}>
|
||||
<Text style={styles.sectionTitle}>Available Features</Text>
|
||||
<View style={styles.chipsContainer}>
|
||||
@@ -228,7 +228,7 @@ const ProceedToBidDetail = () => {
|
||||
<FeatureChip label="QCBS" enabled={tenderData?.showQCBS} />
|
||||
<FeatureChip label="LCS" enabled={tenderData?.showLCS} />
|
||||
</View>
|
||||
</View>
|
||||
</View> */}
|
||||
|
||||
{/* Final Status */}
|
||||
<View style={styles.finalStatusCard}>
|
||||
@@ -266,9 +266,7 @@ const ProceedToBidDetail = () => {
|
||||
|
||||
) :
|
||||
// <Text style={styles.footerText}>One time bidding is completed</Text>
|
||||
<TouchableOpacity onPress={() => navigation.navigate('ViewTenderDetail', tenderData)} style={[styles.actionButton, { borderColor: colors.primary, borderWidth: 1 }]}>
|
||||
<Text>View Tender Bid Detail</Text>
|
||||
</TouchableOpacity>
|
||||
null
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -12,7 +12,7 @@ const PurchaseTenderTile = ({ item, onPressDetails }: any) => {
|
||||
const scale = useSharedValue(1);
|
||||
const elevation = useSharedValue(8);
|
||||
const navigation = useNavigation<any>();
|
||||
|
||||
console.log("obj000ect",item)
|
||||
const animatedStyle = useAnimatedStyle(() => ({
|
||||
transform: [{ scale: scale.value }],
|
||||
elevation: elevation.value,
|
||||
|
||||
@@ -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<any>()
|
||||
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 = () => {
|
||||
<Mail size={24} color={colors.primary} />
|
||||
<Text style={styles.sectionTitle}>{title}</Text>
|
||||
</View>
|
||||
{data.map((item: any, index: number) => (
|
||||
{data&& data.map((item: any, index: number) => (
|
||||
<View key={index} style={styles.envelopeItem}>
|
||||
<View style={styles.envelopeHeader}>
|
||||
<Text style={styles.labelName}>
|
||||
@@ -278,7 +280,7 @@ const ViewTenderDetail = () => {
|
||||
</Text>
|
||||
{/* <Text style={styles.documentMeta}>Department User ID: {item.deptUserId}</Text> */}
|
||||
</View>
|
||||
{item.documentFileName && (
|
||||
{item?.documentFileName && (
|
||||
<TouchableOpacity style={styles.downloadButton}>
|
||||
{/* <Download size={24} color={colors.primary} /> */}
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -41,9 +41,9 @@ interface InfoRowProps {
|
||||
const TenderBidding = () => {
|
||||
const route = useRoute<any>();
|
||||
const navigation = useNavigation();
|
||||
console.log("-=-=-=-=-=",route)
|
||||
|
||||
console.log("ROUTE DATA",route)
|
||||
|
||||
|
||||
|
||||
const tenderId = useState<any>(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<EnvelopeType>('A');
|
||||
const [activeEnvelope, setActiveEnvelope] = useState<EnvelopeType>('A');
|
||||
const [envelopForm, setEnvelopForm] = useState<EnvelopeFormState>({
|
||||
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 (
|
||||
<View style={styles.container}>
|
||||
<InsideHeader title="Tender Bidding Start" showArrow />
|
||||
<InsideHeader title="Tender Bidding" showArrow />
|
||||
<ScrollView contentContainerStyle={styles.scrollContainer}>
|
||||
{/* Tender Info */}
|
||||
<View style={styles.card}>
|
||||
@@ -552,30 +551,30 @@ const TenderBidding = () => {
|
||||
)}
|
||||
|
||||
<View style={styles.footer}>
|
||||
{hasEnvelopes() && activeEnvelope !== 'C' ? (
|
||||
{hasEnvelopes() && activeEnvelope !== 'C' &&
|
||||
!(activeEnvelope === 'A' && bidData.envelopeASubmittStatus) &&
|
||||
!(activeEnvelope === 'B' && bidData.envelopeBSubmittStatus) ? (
|
||||
<TouchableOpacity
|
||||
style={styles.primaryButton}
|
||||
onPress={() => {
|
||||
|
||||
if (!check) {
|
||||
Alert.alert('Info', 'check first terms & condition');
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}}
|
||||
|
||||
>
|
||||
<Text style={styles.primaryButtonText}>
|
||||
{loading ? <ActivityIndicator size={'small'} color={'#fff'} /> : `Submit Bid (${activeEnvelope})`}
|
||||
{loading ? (
|
||||
<ActivityIndicator size={'small'} color={'#fff'} />
|
||||
) : (
|
||||
`Submit Bid (${activeEnvelope})`
|
||||
)}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
@@ -586,7 +585,8 @@ const TenderBidding = () => {
|
||||
<Text style={styles.secondaryButtonText}>Go Back</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
+18
-11
@@ -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<any> => {
|
||||
return data
|
||||
}
|
||||
|
||||
export const fetchTenderDashboard = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${TENDER_DASHBOARD}`);
|
||||
return data
|
||||
}
|
||||
|
||||
export const fetchPurchaseAuction = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`);
|
||||
return data
|
||||
}
|
||||
export const fetchPurchaseAuctionPage = async (payload: any): Promise<any> => {
|
||||
console.log(payload,'[[[[[[[[[[[[[[[[[[[[[[[[');
|
||||
|
||||
|
||||
const data = await apiCall<any>('get', `${PURCHASE_AUCTION_PAGE}`, {}, payload);
|
||||
return data
|
||||
@@ -157,7 +163,7 @@ export const proceedToBid = async (tenderId: string): Promise<any> => {
|
||||
'get',
|
||||
`${PROCEED_TO_BID}${tenderId}`
|
||||
);
|
||||
console.log("-=-=-=-=-89",data)
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -239,7 +245,7 @@ export const fetchCityDropdown = async (stateId: number): Promise<any> => {
|
||||
'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<any> => {
|
||||
|
||||
|
||||
export const eSetuAdharVarification = async (payLoad:any ): Promise<any> => {
|
||||
console.log("klkllklklklk",payLoad)
|
||||
|
||||
const data = await apiCall<any>(
|
||||
'post',
|
||||
`${ESETU_VARIFICATION}`,
|
||||
payLoad,
|
||||
);
|
||||
|
||||
console.log("ghghghghghhgg",data)
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -295,9 +300,11 @@ export const partnerShipSubmit = (
|
||||
};
|
||||
|
||||
export const registerContractor = async (payload: any): Promise<any> => {
|
||||
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<any>('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<any>('post', SUBMIT_ENVELOPE_B, payload)
|
||||
console.log("data : ", data)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user