FIX_TRACKER

This commit is contained in:
venbaittech 2025-08-01 18:30:41 +05:30
parent b24215272f
commit fa00f90f8a
8 changed files with 822 additions and 677 deletions

View File

@ -445,16 +445,14 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
item["destination_city"], item["destination_city"],
), ),
SizedBox(height: 5), SizedBox(height: 5),
_buildDateTimeRow( _buildRow(
"Check (in)", "Check (in)",
formatDate(item["checkin_date"]!), "${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}",
formatTime(item["checkin_time"]!),
), ),
SizedBox(height: 5), SizedBox(height: 5),
_buildDateTimeRow( _buildRow(
"Check (out)", "Check (out)",
formatDate(item["checkout_date"]!), "${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}",
formatTime(item["checkout_time"]!),
), ),
SizedBox(height: 5), SizedBox(height: 5),
_buildRow("Comments:", item["comments"] ?? "N/A"), _buildRow("Comments:", item["comments"] ?? "N/A"),
@ -630,7 +628,6 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
SizedBox( SizedBox(
// color: Colors.yellowAccent.shade100, // color: Colors.yellowAccent.shade100,
width: 100, width: 100,
child: Expanded(
child: Text( child: Text(
title, title,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
@ -639,7 +636,6 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
), ),
), ),
), ),
),
SizedBox(width: 5), SizedBox(width: 5),
// Expanded(child: Text(value, style: TextStyle(fontSize: 12))), // Expanded(child: Text(value, style: TextStyle(fontSize: 12))),
Expanded( Expanded(

View File

@ -321,7 +321,9 @@ class _ForexListWidgetState extends State<ForexListWidget> {
Row( Row(
// mainAxisAlignment: MainAxisAlignment.end, // mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text( Expanded(
flex: 1,
child: Text(
getRequestForCountry(item["country_code"]!.toString()), getRequestForCountry(item["country_code"]!.toString()),
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
@ -330,6 +332,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
color: !isDesktop ? Colors.black : Color(0xFF575A74), color: !isDesktop ? Colors.black : Color(0xFF575A74),
), ),
), ),
),
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () => widget.onOpen(true, item, "Forex"), onTap: () => widget.onOpen(true, item, "Forex"),
@ -357,7 +360,6 @@ class _ForexListWidgetState extends State<ForexListWidget> {
), ),
), ),
), ),
SizedBox(width: 10),
item['forex_id'] != null item['forex_id'] != null
? IconButton( ? IconButton(
icon: Icon( icon: Icon(

View File

@ -578,8 +578,6 @@ class TemplateForexState extends State<TemplateForex> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Container( Container(
@ -591,11 +589,9 @@ class TemplateForexState extends State<TemplateForex> {
tooltip: 'Go To Organization Settings', tooltip: 'Go To Organization Settings',
onTap: (context) { onTap: (context) {
context.go("/OrganizationSettings"); context.go("/OrganizationSettings");
} },
),
BreadcrumbItem(
title: 'Forex',
), ),
BreadcrumbItem(title: 'Forex'),
], ],
), ),
), ),
@ -788,7 +784,7 @@ class TemplateForexState extends State<TemplateForex> {
), ),
Container( Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
height: MediaQuery.of(context).size.height * 0.5, height: MediaQuery.of(context).size.height * 0.45,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
border: Border.all(color: Color(0xFFD6D5E6), width: 0.5), border: Border.all(color: Color(0xFFD6D5E6), width: 0.5),
@ -862,7 +858,8 @@ class TemplateForexState extends State<TemplateForex> {
SizedBox(width: 10), SizedBox(width: 10),
SizedBox( SizedBox(
child: ElevatedButton( child: ElevatedButton(
onPressed: isDisable onPressed:
isDisable
? null ? null
: () async { : () async {
setState(() { setState(() {

View File

@ -1131,7 +1131,7 @@ class _OrgSetUpState extends State<OrgSetUp> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
), ),
onPressed: () { onPressed: () {
context.go('/listPlan'); context.go('/OrganizationSettings');
}, },
child: Text("Cancel", style: GoogleFonts.poppins(fontSize: 12)), child: Text("Cancel", style: GoogleFonts.poppins(fontSize: 12)),
), ),

View File

@ -18,10 +18,10 @@ import '../../../services/apiService.dart';
import '../../../utils/pagination.dart'; import '../../../utils/pagination.dart';
import '../../../widgets/custom_breadcrumb_navigation.dart'; import '../../../widgets/custom_breadcrumb_navigation.dart';
import '../../../widgets/popup_travelAgentList_action.dart'; import '../../../widgets/popup_travelAgentList_action.dart';
/// import '../../../widgets/custom_popup.dart'; /// import '../../../widgets/custom_popup.dart';
/// import '../../../../widgets/popup_TravelAgentList_action.dart'; /// import '../../../../widgets/popup_TravelAgentList_action.dart';
class TravelAgentListScreen extends StatefulWidget { class TravelAgentListScreen extends StatefulWidget {
@override @override
_TravelAgentListScreenState createState() => _TravelAgentListScreenState(); _TravelAgentListScreenState createState() => _TravelAgentListScreenState();
@ -144,7 +144,8 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
Future<List<dynamic>> fetchUsers() async { Future<List<dynamic>> fetchUsers() async {
// return []; // return [];
orgId = await getOrgId(); orgId = await getOrgId();
final String apiUrlData = '$apiUrl/api/agentList?org_id=$orgId&for=table_view'; final String apiUrlData =
'$apiUrl/api/agentList?org_id=$orgId&for=table_view';
final String? token = await getToken(); final String? token = await getToken();
print("Fetch Users"); print("Fetch Users");
@ -463,11 +464,9 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
tooltip: 'Go To Organization Settings', tooltip: 'Go To Organization Settings',
onTap: (context) { onTap: (context) {
context.go("/OrganizationSettings"); context.go("/OrganizationSettings");
} },
),
BreadcrumbItem(
title: 'Travel Agent',
), ),
BreadcrumbItem(title: 'Travel Agent'),
], ],
), ),
), ),
@ -848,7 +847,8 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
children: [ children: [
GestureDetector( GestureDetector(
child: Tooltip( child: Tooltip(
message: 'Edit Travel Agent Details', message:
'Edit Travel Agent Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
@ -858,12 +858,18 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
onTap: () async { onTap: () async {
// Navigator.pop(context); // Close the menu // Navigator.pop(context); // Close the menu
// final userId = user['user_id']; // final userId = user['user_id'];
final userId = int.parse(user['user_id'].toString()); final userId = int.parse(
final usersData = await apiService.getSingleUser(userId); user['user_id'].toString(),
context.go("/CreateTravelAgent", extra: { );
final usersData = await apiService
.getSingleUser(userId);
context.go(
"/CreateTravelAgent",
extra: {
"selectedUser": usersData, "selectedUser": usersData,
"isViewMode": false, "isViewMode": false,
}); },
);
}, },
), ),
], ],
@ -911,14 +917,14 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
), ),
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
child: Tooltip( child: Tooltip(
message: 'Edit Travel Agent Details', message:
'Edit Travel Agent Details',
child: Image.asset( child: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
@ -926,14 +932,30 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
), ),
), ),
onTap: () async { onTap: () async {
Navigator.pop(context); // Close the menu // Navigator.pop(context); // Close the menu
final userId = int.parse(user['user_id'].toString()); // final userId = user['user_id'];
final usersData = await apiService.getSingleUser(userId); final userId = int.parse(
context.go("/CreateTravelAgent", extra: { user['user_id'].toString(),
);
final usersData = await apiService
.getSingleUser(userId);
context.go(
"/CreateTravelAgent",
extra: {
"selectedUser": usersData, "selectedUser": usersData,
"isViewMode": false, "isViewMode": false,
});
}, },
);
},
// onTap: () async {
// Navigator.pop(context); // Close the menu
// final userId = int.parse(user['user_id'].toString());
// final usersData = await apiService.getSingleUser(userId);
// context.go("/CreateTravelAgent", extra: {
// "selectedUser": usersData,
// "isViewMode": false,
// });
// },
), ),
], ],
), ),

