Header Icons , Forex Search
This commit is contained in:
parent
d99d9433ec
commit
3be2f695c6
@ -282,21 +282,43 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void filterUsers(String query) {
|
void filterForex1(String query) {
|
||||||
print("allUsers before filtering: $query");
|
print("allUsers before filtering: $query");
|
||||||
final lowerQuery = query.toLowerCase();
|
final lowerQuery = query.toLowerCase();
|
||||||
setState(() {
|
setState(() {
|
||||||
filteredForex = allForex.where((user) {
|
filteredForex = allForex.where((forex) {
|
||||||
return (user['first_name']?.toLowerCase().contains(lowerQuery) ??
|
return (forex['country_code']?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
(user['last_name']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(forex['country_name']?.toLowerCase().contains(lowerQuery) ??
|
||||||
(user['email']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
false) ||
|
||||||
(user['role_value']?.toLowerCase().contains(lowerQuery) ?? false);
|
(forex['currency']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
|
(forex['perdiem_amount']?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false);
|
||||||
}).toList();
|
}).toList();
|
||||||
});
|
});
|
||||||
print("filteredPlans: $filteredForex");
|
print("filteredPlans: $filteredForex");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterForex(String query) {
|
||||||
|
print("allForex before filtering: $query");
|
||||||
|
final lowerQuery = query.toLowerCase();
|
||||||
|
setState(() {
|
||||||
|
filteredForex = allForex.where((forex) {
|
||||||
|
final isActiveStatus =
|
||||||
|
forex['is_active'] == "1" ? "active" : "inactive";
|
||||||
|
return (forex['country_code']?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
|
(forex['country_name']?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
|
(forex['currency']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
|
(forex['perdiem_amount']?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
|
(isActiveStatus.contains(lowerQuery));
|
||||||
|
}).toList();
|
||||||
|
});
|
||||||
|
print("filteredForex: $filteredForex");
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
||||||
@ -396,7 +418,7 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: searchController,
|
controller: searchController,
|
||||||
onChanged: filterUsers,
|
onChanged: filterForex,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search ...",
|
hintText: "Search ...",
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
@ -490,7 +512,7 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
height: 35,
|
height: 35,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: searchController,
|
controller: searchController,
|
||||||
onChanged: filterUsers,
|
onChanged: filterForex,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search ...",
|
hintText: "Search ...",
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
@ -571,10 +593,10 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<dynamic> users =
|
List<dynamic> forex =
|
||||||
filteredForex.isNotEmpty ? filteredForex : allForex;
|
filteredForex.isNotEmpty ? filteredForex : allForex;
|
||||||
|
|
||||||
users.sort((a, b) {
|
forex.sort((a, b) {
|
||||||
DateTime dateA = DateTime.parse(a['created_on']);
|
DateTime dateA = DateTime.parse(a['created_on']);
|
||||||
DateTime dateB = DateTime.parse(b['created_on']);
|
DateTime dateB = DateTime.parse(b['created_on']);
|
||||||
|
|
||||||
@ -582,7 +604,7 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
.compareTo(dateA); // Descending: newest first
|
.compareTo(dateA); // Descending: newest first
|
||||||
});
|
});
|
||||||
|
|
||||||
List paginatedUser = users
|
List paginatedForex = forex
|
||||||
.skip(currentPage * itemsPerPage)
|
.skip(currentPage * itemsPerPage)
|
||||||
.take(itemsPerPage)
|
.take(itemsPerPage)
|
||||||
.toList();
|
.toList();
|
||||||
@ -645,7 +667,7 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
fontWeight: FontWeight.w600),
|
fontWeight: FontWeight.w600),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
rows: paginatedUser.map((forex) {
|
rows: paginatedForex.map((forex) {
|
||||||
String forexId = forex['forex_perdiem_id']
|
String forexId = forex['forex_perdiem_id']
|
||||||
.toString(); // Get user ID
|
.toString(); // Get user ID
|
||||||
bool isSelected = selectedUserId == forexId;
|
bool isSelected = selectedUserId == forexId;
|
||||||
@ -958,16 +980,44 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: isDesktop
|
child: isDesktop
|
||||||
? SingleChildScrollView(
|
? (searchController.text.isNotEmpty &&
|
||||||
scrollDirection: Axis.vertical,
|
filteredForex.isEmpty
|
||||||
child: table, // <-- your existing table
|
? Center(
|
||||||
)
|
child: Text(
|
||||||
: buildMobileCardView(paginatedUser),
|
"No matches found",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: table,
|
||||||
|
))
|
||||||
|
: (searchController.text.isNotEmpty &&
|
||||||
|
filteredForex.isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text(
|
||||||
|
"No matches found",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: buildMobileCardView(paginatedForex)),
|
||||||
|
),
|
||||||
|
// Expanded(
|
||||||
|
// child: isDesktop
|
||||||
|
// ? SingleChildScrollView(
|
||||||
|
// scrollDirection: Axis.vertical,
|
||||||
|
// child: table, // <-- your existing table
|
||||||
|
// )
|
||||||
|
// : buildMobileCardView(paginatedUser),
|
||||||
|
// ),
|
||||||
PaginationControls(
|
PaginationControls(
|
||||||
currentPage: currentPage,
|
currentPage: currentPage,
|
||||||
itemsPerPage: itemsPerPage,
|
itemsPerPage: itemsPerPage,
|
||||||
totalItems: users.length,
|
totalItems: forex.length,
|
||||||
activeColor: layoutColor, // your theme color
|
activeColor: layoutColor, // your theme color
|
||||||
onPageChanged: (page) {
|
onPageChanged: (page) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@ -295,7 +295,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
layoutColor!,
|
layoutColor!,
|
||||||
// () => context.go('/listPlan'),
|
// () => context.go('/listPlan'),
|
||||||
isSelected: selectedTab == TabSelection.myTrips,
|
isSelected: selectedTab == TabSelection.myTrips,
|
||||||
icon: Icons.request_page_outlined,
|
icon: Icons.shopping_bag_outlined,
|
||||||
),
|
),
|
||||||
// if (userDetails["role"] == "Travel Agent")
|
// if (userDetails["role"] == "Travel Agent")
|
||||||
// buildNavItem("My Trips", _myTravelRequestColor,
|
// buildNavItem("My Trips", _myTravelRequestColor,
|
||||||
@ -319,7 +319,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
layoutColor!,
|
layoutColor!,
|
||||||
// () => context.go('/ApprovalList'),
|
// () => context.go('/ApprovalList'),
|
||||||
isSelected: selectedTab == TabSelection.myApprovals,
|
isSelected: selectedTab == TabSelection.myApprovals,
|
||||||
icon: Icons.assessment_outlined,
|
icon: Icons.verified_outlined,
|
||||||
),
|
),
|
||||||
|
|
||||||
// buildNavItem("My Approvals", _myApprovalsColor, () {
|
// buildNavItem("My Approvals", _myApprovalsColor, () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user