diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index aa069ff..70a16ac 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,14 +1,11 @@ - - + - - - - + + + ( ): Promise => { try { const token: any = store.getState().token.token; - - console.log("abin-------",url) + const response = await axios({ method, url, @@ -23,25 +22,27 @@ export const apiCall = async ( 'Content-Type': contentType || 'application/json', }, }); - - console.log("abin-------",response) - + return response.data; } catch (error: any) { const errorMessage = error?.response?.data?.error; - console.log(errorMessage, '---------------------------api error message'); + // console.log(error?.response?.data.error, '---------------------------api error message'); - if (error?.response?.status === 401) { + if (error?.response?.statusCode === 401) { store.dispatch(setToken({})); return { success: false, message: 'JWT Error - Token expired or malformed', } as R; } + const data = { + data: { + success: false, + message: error?.response?.data?.message || 'No Response From Server', + } - return { - success: false, - message: error?.response?.data?.message || 'No Response From Server', - } as R; + } + + return data as any } }; diff --git a/src/Component/Serach/SeacrhInput.tsx b/src/Component/Serach/SeacrhInput.tsx index 5f66aa0..5b4b556 100644 --- a/src/Component/Serach/SeacrhInput.tsx +++ b/src/Component/Serach/SeacrhInput.tsx @@ -1,7 +1,12 @@ import { Filter, Search } from "lucide-react-native"; -import React from "react"; +import React, { useEffect, useRef, useState } from "react"; import { View, Text, TextInput, StyleSheet, TouchableOpacity, Platform } from "react-native"; -import Animated, { useAnimatedStyle, useSharedValue, withTiming, interpolateColor } from "react-native-reanimated"; +import Animated, { + useAnimatedStyle, + useSharedValue, + withTiming, + interpolateColor, +} from "react-native-reanimated"; import colors from "../../Constant/Color"; export interface SearchType { @@ -10,12 +15,22 @@ export interface SearchType { label?: string; filter?: boolean; filterPress?: () => void; + debounceDelay?: number; // 👈 optional } const AnimatedView = Animated.createAnimatedComponent(View); -export const SearchInput: React.FC = ({ placeholder, onChange, label, filter = true, filterPress }) => { +export const SearchInput: React.FC = ({ + placeholder, + onChange, + label, + filter = true, + filterPress, + debounceDelay = 500, // 👈 default debounce +}) => { const isFocused = useSharedValue(0); + const [text, setText] = useState(''); + const debounceRef = useRef(null); const inputContainerStyle = useAnimatedStyle(() => { const borderColor = interpolateColor( @@ -25,13 +40,30 @@ export const SearchInput: React.FC = ({ placeholder, onChange, label ); return { - borderColor: borderColor, + borderColor, borderWidth: withTiming(isFocused.value ? 1.5 : 1), transform: [{ scale: withTiming(isFocused.value ? 1.01 : 1) }], shadowOpacity: withTiming(isFocused.value ? 0.1 : 0), }; }); + // 🔥 Debounce logic + useEffect(() => { + if (debounceRef.current) { + clearTimeout(debounceRef.current); + } + + debounceRef.current = setTimeout(() => { + onChange(text.trim()); + }, debounceDelay); + + return () => { + if (debounceRef.current) { + clearTimeout(debounceRef.current); + } + }; + }, [text]); + return ( {label && {label}} @@ -40,13 +72,14 @@ export const SearchInput: React.FC = ({ placeholder, onChange, label (isFocused.value = withTiming(1))} onBlur={() => (isFocused.value = withTiming(0))} @@ -94,11 +127,9 @@ const styles = StyleSheet.create({ borderRadius: 12, paddingHorizontal: 12, borderWidth: 1, - // Shadow for iOS shadowColor: "#000", shadowOffset: { width: 0, height: 2 }, shadowRadius: 4, - // Elevation for Android elevation: 2, }, searchIcon: { @@ -125,5 +156,5 @@ const styles = StyleSheet.create({ shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.1, shadowRadius: 2, - } -}); \ No newline at end of file + }, +}); diff --git a/src/Helper/DateFormat.tsx b/src/Helper/DateFormat.tsx index 248e00d..b52b274 100644 --- a/src/Helper/DateFormat.tsx +++ b/src/Helper/DateFormat.tsx @@ -1,12 +1,10 @@ import moment from 'moment'; export const format = { - // Internal helper to safely parse any input parse: (date: string | Date) => { if (!date) return null; let d = date; if (typeof date === 'string') { - // Replace IST or other known timezone abbreviations with UTC offset d = date.replace('IST', '+0530'); } return moment(d); diff --git a/src/Screens/Auction/LiveAuction.tsx b/src/Screens/Auction/LiveAuction.tsx index 525c7c3..a1831d9 100644 --- a/src/Screens/Auction/LiveAuction.tsx +++ b/src/Screens/Auction/LiveAuction.tsx @@ -18,13 +18,14 @@ const LiveAuction = () => { const onEndReachedCalledDuringMomentum = useRef(true); const SelectedPurchaseList = useSelector((state: any) => state.selectPurchaseAuction); const [showRefreshBanner, setShowRefreshBanner] = useState(false); - const [allBoolean, setAllBoolean] = useState({ liveAuctionData: [] }) + const [allBoolean, setAllBoolean] = useState({ liveAuctionData: [], isLoading: false }) const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch, isPending }: any = useFetchLiveAuction(); // My Methods const getMyAuction = async () => { try { + setAllBoolean(prev => ({ ...prev, isLoading: true })) const res = await apiCall('get', `${GET_MY_AUCTION}`,); if (res?.statusCode === 200) { const purchasedIds = new Set(res.data.map((item: any) => item.auctionId)); @@ -100,7 +101,7 @@ const LiveAuction = () => { return ( - { }} placeholder="Search...." /> + { }} placeholder="Search...." filter={false} /> {showRefreshBanner && ( { )} { - isPending ? : + isPending || allBoolean.isLoading ? : = ({ visible, onClose, data }) => { }; return ( - void; - onApply: (filters: { - fromDate: Date | null; - toDate: Date | null; - status: AuctionStatus; - }) => void; -} -const FilterModal: React.FC = ({ visible, onClose, onApply }) => { +const FilterModal: React.FC = ({ visible, onClose, setFilter, filter }) => { const [fromDate, setFromDate] = useState(null); const [toDate, setToDate] = useState(null); const [status, setStatus] = useState(null); @@ -38,16 +22,26 @@ const FilterModal: React.FC = ({ visible, onClose, onApply }) => { }; const handleConfirm = (date: Date) => { + if (pickerType === 'FROM') { setFromDate(date); + console.log('FROM date set'); } else { setToDate(date); + console.log('TO date set'); } + setOpenPicker(false); }; const handleApply = () => { - onApply({ fromDate, toDate, status }); + const payload = { + fromDate: fromDate ? fromDate.toISOString() : null, + toDate: toDate ? toDate.toISOString() : null, + status, + + }; + setFilter({ ...payload, auctionNumber: filter.auctionNumber || '' }); onClose(); }; @@ -67,7 +61,7 @@ const FilterModal: React.FC = ({ visible, onClose, onApply }) => { Filter Auctions - {/* ===== DATE RANGE ===== */} + {/* DATE RANGE */} Date Range @@ -96,7 +90,7 @@ const FilterModal: React.FC = ({ visible, onClose, onApply }) => { - {/* ===== STATUS ===== */} + {/* STATUS */} Auction Status @@ -109,7 +103,9 @@ const FilterModal: React.FC = ({ visible, onClose, onApply }) => { return ( setStatus(item.value as AuctionStatus)} + onPress={() => + setStatus(item.value as AuctionStatus) + } style={[ styles.statusPill, active && styles.statusActive, @@ -128,20 +124,25 @@ const FilterModal: React.FC = ({ visible, onClose, onApply }) => { })} - {/* ===== FOOTER ===== */} + {/* FOOTER */} - {/* - Cancel - */} - - + { setFilter({}), onClose() }} + > + Clear + + Apply - {/* ===== DATE PICKER ===== */} + {/* DATE PICKER */} = ({ visible, onClose, onApply }) => { export default FilterModal; - const styles = StyleSheet.create({ overlay: { flex: 1, @@ -229,31 +229,28 @@ const styles = StyleSheet.create({ statusText: { fontSize: 13, color: '#334155', - fontFamily:FontsFamily.poppinsSemiBold + fontFamily: FontsFamily.poppinsSemiBold, }, statusActiveText: { color: '#fff', }, footer: { + marginTop: 24, flexDirection: 'row', justifyContent: 'space-between', - marginTop: 24, + alignItems: 'center' }, - cancelBtn: { - padding: 12, - }, - applyBtn: { backgroundColor: colors.primary, paddingHorizontal: 20, paddingVertical: 12, borderRadius: 12, - width: '100%' + width: '49%', }, applyText: { color: '#fff', fontSize: 16, textAlign: 'center', - fontFamily: FontsFamily.poppinsSemiBold + fontFamily: FontsFamily.poppinsSemiBold, }, }); diff --git a/src/Screens/Auction/PurchaseAuction.tsx b/src/Screens/Auction/PurchaseAuction.tsx index 3d67f2a..3e346c7 100644 --- a/src/Screens/Auction/PurchaseAuction.tsx +++ b/src/Screens/Auction/PurchaseAuction.tsx @@ -19,7 +19,8 @@ const PurchaseAuction = () => { const navigation = useNavigation() as any; const Dispatch = useDispatch() const onEndReachedCalledDuringMomentum = useRef(true); - const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch, isPending }: any = useFetchLiveAuctionPage(); + const [filter, setFilter] = useState({}) + const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, isRefetching, refetch, isPending }: any = useFetchLiveAuctionPage(filter); const [allBoolean, setAllBoolean] = useState({ isShowFilter: false }) const format = 'DD-MM-YYYY HH:mm:ss'; @@ -60,9 +61,10 @@ const PurchaseAuction = () => { ); }, [isFetchingNextPage]); + return ( - { }} placeholder='Search....' filterPress={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: !prev.isShowFilter })) }} /> + { setFilter(prev => ({ ...prev, auctionNumber: val })) }} placeholder='Search....' filterPress={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: !prev.isShowFilter })) }} /> {isPending ? : { /> } {allBoolean.isShowFilter && - { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: false })) }} onApply={() => { }} /> - } + { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: false })) }} setFilter={setFilter} filter={filter} /> + }. ); diff --git a/src/Screens/Auction/types/types.tsx b/src/Screens/Auction/types/types.tsx index 5848de0..c24de08 100644 --- a/src/Screens/Auction/types/types.tsx +++ b/src/Screens/Auction/types/types.tsx @@ -15,4 +15,23 @@ export interface LiveAuctionTileProps { export interface allBooleanProps { showDetail?: boolean isShowFilter?: boolean + filterValue?: { + fromDate?: any, + toDate?: any, + status?: any + } +} + +export type AuctionStatus = 'RUNNING' | 'ENDED' | 'NOT_STARTED' | null; + +export interface Props { + visible: boolean; + onClose: () => void; + setFilter: (data: { + fromDate?: string | null; + toDate?: string | null; + status?: AuctionStatus; + auctionNumber?: any + }) => void; + filter: any } \ No newline at end of file diff --git a/src/Screens/Bidding/Component/TemplateFormModal.tsx b/src/Screens/Bidding/Component/TemplateFormModal.tsx index a4420d3..f4df0c3 100644 --- a/src/Screens/Bidding/Component/TemplateFormModal.tsx +++ b/src/Screens/Bidding/Component/TemplateFormModal.tsx @@ -18,7 +18,7 @@ const TemplateFormModal: React.FC = ({ visible, template, setAllBoolean } const SelectedAuction = useSelector((state: any) => state.auction.auction) const Navigation: any = useNavigation() const [loading, setLoading] = useState(false) - const initialValues = template.labels.reduce((acc: any, label: any) => { + const initialValues = template?.labels?.reduce((acc: any, label: any) => { acc[label.labelName] = '' return acc }, {}) @@ -150,7 +150,7 @@ const TemplateFormModal: React.FC = ({ visible, template, setAllBoolean } ([labelName, labelValue]: any) => { if (typeof labelValue === 'object' && labelValue?.uri) { hasFile = true - fileFormData.append(labelName, { + fileFormData.append('files', { uri: labelValue.uri, name: labelValue.name, type: labelValue.type, @@ -166,14 +166,13 @@ const TemplateFormModal: React.FC = ({ visible, template, setAllBoolean } const rs1: any = await apiCall('post', TECHNICAL_VALUE_SUBMIT, jsonBody) - if (hasFile) { fileFormData.append( - 'auctiontId', - String(SelectedAuction.auctionId) + 'auctionTemplateValueIds', + String(rs1?.data[0]?.valueId) ) fileFormData.append( - 'technicalDocumentTemplateId', + 'templateNameId', String(payload.templateNameId) ) @@ -184,7 +183,7 @@ const TemplateFormModal: React.FC = ({ visible, template, setAllBoolean } {}, 'multipart/form-data' ) - console.log(res2, '-------------res2'); + if (rs1.statusCode == 200 && res2.statusCode == 200) { Navigation.navigate(NavigationString.StartBidding) setAllBoolean((prev: any) => ({ ...prev, technicalDocModalVisible: false })) @@ -397,7 +396,7 @@ const styles = StyleSheet.create({ submitRow: { marginTop: 20, alignItems: 'flex-end', - height:50 + height: 50 }, submitBtn: { backgroundColor: colors.primary, diff --git a/src/Screens/Bidding/Emd.tsx b/src/Screens/Bidding/Emd.tsx index 613b940..c895209 100644 --- a/src/Screens/Bidding/Emd.tsx +++ b/src/Screens/Bidding/Emd.tsx @@ -15,7 +15,6 @@ import { AUCITON_SINGLE_EMD, AUCTION_ITEM_SUBMIT, CHECK_TECHNICAL_DOCUMENTAION, import TemplateFormModal from './Component/TemplateFormModal'; import { SelectedItem } from './Type/BidType'; import FontsFamily from '../../Constant/FontsFamily'; -import { all } from 'axios'; import { showSuccessAlert } from '../../Constant/ShowDailog'; @@ -231,7 +230,6 @@ const Emd = () => { mutate({ auctionNumber: SelectedAuction.auctionNumber }, { onSuccess: (async (res) => { if (res.statusCode == 200) { - if (res.message == 'No EMD Documents') { const result = await getAuction() if (result) { @@ -381,7 +379,6 @@ const Emd = () => { }; useEffect(() => { - // getAuction() AlreadyEmdCheck() }, []) diff --git a/src/Screens/Home/Home.tsx b/src/Screens/Home/Home.tsx index df9cdb6..aa5897d 100644 --- a/src/Screens/Home/Home.tsx +++ b/src/Screens/Home/Home.tsx @@ -5,6 +5,7 @@ import { Layers, Clock, ShoppingCart, X, FileText } from 'lucide-react-native'; import { Header } from '../../Component/Index'; import colors from '../../Constant/Color'; import { useDashboard } from '../../Services/BBPS/Hooks'; +import { log } from 'console'; const { width } = Dimensions.get('window'); const CARD_WIDTH = (width - 48) / 2; diff --git a/src/Services/BBPS/ApiUrls.tsx b/src/Services/BBPS/ApiUrls.tsx index 7fd29a0..875754b 100644 --- a/src/Services/BBPS/ApiUrls.tsx +++ b/src/Services/BBPS/ApiUrls.tsx @@ -66,7 +66,7 @@ const DASHBOARD_COUNT = `${BASE_URL_Auction}api/auction/home/dashboard/counts` const AUCTION_ONE_TIME_BID = `${BASE_URL_Auction}api/bidding/getBidForAuction` const AUCITON_SINGLE_EMD = `${BASE_URL_Auction}api/auction/addEMDDocumentsAuctionWise` const PURCHASE_AUCTION_LIST = `${BASE_URL_Auction}api/auction/proceedToPurchase` -const VIEW_AUCTION_ITEM_DETAIL = `${BASE_URL_Auction}api/auction/home/viewDocumentsForAuctionItemDetails` +const VIEW_AUCTION_ITEM_DETAIL = `${BASE_URL_Auction}api/auction/viewDocumentsForAuctionItemDetails` const VIEW_AUCTION_DOCUMENTS = `${BASE_URL_Auction}api/auction/viewDocumentsForAuction` const AUCTION_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocumentForAuction` const AUCTION_ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocument/auctionItemId` diff --git a/src/Services/BBPS/Hooks.ts b/src/Services/BBPS/Hooks.ts index 87aaf07..22bc298 100644 --- a/src/Services/BBPS/Hooks.ts +++ b/src/Services/BBPS/Hooks.ts @@ -66,13 +66,14 @@ export const useFetchPurchaseAuction = () => { }); }; -export const useFetchLiveAuctionPage = () => { +export const useFetchLiveAuctionPage = (payload: any) => { return useInfiniteQuery({ - queryKey: ['fetchPurchaseAuctionPage'], + queryKey: ['fetchPurchaseAuctionPage', payload], queryFn: ({ pageParam = 0 }) => fetchPurchaseAuctionPage({ page: pageParam, size: 10, + ...payload }), initialPageParam: 0, @@ -148,11 +149,11 @@ return useQuery({ }); } export const useProceedToBid = (tenderId?: string) => { - return useQuery({ - queryKey: ['proceedToBid', tenderId], - queryFn: () => proceedToBid(tenderId as string), - enabled: false, // 👈 manual trigger - }); + return useQuery({ + queryKey: ['proceedToBid', tenderId], + queryFn: () => proceedToBid(tenderId as string), + enabled: false, // 👈 manual trigger + }); }; export const useAuctionItem = () => { @@ -169,11 +170,11 @@ export const useEmdCheck = () => { }); }; -export const useGetDesignation = () => { +export const useGetDesignation = () => { return useQuery({ queryKey: ['Designation'], queryFn: () => getDesignation() - + }); } @@ -190,75 +191,75 @@ export const useRagistrationState = () => { }; -export const usefetchMasterData = () => { +export const usefetchMasterData = () => { return useQuery({ queryKey: ['MasterData'], queryFn: () => fetchMasterData() - + }); } - export const useCityDropdown = () => { +export const useCityDropdown = () => { return useMutation({ mutationFn: (stateId: number) => fetchCityDropdown(stateId), }); }; export const useVerifyPan = () => - useMutation({ - mutationFn: verifyPanHandler, - }); + useMutation({ + mutationFn: verifyPanHandler, + }); - export const useSendAadhaarOtp = () => - useMutation({ - mutationFn: sendAadhaarOtp, - }); +export const useSendAadhaarOtp = () => + useMutation({ + mutationFn: sendAadhaarOtp, + }); - export const useVerifyAadhaarOtp = () => - useMutation({ - mutationFn: verifyAadhaarOtp, - }); +export const useVerifyAadhaarOtp = () => + useMutation({ + mutationFn: verifyAadhaarOtp, + }); - export const useVerifyGstNumber = () => - useMutation({ - mutationFn: verifyGstNumber, - }); +export const useVerifyGstNumber = () => + useMutation({ + mutationFn: verifyGstNumber, + }); - - export const useContractorStageTwoSubmit = () => - useMutation({ - mutationFn: contractorStageTwoSubmit, - }); - export const useContractorStageThreeSubmit = () => - useMutation({ - mutationFn: contractorStageThreeSubmit, - }); - - export const usePartnerShipSubmit = () => - useMutation({ - mutationFn: partnerShipSubmit, - }); +export const useContractorStageTwoSubmit = () => + useMutation({ + mutationFn: contractorStageTwoSubmit, + }); + +export const useContractorStageThreeSubmit = () => + useMutation({ + mutationFn: contractorStageThreeSubmit, + }); + +export const usePartnerShipSubmit = () => + useMutation({ + mutationFn: partnerShipSubmit, + }); + - export const useSubmitEnvelopeA = () => - useMutation({ - mutationFn: submitEnvelopeA, - }) + useMutation({ + mutationFn: submitEnvelopeA, + }) export const useSubmitEnvelopeB = () => - useMutation({ - mutationFn: submitEnvelopeB, - }) + useMutation({ + mutationFn: submitEnvelopeB, + }) export const useUploadEnvelopeFile = () => - useMutation({ - mutationFn: uploadEnvelopeFile, - }) + useMutation({ + mutationFn: uploadEnvelopeFile, + }) @@ -285,7 +286,7 @@ export const useGetAucitonDocument = (payload: { auctionId: number }) => { export const useAucitonItemDetail = (payload: { auctionItemId: number }) => { return useQuery({ - queryKey: ['viewAuctionItemDocuments'], + queryKey: [], queryFn: () => viewAuctionItemDocuments(payload) }); }; diff --git a/src/Services/BBPS/apis.ts b/src/Services/BBPS/apis.ts index f2b3906..6523944 100644 --- a/src/Services/BBPS/apis.ts +++ b/src/Services/BBPS/apis.ts @@ -51,6 +51,8 @@ export const fetchPurchaseAuction = async (): Promise => { return data } export const fetchPurchaseAuctionPage = async (payload: any): Promise => { + console.log(payload,'[[[[[[[[[[[[[[[[[[[[[[[['); + const data = await apiCall('get', `${PURCHASE_AUCTION_PAGE}`, {}, payload); return data } diff --git a/{ b/{ deleted file mode 100644 index e69de29..0000000