forex validations
This commit is contained in:
parent
128b0ea9e6
commit
16e58dca07
BIN
assets/images/IconsImg/Frame.png
Normal file
BIN
assets/images/IconsImg/Frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 391 B |
BIN
assets/images/IconsImg/ViceVersaArrow.png
Normal file
BIN
assets/images/IconsImg/ViceVersaArrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
@ -97,7 +97,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
futurePlans = fetchPlans();
|
futurePlans = fetchPlans();
|
||||||
});
|
});
|
||||||
|
print("Token availa");
|
||||||
// Wait for futurePlans to be fetched and update allPlans
|
// Wait for futurePlans to be fetched and update allPlans
|
||||||
futurePlans.then((plans) {
|
futurePlans.then((plans) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -186,7 +186,9 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final data = json.decode(response.body);
|
final data = json.decode(response.body);
|
||||||
|
print('plansJson1');
|
||||||
List<dynamic> plansJson = data['data'];
|
List<dynamic> plansJson = data['data'];
|
||||||
|
print('plansJson $plansJson');
|
||||||
return plansJson.map((json) => Plan.fromJson(json)).toList();
|
return plansJson.map((json) => Plan.fromJson(json)).toList();
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Failed to load plans');
|
throw Exception('Failed to load plans');
|
||||||
@ -890,6 +892,9 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
print(
|
print(
|
||||||
"Approver Edit2 : ${plan.delegaterId}",
|
"Approver Edit2 : ${plan.delegaterId}",
|
||||||
);
|
);
|
||||||
|
print(
|
||||||
|
"Approver Edit3 : ${plan.approver_status}",
|
||||||
|
);
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
@ -1140,6 +1145,10 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
'Edit The Trip Details',
|
'Edit The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
print(
|
||||||
|
"Approver Edit3 : ${plan.approver_status}",
|
||||||
|
);
|
||||||
|
|
||||||
ApiService.viewPlanForApprover(
|
ApiService.viewPlanForApprover(
|
||||||
context,
|
context,
|
||||||
plan.planId,
|
plan.planId,
|
||||||
|
|||||||
@ -356,6 +356,9 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
print("card - $card");
|
print("card - $card");
|
||||||
print("cash - $cash");
|
print("cash - $cash");
|
||||||
|
|
||||||
|
_validateCardAmount(card);
|
||||||
|
_validateCashAmount(cash);
|
||||||
|
|
||||||
if (!isValidForexData(data)) {
|
if (!isValidForexData(data)) {
|
||||||
// && errorMessages.isNotEmpty) {
|
// && errorMessages.isNotEmpty) {
|
||||||
print("Validation Failed: Required fields are missing.");
|
print("Validation Failed: Required fields are missing.");
|
||||||
@ -411,7 +414,6 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
textControllers["_forexStartDate"]?.addListener(_onFieldChanged);
|
textControllers["_forexStartDate"]?.addListener(_onFieldChanged);
|
||||||
textControllers["_forexEndDate"]?.addListener(_onFieldChanged);
|
textControllers["_forexEndDate"]?.addListener(_onFieldChanged);
|
||||||
|
|
||||||
|
|
||||||
flightFirstTripDateNotifier = ValueNotifier<String?>(null);
|
flightFirstTripDateNotifier = ValueNotifier<String?>(null);
|
||||||
flightLastTripDateNotifier = ValueNotifier<String?>(null);
|
flightLastTripDateNotifier = ValueNotifier<String?>(null);
|
||||||
|
|
||||||
@ -428,26 +430,62 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
// ✅ Only set controller after value is updated
|
// ✅ Only set controller after value is updated
|
||||||
// final parsedDate =
|
// final parsedDate =
|
||||||
// DateTime.tryParse(flightFirstTripDateNotifier.value ?? '');
|
// DateTime.tryParse(flightFirstTripDateNotifier.value ?? '');
|
||||||
|
// -----------------------------------
|
||||||
|
|
||||||
|
// final parsedDate = DateFormat(
|
||||||
|
// "dd-MM-yyyy",
|
||||||
|
// ).parse(flightFirstTripDateNotifier.value ?? '');
|
||||||
|
// if (parsedDate != null) {
|
||||||
|
// textControllers["_forexStartDate"]?.text = DateFormat(
|
||||||
|
// 'dd-MM-yyyy',
|
||||||
|
// ).format(parsedDate);
|
||||||
|
// }
|
||||||
|
final flightDateStr = flightFirstTripDateNotifier.value;
|
||||||
|
|
||||||
|
if (flightDateStr != null && flightDateStr.trim().isNotEmpty) {
|
||||||
|
try {
|
||||||
final parsedDate = DateFormat(
|
final parsedDate = DateFormat(
|
||||||
"dd-MM-yyyy",
|
"dd-MM-yyyy",
|
||||||
).parse(flightFirstTripDateNotifier.value ?? '');
|
).parse(flightDateStr.trim());
|
||||||
if (parsedDate != null) {
|
|
||||||
textControllers["_forexStartDate"]?.text = DateFormat(
|
textControllers["_forexStartDate"]?.text = DateFormat(
|
||||||
'dd-MM-yyyy',
|
'dd-MM-yyyy',
|
||||||
).format(parsedDate);
|
).format(parsedDate);
|
||||||
|
} catch (e) {
|
||||||
|
print("Error parsing flightFirstTripDate: $e");
|
||||||
|
// Optionally show an error message to the user or log it
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("flightFirstTripDateNotifier is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
final parsedEndDate = DateFormat(
|
final flightDateEnd = flightFirstTripDateNotifier.value;
|
||||||
|
|
||||||
|
if (flightDateEnd != null && flightDateEnd.trim().isNotEmpty) {
|
||||||
|
try {
|
||||||
|
final parsedDate = DateFormat(
|
||||||
"dd-MM-yyyy",
|
"dd-MM-yyyy",
|
||||||
).parse(flightLastTripDateNotifier.value ?? '');
|
).parse(flightDateEnd.trim());
|
||||||
if (parsedEndDate != null) {
|
|
||||||
textControllers["_forexEndDate"]?.text = DateFormat(
|
textControllers["_forexEndDate"]?.text = DateFormat(
|
||||||
'dd-MM-yyyy',
|
'dd-MM-yyyy',
|
||||||
).format(parsedEndDate);
|
).format(parsedDate);
|
||||||
|
} catch (e) {
|
||||||
|
print("Error parsing flightEndTripDate: $e");
|
||||||
|
// Optionally show an error message to the user or log it
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("flightEndTripDateNotifier is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUpdatedField();
|
// final parsedEndDate = DateFormat(
|
||||||
|
// "dd-MM-yyyy",
|
||||||
|
// ).parse(flightLastTripDateNotifier.value ?? '');
|
||||||
|
// if (parsedEndDate != null) {
|
||||||
|
// textControllers["_forexEndDate"]?.text = DateFormat(
|
||||||
|
// 'dd-MM-yyyy',
|
||||||
|
// ).format(parsedEndDate);
|
||||||
|
// }
|
||||||
|
|
||||||
|
handleUpdatedField();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,16 +506,22 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
print("UPDATAED SELECTION");
|
print("UPDATAED SELECTION");
|
||||||
|
|
||||||
textControllers["_forexStartDate"] = initController("start_date");
|
textControllers["_forexStartDate"] = initController("start_date");
|
||||||
textControllers["_forexStartDate"]?.addListener(_onFieldChanged); // Reattach
|
textControllers["_forexStartDate"]?.addListener(
|
||||||
|
_onFieldChanged,
|
||||||
|
); // Reattach
|
||||||
textControllers["_forexEndDate"] = initController("end_date");
|
textControllers["_forexEndDate"] = initController("end_date");
|
||||||
textControllers["_forexEndDate"]?.addListener(_onFieldChanged); // Reattach
|
textControllers["_forexEndDate"]?.addListener(
|
||||||
|
_onFieldChanged,
|
||||||
|
); // Reattach
|
||||||
textControllers["_transport"] = initController("transport");
|
textControllers["_transport"] = initController("transport");
|
||||||
textControllers["_accomodation"] = initController("accommodation");
|
textControllers["_accomodation"] = initController("accommodation");
|
||||||
textControllers["_telephone"] = initController("telephone");
|
textControllers["_telephone"] = initController("telephone");
|
||||||
textControllers["_cardNumber"] = initController("card_number");
|
textControllers["_cardNumber"] = initController("card_number");
|
||||||
textControllers["_card"] = initController("deposit_on_card");
|
textControllers["_card"] = initController("deposit_on_card");
|
||||||
textControllers["_cash"] = initController("deposit_on_cash");
|
textControllers["_cash"] = initController("deposit_on_cash");
|
||||||
textControllers["_deliveryLocation"] = initController("delivery_location");
|
textControllers["_deliveryLocation"] = initController(
|
||||||
|
"delivery_location",
|
||||||
|
);
|
||||||
textControllers["_comments"] = initController("comments");
|
textControllers["_comments"] = initController("comments");
|
||||||
|
|
||||||
// Set dropdown values
|
// Set dropdown values
|
||||||
@ -1162,7 +1206,8 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
errorMessages["end_date"]!,
|
errorMessages["end_date"]!,
|
||||||
style: const TextStyle(color: Colors.red, fontSize: 12),
|
style: const TextStyle(color: Colors.red, fontSize: 12),
|
||||||
maxLines: 2, // Allow it to wrap onto two lines
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
overflow:
|
||||||
|
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -51,10 +51,15 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
Map<String, String> tempCountryMap = {};
|
Map<String, String> tempCountryMap = {};
|
||||||
|
|
||||||
for (var country in result) {
|
for (var country in result) {
|
||||||
String city = country['City'] ?? '';
|
// String city = country['City'] ?? '';
|
||||||
String airport = country['Airport'] ?? '';
|
// String airport = country['Airport'] ?? '';
|
||||||
String displayName = '${country['City']} - ${country['Airport']}';
|
// String displayName = '${country['City']} - ${country['Airport']}';
|
||||||
// String displayName = '${country['City']} | ${country['Airport']}';
|
// // String displayName = '${country['City']} | ${country['Airport']}';
|
||||||
|
|
||||||
|
final code = country['Code'] ?? '';
|
||||||
|
final city = country['City'] ?? '';
|
||||||
|
final airport = country['Airport'] ?? '';
|
||||||
|
final displayName = '$city ($code)\n$airport';
|
||||||
|
|
||||||
tempCountryMap[country['Code']] = displayName;
|
tempCountryMap[country['Code']] = displayName;
|
||||||
}
|
}
|
||||||
@ -346,7 +351,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 5,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Sector",
|
"Sector",
|
||||||
style: GoogleFonts.poppins(fontSize: 11),
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
@ -374,13 +379,38 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
if (item["trips"] != null && item["trips"].isNotEmpty)
|
if (item["trips"] != null && item["trips"].isNotEmpty)
|
||||||
...item["trips"].map<Widget>((trip) {
|
...item["trips"].map<Widget>((trip) {
|
||||||
|
print("werewrewrTrip - $trip");
|
||||||
|
|
||||||
String fromPlaceCountry =
|
String fromPlaceCountry =
|
||||||
countryMap[trip["from_place"]?.toString()] ??
|
countryMap[trip["from_place"]?.toString()] ??
|
||||||
"Unknown Country";
|
"Unknown Country";
|
||||||
|
|
||||||
|
final parts = fromPlaceCountry.split('\n');
|
||||||
|
final cityAndCode = parts[0];
|
||||||
|
final fromairport = parts.length > 1 ? parts[1] : '';
|
||||||
|
|
||||||
|
// Extract city and code from "City (CODE)"
|
||||||
|
final cityMatch = RegExp(
|
||||||
|
r'^(.*)\s+\(([^)]+)\)$',
|
||||||
|
).firstMatch(cityAndCode);
|
||||||
|
final fromcity = cityMatch?.group(1) ?? '';
|
||||||
|
final fromcode = cityMatch?.group(2) ?? '';
|
||||||
|
|
||||||
String toPlaceCountry =
|
String toPlaceCountry =
|
||||||
countryMap[trip["to_place"]?.toString()] ??
|
countryMap[trip["to_place"]?.toString()] ??
|
||||||
"Unknown Country";
|
"Unknown Country";
|
||||||
|
|
||||||
|
final toparts = toPlaceCountry.split('\n');
|
||||||
|
final tocityAndCode = toparts[0];
|
||||||
|
final toairport = toparts.length > 1 ? toparts[1] : '';
|
||||||
|
|
||||||
|
// Extract city and code from "City (CODE)"
|
||||||
|
final tocityMatch = RegExp(
|
||||||
|
r'^(.*)\s+\(([^)]+)\)$',
|
||||||
|
).firstMatch(tocityAndCode);
|
||||||
|
final tocity = tocityMatch?.group(1) ?? '';
|
||||||
|
final tocode = tocityMatch?.group(2) ?? '';
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -398,36 +428,74 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: Column(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"$fromPlaceCountry",
|
"$fromcity ($fromcode)",
|
||||||
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 10),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/IconsImg/alternate.png',
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
"$toPlaceCountry",
|
"$fromairport",
|
||||||
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 10,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/Frame.png',
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$tocity ($tocode)",
|
||||||
|
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"$toairport",
|
||||||
|
// "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -478,6 +546,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
"Sector",
|
"Sector",
|
||||||
"${trip["from_place"] ?? "N/A"} - ${trip["to_place"] ?? "N/A"}",
|
"${trip["from_place"] ?? "N/A"} - ${trip["to_place"] ?? "N/A"}",
|
||||||
),
|
),
|
||||||
|
|
||||||
_buildKeyValueRow(
|
_buildKeyValueRow(
|
||||||
"Date",
|
"Date",
|
||||||
formatDate(trip["date"] ?? ""),
|
formatDate(trip["date"] ?? ""),
|
||||||
|
|||||||
@ -54,7 +54,8 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Select Trip Type'),
|
title: const Text('Select Trip Type'),
|
||||||
content: const Text(
|
content: const Text(
|
||||||
'Please select a trip type before adding a Train.'),
|
'Please select a trip type before adding a Train.',
|
||||||
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
@ -109,16 +110,19 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor: widget.isViewMode
|
cursor:
|
||||||
|
widget.isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: MouseRegion(
|
child: MouseRegion(
|
||||||
cursor: widget.isViewMode
|
cursor:
|
||||||
|
widget.isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: widget.isViewMode
|
onTap:
|
||||||
|
widget.isViewMode
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
print("New data");
|
print("New data");
|
||||||
@ -137,7 +141,7 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
Icons.add_circle_sharp,
|
Icons.add_circle_sharp,
|
||||||
size: 30,
|
size: 30,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -193,9 +197,9 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// Scroll behavior based on device
|
|
||||||
|
|
||||||
_buildData(context, isDesktop)
|
// Scroll behavior based on device
|
||||||
|
_buildData(context, isDesktop),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -268,8 +272,11 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
|
|
||||||
if (hour == 24 && minute == 0) {
|
if (hour == 24 && minute == 0) {
|
||||||
// 24:00 is treated as 00:00 on the next day
|
// 24:00 is treated as 00:00 on the next day
|
||||||
dateTime = DateTime(now.year, now.month, now.day)
|
dateTime = DateTime(
|
||||||
.add(const Duration(days: 1));
|
now.year,
|
||||||
|
now.month,
|
||||||
|
now.day,
|
||||||
|
).add(const Duration(days: 1));
|
||||||
} else {
|
} else {
|
||||||
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
||||||
throw FormatException("Invalid hour or minute");
|
throw FormatException("Invalid hour or minute");
|
||||||
@ -356,9 +363,7 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(color: Colors.blueGrey.shade50),
|
||||||
color: Colors.blueGrey.shade50,
|
|
||||||
),
|
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
@ -367,34 +372,30 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Class",
|
" Class",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 4,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Planned Trips",
|
" Planned Trips",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Date",
|
" Date",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Comments",
|
" Comments",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
@ -410,20 +411,103 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: Text(
|
|
||||||
"$fromPlaceCountry - $toPlaceCountry",
|
// child: Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// flex: 1,
|
||||||
|
// child: Text(
|
||||||
|
// "$fromPlaceCountry",
|
||||||
|
// // "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
|
// style: GoogleFonts.poppins(
|
||||||
|
// fontSize: 12,
|
||||||
|
// fontWeight: FontWeight.w700,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Expanded(
|
||||||
|
// flex: 1,
|
||||||
|
// child: Padding(
|
||||||
|
// padding: const EdgeInsets.only(left: 10),
|
||||||
|
// child: Image.asset(
|
||||||
|
// 'assets/images/IconsImg/Frame.png',
|
||||||
|
// width: 20,
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Expanded(
|
||||||
|
// flex: 1,
|
||||||
|
// child: Text(
|
||||||
|
// "$toPlaceCountry",
|
||||||
|
// // "${trip["from_place"]?.toString()} - ${trip["to_place"]?.toString()}",
|
||||||
|
// style: GoogleFonts.poppins(
|
||||||
|
// fontSize: 12,
|
||||||
|
// fontWeight: FontWeight.w700,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$fromPlaceCountry ",
|
||||||
|
|
||||||
// "${item["from_station"]!} - ${(item["to_station"])}",
|
// "${item["from_station"]!} - ${(item["to_station"])}",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
SizedBox(width: 10),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/Frame.png',
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$toPlaceCountry",
|
||||||
|
|
||||||
|
// "$fromPlaceCountry - $toPlaceCountry",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
// SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -438,7 +522,9 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: _buildComments(
|
child: _buildComments(
|
||||||
"Comments:", item["comments"] ?? "N/A"),
|
"Comments:",
|
||||||
|
item["comments"] ?? "N/A",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -447,8 +533,8 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
children: [
|
children: [
|
||||||
_buildRow(
|
_buildRow(
|
||||||
"Class:",
|
"Class:",
|
||||||
getRequestForTrainClass(
|
getRequestForTrainClass(item["class"]!.toString()),
|
||||||
item["class"]!.toString())),
|
),
|
||||||
_buildRow("From:", item["from_station"]!),
|
_buildRow("From:", item["from_station"]!),
|
||||||
_buildRow("To:", item["to_station"]!),
|
_buildRow("To:", item["to_station"]!),
|
||||||
_buildDateTimeRow(
|
_buildDateTimeRow(
|
||||||
@ -458,7 +544,7 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
),
|
),
|
||||||
_buildRow("Comments:", item["comments"] ?? "N/A"),
|
_buildRow("Comments:", item["comments"] ?? "N/A"),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -487,30 +573,36 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: exceedsLimit
|
child:
|
||||||
|
exceedsLimit
|
||||||
? Tooltip(
|
? Tooltip(
|
||||||
message: wrapText(value, 50),
|
message: wrapText(value, 50),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade200, // Black background
|
color: Colors.grey.shade200, // Black background
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
textStyle:
|
textStyle: TextStyle(
|
||||||
TextStyle(color: Colors.black), // Tooltip text color
|
color: Colors.black,
|
||||||
|
), // Tooltip text color
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
preferBelow: false,
|
preferBelow: false,
|
||||||
child: Text(value.substring(0, limit) + "...",
|
child: Text(
|
||||||
|
value.substring(0, limit) + "...",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontFamily: "Archivo"),
|
fontFamily: "Archivo",
|
||||||
overflow: TextOverflow.ellipsis),
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontFamily: "Archivo"),
|
fontFamily: "Archivo",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -538,36 +630,30 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600),
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: exceedsLimit
|
child:
|
||||||
|
exceedsLimit
|
||||||
? Tooltip(
|
? Tooltip(
|
||||||
message: wrapText(value, 50),
|
message: wrapText(value, 50),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade200, // Black background
|
color: Colors.grey.shade200, // Black background
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
textStyle:
|
textStyle: TextStyle(
|
||||||
TextStyle(color: Colors.black), // Tooltip text color
|
color: Colors.black,
|
||||||
|
), // Tooltip text color
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
preferBelow: false,
|
preferBelow: false,
|
||||||
child: Text(value.substring(0, limit) + "...",
|
child: Text(
|
||||||
style: GoogleFonts.poppins(
|
value.substring(0, limit) + "...",
|
||||||
fontSize: 12,
|
style: GoogleFonts.poppins(fontSize: 12),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis),
|
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(value, style: GoogleFonts.poppins(fontSize: 12)),
|
||||||
value,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -579,18 +665,10 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: TextStyle(
|
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12),
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(child: Text("$date, $time", style: TextStyle(fontSize: 12))),
|
||||||
child: Text(
|
|
||||||
"$date, $time",
|
|
||||||
style: TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1173,17 +1173,18 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
print("ViewAAA - $planData");
|
print("ViewAAA - $planData");
|
||||||
print("Call viewPlanForApprover");
|
print("Call viewPlanForApprover");
|
||||||
|
|
||||||
ApiService.viewPlanForApprover(
|
// ApiService.viewPlanForApprover(
|
||||||
context,
|
// context,
|
||||||
data['plan_id'],
|
// data['plan_id'],
|
||||||
data['approverId'],
|
// data['approverId'],
|
||||||
data['delegaterId'],
|
// data['delegaterId'],
|
||||||
data['approver_status'],
|
// data['approver_status'],
|
||||||
|
//
|
||||||
isViewMode: false,
|
// isViewMode: false,
|
||||||
isApprover: true,
|
// isApprover: true,
|
||||||
);
|
// );
|
||||||
|
// Close loading dialog (ONLY if still mounted)
|
||||||
|
if (mounted) Navigator.of(context, rootNavigator: true).pop();
|
||||||
context.go('/approvallist');
|
context.go('/approvallist');
|
||||||
} else {
|
} else {
|
||||||
print("$methodName failed. Status: ${response.statusCode}");
|
print("$methodName failed. Status: ${response.statusCode}");
|
||||||
@ -3172,6 +3173,11 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
statusValue = "Approved";
|
statusValue = "Approved";
|
||||||
});
|
});
|
||||||
callApproveAPI(selectedPlanId!, planData['user_id']);
|
callApproveAPI(selectedPlanId!, planData['user_id']);
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) => const SavingLoader(),
|
||||||
|
);
|
||||||
} else if (result is String) {
|
} else if (result is String) {
|
||||||
// User rejected with remarks
|
// User rejected with remarks
|
||||||
_remarksController.text = result;
|
_remarksController.text = result;
|
||||||
|
|||||||
@ -720,7 +720,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (start_Date != null &&
|
if (start_Date != null &&
|
||||||
end_Date != null &&
|
end_Date != null &&
|
||||||
end_Date.isBefore(start_Date)) {
|
end_Date.isBefore(start_Date)) {
|
||||||
print("End date cannot be earlier than start date");
|
print("Invalid Date Range");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -457,7 +457,7 @@ class _OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["employee_code"]!,
|
widget.errorMessages["employee_code"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -802,7 +802,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["first_name"]!,
|
widget.errorMessages["first_name"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -848,7 +848,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["last_name"]!,
|
widget.errorMessages["last_name"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1168,7 +1168,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["email"]!,
|
widget.errorMessages["email"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1229,7 +1229,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["mobile_no"]!,
|
widget.errorMessages["mobile_no"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1281,7 +1281,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["alternate_mobile_no"]!,
|
widget.errorMessages["alternate_mobile_no"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1612,7 +1612,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["role_id"]!,
|
widget.errorMessages["role_id"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1703,7 +1703,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
widget.errorMessages["password"]!,
|
widget.errorMessages["password"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -195,7 +195,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
end_Date != null &&
|
end_Date != null &&
|
||||||
end_Date.isBefore(start_Date)) {
|
end_Date.isBefore(start_Date)) {
|
||||||
setState(() {
|
setState(() {
|
||||||
errorMessages["date_of_expiry"] = "End date cannot be earlier";
|
errorMessages["date_of_expiry"] = "Invalid Date Range";
|
||||||
});
|
});
|
||||||
print("End date cannot be earlier than start date");
|
print("End date cannot be earlier than start date");
|
||||||
}
|
}
|
||||||
@ -203,6 +203,11 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
print("Invalid passport date format");
|
print("Invalid passport date format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorMessages.isNotEmpty) {
|
||||||
|
print("Validation failed with errors: $errorMessages");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Additional validation starts - travelDetailsData passport
|
// Additional validation starts - travelDetailsData passport
|
||||||
// DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
// DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
||||||
// DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
// DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
||||||
@ -1379,7 +1384,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["passport_number"]!,
|
errorMessages["passport_number"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -1458,8 +1463,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
// Revalidate expiry
|
// Revalidate expiry
|
||||||
if (_selectedDateOfExpiry != null &&
|
if (_selectedDateOfExpiry != null &&
|
||||||
_selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) {
|
_selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) {
|
||||||
errorMessages["date_of_expiry"] =
|
errorMessages["date_of_expiry"] = "Invalid Date Range";
|
||||||
"Expiry date cannot be earlier than Issue date";
|
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("date_of_expiry");
|
errorMessages.remove("date_of_expiry");
|
||||||
}
|
}
|
||||||
@ -1585,8 +1589,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
|
|
||||||
if (_selectedDateOfIssue != null &&
|
if (_selectedDateOfIssue != null &&
|
||||||
_selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) {
|
_selectedDateOfExpiry!.isBefore(_selectedDateOfIssue!)) {
|
||||||
errorMessages["date_of_expiry"] =
|
errorMessages["date_of_expiry"] = "Invalid Date Range";
|
||||||
"Expiry date cannot be earlier than Issue date";
|
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("date_of_expiry");
|
errorMessages.remove("date_of_expiry");
|
||||||
}
|
}
|
||||||
@ -1668,7 +1671,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["date_of_expiry"]!,
|
errorMessages["date_of_expiry"]!,
|
||||||
style: const TextStyle(color: Colors.red, fontSize: 10),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 10),
|
||||||
maxLines: 2, // Allow it to wrap onto two lines
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
overflow:
|
overflow:
|
||||||
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
@ -2905,7 +2908,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["forex_pre_paid_card_number"]!,
|
errorMessages["forex_pre_paid_card_number"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -4175,8 +4178,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
// Revalidate expiry
|
// Revalidate expiry
|
||||||
if (_selectedCheckOutDate != null &&
|
if (_selectedCheckOutDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] =
|
errorMessages["valid_upto"] = "Invalid Date Range";
|
||||||
"valid upto cannot be earlier than valid from";
|
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto");
|
||||||
}
|
}
|
||||||
@ -4293,8 +4295,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
|
|
||||||
if (_selectedCheckInDate != null &&
|
if (_selectedCheckInDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] =
|
errorMessages["valid_upto"] = "Invalid Date Range";
|
||||||
"valid upto cannot be earlier than valid from";
|
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto");
|
||||||
}
|
}
|
||||||
@ -4355,7 +4356,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["valid_upto"]!,
|
errorMessages["valid_upto"]!,
|
||||||
style: const TextStyle(color: Colors.red, fontSize: 10),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 10),
|
||||||
maxLines: 2, // Allow it to wrap onto two lines
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
overflow:
|
overflow:
|
||||||
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
|
|
||||||
Future<List<dynamic>> fetchUsers() async {
|
Future<List<dynamic>> fetchUsers() async {
|
||||||
orgId = await getOrgId();
|
orgId = await getOrgId();
|
||||||
final String apiUrlData = '$apiUrl/api/users?org_id=$orgId';
|
final String apiUrlData = '$apiUrl/api/users?org_id=$orgId&for=table_view';
|
||||||
final String? token = await getToken();
|
final String? token = await getToken();
|
||||||
|
|
||||||
print("Fetch Users");
|
print("Fetch Users");
|
||||||
@ -294,7 +294,13 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
// Refresh user list after update
|
// Refresh user list after update
|
||||||
void refreshUserList() {
|
void refreshUserList() {
|
||||||
setState(() {
|
setState(() {
|
||||||
futureUsers = fetchUsers(); // Re-fetch users after status update
|
futureUsers = fetchUsers();
|
||||||
|
|
||||||
|
futureUsers.then((users) {
|
||||||
|
setState(() {
|
||||||
|
allUsers = users;
|
||||||
|
});
|
||||||
|
}); // Re-fetch users after status update
|
||||||
// Wait for futurePlans to be fetched and update allPlans
|
// Wait for futurePlans to be fetched and update allPlans
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -724,7 +730,9 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
GestureDetector(
|
MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
handleToggleUserStatus(
|
handleToggleUserStatus(
|
||||||
user['user_id'],
|
user['user_id'],
|
||||||
@ -747,6 +755,7 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
UserActionsMenu(
|
UserActionsMenu(
|
||||||
user: user,
|
user: user,
|
||||||
@ -1146,7 +1155,6 @@ class _UserListScreenState extends State<UserListScreen> {
|
|||||||
// )
|
// )
|
||||||
// : buildMobileCardView(paginatedUser),
|
// : buildMobileCardView(paginatedUser),
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child:
|
child:
|
||||||
isDesktop
|
isDesktop
|
||||||
|
|||||||
@ -44,24 +44,32 @@ class Plan {
|
|||||||
factory Plan.fromJson(Map<String, dynamic> json) {
|
factory Plan.fromJson(Map<String, dynamic> json) {
|
||||||
print('Parsing Plan from JSON: $json');
|
print('Parsing Plan from JSON: $json');
|
||||||
return Plan(
|
return Plan(
|
||||||
planId: json['plan_id'],
|
planId: json['plan_id']!.toString(),
|
||||||
employeeCode: json['employee_code'],
|
employeeCode: json['employee_code']!.toString(),
|
||||||
tripTitle: json['trip_title'],
|
tripTitle: json['trip_title']!.toString(),
|
||||||
tripType: json['trip_type_value'],
|
tripType: json['trip_type_value']!.toString(),
|
||||||
approver_status: json['approver_status'],
|
approver_status:
|
||||||
|
json["approver_status"] == null
|
||||||
|
? ''
|
||||||
|
: json['approver_status']!.toString(),
|
||||||
status: json['status'] == "0" ? "Inactive" : "Active",
|
status: json['status'] == "0" ? "Inactive" : "Active",
|
||||||
costCenter: json['cost_center_value'] ?? '',
|
costCenter: json['cost_center_value']!.toString(),
|
||||||
functionalDepartment: json['functional_department_value'] ?? '',
|
functionalDepartment: json['functional_department_value']!.toString(),
|
||||||
purposeOfTravel: json['purpose_of_travel_value'] ?? '',
|
purposeOfTravel: json['purpose_of_travel_value']!.toString(),
|
||||||
soNumber: json['so_number'] ?? '',
|
soNumber: json['so_number']!.toString(),
|
||||||
description: json['description'] ?? '',
|
description: json['description']!.toString(),
|
||||||
isBillable: json['is_billable_value'] ?? '',
|
isBillable: json['is_billable_value']!.toString(),
|
||||||
userName: json["user_name"] ?? '',
|
userName: json["user_name"]!.toString(),
|
||||||
travellerName: json["traveller_name"] ?? '',
|
travellerName:
|
||||||
statusValue: json["status_value"] ?? '',
|
json["traveller_name"] == null
|
||||||
createdOn: json["created_on"] ?? '',
|
? ''
|
||||||
approverId: json['approver_id'],
|
: json["traveller_name"]!.toString(),
|
||||||
delegaterId: json['delegater_id'],
|
statusValue: json["status_value"]!.toString(),
|
||||||
|
createdOn: json["created_on"],
|
||||||
|
approverId:
|
||||||
|
json["approver_id"] == null ? '' : json['approver_id']!.toString(),
|
||||||
|
delegaterId:
|
||||||
|
json["delegater_id"] == null ? '' : json['delegater_id']!.toString(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -618,8 +618,8 @@ class ApiService {
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
String planId,
|
String planId,
|
||||||
String? approverId,
|
String? approverId,
|
||||||
String? approver_status,
|
String? delegaterId,
|
||||||
String? delegaterId, {
|
String? approver_status, {
|
||||||
bool isViewMode = false,
|
bool isViewMode = false,
|
||||||
bool isApprover = true,
|
bool isApprover = true,
|
||||||
}) async {
|
}) async {
|
||||||
|
|||||||
@ -101,6 +101,8 @@ flutter:
|
|||||||
- assets/images/login/microsoft.png
|
- assets/images/login/microsoft.png
|
||||||
- assets/images/IconsImg/path.png
|
- assets/images/IconsImg/path.png
|
||||||
- assets/images/IconsImg/alternate.png
|
- assets/images/IconsImg/alternate.png
|
||||||
|
- assets/images/IconsImg/ViceVersaArrow.png
|
||||||
|
- assets/images/IconsImg/Frame.png
|
||||||
- assets/images/IconsImg/delete.png
|
- assets/images/IconsImg/delete.png
|
||||||
- assets/images/IconsImg/edit.png
|
- assets/images/IconsImg/edit.png
|
||||||
- assets/images/IconsImg/planPdf_icon.png
|
- assets/images/IconsImg/planPdf_icon.png
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user