View File

@ -806,7 +806,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
CustomTextFieldUserWrapper( CustomTextFieldUserWrapper(
isFocused: focusStates["FnameFocused"] ?? false, isFocused: focusStates["FnameFocused"] ?? false,
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
width: MediaQuery.of(context).size.width * 0.12, width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.12
: null,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: TextField( child: TextField(
@ -858,7 +861,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
CustomTextFieldUserWrapper( CustomTextFieldUserWrapper(
isFocused: focusStates["LnameFocused"] ?? false, isFocused: focusStates["LnameFocused"] ?? false,
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
width: MediaQuery.of(context).size.width * 0.12, width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.12
: null,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: TextField( child: TextField(
@ -1210,7 +1216,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
CustomTextFieldUserWrapper( CustomTextFieldUserWrapper(
isFocused: focusStates["mobileNumberFocused"] ?? false, isFocused: focusStates["mobileNumberFocused"] ?? false,
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
width: MediaQuery.of(context).size.width * 0.12, width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.12
: null,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: TextField( child: TextField(
@ -1274,7 +1283,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
// isFocused: false, // isFocused: false,
isFocused: focusStates["alternateMobileFocused"] ?? false, isFocused: focusStates["alternateMobileFocused"] ?? false,
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
width: MediaQuery.of(context).size.width * 0.12, width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.12
: null,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: TextField( child: TextField(
@ -1387,7 +1399,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
// ), // ),
(context, item, isSelected) { (context, item, isSelected) {
print("contryItem - $item"); print("contryItem - $item");
final match = RegExp(r'^(.*)\s\((.*)\)$').firstMatch(item); final match = RegExp(
r'^(.*)\s\((.*)\)$',
).firstMatch(item);
final countryName = match?.group(1) ?? ''; final countryName = match?.group(1) ?? '';
final countryCode = match?.group(2) ?? ''; final countryCode = match?.group(2) ?? '';
return Padding( return Padding(
@ -1397,7 +1411,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
), ),
child: Padding( child: Padding(
// padding: const EdgeInsets.all(3.0), // padding: const EdgeInsets.all(3.0),
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 3), padding: EdgeInsets.symmetric(
horizontal: 2,
vertical: 3,
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -1454,9 +1471,14 @@ class PersonalDetailsState extends State<PersonalDetails> {
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color : (layoutColor ?? Colors.grey), width: 1), color: (layoutColor ?? Colors.grey),
width: 1,
),
),
contentPadding: EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 8.0,
), ),
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0,),
// contentPadding: EdgeInsets.symmetric(horizontal: 1), // contentPadding: EdgeInsets.symmetric(horizontal: 1),
), ),
), ),
@ -1496,7 +1518,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
final countryCode = final countryCode =
countryMap.entries countryMap.entries
.firstWhere((entry) => entry.value == newValue) .firstWhere(
(entry) => entry.value == newValue,
)
.key; .key;
setState(() { setState(() {
@ -1507,7 +1531,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
countryCode, countryCode,
); // send code not name ); // send code not name
}, },
),),), ),
),
),
), ),
), ),
], ],

