Itinerary List Dropdown
This commit is contained in:
parent
4a1624acde
commit
23e6c1608a
@ -377,8 +377,6 @@ class _VisaScreenState extends State<VisaScreen> {
|
|||||||
// List<String> countryNames = countryList.map((item) => item['country_name'] as String).toList();
|
// List<String> countryNames = countryList.map((item) => item['country_name'] as String).toList();
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
late Map<String, String> countryMap; // Mapping country_code -> country_name
|
late Map<String, String> countryMap; // Mapping country_code -> country_name
|
||||||
late List<String> countryCodes; // List of country codes
|
late List<String> countryCodes; // List of country codes
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class FlightListWidget extends StatelessWidget {
|
|||||||
horizontalInside: BorderSide(color: Colors.black12), // Only horizontal lines
|
horizontalInside: BorderSide(color: Colors.black12), // Only horizontal lines
|
||||||
),
|
),
|
||||||
columns: const [
|
columns: const [
|
||||||
DataColumn(label: Text('#')),
|
// DataColumn(label: Text('#')),
|
||||||
DataColumn(label: Text('Trip Type')),
|
DataColumn(label: Text('Trip Type')),
|
||||||
DataColumn(label: Text('From')),
|
DataColumn(label: Text('From')),
|
||||||
DataColumn(label: Text('To')),
|
DataColumn(label: Text('To')),
|
||||||
@ -61,7 +61,7 @@ class FlightListWidget extends StatelessWidget {
|
|||||||
|
|
||||||
|
|
||||||
return DataRow(cells: [
|
return DataRow(cells: [
|
||||||
DataCell(Text(item["indx"]?.toString() ?? "N/A")),
|
// DataCell(Text(item["indx"]?.toString() ?? "N/A")),
|
||||||
DataCell(Text(item["trip_type"]?.toString() ?? "N/A")),
|
DataCell(Text(item["trip_type"]?.toString() ?? "N/A")),
|
||||||
DataCell(Text(item["trips"].isNotEmpty ? item["trips"][0]["from_place"]?.toString() ?? "N/A" : "N/A")),
|
DataCell(Text(item["trips"].isNotEmpty ? item["trips"][0]["from_place"]?.toString() ?? "N/A" : "N/A")),
|
||||||
DataCell(Text(item["trips"].isNotEmpty ? item["trips"][0]["to_place"]?.toString() ?? "N/A" : "N/A")),
|
DataCell(Text(item["trips"].isNotEmpty ? item["trips"][0]["to_place"]?.toString() ?? "N/A" : "N/A")),
|
||||||
|
|||||||
@ -7,8 +7,10 @@ class ForexListWidget extends StatelessWidget{
|
|||||||
final List<Map<String,dynamic>> forexList;
|
final List<Map<String,dynamic>> forexList;
|
||||||
final Function(bool, Map<String,dynamic>, String)onOpen;
|
final Function(bool, Map<String,dynamic>, String)onOpen;
|
||||||
final Function(Map<String,dynamic>) onDeleteForex;
|
final Function(Map<String,dynamic>) onDeleteForex;
|
||||||
|
final List<dynamic>? apiCountryData;
|
||||||
|
|
||||||
const ForexListWidget({super.key, required this.forexList, required this.onOpen, required this.onDeleteForex});
|
const ForexListWidget({super.key, required this.forexList, required this.onOpen,
|
||||||
|
required this.onDeleteForex,required this.apiCountryData});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -59,12 +61,26 @@ class ForexListWidget extends StatelessWidget{
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataRow> _buildDataRows() {
|
List<DataRow> _buildDataRows() {
|
||||||
|
List<dynamic> countryList = apiCountryData ?? [];
|
||||||
|
|
||||||
List<Map<String, dynamic>> filteredList = forexList
|
List<Map<String, dynamic>> filteredList = forexList
|
||||||
.where((item) => item["is_active"] == "1")
|
.where((item) => item["is_active"] == "1")
|
||||||
.toList();
|
.toList();
|
||||||
print("filteredList- $filteredList");
|
print("filteredList- $filteredList");
|
||||||
|
|
||||||
|
|
||||||
|
String getRequestForCountry(String? countryCode) {
|
||||||
|
if (countryCode == null) return "N/A";
|
||||||
|
|
||||||
|
return countryList
|
||||||
|
.firstWhere(
|
||||||
|
(element) => element["country_code"].toString() == countryCode,
|
||||||
|
orElse: () => {"country_name": "N/A"},
|
||||||
|
)["country_name"]
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return filteredList.asMap().entries.map((entry) {
|
return filteredList.asMap().entries.map((entry) {
|
||||||
|
|
||||||
Map<String,dynamic> item = entry.value;
|
Map<String,dynamic> item = entry.value;
|
||||||
@ -73,7 +89,8 @@ class ForexListWidget extends StatelessWidget{
|
|||||||
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
|
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
|
||||||
DataCell(Text(item["start_date"] ?? "N/A")),
|
DataCell(Text(item["start_date"] ?? "N/A")),
|
||||||
DataCell(Text(item["end_date"] ?? "N/A")),
|
DataCell(Text(item["end_date"] ?? "N/A")),
|
||||||
DataCell(Text(item["country_code"] ?? "N/A")),
|
DataCell( Text(getRequestForCountry( item["country_code"]!.toString()))),
|
||||||
|
// DataCell(Text(item["country_code"] ?? "N/A")),
|
||||||
DataCell(Text(item["perdiem_amount"] ?? "N/A")),
|
DataCell(Text(item["perdiem_amount"] ?? "N/A")),
|
||||||
DataCell(Row(
|
DataCell(Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -6,7 +6,9 @@ class InsuranceListWidget extends StatelessWidget {
|
|||||||
final List<Map<String,dynamic>> insuranceList;
|
final List<Map<String,dynamic>> insuranceList;
|
||||||
final Function(bool, Map<String,dynamic>, String)onOpen;
|
final Function(bool, Map<String,dynamic>, String)onOpen;
|
||||||
final Function(Map<String,dynamic>)onDeleteInsurance;
|
final Function(Map<String,dynamic>)onDeleteInsurance;
|
||||||
const InsuranceListWidget({super.key, required this.insuranceList, required this.onOpen,required this.onDeleteInsurance});
|
final Map<String, dynamic>? apiData;
|
||||||
|
const InsuranceListWidget({super.key, required this.insuranceList, required this.onOpen,required this.apiData,
|
||||||
|
required this.onDeleteInsurance});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -51,17 +53,33 @@ class InsuranceListWidget extends StatelessWidget {
|
|||||||
|
|
||||||
List<DataRow> _buildDataRows() {
|
List<DataRow> _buildDataRows() {
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, dynamic>> filteredList = insuranceList
|
List<Map<String, dynamic>> filteredList = insuranceList
|
||||||
.where((item) => item["is_active"] == "1")
|
.where((item) => item["is_active"] == "1")
|
||||||
.toList();
|
.toList();
|
||||||
print("filteredList- $filteredList");
|
print("filteredList- $filteredList");
|
||||||
|
|
||||||
|
List<dynamic> insurancetypeList = apiData?['insurance_type_of_insurance'] ?? [];
|
||||||
|
|
||||||
|
|
||||||
|
String getRequestForInsuranceType(String? specialRequestKey) {
|
||||||
|
if (specialRequestKey == null) return "N/A";
|
||||||
|
|
||||||
|
return insurancetypeList
|
||||||
|
.firstWhere(
|
||||||
|
(element) => element["dropdown_key"].toString() == specialRequestKey,
|
||||||
|
orElse: () => {"dropdown_value": "N/A"},
|
||||||
|
)["dropdown_value"]
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
return filteredList.asMap().entries.map((entry) {
|
return filteredList.asMap().entries.map((entry) {
|
||||||
|
|
||||||
Map<String,dynamic> item = entry.value;
|
Map<String,dynamic> item = entry.value;
|
||||||
return DataRow(cells: [
|
return DataRow(cells: [
|
||||||
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
|
// DataCell(Text(item["indx"]?.toString() ?? "N/A")), // Index column
|
||||||
DataCell(Text(item["type_of_insurance"]!)),
|
// DataCell(Text(item["type_of_insurance"]!)),
|
||||||
|
DataCell( Text(getRequestForInsuranceType( item["type_of_insurance"]!.toString()))),
|
||||||
DataCell(Text(item["start_date"]!)),
|
DataCell(Text(item["start_date"]!)),
|
||||||
DataCell(Text(item["end_date"]!)),
|
DataCell(Text(item["end_date"]!)),
|
||||||
DataCell(Row(
|
DataCell(Row(
|
||||||
|
|||||||
@ -58,6 +58,7 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
print("filteredList- $filteredList");
|
print("filteredList- $filteredList");
|
||||||
|
|
||||||
List<dynamic> visatypeList = apiData?['visa_type_of_visa'] ?? [];
|
List<dynamic> visatypeList = apiData?['visa_type_of_visa'] ?? [];
|
||||||
|
List<dynamic> countryList = apiCountryData ?? [];
|
||||||
|
|
||||||
String getRequestForVisa(String? specialRequestKey) {
|
String getRequestForVisa(String? specialRequestKey) {
|
||||||
if (specialRequestKey == null) return "N/A";
|
if (specialRequestKey == null) return "N/A";
|
||||||
@ -70,6 +71,17 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getRequestForCountry(String? countryCode) {
|
||||||
|
if (countryCode == null) return "N/A";
|
||||||
|
|
||||||
|
return countryList
|
||||||
|
.firstWhere(
|
||||||
|
(element) => element["country_code"].toString() == countryCode,
|
||||||
|
orElse: () => {"country_name": "N/A"},
|
||||||
|
)["country_name"]
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return filteredList.asMap().entries.map((entry){
|
return filteredList.asMap().entries.map((entry){
|
||||||
@ -81,7 +93,8 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
// DataCell(Text(item["indx"]?.toString() ?? "N/A")),
|
// DataCell(Text(item["indx"]?.toString() ?? "N/A")),
|
||||||
// DataCell(Text(item["type_of_visa"]!)),
|
// DataCell(Text(item["type_of_visa"]!)),
|
||||||
DataCell( Text(getRequestForVisa( item["type_of_visa"]!.toString()))),
|
DataCell( Text(getRequestForVisa( item["type_of_visa"]!.toString()))),
|
||||||
DataCell(Text(item["country_code"]!)),
|
DataCell( Text(getRequestForCountry( item["country_code"]!.toString()))),
|
||||||
|
// DataCell(Text(item["country_code"]!)),
|
||||||
DataCell(Text(item["start_date"]!)),
|
DataCell(Text(item["start_date"]!)),
|
||||||
DataCell(Row(
|
DataCell(Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -315,7 +315,7 @@ class _DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
break;
|
break;
|
||||||
case "Insurance":
|
case "Insurance":
|
||||||
selectedListWidget = InsuranceListWidget(insuranceList : itineraryData["Insurance"]!,
|
selectedListWidget = InsuranceListWidget(insuranceList : itineraryData["Insurance"]!,
|
||||||
onOpen: handleEdit,
|
onOpen: handleEdit, apiData: widget.apiData,
|
||||||
onDeleteInsurance:(data) => handleItinerarydelete("Insurance", data),);
|
onDeleteInsurance:(data) => handleItinerarydelete("Insurance", data),);
|
||||||
break;
|
break;
|
||||||
case "Visa":
|
case "Visa":
|
||||||
@ -326,6 +326,7 @@ class _DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
break;
|
break;
|
||||||
case "Forex":
|
case "Forex":
|
||||||
selectedListWidget = ForexListWidget(forexList: itineraryData["Forex"]!,
|
selectedListWidget = ForexListWidget(forexList: itineraryData["Forex"]!,
|
||||||
|
apiCountryData : widget.apiCountryData,
|
||||||
onOpen: handleEdit,
|
onOpen: handleEdit,
|
||||||
onDeleteForex: (data) => handleItinerarydelete("Forex", data),);
|
onDeleteForex: (data) => handleItinerarydelete("Forex", data),);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user