stuctured envelopa and envelopb integration
This commit is contained in:
@@ -107,27 +107,27 @@ const ProceedToBidDetail = () => {
|
|||||||
<View style={styles.headerCard}>
|
<View style={styles.headerCard}>
|
||||||
<View style={styles.tenderHeader}>
|
<View style={styles.tenderHeader}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.tenderNumber}>{tenderData.tenderNumber}</Text>
|
<Text style={styles.tenderNumber}>{tenderData?.tenderNumber}</Text>
|
||||||
<Text style={styles.tenderId}>ID: {tenderData.tenderId}</Text>
|
<Text style={styles.tenderId}>ID: {tenderData?.tenderId}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[styles.statusBadge, { backgroundColor: tenderData.biddingStatus ? colors.success : colors.warning }]}>
|
<View style={[styles.statusBadge, { backgroundColor: tenderData?.biddingStatus ? colors.success : colors.warning }]}>
|
||||||
<Text style={styles.statusBadgeText}>
|
<Text style={styles.statusBadgeText}>
|
||||||
{tenderData.biddingStatus ? "Active" : "Inactive"}
|
{tenderData?.biddingStatus ? "Active" : "Inactive"}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Text style={styles.workDescription}>{tenderData.nameofWork}</Text>
|
<Text style={styles.workDescription}>{tenderData?.nameofWork}</Text>
|
||||||
|
|
||||||
<View style={styles.headerInfoRow}>
|
<View style={styles.headerInfoRow}>
|
||||||
<View style={styles.headerInfoItem}>
|
<View style={styles.headerInfoItem}>
|
||||||
<Text style={styles.headerInfoLabel}>NIT No.</Text>
|
<Text style={styles.headerInfoLabel}>NIT No.</Text>
|
||||||
<Text style={styles.headerInfoValue}>{tenderData.nitNo}</Text>
|
<Text style={styles.headerInfoValue}>{tenderData?.nitNo}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.separator} />
|
<View style={styles.separator} />
|
||||||
<View style={styles.headerInfoItem}>
|
<View style={styles.headerInfoItem}>
|
||||||
<Text style={styles.headerInfoLabel}>EMD Amount</Text>
|
<Text style={styles.headerInfoLabel}>EMD Amount</Text>
|
||||||
<Text style={styles.headerInfoValue}>₹{tenderData.emdInFig}</Text>
|
<Text style={styles.headerInfoValue}>₹{tenderData?.emdInFig}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -136,19 +136,19 @@ const ProceedToBidDetail = () => {
|
|||||||
<View style={styles.section}>
|
<View style={styles.section}>
|
||||||
<Text style={styles.sectionTitle}>Envelope Submission Status</Text>
|
<Text style={styles.sectionTitle}>Envelope Submission Status</Text>
|
||||||
<View style={styles.statusGrid}>
|
<View style={styles.statusGrid}>
|
||||||
<StatusIndicator status={tenderData.envelopeASubmittStatus} label="Envelope A" />
|
<StatusIndicator status={tenderData?.envelopeASubmittStatus} label="Envelope A" />
|
||||||
<StatusIndicator status={tenderData.envelopeBSubmittStatus} label="Envelope B" />
|
<StatusIndicator status={tenderData?.envelopeBSubmittStatus} label="Envelope B" />
|
||||||
<StatusIndicator status={tenderData.envelopeCSubmittStatus} label="Envelope C" />
|
<StatusIndicator status={tenderData?.envelopeCSubmittStatus} label="Envelope C" />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Envelope Logs */}
|
{/* Envelope Logs */}
|
||||||
{tenderData.envelopeA_Logs && (
|
{tenderData?.envelopeA_Logs && (
|
||||||
<View style={styles.section}>
|
<View style={styles.section}>
|
||||||
<Text style={styles.sectionTitle}>Submission Logs</Text>
|
<Text style={styles.sectionTitle}>Submission Logs</Text>
|
||||||
<EnvelopeLogCard log={tenderData.envelopeA_Logs} title="Envelope A Submission" />
|
<EnvelopeLogCard log={tenderData?.envelopeA_Logs} title="Envelope A Submission" />
|
||||||
<EnvelopeLogCard log={tenderData.envelopeB_Logs} title="Envelope B Submission" />
|
<EnvelopeLogCard log={tenderData?.envelopeB_Logs} title="Envelope B Submission" />
|
||||||
<EnvelopeLogCard log={tenderData.envelopeC_Logs} title="Envelope C Submission" />
|
<EnvelopeLogCard log={tenderData?.envelopeC_Logs} title="Envelope C Submission" />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -156,11 +156,11 @@ const ProceedToBidDetail = () => {
|
|||||||
<View style={styles.section}>
|
<View style={styles.section}>
|
||||||
<Text style={styles.sectionTitle}>Tender Details</Text>
|
<Text style={styles.sectionTitle}>Tender Details</Text>
|
||||||
<View style={styles.detailsCard}>
|
<View style={styles.detailsCard}>
|
||||||
<InfoRow label="Envelope Type" value={tenderData.envelopeType} />
|
<InfoRow label="Envelope Type" value={tenderData?.envelopeType} />
|
||||||
<InfoRow label="Tender Stages" value={tenderData.tenderStages} />
|
<InfoRow label="Tender Stages" value={tenderData?.tenderStages} />
|
||||||
<InfoRow label="Bid Withdrawal" value={tenderData.bidWithDraw} isHighlighted={tenderData.bidWithdrawStatus} />
|
<InfoRow label="Bid Withdrawal" value={tenderData?.bidWithDraw} isHighlighted={tenderData?.bidWithdrawStatus} />
|
||||||
<InfoRow label="Re-bid" value={tenderData.reBid} />
|
<InfoRow label="Re-bid" value={tenderData?.reBid} />
|
||||||
<InfoRow label="DSC Status" value={tenderData.dscStatus ? "Required" : "Not Required"} />
|
<InfoRow label="DSC Status" value={tenderData?.dscStatus ? "Required" : "Not Required"} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -170,11 +170,11 @@ const ProceedToBidDetail = () => {
|
|||||||
<View style={styles.timeCard}>
|
<View style={styles.timeCard}>
|
||||||
<View style={styles.timeRow}>
|
<View style={styles.timeRow}>
|
||||||
<Text style={styles.timeLabel}>Starts On:</Text>
|
<Text style={styles.timeLabel}>Starts On:</Text>
|
||||||
<Text style={styles.timeValue}>{formatDate(tenderData.submittedStartDate)}</Text>
|
<Text style={styles.timeValue}>{formatDate(tenderData?.submittedStartDate)}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.timeRow}>
|
<View style={styles.timeRow}>
|
||||||
<Text style={styles.timeLabel}>Ends On:</Text>
|
<Text style={styles.timeLabel}>Ends On:</Text>
|
||||||
<Text style={styles.timeValue}>{formatDate(tenderData.submittedEndDate)}</Text>
|
<Text style={styles.timeValue}>{formatDate(tenderData?.submittedEndDate)}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -183,12 +183,12 @@ const ProceedToBidDetail = () => {
|
|||||||
<View style={styles.section}>
|
<View style={styles.section}>
|
||||||
<Text style={styles.sectionTitle}>Available Features</Text>
|
<Text style={styles.sectionTitle}>Available Features</Text>
|
||||||
<View style={styles.chipsContainer}>
|
<View style={styles.chipsContainer}>
|
||||||
<FeatureChip label="View Bid" enabled={tenderData.viewBid} />
|
<FeatureChip label="View Bid" enabled={tenderData?.viewBid} />
|
||||||
<FeatureChip label="Proceed to Bid" enabled={tenderData.proceedtoBid} />
|
<FeatureChip label="Proceed to Bid" enabled={tenderData?.proceedtoBid} />
|
||||||
<FeatureChip label="Show Envelope B" enabled={tenderData.showEB} />
|
<FeatureChip label="Show Envelope B" enabled={tenderData?.showEB} />
|
||||||
<FeatureChip label="Show Envelope C" enabled={tenderData.showEC} />
|
<FeatureChip label="Show Envelope C" enabled={tenderData?.showEC} />
|
||||||
<FeatureChip label="QCBS" enabled={tenderData.showQCBS} />
|
<FeatureChip label="QCBS" enabled={tenderData?.showQCBS} />
|
||||||
<FeatureChip label="LCS" enabled={tenderData.showLCS} />
|
<FeatureChip label="LCS" enabled={tenderData?.showLCS} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -199,18 +199,18 @@ const ProceedToBidDetail = () => {
|
|||||||
<Text style={styles.finalStatusLabel}>All Envelopes Submitted:</Text>
|
<Text style={styles.finalStatusLabel}>All Envelopes Submitted:</Text>
|
||||||
<Text style={[styles.finalStatusValue,
|
<Text style={[styles.finalStatusValue,
|
||||||
{
|
{
|
||||||
color: tenderData.envelopeASubmittStatus && tenderData.envelopeBSubmittStatus && tenderData.envelopeCSubmittStatus
|
color: tenderData?.envelopeASubmittStatus && tenderData?.envelopeBSubmittStatus && tenderData?.envelopeCSubmittStatus
|
||||||
? colors.success : colors.error
|
? colors.success : colors.error
|
||||||
}]}>
|
}]}>
|
||||||
{tenderData.envelopeASubmittStatus && tenderData.envelopeBSubmittStatus && tenderData.envelopeCSubmittStatus
|
{tenderData?.envelopeASubmittStatus && tenderData?.envelopeBSubmittStatus && tenderData?.envelopeCSubmittStatus
|
||||||
? "COMPLETED" : "PENDING"}
|
? "COMPLETED" : "PENDING"}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.finalStatusRow}>
|
<View style={styles.finalStatusRow}>
|
||||||
<Text style={styles.finalStatusLabel}>Bidding Status:</Text>
|
<Text style={styles.finalStatusLabel}>Bidding Status:</Text>
|
||||||
<Text style={[styles.finalStatusValue,
|
<Text style={[styles.finalStatusValue,
|
||||||
{ color: tenderData.biddingStatus ? colors.success : colors.error }]}>
|
{ color: tenderData?.biddingStatus ? colors.success : colors.error }]}>
|
||||||
{tenderData.biddingStatus ? "ACTIVE" : "CLOSED"}
|
{tenderData?.biddingStatus ? "ACTIVE" : "CLOSED"}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ import MyInput from '../../../../src/Component/MyInput';
|
|||||||
import { pick, types } from '@react-native-documents/picker';
|
import { pick, types } from '@react-native-documents/picker';
|
||||||
import { InsideHeader } from '../../../Component/Index';
|
import { InsideHeader } from '../../../Component/Index';
|
||||||
import colors from '../../../Constant/Color';
|
import colors from '../../../Constant/Color';
|
||||||
import { SUBMIT_ENVELOPE_A, SUBMIT_ENVELOPE_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 axios from 'axios';
|
import axios from 'axios';
|
||||||
import { Fontisto } from '@react-native-vector-icons/fontisto';
|
import { Fontisto } from '@react-native-vector-icons/fontisto';
|
||||||
import { useSubmitEnvelopeA, useSubmitEnvelopeB } from '../../../Services/BBPS/Hooks';
|
import { useSubmitEnvelopeA, useSubmitEnvelopeB, useUploadEnvelopeFile } from '../../../Services/BBPS/Hooks';
|
||||||
|
import { apiCall } from '../../../Axios/Axios';
|
||||||
|
|
||||||
type EnvelopeType = 'A' | 'B' | 'C';
|
type EnvelopeType = 'A' | 'B' | 'C';
|
||||||
type EnvelopeFormState = {
|
type EnvelopeFormState = {
|
||||||
@@ -40,16 +41,14 @@ interface InfoRowProps {
|
|||||||
const TenderBidding = () => {
|
const TenderBidding = () => {
|
||||||
const route = useRoute<any>();
|
const route = useRoute<any>();
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
const { mutate: submitEnvelopeA, isPending } = useSubmitEnvelopeA(() => {
|
const { mutate: submitEnvelopeA, isPending } = useSubmitEnvelopeA()
|
||||||
navigation.goBack()
|
const { mutate: submitEnvelopeB, isPending: isPendingB } = useSubmitEnvelopeB()
|
||||||
})
|
const { mutate: uploadEnvelopeFile, isPending: uploadLoading } =
|
||||||
const { mutate: submitEnvelopeB, isPending: isPendingB } = useSubmitEnvelopeB(() => {
|
useUploadEnvelopeFile()
|
||||||
navigation.goBack()
|
|
||||||
})
|
|
||||||
|
|
||||||
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 | null>('A');
|
const [activeEnvelope, setActiveEnvelope] = useState<EnvelopeType>('A');
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [envelopForm, setEnvelopForm] = useState<EnvelopeFormState>({
|
const [envelopForm, setEnvelopForm] = useState<EnvelopeFormState>({
|
||||||
A: {},
|
A: {},
|
||||||
@@ -326,7 +325,7 @@ const TenderBidding = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const validateEnvelope = () => {
|
const validateEnvelope = () => {
|
||||||
const list = bidData?.[`tenderEnvelope${activeEnvelope}List`] || [];
|
const list = tenderData?.[`tenderEnvelope${activeEnvelope}List`] || [];
|
||||||
const formValues = envelopForm[activeEnvelope];
|
const formValues = envelopForm[activeEnvelope];
|
||||||
|
|
||||||
const missing = list.some((item: any) => {
|
const missing = list.some((item: any) => {
|
||||||
@@ -348,35 +347,59 @@ const TenderBidding = () => {
|
|||||||
return !missing;
|
return !missing;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitEnvelopeA = () => {
|
|
||||||
|
const handleSubmitEnvelopeA = async () => {
|
||||||
if (!validateEnvelope()) {
|
if (!validateEnvelope()) {
|
||||||
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)
|
console.log('Envelope A Payload:', payload);
|
||||||
|
setLoading(true)
|
||||||
|
if (envelopForm?.[activeEnvelope]?.[3]) {
|
||||||
|
handleSubmitEnvelopeFile()
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
|
||||||
|
const res = await apiCall('post',SUBMIT_ENVELOPE_A, payload)
|
||||||
|
console.log("res A envelop : ", res)
|
||||||
|
ToastAndroid.show(res.message, ToastAndroid.SHORT)
|
||||||
|
|
||||||
|
|
||||||
|
navigation.goBack()
|
||||||
|
} catch (error) {
|
||||||
|
console.log("error A envelop submit : ", error)
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleSubmitEnvelopeB = async () => {
|
||||||
|
if (!validateEnvelope()) {
|
||||||
|
Alert.alert('Validation Error', 'Please fill all mandatory fields');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true)
|
||||||
|
const payload = buildEnvelopePayload();
|
||||||
|
console.log('Envelope B Payload:', payload);
|
||||||
|
|
||||||
|
|
||||||
if (envelopForm?.[activeEnvelope]?.[3]) {
|
if (envelopForm?.[activeEnvelope]?.[3]) {
|
||||||
handleSubmitEnvelopeFile()
|
handleSubmitEnvelopeFile()
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
const res = await apiCall('post', SUBMIT_ENVELOPE_B, payload)
|
||||||
|
console.log("res B envelop : ", res)
|
||||||
|
|
||||||
submitEnvelopeA(payload)
|
ToastAndroid.show(res.message, ToastAndroid.SHORT)
|
||||||
}
|
navigation.goBack()
|
||||||
const handleSubmitEnvelopeB = () => {
|
} catch (error) {
|
||||||
if (!validateEnvelope()) {
|
console.log("error B envelop submit : ", error)
|
||||||
Alert.alert('Validation Error', 'Please fill all mandatory fields')
|
} finally {
|
||||||
return
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = buildEnvelopePayload()
|
|
||||||
console.log('Envelope A Payload:', payload)
|
|
||||||
|
|
||||||
if (envelopForm?.[activeEnvelope]?.[3]) {
|
|
||||||
handleSubmitEnvelopeFile()
|
|
||||||
}
|
|
||||||
|
|
||||||
submitEnvelopeB(payload)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmitEnvelopeFile = async () => {
|
const handleSubmitEnvelopeFile = async () => {
|
||||||
@@ -396,8 +419,7 @@ const TenderBidding = () => {
|
|||||||
|
|
||||||
|
|
||||||
console.log("reuestDto for fil doc : ", formData)
|
console.log("reuestDto for fil doc : ", formData)
|
||||||
// return
|
const res = await apiCall('post', activeEnvelope === 'B' ? SUBMIT_ENVELOPE_FILE_B : SUBMIT_ENVELOPE_FILE_A, payload)
|
||||||
const res = await axios.post(activeEnvelope === 'B' ? SUBMIT_ENVELOPE_B : SUBMIT_ENVELOPE_A, payload)
|
|
||||||
console.log(`res file ${activeEnvelope} Payload:`, res)
|
console.log(`res file ${activeEnvelope} Payload:`, res)
|
||||||
ToastAndroid.show(res.message, ToastAndroid.SHORT)
|
ToastAndroid.show(res.message, ToastAndroid.SHORT)
|
||||||
// navigation.goBack()
|
// navigation.goBack()
|
||||||
@@ -408,18 +430,8 @@ const TenderBidding = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<View style={styles.loadingContainer}>
|
|
||||||
<Text>Loading...</Text>
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log("route for date : ", bidData)
|
|
||||||
// console.log("bid envelop : ", tenderData)
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<InsideHeader title="Tender Bidding Start" showArrow />
|
<InsideHeader title="Tender Bidding Start" showArrow />
|
||||||
@@ -492,6 +504,7 @@ const TenderBidding = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
{hasEnvelopes() ? (
|
{hasEnvelopes() ? (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
|||||||
+12
-24
@@ -1,5 +1,5 @@
|
|||||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import { fetchDashboard, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, submitEnvelopeA, submitEnvelopeB } from './apis';
|
import { fetchDashboard, fetchLiveAuction, fetchLiveTender, fetchPurchaseAuction, fetchPurchaseTender, offlineAuctionPurchase, userLogin, offlineTenderPurchase, fetchTenderById, proceedToBid, submitEnvelopeA, submitEnvelopeB, uploadEnvelopeFile, UploadArgs } from './apis';
|
||||||
import { ToastAndroid } from 'react-native';
|
import { ToastAndroid } from 'react-native';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@@ -32,7 +32,7 @@ export const useFetchPurchaseTender = () => {
|
|||||||
getNextPageParam: (lastPage, allPages) => {
|
getNextPageParam: (lastPage, allPages) => {
|
||||||
console.log('last page : ', lastPage)
|
console.log('last page : ', lastPage)
|
||||||
console.log("all page : ", allPages)
|
console.log("all page : ", allPages)
|
||||||
const {totalCount } = lastPage;
|
const { totalCount } = lastPage;
|
||||||
|
|
||||||
const totalPages = Math.ceil(totalCount / 10);
|
const totalPages = Math.ceil(totalCount / 10);
|
||||||
const nextPage = allPages.length;
|
const nextPage = allPages.length;
|
||||||
@@ -122,29 +122,17 @@ export const useProceedToBid = (tenderId?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const useSubmitEnvelopeA = (onSuccessCallback?: () => void) => {
|
export const useSubmitEnvelopeA = () =>
|
||||||
return useMutation({
|
useMutation({
|
||||||
mutationFn: submitEnvelopeA,
|
mutationFn: submitEnvelopeA,
|
||||||
onSuccess: (data) => {
|
|
||||||
ToastAndroid.show(data?.message || 'Submitted successfully', ToastAndroid.SHORT)
|
|
||||||
onSuccessCallback?.()
|
|
||||||
},
|
|
||||||
onError: (error: any) => {
|
|
||||||
console.log('Envelope A submit error:', error)
|
|
||||||
ToastAndroid.show('Something went wrong', ToastAndroid.SHORT)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
export const useSubmitEnvelopeB = (onSuccessCallback?: () => void) => {
|
export const useSubmitEnvelopeB = () =>
|
||||||
return useMutation({
|
useMutation({
|
||||||
mutationFn: submitEnvelopeB,
|
mutationFn: submitEnvelopeB,
|
||||||
onSuccess: (data) => {
|
|
||||||
ToastAndroid.show(data?.message || 'Submitted successfully', ToastAndroid.SHORT)
|
|
||||||
onSuccessCallback?.()
|
|
||||||
},
|
|
||||||
onError: (error: any) => {
|
|
||||||
console.log('Envelope A submit error:', error)
|
|
||||||
ToastAndroid.show('Something went wrong', ToastAndroid.SHORT)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
export const useUploadEnvelopeFile = () =>
|
||||||
|
useMutation({
|
||||||
|
mutationFn: uploadEnvelopeFile,
|
||||||
|
})
|
||||||
|
|||||||
@@ -3,7 +3,15 @@ import { DASHBOARD_COUNT, GET_MY_AUCTION, GET_MY_TENDER, GET_TENDER_DETAILS, LIV
|
|||||||
import { apiCall } from "../../Axios/Axios";
|
import { apiCall } from "../../Axios/Axios";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
|
export type UploadArgs = {
|
||||||
|
activeEnvelope: 'A' | 'B'
|
||||||
|
file: {
|
||||||
|
uri: string
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
payload: any
|
||||||
|
}
|
||||||
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
export const userLogin = async (payload: { emailAdd: string, password: string }): Promise<any> => {
|
||||||
try {
|
try {
|
||||||
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
// const response = await axios.post(LOG_IN_URL, { ...payload, divice: "mobileApp" });
|
||||||
@@ -85,14 +93,42 @@ export const proceedToBid = async (tenderId: string): Promise<any> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const submitEnvelopeA = async (payload: any) => {
|
export const submitEnvelopeA = async (payload: any) => {
|
||||||
|
console.log('SUBMIT ENVELOPE A API CALLED', payload)
|
||||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_A, payload)
|
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_A, payload)
|
||||||
|
console.log("data : ", data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
export const submitEnvelopeB = async (payload: any) => {
|
export const submitEnvelopeB = async (payload: any) => {
|
||||||
|
console.log('SUBMIT ENVELOPE B API CALLED', payload)
|
||||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_B, payload)
|
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_B, payload)
|
||||||
|
console.log("data : ", data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
export const submitEnvelopeFileB = async (payload: any) => {
|
|
||||||
const { data } = await apiCall<any>('post', SUBMIT_ENVELOPE_FILE_B, payload)
|
|
||||||
|
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
|
return data
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user