View File

@ -388,6 +388,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
), ),
), ),
), ),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -415,6 +417,7 @@ class OfficeDetailsState extends State<OfficeDetails> {
_buildFourthRow(widget.isDesktop), _buildFourthRow(widget.isDesktop),
], ],
), ),
),
); );
} }

View File

@ -225,18 +225,27 @@ class _UserListScreenState extends State<UserListScreen> {
print("handDel - $userId"); print("handDel - $userId");
} }
void _showConfirmationDialog(String subtitle, List<String> successList, List<Map<String, String>> failedList) { void _showConfirmationDialog(
String subtitle,
List<String> successList,
List<Map<String, String>> failedList,
) {
_dialogShown = true; _dialogShown = true;
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder:
(context) => AlertDialog(
// title: Text("User Details"), // title: Text("User Details"),
title: Text("Upload Status - $subtitle", style: GoogleFonts.poppins( title: Text(
"Upload Status - $subtitle",
style: GoogleFonts.poppins(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.black, color: Colors.black,
), overflow: TextOverflow.ellipsis), ),
overflow: TextOverflow.ellipsis,
),
content: SingleChildScrollView( content: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -244,11 +253,14 @@ class _UserListScreenState extends State<UserListScreen> {
// Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)), // Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)),
// //
// SizedBox(height: 12), // SizedBox(height: 12),
Text("Success Report :", style: GoogleFonts.poppins( Text(
"Success Report :",
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black, color: Colors.black,
)), ),
),
// if (successList.isNotEmpty) // if (successList.isNotEmpty)
// ...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created.")) // ...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created."))
if (successList.isNotEmpty) if (successList.isNotEmpty)
@ -279,11 +291,17 @@ class _UserListScreenState extends State<UserListScreen> {
color: Colors.black, color: Colors.black,
), ),
), ),
) ),
], ],
rows: successList.asMap().entries.map((entry) { rows:
successList.asMap().entries.map((entry) {
final newIndex = entry.key + 1; final newIndex = entry.key + 1;
final data = entry.value?.toString().trim().isNotEmpty == true final data =
entry.value
?.toString()
.trim()
.isNotEmpty ==
true
? entry.value.toString() ? entry.value.toString()
: '-'; : '-';
@ -321,90 +339,141 @@ class _UserListScreenState extends State<UserListScreen> {
), ),
) )
else else
Text("-- no data. --",style: GoogleFonts.poppins( Text(
"-- no data. --",
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w200, fontWeight: FontWeight.w200,
color: Colors.black, color: Colors.black,
)), ),
),
SizedBox(height: 12), SizedBox(height: 12),
// Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)), // Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)),
Text("Failed Report :", style: GoogleFonts.poppins( Text(
"Failed Report :",
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black, color: Colors.black,
)), ),
),
// if (failedList.isNotEmpty) // if (failedList.isNotEmpty)
// ...failedList.asMap().entries.map((entry) { // ...failedList.asMap().entries.map((entry) {
// final data = entry.value["data"] ?? "-"; // final data = entry.value["data"] ?? "-";
// final reason = entry.value["reason"] ?? "Unknown error"; // final reason = entry.value["reason"] ?? "Unknown error";
// return Text("${entry.key + 1}) $data - unable to create due to \"$reason\"."); // return Text("${entry.key + 1}) $data - unable to create due to \"$reason\".");
// }) // })
if (failedList.isNotEmpty) if (failedList.isNotEmpty)
SizedBox( SizedBox(
height: 250, // Vertical scroll height height: 250, // Vertical scroll height
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, // Enable horizontal scrolling scrollDirection:
Axis.horizontal, // Enable horizontal scrolling
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.vertical, // Enable vertical scrolling scrollDirection:
Axis.vertical, // Enable vertical scrolling
child: DataTable( child: DataTable(
columns: [ columns: [
DataColumn(label: Text('S.No', style: GoogleFonts.poppins( DataColumn(
label: Text(
'S.No',
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.black, color: Colors.black,
))), ),
DataColumn(label: Text('Data', style: GoogleFonts.poppins( ),
),
DataColumn(
label: Text(
'Data',
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.black, color: Colors.black,
))), ),
DataColumn(label: Text('Reason', style: GoogleFonts.poppins( ),
),
DataColumn(
label: Text(
'Reason',
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.black, color: Colors.black,
))), ),
),
),
], ],
rows: failedList.asMap().entries.map((entry) { rows:
failedList.asMap().entries.map((entry) {
final index = entry.key + 1; final index = entry.key + 1;
final rawData = entry.value['data']; final rawData = entry.value['data'];
final data = (rawData == null || rawData.toString().trim().isEmpty) ? '-' : rawData.toString(); final data =
final reason = entry.value['reason'] ?? 'Unknown error'; (rawData == null ||
rawData.toString().trim().isEmpty)
? '-'
: rawData.toString();
final reason =
entry.value['reason'] ?? 'Unknown error';
return DataRow(cells: [ return DataRow(
DataCell(Text('$index',style: GoogleFonts.poppins( cells: [
DataCell(
Text(
'$index',
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black, color: Colors.black,
))), ),
DataCell(SizedBox( ),
),
DataCell(
SizedBox(
width: 180, width: 180,
child: Text(data, style: GoogleFonts.poppins( child: Text(
data,
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black, color: Colors.black,
), overflow: TextOverflow.ellipsis), ),
)), overflow: TextOverflow.ellipsis,
DataCell(SizedBox( ),
),
),
DataCell(
SizedBox(
width: 280, width: 280,
child: Text(reason, style: GoogleFonts.poppins( child: Text(
reason,
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black, color: Colors.black,
),overflow: TextOverflow.ellipsis), ),
)), overflow: TextOverflow.ellipsis,
]); ),
),
),
],
);
}).toList(), }).toList(),
), ),
), ),
), ),
) )
else else
Text("-- no data. --",style: GoogleFonts.poppins( Text(
"-- no data. --",
style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w200, fontWeight: FontWeight.w200,
color: Colors.black, color: Colors.black,
)), ),
),
], ],
), ),
), ),
@ -421,12 +490,13 @@ class _UserListScreenState extends State<UserListScreen> {
); );
} }
Future<void> handleDownload() async { Future<void> handleDownload() async {
final result = await apiService.getDownloadUserTemplateForUpload(); final result = await apiService.getDownloadUserTemplateForUpload();
final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13'; final String displayBackgroundColor =
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent; result['status'] ? '#28a745' : '#dc1c13';
final Color displayColor =
result['status'] ? Colors.green : Colors.redAccent;
final String displayMessage = result['message']; final String displayMessage = result['message'];
// final bool status = result['status'] == true; // final bool status = result['status'] == true;
@ -438,9 +508,11 @@ class _UserListScreenState extends State<UserListScreen> {
backgroundColor: displayColor, backgroundColor: displayColor,
textColor: Colors.white, textColor: Colors.white,
fontSize: 18.0, fontSize: 18.0,
webBgColor: "linear-gradient(to right, $displayBackgroundColor, $displayBackgroundColor)", webBgColor:
"linear-gradient(to right, $displayBackgroundColor, $displayBackgroundColor)",
); );
} }
Future<void> handleUpload() async { Future<void> handleUpload() async {
final Completer<void> completer = Completer<void>(); final Completer<void> completer = Completer<void>();
@ -540,9 +612,14 @@ class _UserListScreenState extends State<UserListScreen> {
final status = responseData['status'] ?? ''; final status = responseData['status'] ?? '';
final data = responseData['data'] ?? {}; final data = responseData['data'] ?? {};
final List<String> successList = List<String>.from(data['successfulUsers'] ?? []); final List<String> successList = List<String>.from(
final List<Map<String, String>> failedList = List<Map<String, String>>.from( data['successfulUsers'] ?? [],
(data['failedUsers'] ?? []).map((item) => Map<String, String>.from(item)), );
final List<Map<String, String>> failedList =
List<Map<String, String>>.from(
(data['failedUsers'] ?? []).map(
(item) => Map<String, String>.from(item),
),
); );
_showConfirmationDialog(message, successList, failedList); _showConfirmationDialog(message, successList, failedList);
@ -565,10 +642,10 @@ class _UserListScreenState extends State<UserListScreen> {
// Refresh list if needed // Refresh list if needed
refreshUserList(); refreshUserList();
} else { } else {
// For non-200 responses // For non-200 responses
final errorMsg = 'Failed to upload file: ${response.reasonPhrase}'; final errorMsg =
'Failed to upload file: ${response.reasonPhrase}';
Fluttertoast.showToast( Fluttertoast.showToast(
msg: errorMsg, msg: errorMsg,
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
@ -581,7 +658,6 @@ class _UserListScreenState extends State<UserListScreen> {
); );
print(errorMsg); print(errorMsg);
} }
} }
} }
return completer.future; // Wait for upload to finish before proceeding return completer.future; // Wait for upload to finish before proceeding
@ -768,8 +844,7 @@ class _UserListScreenState extends State<UserListScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return return ResponsiveBuilder(
ResponsiveBuilder(
builder: (context, sizingInfo) { builder: (context, sizingInfo) {
bool isDesktop = bool isDesktop =
sizingInfo.deviceScreenType == DeviceScreenType.desktop; sizingInfo.deviceScreenType == DeviceScreenType.desktop;
@ -965,7 +1040,8 @@ class _UserListScreenState extends State<UserListScreen> {
// UPLOAD BUTTON // UPLOAD BUTTON
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: _isUploading child:
_isUploading
? const SizedBox( ? const SizedBox(
width: 28, width: 28,
height: 28, height: 28,
@ -1297,12 +1373,18 @@ class _UserListScreenState extends State<UserListScreen> {
onTap: () async { onTap: () async {
// Navigator.pop(context); // Close the menu // Navigator.pop(context); // Close the menu
// final userId = user['user_id']; // final userId = user['user_id'];
final userId = int.parse(user['user_id'].toString()); final userId = int.parse(
final usersData = await apiService.getSingleUser(userId); user['user_id'].toString(),
context.go("/CreateUserDetails", extra: { );
final usersData = await apiService
.getSingleUser(userId);
context.go(
"/CreateUserDetails",
extra: {
"selectedUser": usersData, "selectedUser": usersData,
"isViewMode": false, "isViewMode": false,
}); },
);
}, },
), ),
], ],
@ -1546,14 +1628,31 @@ class _UserListScreenState extends State<UserListScreen> {
), ),
), ),
onTap: () async { onTap: () async {
Navigator.pop(context); // Close the menu // Navigator.pop(context); // Close the menu
final userId = int.parse(user['user_id'].toString()); // final userId = user['user_id'];
final usersData = await apiService.getSingleUser(userId); final userId = int.parse(
context.go("/CreateUserDetails", extra: { user['user_id'].toString(),
);
final usersData = await apiService
.getSingleUser(userId);
context.go(
"/CreateUserDetails",
extra: {
"selectedUser": usersData, "selectedUser": usersData,
"isViewMode": true, "isViewMode": false,
});
}, },
);
},
// onTap: () async {
// Navigator.pop(context); // Close the menu
// final userId = int.parse(user['user_id'].toString());
// final usersData = await apiService.getSingleUser(userId);
// context.go("/CreateUserDetails", extra: {
// "selectedUser": usersData,
// "isViewMode": true,
// });
// },
), ),
], ],
), ),