tracker items
This commit is contained in:
parent
3e973707a6
commit
c2bbbb2214
@ -745,7 +745,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
||||
cells: [
|
||||
DataCell(
|
||||
Text(
|
||||
"${index + 1}",
|
||||
// "${index + 1}",
|
||||
"${(currentPage * itemsPerPage) + index + 1}",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontFamily: "Inter",
|
||||
|
||||
@ -128,13 +128,23 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
print("Token - $token");
|
||||
await storeUserDetails(token);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Login Successful"),
|
||||
backgroundColor: Colors.green, // Set background to green
|
||||
),
|
||||
Fluttertoast.showToast(
|
||||
msg: "You're in!",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.green,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text("Login Successful"),
|
||||
// backgroundColor: Colors.green, // Set background to green
|
||||
// ),
|
||||
// );
|
||||
|
||||
if (userRole == "Travel Agent") {
|
||||
context.go('/listTravelAgentPlan');
|
||||
} else if (userRole == "Org Admin" || userRole == "Travel Admin") {
|
||||
@ -151,11 +161,17 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
if (messages is Map && messages.isNotEmpty) {
|
||||
errorMessage = messages.values.first.toString();
|
||||
}
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Login Failed: $errorMessage"),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Login Failed: $errorMessage",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
// webPosition: "center",
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
_emailController.clear();
|
||||
_passwordController.clear();
|
||||
@ -169,9 +185,20 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
// );
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text("Error: $e")));
|
||||
// ScaffoldMessenger.of(
|
||||
// context,
|
||||
// ).showSnackBar(SnackBar(content: Text("Error: $e")));
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Login Failed: $e",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -198,27 +225,59 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
_showOtpResetFields = true;
|
||||
// _clearAllFields();
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("OTP sent to your email"),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text("OTP sent to your email"),
|
||||
// backgroundColor: Colors.green,
|
||||
// ),
|
||||
// );
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "OTP sent to your email",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.green,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
} else {
|
||||
print(response);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"${jsonDecode(response.body)['messages']['error']}",
|
||||
),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(
|
||||
// "${jsonDecode(response.body)['messages']['error']}",
|
||||
// ),
|
||||
//
|
||||
// backgroundColor: Colors.red,
|
||||
// ),
|
||||
// );
|
||||
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
Fluttertoast.showToast(
|
||||
msg: "${jsonDecode(response.body)['messages']['error']}",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("Error: $e"), backgroundColor: Colors.red),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(content: Text("Error: $e"), backgroundColor: Colors.red),
|
||||
// );
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Error: $e",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
}
|
||||
} else if (!_isForgotPassword && _showOtpResetFields) {
|
||||
@ -245,11 +304,21 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
_showOtpResetFields = false;
|
||||
_clearAllFields();
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Password reset successfully"),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text("Password reset successfully"),
|
||||
// backgroundColor: Colors.green,
|
||||
// ),
|
||||
// );
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Password reset successfully",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.green,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
} else {
|
||||
print('23');
|
||||
@ -258,19 +327,41 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
final errorMessage =
|
||||
responseBody['messages']?['error'] ?? 'An unknown error occurred';
|
||||
print(errorMessage);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"Reset failed: $errorMessage",
|
||||
// "Reset failed: ${jsonDecode(response.body)['message']}",
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(
|
||||
// "Reset failed: $errorMessage",
|
||||
// // "Reset failed: ${jsonDecode(response.body)['message']}",
|
||||
// ),
|
||||
// backgroundColor: Colors.red,
|
||||
// ),
|
||||
// );
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Reset failed: $errorMessage",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("Error: $e"), backgroundColor: Colors.red),
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(content: Text("Error: $e"), backgroundColor: Colors.red),
|
||||
// );
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Error: $e",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 2,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -13,6 +13,7 @@ import '../../widgets/custom_text_traveller.dart';
|
||||
|
||||
class UserSelectionDialog extends StatefulWidget {
|
||||
final String title;
|
||||
final String? currentUser;
|
||||
final Color layoutColorForUser;
|
||||
final void Function(String, String, bool) onSubmit;
|
||||
final void Function() onClose;
|
||||
@ -23,6 +24,7 @@ class UserSelectionDialog extends StatefulWidget {
|
||||
required this.layoutColorForUser,
|
||||
required this.onSubmit,
|
||||
required this.onClose,
|
||||
required this.currentUser,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -202,10 +204,17 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
|
||||
print("Filtering _filterUsersTravellers...");
|
||||
setState(() {
|
||||
_filteredList.clear(); // Reset the list before filtering
|
||||
|
||||
final excludedUserId = widget.currentUser.toString();
|
||||
if (query.isEmpty) {
|
||||
_filteredList = [
|
||||
..._users.map((user) => {"type": "user", "data": user}),
|
||||
// ..._users.map((user) => {"type": "user", "data": user}),
|
||||
..._users
|
||||
.where(
|
||||
(user) =>
|
||||
(user.userId.toString() == excludedUserId &&
|
||||
user.roleId.toString() == "5"),
|
||||
) // ⛔ Exclude user ID 4
|
||||
.map((user) => {"type": "user", "data": user}),
|
||||
];
|
||||
} else {
|
||||
_filteredList = [
|
||||
@ -213,6 +222,10 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
|
||||
.where((user) {
|
||||
print("usersLLL : ${user}");
|
||||
|
||||
if (user.userId.toString() == excludedUserId ||
|
||||
user.roleId.toString() == "5")
|
||||
return false;
|
||||
|
||||
List<String> searchFields = [
|
||||
"${user.firstName} ${user.lastName}".toLowerCase(),
|
||||
user.email.toLowerCase() ?? "",
|
||||
@ -335,6 +348,7 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
|
||||
super.initState();
|
||||
fetchUsers();
|
||||
fetchTraveller();
|
||||
print("SelffsdfcurrentUser - ${widget.currentUser}");
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -3582,6 +3582,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
fetchUserDetails();
|
||||
},
|
||||
layoutColorForUser: widget.layoutColor!,
|
||||
currentUser: selfId,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@ -722,7 +722,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
if (start_Date != null &&
|
||||
end_Date != null &&
|
||||
end_Date.isBefore(start_Date)) {
|
||||
print("Invalid Date Range");
|
||||
print("Invalid date range");
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -2408,10 +2408,15 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
);
|
||||
},
|
||||
),
|
||||
dropdownDecoratorProps: const DropDownDecoratorProps(
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
hintText: "Select Seat",
|
||||
hintStyle: GoogleFonts.poppins(
|
||||
fontSize: 11.5,
|
||||
color: Colors.grey,
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 5,
|
||||
),
|
||||
@ -2421,7 +2426,9 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
icon: Icon(Icons.arrow_drop_down),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
if (selectedItem == null ||
|
||||
selectedItem.isEmpty ||
|
||||
selectedItem['dropdown_value'].toString().isEmpty) {
|
||||
return Text(
|
||||
"Select Seat", // fallback text
|
||||
style: GoogleFonts.poppins(
|
||||
@ -2431,7 +2438,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
selectedItem['dropdown_value'] ?? 'Select Seat',
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
);
|
||||
},
|
||||
@ -2656,7 +2663,9 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
),
|
||||
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
if (selectedItem == null ||
|
||||
selectedItem.isEmpty ||
|
||||
selectedItem['dropdown_value'].toString().isEmpty) {
|
||||
return Text(
|
||||
"Select Seat", // fallback text
|
||||
style: GoogleFonts.poppins(
|
||||
@ -2666,14 +2675,14 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
selectedItem['dropdown_value'] ?? '',
|
||||
selectedItem['dropdown_value'] ?? 'Select Seat"',
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
);
|
||||
},
|
||||
items: seatOptionsInt,
|
||||
selectedItem:
|
||||
selectedIntenationalSeat == null
|
||||
? null
|
||||
? {"dropdown_value": "Select Seat"}
|
||||
: {"dropdown_value": selectedIntenationalSeat},
|
||||
onChanged:
|
||||
widget.isViewMode
|
||||
|
||||
@ -88,6 +88,7 @@ class _MyAppState extends State<MyApp> {
|
||||
throw Exception(errorMessage);
|
||||
}
|
||||
} catch (e) {
|
||||
router.go('/');
|
||||
print("Error: $e");
|
||||
}
|
||||
}
|
||||
@ -124,6 +125,7 @@ class _MyAppState extends State<MyApp> {
|
||||
apiService.getOrganizationData();
|
||||
} catch (e) {
|
||||
print('Error decoding token: $e');
|
||||
router.go('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
//api url
|
||||
// const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be';
|
||||
const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||
const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be';
|
||||
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||
|
||||
@ -6,6 +6,7 @@ class SearchUser {
|
||||
final String mobileNo;
|
||||
final String alternateMobileNo;
|
||||
String? empCode;
|
||||
final String roleId;
|
||||
|
||||
SearchUser({
|
||||
required this.userId,
|
||||
@ -15,6 +16,7 @@ class SearchUser {
|
||||
required this.mobileNo,
|
||||
required this.alternateMobileNo,
|
||||
this.empCode,
|
||||
required this.roleId,
|
||||
});
|
||||
|
||||
factory SearchUser.fromJson(Map<String, dynamic> json) {
|
||||
@ -26,6 +28,7 @@ class SearchUser {
|
||||
mobileNo: json['mobile_no'].toString() ?? '',
|
||||
alternateMobileNo: json['alternate_mobile_no'].toString() ?? '',
|
||||
empCode: json['employee_code'].toString() ?? '',
|
||||
roleId: json['role_id'].toString() ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,22 +537,41 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Last Login: ${userData?["last_login_at"]}" ??
|
||||
'',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 8.5,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const Divider(), // 👈 Divider after role
|
||||
const PopupMenuDivider(),
|
||||
// const Divider(), // 👈 Divider after role
|
||||
],
|
||||
),
|
||||
),
|
||||
...filteredItems
|
||||
.map(buildMenuItem)
|
||||
.toList(), // 👈 then normal items
|
||||
// const PopupMenuDivider(),
|
||||
PopupMenuItem<String>(
|
||||
enabled: false, // Not clickable
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Last Login : ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
|
||||
// SizedBox(width: 10),
|
||||
Text(
|
||||
"${userData?["last_login_at"] ?? ''}",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user