UI_HOTEL_NAME
This commit is contained in:
parent
a7310238c0
commit
bf9a2b1277
@ -40,7 +40,8 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
|
|
||||||
// late Map<String, String> countryMap;
|
// late Map<String, String> countryMap;
|
||||||
Map<String, String> countryMap = {};
|
Map<String, String> countryMap = {};
|
||||||
|
List<String> allItems = [];
|
||||||
|
List<String> filteredItems = [];
|
||||||
String? selectedClass;
|
String? selectedClass;
|
||||||
String? exceptionalClass = "0";
|
String? exceptionalClass = "0";
|
||||||
bool hasExceptionalClass = false;
|
bool hasExceptionalClass = false;
|
||||||
@ -68,6 +69,8 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
late TextEditingController _checkOutTimeController = TextEditingController();
|
late TextEditingController _checkOutTimeController = TextEditingController();
|
||||||
late TextEditingController _commentsController = TextEditingController();
|
late TextEditingController _commentsController = TextEditingController();
|
||||||
|
|
||||||
|
List<dynamic>? futureHotels;
|
||||||
|
|
||||||
bool _destinationFocused = false;
|
bool _destinationFocused = false;
|
||||||
bool _isHotelNameFocused = false;
|
bool _isHotelNameFocused = false;
|
||||||
bool _CategoryFocused = false;
|
bool _CategoryFocused = false;
|
||||||
@ -129,6 +132,7 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
loadInitialData();
|
loadInitialData();
|
||||||
});
|
});
|
||||||
|
|
||||||
_addFocusListener(
|
_addFocusListener(
|
||||||
_destinationFocusNode,
|
_destinationFocusNode,
|
||||||
(focus) => _destinationFocused = focus,
|
(focus) => _destinationFocused = focus,
|
||||||
@ -284,11 +288,36 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
// : Colors.redAccent;
|
// : Colors.redAccent;
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
futureHotels = await apiService.fetchGetHotels();
|
||||||
|
|
||||||
|
print("futureHotels - $futureHotels");
|
||||||
|
|
||||||
|
// Extract hotel_name and assign to items
|
||||||
|
allItems =
|
||||||
|
futureHotels!
|
||||||
|
.map<String>((hotel) => hotel['hotel_name'].toString())
|
||||||
|
.toList();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
layoutColor =
|
layoutColor =
|
||||||
layoutString != null
|
layoutString != null
|
||||||
? Color(int.parse(layoutString))
|
? Color(int.parse(layoutString))
|
||||||
: Colors.redAccent;
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
filteredItems = List.from(allItems);
|
||||||
|
|
||||||
|
print("items - $allItems");
|
||||||
|
_hotelNameController.addListener(_filterItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _filterItems() {
|
||||||
|
print("Filter iteks");
|
||||||
|
String query = _hotelNameController.text.toLowerCase();
|
||||||
|
print("Filter iteks - $query");
|
||||||
|
setState(() {
|
||||||
|
filteredItems =
|
||||||
|
allItems.where((item) => item.toLowerCase().contains(query)).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +616,7 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final List<String> items = ['Apple', 'Banana', 'Orange', 'Mango'];
|
// final List<String> items = ['Apple Banana', 'Banana', 'Orange', 'Mango'];
|
||||||
// Default selected value
|
// Default selected value
|
||||||
// selectedClass ??=
|
// selectedClass ??=
|
||||||
// dropdownItems.isNotEmpty ? dropdownItems.first.value : null;
|
// dropdownItems.isNotEmpty ? dropdownItems.first.value : null;
|
||||||
@ -665,26 +694,124 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldItnerarySubWrapper(
|
CustomTextFieldItnerarySubWrapper(
|
||||||
isFocused: _isHotelNameFocused,
|
// isFocused: _isHotelNameFocused,
|
||||||
|
isFocused: false,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
// width:
|
// width:
|
||||||
// isDesktop
|
// isDesktop
|
||||||
// ? MediaQuery.of(context).size.width * 0.34
|
// ? MediaQuery.of(context).size.width * 0.34
|
||||||
// : MediaQuery.of(context).size.width * 0.66,
|
// : MediaQuery.of(context).size.width * 0.66,
|
||||||
|
child: Focus(
|
||||||
|
focusNode: _hotelNameFocusNode,
|
||||||
|
|
||||||
|
onFocusChange: (hasFocus) {
|
||||||
|
setState(() {
|
||||||
|
_isHotelNameFocused = hasFocus;
|
||||||
|
});
|
||||||
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: TextField(
|
child: GestureDetector(
|
||||||
focusNode: _hotelNameFocusNode, // Assign the correct focus node
|
onTap: () {
|
||||||
controller: _hotelNameController,
|
_hotelNameFocusNode.requestFocus();
|
||||||
style: TextStyle(fontSize: 12),
|
},
|
||||||
decoration: InputDecoration(
|
child: DropdownSearch<String>(
|
||||||
labelText: "Hotel Name",
|
items: allItems,
|
||||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
selectedItem: _hotelNameController.text,
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
popupProps: PopupProps.menu(
|
||||||
border: InputBorder.none,
|
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
showSearchBox: true,
|
||||||
|
itemBuilder:
|
||||||
|
(context, item, isSelected) => Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 2,
|
||||||
),
|
),
|
||||||
|
child: Text(
|
||||||
|
item,
|
||||||
|
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 11,
|
||||||
|
), // 👈 smaller font size here
|
||||||
|
),
|
||||||
|
),
|
||||||
|
searchFieldProps: TextFieldProps(
|
||||||
|
controller: _hotelNameController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: "Enter/ Search Hotel Name",
|
||||||
|
labelStyle: GoogleFonts.poppins(fontSize: 11),
|
||||||
|
|
||||||
|
isDense: true,
|
||||||
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
|
// contentPadding: EdgeInsets.symmetric(
|
||||||
|
// vertical: 12,
|
||||||
|
// horizontal: 10,
|
||||||
|
// ),
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
fit: FlexFit.loose,
|
||||||
|
),
|
||||||
|
|
||||||
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
|
dropdownSearchDecoration: InputDecoration(
|
||||||
|
labelText: "Hotel Name",
|
||||||
|
labelStyle: GoogleFonts.poppins(
|
||||||
|
fontSize: 11,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
// border: OutlineInputBorder(),
|
||||||
|
// border: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color:
|
||||||
|
(_isHotelNameFocused ?? false)
|
||||||
|
? layoutColor!
|
||||||
|
: Colors.white,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color:
|
||||||
|
(_CategoryFocused ?? false)
|
||||||
|
? layoutColor
|
||||||
|
: Colors.white,
|
||||||
|
// : const Color(0xFFD6D5E6),
|
||||||
|
width: 1,
|
||||||
|
// const Color(0xFFD6D5E6),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: layoutColor, width: 1),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (value) {
|
||||||
|
_hotelNameController.text = value ?? '';
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// TextField(
|
||||||
|
// focusNode: _hotelNameFocusNode, // Assign the correct focus node
|
||||||
|
// controller: _hotelNameController,
|
||||||
|
// style: TextStyle(fontSize: 12),
|
||||||
|
// decoration: InputDecoration(
|
||||||
|
// labelText: "Hotel Name",
|
||||||
|
// labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
||||||
|
// floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
|
// border: InputBorder.none,
|
||||||
|
// contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -173,7 +173,10 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
|
|
||||||
// Save to SharedPreferences
|
// Save to SharedPreferences
|
||||||
await prefs.setString('layout_color', selectedOrg?['layout_color']);
|
await prefs.setString('layout_color', selectedOrg?['layout_color']);
|
||||||
await prefs.setString('secondary_color', selectedOrg?['secondary_color']);
|
await prefs.setString(
|
||||||
|
'secondary_color',
|
||||||
|
selectedOrg?['secondary_color'],
|
||||||
|
);
|
||||||
await prefs.setString('ternary_color', selectedOrg?['ternary_color']);
|
await prefs.setString('ternary_color', selectedOrg?['ternary_color']);
|
||||||
await prefs.setString('body_color', selectedOrg?['color']);
|
await prefs.setString('body_color', selectedOrg?['color']);
|
||||||
await prefs.setString('body_color', selectedOrg?['plan_action']);
|
await prefs.setString('body_color', selectedOrg?['plan_action']);
|
||||||
@ -551,7 +554,9 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
} else if (role == "Travel Agent") {
|
} else if (role == "Travel Agent") {
|
||||||
filteredItems =
|
filteredItems =
|
||||||
menuItems
|
menuItems
|
||||||
.where((item) => item['value'] == '/logout')
|
.where(
|
||||||
|
(item) => item['value'] == '/logout',
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
} else {
|
} else {
|
||||||
filteredItems = menuItems;
|
filteredItems = menuItems;
|
||||||
|
|||||||
@ -1591,7 +1591,11 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> reportExcelDownload(String apiRoute,String body,String name,) async {
|
Future<Map<String, dynamic>> reportExcelDownload(
|
||||||
|
String apiRoute,
|
||||||
|
String body,
|
||||||
|
String name,
|
||||||
|
) async {
|
||||||
final String apiUrldata = '$apiUrl/api/$apiRoute';
|
final String apiUrldata = '$apiUrl/api/$apiRoute';
|
||||||
|
|
||||||
// Sanitize name for filename (optional)
|
// Sanitize name for filename (optional)
|
||||||
@ -1617,7 +1621,6 @@ class ApiService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
print("report XL Dowloaded");
|
print("report XL Dowloaded");
|
||||||
print(excelName);
|
print(excelName);
|
||||||
@ -1651,4 +1654,33 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------- Report -------------------------
|
// ----------------------- Report -------------------------
|
||||||
|
|
||||||
|
Future<List<dynamic>> fetchGetHotels() async {
|
||||||
|
// return [];
|
||||||
|
final orgId = await getOrgId();
|
||||||
|
final String apiUrlData = '$apiUrl/api/getHotels';
|
||||||
|
|
||||||
|
final String? token = await getToken();
|
||||||
|
|
||||||
|
print("Fetch Hotels 2KN : $token");
|
||||||
|
|
||||||
|
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) {
|
||||||
|
final data = json.decode(response.body);
|
||||||
|
return data['data']; // Returning raw JSON list
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load users');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,9 +67,6 @@ dependencies:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user