Merge branch 'etender' of https://git.zeptic.in/rohit/Procurelinc
This commit is contained in:
@@ -32,8 +32,9 @@ const PROCEED_PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/proceedToPurcha
|
||||
const PURCHASE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuction`
|
||||
const PURCHASE_OFFLINE_AUCTION = `${BASE_URL_Auction}api/auction/purchaseAuctionOffline`
|
||||
const PURCHASE_TENDER = `https://procurelinc.in/EProcurementSB/tenderPayment/purchaseTender`
|
||||
const PURCHASE_TENDER_OFFLINE = `https://procurelinc.in/EProcurementSB/tenderPayment/purchaseTenderOffline`
|
||||
const AUCTION_PURCHASE_STATUS = `https://api.godemo.in/Auction/api/auction/transactionStatus?orderNo=`
|
||||
const GET_TENDER_DETAILS = `${BASE_URL}eTendering/getTenderById?tenderId=`
|
||||
const GET_TENDER_DETAILS = `https://procurelinc.in/EProcurementSB/tenderBidding/getTenderDetail?tenderId=`
|
||||
const GET_DOCID = `${BASE_URL}eTendering/download/docId?docId=`
|
||||
// https://procurelinc.in/EProcurementSB/eTendering/download/docId?docId=158
|
||||
// const DOWNLOAD_DOC = `${BASE_URL}eTende ring/download/docId?docId=`
|
||||
@@ -69,6 +70,17 @@ const VIEW_AUCTION_DOCUMENTS = `${BASE_URL_Auction}api/auction/viewDocumentsForA
|
||||
const AUCTION_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocumentForAuction`
|
||||
const AUCTION_ITEM_DOCUMENT_DOWNLOAD = `${BASE_URL_Auction}api/auction/home/downloadDocument/auctionItemId`
|
||||
|
||||
//tender
|
||||
|
||||
const TENDER_LOGIN = `${BASE_URL}eproc/loginWithoutDecryption`
|
||||
const PROCEED_TO_BID = `${BASE_URL}tenderBidding/proceedToBid?tenderId=`
|
||||
const SUBMIT_ENVELOPE_A = `${BASE_URL}tenderBidding/getSaveEnvelopeAData`
|
||||
const SUBMIT_ENVELOPE_B = `${BASE_URL}tenderBidding/getSaveEnvelopeBData`
|
||||
const SUBMIT_ENVELOPE_FILE_A = `${BASE_URL}tenderBidding/addDocumentsEnvelopeA?requestDto=`
|
||||
const SUBMIT_ENVELOPE_FILE_B = `${BASE_URL}tenderBidding/addDocumentsEnvelopeB?requestDto=`
|
||||
|
||||
|
||||
|
||||
export {
|
||||
// Rohit
|
||||
VIEW_AUCTION_ITEM_DETAIL,
|
||||
@@ -132,6 +144,13 @@ export {
|
||||
AUCTION_LOGIN,
|
||||
TWO_FACTOR_AUTH,
|
||||
GET_MASTER_DATA,
|
||||
PURCHASE_OFFLINE_AUCTION
|
||||
PURCHASE_OFFLINE_AUCTION,
|
||||
TENDER_LOGIN,
|
||||
PURCHASE_TENDER_OFFLINE,
|
||||
PROCEED_TO_BID,
|
||||
SUBMIT_ENVELOPE_A,
|
||||
SUBMIT_ENVELOPE_B,
|
||||
SUBMIT_ENVELOPE_FILE_A,
|
||||
SUBMIT_ENVELOPE_FILE_B
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments } from './apis';
|
||||
import { fetchAuctionItem, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, getAuction, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments } from './apis';
|
||||
|
||||
// User
|
||||
|
||||
@@ -20,15 +20,38 @@ export const useDashboard = () => {
|
||||
// Auction & Tender
|
||||
|
||||
export const useFetchPurchaseTender = () => {
|
||||
return useQuery({
|
||||
queryKey: [],
|
||||
queryFn: () => fetchPurchaseTender()
|
||||
return useInfiniteQuery({
|
||||
queryKey: ['fetchPurchaseTender'],
|
||||
queryFn: ({ pageParam = 0 }) =>
|
||||
fetchPurchaseTender({
|
||||
page: pageParam,
|
||||
size: 10,
|
||||
}),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
console.log('last page : ', lastPage)
|
||||
console.log("all page : ", allPages)
|
||||
const {totalCount } = lastPage;
|
||||
|
||||
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 useFetchLiveTender = () => {
|
||||
return useQuery({
|
||||
queryKey: [],
|
||||
queryKey: ['fetchLiveTender',],
|
||||
queryFn: () => fetchLiveTender()
|
||||
});
|
||||
};
|
||||
@@ -78,6 +101,30 @@ export const useOfflineAuctionPurchase = () => {
|
||||
mutationFn: (payload: any) => offlineAuctionPurchase(payload),
|
||||
});
|
||||
};
|
||||
export const useOfflineTenderPurchase = () => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => offlineTenderPurchase(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const useFetchTenderById = (tenderId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['fetchTenderById', tenderId],
|
||||
queryFn: () => fetchTenderById(tenderId)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export const useProceedToBid = (tenderId?: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['proceedToBid', tenderId],
|
||||
queryFn: () => proceedToBid(tenderId as string),
|
||||
enabled: false, // 👈 manual trigger
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// EMD
|
||||
export const useEmdCheck = () => {
|
||||
|
||||
+50
-11
@@ -1,12 +1,13 @@
|
||||
import axios from "axios";
|
||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL } from "./ApiUrls";
|
||||
import { AUCTION_DOCUMENT_DOWNLOAD, DASHBOARD_COUNT, EMD_CHECK, FORARD_AUCTION_ITEM, GET_AUCTION_DETAILS, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIVE_AUCTION, LIVE_TENDER, LOG_IN_URL, PROCEED_PURCHASE_AUCTION, PROCEED_TO_BID, PURCHASE_TENDER_OFFLINE, TENDER_LOGIN, PURCHASE_AUCTION_LIST, PURCHASE_OFFLINE_AUCTION, REVERSE_AUCTION_ITEM, VIEW_AUCTION_DOCUMENTS, VIEW_AUCTION_ITEM_DETAIL } from "./ApiUrls";
|
||||
import { apiCall } from "../../Axios/Axios";
|
||||
|
||||
// User
|
||||
|
||||
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||
try {
|
||||
const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||
const response = await axios.post(TENDER_LOGIN, { ...payload, device: "mobileApp" });
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
@@ -18,15 +19,6 @@ export const fetchDashboard = async (): Promise<any> => {
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
export const fetchPurchaseTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchLiveTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${LIVE_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchPurchaseAuction = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${GET_MY_AUCTION}`);
|
||||
return data
|
||||
@@ -73,6 +65,53 @@ export const fetchAuctionItem = async (payload: any): Promise<any> => {
|
||||
}
|
||||
};
|
||||
|
||||
// Tender Purchase offline
|
||||
export const offlineTenderPurchase = async (payload: any): Promise<any> => {
|
||||
try {
|
||||
const response = await apiCall<any>('post', PURCHASE_TENDER_OFFLINE, payload);
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
throw error.response?.data || error.message;
|
||||
}
|
||||
};
|
||||
|
||||
// tender
|
||||
export const fetchPurchaseTender = async ({
|
||||
page,
|
||||
size,
|
||||
}: {
|
||||
page: number;
|
||||
size: number;
|
||||
}) => {
|
||||
return apiCall<any>(
|
||||
'get',
|
||||
`${GET_MY_TENDER}?page=${page}&size=${size}`
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const fetchLiveTender = async (): Promise<any> => {
|
||||
const data = await apiCall<any>('get', `${LIVE_TENDER}`);
|
||||
return data
|
||||
}
|
||||
export const fetchTenderById = async (tenderId: string): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${GET_TENDER_DETAILS}${tenderId}`
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const proceedToBid = async (tenderId: string): Promise<any> => {
|
||||
const data = await apiCall<any>(
|
||||
'get',
|
||||
`${PROCEED_TO_BID}${tenderId}`
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const fetchPurchaseAuctionList = async (payload: any): Promise<any> => {
|
||||
const data = await apiCall<any>('post', `${PURCHASE_AUCTION_LIST}`, payload);
|
||||
|
||||
Reference in New Issue
Block a user