FIX_TRACKER
This commit is contained in:
parent
b24215272f
commit
fa00f90f8a
@ -445,16 +445,14 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
item["destination_city"],
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
_buildDateTimeRow(
|
||||
_buildRow(
|
||||
"Check (in)",
|
||||
formatDate(item["checkin_date"]!),
|
||||
formatTime(item["checkin_time"]!),
|
||||
"${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}",
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
_buildDateTimeRow(
|
||||
_buildRow(
|
||||
"Check (out)",
|
||||
formatDate(item["checkout_date"]!),
|
||||
formatTime(item["checkout_time"]!),
|
||||
"${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}",
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
_buildRow("Comments:", item["comments"] ?? "N/A"),
|
||||
@ -630,7 +628,6 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
SizedBox(
|
||||
// color: Colors.yellowAccent.shade100,
|
||||
width: 100,
|
||||
child: Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: GoogleFonts.poppins(
|
||||
@ -639,7 +636,6 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
// Expanded(child: Text(value, style: TextStyle(fontSize: 12))),
|
||||
Expanded(
|
||||
|
||||
@ -321,7 +321,9 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
getRequestForCountry(item["country_code"]!.toString()),
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
@ -330,6 +332,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Forex"),
|
||||
@ -357,7 +360,6 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
item['forex_id'] != null
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
|
||||
@ -578,8 +578,6 @@ class TemplateForexState extends State<TemplateForex> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
@ -591,11 +589,9 @@ class TemplateForexState extends State<TemplateForex> {
|
||||
tooltip: 'Go To Organization Settings',
|
||||
onTap: (context) {
|
||||
context.go("/OrganizationSettings");
|
||||
}
|
||||
),
|
||||
BreadcrumbItem(
|
||||
title: 'Forex',
|
||||
},
|
||||
),
|
||||
BreadcrumbItem(title: 'Forex'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -788,7 +784,7 @@ class TemplateForexState extends State<TemplateForex> {
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
height: MediaQuery.of(context).size.height * 0.45,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: Color(0xFFD6D5E6), width: 0.5),
|
||||
@ -862,7 +858,8 @@ class TemplateForexState extends State<TemplateForex> {
|
||||
SizedBox(width: 10),
|
||||
SizedBox(
|
||||
child: ElevatedButton(
|
||||
onPressed: isDisable
|
||||
onPressed:
|
||||
isDisable
|
||||
? null
|
||||
: () async {
|
||||
setState(() {
|
||||
|
||||
@ -1131,7 +1131,7 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
),
|
||||
onPressed: () {
|
||||
context.go('/listPlan');
|
||||
context.go('/OrganizationSettings');
|
||||
},
|
||||
child: Text("Cancel", style: GoogleFonts.poppins(fontSize: 12)),
|
||||
),
|
||||
|
||||
@ -18,10 +18,10 @@ import '../../../services/apiService.dart';
|
||||
import '../../../utils/pagination.dart';
|
||||
import '../../../widgets/custom_breadcrumb_navigation.dart';
|
||||
import '../../../widgets/popup_travelAgentList_action.dart';
|
||||
|
||||
/// import '../../../widgets/custom_popup.dart';
|
||||
/// import '../../../../widgets/popup_TravelAgentList_action.dart';
|
||||
|
||||
|
||||
class TravelAgentListScreen extends StatefulWidget {
|
||||
@override
|
||||
_TravelAgentListScreenState createState() => _TravelAgentListScreenState();
|
||||
@ -144,7 +144,8 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
Future<List<dynamic>> fetchUsers() async {
|
||||
// return [];
|
||||
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();
|
||||
|
||||
print("Fetch Users");
|
||||
@ -463,11 +464,9 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
tooltip: 'Go To Organization Settings',
|
||||
onTap: (context) {
|
||||
context.go("/OrganizationSettings");
|
||||
}
|
||||
),
|
||||
BreadcrumbItem(
|
||||
title: 'Travel Agent',
|
||||
},
|
||||
),
|
||||
BreadcrumbItem(title: 'Travel Agent'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -848,7 +847,8 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: Tooltip(
|
||||
message: 'Edit Travel Agent Details',
|
||||
message:
|
||||
'Edit Travel Agent Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
@ -858,12 +858,18 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
onTap: () async {
|
||||
// Navigator.pop(context); // Close the menu
|
||||
// final userId = user['user_id'];
|
||||
final userId = int.parse(user['user_id'].toString());
|
||||
final usersData = await apiService.getSingleUser(userId);
|
||||
context.go("/CreateTravelAgent", extra: {
|
||||
final userId = int.parse(
|
||||
user['user_id'].toString(),
|
||||
);
|
||||
final usersData = await apiService
|
||||
.getSingleUser(userId);
|
||||
context.go(
|
||||
"/CreateTravelAgent",
|
||||
extra: {
|
||||
"selectedUser": usersData,
|
||||
"isViewMode": false,
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -911,14 +917,14 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: Tooltip(
|
||||
message: 'Edit Travel Agent Details',
|
||||
message:
|
||||
'Edit Travel Agent Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
@ -926,14 +932,30 @@ class _TravelAgentListScreenState extends State<TravelAgentListScreen> {
|
||||
),
|
||||
),
|
||||
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: {
|
||||
// Navigator.pop(context); // Close the menu
|
||||
// final userId = user['user_id'];
|
||||
final userId = int.parse(
|
||||
user['user_id'].toString(),
|
||||
);
|
||||
final usersData = await apiService
|
||||
.getSingleUser(userId);
|
||||
context.go(
|
||||
"/CreateTravelAgent",
|
||||
extra: {
|
||||
"selectedUser": usersData,
|
||||
"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,
|
||||
// });
|
||||
// },
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -806,7 +806,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: focusStates["FnameFocused"] ?? false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.12
|
||||
: null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
@ -858,7 +861,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: focusStates["LnameFocused"] ?? false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.12
|
||||
: null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
@ -1210,7 +1216,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
CustomTextFieldUserWrapper(
|
||||
isFocused: focusStates["mobileNumberFocused"] ?? false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.12
|
||||
: null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
@ -1274,7 +1283,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
// isFocused: false,
|
||||
isFocused: focusStates["alternateMobileFocused"] ?? false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.12
|
||||
: null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
@ -1387,7 +1399,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
// ),
|
||||
(context, item, isSelected) {
|
||||
print("contryItem - $item");
|
||||
final match = RegExp(r'^(.*)\s\((.*)\)$').firstMatch(item);
|
||||
final match = RegExp(
|
||||
r'^(.*)\s\((.*)\)$',
|
||||
).firstMatch(item);
|
||||
final countryName = match?.group(1) ?? '';
|
||||
final countryCode = match?.group(2) ?? '';
|
||||
return Padding(
|
||||
@ -1397,7 +1411,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
),
|
||||
child: Padding(
|
||||
// padding: const EdgeInsets.all(3.0),
|
||||
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 3),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 2,
|
||||
vertical: 3,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -1454,9 +1471,14 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
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),
|
||||
),
|
||||
),
|
||||
@ -1496,7 +1518,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
|
||||
final countryCode =
|
||||
countryMap.entries
|
||||
.firstWhere((entry) => entry.value == newValue)
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
|
||||
setState(() {
|
||||
@ -1507,7 +1531,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
countryCode,
|
||||
); // ✅ send code not name
|
||||
},
|
||||
),),),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -388,6 +388,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
||||
),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -415,6 +417,7 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
||||
_buildFourthRow(widget.isDesktop),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -225,18 +225,27 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
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;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
// title: Text("User Details"),
|
||||
title: Text("Upload Status - $subtitle", style: GoogleFonts.poppins(
|
||||
title: Text(
|
||||
"Upload Status - $subtitle",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
), overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -244,11 +253,14 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
// Text(subtitle, style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
//
|
||||
// SizedBox(height: 12),
|
||||
Text("Success Report :", style: GoogleFonts.poppins(
|
||||
Text(
|
||||
"Success Report :",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
),
|
||||
// if (successList.isNotEmpty)
|
||||
// ...successList.asMap().entries.map((entry) => Text("${entry.key + 1}) ${entry.value} created."))
|
||||
if (successList.isNotEmpty)
|
||||
@ -279,11 +291,17 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
rows: successList.asMap().entries.map((entry) {
|
||||
rows:
|
||||
successList.asMap().entries.map((entry) {
|
||||
final newIndex = entry.key + 1;
|
||||
final data = entry.value?.toString().trim().isNotEmpty == true
|
||||
final data =
|
||||
entry.value
|
||||
?.toString()
|
||||
.trim()
|
||||
.isNotEmpty ==
|
||||
true
|
||||
? entry.value.toString()
|
||||
: '-';
|
||||
|
||||
@ -321,90 +339,141 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
),
|
||||
)
|
||||
else
|
||||
Text("-- no data. --",style: GoogleFonts.poppins(
|
||||
Text(
|
||||
"-- no data. --",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w200,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
// Text("Failed Report :", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("Failed Report :", style: GoogleFonts.poppins(
|
||||
Text(
|
||||
"Failed Report :",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
||||
// if (failedList.isNotEmpty)
|
||||
// ...failedList.asMap().entries.map((entry) {
|
||||
// final data = entry.value["data"] ?? "-";
|
||||
// final reason = entry.value["reason"] ?? "Unknown error";
|
||||
// return Text("${entry.key + 1}) $data - unable to create due to \"$reason\".");
|
||||
// })
|
||||
|
||||
if (failedList.isNotEmpty)
|
||||
SizedBox(
|
||||
height: 250, // Vertical scroll height
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal, // Enable horizontal scrolling
|
||||
scrollDirection:
|
||||
Axis.horizontal, // Enable horizontal scrolling
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical, // Enable vertical scrolling
|
||||
scrollDirection:
|
||||
Axis.vertical, // Enable vertical scrolling
|
||||
child: DataTable(
|
||||
columns: [
|
||||
DataColumn(label: Text('S.No', style: GoogleFonts.poppins(
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'S.No',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
))),
|
||||
DataColumn(label: Text('Data', style: GoogleFonts.poppins(
|
||||
),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'Data',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
))),
|
||||
DataColumn(label: Text('Reason', style: GoogleFonts.poppins(
|
||||
),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'Reason',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
))),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: failedList.asMap().entries.map((entry) {
|
||||
rows:
|
||||
failedList.asMap().entries.map((entry) {
|
||||
final index = entry.key + 1;
|
||||
final rawData = entry.value['data'];
|
||||
final data = (rawData == null || rawData.toString().trim().isEmpty) ? '-' : rawData.toString();
|
||||
final reason = entry.value['reason'] ?? 'Unknown error';
|
||||
final data =
|
||||
(rawData == null ||
|
||||
rawData.toString().trim().isEmpty)
|
||||
? '-'
|
||||
: rawData.toString();
|
||||
final reason =
|
||||
entry.value['reason'] ?? 'Unknown error';
|
||||
|
||||
return DataRow(cells: [
|
||||
DataCell(Text('$index',style: GoogleFonts.poppins(
|
||||
return DataRow(
|
||||
cells: [
|
||||
DataCell(
|
||||
Text(
|
||||
'$index',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
))),
|
||||
DataCell(SizedBox(
|
||||
),
|
||||
),
|
||||
),
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 180,
|
||||
child: Text(data, style: GoogleFonts.poppins(
|
||||
child: Text(
|
||||
data,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
), overflow: TextOverflow.ellipsis),
|
||||
)),
|
||||
DataCell(SizedBox(
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 280,
|
||||
child: Text(reason, style: GoogleFonts.poppins(
|
||||
child: Text(
|
||||
reason,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
),overflow: TextOverflow.ellipsis),
|
||||
)),
|
||||
]);
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
Text("-- no data. --",style: GoogleFonts.poppins(
|
||||
Text(
|
||||
"-- no data. --",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w200,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -421,12 +490,13 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> handleDownload() async {
|
||||
final result = await apiService.getDownloadUserTemplateForUpload();
|
||||
|
||||
final String displayBackgroundColor = result['status'] ? '#28a745' : '#dc1c13';
|
||||
final Color displayColor = result['status'] ? Colors.green : Colors.redAccent;
|
||||
final String displayBackgroundColor =
|
||||
result['status'] ? '#28a745' : '#dc1c13';
|
||||
final Color displayColor =
|
||||
result['status'] ? Colors.green : Colors.redAccent;
|
||||
final String displayMessage = result['message'];
|
||||
// final bool status = result['status'] == true;
|
||||
|
||||
@ -438,9 +508,11 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
backgroundColor: displayColor,
|
||||
textColor: Colors.white,
|
||||
fontSize: 18.0,
|
||||
webBgColor: "linear-gradient(to right, $displayBackgroundColor, $displayBackgroundColor)",
|
||||
webBgColor:
|
||||
"linear-gradient(to right, $displayBackgroundColor, $displayBackgroundColor)",
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> handleUpload() async {
|
||||
final Completer<void> completer = Completer<void>();
|
||||
|
||||
@ -540,9 +612,14 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
final status = responseData['status'] ?? '';
|
||||
final data = responseData['data'] ?? {};
|
||||
|
||||
final List<String> successList = List<String>.from(data['successfulUsers'] ?? []);
|
||||
final List<Map<String, String>> failedList = List<Map<String, String>>.from(
|
||||
(data['failedUsers'] ?? []).map((item) => Map<String, String>.from(item)),
|
||||
final List<String> successList = List<String>.from(
|
||||
data['successfulUsers'] ?? [],
|
||||
);
|
||||
final List<Map<String, String>> failedList =
|
||||
List<Map<String, String>>.from(
|
||||
(data['failedUsers'] ?? []).map(
|
||||
(item) => Map<String, String>.from(item),
|
||||
),
|
||||
);
|
||||
|
||||
_showConfirmationDialog(message, successList, failedList);
|
||||
@ -565,10 +642,10 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
|
||||
// Refresh list if needed
|
||||
refreshUserList();
|
||||
|
||||
} else {
|
||||
// For non-200 responses
|
||||
final errorMsg = 'Failed to upload file: ${response.reasonPhrase}';
|
||||
final errorMsg =
|
||||
'Failed to upload file: ${response.reasonPhrase}';
|
||||
Fluttertoast.showToast(
|
||||
msg: errorMsg,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
@ -581,7 +658,6 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
);
|
||||
print(errorMsg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return completer.future; // Wait for upload to finish before proceeding
|
||||
@ -768,8 +844,7 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
ResponsiveBuilder(
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInfo) {
|
||||
bool isDesktop =
|
||||
sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||
@ -965,7 +1040,8 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
// UPLOAD BUTTON
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: _isUploading
|
||||
child:
|
||||
_isUploading
|
||||
? const SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
@ -1297,12 +1373,18 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
onTap: () async {
|
||||
// Navigator.pop(context); // Close the menu
|
||||
// final userId = user['user_id'];
|
||||
final userId = int.parse(user['user_id'].toString());
|
||||
final usersData = await apiService.getSingleUser(userId);
|
||||
context.go("/CreateUserDetails", extra: {
|
||||
final userId = int.parse(
|
||||
user['user_id'].toString(),
|
||||
);
|
||||
final usersData = await apiService
|
||||
.getSingleUser(userId);
|
||||
context.go(
|
||||
"/CreateUserDetails",
|
||||
extra: {
|
||||
"selectedUser": usersData,
|
||||
"isViewMode": false,
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -1546,14 +1628,31 @@ class _UserListScreenState extends State<UserListScreen> {
|
||||
),
|
||||
),
|
||||
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: {
|
||||
// Navigator.pop(context); // Close the menu
|
||||
// final userId = user['user_id'];
|
||||
final userId = int.parse(
|
||||
user['user_id'].toString(),
|
||||
);
|
||||
final usersData = await apiService
|
||||
.getSingleUser(userId);
|
||||
context.go(
|
||||
"/CreateUserDetails",
|
||||
extra: {
|
||||
"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,
|
||||
// });
|
||||
// },
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user