From b6c927367da67fe738649bce57930f11015b85a9 Mon Sep 17 00:00:00 2001 From: Abin Toppo Date: Mon, 19 Jan 2026 14:16:38 +0530 Subject: [PATCH] commit --- src/Constant/Dialog/ConfirmDialog.tsx | 4 +- src/Navigation/MainStack.jsx | 4 +- src/Screens/Auction/Auction.tsx | 277 +++++++++++++------- src/Screens/Home/Home.tsx | 1 - src/Screens/Profile/ProfileTab.tsx | 298 ++++++++++++++++------ src/Screens/Tender/ProceedToBidDetail.tsx | 5 +- src/Screens/Tender/Tender.tsx | 276 ++++++++++++++------ src/Screens/Tender/ViewTenderDetail.tsx | 18 +- src/Screens/index.ts | 6 +- 9 files changed, 610 insertions(+), 279 deletions(-) diff --git a/src/Constant/Dialog/ConfirmDialog.tsx b/src/Constant/Dialog/ConfirmDialog.tsx index 43c1cf0..402c800 100644 --- a/src/Constant/Dialog/ConfirmDialog.tsx +++ b/src/Constant/Dialog/ConfirmDialog.tsx @@ -51,9 +51,9 @@ const ConfirmDialog: React.FC = ({ {/* Actions */} - {/* + {cancelText} - */} + - @@ -46,7 +45,8 @@ export default function MainStack() { - + + ); } diff --git a/src/Screens/Auction/Auction.tsx b/src/Screens/Auction/Auction.tsx index 7891596..5801bf3 100644 --- a/src/Screens/Auction/Auction.tsx +++ b/src/Screens/Auction/Auction.tsx @@ -5,7 +5,7 @@ import { useFetchLiveAuction, useFetchPurchaseAuction } from '../../Services/BBP import colors from '../../Constant/Color'; import LiveAuction from './LiveAuction'; import PurchaseAuction from './PurchaseAuction'; -import { ShoppingCart } from 'lucide-react-native'; +import { ShoppingCart, Lock } from 'lucide-react-native'; import { useNavigation } from '@react-navigation/native'; import NavigationString from '../../Constant/NavigationString'; import FontsFamily from '../../Constant/FontsFamily'; @@ -21,6 +21,7 @@ const Auction = () => { const { data: liveAuctionData = {} }: any = useFetchLiveAuction(); const { data: purchaseAuctionData = {} } = useFetchPurchaseAuction(); const SelectedPurchaseList = useSelector((state: any) => state.selectPurchaseAuction); + const reduxToken = useSelector((state: any) => state.token?.token); const liveCount = Array.isArray(liveAuctionData?.result) ? liveAuctionData?.pages?.[0]?.totalCount @@ -31,7 +32,6 @@ const Auction = () => { : 0; const [selectedTab, setSelectedTab] = useState<'live' | 'purchase'>('live'); - const translateX = useRef(new Animated.Value(0)).current; const TAB_WIDTH = useMemo(() => { @@ -48,97 +48,136 @@ const Auction = () => { }).start(); }; + // Check if user is tender type + const isTenderUser = reduxToken?.userType?.toLowerCase() === 'tender'; + + // Render restricted access message + const renderRestrictedAccess = () => ( + + + + + + + Auction Access Restricted + + + You are currently logged in as a Tender user. Auction features are not available for your account type. + + + + To access auction features, please login with an Auction user account. + + + Navigation.navigate(NavigationString.Login)} + > + Switch to Auction Login + + + + ); + return ( - - - - - onTabPress('live', 0)} - > - - Live ({liveCount}) - - - - onTabPress('purchase', 1)} - > - - Purchased ({purchaseCount}) - - - - - - {SelectedPurchaseList.length ? ( + {isTenderUser ? ( + // Show restricted access message for tender users + renderRestrictedAccess() + ) : ( + // Show normal auction UI for auction users + <> + - - {SelectedPurchaseList.length} - - - ) : null} - { - Navigation.navigate(NavigationString.PurchaseList); - }} - > - - - - + - {selectedTab === 'live' ? : } + onTabPress('live', 0)} + > + + Live ({liveCount}) + + + + onTabPress('purchase', 1)} + > + + Purchased ({purchaseCount}) + + + + + + {SelectedPurchaseList.length ? ( + + + {SelectedPurchaseList.length} + + + ) : null} + { + Navigation.navigate(NavigationString.PurchaseList); + }} + > + + + + + + {selectedTab === 'live' ? : } + + )} ); }; @@ -191,4 +230,70 @@ const styles = StyleSheet.create({ shadowRadius: 6, elevation: 3, }, + restrictedContainer: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + padding: 24, + backgroundColor: colors.lightGray, + }, + restrictedCard: { + backgroundColor: colors.white, + borderRadius: 24, + padding: 32, + alignItems: 'center', + maxWidth: 400, + width: '100%', + + }, + iconContainer: { + width: 120, + height: 120, + borderRadius: 60, + backgroundColor: colors.primaryHighlight, + justifyContent: 'center', + alignItems: 'center', + marginBottom: 24, + }, + restrictedTitle: { + fontSize: 24, + fontWeight: '700', + color: colors.darkText, + textAlign: 'center', + marginBottom: 16, + fontFamily: FontsFamily.poppinsBold, + }, + restrictedMessage: { + fontSize: 16, + color: colors.grayText, + textAlign: 'center', + lineHeight: 24, + marginBottom: 12, + fontFamily: FontsFamily.poppinsRegular, + }, + restrictedSubMessage: { + fontSize: 14, + color: colors.grayText, + textAlign: 'center', + lineHeight: 22, + marginBottom: 32, + fontFamily: FontsFamily.poppinsRegular, + }, + loginButton: { + backgroundColor: colors.primary, + paddingHorizontal: 32, + paddingVertical: 14, + borderRadius: 12, + shadowColor: colors.primary, + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.3, + shadowRadius: 8, + elevation: 4, + }, + loginButtonText: { + color: colors.white, + fontSize: 16, + fontWeight: '600', + fontFamily: FontsFamily.poppinsSemiBold, + }, }); diff --git a/src/Screens/Home/Home.tsx b/src/Screens/Home/Home.tsx index 11a0d3d..18c61b2 100644 --- a/src/Screens/Home/Home.tsx +++ b/src/Screens/Home/Home.tsx @@ -86,7 +86,6 @@ const Home = () => { udf2: "77.34", udf3: "string", udf4: "string", - responseUrl: "https://dev.procurelinc.in/" }; console.log("Payload:", payload); diff --git a/src/Screens/Profile/ProfileTab.tsx b/src/Screens/Profile/ProfileTab.tsx index 196f863..9053dd5 100644 --- a/src/Screens/Profile/ProfileTab.tsx +++ b/src/Screens/Profile/ProfileTab.tsx @@ -52,9 +52,14 @@ import { X, Save, } from 'lucide-react-native'; +import { useNavigation } from '@react-navigation/native'; -import { useContractorProfile, useUpdateUserProfile } from '../../Services/BBPS/Hooks'; +import { useContractorProfile, useUpdateUserProfile, useESetuAdharVarification } from '../../Services/BBPS/Hooks'; import colors from '../../Constant/Color'; +import { useSelector } from 'react-redux'; +import ConfirmDialog from '../../Constant/Dialog/ConfirmDialog'; +import { generateTransactionId } from '../../Helper/uniqueId'; +import NavigationString from '../../Constant/NavigationString'; const { width } = Dimensions.get('window'); @@ -102,10 +107,12 @@ interface ContractorData { interface ProfileHeaderProps { data: ContractorData; + displayName: string; } interface QuickStatsProps { data: ContractorData; + onAadhaarPress: () => void; } interface InfoSectionProps { @@ -129,6 +136,7 @@ interface StatItem { label: string; value: string; color: string; + onPress?: () => void; } interface UpdateProfilePayload { @@ -150,11 +158,61 @@ const isValidValue = (value: any): boolean => { return true; }; +// Helper function to check if section has any valid data +const hasSectionData = (values: any[]): boolean => { + return values.some(value => isValidValue(value)); +}; + // Main Component const ProfileTab: React.FC = () => { const { data, refetch, isLoading, error } = useContractorProfile(); - console.log("ioioi",data) + const user = useSelector((state: any) => state.token?.token); + const Navigation: any = useNavigation(); + const { mutateAsync: eSetuAdharVarification, isPending } = useESetuAdharVarification(); + const [editModalVisible, setEditModalVisible] = useState(false); + const [showDialog, setShowDialog] = useState(false); + const [isNavigating, setIsNavigating] = useState(false); + + // Check if user is auction type + const isAuctionUser = user?.userType?.toLowerCase() === 'auction'; + + // Get display data based on user type + const displayName = isAuctionUser ? user?.fullName : data?.fullName; + const displayMobile = isAuctionUser ? user?.mobileNo : data?.mobileNo; + + const handleAadhaarPress = () => { + if (user?.esetuVerified === 'Not Verified') { + setShowDialog(true); + } + }; + + const handleProceedVerification = async () => { + try { + setIsNavigating(true); + + const payload = { + contId: user.id, + transactionId: generateTransactionId(), + udf1: "23.77", + udf2: "77.34", + udf3: "string", + udf4: "string", + responseUrl: "https://dev.procurelinc.in/" + }; + + const res = await eSetuAdharVarification(payload); + + 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); + } + }; if (isLoading) { return ( @@ -200,78 +258,134 @@ const ProfileTab: React.FC = () => { windowSize={10} > {/* Header with Gradient */} - + {/* Quick Stats */} - + - {/* Personal Information */} + {/* Personal Information - Always show */} setEditModalVisible(true)} > - + - {/* Company Details */} - - - - - - - + {/* Company Details - Only show if has data */} + {hasSectionData([ + data.company, + data.contractorType, + data.contOrganization, + data.agentWebsite, + data.agentRegno + ]) && ( + + + + + + + + )} - {/* Address Information */} - - - - - - + {/* Address Information - Only show if has data */} + {hasSectionData([ + data.agentAddress, + data.agentCity, + data.agentState, + data.agentPincode + ]) && ( + + + + + + + )} - {/* Tax & Legal */} - - - - - - - + {/* Tax & Legal - Only show if has data */} + {hasSectionData([ + data.orgPAN, + data.orgPANname, + data.orgPANdob, + data.gistnNo, + data.comAadharNo + ]) && ( + + + + + + + + )} - {/* Registration Status */} - - - - - - + {/* Registration Status - Only show if has data */} + {hasSectionData([ + data.contractorClass, + data.socialCategory, + data.msmeStatus, + data.expiryDate + ]) && ( + + + + + + + )} - {/* Edit Modal */} - setEditModalVisible(false)} - data={data} - onSuccess={refetch} + {/* Edit Modal - Only for tender users */} + {!isAuctionUser && ( + setEditModalVisible(false)} + data={data} + onSuccess={refetch} + /> + )} + + {/* Aadhaar Verification Dialog */} + !isPending && !isNavigating && setShowDialog(false)} + loading={isPending || isNavigating} /> + + {/* Navigation Overlay */} + {isNavigating && ( + + + Loading verification... + + )} ); }; @@ -303,7 +417,6 @@ const EditProfileModal: React.FC = ({ const updateProfileMutation = useUpdateUserProfile(); - // Reset form when modal opens useEffect(() => { if (visible) { setFormData({ @@ -341,7 +454,6 @@ const EditProfileModal: React.FC = ({ newErrors.mobileNo = 'Invalid mobile number'; } - // Auto-generate fullname const generatedFullName = `${formData.firstName} ${formData.middleName} ${formData.lastName}`.trim(); setFormData(prev => ({ ...prev, fullname: generatedFullName })); @@ -376,7 +488,6 @@ const EditProfileModal: React.FC = ({ behavior={Platform.OS === 'ios' ? 'padding' : 'height'} > - {/* Header */} Edit Personal Information @@ -384,9 +495,7 @@ const EditProfileModal: React.FC = ({ - {/* Form */} - {/* First Name */} First Name * = ({ )} - {/* Middle Name */} Middle Name = ({ /> - {/* Last Name */} Last Name * = ({ )} - {/* Email */} Email * = ({ )} - {/* Mobile Number */} Mobile Number * = ({ - {/* Footer Buttons */} = ({ }; // Profile Header Component - OPTIMIZED -const ProfileHeader: React.FC = React.memo(({ data }) => { +const ProfileHeader: React.FC = React.memo(({ data, displayName }) => { const getInitials = (name: string): string => { if (!name || typeof name !== 'string' || name.trim().length === 0) { const fallbackName = `${data.firstName || ''} ${data.lastName || ''}`.trim(); @@ -537,7 +641,7 @@ const ProfileHeader: React.FC = React.memo(({ data }) => { > - {getInitials(data.fullName)} + {getInitials(displayName)} @@ -545,9 +649,7 @@ const ProfileHeader: React.FC = React.memo(({ data }) => { - {data.fullName || - `${data.firstName} ${data.lastName}`.trim() || - 'Unknown User'} + {displayName || 'Unknown User'} @@ -561,15 +663,18 @@ const ProfileHeader: React.FC = React.memo(({ data }) => { ProfileHeader.displayName = 'ProfileHeader'; -// Quick Stats Component - OPTIMIZED -const QuickStats: React.FC = React.memo(({ data }) => { +// Quick Stats Component - OPTIMIZED WITH TOUCHABLE AADHAAR +const QuickStats: React.FC = React.memo(({ data, onAadhaarPress }) => { + const user = useSelector((state: any) => state.token?.token); + const stats: StatItem[] = useMemo( () => [ { Icon: CheckCircle, - label: 'Status', - value: data.isActive, - color: colors.success, + label: 'Aadhaar', + value: user?.esetuVerified, + color: user?.esetuVerified === 'Not Verified' ? colors.error : colors.success, + onPress: onAadhaarPress, }, { Icon: ShieldCheck, @@ -584,20 +689,37 @@ const QuickStats: React.FC = React.memo(({ data }) => { color: colors.info, }, ], - [data.isActive, data.twoFactorAuthEnabled, data.registrationStatus] + [data.twoFactorAuthEnabled, data.registrationStatus, user?.esetuVerified, onAadhaarPress] ); return ( - {stats.map((stat) => ( - - - - {stat.value} - - {stat.label} - - ))} + {stats.map((stat) => { + const CardContent = ( + + + + {stat.value} + + {stat.label} + + ); + + if (stat.onPress) { + return ( + + {CardContent} + + ); + } + + return {CardContent}; + })} ); }); @@ -633,7 +755,6 @@ InfoSection.displayName = 'InfoSection'; // Info Row Component - OPTIMIZED const InfoRow: React.FC = React.memo( ({ label, value, IconComponent, valueColor }) => { - // Return null if value is not valid if (!isValidValue(value)) { return null; } @@ -715,6 +836,7 @@ interface Styles { saveButton: ViewStyle; cancelButtonText: TextStyle; saveButtonText: TextStyle; + navigationOverlay: ViewStyle; } const styles = StyleSheet.create({ @@ -763,7 +885,6 @@ const styles = StyleSheet.create({ fontWeight: '600', }, - // Header Styles headerGradient: { paddingTop: Platform.OS === 'ios' ? 60 : 40, paddingBottom: 30, @@ -841,7 +962,6 @@ const styles = StyleSheet.create({ fontWeight: '600', }, - // Stats Styles statsContainer: { flexDirection: 'row', marginHorizontal: 16, @@ -874,7 +994,6 @@ const styles = StyleSheet.create({ marginTop: 4, }, - // Section Styles section: { marginHorizontal: 16, marginTop: 24, @@ -925,7 +1044,6 @@ const styles = StyleSheet.create({ backgroundColor: colors.primaryHighlight, }, - // Info Row Styles infoRow: { borderRadius: 12, overflow: 'hidden', @@ -966,7 +1084,6 @@ const styles = StyleSheet.create({ lineHeight: 21, }, - // Modal Styles modalOverlay: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.5)', @@ -1058,6 +1175,17 @@ const styles = StyleSheet.create({ fontWeight: '600', color: colors.white, }, + navigationOverlay: { + position: 'absolute', + top: 0, + left: 0, + right: 0, + bottom: 0, + backgroundColor: 'rgba(255, 255, 255, 0.9)', + justifyContent: 'center', + alignItems: 'center', + zIndex: 999, + }, }); export default ProfileTab; diff --git a/src/Screens/Tender/ProceedToBidDetail.tsx b/src/Screens/Tender/ProceedToBidDetail.tsx index 5944612..af26cbf 100644 --- a/src/Screens/Tender/ProceedToBidDetail.tsx +++ b/src/Screens/Tender/ProceedToBidDetail.tsx @@ -12,6 +12,7 @@ const ProceedToBidDetail = () => { const { data, refetch, isRefetching } = useProceedToBid(tenderDataId?.tenderId); const { data: tenderResponse, refetch: tenderRefetch }: any = useFetchTenderById(tenderDataId?.tenderId); const tenderData = tenderResponse?.data; + console.log("dataopop",tenderData) const [refreshing, setRefreshing] = React.useState(false); const [loading, setLoading] = React.useState(false); @@ -174,8 +175,8 @@ const ProceedToBidDetail = () => { Envelope Submission Status - - + {tenderData?.showEB &&} + {tenderData?.showEC &&} diff --git a/src/Screens/Tender/Tender.tsx b/src/Screens/Tender/Tender.tsx index bd5f117..88990e9 100644 --- a/src/Screens/Tender/Tender.tsx +++ b/src/Screens/Tender/Tender.tsx @@ -13,7 +13,7 @@ import { useFetchPurchaseTender, } from '../../Services/BBPS/Hooks'; import colors from '../../Constant/Color'; -import { ShoppingCart } from 'lucide-react-native'; +import { ShoppingCart, Lock } from 'lucide-react-native'; import { useNavigation } from '@react-navigation/native'; import NavigationString from '../../Constant/NavigationString'; import FontsFamily from '../../Constant/FontsFamily'; @@ -33,6 +33,7 @@ const Tender = () => { const SelectedPurchaseList = useSelector( (state: any) => state?.selectPurchaseTender, ); + const reduxToken = useSelector((state: any) => state.token?.token); const liveCount = liveTenderData?.pages?.[0]?.totalCount || 0; const purchaseCount = purchaseTenderData?.pages?.[0]?.totalCount || 0; @@ -54,97 +55,136 @@ const Tender = () => { }).start(); }; + // Check if user is auction type + const isAuctionUser = reduxToken?.userType?.toLowerCase() === 'auction'; + + // Render restricted access message + const renderRestrictedAccess = () => ( + + + + + + + Tender Access Restricted + + + You are currently logged in as an Auction user. Tender features are not available for your account type. + + + + To access tender features, please login with a Tender user account. + + + Navigation.navigate(NavigationString.Login)} + > + Switch to Tender Login + + + + ); + return ( - - - - - onTabPress('live', 0)} - > - - Live ({liveCount}) - - - - onTabPress('purchase', 1)} - > - - Purchased ({purchaseCount}) - - - - - - {SelectedPurchaseList.length ? ( + {isAuctionUser ? ( + // Show restricted access message for auction users + renderRestrictedAccess() + ) : ( + // Show normal tender UI for tender users + <> + - - {SelectedPurchaseList.length} - - - ) : null} - { - Navigation.navigate(NavigationString.PurchaseTenderList); - }} - > - - - - + - {selectedTab === 'live' ? : } + onTabPress('live', 0)} + > + + Live ({liveCount}) + + + + onTabPress('purchase', 1)} + > + + Purchased ({purchaseCount}) + + + + + + {SelectedPurchaseList.length ? ( + + + {SelectedPurchaseList.length} + + + ) : null} + { + Navigation.navigate(NavigationString.PurchaseTenderList); + }} + > + + + + + + {selectedTab === 'live' ? : } + + )} ); }; @@ -197,4 +237,70 @@ const styles = StyleSheet.create({ shadowRadius: 6, elevation: 3, }, + restrictedContainer: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + padding: 24, + backgroundColor: colors.lightGray, + }, + restrictedCard: { + backgroundColor: colors.white, + borderRadius: 24, + padding: 32, + alignItems: 'center', + maxWidth: 400, + width: '100%', + + }, + iconContainer: { + width: 120, + height: 120, + borderRadius: 60, + backgroundColor: colors.primaryHighlight, + justifyContent: 'center', + alignItems: 'center', + marginBottom: 24, + }, + restrictedTitle: { + fontSize: 24, + fontWeight: '700', + color: colors.darkText, + textAlign: 'center', + marginBottom: 16, + fontFamily: FontsFamily.poppinsBold, + }, + restrictedMessage: { + fontSize: 16, + color: colors.grayText, + textAlign: 'center', + lineHeight: 24, + marginBottom: 12, + fontFamily: FontsFamily.poppinsRegular, + }, + restrictedSubMessage: { + fontSize: 14, + color: colors.grayText, + textAlign: 'center', + lineHeight: 22, + marginBottom: 32, + fontFamily: FontsFamily.poppinsRegular, + }, + loginButton: { + backgroundColor: colors.primary, + paddingHorizontal: 32, + paddingVertical: 14, + borderRadius: 12, + shadowColor: colors.primary, + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.3, + shadowRadius: 8, + elevation: 4, + }, + loginButtonText: { + color: colors.white, + fontSize: 16, + fontWeight: '600', + fontFamily: FontsFamily.poppinsSemiBold, + }, }); diff --git a/src/Screens/Tender/ViewTenderDetail.tsx b/src/Screens/Tender/ViewTenderDetail.tsx index e915075..06762d3 100644 --- a/src/Screens/Tender/ViewTenderDetail.tsx +++ b/src/Screens/Tender/ViewTenderDetail.tsx @@ -122,7 +122,7 @@ const ViewTenderDetail = () => { {item.fieldValue && ( - + {item.fieldValue} @@ -143,15 +143,7 @@ const ViewTenderDetail = () => { )} - - - Type: {getLabelTypeText(item.labelTypeA || item.labelTypeB)} - - {item.docEnvelopeSeqId && ( - ID: {item.docEnvelopeSeqId} - )} - - + ))} ); @@ -515,12 +507,12 @@ const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', - marginBottom: 12, + marginBottom:8, }, labelName: { fontSize: 16, fontWeight: '700', - color: colors.darkText, + color: colors.primary, }, mandatoryTag: { fontSize: 12, @@ -534,7 +526,7 @@ const styles = StyleSheet.create({ fieldRow: { flexDirection: 'row', alignItems: 'center', - marginTop: 8, + marginTop: 4, }, fieldValue: { fontSize: 14, diff --git a/src/Screens/index.ts b/src/Screens/index.ts index 00ef479..342d863 100644 --- a/src/Screens/index.ts +++ b/src/Screens/index.ts @@ -42,8 +42,8 @@ const Screens = { Registration, Partnership, LiveTenderDetail, - ProfileTab, , - KycWebViewScreen - ViewTenderDetail + ProfileTab, + KycWebViewScreen, + ViewTenderDetail, } export default Screens \ No newline at end of file