some bug fixed
This commit is contained in:
@@ -69,6 +69,7 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
const [selectedGroupIds, setSelectedGroupIds] = useState<string[]>([]);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
// console.log("user me : ", userDashboard)
|
||||
// Preselect all due groups at mount and on change
|
||||
useEffect(() => {
|
||||
if (userDashboard?.dueGroupDetails) {
|
||||
@@ -77,22 +78,25 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
}, [userDashboard?.dueGroupDetails]);
|
||||
|
||||
// Show profile completion modal only if profile is incomplete
|
||||
|
||||
console.log("userDashboard : ", userDashboard)
|
||||
useEffect(() => {
|
||||
if (statusData && !statusData.profileStatus) setShowModal(true);
|
||||
}, [statusData]);
|
||||
|
||||
// Top grid info items
|
||||
const infoItems = useMemo(
|
||||
() => [
|
||||
{ label: "Role", value: statusData?.role || "-" },
|
||||
{ label: "Active Groups", value: userDashboard?.activeStatusMyGroupCount?.toString() || "0" },
|
||||
{ label: "Joined Groups", value: userDashboard?.myJoinedGroups?.length?.toString() || "0" },
|
||||
{ label: "My Groups", value: userDashboard?.myCreatedGroups?.length?.toString() || "0" },
|
||||
{ label: "Total Due", value: `₹${userDashboard?.multiplePayAmount || 0}` },
|
||||
{ label: "Completed", value: userDashboard?.completeStatusMyGroupCount?.toString() || "0" },
|
||||
],
|
||||
[userDashboard, statusData]
|
||||
);
|
||||
() => [
|
||||
{ icon: <Ionicons name="person-outline" size={20} color={colors.primary} />, label: "Role", value: statusData?.role || "-" },
|
||||
{ icon: <Ionicons name="pie-chart-outline" size={20} color={colors.primary} />, label: "Active Groups", value: userDashboard?.activeStatusMyGroupCount?.toString() || "0" },
|
||||
{ icon: <Ionicons name="book-outline" size={20} color={colors.primary} />, label: "Joined Groups", value: userDashboard?.myJoinedGroups?.length?.toString() || "0" },
|
||||
{ icon: <Ionicons name="people-outline" size={20} color={colors.primary} />, label: "My Groups", value: userDashboard?.myCreatedGroups?.length?.toString() || "0" },
|
||||
{ icon: <Ionicons name="document-text-outline" size={20} color={colors.primary} />, label: "Total Due", value: `₹${userDashboard?.multiplePayAmount || 0}` },
|
||||
{ icon: <Ionicons name="checkmark-done-outline" size={20} color={colors.primary} />, label: "Completed", value: userDashboard?.completeStatusMyGroupCount?.toString() || "0" },
|
||||
],
|
||||
[userDashboard, statusData]
|
||||
);
|
||||
|
||||
|
||||
// Utility for info color
|
||||
const getValueColor = (value: string) => {
|
||||
@@ -127,18 +131,9 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
}
|
||||
setSubmitting(true);
|
||||
try {
|
||||
const response = await apiCall(PAY_ALL_URL, 'POST',{ groupIds: selectedGroupIds }, undefined, "Payment failed. Try again.") as any;
|
||||
|
||||
console.log("-=-=-=-=-=-=-=-=-=-=-=",response)
|
||||
|
||||
// const response = await fetch(
|
||||
// "https://api.godemo.in/FundCollect/api/payments/payments/bulk",
|
||||
// {
|
||||
// method: "POST",
|
||||
// headers: { "Content-Type": "application/json" },
|
||||
// body: JSON.stringify({ groupIds: selectedGroupIds, payAllDue: true }),
|
||||
// }
|
||||
// );
|
||||
const response = await apiCall(PAY_ALL_URL, 'POST', { groupIds: selectedGroupIds }, undefined, "Payment failed. Try again.") as any;
|
||||
|
||||
console.log("-=-=-=-=-=-=-=-=-=-=-=", response)
|
||||
if (response.status) {
|
||||
ToastAndroid.show("Payment initiated!", ToastAndroid.LONG);
|
||||
setShowPayDialog(false);
|
||||
@@ -186,7 +181,7 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
<Ionicons name="close-circle" color="#000000ff" size={24} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
<ScrollView
|
||||
<ScrollView
|
||||
style={{ maxHeight: 200, width: "100%" }}
|
||||
contentContainerStyle={{ paddingVertical: 8, paddingHorizontal: 4 }}
|
||||
>
|
||||
@@ -261,7 +256,6 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={styles.contentSection}>
|
||||
<View style={styles.leftSection}>
|
||||
<View style={styles.infoGrid}>
|
||||
@@ -269,7 +263,7 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
<View key={item.label} style={styles.infoCard}>
|
||||
<View style={styles.infoCardHeader}>
|
||||
<View style={styles.iconContainer}>
|
||||
<Ionicons name="information-circle-outline" size={16} color={colors.primary} />
|
||||
{item.icon}
|
||||
</View>
|
||||
<Text style={styles.infoLabel} >
|
||||
{item.label}
|
||||
@@ -289,17 +283,19 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
activeOpacity={0.8}
|
||||
>
|
||||
<View style={styles.profileContainer}>
|
||||
{profileImage ? (
|
||||
{profileImage !== undefined ? (
|
||||
<Image source={{ uri: profileImage.uri }} style={styles.avatar} />
|
||||
) : (
|
||||
<View style={styles.avatarPlaceholder}>
|
||||
<Ionicons name="person" size={45} color="#fff" />
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.profileBadge}>
|
||||
<Ionicons name="camera" size={18} color={colors.primary} />
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.infoCardOne}>
|
||||
<Text style={{ color: "#fff", fontWeight: "400"}}>Total Paid Amount {userDashboard?.totalPaidAmountMonth}</Text>
|
||||
{/* <Text style={{ color: "#fff", fontWeight: "400"}}>Total Paid Amount {userDashboard?.totalPaidAmountMonth}</Text> */}
|
||||
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
@@ -318,8 +314,8 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
Your profile is incomplete. Update your details to unlock all features.
|
||||
</Text>
|
||||
<View style={styles.modalButtons}>
|
||||
<TouchableOpacity
|
||||
style={[styles.button, styles.primaryButton]}
|
||||
<TouchableOpacity
|
||||
style={[styles.button, styles.primaryButton]}
|
||||
onPress={() => {
|
||||
setShowModal(false);
|
||||
navigation.navigate("Profile" as never);
|
||||
@@ -328,8 +324,8 @@ const UserProfileStatus: React.FC<UserProfileStatusProps> = ({
|
||||
<Ionicons name="person" size={18} color="#fff" />
|
||||
<Text style={styles.buttonText}>Complete Profile</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={[styles.button, styles.secondaryButton]}
|
||||
<TouchableOpacity
|
||||
style={[styles.button, styles.secondaryButton]}
|
||||
onPress={() => setShowModal(false)}
|
||||
>
|
||||
<Ionicons name="time" size={18} color="#666" />
|
||||
@@ -368,17 +364,17 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: 18,
|
||||
marginBottom: 16,
|
||||
},
|
||||
titleWithIcon: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
titleWithIcon: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
},
|
||||
headerIcon: {
|
||||
marginRight: 8
|
||||
headerIcon: {
|
||||
marginRight: 8
|
||||
},
|
||||
header: {
|
||||
fontSize: 20,
|
||||
fontWeight: "700",
|
||||
color: "#fff"
|
||||
header: {
|
||||
fontSize: 20,
|
||||
fontWeight: "700",
|
||||
color: "#fff"
|
||||
},
|
||||
statusBadge: {
|
||||
flexDirection: 'row',
|
||||
@@ -388,26 +384,26 @@ const styles = StyleSheet.create({
|
||||
paddingVertical: 6,
|
||||
borderRadius: 20,
|
||||
},
|
||||
statusBadgeText: {
|
||||
color: "#fff",
|
||||
fontSize: 13,
|
||||
fontWeight: '600',
|
||||
marginLeft: 4
|
||||
statusBadgeText: {
|
||||
color: "#fff",
|
||||
fontSize: 13,
|
||||
fontWeight: '600',
|
||||
marginLeft: 4
|
||||
},
|
||||
contentSection: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'flex-start',
|
||||
contentSection: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'flex-start',
|
||||
paddingHorizontal: 16,
|
||||
paddingBottom: 16,
|
||||
},
|
||||
leftSection: {
|
||||
flex: 1,
|
||||
marginRight: 16
|
||||
leftSection: {
|
||||
flex: 1,
|
||||
marginRight: 16
|
||||
},
|
||||
infoGrid: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
gap: 10
|
||||
infoGrid: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
gap: 10
|
||||
},
|
||||
infoCard: {
|
||||
backgroundColor: 'rgba(255,255,255,0.15)',
|
||||
@@ -419,10 +415,20 @@ const styles = StyleSheet.create({
|
||||
minWidth: '45%',
|
||||
marginBottom: 8,
|
||||
},
|
||||
infoCardHeader: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 6
|
||||
infoCardOne: {
|
||||
backgroundColor: 'rgba(255,255,255,0.15)',
|
||||
borderRadius: 14,
|
||||
padding: 12,
|
||||
borderWidth: 1,
|
||||
borderColor: 'rgba(255,255,255,0.2)',
|
||||
// flex: 1,
|
||||
minWidth: '45%',
|
||||
marginTop: 21,
|
||||
},
|
||||
infoCardHeader: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 6
|
||||
},
|
||||
iconContainer: {
|
||||
width: 28,
|
||||
@@ -439,9 +445,9 @@ const styles = StyleSheet.create({
|
||||
fontWeight: '500',
|
||||
flexShrink: 1,
|
||||
},
|
||||
infoValue: {
|
||||
fontWeight: "700",
|
||||
fontSize: 16,
|
||||
infoValue: {
|
||||
fontWeight: "700",
|
||||
fontSize: 16,
|
||||
textAlign: 'left',
|
||||
color: "#fff"
|
||||
},
|
||||
@@ -450,8 +456,8 @@ const styles = StyleSheet.create({
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
profileContainer: {
|
||||
alignItems: 'center'
|
||||
profileContainer: {
|
||||
alignItems: 'center'
|
||||
},
|
||||
avatar: {
|
||||
width: 80,
|
||||
@@ -490,10 +496,10 @@ const styles = StyleSheet.create({
|
||||
borderColor: "rgba(255,255,255,0.15)",
|
||||
backgroundColor: "rgba(0,0,0,0.15)",
|
||||
},
|
||||
dueBarText: {
|
||||
color: "#fff",
|
||||
fontSize: 16,
|
||||
fontWeight: "600"
|
||||
dueBarText: {
|
||||
color: "#fff",
|
||||
fontSize: 16,
|
||||
fontWeight: "600"
|
||||
},
|
||||
payAllButton: {
|
||||
backgroundColor: "#ffffffff",
|
||||
@@ -504,10 +510,10 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 20,
|
||||
gap: 6,
|
||||
},
|
||||
payAllButtonText: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "bold",
|
||||
fontSize: 16
|
||||
payAllButtonText: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "bold",
|
||||
fontSize: 16
|
||||
},
|
||||
payModalOverlay: {
|
||||
flex: 1,
|
||||
@@ -535,10 +541,10 @@ const styles = StyleSheet.create({
|
||||
borderBottomWidth: 1,
|
||||
borderColor: "rgba(255,255,255,0.1)",
|
||||
},
|
||||
payDialogTitle: {
|
||||
color: "#000000ff",
|
||||
fontSize: 18,
|
||||
fontWeight: "700"
|
||||
payDialogTitle: {
|
||||
color: "#000000ff",
|
||||
fontSize: 18,
|
||||
fontWeight: "700"
|
||||
},
|
||||
payGroupOption: {
|
||||
flexDirection: "row",
|
||||
@@ -546,7 +552,7 @@ const styles = StyleSheet.create({
|
||||
gap: 16,
|
||||
paddingVertical: 12,
|
||||
paddingHorizontal: 14,
|
||||
borderColor: colors.primary,
|
||||
borderColor: colors.primary,
|
||||
borderWidth: 1,
|
||||
borderRadius: 12,
|
||||
marginBottom: 8,
|
||||
@@ -556,20 +562,20 @@ const styles = StyleSheet.create({
|
||||
borderColor: colors.primary,
|
||||
borderWidth: 1,
|
||||
},
|
||||
payGroupName: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "700",
|
||||
fontSize: 16
|
||||
payGroupName: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "700",
|
||||
fontSize: 16
|
||||
},
|
||||
payDueText: {
|
||||
color: "rgba(0, 0, 0, 0.8)",
|
||||
fontSize: 13,
|
||||
marginTop: 2
|
||||
payDueText: {
|
||||
color: "rgba(0, 0, 0, 0.8)",
|
||||
fontSize: 13,
|
||||
marginTop: 2
|
||||
},
|
||||
payAmount: {
|
||||
fontWeight: "bold",
|
||||
fontSize: 16,
|
||||
color: "#4CAF50"
|
||||
payAmount: {
|
||||
fontWeight: "bold",
|
||||
fontSize: 16,
|
||||
color: "#4CAF50"
|
||||
},
|
||||
payDialogFooter: {
|
||||
flexDirection: "row",
|
||||
@@ -579,10 +585,10 @@ const styles = StyleSheet.create({
|
||||
paddingVertical: 16,
|
||||
paddingHorizontal: 18,
|
||||
},
|
||||
payDialogTotal: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "600",
|
||||
fontSize: 17
|
||||
payDialogTotal: {
|
||||
color: "#000000ff",
|
||||
fontWeight: "600",
|
||||
fontSize: 17
|
||||
},
|
||||
payConfirmButton: {
|
||||
flexDirection: "row",
|
||||
@@ -592,14 +598,14 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: 24,
|
||||
borderRadius: 20,
|
||||
elevation: 4,
|
||||
borderColor:colors.primary,
|
||||
borderWidth:1,
|
||||
borderColor: colors.primary,
|
||||
borderWidth: 1,
|
||||
gap: 8,
|
||||
},
|
||||
payButtonText: {
|
||||
color: "#ffffffff",
|
||||
fontWeight: "bold",
|
||||
fontSize: 16
|
||||
payButtonText: {
|
||||
color: "#ffffffff",
|
||||
fontWeight: "bold",
|
||||
fontSize: 16
|
||||
},
|
||||
modalOverlay: {
|
||||
flex: 1,
|
||||
|
||||
Reference in New Issue
Block a user