userlist
This commit is contained in:
parent
b81f3803e0
commit
400a7a2ec0
@ -311,7 +311,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Number of Passenger",
|
"Number of Passenger *",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
|||||||
@ -897,6 +897,72 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// download the Template for bulk upload the user
|
||||||
|
Future<void> getDownloadUserTemplateForUpload() async {
|
||||||
|
|
||||||
|
final String apiUrldata = '$apiUrl/api/user/userUploadTemplate'; // download the Template for bulk upload user => api
|
||||||
|
|
||||||
|
// final String apiUrldata = '$apiUrl/auth/googlelogin';
|
||||||
|
|
||||||
|
final token = await getToken();
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('Token not found. Please log in.');
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(apiUrldata),
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
try {
|
||||||
|
print("XL Dowloaded");
|
||||||
|
|
||||||
|
// Create a blob from the response body
|
||||||
|
final blob = html.Blob([response.bodyBytes]);
|
||||||
|
|
||||||
|
// Generate a download URL for the blob
|
||||||
|
final url = html.Url.createObjectUrlFromBlob(blob);
|
||||||
|
|
||||||
|
// Create a link element to trigger the download
|
||||||
|
final anchor =
|
||||||
|
html.AnchorElement(href: url)
|
||||||
|
..setAttribute('download', 'user_file.xlsx')
|
||||||
|
..click();
|
||||||
|
|
||||||
|
// Revoke the download URL to free up resources
|
||||||
|
html.Url.revokeObjectUrl(url);
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('Error parsing response: $e');
|
||||||
|
}
|
||||||
|
} else if (response.statusCode == 404) {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (BuildContext context) {
|
||||||
|
// return AlertDialog(
|
||||||
|
// title: Text('File not found.'),
|
||||||
|
// // content: Text('File not found.'),
|
||||||
|
// actions: [
|
||||||
|
// TextButton(
|
||||||
|
// child: Text('OK'),
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.of(context).pop(); // Close the dialog
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load plans');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------User Management-----------------------------------
|
//---------------------------------------User Management-----------------------------------
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getSingleUser(int userId) async {
|
Future<Map<String, dynamic>> getSingleUser(int userId) async {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user