diff --git a/package-lock.json b/package-lock.json index 8b11548..1cad35f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@react-native-community/blur": "^4.4.1", "@react-native-documents/picker": "^11.0.3", "@react-native-masked-view/masked-view": "^0.3.2", + "@react-native-vector-icons/fontisto": "^12.4.0", "@react-navigation/bottom-tabs": "^7.9.0", "@react-navigation/native": "^7.1.26", "@react-navigation/stack": "^7.6.13", @@ -3233,6 +3234,132 @@ "react-native": ">=0.57" } }, + "node_modules/@react-native-vector-icons/common": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/@react-native-vector-icons/common/-/common-12.4.0.tgz", + "integrity": "sha512-t9W0q+AW7WH1Oj5aEg7wGNXDLZJb5sIVkAWo5qtad3PcbBADqoCdikRK/ToLK+xlB0TxjcuL0T74ogudMkYGeA==", + "license": "MIT", + "dependencies": { + "find-up": "^7.0.0", + "picocolors": "^1.1.1", + "plist": "^3.1.0" + }, + "bin": { + "rnvi-update-plist": "lib/commonjs/scripts/updatePlist.js" + }, + "engines": { + "node": ">=20.19.0 <21.0.0 || >=22.0.0" + }, + "peerDependencies": { + "@react-native-vector-icons/get-image": "^12.3.0", + "react": "*", + "react-native": "*" + }, + "peerDependenciesMeta": { + "@react-native-vector-icons/get-image": { + "optional": true + } + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/find-up": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz", + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", + "license": "MIT", + "dependencies": { + "locate-path": "^7.2.0", + "path-exists": "^5.0.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/@react-native-vector-icons/common/node_modules/yocto-queue": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz", + "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==", + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@react-native-vector-icons/fontisto": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/@react-native-vector-icons/fontisto/-/fontisto-12.4.0.tgz", + "integrity": "sha512-0XFOXDTV03Lvz7d0LmzNtvt7BgAupmUcv4HzVdtSccQ9Ak4lmLeBnO6kbP1v4iqcrsATR1xPrhQxTWWIJ90oFQ==", + "license": "MIT", + "dependencies": { + "@react-native-vector-icons/common": "^12.4.0" + }, + "engines": { + "node": ">= 18.0.0" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/@react-native/assets-registry": { "version": "0.79.0", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.79.0.tgz", @@ -4576,6 +4703,15 @@ "devOptional": true, "license": "MIT" }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz", + "integrity": "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -11375,6 +11511,20 @@ "node": ">=8" } }, + "node_modules/plist": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.8.8", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=10.4.0" + } + }, "node_modules/possible-typed-array-names": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", @@ -13708,6 +13858,18 @@ "node": ">=4" } }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -14056,6 +14218,15 @@ "async-limiter": "~1.0.0" } }, + "node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "license": "MIT", + "engines": { + "node": ">=8.0" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 3c6f30e..f1e6dfd 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@react-native-community/blur": "^4.4.1", "@react-native-documents/picker": "^11.0.3", "@react-native-masked-view/masked-view": "^0.3.2", + "@react-native-vector-icons/fontisto": "^12.4.0", "@react-navigation/bottom-tabs": "^7.9.0", "@react-navigation/native": "^7.1.26", "@react-navigation/stack": "^7.6.13", diff --git a/src/Constant/Color.tsx b/src/Constant/Color.tsx index 7f2a093..a936d45 100644 --- a/src/Constant/Color.tsx +++ b/src/Constant/Color.tsx @@ -7,6 +7,7 @@ const colors = { // Secondary (Warm contrast) secondary: '#1B4B66', // Deep blue for balance secondaryLight: '#639599', // Muted blue + secondaryHighLight: '#e1eff2', // Very light blue (backgrounds) // Status colors success: '#22C55E', // Green diff --git a/src/Constant/NavigationString.tsx b/src/Constant/NavigationString.tsx index bd702db..7dbfa19 100644 --- a/src/Constant/NavigationString.tsx +++ b/src/Constant/NavigationString.tsx @@ -1,6 +1,3 @@ -import ProceedToBidDetail from "../Screens/Tender/ProceedToBidDetail" -import TenderBidding from "../Screens/Tender/tenderBidding/TenderBidding" - const NavigationString = { Login: 'Login', Splash: 'Splash', @@ -20,5 +17,6 @@ const NavigationString = { Signup:'Signup', Registration:'Registration', Partnership:'Partnership', + LiveTenderDetail:'LiveTenderDetail', } export default NavigationString \ No newline at end of file diff --git a/src/Navigation/MainStack.jsx b/src/Navigation/MainStack.jsx index 60e353c..5055307 100644 --- a/src/Navigation/MainStack.jsx +++ b/src/Navigation/MainStack.jsx @@ -45,6 +45,8 @@ export default function MainStack() { + + ); } diff --git a/src/Screens/Tender/LiveTender.tsx b/src/Screens/Tender/LiveTender.tsx index eeca2c9..3e48882 100644 --- a/src/Screens/Tender/LiveTender.tsx +++ b/src/Screens/Tender/LiveTender.tsx @@ -57,8 +57,8 @@ const LiveTender = () => { tenderOfWork={item.departmentName} tenderFees={item.documentFees} tenderNumber={item.tenderNumber} - onPurchasePress={() => { Dispatch(togglePurchaseTender(item)) }} - onDetailsPress={() => { }} + // onPurchasePress={() => { Dispatch(togglePurchaseTender(item)) }} + // onDetailsPress={() => navigation.navigate('LiveTenderDetail', {item})} /> }, [SelectedPurchaseList] diff --git a/src/Screens/Tender/LiveTenderDetail.tsx b/src/Screens/Tender/LiveTenderDetail.tsx new file mode 100644 index 0000000..5cd345a --- /dev/null +++ b/src/Screens/Tender/LiveTenderDetail.tsx @@ -0,0 +1,18 @@ +import { StyleSheet, Text, View } from 'react-native' +import React from 'react' +import { useRoute } from '@react-navigation/native'; + +const LiveTenderDetail = () => { + const route = useRoute(); + const { tender } = route.params; + console.log("live tender details : ", tender) + return ( + + LiveTenderDetail + + ) +} + +export default LiveTenderDetail + +const styles = StyleSheet.create({}) \ No newline at end of file diff --git a/src/Screens/Tender/LiveTenderTile.tsx b/src/Screens/Tender/LiveTenderTile.tsx index 71890a6..bc5104c 100644 --- a/src/Screens/Tender/LiveTenderTile.tsx +++ b/src/Screens/Tender/LiveTenderTile.tsx @@ -6,6 +6,7 @@ import { LiveTenderTileProps } from './types/types'; import { Calendar, Tag, Info, ArrowRight } from 'lucide-react-native'; import TenderDetail from './Modal/TenderFullDetail'; import TenderFullDetail from './Modal/TenderFullDetail'; +import { useNavigation } from '@react-navigation/native'; const LiveTenderTile: React.FC = ({ data, @@ -16,10 +17,12 @@ const LiveTenderTile: React.FC = ({ purchaseEnd, tenderFees, tenderNumber, + onDetailsPress }) => { - const [showDetail, setShowDetail] = React.useState(false); + const navigation: any = useNavigation(); const purchaseEnded = moment().isAfter(moment(purchaseEnd, 'DD-MM-YYYY HH:mm:ss')); + console.log("live tender data : ", data) return ( {/* Status Tag */} @@ -33,7 +36,7 @@ const LiveTenderTile: React.FC = ({ setShowDetail(true)} + onPress={() => navigation.navigate('LiveTenderDetail', data)} > {/* Header */} @@ -72,7 +75,7 @@ const LiveTenderTile: React.FC = ({ {/* Action Bar */} - setShowDetail(true)}> + Details @@ -104,7 +107,7 @@ const LiveTenderTile: React.FC = ({ {/* Tender Detail Modal */} - setShowDetail(false)} /> + {/* setShowDetail(false)} /> */} ); diff --git a/src/Screens/Tender/ProceedToBidDetail.tsx b/src/Screens/Tender/ProceedToBidDetail.tsx index f937852..f981123 100644 --- a/src/Screens/Tender/ProceedToBidDetail.tsx +++ b/src/Screens/Tender/ProceedToBidDetail.tsx @@ -2,85 +2,24 @@ import { StyleSheet, Text, View, ScrollView, StatusBar, TouchableOpacity } from import React from 'react' import { InsideHeader } from '../../Component/Index' import colors from '../../Constant/Color' -import { useNavigation } from '@react-navigation/native' +import { useNavigation, useRoute } from '@react-navigation/native' +import { useProceedToBid } from '../../Services/BBPS/Hooks' const ProceedToBidDetail = () => { // Sample data based on your JSON - const navigation = useNavigation() - const tenderData = { - tenderId: 1372, - envelopeASubmittStatus: true, - envelopeBSubmittStatus: true, - envelopeCSubmittStatus: true, - envelopeA_Logs: { - logId: 314, - contractorId: 1, - activity: "Bid on Envelope A", - tenderId: 1372, - dateTime: "Fri Dec 12 13:07:44 IST 2025", - osName: "Linux", - browserName: "Chrome-142.0.0.0", - ipAddress: "192.168.5.10", - macAddress: "00:00:00:00:00:00", - logMessage: "Envelope A bidding is Submitted", - headingMsg: null, - status: null, - envelope: "EA" - }, - envelopeB_Logs: { - logId: 315, - contractorId: 1, - activity: "Bid on Envelope B", - tenderId: 1372, - dateTime: "Fri Dec 12 13:08:00 IST 2025", - osName: "Linux", - browserName: "Chrome-142.0.0.0", - ipAddress: "192.168.5.10", - macAddress: "00:00:00:00:00:00", - logMessage: "Envelope B bidding is Submitted", - headingMsg: null, - status: null, - envelope: "EB" - }, - envelopeC_Logs: { - logId: 316, - contractorId: 1, - activity: "Bid on Envelope C", - tenderId: 1372, - dateTime: "Fri Dec 12 13:08:31 IST 2025", - osName: "Linux", - browserName: "Chrome-142.0.0.0", - ipAddress: "192.168.5.10", - macAddress: "00:00:00:00:00:00", - logMessage: "Envelope C bidding is Submitted", - headingMsg: "Percentage Rate Tender", - status: null, - envelope: "EC" - }, - showEB: true, - showEC: true, - showQCBS: false, - showLCS: false, - viewBid: true, - proceedtoBid: false, - tenderNumber: "TN/152", - emdInFig: "100", - tenderBidWithdraw: "Allowed", - tenderRebid: "Allowed", - nitNo: "NIT-410", - nameofWork: "Tender is created for Testing Process only", - reBid: "Allowed", - bidWithDraw: "Allowed", - envelopeType: "3", - biddingStatus: true, - tenderStages: "1", - dscStatus: false, - submittedStartDate: [2025, 3, 4, 10, 0], - submittedEndDate: [2026, 3, 4, 23, 50], - bidWithdrawStatus: true - }; + const route = useRoute() + const tenderData = route.params?.tender; + const {data, refetch} = useProceedToBid(tenderData?.tenderId); + const navigation = useNavigation() // Format date from array + + const handleStartBidding = () => { + refetch(); + if (data) { + navigation.navigate('TenderBidding', { tenderData: tenderData , bidData: data.data }); + } + } const formatDate = (dateArray: any[]) => { if (!dateArray || dateArray.length < 3) return "N/A"; const [year, month, day, hour = 0, minute = 0] = dateArray; @@ -103,39 +42,39 @@ const ProceedToBidDetail = () => { {title} - {log.envelope} + {log?.envelope} Activity: - {log.activity} + {log?.activity} Date & Time: - {log.dateTime} + {log?.dateTime} System Info: - {log.osName} / {log.browserName} + {log?.osName} / {log?.browserName} IP Address: - {log.ipAddress} + {log?.ipAddress} Status Message: - {log.logMessage} + {log?.logMessage} - {log.headingMsg && ( + {log?.headingMsg && ( Heading: - {log.headingMsg} + {log?.headingMsg} )} @@ -168,27 +107,27 @@ const ProceedToBidDetail = () => { - {tenderData.tenderNumber} - ID: {tenderData.tenderId} + {tenderData?.tenderNumber} + ID: {tenderData?.tenderId} - + - {tenderData.biddingStatus ? "Active" : "Inactive"} + {tenderData?.biddingStatus ? "Active" : "Inactive"} - {tenderData.nameofWork} + {tenderData?.nameofWork} NIT No. - {tenderData.nitNo} + {tenderData?.nitNo} EMD Amount - ₹{tenderData.emdInFig} + ₹{tenderData?.emdInFig} @@ -197,19 +136,19 @@ const ProceedToBidDetail = () => { Envelope Submission Status - - - + + + {/* Envelope Logs */} - {tenderData.envelopeA_Logs && ( + {tenderData?.envelopeA_Logs && ( Submission Logs - - - + + + )} @@ -217,11 +156,11 @@ const ProceedToBidDetail = () => { Tender Details - - - - - + + + + + @@ -231,11 +170,11 @@ const ProceedToBidDetail = () => { Starts On: - {formatDate(tenderData.submittedStartDate)} + {formatDate(tenderData?.submittedStartDate)} Ends On: - {formatDate(tenderData.submittedEndDate)} + {formatDate(tenderData?.submittedEndDate)} @@ -244,12 +183,12 @@ const ProceedToBidDetail = () => { Available Features - - - - - - + + + + + + @@ -260,41 +199,37 @@ const ProceedToBidDetail = () => { All Envelopes Submitted: - {tenderData.envelopeASubmittStatus && tenderData.envelopeBSubmittStatus && tenderData.envelopeCSubmittStatus + {tenderData?.envelopeASubmittStatus && tenderData?.envelopeBSubmittStatus && tenderData?.envelopeCSubmittStatus ? "COMPLETED" : "PENDING"} Bidding Status: - {tenderData.biddingStatus ? "ACTIVE" : "CLOSED"} + { color: tenderData?.biddingStatus ? colors.success : colors.error }]}> + {tenderData?.biddingStatus ? "ACTIVE" : "CLOSED"} - - { - navigation.navigate('TenderBidding', { tenderData: tenderData }); - }}> - Proceed to Bid - - { - // tenderData?.proceedtoBid && !tenderData?.viewBid && tenderData?.biddingStatus && tenderData?.bidWithdrawStatus === false ? ( - // { - // navigation.navigate('TenderBidding', { tenderData: tenderData }); - // }}> - // Proceed to Bid - // - // ) : One time bidding is completed - } + + + { + tenderData?.proceedtoBid && !tenderData?.viewBid && tenderData?.biddingStatus && tenderData?.bidWithdrawStatus === false ? ( + + + Start Bidding + + + ) : One time bidding is completed + } ) diff --git a/src/Screens/Tender/PurchaseTenderAllList.tsx b/src/Screens/Tender/PurchaseTenderAllList.tsx index 69072ac..59d1e0d 100644 --- a/src/Screens/Tender/PurchaseTenderAllList.tsx +++ b/src/Screens/Tender/PurchaseTenderAllList.tsx @@ -23,6 +23,8 @@ const PurchaseTenderAllList = () => { const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch }: any = useFetchPurchaseTender(); const [showRefreshBanner, setShowRefreshBanner] = useState(false); + + console.log("data for tender : ", data) useEffect(() => { if (isRefetching) { setShowRefreshBanner(true); diff --git a/src/Screens/Tender/PurchaseTenderTile.tsx b/src/Screens/Tender/PurchaseTenderTile.tsx index a3c72bd..30b79db 100644 --- a/src/Screens/Tender/PurchaseTenderTile.tsx +++ b/src/Screens/Tender/PurchaseTenderTile.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { use, useEffect } from 'react'; import { View, Text, @@ -33,21 +33,17 @@ const PurchaseTenderTile = ({ elevation: elevation.value, })); - const { data: tenderResponse, }: any = useFetchTenderById(item?.tenderId); - const tender = tenderResponse?.data; + const { data: tenderResponse, }: any = useFetchTenderById(item?.tenderId); + const tender = tenderResponse?.data; - // const { - // refetch, - // isFetching, - // isError, - // } = useProceedToBid(item?.tenderId); + // console.log("item my : ", item) - // const handleProceed = async (item: any) => { - // const res = await refetch(); - // if (res.data && !isError) { - // navigation.navigate('TenderBidding', { tenderData: res.data?.data }); - // } - // }; + { + if (item?.nitNumber == 'TN/111') { + console.log("tender item : ", item?.nitNumber) + + } + } const handlePressIn = () => { scale.value = withTiming(0.97, { duration: 120 }); @@ -59,12 +55,18 @@ const PurchaseTenderTile = ({ elevation.value = withTiming(8, { duration: 160 }); }; - const isLive = item?.liveStatus === true; + const isLive = item?.biddingStatus === true; const statusColor = isLive ? colors.primary : '#94A3B8'; const lightStatusBg = isLive ? '#EFF6FF' : '#F8FAFC'; const [showDetail, setShowDetail] = React.useState(false); + useEffect(() => { + if(item?.tenderNumber == 'TN/210'){ + console.log("tender item : ", item) + } + }, [item]); + return ( - Purchase Ends: + Bid Ends: {moment( - item?.tenderKeyDatesAmendment?.tenderPurchaseDate?.endDateTime, + item?.keydates?.bidSubmissionDate?.endDateTime, 'DD-MM-YYYY HH:mm:ss' - ).format('DD MMM, hh:mm A')} + ).format('DD MMM YYYY, hh:mm A')} @@ -121,7 +123,7 @@ const PurchaseTenderTile = ({ {isLive ? ( ) : ( @@ -133,7 +135,7 @@ const PurchaseTenderTile = ({ disabled={!isLive} onPress={() => { if (isLive) { - navigation.navigate('ProceedToBidDetail', { tender }); + navigation.navigate('ProceedToBidDetail', { tender }); } }} activeOpacity={0.85} diff --git a/src/Screens/Tender/tenderBidding/TenderBidding.tsx b/src/Screens/Tender/tenderBidding/TenderBidding.tsx index b4e10bf..efd1b74 100644 --- a/src/Screens/Tender/tenderBidding/TenderBidding.tsx +++ b/src/Screens/Tender/tenderBidding/TenderBidding.tsx @@ -15,6 +15,9 @@ import MyInput from '../../../../src/Component/MyInput'; import { pick, types } from '@react-native-documents/picker'; import { InsideHeader } from '../../../Component/Index'; 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 { Fontisto } from '@react-native-vector-icons/fontisto'; +import { apiCall } from '../../../Axios/Axios'; type EnvelopeType = 'A' | 'B' | 'C'; type EnvelopeFormState = { @@ -33,27 +36,13 @@ interface InfoRowProps { value: string; } -interface TenderBiddingData { - data?: { - tenderNumber?: string; - nitNo?: string; - emdInFig?: string; - tenderRebid?: boolean; - showEA?: boolean; - showEB?: boolean; - showEC?: boolean; - tenderEnvelopeAList?: any[]; - tenderEnvelopeBList?: any[]; - tenderEnvelopeCList?: any[]; - }; -} - const TenderBidding = () => { - const route = useRoute(); + const route = useRoute(); const navigation = useNavigation(); const [bidData] = useState(route.params?.tenderData || null); - const [activeEnvelope, setActiveEnvelope] = useState('A'); + const tenderData: any = route.params?.bidData || null; + const [activeEnvelope, setActiveEnvelope] = useState('A'); const [isLoading, setIsLoading] = useState(false); const [envelopForm, setEnvelopForm] = useState({ A: {}, @@ -63,7 +52,7 @@ const TenderBidding = () => { const [loading, setLoading] = useState(false) const [loadingUpload, setLoadingUpload] = useState(false) const [check, setCheck] = useState(false) - + const InfoRow = ({ title, value }: InfoRowProps) => ( @@ -144,7 +133,7 @@ const TenderBidding = () => { activeEnvelope === envelopeType !== 'C' && !bidData?.[`envelope${envelopeType}SubmittStatus`]; - + // console.log("tender ana : ", tenderData) return ( @@ -227,9 +216,9 @@ const TenderBidding = () => { }; const hasEnvelopes = () => { - const hasA = bidData?.tenderEnvelopeAList?.length > 0; - const hasB = bidData?.tenderEnvelopeBList?.length > 0; - // const hasC = bidData?.tenderEnvelopeCList?.length > 0; + const hasA = tenderData?.tenderEnvelopeAList?.length > 0; + const hasB = tenderData?.tenderEnvelopeBList?.length > 0; + // const hasC = tenderData?.tenderEnvelopeCList?.length > 0; return hasA || hasB; }; @@ -254,8 +243,9 @@ const TenderBidding = () => { }; const buildEnvelopePayload = () => { + const list = - bidData?.[`tenderEnvelope${activeEnvelope}List`] || []; + tenderData?.[`tenderEnvelope${activeEnvelope}List`] || []; const formValues = envelopForm?.[activeEnvelope] || {}; // 🔹 NON-FILE FIELDS (labelType !== '3') @@ -305,17 +295,17 @@ const TenderBidding = () => { }; }); - return payload = { - deptId: bidData?.deptId, - tenderId: bidData?.tenderId, + const payload: any = { + deptId: tenderData?.deptId, + tenderId: tenderData?.tenderId, [`tenderEnvelope${activeEnvelope}NameId`]: - bidData?.[`tenderEnvelope${activeEnvelope}List`]?.[0]?.[ + tenderData?.[`tenderEnvelope${activeEnvelope}List`]?.[0]?.[ `tenderEnvelope${activeEnvelope}NameId` ], [`envelope${activeEnvelope}TemplateName`]: - bidData?.[`tenderEnvelope${activeEnvelope}List`]?.[0]?.[ + tenderData?.[`tenderEnvelope${activeEnvelope}List`]?.[0]?.[ `envelope${activeEnvelope}TemplateName` ], @@ -323,12 +313,13 @@ const TenderBidding = () => { ? fileData : saveData, }; + // console.log("payload : ", payload) + return payload; }; - const validateEnvelope = () => { - const list = bidData?.[`tenderEnvelope${activeEnvelope}List`] || []; + const list = tenderData?.[`tenderEnvelope${activeEnvelope}List`] || []; const formValues = envelopForm[activeEnvelope]; const missing = list.some((item: any) => { @@ -362,10 +353,11 @@ const TenderBidding = () => { setLoading(true) if (envelopForm?.[activeEnvelope]?.[3]) { handleSubmitEnvelopeFile() + return } try { - const res = await apiCallForPostWithToken(SUBMIT_ENVELOPE_A, payload) + const res = await apiCall('post',SUBMIT_ENVELOPE_A, payload) console.log("res A envelop : ", res) ToastAndroid.show(res.message, ToastAndroid.SHORT) @@ -387,11 +379,14 @@ const TenderBidding = () => { setLoading(true) const payload = buildEnvelopePayload(); console.log('Envelope B Payload:', payload); + + if (envelopForm?.[activeEnvelope]?.[3]) { handleSubmitEnvelopeFile() + return } try { - const res = await apiCallForPostWithToken(SUBMIT_ENVELOPE_B, payload) + const res = await apiCall('post', SUBMIT_ENVELOPE_B, payload) console.log("res B envelop : ", res) ToastAndroid.show(res.message, ToastAndroid.SHORT) @@ -420,8 +415,7 @@ const TenderBidding = () => { console.log("reuestDto for fil doc : ", formData) - // return - const res = await apiCallForPostWithToken(activeEnvelope === 'B' ? SUBMIT_ENVELOPE_B : SUBMIT_ENVELOPE_A, payload) + const res = await apiCall('post', activeEnvelope === 'B' ? SUBMIT_ENVELOPE_FILE_B : SUBMIT_ENVELOPE_FILE_A, payload) console.log(`res file ${activeEnvelope} Payload:`, res) ToastAndroid.show(res.message, ToastAndroid.SHORT) // navigation.goBack() @@ -432,17 +426,8 @@ const TenderBidding = () => { } } - if (isLoading) { - return ( - <> - - Loading... - - - ); - } - console.log("route for date : ", route.params) + return ( @@ -467,20 +452,19 @@ const TenderBidding = () => { Bid Envelopes - {bidData?.showEA && ( + {tenderData?.showEA && ( setActiveEnvelope('A')} /> )} - {bidData?.showEB && ( + {tenderData?.showEB && ( { - if - (bidData?.envelopeASubmittStatus) { + if (tenderData?.envelopeASubmittStatus) { setActiveEnvelope('B') } else { Alert.alert('Info', 'First Fill Envelop A First') @@ -488,7 +472,7 @@ const TenderBidding = () => { }} /> )} - {bidData?.showEC && ( + {tenderData?.showEC && ( { {/* Envelope A List */} - {bidData?.[`tenderEnvelope${activeEnvelope}List`]?.length > 0 && activeEnvelope !== 'C' && ( + {tenderData?.[`tenderEnvelope${activeEnvelope}List`]?.length > 0 && activeEnvelope !== 'C' && ( Envelope {activeEnvelope} Details item?.[`tenderEnvelope${activeEnvelope}SequnceId`]?.toString()} renderItem={({ item }) => renderEnvelopeItem({ item, envelopeType: activeEnvelope })} scrollEnabled={false} /> - {/* + setCheck(!check)}> {check ? : } Check First Terms&Condition - */} + )} + {hasEnvelopes() ? ( { }); } - export const useCityDropdown = () => { + export const useCityDropdown = (stateId?: number) => { return useMutation({ - mutationFn: (stateId: number) => fetchCityDropdown(stateId), + mutationFn: () => fetchCityDropdown(stateId as number), }); }; @@ -196,20 +196,4 @@ export const useVerifyPan = () => export const useVerifyGstNumber = () => useMutation({ mutationFn: verifyGstNumber, - }); - - - export const useContractorStageTwoSubmit = () => - useMutation({ - mutationFn: contractorStageTwoSubmit, - }); - - export const useContractorStageThreeSubmit = () => - useMutation({ - mutationFn: contractorStageThreeSubmit, - }); - - export const usePartnerShipSubmit = () => - useMutation({ - mutationFn: partnerShipSubmit, }); \ No newline at end of file diff --git a/src/Services/BBPS/apis.ts b/src/Services/BBPS/apis.ts index 394911c..6f9abcd 100644 --- a/src/Services/BBPS/apis.ts +++ b/src/Services/BBPS/apis.ts @@ -1,9 +1,17 @@ import axios from "axios"; -import { ALL_DESIGNATION, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_MASTER_DATA, GET_MY_AUCTION, GET_MY_TENDER, GET_REGISTRATION_STATE, GET_TENDER_DETAILS, GETCONTRACTORBYSTATE, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PARTNER_API_ENDPOINT, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_OFFLINE_AUCTION, PURCHASE_TENDER_OFFLINE, REJ_STAGE_TWO, REVERSE_AUCTION_ITEM, SAVE_CONTRACTOR_STAGE1, SEND_ADHAROTP, STAGETHREE, TENDER_LOGIN, VERIFY_ADHAR, VERIFY_GST,VERIFY_ORGPAN } from "./ApiUrls"; +import { ALL_DESIGNATION, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_MASTER_DATA, GET_MY_AUCTION, GET_MY_TENDER, GET_REGISTRATION_STATE, GET_TENDER_DETAILS, GETCONTRACTORBYSTATE, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PARTNER_API_ENDPOINT, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_OFFLINE_AUCTION, PURCHASE_TENDER_OFFLINE, SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_B, SUBMIT_ENVELOPE_FILE_A, SUBMIT_ENVELOPE_FILE_B, REJ_STAGE_TWO, REVERSE_AUCTION_ITEM, SAVE_CONTRACTOR_STAGE1, SEND_ADHAROTP, STAGETHREE, TENDER_LOGIN, VERIFY_ADHAR, VERIFY_GST,VERIFY_ORGPAN } from "./ApiUrls"; import { apiCall } from "../../Axios/Axios"; // User - +export type UploadArgs = { + activeEnvelope: 'A' | 'B' + file: { + uri: string + name: string + type: string + } + payload: any +} type DropdownOption = { label: string; value: number | string }; type State = { stateId: number; stateName: string }; @@ -271,3 +279,44 @@ export const partnerShipSubmit = ( payload, ); }; + +export const submitEnvelopeA = async (payload: any) => { + console.log('SUBMIT ENVELOPE A API CALLED', payload) + const { data } = await apiCall('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('post', SUBMIT_ENVELOPE_B, payload) + console.log("data : ", data) + return data +} + + +export const uploadEnvelopeFile = async ({ + activeEnvelope, + file, + payload, +}: UploadArgs) => { + const formData = new FormData() + + formData.append('files', { + uri: file.uri, + name: file.name, + type: file.type, + } as any) + + formData.append('requestDto', JSON.stringify(payload)) + + const url = + activeEnvelope === 'B' ? SUBMIT_ENVELOPE_FILE_B : SUBMIT_ENVELOPE_FILE_A + + const data = await apiCall('post', url, formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) + + return data +} \ No newline at end of file