correct issues

This commit is contained in:
Jaanu423
2025-10-13 15:07:31 +05:30
parent 848032768c
commit afe43b56a5
17 changed files with 350 additions and 336 deletions
+6 -5
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useState, useCallback } from 'react';
import { View, Text, StyleSheet, ActivityIndicator, ScrollView, RefreshControl, Alert, TouchableOpacity, Modal, TextInput } from 'react-native';
import { View, Text, StyleSheet, ActivityIndicator, ScrollView, RefreshControl, Alert, TouchableOpacity, Modal, TextInput, ToastAndroid } from 'react-native';
import { useRoute, RouteProp } from '@react-navigation/native';
import { Ionicons } from "@react-native-vector-icons/ionicons";
import colors from '../../components/colors';
@@ -121,12 +121,12 @@ const Payments: React.FC = () => {
const amountToWaive = parseFloat(waiverAmount);
if (isNaN(amountToWaive) || amountToWaive < 0) {
Alert.alert("Invalid Input", "Please enter a valid waiver amount.");
ToastAndroid.show("Please enter a valid waiver amount.", ToastAndroid.SHORT);
return;
}
if (amountToWaive > currentParticipant.lateFee) {
Alert.alert("Invalid Amount", `Waiver cannot exceed the current late fee of ₹${currentParticipant.lateFee}.`);
ToastAndroid.show(`Waiver cannot exceed the current late fee of ₹${currentParticipant.lateFee}.`, ToastAndroid.SHORT);
return;
}
@@ -135,14 +135,15 @@ const Payments: React.FC = () => {
const response = await apiCall(url, 'PUT', {}) as any;
if (response && response.statusCode === 200) {
Alert.alert("Success", `₹${amountToWaive} has been waived successfully.`);
ToastAndroid.show(`₹${amountToWaive} has been waived successfully.`, ToastAndroid.SHORT);
setModalVisible(false);
onRefresh();
} else {
throw new Error(response?.message || "Failed to apply waiver.");
}
} catch (error: any) {
Alert.alert("API Error", error.message);
ToastAndroid.show(error.message || "Failed to apply waiver.", ToastAndroid.SHORT);
console.error("Waive Fee Error:", error);
}
};