Fix issues reported in the error reports of find the error while testing eprocure application
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
export interface TenderItem {
|
export interface TenderItem {
|
||||||
TenderNumber: string;
|
tenderId: number;
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ DEFAULT = EMPTY ARRAY
|
|
||||||
const initialState: TenderItem[] = [];
|
const initialState: TenderItem[] = [];
|
||||||
|
|
||||||
export const selectPurchaseTenderSlice = createSlice({
|
export const selectPurchaseTenderSlice = createSlice({
|
||||||
@@ -27,7 +25,7 @@ export const selectPurchaseTenderSlice = createSlice({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clearPurchaseTender: () => [],
|
clearPurchaseTender: () => initialState,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -36,4 +34,4 @@ export const {
|
|||||||
clearPurchaseTender,
|
clearPurchaseTender,
|
||||||
} = selectPurchaseTenderSlice.actions;
|
} = selectPurchaseTenderSlice.actions;
|
||||||
|
|
||||||
export default selectPurchaseTenderSlice.reducer;
|
export default selectPurchaseTenderSlice.reducer;
|
||||||
@@ -72,6 +72,7 @@ const LiveTender = () => {
|
|||||||
return <Skelton />;
|
return <Skelton />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("data live : ", data )
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<SearchInput onChange={() => { }} placeholder="Search...." />
|
<SearchInput onChange={() => { }} placeholder="Search...." />
|
||||||
@@ -114,7 +115,7 @@ const LiveTender = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<FlatList
|
<FlatList
|
||||||
data={data?.data ?? []}
|
data={data?.result ?? []}
|
||||||
keyExtractor={(item) => String(item.auctionId)}
|
keyExtractor={(item) => String(item.auctionId)}
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -135,6 +136,8 @@ const LiveTender = () => {
|
|||||||
windowSize={7}
|
windowSize={7}
|
||||||
removeClippedSubviews
|
removeClippedSubviews
|
||||||
updateCellsBatchingPeriod={50}
|
updateCellsBatchingPeriod={50}
|
||||||
|
onRefresh={refetch}
|
||||||
|
refreshing={isRefetching}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,20 +17,20 @@ const LiveTenderTile: React.FC<LiveTenderTileProps> = ({
|
|||||||
tenderDispatchDate,
|
tenderDispatchDate,
|
||||||
tenderOfWork,
|
tenderOfWork,
|
||||||
purchaseEnd,
|
purchaseEnd,
|
||||||
tenderFees,
|
tenderFees,
|
||||||
tenderNumber,
|
tenderNumber,
|
||||||
onDetailsPress
|
|
||||||
}) => {
|
}) => {
|
||||||
const navigation: any = useNavigation();
|
const navigation: any = useNavigation();
|
||||||
const purchaseEnded = !moment().isAfter(moment(purchaseEnd, 'DD-MM-YYYY HH:mm:ss'));
|
const purchaseEnded = !moment().isAfter(moment(purchaseEnd, 'DD-MM-YYYY HH:mm:ss'));
|
||||||
|
|
||||||
const contractorIds = typeof data?.contractorId === 'string'
|
const contractorIds = typeof data?.contractorId === 'string'
|
||||||
? data.contractorId.split(',').map((id:any) => id.trim())
|
? data.contractorId.split(',').map((id: any) => id.trim())
|
||||||
: Array.isArray(data?.contractorId)
|
: Array.isArray(data?.contractorId)
|
||||||
? data.contractorId
|
? data.contractorId
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
const purchased = contractorIds.includes(String(contractorId));
|
||||||
|
|
||||||
const purchased = contractorIds.includes(String(contractorId));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.cardWrapper}>
|
<View style={styles.cardWrapper}>
|
||||||
@@ -38,7 +38,7 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
styles.statusTag,
|
styles.statusTag,
|
||||||
{ backgroundColor: isPurchased ? colors.error : purchaseEnded ? '#94a3b8' : (purchased?'#94a3b8':'#4ade80') },
|
{ backgroundColor: isPurchased ? colors.error : purchaseEnded ? '#94a3b8' : (purchased ? '#94a3b8' : '#4ade80') },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -67,7 +67,6 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
<Calendar size={16} color="#64748b" />
|
<Calendar size={16} color="#64748b" />
|
||||||
<View style={styles.infoTextGroup}>
|
<View style={styles.infoTextGroup}>
|
||||||
<Text style={styles.infoLabel}>Start</Text>
|
<Text style={styles.infoLabel}>Start</Text>
|
||||||
{/* <Text style={styles.infoValue}>{tenderDispatchDate ?? '-'}</Text> */}
|
|
||||||
<Text style={styles.infoValue}>{format.date6(`${tenderDispatchDate}`)}</Text>
|
<Text style={styles.infoValue}>{format.date6(`${tenderDispatchDate}`)}</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@@ -86,7 +85,7 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
|
|
||||||
{/* Action Bar */}
|
{/* Action Bar */}
|
||||||
<View style={styles.actionBar}>
|
<View style={styles.actionBar}>
|
||||||
<TouchableOpacity style={styles.iconBtn} onPress={()=>navigation.navigate('LiveTenderDetail', data)}>
|
<TouchableOpacity style={styles.iconBtn} onPress={() => navigation.navigate('LiveTenderDetail', data)}>
|
||||||
<Info size={18} color={colors.primary} />
|
<Info size={18} color={colors.primary} />
|
||||||
<Text style={styles.iconBtnText}>Details</Text>
|
<Text style={styles.iconBtnText}>Details</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
@@ -96,7 +95,7 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
styles.mainButton,
|
styles.mainButton,
|
||||||
purchaseEnded
|
purchaseEnded
|
||||||
? styles.btnDisabled
|
? styles.btnDisabled
|
||||||
:(purchased? styles.btnDisabled: isPurchased
|
: (purchased ? styles.btnDisabled : isPurchased
|
||||||
? styles.btnPurchased
|
? styles.btnPurchased
|
||||||
: styles.btnActive),
|
: styles.btnActive),
|
||||||
]}
|
]}
|
||||||
@@ -109,7 +108,7 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
isPurchased && !purchaseEnded ? { color: colors.white } : { color: '#fff' },
|
isPurchased && !purchaseEnded ? { color: colors.white } : { color: '#fff' },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{purchaseEnded ? 'Expired' : (purchased?'Purchased':isPurchased ? 'Remove' : 'Add to Cart')}
|
{purchaseEnded ? 'Expired' : (purchased ? 'Purchased' : isPurchased ? 'Remove' : 'Add to Cart')}
|
||||||
</Text>
|
</Text>
|
||||||
{(!purchaseEnded && !purchased) && (
|
{(!purchaseEnded && !purchased) && (
|
||||||
<ArrowRight size={16} color={isPurchased ? colors.white : '#fff'} />
|
<ArrowRight size={16} color={isPurchased ? colors.white : '#fff'} />
|
||||||
@@ -117,8 +116,6 @@ const purchased = contractorIds.includes(String(contractorId));
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Tender Detail Modal */}
|
|
||||||
{/* <TenderFullDetail visible={showDetail} data={data} onClose={() => setShowDetail(false)} /> */}
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ const ProceedToBidDetail = () => {
|
|||||||
const [refreshing, setRefreshing] = React.useState(false);
|
const [refreshing, setRefreshing] = React.useState(false);
|
||||||
const [loading, setLoading] = React.useState(false);
|
const [loading, setLoading] = React.useState(false);
|
||||||
|
|
||||||
console.log("proceed to bid tender detail : ", tenderDataId)
|
// console.log("proceed to bid tender detail : ", tenderDataId)
|
||||||
console.log("proceed to data detail : ", data)
|
// console.log("proceed to data detail : ", data)
|
||||||
console.log("tender data for updated : ", tenderData)
|
// console.log("tender data for updated : ", tenderData)
|
||||||
const navigation = useNavigation<any>()
|
const navigation = useNavigation<any>()
|
||||||
// Format date from array
|
// Format date from array
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ const ProceedToBidDetail = () => {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
tenderRefetch();
|
tenderRefetch();
|
||||||
}, [tenderData.tenderId])
|
}, [tenderData?.tenderId])
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ const PurchaseTenderAllList = () => {
|
|||||||
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch }: any = useFetchPurchaseTender();
|
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch }: any = useFetchPurchaseTender();
|
||||||
const [showRefreshBanner, setShowRefreshBanner] = useState(false);
|
const [showRefreshBanner, setShowRefreshBanner] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
console.log("data for tender : ", data)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isRefetching) {
|
if (isRefetching) {
|
||||||
setShowRefreshBanner(true);
|
setShowRefreshBanner(true);
|
||||||
@@ -36,6 +34,7 @@ const PurchaseTenderAllList = () => {
|
|||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}
|
}
|
||||||
}, [isRefetching]);
|
}, [isRefetching]);
|
||||||
|
|
||||||
const format = 'DD-MM-YYYY HH:mm:ss';
|
const format = 'DD-MM-YYYY HH:mm:ss';
|
||||||
|
|
||||||
function isTenderActive(item: any): boolean {
|
function isTenderActive(item: any): boolean {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import colors from '../../Constant/Color';
|
|||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import NavigationString from '../../Constant/NavigationString';
|
import NavigationString from '../../Constant/NavigationString';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { togglePurchaseAuction } from '../../Redux/Slices/selectPurchaseAuction';
|
import { togglePurchaseTender } from '../../Redux/Slices/SelectedPurchaseTender';
|
||||||
|
|
||||||
const PurchaseTenderList = () => {
|
const PurchaseTenderList = () => {
|
||||||
const Navigation: any = useNavigation()
|
const Navigation: any = useNavigation()
|
||||||
@@ -18,7 +18,6 @@ const PurchaseTenderList = () => {
|
|||||||
setExpandedIndex(prev => (prev === index ? null : index));
|
setExpandedIndex(prev => (prev === index ? null : index));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.screen}>
|
<View style={styles.screen}>
|
||||||
<InsideHeader title="Purchase" showArrow />
|
<InsideHeader title="Purchase" showArrow />
|
||||||
@@ -27,12 +26,13 @@ const PurchaseTenderList = () => {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<Text style={styles.heading}>Tender Purchase List</Text>
|
<Text style={styles.heading}>Tender Purchase List</Text>
|
||||||
<Info size={20} color="#0F172A" />
|
{/* <Info size={20} color="#0F172A" /> */}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Cards */}
|
{/* Cards */}
|
||||||
{SelectedPurchaseList.map((item: any, index: any) => {
|
{SelectedPurchaseList.map((item: any, index: any) => {
|
||||||
const expanded = expandedIndex === index;
|
const expanded = expandedIndex === index;
|
||||||
|
console.log("item gvsdvgfsv h ca : ", item)
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
key={item.auctionId}
|
key={item.auctionId}
|
||||||
@@ -79,7 +79,7 @@ const PurchaseTenderList = () => {
|
|||||||
{renderRow('Department', item.departmentName)}
|
{renderRow('Department', item.departmentName)}
|
||||||
{renderRow('Purchase End', item.purchaseEnd)}
|
{renderRow('Purchase End', item.purchaseEnd)}
|
||||||
|
|
||||||
<TouchableOpacity style={styles.removeButton} onPress={() => { Dispatch(togglePurchaseAuction(item)) }}>
|
<TouchableOpacity style={styles.removeButton} onPress={() => { Dispatch(togglePurchaseTender(item)) }}>
|
||||||
<Trash2 size={18} color="#fff" />
|
<Trash2 size={18} color="#fff" />
|
||||||
<Text style={styles.removeText}>Remove</Text>
|
<Text style={styles.removeText}>Remove</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const PurchaseTenderTile = ({ item, onPressDetails }: any) => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
// disabled={!isLive}
|
disabled={!isLive}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (isLive) {
|
if (isLive) {
|
||||||
navigation.navigate('ProceedToBidDetail', { tender });
|
navigation.navigate('ProceedToBidDetail', { tender });
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const Tender = () => {
|
|||||||
(state: any) => state?.selectPurchaseTender,
|
(state: any) => state?.selectPurchaseTender,
|
||||||
);
|
);
|
||||||
|
|
||||||
const liveCount = liveTenderData?.totalCount || 0;
|
const liveCount = liveTenderData?.pages?.[0]?.totalCount || 0;
|
||||||
const purchaseCount = purchaseTenderData?.pages?.[0]?.totalCount || 0;
|
const purchaseCount = purchaseTenderData?.pages?.[0]?.totalCount || 0;
|
||||||
|
|
||||||
const [selectedTab, setSelectedTab] = useState<'live' | 'purchase'>('live');
|
const [selectedTab, setSelectedTab] = useState<'live' | 'purchase'>('live');
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ import colors from '../../../Constant/Color';
|
|||||||
import { SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_B, SUBMIT_ENVELOPE_FILE_A, SUBMIT_ENVELOPE_FILE_B } from '../../../Services/BBPS/ApiUrls';
|
import { SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_B, SUBMIT_ENVELOPE_FILE_A, SUBMIT_ENVELOPE_FILE_B } from '../../../Services/BBPS/ApiUrls';
|
||||||
import { CheckSquare, Square } from 'lucide-react-native';
|
import { CheckSquare, Square } from 'lucide-react-native';
|
||||||
import { apiCall } from '../../../Axios/Axios';
|
import { apiCall } from '../../../Axios/Axios';
|
||||||
|
|
||||||
import axios from 'axios';
|
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
import EnvelopeCExcelPreview from '../Component/EnvelopeCExcelPreview';
|
import EnvelopeCExcelPreview from '../Component/EnvelopeCExcelPreview';
|
||||||
|
|
||||||
type EnvelopeType = 'A' | 'B' | 'C';
|
type EnvelopeType = 'A' | 'B' | 'C';
|
||||||
@@ -43,8 +40,6 @@ interface InfoRowProps {
|
|||||||
const TenderBidding = () => {
|
const TenderBidding = () => {
|
||||||
const route = useRoute<any>();
|
const route = useRoute<any>();
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
const token = useSelector((state: any) => state.token.token);
|
|
||||||
|
|
||||||
const [bidData] = useState<any>(route.params?.tenderData || null);
|
const [bidData] = useState<any>(route.params?.tenderData || null);
|
||||||
const tenderData: any = route.params?.bidData || null;
|
const tenderData: any = route.params?.bidData || null;
|
||||||
const [activeEnvelope, setActiveEnvelope] = useState<EnvelopeType>('A');
|
const [activeEnvelope, setActiveEnvelope] = useState<EnvelopeType>('A');
|
||||||
@@ -54,18 +49,13 @@ const TenderBidding = () => {
|
|||||||
C: {},
|
C: {},
|
||||||
});
|
});
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [loadingUpload, setLoadingUpload] = useState(false)
|
|
||||||
const [check, setCheck] = useState(false)
|
const [check, setCheck] = useState(false)
|
||||||
const [uploadFileResponse, setUploadFileResponse] = useState<any>(null);
|
|
||||||
|
|
||||||
|
|
||||||
const InfoRow = ({ title, value }: InfoRowProps) => (
|
const InfoRow = ({ title, value }: InfoRowProps) => (
|
||||||
<View style={styles.infoRow}>
|
<View style={styles.infoRow}>
|
||||||
<Text style={styles.label}>{title}</Text>
|
<Text style={styles.label}>{title}</Text>
|
||||||
<Text style={styles.value}>{value || '-'}</Text>
|
<Text style={styles.value}>{value || '-'}</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
const EnvelopeButton = ({ title, envelopeType, onPress }: EnvelopeButtonProps & { envelopeType: EnvelopeType }) => (
|
const EnvelopeButton = ({ title, envelopeType, onPress }: EnvelopeButtonProps & { envelopeType: EnvelopeType }) => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
@@ -80,8 +70,6 @@ const TenderBidding = () => {
|
|||||||
<Text style={styles.envelopeButtonText}>{title}</Text>
|
<Text style={styles.envelopeButtonText}>{title}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const handleEnvelopeChange = (
|
const handleEnvelopeChange = (
|
||||||
envelopeType: EnvelopeType,
|
envelopeType: EnvelopeType,
|
||||||
sequenceId: number,
|
sequenceId: number,
|
||||||
@@ -95,7 +83,6 @@ const TenderBidding = () => {
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const pickPdf = async (
|
const pickPdf = async (
|
||||||
envelopeType: EnvelopeType,
|
envelopeType: EnvelopeType,
|
||||||
sequenceId: number
|
sequenceId: number
|
||||||
@@ -116,8 +103,6 @@ const TenderBidding = () => {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const renderEnvelopeItem = ({
|
const renderEnvelopeItem = ({
|
||||||
item,
|
item,
|
||||||
envelopeType,
|
envelopeType,
|
||||||
@@ -137,22 +122,13 @@ const TenderBidding = () => {
|
|||||||
const showInput =
|
const showInput =
|
||||||
activeEnvelope === envelopeType &&
|
activeEnvelope === envelopeType &&
|
||||||
!bidData?.[`envelope${envelopeType}SubmittStatus`];
|
!bidData?.[`envelope${envelopeType}SubmittStatus`];
|
||||||
|
|
||||||
// console.log("tender ana : ", tenderData)
|
|
||||||
return (
|
return (
|
||||||
<View key={sequenceId}>
|
<View key={sequenceId}>
|
||||||
<View style={styles.envelopeItem}>
|
<View style={styles.envelopeItem}>
|
||||||
<View style={{ flexDirection: 'row', gap: 20 }}>
|
<View style={{ flexDirection: 'row', gap: 20 }}>
|
||||||
{/* <Text style={styles.label}>Label Name</Text> */}
|
|
||||||
<Text style={styles.value}>{labelName || '-'}</Text>
|
<Text style={styles.value}>{labelName || '-'}</Text>
|
||||||
{item?.[`labelMandatory${activeEnvelope}`] && <Text style={{ color: validateEnvelope() ? 'gray' : 'red', }}>*</Text>}
|
{item?.[`labelMandatory${activeEnvelope}`] && <Text style={{ color: validateEnvelope() ? 'gray' : 'red', }}>*</Text>}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* <View>
|
|
||||||
<Text style={styles.label}>Label Type</Text>
|
|
||||||
<Text style={styles.value}>{labelType || '-'}</Text>
|
|
||||||
</View> */}
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{showInput ? (
|
{showInput ? (
|
||||||
@@ -227,7 +203,6 @@ const TenderBidding = () => {
|
|||||||
|
|
||||||
return hasA || hasB;
|
return hasA || hasB;
|
||||||
};
|
};
|
||||||
|
|
||||||
const digitToWordMap: Record<string, string> = {
|
const digitToWordMap: Record<string, string> = {
|
||||||
'0': 'Zero',
|
'0': 'Zero',
|
||||||
'1': 'One',
|
'1': 'One',
|
||||||
@@ -240,14 +215,12 @@ const TenderBidding = () => {
|
|||||||
'8': 'Eight',
|
'8': 'Eight',
|
||||||
'9': 'Nine',
|
'9': 'Nine',
|
||||||
};
|
};
|
||||||
|
|
||||||
const convertDigitsToWords = (value: string): string => {
|
const convertDigitsToWords = (value: string): string => {
|
||||||
return value
|
return value
|
||||||
.split('')
|
.split('')
|
||||||
.map(digit => digitToWordMap[digit] || '')
|
.map(digit => digitToWordMap[digit] || '')
|
||||||
.join(' ') || value;
|
.join(' ') || value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildEnvelopePayload = () => {
|
const buildEnvelopePayload = () => {
|
||||||
|
|
||||||
const list =
|
const list =
|
||||||
@@ -319,7 +292,6 @@ const TenderBidding = () => {
|
|||||||
? fileData
|
? fileData
|
||||||
: saveData,
|
: saveData,
|
||||||
};
|
};
|
||||||
// console.log("payload : ", payload)
|
|
||||||
return payload;
|
return payload;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -334,13 +306,9 @@ const TenderBidding = () => {
|
|||||||
const value = formValues?.[seqId];
|
const value = formValues?.[seqId];
|
||||||
|
|
||||||
if (!isMandatory) return false;
|
if (!isMandatory) return false;
|
||||||
|
|
||||||
// File upload
|
|
||||||
if (item[`labelType${activeEnvelope}`] === '3') {
|
if (item[`labelType${activeEnvelope}`] === '3') {
|
||||||
return !value;
|
return !value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text / numeric
|
|
||||||
return !value || value.toString().trim() === '';
|
return !value || value.toString().trim() === '';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -353,30 +321,29 @@ const TenderBidding = () => {
|
|||||||
Alert.alert('Validation Error', 'Please fill all mandatory fields');
|
Alert.alert('Validation Error', 'Please fill all mandatory fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = buildEnvelopePayload();
|
const payload = buildEnvelopePayload();
|
||||||
console.log('Envelope A Payload:', payload);
|
|
||||||
setLoading(true)
|
|
||||||
if (envelopForm?.[activeEnvelope]?.[3]) {
|
if (envelopForm?.[activeEnvelope]?.[3]) {
|
||||||
handleSubmitEnvelopeFile(SUBMIT_ENVELOPE_FILE_A)
|
const result = await handleSubmitEnvelopeFile(SUBMIT_ENVELOPE_FILE_A)
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
|
|
||||||
const res = await apiCall('post', SUBMIT_ENVELOPE_A, payload) as any
|
if (result && result?.statusCode === 200) {
|
||||||
console.log("res A envelop : ", res)
|
try {
|
||||||
ToastAndroid.show(res?.message, ToastAndroid.SHORT)
|
const res = await apiCall('post', SUBMIT_ENVELOPE_A, payload) as any
|
||||||
|
|
||||||
|
if (res?.statusCode === 200) {
|
||||||
navigation.goBack()
|
navigation.goBack()
|
||||||
} catch (error) {
|
ToastAndroid.show(res.message, ToastAndroid.SHORT)
|
||||||
console.log("error A envelop submit : ", error)
|
}
|
||||||
} finally {
|
} catch (error) {
|
||||||
setLoading(false)
|
console.log("error A envelop submit : ", error)
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setLoading(false)
|
||||||
|
Alert.alert('Error', 'File upload failed. Please try again.')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleSubmitEnvelopeB = async () => {
|
const handleSubmitEnvelopeB = async () => {
|
||||||
if (!validateEnvelope()) {
|
if (!validateEnvelope()) {
|
||||||
Alert.alert('Validation Error', 'Please fill all mandatory fields');
|
Alert.alert('Validation Error', 'Please fill all mandatory fields');
|
||||||
@@ -405,25 +372,16 @@ const TenderBidding = () => {
|
|||||||
Alert.alert('Error', 'File upload failed. Please try again.')
|
Alert.alert('Error', 'File upload failed. Please try again.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmitEnvelopeFile = async (url: string) => {
|
const handleSubmitEnvelopeFile = async (url: string) => {
|
||||||
console.log("url :: ", url)
|
|
||||||
|
|
||||||
const payload = buildEnvelopePayload();
|
const payload = buildEnvelopePayload();
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
console.log("envelop form : ", envelopForm)
|
const fileDetail: any = envelopForm?.[activeEnvelope]?.[3]
|
||||||
|
|
||||||
formData.append('files', {
|
formData.append('files', {
|
||||||
uri: envelopForm?.[activeEnvelope]?.[3].uri,
|
uri: fileDetail.uri,
|
||||||
name: envelopForm?.[activeEnvelope]?.[3].name,
|
name: fileDetail.name,
|
||||||
type: envelopForm?.[activeEnvelope]?.[3].type,
|
type: fileDetail.type,
|
||||||
});
|
});
|
||||||
// formData.append('requestDto', payload)
|
|
||||||
formData.append('requestDto', JSON.stringify(payload))
|
formData.append('requestDto', JSON.stringify(payload))
|
||||||
console.log("formdata : ", formData)
|
console.log("formdata : ", formData)
|
||||||
|
|
||||||
@@ -557,9 +515,10 @@ const TenderBidding = () => {
|
|||||||
handleSubmitEnvelopeB();
|
handleSubmitEnvelopeB();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
// disabled={loading}
|
||||||
>
|
>
|
||||||
<Text style={styles.primaryButtonText}>
|
<Text style={styles.primaryButtonText}>
|
||||||
{loading ? 'Submitting...' : `Submit Bid (${activeEnvelope})`}
|
{loading ? <ActivityIndicator size={'small'} color={'#fff'} /> : `Submit Bid (${activeEnvelope})`}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
+30
-10
@@ -53,10 +53,30 @@ export const useFetchPurchaseTender = () => {
|
|||||||
|
|
||||||
|
|
||||||
export const useFetchLiveTender = () => {
|
export const useFetchLiveTender = () => {
|
||||||
return useQuery({
|
|
||||||
queryKey: ['fetchLiveTender',],
|
return useInfiniteQuery({
|
||||||
queryFn: () => fetchLiveTender()
|
queryKey: ['fetchLiveTender'],
|
||||||
});
|
queryFn: ({ pageParam = 0 }) => fetchLiveTender({
|
||||||
|
page: pageParam,
|
||||||
|
size: 10
|
||||||
|
}),
|
||||||
|
initialPageParam: 0,
|
||||||
|
getNextPageParam: (lastPage, allPages) => {
|
||||||
|
const { totalCount } = lastPage;
|
||||||
|
console.log("last page : ", lastPage)
|
||||||
|
console.log("all pages : ", allPages)
|
||||||
|
const totalPages = Math.ceil(totalCount / 10);
|
||||||
|
const nextPage = allPages.length;
|
||||||
|
return nextPage < totalPages ? nextPage : undefined;
|
||||||
|
},
|
||||||
|
|
||||||
|
select: (data) => ({
|
||||||
|
...data,
|
||||||
|
result: data.pages.flatMap(
|
||||||
|
(page: any) => page?.data ?? []
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useFetchPurchaseAuction = () => {
|
export const useFetchPurchaseAuction = () => {
|
||||||
@@ -142,11 +162,11 @@ export const useOfflineTenderPurchase = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useFetchTenderById = (tenderId: string) => {
|
export const useFetchTenderById = (tenderId: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['fetchTenderById', tenderId],
|
queryKey: ['fetchTenderById', tenderId],
|
||||||
queryFn: () => fetchTenderById(tenderId),
|
queryFn: () => fetchTenderById(tenderId),
|
||||||
enabled: !!tenderId, // prevents running with undefined id
|
enabled: !!tenderId, // prevents running with undefined id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export const useProceedToBid = (tenderId?: string) => {
|
export const useProceedToBid = (tenderId?: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
@@ -306,7 +326,7 @@ export const useTenderDetails = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useFetchLiveTenderById = (tenderId:number) => {
|
export const useFetchLiveTenderById = (tenderId: number) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['fetchLiveTenderById', tenderId],
|
queryKey: ['fetchLiveTenderById', tenderId],
|
||||||
queryFn: () => fetchLiveTenderById(tenderId)
|
queryFn: () => fetchLiveTenderById(tenderId)
|
||||||
|
|||||||
@@ -125,10 +125,14 @@ export const fetchPurchaseTender = async ({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const fetchLiveTender = async (): Promise<any> => {
|
export const fetchLiveTender = async ({page, size}:{page:number, size:number}): Promise<any> => {
|
||||||
const data = await apiCall<any>('get', `${LIVE_TENDER}`);
|
console.log("page : ", page)
|
||||||
|
console.log("size : ", size)
|
||||||
|
const data = await apiCall<any>('get', `${LIVE_TENDER}?page=${page}&size=${size}`);
|
||||||
|
console.log("data : ", data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchTenderById = async (tenderId: string): Promise<any> => {
|
export const fetchTenderById = async (tenderId: string): Promise<any> => {
|
||||||
const data = await apiCall<any>(
|
const data = await apiCall<any>(
|
||||||
'get',
|
'get',
|
||||||
|
|||||||
Reference in New Issue
Block a user