before merge
This commit is contained in:
@@ -19,5 +19,6 @@ const NavigationString = {
|
|||||||
ProceedToBidDetail:'ProceedToBidDetail',
|
ProceedToBidDetail:'ProceedToBidDetail',
|
||||||
Signup:'Signup',
|
Signup:'Signup',
|
||||||
Registration:'Registration',
|
Registration:'Registration',
|
||||||
|
Partnership:'Partnership',
|
||||||
}
|
}
|
||||||
export default NavigationString
|
export default NavigationString
|
||||||
@@ -44,6 +44,7 @@ export default function MainStack() {
|
|||||||
<Stack.Screen name={NavigationString.ProceedToBidDetail} component={Screens.ProceedToBidDetail} options={option} />
|
<Stack.Screen name={NavigationString.ProceedToBidDetail} component={Screens.ProceedToBidDetail} options={option} />
|
||||||
<Stack.Screen name={NavigationString.StartReverseBidding} component={Screens.StartReverseBidding} options={option} />
|
<Stack.Screen name={NavigationString.StartReverseBidding} component={Screens.StartReverseBidding} options={option} />
|
||||||
<Stack.Screen name={NavigationString.Registration} component={Screens.Registration} options={option} />
|
<Stack.Screen name={NavigationString.Registration} component={Screens.Registration} options={option} />
|
||||||
|
<Stack.Screen name={NavigationString.Partnership} component={Screens.Partnership} options={option} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,278 @@
|
|||||||
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
SafeAreaView,
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
Platform,
|
||||||
|
} from 'react-native';
|
||||||
|
import React, { use, useState } from 'react';
|
||||||
|
import { useNavigation, useRoute, NavigationProp, RouteProp } from '@react-navigation/native';
|
||||||
|
import colors from '../../Constant/Color';
|
||||||
|
import PrimaryButton from '../../Component/PrimaryButton/PrimaryButton';
|
||||||
|
import MyInput from '../../Component/MyInput';
|
||||||
|
import { showToast } from '../../Constant/ShowDailog';
|
||||||
|
import { PARTNER_API_ENDPOINT } from '../../Services/BBPS/ApiUrls';
|
||||||
|
import { usePartnerShipSubmit } from '../../Services/BBPS/Hooks';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
|
import { Navigation } from 'lucide-react-native';
|
||||||
|
import { NavigationString } from '../../Constant/AllImports';
|
||||||
|
|
||||||
|
|
||||||
|
type Partner = {
|
||||||
|
partnerName: string;
|
||||||
|
percentage: string;
|
||||||
|
partnerPan: string;
|
||||||
|
aadharNumber: string;
|
||||||
|
mobileNumber: string;
|
||||||
|
};
|
||||||
|
type Navigation = {
|
||||||
|
replace: (route: string) => void;
|
||||||
|
};
|
||||||
|
type PartnershipParams = {
|
||||||
|
otherId: string | number
|
||||||
|
};
|
||||||
|
const Partnership = () => {
|
||||||
|
const route = useRoute<RouteProp<{ params: PartnershipParams }, 'params'>>();
|
||||||
|
|
||||||
|
const navigation = useNavigation() as Navigation;
|
||||||
|
const [partners, setPartners] = useState<Partner[]>([
|
||||||
|
{
|
||||||
|
partnerName: '',
|
||||||
|
percentage: '',
|
||||||
|
partnerPan: '',
|
||||||
|
aadharNumber: '',
|
||||||
|
mobileNumber: '',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const [focusedField, setFocusedField] = useState<string>('');
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const { mutateAsync:partnerShipSubmit } = usePartnerShipSubmit();
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
const handleChange = (index: number, name: keyof Partner, value: string) => {
|
||||||
|
const updated = [...partners];
|
||||||
|
updated[index][name] = value;
|
||||||
|
setPartners(updated);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAddMore = () => {
|
||||||
|
setPartners(prev => [
|
||||||
|
...prev,
|
||||||
|
{
|
||||||
|
partnerName: '',
|
||||||
|
percentage: '',
|
||||||
|
partnerPan: '',
|
||||||
|
aadharNumber: '',
|
||||||
|
mobileNumber: '',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRemove = (index: number) => {
|
||||||
|
const updated = [...partners];
|
||||||
|
updated.splice(index, 1);
|
||||||
|
setPartners(
|
||||||
|
updated.length > 0
|
||||||
|
? updated
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
partnerName: '',
|
||||||
|
percentage: '',
|
||||||
|
partnerPan: '',
|
||||||
|
aadharNumber: '',
|
||||||
|
mobileNumber: '',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
setLoading(true)
|
||||||
|
try {
|
||||||
|
// Convert percentage strings to numbers and validate
|
||||||
|
const payload = partners.map((p, i) => {
|
||||||
|
const percentage = Number(p.percentage);
|
||||||
|
|
||||||
|
if (isNaN(percentage) || percentage < 0 || percentage > 100) {
|
||||||
|
throw new Error(`Invalid percentage value for partner ${p.partnerName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
contOtherId: route?.params?.otherId,
|
||||||
|
ptnrAadharNo: p.aadharNumber,
|
||||||
|
ptnrMobNo: p.mobileNumber,
|
||||||
|
ptnrName: p.partnerName,
|
||||||
|
ptnrPop: percentage, // Ensure this is a number
|
||||||
|
ptnrPANNo: p.partnerPan,
|
||||||
|
ptnrNo: i,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Validate total percentage equals 100%
|
||||||
|
const totalPercentage = payload.reduce((sum, p) => sum + p.ptnrPop, 0);
|
||||||
|
if (totalPercentage !== 100) {
|
||||||
|
showToast(`Total percentage must equal 100% (currently ${totalPercentage}%)`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Partner ship payload:", payload);
|
||||||
|
const response = await partnerShipSubmit(payload);
|
||||||
|
|
||||||
|
console.log("first ====== ", response)
|
||||||
|
if (response?.statusCode === 200) {
|
||||||
|
console.log('✅ Partners submitted successfully:', response);
|
||||||
|
showToast(response.message || 'Submitted successfully!');
|
||||||
|
navigation.replace(NavigationString.Home);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error('❌ Submission failed:', error.message);
|
||||||
|
showToast(error.message || 'Submission failed. Please check partner details.');
|
||||||
|
}finally{
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<Text style={[styles.heading, { paddingTop: insets.top }]}>Partnership Details</Text>
|
||||||
|
<SafeAreaView style={{ flex: 1 }}>
|
||||||
|
<KeyboardAvoidingView
|
||||||
|
style={{ flex: 1 }}
|
||||||
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
||||||
|
keyboardVerticalOffset={40}
|
||||||
|
>
|
||||||
|
<ScrollView contentContainerStyle={styles.scrollContainer} keyboardShouldPersistTaps="handled">
|
||||||
|
{partners.map((partner, index) => (
|
||||||
|
<View style={{ marginBottom: 20 }} key={index}>
|
||||||
|
<Text style={styles.partnerTitle}>Partner {index + 1}</Text>
|
||||||
|
|
||||||
|
<MyInput
|
||||||
|
icon="user"
|
||||||
|
placeholder="Name of Partner *"
|
||||||
|
value={partner.partnerName}
|
||||||
|
onChangeText={text => handleChange(index, 'partnerName', text)}
|
||||||
|
onFocus={() => setFocusedField(`partnerName-${index}`)}
|
||||||
|
onBlur={() => setFocusedField('')}
|
||||||
|
focused={focusedField === `partnerName-${index}`}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MyInput
|
||||||
|
icon="percent"
|
||||||
|
placeholder="Partnership Percentage *"
|
||||||
|
value={partner.percentage}
|
||||||
|
onChangeText={text => handleChange(index, 'percentage', text)}
|
||||||
|
onFocus={() => setFocusedField(`percentage-${index}`)}
|
||||||
|
onBlur={() => setFocusedField('')}
|
||||||
|
focused={focusedField === `percentage-${index}`}
|
||||||
|
keyboardType="numeric"
|
||||||
|
maxlength={3}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MyInput
|
||||||
|
icon="id-card"
|
||||||
|
placeholder="PAN of Partner *"
|
||||||
|
value={partner.partnerPan}
|
||||||
|
onChangeText={text => handleChange(index, 'partnerPan', text)}
|
||||||
|
onFocus={() => setFocusedField(`partnerPan-${index}`)}
|
||||||
|
onBlur={() => setFocusedField('')}
|
||||||
|
focused={focusedField === `partnerPan-${index}`}
|
||||||
|
autoCapitalize="characters"
|
||||||
|
maxlength={10}
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MyInput
|
||||||
|
icon="credit-card"
|
||||||
|
placeholder="Aadhar Number *"
|
||||||
|
value={partner.aadharNumber}
|
||||||
|
onChangeText={text => handleChange(index, 'aadharNumber', text)}
|
||||||
|
onFocus={() => setFocusedField(`aadharNumber-${index}`)}
|
||||||
|
onBlur={() => setFocusedField('')}
|
||||||
|
focused={focusedField === `aadharNumber-${index}`}
|
||||||
|
keyboardType="numeric"
|
||||||
|
maxlength={12}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MyInput
|
||||||
|
icon="phone"
|
||||||
|
placeholder="Mobile Number *"
|
||||||
|
value={partner.mobileNumber}
|
||||||
|
onChangeText={text => handleChange(index, 'mobileNumber', text)}
|
||||||
|
onFocus={() => setFocusedField(`mobileNumber-${index}`)}
|
||||||
|
onBlur={() => setFocusedField('')}
|
||||||
|
focused={focusedField === `mobileNumber-${index}`}
|
||||||
|
keyboardType="phone-pad"
|
||||||
|
maxlength={10}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{partners.length > 1 && (
|
||||||
|
<TouchableOpacity style={styles.deleteButton} onPress={() => handleRemove(index)}>
|
||||||
|
<Text style={styles.deleteText}>Delete Partner</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<TouchableOpacity style={styles.addButton} onPress={handleAddMore}>
|
||||||
|
<Text style={styles.addText}>+ Add Partner</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</ScrollView>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
|
</SafeAreaView>
|
||||||
|
|
||||||
|
<PrimaryButton title={loading ? "Loading..." : "Submit" }onPress={handleSubmit} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Partnership;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
heading: {
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
marginBottom: 10,
|
||||||
|
marginTop: 10,
|
||||||
|
textAlign: 'center',
|
||||||
|
|
||||||
|
},
|
||||||
|
partnerTitle: {
|
||||||
|
fontWeight: '600',
|
||||||
|
fontSize: 16,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
scrollContainer: {
|
||||||
|
// backgroundColor: color.background,
|
||||||
|
flexGrow: 1,
|
||||||
|
},
|
||||||
|
addButton: {
|
||||||
|
backgroundColor: colors.primary,
|
||||||
|
padding: 10,
|
||||||
|
marginTop: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
alignItems: 'center',
|
||||||
|
width: 140,
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
},
|
||||||
|
addText: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: '600',
|
||||||
|
},
|
||||||
|
deleteButton: {
|
||||||
|
backgroundColor: '#FF5C5C',
|
||||||
|
padding: 10,
|
||||||
|
marginTop: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
alignItems: 'center',
|
||||||
|
width: 140,
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
},
|
||||||
|
deleteText: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: '600',
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -327,6 +327,7 @@ useEffect(() => {
|
|||||||
orgPAN: formData.orgPanNumber,
|
orgPAN: formData.orgPanNumber,
|
||||||
comAadharNo: formData.aadhaarNumber,
|
comAadharNo: formData.aadhaarNumber,
|
||||||
gistnNo: formData.gstnNo,
|
gistnNo: formData.gstnNo,
|
||||||
|
stateName: MasterData?.data?.states?.find((state:any)=>state.stateId==formData.state)?.stateName || '',
|
||||||
};
|
};
|
||||||
console.log('Form Data for registration',formData);
|
console.log('Form Data for registration',formData);
|
||||||
|
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ const Splash: React.FC = () => {
|
|||||||
|
|
||||||
const routeByOrgType = (params: { otherId: any; orgType: any }) => {
|
const routeByOrgType = (params: { otherId: any; orgType: any }) => {
|
||||||
const orgType = String(params.orgType);
|
const orgType = String(params.orgType);
|
||||||
|
console.log("hitting here ")
|
||||||
if (orgType === '4' || orgType === '5' || orgType === '6') {
|
if (orgType === '4' || orgType === '5' || orgType === '6') {
|
||||||
navigation.replace('StageThree', params);
|
navigation.replace('StageThree', params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orgType === '7') {
|
if (orgType === '7') {
|
||||||
navigation.replace('PartnerShip', params);
|
navigation.replace(NavigationString.Partnership, params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ const Splash: React.FC = () => {
|
|||||||
const handleGetData = async () => {
|
const handleGetData = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await registrationStateMutate();
|
const res = await registrationStateMutate();
|
||||||
console.log('Registration status response:', res?.statusCode);
|
console.log('Registration status response:', res);
|
||||||
|
|
||||||
if (res?.statusCode === 404 || res?.statusCode === 401) {
|
if (res?.statusCode === 404 || res?.statusCode === 401) {
|
||||||
navigation.replace('Registration');
|
navigation.replace('Registration');
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import StartReverseBidding from "./Bidding/StartReverseBidding";
|
|||||||
import Home from "./Home/Home";
|
import Home from "./Home/Home";
|
||||||
import Login from "./Login/Login";
|
import Login from "./Login/Login";
|
||||||
import Onboarding from "./Onboarding/Onboarding";
|
import Onboarding from "./Onboarding/Onboarding";
|
||||||
|
import Partnership from "./Ragistration/PartnerShip";
|
||||||
import Registration from "./Ragistration/Ragistration";
|
import Registration from "./Ragistration/Ragistration";
|
||||||
import Signup from "./SignUp/SignUp";
|
import Signup from "./SignUp/SignUp";
|
||||||
import Splash from "./Splash/Splash";
|
import Splash from "./Splash/Splash";
|
||||||
@@ -34,7 +35,8 @@ const Screens = {
|
|||||||
ProceedToBidDetail,
|
ProceedToBidDetail,
|
||||||
StartReverseBidding,
|
StartReverseBidding,
|
||||||
Signup,
|
Signup,
|
||||||
Registration
|
Registration,
|
||||||
|
Partnership
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseTender, fetchTenderById, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, proceedToBid, registerContractor, sendAadhaarOtp, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler } from './apis';
|
import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseTender, fetchTenderById, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, partnerShipSubmit, proceedToBid, registerContractor, sendAadhaarOtp, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler } from './apis';
|
||||||
import { apiCall } from '../../Axios/Axios';
|
import { apiCall } from '../../Axios/Axios';
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@@ -208,3 +208,8 @@ export const useVerifyPan = () =>
|
|||||||
useMutation({
|
useMutation({
|
||||||
mutationFn: contractorStageThreeSubmit,
|
mutationFn: contractorStageThreeSubmit,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const usePartnerShipSubmit = () =>
|
||||||
|
useMutation({
|
||||||
|
mutationFn: partnerShipSubmit,
|
||||||
|
});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios from "axios";
|
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, 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, 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";
|
import { apiCall } from "../../Axios/Axios";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@@ -261,3 +261,13 @@ export const contractorStageThreeSubmit = (
|
|||||||
payload,
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const partnerShipSubmit = (
|
||||||
|
payload: any
|
||||||
|
): Promise<any> => {
|
||||||
|
return apiCall<any>(
|
||||||
|
'post',
|
||||||
|
PARTNER_API_ENDPOINT,
|
||||||
|
payload,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user