This commit is contained in:
Abin Toppo
2026-01-19 14:16:38 +05:30
parent 96d71d1011
commit b6c927367d
9 changed files with 610 additions and 279 deletions
+3 -2
View File
@@ -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 = () => {
<Text style={styles.sectionTitle}>Envelope Submission Status</Text>
<View style={styles.statusGrid}>
<StatusIndicator status={tenderData?.envelopeASubmittStatus} label="Envelope A" />
<StatusIndicator status={tenderData?.envelopeBSubmittStatus} label="Envelope B" />
<StatusIndicator status={tenderData?.envelopeCSubmittStatus} label="Envelope C" />
{tenderData?.showEB &&<StatusIndicator status={tenderData?.envelopeBSubmittStatus} label="Envelope B" />}
{tenderData?.showEC &&<StatusIndicator status={tenderData?.envelopeCSubmittStatus} label="Envelope C" />}
</View>
</View>
+191 -85
View File
@@ -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 = () => (
<View style={styles.restrictedContainer}>
<View style={styles.restrictedCard}>
<View style={styles.iconContainer}>
<Lock size={64} color={colors.primary} />
</View>
<Text style={styles.restrictedTitle}>Tender Access Restricted</Text>
<Text style={styles.restrictedMessage}>
You are currently logged in as an Auction user. Tender features are not available for your account type.
</Text>
<Text style={styles.restrictedSubMessage}>
To access tender features, please login with a Tender user account.
</Text>
<TouchableOpacity
style={styles.loginButton}
onPress={() => Navigation.navigate(NavigationString.Login)}
>
<Text style={styles.loginButtonText}>Switch to Tender Login</Text>
</TouchableOpacity>
</View>
</View>
);
return (
<View style={styles.container}>
<InsideHeader title="Tender" showArrow />
<View style={styles.topRow}>
<View
style={[
styles.switchWrapper,
{
width: TAB_WIDTH * 2 + SWITCH_INSETS * 2,
},
]}
>
<Animated.View
pointerEvents="none"
style={[
styles.activeTab,
{
width: TAB_WIDTH,
transform: [{ translateX }],
},
]}
/>
<TouchableOpacity
style={[styles.tab, { width: TAB_WIDTH }]}
activeOpacity={0.8}
onPress={() => onTabPress('live', 0)}
>
<Text
style={[
styles.tabText,
selectedTab === 'live' && styles.activeText,
]}
>
Live ({liveCount})
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.tab, { width: TAB_WIDTH }]}
activeOpacity={0.8}
onPress={() => onTabPress('purchase', 1)}
>
<Text
style={[
styles.tabText,
selectedTab === 'purchase' && styles.activeText,
]}
>
Purchased ({purchaseCount})
</Text>
</TouchableOpacity>
</View>
<View>
{SelectedPurchaseList.length ? (
{isAuctionUser ? (
// Show restricted access message for auction users
renderRestrictedAccess()
) : (
// Show normal tender UI for tender users
<>
<View style={styles.topRow}>
<View
style={{
borderWidth: 2,
borderColor: colors.white,
backgroundColor: colors.primaryLight,
position: 'absolute',
borderRadius: 50,
zIndex: 20,
right: 0,
top: -10,
paddingHorizontal: 2,
}}
style={[
styles.switchWrapper,
{
width: TAB_WIDTH * 2 + SWITCH_INSETS * 2,
},
]}
>
<Text style={{ fontSize: 12, color: colors.black }}>
{SelectedPurchaseList.length}
</Text>
</View>
) : null}
<TouchableOpacity
style={{
padding: 10,
backgroundColor: colors.primaryLight,
borderRadius: 20,
}}
onPress={() => {
Navigation.navigate(NavigationString.PurchaseTenderList);
}}
>
<ShoppingCart size={22} color={colors.black} strokeWidth={2} />
</TouchableOpacity>
</View>
</View>
<Animated.View
pointerEvents="none"
style={[
styles.activeTab,
{
width: TAB_WIDTH,
transform: [{ translateX }],
},
]}
/>
{selectedTab === 'live' ? <LiveTender /> : <PurchaseTenderAllList />}
<TouchableOpacity
style={[styles.tab, { width: TAB_WIDTH }]}
activeOpacity={0.8}
onPress={() => onTabPress('live', 0)}
>
<Text
style={[
styles.tabText,
selectedTab === 'live' && styles.activeText,
]}
>
Live ({liveCount})
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.tab, { width: TAB_WIDTH }]}
activeOpacity={0.8}
onPress={() => onTabPress('purchase', 1)}
>
<Text
style={[
styles.tabText,
selectedTab === 'purchase' && styles.activeText,
]}
>
Purchased ({purchaseCount})
</Text>
</TouchableOpacity>
</View>
<View>
{SelectedPurchaseList.length ? (
<View
style={{
borderWidth: 2,
borderColor: colors.white,
backgroundColor: colors.primaryLight,
position: 'absolute',
borderRadius: 50,
zIndex: 20,
right: 0,
top: -10,
paddingHorizontal: 2,
}}
>
<Text style={{ fontSize: 12, color: colors.black }}>
{SelectedPurchaseList.length}
</Text>
</View>
) : null}
<TouchableOpacity
style={{
padding: 10,
backgroundColor: colors.primaryLight,
borderRadius: 20,
}}
onPress={() => {
Navigation.navigate(NavigationString.PurchaseTenderList);
}}
>
<ShoppingCart size={22} color={colors.black} strokeWidth={2} />
</TouchableOpacity>
</View>
</View>
{selectedTab === 'live' ? <LiveTender /> : <PurchaseTenderAllList />}
</>
)}
</View>
);
};
@@ -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,
},
});
+5 -13
View File
@@ -122,7 +122,7 @@ const ViewTenderDetail = () => {
</View>
{item.fieldValue && (
<View style={styles.fieldRow}>
<View style={[styles.fieldRow,{backgroundColor:colors.lightGray,borderRadius:20,padding:10}]}>
<Type size={16} color={colors.gray} />
<Text style={styles.fieldValue}>{item.fieldValue}</Text>
</View>
@@ -143,15 +143,7 @@ const ViewTenderDetail = () => {
</TouchableOpacity>
)}
<View style={styles.metaInfo}>
<Text style={styles.metaText}>
Type: {getLabelTypeText(item.labelTypeA || item.labelTypeB)}
</Text>
{item.docEnvelopeSeqId && (
<Text style={styles.metaText}>ID: {item.docEnvelopeSeqId}</Text>
)}
</View>
</View>
</View>
))}
</View>
);
@@ -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,