diff --git a/src/Axios/Axios.ts b/src/Axios/Axios.ts index 0dc18bd..9a3a410 100644 --- a/src/Axios/Axios.ts +++ b/src/Axios/Axios.ts @@ -22,7 +22,12 @@ console.log("api payload", data) 'Content-Type': contentType || 'application/json', }, }); -console.log("api response",response) + console.log("method : ", method) + console.log("url : ", url) + console.log("params : ", params) + console.log("data : ", data) + + return response.data; } catch (error: any) { const errorMessage = error?.response?.data?.error; diff --git a/src/Constant/NavigationString.tsx b/src/Constant/NavigationString.tsx index ce1f201..cb1f9d5 100644 --- a/src/Constant/NavigationString.tsx +++ b/src/Constant/NavigationString.tsx @@ -21,7 +21,6 @@ const NavigationString = { LiveTenderDetail:'LiveTenderDetail', AuctionDetail: 'AuctionDetail', Profile:'Profile', - ViewTenderDetail:'ViewTenderDetail', ResetPassword:'ResetPassword', KycWebViewScreen:'KycWebViewScreen', StageThreeScreen:'StageThree' diff --git a/src/Navigation/MainStack.jsx b/src/Navigation/MainStack.jsx index 52d99a2..95a4619 100644 --- a/src/Navigation/MainStack.jsx +++ b/src/Navigation/MainStack.jsx @@ -45,8 +45,7 @@ export default function MainStack() { - - + diff --git a/src/Screens/Tender/LiveTender.tsx b/src/Screens/Tender/LiveTender.tsx index 0c56324..035c6b7 100644 --- a/src/Screens/Tender/LiveTender.tsx +++ b/src/Screens/Tender/LiveTender.tsx @@ -73,8 +73,6 @@ const LiveTender = () => { if (isLoading) { return ; } - - console.log("data live : ", data ) return ( { }} placeholder="Search...." /> diff --git a/src/Screens/Tender/ProceedToBidDetail.tsx b/src/Screens/Tender/ProceedToBidDetail.tsx index 40bb383..958b72e 100644 --- a/src/Screens/Tender/ProceedToBidDetail.tsx +++ b/src/Screens/Tender/ProceedToBidDetail.tsx @@ -265,8 +265,7 @@ const ProceedToBidDetail = () => { ) : - // One time bidding is completed - null + One time bidding is completed } diff --git a/src/Screens/Tender/ProceedToPurTender.tsx b/src/Screens/Tender/ProceedToPurTender.tsx index 73608b8..e79b413 100644 --- a/src/Screens/Tender/ProceedToPurTender.tsx +++ b/src/Screens/Tender/ProceedToPurTender.tsx @@ -3,17 +3,19 @@ import { View, Text, FlatList, StyleSheet, TouchableOpacity, Alert } from 'react import { InsideHeader, Loader } from '../../Component/Index'; import colors from '../../Constant/Color'; import { CreditCard, Calendar, User, DollarSign, ArrowRight } from 'lucide-react-native'; -import { useSelector } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { useOfflineTenderPurchase } from '../../Services/BBPS/Hooks'; import { StackActions, useNavigation } from '@react-navigation/native'; import NavigationString from '../../Constant/NavigationString'; import { showErrorAlert, showToast } from '../../Constant/ShowDailog'; +import { clearPurchaseTender } from '../../Redux/Slices/SelectedPurchaseTender'; const ProceedToPurTender = () => { const navigation: any = useNavigation(); + const Dispatch = useDispatch() const [loading, setLoading] = useState(false); const SelectedPurchaseList = useSelector((state: any) => state.selectPurchaseTender); - + const { mutate, isPending } = useOfflineTenderPurchase() const calculateTotalAmount = (item: any) => { const gstAmount = @@ -28,14 +30,14 @@ const ProceedToPurTender = () => { const handleOfflinePurchase = async () => { const orderNo = `ORD${Date.now()}`; const body = { - tenderDetails: SelectedPurchaseList.map((item: any, index:number) => ({ + tenderDetails: SelectedPurchaseList.map((item: any, index: number) => ({ gst: item.gst, regId: item.regId || 0, deptId: item.deptId || 1, gstAmount: item.gst / 100, payableAmount: calculateTotalAmount(item), portalCharge: item.portalCharge, - tenderFees: item.documentFees, + tenderFees: item.documentFees, tenderId: item.tenderId, tenderNumber: item.tenderNumber, tenderStatus: item.tenderStatus ?? "", @@ -53,9 +55,13 @@ const ProceedToPurTender = () => { mutate(body, { onSuccess: (res) => { console.log(res, '---------------------purchsase response'); - if(res.statusCode === 200 ){ - showToast(res.message); - navigation.dispatch(StackActions.pop(2)); + if (res.statusCode === 200) { + showToast(res.message); + navigation.dispatch(StackActions.pop(2)); + Dispatch( + clearPurchaseTender() + ); + } }, onError: (error) => { @@ -124,7 +130,7 @@ const ProceedToPurTender = () => { item.tenderId.toString()} + keyExtractor={(item) => item?.tenderId?.toString()} contentContainerStyle={styles.container} /> diff --git a/src/Screens/Tender/ViewTenderDetail.tsx b/src/Screens/Tender/ViewTenderDetail.tsx deleted file mode 100644 index 34be432..0000000 --- a/src/Screens/Tender/ViewTenderDetail.tsx +++ /dev/null @@ -1,633 +0,0 @@ -import { ScrollView, StyleSheet, Text, View, TouchableOpacity, SafeAreaView, Alert } from 'react-native' -import React from 'react' -import { InsideHeader } from '../../Component/Index' -import colors from '../../Constant/Color' -import { useFetchLiveTenderById, useFetchTenderBidDetailById, useFetchTenderById } from '../../Services/BBPS/Hooks' -import { useRoute } from '@react-navigation/native' -import { - Mail, - FileText, - CheckCircle, - AlertCircle, - Briefcase, - Calendar, - Download, - Folder, - Hash, - Receipt, - IndianRupee, - Building, - Tag, - Settings, - PlayCircle, - Square, - Type, - SpellCheck, - File, - Circle, - ArrowLeft, - FileSpreadsheet -} from 'lucide-react-native' -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 = useRoute() - console.log("jjo",route?.params?.tenderId) - const { data: tenderResponse }: any = useFetchLiveTenderById(route?.params?.tenderId); - 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) - const formatDate = (dateArray: any) => { - if (!dateArray) return "N/A"; - const [year, month, day, hour, minute] = dateArray; - return `${day.toString().padStart(2, '0')}/${month.toString().padStart(2, '0')}/${year} ${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`; - }; - - const getLabelTypeText = (type: any) => { - switch (type) { - case 1: return "Text"; - case 2: return "Number"; - case 3: return "Document"; - case 4: return "Currency"; - default: return "Unknown"; - } - }; - - const renderInfoCard = (title: string, value: string, IconComponent: any) => ( - - - - {title} - - {value || "N/A"} - - ); - - const handleDownload = async (doc: any) => { - console.log("doc details : ", doc) - try { - const { dirs } = ReactNativeBlobUtil.fs; - const path = `${dirs.DownloadDir}/${doc?.documentFileName}.pdf`; - const downloadUrl = `${GET_DOCID}${doc?.docEnvelopeSeqId}`; - console.log("download url : ", downloadUrl) - const response = await ReactNativeBlobUtil.config({ - fileCache: true, - addAndroidDownloads: { - useDownloadManager: true, - notification: true, - path, - mime: 'application/pdf', - title: `${doc?.documentFileName}.pdf`, - description: 'Downloading document', - mediaScannable: true, - }, - }).fetch('GET', downloadUrl, { - Authentication:`Bearer ${Token?.token}`, - Accept: 'application/pdf', - }); - - const stat = await ReactNativeBlobUtil.fs.stat(path); - console.log('File size:', stat.size); - console.log("start : ", stat) - showSuccessAlert(`Download complete `); - console.log("file response : ", response) - } catch (error: any) { - Alert.alert('Error', error?.message || 'Something went wrong while downloading.'); - } - }; - - const renderEnvelopeSection = (title: string, data: any, isDocument = false) => { - if (!data || data.length === 0) return null; - - return ( - - - - {title} - - {data&& data.map((item: any, index: number) => ( - - - - {item.labelNameA || item.labelNameB || "Document"} - - {item.labelMandatoryA || item.labelMandatoryB ? ( - Required - ) : null} - - - {item.fieldValue && ( - - - {item.fieldValue} - - )} - - {item.fieldValueInWord && ( - - - {item.fieldValueInWord} - - )} - - {item.documentFileName && ( - handleDownload(item)}> - - {item.documentFileName} - - - )} - - - ))} - - ); - }; - - return ( - - - - - - {/* Status Banner */} - - {data?.status === "Success" ? ( - - ) : ( - - )} - - {data?.message} - Status: {data?.status} - - - - {/* Tender Overview */} - - - - Tender Overview - - - - - {renderInfoCard("Tender No.", data?.data?.tenderNumber, Hash)} - - - {renderInfoCard("NIT No.", data?.data?.nitNo, Receipt)} - {renderInfoCard("EMD Amount", `₹${data?.data?.emdInFig}`, IndianRupee)} - - - {renderInfoCard("PAC Value", `₹${data?.data?.pacValue}`, Building)} - {renderInfoCard("Type", data?.data?.typesOfTender, Tag)} - - - - {/* Work Description */} - - - - Work Description - - {data?.data?.nameofWork} - - - {/* Timeline */} - - - - Timeline - - - - - Start Date - - {formatDate(data?.data?.submittedStartDate)} - - - - - - - End Date - - {formatDate(data?.data?.submittedEndDate)} - - - - - - {/* Bid Options */} - - - - Bid Options - - - - Bid Withdrawal - {data?.data?.bidWithdraw} - - - Re-Bid - {data?.data?.reBid} - - - - - - {/* Envelope Sections */} - {data?.data?.showEA && renderEnvelopeSection("Envelope A", data?.data?.tenderEnvelopeAList)} - {data?.data?.showEB && renderEnvelopeSection("Envelope B", data?.data?.tenderEnvelopeBList)} - - {/* Envelope C - Document Section */} - {data?.data?.showEC && data?.data?.tenderEnvelopeCViewBidResDTO && ( - - - - Envelope C - - {data?.data?.tenderEnvelopeCViewBidResDTO.map((item: any, index: number) => ( - - - - - - {item.documentFileName || "Document"} - - {/* Department User ID: {item.deptUserId} */} - - {item?.documentFileName && ( - - {/* */} - - )} - - - - - ))} - - )} - - {/* Envelope Status Indicators */} - - - - - Envelope A - - - - Envelope B - - - - Envelope C - - - - - - - ) -} - -export default ViewTenderDetail - -const styles = StyleSheet.create({ - safeArea: { - flex: 1, - backgroundColor: colors.white, - }, - container: { - flex: 1, - }, - scrollView: { - flex: 1, - }, - scrollContent: { - paddingBottom: 30, - }, - statusBanner: { - flexDirection: 'row', - alignItems: 'center', - padding: 16, - marginHorizontal: 16, - marginTop: 16, - borderRadius: 12, - backgroundColor: colors.successLight, - }, - successBanner: { - backgroundColor: colors.successLight, - }, - errorBanner: { - backgroundColor: colors.error, - }, - statusContent: { - flex: 1, - marginLeft: 12, - }, - statusTitle: { - fontSize: 14, - fontWeight: '600', - color: colors.darkText, - marginBottom: 4, - }, - statusSubtitle: { - fontSize: 12, - color: colors.gray, - }, - overviewSection: { - marginHorizontal: 16, - marginTop: 24, - }, - sectionHeader: { - flexDirection: 'row', - alignItems: 'center', - marginBottom: 20, - }, - sectionTitle: { - fontSize: 20, - fontWeight: '700', - color: colors.darkText, - marginLeft: 12, - }, - gridContainer: { - marginBottom: 20, - }, - gridRow: { - flexDirection: 'row', - justifyContent: 'space-between', - marginBottom: 12, - }, - infoCard: { - flex: 1, - backgroundColor: colors.white, - padding: 16, - borderRadius: 12, - marginHorizontal: 4, - borderWidth: 1, - borderColor: colors.lightGray, - }, - infoHeader: { - flexDirection: 'row', - alignItems: 'center', - marginBottom: 8, - }, - infoTitle: { - fontSize: 12, - fontWeight: '600', - color: colors.gray, - marginLeft: 8, - }, - infoValue: { - fontSize: 16, - fontWeight: '700', - color: colors.darkText, - }, - descriptionCard: { - backgroundColor: colors.white, - padding: 16, - borderRadius: 12, - borderWidth: 1, - borderColor: colors.lightGray, - marginBottom: 16, - }, - descriptionText: { - fontSize: 14, - color: colors.darkText, - lineHeight: 20, - marginTop: 8, - }, - timelineCard: { - backgroundColor: colors.white, - padding: 16, - borderRadius: 12, - borderWidth: 1, - borderColor: colors.lightGray, - marginBottom: 16, - }, - timelineRow: { - flexDirection: 'row', - alignItems: 'center', - marginTop: 12, - }, - timelineItem: { - flex: 1, - marginLeft: 12, - }, - timelineLabel: { - fontSize: 12, - color: colors.gray, - marginBottom: 4, - }, - timelineValue: { - fontSize: 14, - fontWeight: '600', - color: colors.darkText, - }, - optionsCard: { - backgroundColor: colors.primaryLight, - padding: 16, - borderRadius: 12, - borderWidth: 1, - borderColor: colors.lightGray, - marginBottom: 24, - }, - optionsGrid: { - flexDirection: 'row', - justifyContent: 'space-between', - marginTop: 12, - }, - optionBadge: { - flex: 1, - alignItems: 'center', - paddingVertical: 12, - borderRadius: 8, - marginHorizontal: 4, - }, - allowedBadge: { - backgroundColor: colors.successLight, - borderWidth: 1, - borderColor: colors.success, - }, - notAllowedBadge: { - backgroundColor: colors.error, - borderWidth: 1, - borderColor: colors.error, - }, - optionText: { - fontSize: 12, - color: colors.gray, - marginBottom: 4, - }, - optionStatus: { - fontSize: 14, - fontWeight: '700', - }, - envelopeSection: { - marginHorizontal: 16, - marginTop: 24, - }, - envelopeItem: { - backgroundColor: colors.white, - padding: 16, - borderRadius: 12, - borderWidth: 1, - borderColor: colors.lightGray, - marginBottom: 12, - }, - envelopeHeader: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom:8, - }, - labelName: { - fontSize: 16, - fontWeight: '700', - color: colors.primary, - }, - mandatoryTag: { - fontSize: 12, - fontWeight: '600', - color: colors.error, - backgroundColor: colors.primaryHighlight, - paddingHorizontal: 8, - paddingVertical: 4, - borderRadius: 6, - }, - fieldRow: { - flexDirection: 'row', - alignItems: 'center', - marginTop: 4, - }, - fieldValue: { - fontSize: 14, - color: colors.darkText, - marginLeft: 8, - flex: 1, - }, - fieldValueInWord: { - fontSize: 13, - color: colors.gray, - fontStyle: 'italic', - marginLeft: 8, - flex: 1, - }, - documentButton: { - flexDirection: 'row', - alignItems: 'center', - backgroundColor: colors.primary, - padding: 12, - borderRadius: 8, - marginTop: 12, - }, - documentText: { - flex: 1, - fontSize: 14, - color: colors.white, - marginLeft: 12, - marginRight: 8, - }, - metaInfo: { - flexDirection: 'row', - justifyContent: 'space-between', - marginTop: 12, - paddingTop: 12, - borderTopWidth: 1, - borderTopColor: colors.lightGray, - }, - metaText: { - fontSize: 12, - color: colors.gray, - }, - documentCard: { - flexDirection: 'row', - alignItems: 'center', - backgroundColor: colors.white, - padding: 16, - borderRadius: 12, - borderWidth: 1, - borderColor: colors.lightGray, - marginBottom: 12, - }, - documentInfo: { - flex: 1, - marginLeft: 16, - }, - documentName: { - fontSize: 14, - fontWeight: '600', - color: colors.darkText, - marginBottom: 4, - }, - documentMeta: { - fontSize: 12, - color: colors.gray, - }, - downloadButton: { - padding: 8, - }, - envelopeStatusSection: { - marginHorizontal: 16, - marginTop: 24, - marginBottom: 30, - }, - statusGrid: { - flexDirection: 'row', - justifyContent: 'space-around', - }, - statusIndicator: { - alignItems: 'center', - }, - statusDot: { - width: 12, - height: 12, - borderRadius: 6, - marginBottom: 8, - }, - activeDot: { - backgroundColor: colors.success, - }, - inactiveDot: { - backgroundColor: colors.gray, - }, - statusText: { - fontSize: 12, - color: colors.gray, - }, -}) \ No newline at end of file diff --git a/src/Screens/Tender/tenderBidding/TenderBidding.tsx b/src/Screens/Tender/tenderBidding/TenderBidding.tsx index f2faf68..afec5ce 100644 --- a/src/Screens/Tender/tenderBidding/TenderBidding.tsx +++ b/src/Screens/Tender/tenderBidding/TenderBidding.tsx @@ -41,21 +41,22 @@ interface InfoRowProps { const TenderBidding = () => { const route = useRoute(); const navigation = useNavigation(); - - + console.log("-=-=-=-=-=", route) + + console.log("ROUTE DATA", route) + + const tenderId = useState(route.params?.tenderId || null); + + const { data: tenderResponse, refetch: tenderRefetch }: any = useFetchTenderById(route.params?.tenderId); - const tenderId = useState(route.params?.tenderId || null); + const bidData = tenderResponse?.data; + console.log(" --------------1", bidData) + const { data: tender, refetch } = useProceedToBid(route.params?.tenderId); + const tenderData = tender?.data - const { data: tenderResponse, refetch: tenderRefetch }: any = useFetchTenderById(route.params?.tenderId); - - - const bidData= tenderResponse?.data; - - const { data:tender, refetch } = useProceedToBid(route.params?.tenderId); - const tenderData= tender?.data - -const [activeEnvelope, setActiveEnvelope] = useState('A'); + console.log(" --------------2", tenderData) + const [activeEnvelope, setActiveEnvelope] = useState('A'); const [envelopForm, setEnvelopForm] = useState({ A: {}, B: {}, @@ -330,17 +331,17 @@ const [activeEnvelope, setActiveEnvelope] = useState('A'); const handleSubmitEnvelopeA = async () => { - + console.log("hitting here ", envelopForm?.[activeEnvelope]) if (!validateEnvelope()) { Alert.alert('Validation Error', 'Please fill all mandatory fields'); return; } const payload = buildEnvelopePayload(); - + if (envelopForm?.[activeEnvelope]?.[3]) { const result = await handleSubmitEnvelopeFile(SUBMIT_ENVELOPE_FILE_A) - + if (result && result?.statusCode === 200) { try { const res = await apiCall('post', SUBMIT_ENVELOPE_A, payload) as any @@ -437,7 +438,7 @@ const [activeEnvelope, setActiveEnvelope] = useState('A'); } console.log("bidData : ", bidData) console.log("tender data : ", tenderData) -// console.log( `bold ${tenderData?.[`tenderEnvelope${activeEnvelope}List`]}`,tenderData?.[`tenderEnvelope${activeEnvelope}List`]) + // console.log( `bold ${tenderData?.[`tenderEnvelope${activeEnvelope}List`]}`,tenderData?.[`tenderEnvelope${activeEnvelope}List`]) return ( @@ -462,7 +463,7 @@ const [activeEnvelope, setActiveEnvelope] = useState('A'); Bid Envelopes - {tenderData?.showEA && ( + {tenderData?.showEA && ( ('A'); { - if (tenderData?.envelopeASubmittStatus) { - - setActiveEnvelope('B') - } else { - Alert.alert('Info', 'Submit Envelop A First') - } - }} + onPress={() => setActiveEnvelope('B')} /> )} {tenderData?.showEC && ( { - if(tenderData?.showEB){ if (tenderData?.envelopeBSubmittStatus ) { - setActiveEnvelope('C') - } else { - Alert.alert('Info', 'Submit Envelop B First') - }}else{ - setActiveEnvelope('C') - } - }} + onPress={() => setActiveEnvelope('C')} /> )} {/* Envelope A List */} - - - {tenderData?.[`tenderEnvelope${activeEnvelope}List`]?.length > 0 && bidData?.envelopeB_Logs === null && ( + + + {tenderData?.[`tenderEnvelope${activeEnvelope}List`]?.length > 0 && ( Envelope {activeEnvelope} Details ('A'); )} ) : ( - - - + + + )} )} - - {hasEnvelopes() && activeEnvelope !== 'C' && - !(activeEnvelope === 'A' && bidData.envelopeASubmittStatus) && - !(activeEnvelope === 'B' && bidData.envelopeBSubmittStatus) ? ( - { - if (!check) { - Alert.alert('Info', 'check first terms & condition'); - return; - } + + {hasEnvelopes() && activeEnvelope !== 'C' ? ( + { - if (activeEnvelope === 'A') { - handleSubmitEnvelopeA(); - } else if (activeEnvelope === 'B') { - handleSubmitEnvelopeB(); - } - }} - > - - {loading ? ( - - ) : ( - `Submit Bid (${activeEnvelope})` - )} - - - ) : ( - navigation.goBack()} - > - Go Back - - )} - + if (activeEnvelope === 'A') { + if (!check) { + Alert.alert('Info', 'check first terms & condition'); + return; + } + handleSubmitEnvelopeA(); + } else if (activeEnvelope === 'B') { + if (!check) { + Alert.alert('Info', 'check first terms & condition'); + return; + } + handleSubmitEnvelopeB(); + } + }} + + > + + {loading ? : `Submit Bid (${activeEnvelope})`} + + + ) : ( + navigation.goBack()} + > + Go Back + + )} + diff --git a/src/Screens/index.ts b/src/Screens/index.ts index acdb077..4e48f19 100644 --- a/src/Screens/index.ts +++ b/src/Screens/index.ts @@ -21,7 +21,6 @@ import ProceedToPurTender from "./Tender/ProceedToPurTender"; import PurchaseTenderList from "./Tender/PurchaseTenderList"; import Tender from "./Tender/Tender"; import TenderBidding from "./Tender/tenderBidding/TenderBidding"; -import ViewTenderDetail from "./Tender/ViewTenderDetail"; const Screens = { @@ -45,7 +44,6 @@ const Screens = { Partnership, LiveTenderDetail, ProfileTab, - ViewTenderDetail, ResetPassword, KycWebViewScreen, StageThreeScreen diff --git a/src/Services/BBPS/apis.ts b/src/Services/BBPS/apis.ts index 98dc496..4a2966f 100644 --- a/src/Services/BBPS/apis.ts +++ b/src/Services/BBPS/apis.ts @@ -400,9 +400,6 @@ export const uploadEnvelopeFile = async ({ return data } - - - export const tenderDetails = async (tenderId:any ): Promise => { const data = await apiCall('get', `${GET_TENDER_DETAILS}${tenderId}`, ); return data