UI_USR_MNGMT_APPROVER
This commit is contained in:
parent
d2b3b792d9
commit
1b6188c584
@ -52,7 +52,7 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
"Partially Approved",
|
"Partially Approved",
|
||||||
"Approved",
|
"Approved",
|
||||||
"Rejected",
|
"Rejected",
|
||||||
"Cancelled"
|
"Cancelled",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Extract counts for "Both" section
|
// Extract counts for "Both" section
|
||||||
@ -151,7 +151,6 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
});
|
});
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
});
|
});
|
||||||
// If token exists, load the dashboard data
|
// If token exists, load the dashboard data
|
||||||
loadDashboardData();
|
loadDashboardData();
|
||||||
@ -320,25 +319,27 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
// currentData = selectedView == "Today" ? todayBasedCount : weekBasedCount;
|
// currentData = selectedView == "Today" ? todayBasedCount : weekBasedCount;
|
||||||
typeData = selectedView == "Today"
|
typeData =
|
||||||
? typeBasedTodayCount
|
selectedView == "Today" ? typeBasedTodayCount : typeBasedWeeklyCount;
|
||||||
: typeBasedWeeklyCount ;
|
statusData =
|
||||||
statusData = selectedView == "Today"
|
selectedView == "Today"
|
||||||
? statusBasedTodayCount
|
? statusBasedTodayCount
|
||||||
: statusBasedWeeklyCount;
|
: statusBasedWeeklyCount;
|
||||||
|
|
||||||
flightData = selectedView == "Today"
|
flightData =
|
||||||
|
selectedView == "Today"
|
||||||
? getStatusValues(todayBasedCount['flight'] ?? {})
|
? getStatusValues(todayBasedCount['flight'] ?? {})
|
||||||
: getStatusValues(weekBasedCount['flight'] ?? {});
|
: getStatusValues(weekBasedCount['flight'] ?? {});
|
||||||
accommodationData = selectedView == "Today"
|
accommodationData =
|
||||||
|
selectedView == "Today"
|
||||||
? getStatusValues(todayBasedCount['acomodation'] ?? {})
|
? getStatusValues(todayBasedCount['acomodation'] ?? {})
|
||||||
: getStatusValues(weekBasedCount['acomodation'] ?? {});
|
: getStatusValues(weekBasedCount['acomodation'] ?? {});
|
||||||
forexData = selectedView == "Today"
|
forexData =
|
||||||
|
selectedView == "Today"
|
||||||
? getStatusValues(todayBasedCount['forex'] ?? {})
|
? getStatusValues(todayBasedCount['forex'] ?? {})
|
||||||
: getStatusValues(weekBasedCount['forex'] ?? {});
|
: getStatusValues(weekBasedCount['forex'] ?? {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
print("statusBasedCount - => $statusBasedCount");
|
print("statusBasedCount - => $statusBasedCount");
|
||||||
print("Current Data - => $currentData");
|
print("Current Data - => $currentData");
|
||||||
// 👇 Local function to create the card widget
|
// 👇 Local function to create the card widget
|
||||||
@ -403,6 +404,7 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
print("dashboard ..");
|
print("dashboard ..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String capitalize(String s) => s[0].toUpperCase() + s.substring(1);
|
String capitalize(String s) => s[0].toUpperCase() + s.substring(1);
|
||||||
|
|
||||||
Widget toggleChip(String label) {
|
Widget toggleChip(String label) {
|
||||||
@ -501,7 +503,8 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center, // vertically center everything
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center, // vertically center everything
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
count.toString(),
|
count.toString(),
|
||||||
@ -529,8 +532,40 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildCategoryCard(String title, IconData icon, List<String> statusLabels,List<int> values) {
|
Widget statusCardContainer(bool isDesktop, List<Widget> cards) {
|
||||||
|
return isDesktop
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children:
|
||||||
|
cards
|
||||||
|
.map(
|
||||||
|
(card) => Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 12.0),
|
||||||
|
child: card,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children:
|
||||||
|
cards
|
||||||
|
.map(
|
||||||
|
(card) => Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 12.0),
|
||||||
|
child: card,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildCategoryCard(
|
||||||
|
String title,
|
||||||
|
IconData icon,
|
||||||
|
List<String> statusLabels,
|
||||||
|
List<int> values,
|
||||||
|
) {
|
||||||
final statusIcons = [
|
final statusIcons = [
|
||||||
Icons.calendar_today,
|
Icons.calendar_today,
|
||||||
Icons.assignment,
|
Icons.assignment,
|
||||||
@ -584,17 +619,16 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
color: Color(0xFF004A8E),
|
color: Color(0xFF004A8E),
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(icon, color: Colors.white, size: 20),
|
||||||
icon,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(title, style: GoogleFonts.poppins(
|
Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontWeight: FontWeight.bold
|
fontWeight: FontWeight.bold,
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
@ -612,7 +646,9 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
height: 28,
|
height: 28,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: statusColors[index], // background color
|
color: statusColors[index], // background color
|
||||||
borderRadius: BorderRadius.circular(4), // square with slight rounding
|
borderRadius: BorderRadius.circular(
|
||||||
|
4,
|
||||||
|
), // square with slight rounding
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@ -622,16 +658,20 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(statusLabels[index], style: GoogleFonts.poppins(
|
Text(
|
||||||
color: Colors.black87,
|
statusLabels[index],
|
||||||
),),
|
style: GoogleFonts.poppins(color: Colors.black87),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(values[index].toString(), style: GoogleFonts.poppins(
|
Text(
|
||||||
|
values[index].toString(),
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -736,35 +776,41 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
appBar: CustomAppBar(isDesktop: isDesktop),
|
appBar: CustomAppBar(isDesktop: isDesktop),
|
||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: isDesktop
|
padding:
|
||||||
|
isDesktop
|
||||||
? const EdgeInsets.symmetric(vertical: 5)
|
? const EdgeInsets.symmetric(vertical: 5)
|
||||||
: EdgeInsets.zero,
|
: EdgeInsets.zero,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(maxWidth: 1200),
|
||||||
maxWidth: 1200,
|
|
||||||
),
|
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15.0), // ✅ Scroll content padding
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 15.0,
|
||||||
|
), // ✅ Scroll content padding
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
isLoading ? Center(child: CircularProgressIndicator()) :
|
isLoading
|
||||||
LayoutBuilder(
|
? Center(child: CircularProgressIndicator())
|
||||||
|
: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// First Row: Toggle Buttons Row
|
// First Row: Toggle Buttons Row
|
||||||
|
const SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 36,
|
height: 36,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xFFEAEAEA),
|
color: const Color(0xFFEAEAEA),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius:
|
||||||
|
BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -780,15 +826,20 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
// Second Row: Domestic & International and Status
|
// Second Row: Domestic & International and Status
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
12,
|
||||||
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.blueGrey,
|
color: Colors.blueGrey,
|
||||||
@ -797,7 +848,9 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(
|
||||||
|
15,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
...typeData.map((item) {
|
...typeData.map((item) {
|
||||||
@ -805,14 +858,28 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
buildTopCard(
|
buildTopCard(
|
||||||
color: item['value'] == "Domestic"
|
color:
|
||||||
? Color(0xFF0DB04B)
|
item['value'] ==
|
||||||
: Color(0xFF004A8E),
|
"Domestic"
|
||||||
label: item['value'],
|
? Color(
|
||||||
count: item['count'],
|
0xFF0DB04B,
|
||||||
bgColor: item['value'] == "Domestic"
|
)
|
||||||
? const Color(0xFFD6FBE4)
|
: Color(
|
||||||
: const Color(0xFFD9E8FF),
|
0xFF004A8E,
|
||||||
|
),
|
||||||
|
label:
|
||||||
|
item['value'],
|
||||||
|
count:
|
||||||
|
item['count'],
|
||||||
|
bgColor:
|
||||||
|
item['value'] ==
|
||||||
|
"Domestic"
|
||||||
|
? const Color(
|
||||||
|
0xFFD6FBE4,
|
||||||
|
)
|
||||||
|
: const Color(
|
||||||
|
0xFFD9E8FF,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -828,7 +895,10 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
12,
|
||||||
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.blueGrey,
|
color: Colors.blueGrey,
|
||||||
@ -837,23 +907,46 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(
|
||||||
|
15,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Status",
|
"Status",
|
||||||
style: GoogleFonts.poppins(
|
style:
|
||||||
|
GoogleFonts.poppins(
|
||||||
fontSize: 19,
|
fontSize: 19,
|
||||||
color: Colors.black87,
|
color:
|
||||||
fontWeight: FontWeight.bold,
|
Colors
|
||||||
|
.black87,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
...statusData.map((item) => statusCard(item['value'], item['count'], isDesktop)).toList(),
|
...statusData
|
||||||
|
.map(
|
||||||
|
(
|
||||||
|
item,
|
||||||
|
) => statusCard(
|
||||||
|
item['value'],
|
||||||
|
item['count'],
|
||||||
|
isDesktop,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -863,12 +956,14 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius:
|
||||||
|
BorderRadius.circular(12),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.blueGrey,
|
color: Colors.blueGrey,
|
||||||
@ -877,7 +972,9 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(
|
||||||
|
15,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
...typeData.map((item) {
|
...typeData.map((item) {
|
||||||
@ -885,14 +982,28 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
buildTopCard(
|
buildTopCard(
|
||||||
color: item['value'] == "Domestic"
|
color:
|
||||||
? const Color(0xFF0DB04B)
|
item['value'] ==
|
||||||
: const Color(0xFF004A8E),
|
"Domestic"
|
||||||
label: item['value'],
|
? const Color(
|
||||||
count: item['count'],
|
0xFF0DB04B,
|
||||||
bgColor: item['value'] == "Domestic"
|
)
|
||||||
? const Color(0xFFD6FBE4)
|
: const Color(
|
||||||
: const Color(0xFFD9E8FF),
|
0xFF004A8E,
|
||||||
|
),
|
||||||
|
label:
|
||||||
|
item['value'],
|
||||||
|
count:
|
||||||
|
item['count'],
|
||||||
|
bgColor:
|
||||||
|
item['value'] ==
|
||||||
|
"Domestic"
|
||||||
|
? const Color(
|
||||||
|
0xFFD6FBE4,
|
||||||
|
)
|
||||||
|
: const Color(
|
||||||
|
0xFFD9E8FF,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -905,7 +1016,8 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius:
|
||||||
|
BorderRadius.circular(12),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.blueGrey,
|
color: Colors.blueGrey,
|
||||||
@ -914,16 +1026,22 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(
|
||||||
|
15,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Status",
|
"Status",
|
||||||
style: GoogleFonts.poppins(
|
style:
|
||||||
|
GoogleFonts.poppins(
|
||||||
fontSize: 19,
|
fontSize: 19,
|
||||||
color: Colors.black87,
|
color:
|
||||||
fontWeight: FontWeight.bold,
|
Colors.black87,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 23),
|
const SizedBox(height: 23),
|
||||||
@ -931,7 +1049,17 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
spacing: 10,
|
spacing: 10,
|
||||||
runSpacing: 10,
|
runSpacing: 10,
|
||||||
children: [
|
children: [
|
||||||
...statusData.map((item) => statusCard(item['value'], item['count'], isDesktop)).toList(),
|
...statusData
|
||||||
|
.map(
|
||||||
|
(
|
||||||
|
item,
|
||||||
|
) => statusCard(
|
||||||
|
item['value'],
|
||||||
|
item['count'],
|
||||||
|
isDesktop,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -945,33 +1073,77 @@ class StatusDashboardState extends State<StatusDashboard> {
|
|||||||
// Third Row: Flight, Accommodation, Forex
|
// Third Row: Flight, Accommodation, Forex
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: buildCategoryCard("Flight", Icons.flight, statusLabels, flightData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Flight",
|
||||||
|
Icons.flight,
|
||||||
|
statusLabels,
|
||||||
|
flightData,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(child: buildCategoryCard("Accomodation", Icons.hotel_outlined, statusLabels, accommodationData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Accomodation",
|
||||||
|
Icons.hotel_outlined,
|
||||||
|
statusLabels,
|
||||||
|
accommodationData,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(child: buildCategoryCard("Forex", Icons.attach_money, statusLabels, forexData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Forex",
|
||||||
|
Icons.attach_money,
|
||||||
|
statusLabels,
|
||||||
|
forexData,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: buildCategoryCard("Flight", Icons.flight, statusLabels, flightData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Flight",
|
||||||
|
Icons.flight,
|
||||||
|
statusLabels,
|
||||||
|
flightData,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: buildCategoryCard("Accomodation", Icons.hotel_outlined, statusLabels, accommodationData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Accomodation",
|
||||||
|
Icons.hotel_outlined,
|
||||||
|
statusLabels,
|
||||||
|
accommodationData,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: buildCategoryCard("Forex", Icons.attach_money, statusLabels, forexData)),
|
Expanded(
|
||||||
|
child: buildCategoryCard(
|
||||||
|
"Forex",
|
||||||
|
Icons.attach_money,
|
||||||
|
statusLabels,
|
||||||
|
forexData,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|||||||
@ -926,7 +926,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
minimumSize: !isDesktop
|
minimumSize:
|
||||||
|
!isDesktop
|
||||||
? const Size.fromHeight(48)
|
? const Size.fromHeight(48)
|
||||||
: null, // No min height on desktop // height
|
: null, // No min height on desktop // height
|
||||||
backgroundColor: Colors.green,
|
backgroundColor: Colors.green,
|
||||||
@ -1744,7 +1745,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
|
|
||||||
final parts = selectedItem.split('\n');
|
final parts = selectedItem.split('\n');
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport = parts.length > 1 ? parts[1] : '';
|
final airport =
|
||||||
|
parts.length > 1 ? parts[1] : '';
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
@ -1773,7 +1775,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
selectedFrom[index] =
|
selectedFrom[index] =
|
||||||
countryMap.entries
|
countryMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
if (selectedTripType == "Roundtrip") {
|
if (selectedTripType == "Roundtrip") {
|
||||||
@ -1848,7 +1851,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
//
|
//
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Request focus when user taps
|
// Request focus when user taps
|
||||||
focusNodes["_to${index}FocusNode"]?.requestFocus();
|
focusNodes["_to${index}FocusNode"]
|
||||||
|
?.requestFocus();
|
||||||
},
|
},
|
||||||
child: DropdownSearch<String>(
|
child: DropdownSearch<String>(
|
||||||
enabled:
|
enabled:
|
||||||
@ -2005,7 +2009,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
|
|
||||||
final parts = selectedItem.split('\n');
|
final parts = selectedItem.split('\n');
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport = parts.length > 1 ? parts[1] : '';
|
final airport =
|
||||||
|
parts.length > 1 ? parts[1] : '';
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
@ -2021,7 +2026,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
selectedTo[index] =
|
selectedTo[index] =
|
||||||
countryMap.entries
|
countryMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
@ -2159,9 +2165,12 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: false,
|
showSearchBox: false,
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
menuProps: const MenuProps(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (context, item, isSelected) {
|
||||||
final bool isNotAllowed = item['is_allowed'] == 'No';
|
final bool isNotAllowed =
|
||||||
|
item['is_allowed'] == 'No';
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -2187,7 +2196,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_class${index}Focused"] ?? false)
|
(focusStates["_class${index}Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor!
|
? layoutColor!
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
@ -2196,7 +2206,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_class${index}Focused"] ?? false)
|
(focusStates["_class${index}Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor
|
? layoutColor
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
// : const Color(0xFFD6D5E6),
|
// : const Color(0xFFD6D5E6),
|
||||||
@ -2205,7 +2216,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: layoutColor, width: 1),
|
borderSide: BorderSide(
|
||||||
|
color: layoutColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -2328,7 +2342,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
isFocused: focusStates["_date${index}Focused"] ?? false,
|
isFocused: focusStates["_date${index}Focused"] ?? false,
|
||||||
|
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
width:
|
||||||
|
isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -2416,7 +2431,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
CustomTextFieldItnerarySubWrapper(
|
CustomTextFieldItnerarySubWrapper(
|
||||||
isFocused: focusStates["_time${index}Focused"] ?? false,
|
isFocused: focusStates["_time${index}Focused"] ?? false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.1 : null,
|
width:
|
||||||
|
isDesktop ? MediaQuery.of(context).size.width * 0.1 : null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -2444,7 +2460,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "Time",
|
labelText: "Time",
|
||||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||||
@ -2499,7 +2518,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
elevation: 1,
|
elevation: 1,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||||
color: const Color(0xFFF5F5F5), // Light grey
|
color: const Color(0xFFF5F5F5), // Light grey
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -2530,10 +2551,12 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
isCountryLoading
|
isCountryLoading
|
||||||
? Center(child: CircularProgressIndicator())
|
? Center(child: CircularProgressIndicator())
|
||||||
: Focus(
|
: Focus(
|
||||||
focusNode: focusNodes["_from${index}FocusNode"],
|
focusNode:
|
||||||
|
focusNodes["_from${index}FocusNode"],
|
||||||
onFocusChange: (hasFocus) {
|
onFocusChange: (hasFocus) {
|
||||||
setState(() {
|
setState(() {
|
||||||
focusStates["_from${index}Focused"] = hasFocus;
|
focusStates["_from${index}Focused"] =
|
||||||
|
hasFocus;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -2561,13 +2584,16 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
// },
|
// },
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
constraints: BoxConstraints(maxHeight: 220),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 220,
|
||||||
|
),
|
||||||
showSearchBox:
|
showSearchBox:
|
||||||
true, // Enables search functionality
|
true, // Enables search functionality
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search...",
|
hintText: "Search...",
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 1,
|
vertical: 1,
|
||||||
),
|
),
|
||||||
@ -2577,21 +2603,30 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
menuProps: MenuProps(
|
menuProps: MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (
|
||||||
|
context,
|
||||||
|
item,
|
||||||
|
isSelected,
|
||||||
|
) {
|
||||||
final parts = item.split('\n');
|
final parts = item.split('\n');
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport =
|
final airport =
|
||||||
parts.length > 1 ? parts[1] : '';
|
parts.length > 1
|
||||||
|
? parts[1]
|
||||||
|
: '';
|
||||||
|
|
||||||
// Extract city and code from "City (CODE)"
|
// Extract city and code from "City (CODE)"
|
||||||
final cityMatch = RegExp(
|
final cityMatch = RegExp(
|
||||||
r'^(.*)\s+\(([^)]+)\)$',
|
r'^(.*)\s+\(([^)]+)\)$',
|
||||||
).firstMatch(cityAndCode);
|
).firstMatch(cityAndCode);
|
||||||
final city = cityMatch?.group(1) ?? '';
|
final city =
|
||||||
final code = cityMatch?.group(2) ?? '';
|
cityMatch?.group(1) ?? '';
|
||||||
|
final code =
|
||||||
|
cityMatch?.group(2) ?? '';
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
|
const EdgeInsets.symmetric(
|
||||||
horizontal: 8.0,
|
horizontal: 8.0,
|
||||||
vertical: 6.0,
|
vertical: 6.0,
|
||||||
),
|
),
|
||||||
@ -2601,20 +2636,23 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
city,
|
city,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
code,
|
code,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -2625,7 +2663,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow:
|
||||||
|
TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -2668,7 +2707,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_from${index}Focused"] ??
|
(focusStates["_from${index}Focused"] ??
|
||||||
@ -2696,13 +2736,17 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (
|
||||||
|
context,
|
||||||
|
selectedItem,
|
||||||
|
) {
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
@ -2713,15 +2757,20 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final parts = selectedItem.split('\n');
|
final parts = selectedItem.split(
|
||||||
|
'\n',
|
||||||
|
);
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport = parts.length > 1 ? parts[1] : '';
|
final airport =
|
||||||
|
parts.length > 1 ? parts[1] : '';
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
cityAndCode ?? "Select",
|
cityAndCode ?? "Select",
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -2736,7 +2785,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
// ),
|
// ),
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
errorMessages.remove("from_place_$index");
|
errorMessages.remove(
|
||||||
|
"from_place_$index",
|
||||||
|
);
|
||||||
// selectedFrom[index] = countryMap.entries
|
// selectedFrom[index] = countryMap.entries
|
||||||
// .firstWhere((entry) => entry.value == newValue)
|
// .firstWhere((entry) => entry.value == newValue)
|
||||||
// .key;
|
// .key;
|
||||||
@ -2744,13 +2795,19 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
selectedFrom[index] =
|
selectedFrom[index] =
|
||||||
countryMap.entries
|
countryMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value ==
|
||||||
|
newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
if (selectedTripType == "Roundtrip") {
|
if (selectedTripType ==
|
||||||
print('rounfTo${selectedFrom[index]}');
|
"Roundtrip") {
|
||||||
|
print(
|
||||||
|
'rounfTo${selectedFrom[index]}',
|
||||||
|
);
|
||||||
// textControllers["_to${index+1}Controller"]?.text = selectedFrom[index]!;
|
// textControllers["_to${index+1}Controller"]?.text = selectedFrom[index]!;
|
||||||
selectedTo[2] = selectedFrom[index]!;
|
selectedTo[2] =
|
||||||
|
selectedFrom[index]!;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -2809,17 +2866,20 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
isCountryLoading
|
isCountryLoading
|
||||||
? Center(child: CircularProgressIndicator())
|
? Center(child: CircularProgressIndicator())
|
||||||
: Focus(
|
: Focus(
|
||||||
focusNode: focusNodes["_to${index}FocusNode"],
|
focusNode:
|
||||||
|
focusNodes["_to${index}FocusNode"],
|
||||||
onFocusChange: (hasFocus) {
|
onFocusChange: (hasFocus) {
|
||||||
setState(() {
|
setState(() {
|
||||||
focusStates["_to${index}Focused"] = hasFocus;
|
focusStates["_to${index}Focused"] =
|
||||||
|
hasFocus;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
//
|
//
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Request focus when user taps
|
// Request focus when user taps
|
||||||
focusNodes["_to${index}FocusNode"]?.requestFocus();
|
focusNodes["_to${index}FocusNode"]
|
||||||
|
?.requestFocus();
|
||||||
},
|
},
|
||||||
child: DropdownSearch<String>(
|
child: DropdownSearch<String>(
|
||||||
enabled:
|
enabled:
|
||||||
@ -2831,13 +2891,16 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
: null,
|
: null,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
constraints: BoxConstraints(maxHeight: 220),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 220,
|
||||||
|
),
|
||||||
showSearchBox:
|
showSearchBox:
|
||||||
true, // Enables search functionality
|
true, // Enables search functionality
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search...",
|
hintText: "Search...",
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 1,
|
vertical: 1,
|
||||||
),
|
),
|
||||||
@ -2847,21 +2910,30 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
menuProps: MenuProps(
|
menuProps: MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (
|
||||||
|
context,
|
||||||
|
item,
|
||||||
|
isSelected,
|
||||||
|
) {
|
||||||
final parts = item.split('\n');
|
final parts = item.split('\n');
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport =
|
final airport =
|
||||||
parts.length > 1 ? parts[1] : '';
|
parts.length > 1
|
||||||
|
? parts[1]
|
||||||
|
: '';
|
||||||
|
|
||||||
// Extract city and code from "City (CODE)"
|
// Extract city and code from "City (CODE)"
|
||||||
final cityMatch = RegExp(
|
final cityMatch = RegExp(
|
||||||
r'^(.*)\s+\(([^)]+)\)$',
|
r'^(.*)\s+\(([^)]+)\)$',
|
||||||
).firstMatch(cityAndCode);
|
).firstMatch(cityAndCode);
|
||||||
final city = cityMatch?.group(1) ?? '';
|
final city =
|
||||||
final code = cityMatch?.group(2) ?? '';
|
cityMatch?.group(1) ?? '';
|
||||||
|
final code =
|
||||||
|
cityMatch?.group(2) ?? '';
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
|
const EdgeInsets.symmetric(
|
||||||
horizontal: 8.0,
|
horizontal: 8.0,
|
||||||
vertical: 6.0,
|
vertical: 6.0,
|
||||||
),
|
),
|
||||||
@ -2871,20 +2943,23 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
city,
|
city,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
code,
|
code,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -2895,7 +2970,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow:
|
||||||
|
TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -2920,7 +2996,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_to${index}Focused"] ??
|
(focusStates["_to${index}Focused"] ??
|
||||||
@ -2948,7 +3025,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
),
|
),
|
||||||
@ -2963,7 +3041,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
// style: TextStyle(fontSize: 12),
|
// style: TextStyle(fontSize: 12),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (
|
||||||
|
context,
|
||||||
|
selectedItem,
|
||||||
|
) {
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
@ -2974,34 +3055,47 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final parts = selectedItem.split('\n');
|
final parts = selectedItem.split(
|
||||||
|
'\n',
|
||||||
|
);
|
||||||
final cityAndCode = parts[0];
|
final cityAndCode = parts[0];
|
||||||
final airport = parts.length > 1 ? parts[1] : '';
|
final airport =
|
||||||
|
parts.length > 1 ? parts[1] : '';
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
cityAndCode ?? "Select",
|
cityAndCode ?? "Select",
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
errorMessages.remove("to_place_$index");
|
errorMessages.remove(
|
||||||
|
"to_place_$index",
|
||||||
|
);
|
||||||
selectedTo[index] =
|
selectedTo[index] =
|
||||||
countryMap.entries
|
countryMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value ==
|
||||||
|
newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
print(selectedTo[index]);
|
print(selectedTo[index]);
|
||||||
|
|
||||||
if (selectedTripType == "Roundtrip") {
|
if (selectedTripType ==
|
||||||
print('rounfTo${selectedTo[index]}');
|
"Roundtrip") {
|
||||||
|
print(
|
||||||
|
'rounfTo${selectedTo[index]}',
|
||||||
|
);
|
||||||
// textControllers["_to${index+1}Controller"]?.text = selectedFrom[index]!;
|
// textControllers["_to${index+1}Controller"]?.text = selectedFrom[index]!;
|
||||||
selectedFrom[2] = selectedTo[index]!;
|
selectedFrom[2] =
|
||||||
|
selectedTo[index]!;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -3052,7 +3146,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
//
|
//
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Request focus when user taps
|
// Request focus when user taps
|
||||||
focusNodes["_class${index}FocusNode"]?.requestFocus();
|
focusNodes["_class${index}FocusNode"]
|
||||||
|
?.requestFocus();
|
||||||
},
|
},
|
||||||
child: DropdownSearch<Map<String, dynamic>>(
|
child: DropdownSearch<Map<String, dynamic>>(
|
||||||
items: purposeList.cast<Map<String, dynamic>>(),
|
items: purposeList.cast<Map<String, dynamic>>(),
|
||||||
@ -3073,13 +3168,17 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
orElse: () => {},
|
orElse: () => {},
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
itemAsString: (item) => item['dropdown_value'] ?? '',
|
itemAsString:
|
||||||
|
(item) => item['dropdown_value'] ?? '',
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: false,
|
showSearchBox: false,
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
menuProps: const MenuProps(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (context, item, isSelected) {
|
||||||
final bool isNotAllowed = item['is_allowed'] == 'No';
|
final bool isNotAllowed =
|
||||||
|
item['is_allowed'] == 'No';
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -3105,7 +3204,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_class${index}Focused"] ?? false)
|
(focusStates["_class${index}Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor!
|
? layoutColor!
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
@ -3114,7 +3214,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_class${index}Focused"] ?? false)
|
(focusStates["_class${index}Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor
|
? layoutColor
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
// : const Color(0xFFD6D5E6),
|
// : const Color(0xFFD6D5E6),
|
||||||
@ -3123,7 +3224,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: layoutColor, width: 1),
|
borderSide: BorderSide(
|
||||||
|
color: layoutColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -3132,7 +3236,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (context, selectedItem) {
|
||||||
if (selectedItem == null || selectedItem.isEmpty) {
|
if (selectedItem == null ||
|
||||||
|
selectedItem.isEmpty) {
|
||||||
return Text(
|
return Text(
|
||||||
"Select Class",
|
"Select Class",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
@ -3151,7 +3256,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
},
|
},
|
||||||
onChanged:
|
onChanged:
|
||||||
purposeList.isNotEmpty
|
purposeList.isNotEmpty
|
||||||
? (Map<String, dynamic>? newValue) async {
|
? (
|
||||||
|
Map<String, dynamic>? newValue,
|
||||||
|
) async {
|
||||||
// if (newValue != null &&
|
// if (newValue != null &&
|
||||||
// newValue['is_allowed'] == 'No') {
|
// newValue['is_allowed'] == 'No') {
|
||||||
// print('not allowed');
|
// print('not allowed');
|
||||||
@ -3174,7 +3281,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
|
|
||||||
if (newValue != null &&
|
if (newValue != null &&
|
||||||
newValue['is_allowed'] == 'No') {
|
newValue['is_allowed'] == 'No') {
|
||||||
final confirm = await showNotAllowedDialog(
|
final confirm =
|
||||||
|
await showNotAllowedDialog(
|
||||||
context,
|
context,
|
||||||
message:
|
message:
|
||||||
"You are not entitled for this service. If you wish to continue with this service, you may require another approval.",
|
"You are not entitled for this service. If you wish to continue with this service, you may require another approval.",
|
||||||
@ -3224,7 +3332,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
padding: const EdgeInsets.only(top: 4),
|
padding: const EdgeInsets.only(top: 4),
|
||||||
child: Text(
|
child: Text(
|
||||||
errorMessages["class_$index"]!,
|
errorMessages["class_$index"]!,
|
||||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.red),
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -3246,19 +3357,24 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
isFocused: focusStates["_date${index}Focused"] ?? false,
|
isFocused: focusStates["_date${index}Focused"] ?? false,
|
||||||
|
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
width:
|
||||||
|
isDesktop
|
||||||
|
? MediaQuery.of(context).size.width * 0.11
|
||||||
|
: null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
focusNodes["_date${index}FocusNode"]?.requestFocus();
|
focusNodes["_date${index}FocusNode"]
|
||||||
|
?.requestFocus();
|
||||||
_selectCheckOutDate(context);
|
_selectCheckOutDate(context);
|
||||||
},
|
},
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: focusNodes["_date${index}FocusNode"],
|
focusNode: focusNodes["_date${index}FocusNode"],
|
||||||
// controller: _dateController,
|
// controller: _dateController,
|
||||||
controller: textControllers["_date${index}Controller"],
|
controller:
|
||||||
|
textControllers["_date${index}Controller"],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@ -3267,9 +3383,12 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
floatingLabelBehavior:
|
||||||
|
FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
// border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
// borderRadius: BorderRadius.circular(8),
|
// borderRadius: BorderRadius.circular(8),
|
||||||
// borderSide: BorderSide(
|
// borderSide: BorderSide(
|
||||||
@ -3334,13 +3453,18 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
CustomTextFieldItnerarySubWrapper(
|
CustomTextFieldItnerarySubWrapper(
|
||||||
isFocused: focusStates["_time${index}Focused"] ?? false,
|
isFocused: focusStates["_time${index}Focused"] ?? false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.1 : null,
|
width:
|
||||||
|
isDesktop
|
||||||
|
? MediaQuery.of(context).size.width * 0.1
|
||||||
|
: null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
focusNodes["_time${index}FocusNode"]?.requestFocus();
|
focusNodes["_time${index}FocusNode"]
|
||||||
textControllers["_time${index}Controller"]?.text = "";
|
?.requestFocus();
|
||||||
|
textControllers["_time${index}Controller"]?.text =
|
||||||
|
"";
|
||||||
_clearError("time_$index");
|
_clearError("time_$index");
|
||||||
// validateTimeDifference(index);
|
// validateTimeDifference(index);
|
||||||
// _selectCheckOutTime(context);
|
// _selectCheckOutTime(context);
|
||||||
@ -3357,15 +3481,22 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: focusNodes["_time${index}FocusNode"],
|
focusNode: focusNodes["_time${index}FocusNode"],
|
||||||
// controller: _timeController,
|
// controller: _timeController,
|
||||||
controller: textControllers["_time${index}Controller"],
|
controller:
|
||||||
|
textControllers["_time${index}Controller"],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "Time",
|
labelText: "Time",
|
||||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
labelStyle: TextStyle(
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
floatingLabelBehavior:
|
||||||
|
FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
suffixIcon: Icon(
|
suffixIcon: Icon(
|
||||||
Icons.access_time,
|
Icons.access_time,
|
||||||
size: 16,
|
size: 16,
|
||||||
@ -3407,7 +3538,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
width: double.infinity, // ensure full width
|
width: double.infinity, // ensure full width
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
minimumSize: const Size.fromHeight(48), // set height
|
minimumSize: const Size.fromHeight(
|
||||||
|
48,
|
||||||
|
), // set height
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -3471,61 +3604,7 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// "Visa Required",
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 12,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// color: Color(0xFF575A74),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 5),
|
|
||||||
// CustomTextFieldItnerarySubWrapper(
|
|
||||||
// // isFocused: _tripTypeFocused,
|
|
||||||
// isFocused: focusStates["_visa1Focused"] ?? false,
|
|
||||||
// isDesktop: isDesktop,
|
|
||||||
// // width: isDesktop
|
|
||||||
// // ? MediaQuery.of(context).size.width * 0.34
|
|
||||||
// // : MediaQuery.of(context).size.width * 0.66,
|
|
||||||
// child: SizedBox(
|
|
||||||
// height: 40,
|
|
||||||
// child: DropdownButtonFormField<String>(
|
|
||||||
// // focusNode: _tripTypeFocusNode, // Assign the correct focus node
|
|
||||||
// focusNode: focusNodes["_visa1FocusNode"],
|
|
||||||
// value: selectedvisa_available,
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// decoration: InputDecoration(
|
|
||||||
// border: InputBorder.none,
|
|
||||||
// contentPadding: EdgeInsets.symmetric(
|
|
||||||
// horizontal: 10,
|
|
||||||
// ), // Proper padding
|
|
||||||
// ),
|
|
||||||
// onChanged:
|
|
||||||
// visa_available.isNotEmpty
|
|
||||||
// ? (newValue) {
|
|
||||||
// setState(() {
|
|
||||||
// selectedvisa_available = newValue;
|
|
||||||
// // selectedTripType = "Oneway";
|
|
||||||
// // Reset `multiTripRowCount` when switching away from Multitrip
|
|
||||||
// });
|
|
||||||
// print(
|
|
||||||
// "Updating form data: Flight -> trip_type -> $selectedvisa_available",
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// // _initializeRows();
|
|
||||||
// }
|
|
||||||
// : null,
|
|
||||||
//
|
|
||||||
// items: dropdownItems,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
//********//
|
|
||||||
return isDesktop
|
return isDesktop
|
||||||
? [
|
? [
|
||||||
Column(
|
Column(
|
||||||
@ -3565,14 +3644,17 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
child: DropdownSearch<Map<String, dynamic>>(
|
child: DropdownSearch<Map<String, dynamic>>(
|
||||||
items: visa_available.cast<Map<String, dynamic>>(),
|
items: visa_available.cast<Map<String, dynamic>>(),
|
||||||
selectedItem: visa_available.firstWhere(
|
selectedItem: visa_available.firstWhere(
|
||||||
(item) => item['dropdown_key'] == selectedvisa_available,
|
(item) =>
|
||||||
|
item['dropdown_key'] == selectedvisa_available,
|
||||||
orElse: () => {},
|
orElse: () => {},
|
||||||
),
|
),
|
||||||
itemAsString: (item) => item['dropdown_value'] ?? '',
|
itemAsString: (item) => item['dropdown_value'] ?? '',
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: false,
|
showSearchBox: false,
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
menuProps: const MenuProps(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (context, item, isSelected) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
@ -3614,7 +3696,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: layoutColor, width: 1),
|
borderSide: BorderSide(
|
||||||
|
color: layoutColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -3646,7 +3731,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
selectedvisa_available =
|
selectedvisa_available =
|
||||||
newValue?['dropdown_key'];
|
newValue?['dropdown_key'];
|
||||||
print("Selected Visa: $selectedvisa_available");
|
print(
|
||||||
|
"Selected Visa: $selectedvisa_available",
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
@ -3674,7 +3761,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
CustomTextFieldItnerarySubWrapper(
|
CustomTextFieldItnerarySubWrapper(
|
||||||
isFocused: focusStates["_comments1Focused"] ?? false,
|
isFocused: focusStates["_comments1Focused"] ?? false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.32 : null,
|
width:
|
||||||
|
isDesktop ? MediaQuery.of(context).size.width * 0.32 : null,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: focusNodes["_comments1FocusNode"],
|
focusNode: focusNodes["_comments1FocusNode"],
|
||||||
// controller: _commentsController,
|
// controller: _commentsController,
|
||||||
@ -3709,7 +3797,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
elevation: 1,
|
elevation: 1,
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||||
color: const Color(0xFFF5F5F5), // Light grey
|
color: const Color(0xFFF5F5F5), // Light grey
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -3750,16 +3840,22 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
focusNodes["_visa1FocusNode"]?.requestFocus();
|
focusNodes["_visa1FocusNode"]?.requestFocus();
|
||||||
},
|
},
|
||||||
child: DropdownSearch<Map<String, dynamic>>(
|
child: DropdownSearch<Map<String, dynamic>>(
|
||||||
items: visa_available.cast<Map<String, dynamic>>(),
|
items:
|
||||||
|
visa_available.cast<Map<String, dynamic>>(),
|
||||||
selectedItem: visa_available.firstWhere(
|
selectedItem: visa_available.firstWhere(
|
||||||
(item) => item['dropdown_key'] == selectedvisa_available,
|
(item) =>
|
||||||
|
item['dropdown_key'] ==
|
||||||
|
selectedvisa_available,
|
||||||
orElse: () => {},
|
orElse: () => {},
|
||||||
),
|
),
|
||||||
itemAsString: (item) => item['dropdown_value'] ?? '',
|
itemAsString:
|
||||||
|
(item) => item['dropdown_value'] ?? '',
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: false,
|
showSearchBox: false,
|
||||||
fit: FlexFit.loose,
|
fit: FlexFit.loose,
|
||||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
menuProps: const MenuProps(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
itemBuilder: (context, item, isSelected) {
|
itemBuilder: (context, item, isSelected) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
@ -3783,7 +3879,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_visa1Focused"] ?? false)
|
(focusStates["_visa1Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor!
|
? layoutColor!
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
@ -3792,7 +3889,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(focusStates["_visa1Focused"] ?? false)
|
(focusStates["_visa1Focused"] ??
|
||||||
|
false)
|
||||||
? layoutColor
|
? layoutColor
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
// : const Color(0xFFD6D5E6),
|
// : const Color(0xFFD6D5E6),
|
||||||
@ -3801,7 +3899,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: layoutColor, width: 1),
|
borderSide: BorderSide(
|
||||||
|
color: layoutColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
@ -3810,7 +3911,8 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (context, selectedItem) {
|
||||||
if (selectedItem == null || selectedItem.isEmpty) {
|
if (selectedItem == null ||
|
||||||
|
selectedItem.isEmpty) {
|
||||||
return Text(
|
return Text(
|
||||||
"Select Option",
|
"Select Option",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
@ -3833,7 +3935,9 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
selectedvisa_available =
|
selectedvisa_available =
|
||||||
newValue?['dropdown_key'];
|
newValue?['dropdown_key'];
|
||||||
print("Selected Visa: $selectedvisa_available");
|
print(
|
||||||
|
"Selected Visa: $selectedvisa_available",
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
@ -3861,7 +3965,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
CustomTextFieldItnerarySubWrapper(
|
CustomTextFieldItnerarySubWrapper(
|
||||||
isFocused: focusStates["_comments1Focused"] ?? false,
|
isFocused: focusStates["_comments1Focused"] ?? false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.32 : null,
|
width:
|
||||||
|
isDesktop
|
||||||
|
? MediaQuery.of(context).size.width * 0.32
|
||||||
|
: null,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: focusNodes["_comments1FocusNode"],
|
focusNode: focusNodes["_comments1FocusNode"],
|
||||||
// controller: _commentsController,
|
// controller: _commentsController,
|
||||||
@ -3871,7 +3978,10 @@ class FlightScreenState extends State<FlightScreen> {
|
|||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Comments",
|
labelText: "Comments",
|
||||||
labelStyle: TextStyle(fontSize: 12, color: Colors.grey),
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
// contentPadding: EdgeInsets.symmetric(vertical: 1),
|
// contentPadding: EdgeInsets.symmetric(vertical: 1),
|
||||||
|
|||||||
@ -2,11 +2,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class AccomodationListWidget extends StatelessWidget {
|
import '../../utils/auth_utils.dart';
|
||||||
|
|
||||||
|
class AccomodationListWidget extends StatefulWidget {
|
||||||
final List<Map<String, dynamic>> accommodationList;
|
final List<Map<String, dynamic>> accommodationList;
|
||||||
final Function(bool, Map<String, dynamic>, String) onOpen;
|
final Function(bool, Map<String, dynamic>, String) onOpen;
|
||||||
final Function(Map<String, dynamic>) onDeleteAccommodation;
|
final Function(Map<String, dynamic>) onDeleteAccommodation;
|
||||||
|
|
||||||
final Function(String, bool) onAddNew;
|
final Function(String, bool) onAddNew;
|
||||||
final bool isViewMode;
|
final bool isViewMode;
|
||||||
|
|
||||||
@ -19,12 +20,57 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
required this.isViewMode,
|
required this.isViewMode,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AccomodationListWidget> createState() => _AccomodationListWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||||
|
Color? layoutColor;
|
||||||
|
Color? secondColor;
|
||||||
|
Color? thridColor;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
loadInitialData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadInitialData() async {
|
||||||
|
String? layoutString = await getLayoutColor();
|
||||||
|
String? secondString = await getSecondaryColor();
|
||||||
|
String? thridString = await getTernaryColor();
|
||||||
|
|
||||||
|
// String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
secondColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(secondString!))
|
||||||
|
: Colors.orange;
|
||||||
|
|
||||||
|
thridColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(thridString!))
|
||||||
|
: Colors.orangeAccent;
|
||||||
|
// bodyColor =
|
||||||
|
// bodyStringColor != null
|
||||||
|
// ? Color(int.parse(bodyStringColor))
|
||||||
|
// : Colors.white;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding:
|
||||||
|
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0),
|
margin: const EdgeInsets.only(top: 16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -34,7 +80,7 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
if ((!isDesktop) && accommodationList.isNotEmpty)
|
if ((!isDesktop) && widget.accommodationList.isNotEmpty)
|
||||||
Text(
|
Text(
|
||||||
" ",
|
" ",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@ -44,16 +90,18 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
|
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor: isViewMode
|
cursor:
|
||||||
|
widget.isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: isViewMode
|
onTap:
|
||||||
|
widget.isViewMode
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
print("New data");
|
print("New data");
|
||||||
onAddNew("Accomodation", true);
|
widget.onAddNew("Accomodation", true);
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize:
|
mainAxisSize:
|
||||||
@ -68,7 +116,7 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
Icons.add_circle_sharp,
|
Icons.add_circle_sharp,
|
||||||
size: 30,
|
size: 30,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
)
|
),
|
||||||
// Container(
|
// Container(
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// shape: BoxShape.circle,
|
// shape: BoxShape.circle,
|
||||||
@ -147,9 +195,9 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// Scroll behavior based on device
|
|
||||||
|
|
||||||
_buildData(context, isDesktop)
|
// Scroll behavior based on device
|
||||||
|
_buildData(context, isDesktop),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -158,7 +206,9 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildData(BuildContext context, bool isDesktop) {
|
Widget _buildData(BuildContext context, bool isDesktop) {
|
||||||
List<Map<String, dynamic>> filteredList =
|
List<Map<String, dynamic>> filteredList =
|
||||||
accommodationList.where((item) => item["is_active"] == "1").toList();
|
widget.accommodationList
|
||||||
|
.where((item) => item["is_active"] == "1")
|
||||||
|
.toList();
|
||||||
print("filteredList- $filteredList");
|
print("filteredList- $filteredList");
|
||||||
|
|
||||||
// String formatDate(String dateString) {
|
// String formatDate(String dateString) {
|
||||||
@ -191,8 +241,11 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
|
|
||||||
if (hour == 24 && minute == 0) {
|
if (hour == 24 && minute == 0) {
|
||||||
// 24:00 is treated as 00:00 on the next day
|
// 24:00 is treated as 00:00 on the next day
|
||||||
dateTime = DateTime(now.year, now.month, now.day)
|
dateTime = DateTime(
|
||||||
.add(const Duration(days: 1));
|
now.year,
|
||||||
|
now.month,
|
||||||
|
now.day,
|
||||||
|
).add(const Duration(days: 1));
|
||||||
} else {
|
} else {
|
||||||
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
||||||
throw FormatException("Invalid hour or minute");
|
throw FormatException("Invalid hour or minute");
|
||||||
@ -235,14 +288,18 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
// color: Colors.orange.shade50,
|
// color: Colors.orange.shade50,
|
||||||
color: Colors.white,
|
color: isDesktop ? Colors.white : thridColor,
|
||||||
boxShadow: [
|
// color: Colors.white,
|
||||||
|
boxShadow:
|
||||||
|
isDesktop
|
||||||
|
? [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
blurRadius: 3,
|
blurRadius: 3,
|
||||||
offset: Offset(0, 1),
|
offset: Offset(0, 1),
|
||||||
),
|
),
|
||||||
],
|
]
|
||||||
|
: [],
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
color: Colors.white70, // Change color to match your theme
|
color: Colors.white70, // Change color to match your theme
|
||||||
@ -251,7 +308,7 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -262,25 +319,27 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
item["hotel_name"]!,
|
item["hotel_name"]!,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight:
|
||||||
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74),)
|
isDesktop ? FontWeight.w800 : FontWeight.w500,
|
||||||
|
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Accomodation"),
|
onTap: () => widget.onOpen(true, item, "Accomodation"),
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'Edit Accomodation Details',
|
message: 'Edit Accomodation Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15,
|
height: 15,
|
||||||
color: Color(0xFF114D8B),
|
color: isDesktop ? Color(0xFF114D8B) : Colors.black87,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteAccommodation(item),
|
onTap: () => widget.onDeleteAccommodation(item),
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'Delete Accommodation Details',
|
message: 'Delete Accommodation Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -293,9 +352,7 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(
|
// Divider(color: Colors.blueGrey.shade50),
|
||||||
color: Colors.blueGrey.shade50,
|
|
||||||
),
|
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
@ -304,34 +361,30 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" DestinationCity",
|
" DestinationCity",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Check (in) ",
|
" Check (in) ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Check (out) ",
|
" Check (out) ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Comments",
|
" Comments",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
@ -374,87 +427,99 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: _buildComments(
|
child: _buildComments(
|
||||||
"Comments:", item["comments"] ?? "N/A"),
|
"Comments:",
|
||||||
|
item["comments"] ?? "N/A",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Column(
|
: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
_buildRow(
|
||||||
spacing: 20, // horizontal space between items
|
"Destination City",
|
||||||
runSpacing: 10, // vertical space between rows
|
item["destination_city"],
|
||||||
children: [
|
),
|
||||||
_buildInfoColumn("City", item["destination_city"]),
|
SizedBox(height: 5),
|
||||||
_buildInfoColumn("Check (In)", "${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}"),
|
_buildDateTimeRow(
|
||||||
_buildInfoColumn("Check (Out)", "${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}"),
|
"Check (in)",
|
||||||
// City - long name handled with flexible space
|
formatDate(item["checkin_date"]!),
|
||||||
// Expanded(
|
formatTime(item["checkin_time"]!),
|
||||||
// flex: 3,
|
),
|
||||||
// child: _buildInfoColumn("City", item["destination_city"]),
|
SizedBox(height: 5),
|
||||||
// ),
|
_buildDateTimeRow(
|
||||||
|
"Check (out)",
|
||||||
// SizedBox(width: 8),
|
formatDate(item["checkout_date"]!),
|
||||||
|
formatTime(item["checkout_time"]!),
|
||||||
// Check In and Check Out stacked right side
|
),
|
||||||
// Expanded(
|
SizedBox(height: 5),
|
||||||
// flex: 4,
|
_buildRow("Comments:", item["comments"] ?? "N/A"),
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
// children: [
|
|
||||||
// _buildInfoColumn(
|
|
||||||
// "Check In",
|
|
||||||
// "${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}",
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 6),
|
|
||||||
// _buildInfoColumn(
|
|
||||||
// "Check Out",
|
|
||||||
// "${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}",
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
|
||||||
const Text(
|
|
||||||
"Comment",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w500),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
|
||||||
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Color(0xFF7098DD), width: 1),
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
item["comments"],
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
const Text( "N/A", style: TextStyle(fontSize: 12), ),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
// Column(
|
// Column(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// children: [
|
// children: [
|
||||||
// _buildRow("City:", item["destination_city"]),
|
// Wrap(
|
||||||
// SizedBox(width: 10),
|
// spacing: 20, // horizontal space between items
|
||||||
// SizedBox(width: 10),
|
// runSpacing: 10, // vertical space between rows
|
||||||
// _buildDateTimeRow(
|
// children: [
|
||||||
// "Check-in:",
|
// _buildInfoColumn("City", item["destination_city"]),
|
||||||
// formatDate(item["checkin_date"]!),
|
// _buildInfoColumn("Check (In)", "${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}"),
|
||||||
// item["checkin_time"]!,
|
// _buildInfoColumn("Check (Out)", "${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}"),
|
||||||
|
// // City - long name handled with flexible space
|
||||||
|
// // Expanded(
|
||||||
|
// // flex: 3,
|
||||||
|
// // child: _buildInfoColumn("City", item["destination_city"]),
|
||||||
|
// // ),
|
||||||
|
//
|
||||||
|
// // SizedBox(width: 8),
|
||||||
|
//
|
||||||
|
// // Check In and Check Out stacked right side
|
||||||
|
// // Expanded(
|
||||||
|
// // flex: 4,
|
||||||
|
// // child: Column(
|
||||||
|
// // crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
// // children: [
|
||||||
|
// // _buildInfoColumn(
|
||||||
|
// // "Check In",
|
||||||
|
// // "${formatDate(item["checkin_date"]!)} ${formatTime(item["checkin_time"]!)}",
|
||||||
|
// // ),
|
||||||
|
// // SizedBox(height: 6),
|
||||||
|
// // _buildInfoColumn(
|
||||||
|
// // "Check Out",
|
||||||
|
// // "${formatDate(item["checkout_date"]!)} ${formatTime(item["checkout_time"]!)}",
|
||||||
|
// // ),
|
||||||
|
// // ],
|
||||||
|
// // ),
|
||||||
|
// // ),
|
||||||
|
// ],
|
||||||
// ),
|
// ),
|
||||||
// SizedBox(width: 10),
|
// const SizedBox(height: 10),
|
||||||
// _buildRow(
|
// const Text(
|
||||||
// "Date(out):", formatDate(item["checkout_date"]!)),
|
// "Comment",
|
||||||
// SizedBox(width: 10),
|
// style: TextStyle(fontWeight: FontWeight.w500),
|
||||||
// _buildRow("Comments:", item["comments"] ?? "N/A"),
|
// ),
|
||||||
|
// const SizedBox(height: 5),
|
||||||
|
// if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
|
||||||
|
// Container(
|
||||||
|
// width: double.infinity,
|
||||||
|
// padding: const EdgeInsets.all(8),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// border: Border.all(color: Color(0xFF7098DD), width: 1),
|
||||||
|
// borderRadius: BorderRadius.circular(6),
|
||||||
|
// ),
|
||||||
|
// child: Text(
|
||||||
|
// item["comments"],
|
||||||
|
// style: const TextStyle(fontSize: 12),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// else
|
||||||
|
// const Text( "N/A", style: TextStyle(fontSize: 12), ),
|
||||||
// ],
|
// ],
|
||||||
// )
|
// )
|
||||||
],
|
],
|
||||||
@ -485,23 +550,27 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: exceedsLimit
|
child:
|
||||||
|
exceedsLimit
|
||||||
? Tooltip(
|
? Tooltip(
|
||||||
message: wrapText(value, 50),
|
message: wrapText(value, 50),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade200, // Black background
|
color: Colors.grey.shade200, // Black background
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
textStyle:
|
textStyle: TextStyle(
|
||||||
TextStyle(color: Colors.black), // Tooltip text color
|
color: Colors.black,
|
||||||
|
), // Tooltip text color
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
preferBelow: false,
|
preferBelow: false,
|
||||||
child: Text(value.substring(0, limit) + "...",
|
child: Text(
|
||||||
|
value.substring(0, limit) + "...",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis),
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
@ -531,87 +600,92 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget _buildRow(String title, String value) {
|
Widget _buildRow(String title, String value) {
|
||||||
// // Define character limits based on title
|
// Define character limits based on title
|
||||||
// Map<String, int> limits = {
|
Map<String, int> limits = {
|
||||||
// // "Special Request:": 30,
|
// "Special Request:": 30,
|
||||||
// "Comments:": 10,
|
"Comments:": 10,
|
||||||
// // Add more keys and limits if needed
|
// Add more keys and limits if needed
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// int limit = limits[title] ?? 50; // Default limit if title not found
|
int limit = limits[title] ?? 50; // Default limit if title not found
|
||||||
// bool exceedsLimit = value.length > limit;
|
bool exceedsLimit = value.length > limit;
|
||||||
//
|
|
||||||
// String wrapText(String text, int maxLineLength) {
|
String wrapText(String text, int maxLineLength) {
|
||||||
// final pattern = RegExp('.{1,$maxLineLength}(\\s+|\$)');
|
final pattern = RegExp('.{1,$maxLineLength}(\\s+|\$)');
|
||||||
// return pattern.allMatches(text).map((m) => m.group(0)!).join('\n');
|
return pattern.allMatches(text).map((m) => m.group(0)!).join('\n');
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return Row(
|
return Row(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// children: [
|
|
||||||
// Text(
|
children: [
|
||||||
// title,
|
SizedBox(
|
||||||
// style: GoogleFonts.poppins(
|
// color: Colors.yellowAccent.shade100,
|
||||||
// fontSize: 12,
|
width: 100,
|
||||||
// ),
|
child: Expanded(
|
||||||
// ),
|
child: Text(
|
||||||
// SizedBox(width: 8),
|
title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Expanded(child: Text(value, style: TextStyle(fontSize: 12))),
|
||||||
// Expanded(
|
// Expanded(
|
||||||
// child: exceedsLimit
|
// child:
|
||||||
|
// exceedsLimit
|
||||||
// ? Tooltip(
|
// ? Tooltip(
|
||||||
// message: wrapText(value, 50),
|
// message: wrapText(value, 50),
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// color: Colors.grey.shade200, // Black background
|
// color: Colors.grey.shade200, // Black background
|
||||||
// borderRadius: BorderRadius.circular(6),
|
// borderRadius: BorderRadius.circular(6),
|
||||||
// ),
|
// ),
|
||||||
// textStyle:
|
// textStyle: TextStyle(
|
||||||
// TextStyle(color: Colors.black), // Tooltip text color
|
// color: Colors.black,
|
||||||
|
// ), // Tooltip text color
|
||||||
// padding: EdgeInsets.all(8),
|
// padding: EdgeInsets.all(8),
|
||||||
// preferBelow: false,
|
// preferBelow: false,
|
||||||
// child: Text(value.substring(0, limit) + "...",
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// overflow: TextOverflow.ellipsis),
|
|
||||||
// )
|
|
||||||
// : Text(
|
|
||||||
// value,
|
|
||||||
// style: TextStyle(fontSize: 12),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Widget _buildDateTimeRow(String title, String date, String time) {
|
|
||||||
// return Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// title,
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 12,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 8),
|
|
||||||
// Expanded(
|
|
||||||
// child: Text(
|
// child: Text(
|
||||||
// "$date, $time",
|
// value.substring(0, limit) + "...",
|
||||||
// style: GoogleFonts.poppins(
|
// style: TextStyle(fontSize: 12),
|
||||||
// fontSize: 12,
|
// overflow: TextOverflow.ellipsis,
|
||||||
// ),
|
// ),
|
||||||
|
// )
|
||||||
|
// : Text(value, style: TextStyle(fontSize: 12)),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
],
|
||||||
// ],
|
);
|
||||||
// );
|
}
|
||||||
// }
|
|
||||||
|
Widget _buildDateTimeRow(String title, String date, String time) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Expanded(
|
||||||
|
child: Text("$date, $time", style: GoogleFonts.poppins(fontSize: 12)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import '../../services/apiService.dart';
|
import '../../services/apiService.dart';
|
||||||
|
import '../../utils/auth_utils.dart';
|
||||||
|
|
||||||
class FlightListWidget extends StatefulWidget {
|
class FlightListWidget extends StatefulWidget {
|
||||||
final bool hasAction;
|
final bool hasAction;
|
||||||
@ -32,6 +33,9 @@ class FlightListWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _FlightListWidgetState extends State<FlightListWidget> {
|
class _FlightListWidgetState extends State<FlightListWidget> {
|
||||||
ApiService apiService = ApiService();
|
ApiService apiService = ApiService();
|
||||||
|
Color? layoutColor;
|
||||||
|
Color? secondColor;
|
||||||
|
Color? thridColor;
|
||||||
|
|
||||||
// late Map<String, String> countryMap;
|
// late Map<String, String> countryMap;
|
||||||
Map<String, String> countryMap = {};
|
Map<String, String> countryMap = {};
|
||||||
@ -40,6 +44,36 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
loadCountryList(); // Call your method here
|
loadCountryList(); // Call your method here
|
||||||
|
loadInitialData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadInitialData() async {
|
||||||
|
String? layoutString = await getLayoutColor();
|
||||||
|
String? secondString = await getSecondaryColor();
|
||||||
|
String? thridString = await getTernaryColor();
|
||||||
|
|
||||||
|
// String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
secondColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(secondString!))
|
||||||
|
: Colors.orange;
|
||||||
|
|
||||||
|
thridColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(thridString!))
|
||||||
|
: Colors.orangeAccent;
|
||||||
|
// bodyColor =
|
||||||
|
// bodyStringColor != null
|
||||||
|
// ? Color(int.parse(bodyStringColor))
|
||||||
|
// : Colors.white;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadCountryList() async {
|
Future<void> loadCountryList() async {
|
||||||
@ -169,7 +203,8 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding:
|
||||||
|
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0),
|
margin: const EdgeInsets.only(top: 16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -192,11 +227,13 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
// Right side: either "Add" icon or nothing
|
// Right side: either "Add" icon or nothing
|
||||||
if (widget.flightList.isNotEmpty)
|
if (widget.flightList.isNotEmpty)
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor: widget.isViewMode
|
cursor:
|
||||||
|
widget.isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: widget.isViewMode
|
onTap:
|
||||||
|
widget.isViewMode
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
widget.onAddNew("Flight", true);
|
widget.onAddNew("Flight", true);
|
||||||
@ -223,8 +260,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
@ -235,7 +271,6 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildData(BuildContext context, bool isDesktop) {
|
Widget _buildData(BuildContext context, bool isDesktop) {
|
||||||
@ -347,10 +382,13 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
// color: isDesktop ? Colors.white : Color(0xFFFFF0F5),
|
||||||
|
color: isDesktop ? Colors.white : thridColor,
|
||||||
// color: Colors.orange.shade50,
|
// color: Colors.orange.shade50,
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
|
boxShadow:
|
||||||
boxShadow: [
|
isDesktop
|
||||||
|
? [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
blurRadius: 2,
|
blurRadius: 2,
|
||||||
@ -362,7 +400,8 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
blurRadius: 0.5,
|
blurRadius: 0.5,
|
||||||
offset: Offset(0, -1), // up
|
offset: Offset(0, -1), // up
|
||||||
),
|
),
|
||||||
],
|
]
|
||||||
|
: [],
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
color: Colors.white70, // Change color to match your theme
|
color: Colors.white70, // Change color to match your theme
|
||||||
@ -371,18 +410,23 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(5),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
tripTypeName ?? "N/A",
|
tripTypeName ?? "N/A",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight:
|
||||||
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74),
|
isDesktop ? FontWeight.w800 : FontWeight.w500,
|
||||||
|
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||||
|
|
||||||
|
// Color(0xFF114D8B)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
@ -394,7 +438,8 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15,
|
height: 15,
|
||||||
color: Color(0xFF114D8B),
|
color:
|
||||||
|
isDesktop ? Color(0xFF114D8B) : Colors.black87,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -413,7 +458,8 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(color: Colors.blueGrey.shade50),
|
),
|
||||||
|
// Divider(color: Colors.blueGrey.shade50),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
Row(
|
Row(
|
||||||
@ -600,7 +646,6 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
item["trips"] != null &&
|
item["trips"] != null &&
|
||||||
item["trips"].isNotEmpty)
|
item["trips"].isNotEmpty)
|
||||||
...item["trips"].map<Widget>((trip) {
|
...item["trips"].map<Widget>((trip) {
|
||||||
|
|
||||||
String fromPlaceCountry =
|
String fromPlaceCountry =
|
||||||
countryMap[trip["from_place"]?.toString()] ??
|
countryMap[trip["from_place"]?.toString()] ??
|
||||||
"Unknown Country";
|
"Unknown Country";
|
||||||
@ -631,41 +676,44 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
final tocity = tocityMatch?.group(1) ?? '';
|
final tocity = tocityMatch?.group(1) ?? '';
|
||||||
final tocode = tocityMatch?.group(2) ?? '';
|
final tocode = tocityMatch?.group(2) ?? '';
|
||||||
|
|
||||||
// return Padding(
|
return Padding(
|
||||||
// padding: const EdgeInsets.symmetric(vertical: 6.0),
|
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
// child: Container(
|
child: Container(
|
||||||
// decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// border: Border.all(color: Colors.grey.shade300),
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
// borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
// color: Colors.grey.shade50,
|
color: Colors.grey.shade50,
|
||||||
// ),
|
),
|
||||||
// padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
// child: Column(
|
child: Column(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// children: [
|
children: [
|
||||||
// _buildKeyValueRow(
|
_buildKeyValueRow(
|
||||||
// "Class",
|
"Class",
|
||||||
// getRequestForClass(trip["class"].toString()) ??
|
getRequestForClass(trip["class"].toString()) ??
|
||||||
// "N/A",
|
"N/A",
|
||||||
// ),
|
),
|
||||||
// _buildKeyValueRow(
|
_buildKeyValueRow(
|
||||||
// "Sector",
|
"From",
|
||||||
// "$fromcity ($fromcode), $fromairport → $tocity ($tocode), $toairport",
|
"$fromcity ($fromcode), $fromairport ",
|
||||||
// ),
|
),
|
||||||
//
|
_buildKeyValueRow(
|
||||||
// _buildKeyValueRow(
|
"To",
|
||||||
// "Date",
|
"$tocity ($tocode), $toairport",
|
||||||
// formatDate(trip["date"] ?? ""),
|
),
|
||||||
// ),
|
|
||||||
// _buildKeyValueRow(
|
|
||||||
// "Time",
|
|
||||||
// formatTime(trip["time"] ?? ""),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
_buildKeyValueRow(
|
||||||
|
"Date",
|
||||||
|
formatDate(trip["date"] ?? ""),
|
||||||
|
),
|
||||||
|
_buildKeyValueRow(
|
||||||
|
"Time",
|
||||||
|
formatTime(trip["time"] ?? ""),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// return Padding(
|
// return Padding(
|
||||||
// padding: const EdgeInsets.symmetric(vertical: 6.0),
|
// padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
@ -701,9 +749,13 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// const Padding(
|
// const Padding(
|
||||||
// padding: EdgeInsets.symmetric(horizontal: 6),
|
// padding: EdgeInsets.symmetric(
|
||||||
|
// horizontal: 6,
|
||||||
|
// ),
|
||||||
// child: Image(
|
// child: Image(
|
||||||
// image: AssetImage('assets/images/IconsImg/Frame.png'),
|
// image: AssetImage(
|
||||||
|
// 'assets/images/IconsImg/Frame.png',
|
||||||
|
// ),
|
||||||
// width: 18,
|
// width: 18,
|
||||||
// height: 18,
|
// height: 18,
|
||||||
// ),
|
// ),
|
||||||
@ -738,68 +790,67 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
|
|
||||||
return Padding(
|
// return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
// padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
child: Container(
|
// child: Container(
|
||||||
child: Column(
|
// child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
// children: [
|
||||||
Wrap(
|
// Wrap(
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
// crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
spacing: 4,
|
// spacing: 4,
|
||||||
runSpacing: 4,
|
// runSpacing: 4,
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
'${getRequestForClass(trip["class"].toString()) ?? "N/A"} (',
|
// '${getRequestForClass(trip["class"].toString()) ?? "N/A"} (',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
fontSize: 14,
|
// fontSize: 14,
|
||||||
color: Colors.black87,
|
// color: Colors.black87,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
fromcode,
|
// fromcode,
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
fontSize: 14,
|
// fontSize: 14,
|
||||||
color: Colors.black87,
|
// color: Colors.black87,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const Padding(
|
// const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
// padding: EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: Image(
|
// child: Image(
|
||||||
image: AssetImage('assets/images/IconsImg/Frame.png'),
|
// image: AssetImage('assets/images/IconsImg/Frame.png'),
|
||||||
width: 18,
|
// width: 18,
|
||||||
height: 18,
|
// height: 18,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
'$tocode)',
|
// '$tocode)',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
fontSize: 14,
|
// fontSize: 14,
|
||||||
color: Colors.black87,
|
// color: Colors.black87,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 6),
|
// const SizedBox(height: 6),
|
||||||
Align(
|
// Align(
|
||||||
alignment: Alignment.centerRight,
|
// alignment: Alignment.centerRight,
|
||||||
child: Text(
|
// child: Text(
|
||||||
'${formatDate(trip["date"] ?? "")} ${formatTime(trip["time"] ?? "")}',
|
// '${formatDate(trip["date"] ?? "")} ${formatTime(trip["time"] ?? "")}',
|
||||||
textAlign: TextAlign.right,
|
// textAlign: TextAlign.right,
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontSize: 13,
|
// fontSize: 13,
|
||||||
color: Colors.black87,
|
// color: Colors.black87,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
|
|
||||||
}).toList(),
|
}).toList(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -816,12 +867,12 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 80, // adjust width as needed
|
width: 70, // adjust width as needed
|
||||||
child: Text(
|
child: Text(
|
||||||
"$key:",
|
"$key",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -5,8 +5,9 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import '../../services/apiService.dart';
|
import '../../services/apiService.dart';
|
||||||
|
import '../../utils/auth_utils.dart';
|
||||||
|
|
||||||
class ForexListWidget extends StatelessWidget {
|
class ForexListWidget extends StatefulWidget {
|
||||||
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;
|
||||||
@ -16,15 +17,60 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
final Function(String, bool) onAddNew;
|
final Function(String, bool) onAddNew;
|
||||||
final bool isViewMode;
|
final bool isViewMode;
|
||||||
|
|
||||||
const ForexListWidget(
|
const ForexListWidget({
|
||||||
{super.key,
|
super.key,
|
||||||
required this.forexList,
|
required this.forexList,
|
||||||
required this.onOpen,
|
required this.onOpen,
|
||||||
required this.onDeleteForex,
|
required this.onDeleteForex,
|
||||||
required this.apiCountryData,
|
required this.apiCountryData,
|
||||||
required this.onAddNew,
|
required this.onAddNew,
|
||||||
required this.apiData,
|
required this.apiData,
|
||||||
required this.isViewMode});
|
required this.isViewMode,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ForexListWidget> createState() => _ForexListWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ForexListWidgetState extends State<ForexListWidget> {
|
||||||
|
Color? layoutColor;
|
||||||
|
Color? secondColor;
|
||||||
|
Color? thridColor;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
loadInitialData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadInitialData() async {
|
||||||
|
String? layoutString = await getLayoutColor();
|
||||||
|
String? secondString = await getSecondaryColor();
|
||||||
|
String? thridString = await getTernaryColor();
|
||||||
|
|
||||||
|
// String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
secondColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(secondString!))
|
||||||
|
: Colors.orange;
|
||||||
|
|
||||||
|
thridColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(thridString!))
|
||||||
|
: Colors.orangeAccent;
|
||||||
|
// bodyColor =
|
||||||
|
// bodyStringColor != null
|
||||||
|
// ? Color(int.parse(bodyStringColor))
|
||||||
|
// : Colors.white;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -32,7 +78,8 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding:
|
||||||
|
isDesktop ? const EdgeInsets.all(16.0) : const EdgeInsets.all(5.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0),
|
margin: const EdgeInsets.only(top: 16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -135,26 +182,23 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// Scroll behavior based on device
|
|
||||||
|
|
||||||
_buildData(context, isDesktop)
|
// Scroll behavior based on device
|
||||||
|
_buildData(context, isDesktop),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildData(
|
Widget _buildData(BuildContext context, bool isDesktop) {
|
||||||
BuildContext context,
|
|
||||||
bool isDesktop,
|
|
||||||
) {
|
|
||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
List<Map<String, dynamic>> filteredList =
|
List<Map<String, dynamic>> filteredList =
|
||||||
forexList.where((item) => item["is_active"] == "1").toList();
|
widget.forexList.where((item) => item["is_active"] == "1").toList();
|
||||||
print("filteredList- $filteredList");
|
print("filteredList- $filteredList");
|
||||||
|
|
||||||
List<dynamic> visatypeList = apiData?['visa_type_of_visa'] ?? [];
|
List<dynamic> visatypeList = widget.apiData?['visa_type_of_visa'] ?? [];
|
||||||
List<dynamic> countryList = apiCountryData ?? [];
|
List<dynamic> countryList = widget.apiCountryData ?? [];
|
||||||
|
|
||||||
String getRequestForVisa(String? specialRequestKey) {
|
String getRequestForVisa(String? specialRequestKey) {
|
||||||
if (specialRequestKey == null) return "N/A";
|
if (specialRequestKey == null) return "N/A";
|
||||||
@ -209,8 +253,11 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
|
|
||||||
if (hour == 24 && minute == 0) {
|
if (hour == 24 && minute == 0) {
|
||||||
// 24:00 is treated as 00:00 on the next day
|
// 24:00 is treated as 00:00 on the next day
|
||||||
dateTime = DateTime(now.year, now.month, now.day)
|
dateTime = DateTime(
|
||||||
.add(const Duration(days: 1));
|
now.year,
|
||||||
|
now.month,
|
||||||
|
now.day,
|
||||||
|
).add(const Duration(days: 1));
|
||||||
} else {
|
} else {
|
||||||
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
||||||
throw FormatException("Invalid hour or minute");
|
throw FormatException("Invalid hour or minute");
|
||||||
@ -231,27 +278,34 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = filteredList[index];
|
final item = filteredList[index];
|
||||||
final double transport = double.tryParse(item["transport"] ?? "0") ?? 0;
|
final double transport = double.tryParse(item["transport"] ?? "0") ?? 0;
|
||||||
final double accommodation = double.tryParse(item["accommodation"] ?? "0") ?? 0;
|
final double accommodation =
|
||||||
|
double.tryParse(item["accommodation"] ?? "0") ?? 0;
|
||||||
final double telephone = double.tryParse(item["telephone"] ?? "0") ?? 0;
|
final double telephone = double.tryParse(item["telephone"] ?? "0") ?? 0;
|
||||||
final double perdiemAmount = double.tryParse(item["perdiem_amount"] ?? "0") ?? 0;
|
final double perdiemAmount =
|
||||||
|
double.tryParse(item["perdiem_amount"] ?? "0") ?? 0;
|
||||||
final double calculatedValue = transport + accommodation + telephone;
|
final double calculatedValue = transport + accommodation + telephone;
|
||||||
final String calculatedOtherExpenses = calculatedValue.toStringAsFixed(0);
|
final String calculatedOtherExpenses = calculatedValue.toStringAsFixed(
|
||||||
|
0,
|
||||||
|
);
|
||||||
final double finalTotal = calculatedValue + perdiemAmount;
|
final double finalTotal = calculatedValue + perdiemAmount;
|
||||||
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
// color: Colors.orange.shade50,
|
// color: Colors.orange.shade50,
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
boxShadow: [
|
color: isDesktop ? Colors.white : thridColor,
|
||||||
|
boxShadow:
|
||||||
|
isDesktop
|
||||||
|
? [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
blurRadius: 3,
|
blurRadius: 3,
|
||||||
offset: Offset(0, 1),
|
offset: Offset(0, 1),
|
||||||
),
|
),
|
||||||
],
|
]
|
||||||
|
: [],
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
color: Colors.white70, // Change color to match your theme
|
color: Colors.white70, // Change color to match your theme
|
||||||
@ -260,7 +314,7 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: isDesktop ? EdgeInsets.all(12) : EdgeInsets.all(8),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -271,12 +325,12 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
getRequestForCountry(item["country_code"]!.toString()),
|
getRequestForCountry(item["country_code"]!.toString()),
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Forex"),
|
onTap: () => widget.onOpen(true, item, "Forex"),
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: 'Edit Forex Details',
|
message: 'Edit Forex Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -284,7 +338,7 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
width: 20,
|
width: 20,
|
||||||
height: 15,
|
height: 15,
|
||||||
// color: Color(0xFF114D8B),
|
// color: Color(0xFF114D8B),
|
||||||
color: !isDesktop ? Color(0xFF114D8B) : Color(0xFF575A74)
|
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -303,8 +357,11 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
item['forex_id'] != null
|
item['forex_id'] != null
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: Icon(Icons.download,
|
icon: Icon(
|
||||||
color: Color(0xFF114D8B), size: 18),
|
Icons.download,
|
||||||
|
color: Color(0xFF114D8B),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print("PDF- ${item['forex_id']}");
|
print("PDF- ${item['forex_id']}");
|
||||||
final forexIdString = item['forex_id'];
|
final forexIdString = item['forex_id'];
|
||||||
@ -320,10 +377,8 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
: SizedBox.shrink(), // or Container()
|
: SizedBox.shrink(), // or Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(color: Colors.blueGrey.shade50),
|
||||||
color: Colors.blueGrey.shade50,
|
// SizedBox(height: 4),
|
||||||
),
|
|
||||||
SizedBox(height: 4),
|
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
children: [
|
children: [
|
||||||
@ -331,26 +386,23 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Currency",
|
"Currency",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Duration",
|
" Duration",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Time Period ",
|
" Time Period ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
// Expanded(
|
// Expanded(
|
||||||
// flex: 2,
|
// flex: 2,
|
||||||
// child: Text(
|
// child: Text(
|
||||||
@ -362,50 +414,44 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Perdiem ",
|
" Perdiem ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Others ",
|
" Others ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Total ",
|
" Total ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Cash ",
|
" Cash ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Card ",
|
" Card ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Comments",
|
" Comments",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 11,
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
@ -503,85 +549,113 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: _buildComments(
|
child: _buildComments(
|
||||||
"Comments:", item["comments"] ?? "N/A"),
|
"Comments:",
|
||||||
|
item["comments"] ?? "N/A",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
): Column(
|
)
|
||||||
|
: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Top Row (Country, Currency, Total)
|
_buildRow("Currency", item["currency"]),
|
||||||
Wrap(
|
SizedBox(height: 2),
|
||||||
spacing: 20, // horizontal space between items
|
_buildRow("Duration", item["duration"]),
|
||||||
runSpacing: 10, // vertical space between rows
|
SizedBox(height: 2),
|
||||||
// Row(
|
_buildRow(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
"Time Period",
|
||||||
children: [
|
"${formatDate(item["start_date"]!)} - ${formatDate(item["end_date"]!)}",
|
||||||
_infoBlock("Country code", item["country_code"] ?? "N/A"),
|
// "${item["start_date"]!} - ${item["end_date"]!}",
|
||||||
_infoBlock("Currency", item["currency"] ?? "N/A"),
|
),
|
||||||
_infoBlock("Total Amount", item["total_amount"]?.toString() ?? "0"),
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Perdiem", "$perdiemAmount"),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Others", "$calculatedOtherExpenses"),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Total", "$finalTotal"),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Cash", item["deposit_on_cash"]!),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Card", item["deposit_on_card"]!),
|
||||||
|
SizedBox(height: 2),
|
||||||
|
_buildRow("Comments", item["comments"] ?? "N/A"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
// Second Row (Start Date, End Date, Duration)
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
_infoBlock("Start Date", item["start_date"] ?? "N/A"),
|
|
||||||
_infoBlock("End Date", item["end_date"] ?? "N/A"),
|
|
||||||
_infoBlock("Duration", item["duration"]?.toString() ?? "N/A"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
// child: Column(
|
||||||
|
|
||||||
// Comment label
|
|
||||||
Text(
|
|
||||||
"Comment",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
if (item["comments"] != null && item["comments"].toString().trim().isNotEmpty)
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: const Color(0xFF7098DD), width: 1),
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
item["comments"] ?? "N/A",
|
|
||||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
const Text( "N/A", style: TextStyle(fontSize: 12), ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
// old code
|
|
||||||
// : Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// children: [
|
// children: [
|
||||||
// _buildRow(
|
// // Top Row (Country, Currency, Total)
|
||||||
// "Currency:",
|
// Wrap(
|
||||||
// item["currency"],
|
// spacing: 20, // horizontal space between items
|
||||||
|
// runSpacing: 10, // vertical space between rows
|
||||||
|
// // Row(
|
||||||
|
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// _infoBlock(
|
||||||
|
// "Country code",
|
||||||
|
// item["country_code"] ?? "N/A",
|
||||||
// ),
|
// ),
|
||||||
// // SizedBox(height: 6),
|
// _infoBlock("Currency", item["currency"] ?? "N/A"),
|
||||||
// _buildRow(
|
// _infoBlock(
|
||||||
// "Duration:",
|
// "Total Amount",
|
||||||
// item["duration"],
|
// item["total_amount"]?.toString() ?? "0",
|
||||||
// ),
|
// ),
|
||||||
// // SizedBox(height: 6),
|
// ],
|
||||||
// _buildRow("StartDate:", item["start_date"]!),
|
// ),
|
||||||
// _buildRow("EndDate:", item["end_date"]!),
|
// const SizedBox(height: 12),
|
||||||
// _buildRow("Perdiem:", "$perdiemAmount",),
|
//
|
||||||
// _buildRow("Others:", "$calculatedOtherExpenses"),
|
// // Second Row (Start Date, End Date, Duration)
|
||||||
// _buildRow("Total:", "$finalTotal"),
|
// Row(
|
||||||
// _buildRow("Cash:", item["deposit_on_cash"]!),
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
// _buildRow("Card:", item["deposit_on_card"]!),
|
// children: [
|
||||||
// _buildRow("Comments:", item["comments"] ?? "N/A"),
|
// _infoBlock(
|
||||||
|
// "Start Date",
|
||||||
|
// item["start_date"] ?? "N/A",
|
||||||
|
// ),
|
||||||
|
// _infoBlock("End Date", item["end_date"] ?? "N/A"),
|
||||||
|
// _infoBlock(
|
||||||
|
// "Duration",
|
||||||
|
// item["duration"]?.toString() ?? "N/A",
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 16),
|
||||||
|
//
|
||||||
|
// // Comment label
|
||||||
|
// Text(
|
||||||
|
// "Comment",
|
||||||
|
// style: GoogleFonts.poppins(
|
||||||
|
// fontSize: 14,
|
||||||
|
// fontWeight: FontWeight.w600,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 8),
|
||||||
|
// if (item["comments"] != null &&
|
||||||
|
// item["comments"].toString().trim().isNotEmpty)
|
||||||
|
// Container(
|
||||||
|
// width: double.infinity,
|
||||||
|
// padding: const EdgeInsets.all(12),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// border: Border.all(
|
||||||
|
// color: const Color(0xFF7098DD),
|
||||||
|
// width: 1,
|
||||||
|
// ),
|
||||||
|
// borderRadius: BorderRadius.circular(6),
|
||||||
|
// ),
|
||||||
|
// child: Text(
|
||||||
|
// item["comments"] ?? "N/A",
|
||||||
|
// style: GoogleFonts.poppins(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color: Colors.black87,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// else
|
||||||
|
// const Text("N/A", style: TextStyle(fontSize: 12)),
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
],
|
],
|
||||||
@ -612,23 +686,27 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: exceedsLimit
|
child:
|
||||||
|
exceedsLimit
|
||||||
? Tooltip(
|
? Tooltip(
|
||||||
message: wrapText(value, 50),
|
message: wrapText(value, 50),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade200, // Black background
|
color: Colors.grey.shade200, // Black background
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
),
|
),
|
||||||
textStyle:
|
textStyle: TextStyle(
|
||||||
TextStyle(color: Colors.black), // Tooltip text color
|
color: Colors.black,
|
||||||
|
), // Tooltip text color
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
preferBelow: false,
|
preferBelow: false,
|
||||||
child: Text(value.substring(0, limit) + "...",
|
child: Text(
|
||||||
|
value.substring(0, limit) + "...",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis),
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
@ -660,10 +738,7 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black87),
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -671,60 +746,59 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget _buildRow(String title, String value) {
|
Widget _buildRow(String title, String value) {
|
||||||
// // Define character limits based on title
|
// Define character limits based on title
|
||||||
// Map<String, int> limits = {
|
Map<String, int> limits = {
|
||||||
// // "Special Request:": 30,
|
// "Special Request:": 30,
|
||||||
// "Comments:": 10,
|
"Comments:": 10,
|
||||||
// // Add more keys and limits if needed
|
// Add more keys and limits if needed
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// int limit = limits[title] ?? 50; // Default limit if title not found
|
|
||||||
// bool exceedsLimit = value.length > limit;
|
|
||||||
//
|
|
||||||
// String wrapText(String text, int maxLineLength) {
|
|
||||||
// final pattern = RegExp('.{1,$maxLineLength}(\\s+|\$)');
|
|
||||||
// return pattern.allMatches(text).map((m) => m.group(0)!).join('\n');
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// title,
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 12,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 8),
|
|
||||||
// Expanded(
|
|
||||||
// child: exceedsLimit
|
|
||||||
// ? Tooltip(
|
|
||||||
// message: wrapText(value, 50),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Colors.grey.shade200, // Black background
|
|
||||||
// borderRadius: BorderRadius.circular(6),
|
|
||||||
// ),
|
|
||||||
// textStyle:
|
|
||||||
// TextStyle(color: Colors.black), // Tooltip text color
|
|
||||||
// padding: EdgeInsets.all(8),
|
|
||||||
// preferBelow: false,
|
|
||||||
// child: Text(value.substring(0, limit) + "...",
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 12,
|
|
||||||
// ),
|
|
||||||
// overflow: TextOverflow.ellipsis),
|
|
||||||
// )
|
|
||||||
// : Text(
|
|
||||||
// value,
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 12,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
int limit = limits[title] ?? 50; // Default limit if title not found
|
||||||
|
bool exceedsLimit = value.length > limit;
|
||||||
|
|
||||||
|
String wrapText(String text, int maxLineLength) {
|
||||||
|
final pattern = RegExp('.{1,$maxLineLength}(\\s+|\$)');
|
||||||
|
return pattern.allMatches(text).map((m) => m.group(0)!).join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child:
|
||||||
|
exceedsLimit
|
||||||
|
? Tooltip(
|
||||||
|
message: wrapText(value, 50),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.shade200, // Black background
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
), // Tooltip text color
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
preferBelow: false,
|
||||||
|
child: Text(
|
||||||
|
value.substring(0, limit) + "...",
|
||||||
|
style: GoogleFonts.poppins(fontSize: 12),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Text(value, style: GoogleFonts.poppins(fontSize: 12)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -856,7 +856,7 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
top: 40,
|
top: 40,
|
||||||
), // Push it down to make room for the tab bar
|
), // Push it down to make room for the tab bar
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.only(top: 12, bottom: 12, left: 3, right: 3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white, // Card background
|
color: Colors.white, // Card background
|
||||||
// color: Colors.yellow.shade50, // Card background
|
// color: Colors.yellow.shade50, // Card background
|
||||||
|
|||||||
@ -181,7 +181,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
"first_approver": selectedFirstApprover,
|
"first_approver": selectedFirstApprover,
|
||||||
"second_approver": selectedSecondApprover,
|
"second_approver": selectedSecondApprover,
|
||||||
"third_approver": selectedThirdApprover,
|
"third_approver": selectedThirdApprover,
|
||||||
"exceptional_approver": selectedExceptionalApprover,
|
"fourth_approver": selectedExceptionalApprover,
|
||||||
|
// "exceptional_approver": selectedExceptionalApprover,
|
||||||
"delegated_to_user_id": selectedSubstituteApprover,
|
"delegated_to_user_id": selectedSubstituteApprover,
|
||||||
// "passport_number": controllers["passportNumber"]?.text,
|
// "passport_number": controllers["passportNumber"]?.text,
|
||||||
// "place_of_issue": controllers["placeOfIssue"]?.text,
|
// "place_of_issue": controllers["placeOfIssue"]?.text,
|
||||||
@ -300,9 +301,14 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
apiselectedUser?["third_approver"]?.toString() ?? "";
|
apiselectedUser?["third_approver"]?.toString() ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiselectedUser?["exceptional_approver"] != null) {
|
// if (apiselectedUser?["exceptional_approver"] != null) {
|
||||||
|
// selectedExceptionalApprover =
|
||||||
|
// apiselectedUser?["exceptional_approver"]?.toString() ?? "";
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (apiselectedUser?["fourth_approver"] != null) {
|
||||||
selectedExceptionalApprover =
|
selectedExceptionalApprover =
|
||||||
apiselectedUser?["exceptional_approver"]?.toString() ?? "";
|
apiselectedUser?["fourth_approver"]?.toString() ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiselectedUser?["delegated_to_user_id"] != null) {
|
if (apiselectedUser?["delegated_to_user_id"] != null) {
|
||||||
@ -1329,9 +1335,11 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
print("📨 Response: ${response.body}");
|
print("📨 Response: ${response.body}");
|
||||||
|
|
||||||
if(roleId == "4"){ context.go('/listPlan'); }
|
if (roleId == "4") {
|
||||||
else{ context.go('/listUser'); }
|
context.go('/listPlan');
|
||||||
|
} else {
|
||||||
|
context.go('/listUser');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
print("❌ Submission failed. Status: ${response.statusCode}");
|
print("❌ Submission failed. Status: ${response.statusCode}");
|
||||||
print("📨 Body: ${response.body}");
|
print("📨 Body: ${response.body}");
|
||||||
|
|||||||
@ -191,18 +191,34 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
fetchUsers();
|
fetchUsers();
|
||||||
fetchFindGroup();
|
fetchFindGroup();
|
||||||
|
|
||||||
|
_addFocusListener(
|
||||||
_addFocusListener(_employeeCodeFocusNode, (focus) => _employeeCodeFocus = focus);
|
_employeeCodeFocusNode,
|
||||||
_addFocusListener(_departmentFocusNode, (focus) => _departmentFocus = focus);
|
(focus) => _employeeCodeFocus = focus,
|
||||||
|
);
|
||||||
|
_addFocusListener(
|
||||||
|
_departmentFocusNode,
|
||||||
|
(focus) => _departmentFocus = focus,
|
||||||
|
);
|
||||||
_addFocusListener(_groupFocusNode, (focus) => _groupFocus = focus);
|
_addFocusListener(_groupFocusNode, (focus) => _groupFocus = focus);
|
||||||
_addFocusListener(_firstApprovalFocusNode, (focus) => _firstApprovalFocus = focus);
|
_addFocusListener(
|
||||||
_addFocusListener(_secondApprovalFocusNode, (focus) => _secondApprovalFocus = focus);
|
_firstApprovalFocusNode,
|
||||||
_addFocusListener(_thirdApprovalFocusNode, (focus) => _thirdApprovalFocus = focus);
|
(focus) => _firstApprovalFocus = focus,
|
||||||
_addFocusListener(_exceptionalApprovalFocusNode, (focus) => _exceptionalApprovalFocus = focus);
|
);
|
||||||
|
_addFocusListener(
|
||||||
|
_secondApprovalFocusNode,
|
||||||
|
(focus) => _secondApprovalFocus = focus,
|
||||||
|
);
|
||||||
|
_addFocusListener(
|
||||||
|
_thirdApprovalFocusNode,
|
||||||
|
(focus) => _thirdApprovalFocus = focus,
|
||||||
|
);
|
||||||
|
_addFocusListener(
|
||||||
|
_exceptionalApprovalFocusNode,
|
||||||
|
(focus) => _exceptionalApprovalFocus = focus,
|
||||||
|
);
|
||||||
_addFocusListener(_delegateFocusNode, (focus) => _delegateFocus = focus);
|
_addFocusListener(_delegateFocusNode, (focus) => _delegateFocus = focus);
|
||||||
_addFocusListener(_startDateFocusNode, (focus) => _startDateFocus = focus);
|
_addFocusListener(_startDateFocusNode, (focus) => _startDateFocus = focus);
|
||||||
_addFocusListener(_endDateFocusNode, (focus) => _endDateFocus = focus);
|
_addFocusListener(_endDateFocusNode, (focus) => _endDateFocus = focus);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addFocusListener(FocusNode node, Function(bool) updateState) {
|
void _addFocusListener(FocusNode node, Function(bool) updateState) {
|
||||||
@ -465,10 +481,7 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
widget.isDesktop
|
widget.isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [buildExceptionApprover(isDesktop), Spacer()],
|
||||||
buildExceptionApprover(isDesktop),
|
|
||||||
Spacer(),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -703,27 +716,28 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_departmentFocus)
|
(_departmentFocus) ? (layoutColor) : Colors.white,
|
||||||
? (layoutColor)
|
|
||||||
: Colors.white,
|
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_departmentFocus)
|
(_departmentFocus) ? (layoutColor) : Colors.white,
|
||||||
? (layoutColor)
|
|
||||||
: Colors.white,
|
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color: (layoutColor ?? Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
// contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
// contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -746,7 +760,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
|
|
||||||
final departmentId =
|
final departmentId =
|
||||||
departmentMap.entries
|
departmentMap.entries
|
||||||
.firstWhere((entry) => entry.value == newValue)
|
.firstWhere(
|
||||||
|
(entry) => entry.value == newValue,
|
||||||
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -757,7 +773,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
departmentId,
|
departmentId,
|
||||||
); // Send department_id
|
); // Send department_id
|
||||||
},
|
},
|
||||||
),),),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -914,9 +932,14 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color: (layoutColor ?? Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -934,7 +957,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
|
|
||||||
final levelId =
|
final levelId =
|
||||||
groupMap.entries
|
groupMap.entries
|
||||||
.firstWhere((entry) => entry.value == newValue)
|
.firstWhere(
|
||||||
|
(entry) => entry.value == newValue,
|
||||||
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -946,7 +971,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
); // ✅ pass the ID not the name
|
); // ✅ pass the ID not the name
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1003,16 +1029,20 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: DropdownSearch<String>(
|
: DropdownSearch<String>(
|
||||||
selectedItem: userMap[selectedFirstApprover],
|
selectedItem:
|
||||||
|
userMap[selectedFirstApprover],
|
||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit:
|
||||||
|
FlexFit
|
||||||
|
.loose, // Allows flexible height
|
||||||
menuProps: const MenuProps(
|
menuProps: const MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) =>
|
||||||
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
@ -1024,7 +1054,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 250,
|
||||||
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search User...",
|
hintText: "Search User...",
|
||||||
@ -1038,14 +1070,19 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
apiUserData!.map((user) {
|
apiUserData!.map((user) {
|
||||||
return "${user['first_name']} ${user['last_name']}";
|
return "${user['first_name']} ${user['last_name']}";
|
||||||
}).toList(),
|
}).toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps:
|
||||||
dropdownSearchDecoration: InputDecoration(
|
DropDownDecoratorProps(
|
||||||
|
dropdownSearchDecoration:
|
||||||
|
InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_firstApprovalFocus ?? false)
|
(_firstApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
@ -1053,18 +1090,29 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_firstApprovalFocus ?? false)
|
(_firstApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder:
|
||||||
|
OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color:
|
||||||
|
(layoutColor ??
|
||||||
|
Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -1098,7 +1146,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
final approverId =
|
final approverId =
|
||||||
userMap.entries
|
userMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
@ -1111,7 +1160,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
); // ✅ not newValue, but approverId
|
); // ✅ not newValue, but approverId
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1175,16 +1225,20 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: DropdownSearch<String>(
|
: DropdownSearch<String>(
|
||||||
selectedItem: userMap[selectedSecondApprover],
|
selectedItem:
|
||||||
|
userMap[selectedSecondApprover],
|
||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit:
|
||||||
|
FlexFit
|
||||||
|
.loose, // Allows flexible height
|
||||||
menuProps: const MenuProps(
|
menuProps: const MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) =>
|
||||||
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
@ -1196,7 +1250,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 250,
|
||||||
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search User...",
|
hintText: "Search User...",
|
||||||
@ -1210,14 +1266,19 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
apiUserData!.map((user) {
|
apiUserData!.map((user) {
|
||||||
return "${user['first_name']} ${user['last_name']}";
|
return "${user['first_name']} ${user['last_name']}";
|
||||||
}).toList(),
|
}).toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps:
|
||||||
dropdownSearchDecoration: InputDecoration(
|
DropDownDecoratorProps(
|
||||||
|
dropdownSearchDecoration:
|
||||||
|
InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_secondApprovalFocus ?? false)
|
(_secondApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
@ -1225,18 +1286,29 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_secondApprovalFocus ?? false)
|
(_secondApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder:
|
||||||
|
OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color:
|
||||||
|
(layoutColor ??
|
||||||
|
Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -1257,7 +1329,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
final approverId =
|
final approverId =
|
||||||
userMap.entries
|
userMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
@ -1282,7 +1355,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1346,16 +1420,20 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: DropdownSearch<String>(
|
: DropdownSearch<String>(
|
||||||
selectedItem: userMap[selectedThirdApprover],
|
selectedItem:
|
||||||
|
userMap[selectedThirdApprover],
|
||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit:
|
||||||
|
FlexFit
|
||||||
|
.loose, // Allows flexible height
|
||||||
menuProps: const MenuProps(
|
menuProps: const MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) =>
|
||||||
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
@ -1367,7 +1445,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 250,
|
||||||
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search User...",
|
hintText: "Search User...",
|
||||||
@ -1381,14 +1461,19 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
apiUserData!.map((user) {
|
apiUserData!.map((user) {
|
||||||
return "${user['first_name']} ${user['last_name']}";
|
return "${user['first_name']} ${user['last_name']}";
|
||||||
}).toList(),
|
}).toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps:
|
||||||
dropdownSearchDecoration: InputDecoration(
|
DropDownDecoratorProps(
|
||||||
|
dropdownSearchDecoration:
|
||||||
|
InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_thirdApprovalFocus ?? false)
|
(_thirdApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
@ -1396,18 +1481,29 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_thirdApprovalFocus ?? false)
|
(_thirdApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder:
|
||||||
|
OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color:
|
||||||
|
(layoutColor ??
|
||||||
|
Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -1427,7 +1523,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
final approverId =
|
final approverId =
|
||||||
userMap.entries
|
userMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
@ -1452,7 +1549,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1480,7 +1578,7 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Exceptional Approver",
|
"Fourth Approver",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -1516,16 +1614,20 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: DropdownSearch<String>(
|
: DropdownSearch<String>(
|
||||||
selectedItem: userMap[selectedExceptionalApprover],
|
selectedItem:
|
||||||
|
userMap[selectedExceptionalApprover],
|
||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit:
|
||||||
|
FlexFit
|
||||||
|
.loose, // Allows flexible height
|
||||||
menuProps: const MenuProps(
|
menuProps: const MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) =>
|
||||||
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
@ -1537,7 +1639,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 250,
|
||||||
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search User...",
|
hintText: "Search User...",
|
||||||
@ -1554,11 +1658,15 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(
|
||||||
|
8,
|
||||||
|
),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_exceptionalApprovalFocus ?? false)
|
(_exceptionalApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
@ -1566,8 +1674,10 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_exceptionalApprovalFocus ?? false)
|
(_exceptionalApprovalFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
@ -1575,9 +1685,15 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.white), width: 0.5),
|
color:
|
||||||
|
(layoutColor ?? Colors.white),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -1598,12 +1714,14 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
final approverId =
|
final approverId =
|
||||||
userMap.entries
|
userMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedExceptionalApprover = approverId;
|
selectedExceptionalApprover =
|
||||||
|
approverId;
|
||||||
});
|
});
|
||||||
|
|
||||||
widget.onExceptionalApproverChanged?.call(
|
widget.onExceptionalApproverChanged?.call(
|
||||||
@ -1611,7 +1729,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
); // ✅ not newValue, but approverId
|
); // ✅ not newValue, but approverId
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1625,7 +1744,6 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget buildApproverSubstitute1(bool isDesktop) {
|
Widget buildApproverSubstitute1(bool isDesktop) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -1683,12 +1801,15 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit:
|
||||||
|
FlexFit
|
||||||
|
.loose, // Allows flexible height
|
||||||
menuProps: const MenuProps(
|
menuProps: const MenuProps(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) =>
|
||||||
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
@ -1700,7 +1821,9 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
constraints: BoxConstraints(maxHeight: 133),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 133,
|
||||||
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search User...",
|
hintText: "Search User...",
|
||||||
@ -1714,14 +1837,19 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
apiUserData!.map((user) {
|
apiUserData!.map((user) {
|
||||||
return "${user['first_name']} ${user['last_name']}";
|
return "${user['first_name']} ${user['last_name']}";
|
||||||
}).toList(),
|
}).toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps:
|
||||||
dropdownSearchDecoration: InputDecoration(
|
DropDownDecoratorProps(
|
||||||
|
dropdownSearchDecoration:
|
||||||
|
InputDecoration(
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius:
|
||||||
|
BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_delegateFocus ?? false)
|
(_delegateFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
),
|
),
|
||||||
@ -1729,18 +1857,29 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color:
|
color:
|
||||||
(_delegateFocus ?? false)
|
(_delegateFocus ??
|
||||||
? (layoutColor ?? Colors.white)
|
false)
|
||||||
|
? (layoutColor ??
|
||||||
|
Colors.white)
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
// const Color(0xFFD6D5E6),
|
// const Color(0xFFD6D5E6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder:
|
||||||
|
OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color : (layoutColor ?? Colors.grey), width: 0.5),
|
color:
|
||||||
|
(layoutColor ??
|
||||||
|
Colors.grey),
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.0,
|
||||||
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
@ -1774,7 +1913,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
final approverId =
|
final approverId =
|
||||||
userMap.entries
|
userMap.entries
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(entry) => entry.value == newValue,
|
(entry) =>
|
||||||
|
entry.value == newValue,
|
||||||
)
|
)
|
||||||
.key;
|
.key;
|
||||||
|
|
||||||
@ -1787,7 +1927,8 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
); // ✅ not newValue, but approverId
|
); // ✅ not newValue, but approverId
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1892,7 +2033,10 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
controller: widget.controllers["delegationStartDate"],
|
controller: widget.controllers["delegationStartDate"],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Select Date",
|
labelText: "Select Date",
|
||||||
labelStyle: GoogleFonts.poppins(
|
labelStyle: GoogleFonts.poppins(
|
||||||
@ -2049,7 +2193,10 @@ class OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
controller: widget.controllers["delegationEndDate"],
|
controller: widget.controllers["delegationEndDate"],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Select Date",
|
labelText: "Select Date",
|
||||||
labelStyle: GoogleFonts.poppins(
|
labelStyle: GoogleFonts.poppins(
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
//api url
|
//api url
|
||||||
// const String apiUrl = 'http://localhost/tstat_be';
|
// const String apiUrl = 'http://localhost/tstat_be';
|
||||||
const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||||
// const String apiUrl = 'https://apitest.tripapprovaltool.com/tstat_be';
|
const String apiUrl = 'https://apitest.tripapprovaltool.com/tstat_be';
|
||||||
|
|
||||||
/** Note : Adfactor UAT BE URL
|
/** Note : Adfactor UAT BE URL
|
||||||
* File : web/index.html - change below
|
* File : web/index.html - change below
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user