merge
This commit is contained in:
parent
1a568f6878
commit
194af031d0
Binary file not shown.
@ -69,12 +69,15 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
print("allPlans before filtering: $allPlans");
|
print("allPlans before filtering: $allPlans");
|
||||||
final lowerQuery = query.toLowerCase();
|
final lowerQuery = query.toLowerCase();
|
||||||
setState(() {
|
setState(() {
|
||||||
filteredPlans = allPlans.where((plan) {
|
filteredPlans =
|
||||||
|
allPlans.where((plan) {
|
||||||
return (plan.planId?.toLowerCase().contains(lowerQuery) ?? false) ||
|
return (plan.planId?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.employeeCode?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.employeeCode?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
(plan.tripTitle?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.tripTitle?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.userName?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.userName?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.travellerName?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.travellerName?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
(plan.tripType?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.tripType?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.createdOn?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.createdOn?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.statusValue?.toLowerCase().contains(lowerQuery) ?? false);
|
(plan.statusValue?.toLowerCase().contains(lowerQuery) ?? false);
|
||||||
@ -88,11 +91,13 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
String? bodyStringColor = await getBodyColor();
|
String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
layoutColor = layoutString != null
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
? Color(int.parse(layoutString))
|
? Color(int.parse(layoutString))
|
||||||
: Colors.redAccent;
|
: Colors.redAccent;
|
||||||
|
|
||||||
bodyColor = bodyStringColor != null
|
bodyColor =
|
||||||
|
bodyStringColor != null
|
||||||
? Color(int.parse(bodyStringColor))
|
? Color(int.parse(bodyStringColor))
|
||||||
: Colors.white;
|
: Colors.white;
|
||||||
});
|
});
|
||||||
@ -195,7 +200,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final data = json.decode(response.body);
|
final data = json.decode(response.body);
|
||||||
List<dynamic> plansJson = data['data'];
|
List<dynamic> plansJson = [];
|
||||||
|
// List<dynamic> plansJson = data['data'];
|
||||||
return plansJson.map((json) => Plan.fromJson(json)).toList();
|
return plansJson.map((json) => Plan.fromJson(json)).toList();
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Failed to load plans');
|
throw Exception('Failed to load plans');
|
||||||
@ -239,8 +245,10 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deletePlan(String planId) async {
|
void deletePlan(String planId) async {
|
||||||
bool confirmed =
|
bool confirmed = await apiService.showCancelConfirmationDialog(
|
||||||
await apiService.showCancelConfirmationDialog(context, layoutColor);
|
context,
|
||||||
|
layoutColor,
|
||||||
|
);
|
||||||
|
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
try {
|
try {
|
||||||
@ -257,8 +265,10 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
return ResponsiveBuilder(
|
||||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
builder: (context, sizingInfo) {
|
||||||
|
bool isDesktop =
|
||||||
|
sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Color(0xFFf5f5f5),
|
backgroundColor: Color(0xFFf5f5f5),
|
||||||
@ -267,23 +277,27 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
appBar: CustomAppBar(isDesktop: isDesktop),
|
appBar: CustomAppBar(isDesktop: isDesktop),
|
||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: isDesktop
|
padding:
|
||||||
|
isDesktop
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: MediaQuery.of(context).size.width *
|
horizontal:
|
||||||
|
MediaQuery.of(context).size.width *
|
||||||
0.1, // 30% of screen width as horizontal padding
|
0.1, // 30% of screen width as horizontal padding
|
||||||
vertical: MediaQuery.of(context).size.height *
|
vertical:
|
||||||
|
MediaQuery.of(context).size.height *
|
||||||
0, // 5% of screen height as vertical padding
|
0, // 5% of screen height as vertical padding
|
||||||
)
|
)
|
||||||
: EdgeInsets.all(0),
|
: EdgeInsets.all(0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||||
Expanded(child: buildGroupListLayout(isDesktop))
|
Expanded(child: buildGroupListLayout(isDesktop)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildGroupListLayout(bool isDesktop) {
|
Widget buildGroupListLayout(bool isDesktop) {
|
||||||
@ -313,8 +327,9 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
String _formatDate(String rawDate) {
|
String _formatDate(String rawDate) {
|
||||||
try {
|
try {
|
||||||
final dateTime = DateTime.parse(rawDate);
|
final dateTime = DateTime.parse(rawDate);
|
||||||
return DateFormat('dd, MMM yyyy HH:mm')
|
return DateFormat(
|
||||||
.format(dateTime); // 24-hour format
|
'dd, MMM yyyy HH:mm',
|
||||||
|
).format(dateTime); // 24-hour format
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return rawDate; // fallback if parsing fails
|
return rawDate; // fallback if parsing fails
|
||||||
}
|
}
|
||||||
@ -323,11 +338,13 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
return Container(
|
return Container(
|
||||||
margin: isDesktop ? EdgeInsets.all(10.0) : null,
|
margin: isDesktop ? EdgeInsets.all(10.0) : null,
|
||||||
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 20, right: 20),
|
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 20, right: 20),
|
||||||
height: isDesktop
|
height:
|
||||||
|
isDesktop
|
||||||
? MediaQuery.of(context).size.height * 0.98
|
? MediaQuery.of(context).size.height * 0.98
|
||||||
: MediaQuery.of(context).size.height,
|
: MediaQuery.of(context).size.height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: isDesktop
|
border:
|
||||||
|
isDesktop
|
||||||
? Border.all(
|
? Border.all(
|
||||||
width: 2,
|
width: 2,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -382,8 +399,10 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
onChanged: filterPlans,
|
onChanged: filterPlans,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search...",
|
hintText: "Search...",
|
||||||
hintStyle:
|
hintStyle: TextStyle(
|
||||||
TextStyle(fontSize: 12, color: Color(0xFF9E9DBD)),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF9E9DBD),
|
||||||
|
),
|
||||||
prefixIcon: Icon(
|
prefixIcon: Icon(
|
||||||
Icons.search,
|
Icons.search,
|
||||||
color: Color(0xFF9E9DBD),
|
color: Color(0xFF9E9DBD),
|
||||||
@ -395,23 +414,23 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.grey.shade200, width: 0.5),
|
color: Colors.grey.shade200,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.grey.shade300, width: 1),
|
color: Colors.grey.shade300,
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontFamily: "Inter",
|
|
||||||
),
|
),
|
||||||
|
style: TextStyle(fontSize: 12, fontFamily: "Inter"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// SizedBox(width: 16),
|
// SizedBox(width: 16),
|
||||||
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
// ElevatedButton(
|
// ElevatedButton(
|
||||||
// style: ElevatedButton.styleFrom(
|
// style: ElevatedButton.styleFrom(
|
||||||
@ -447,8 +466,10 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
onChanged: filterPlans,
|
onChanged: filterPlans,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search...",
|
hintText: "Search...",
|
||||||
hintStyle:
|
hintStyle: TextStyle(
|
||||||
TextStyle(fontSize: 12, color: Color(0xFF9E9DBD)),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF9E9DBD),
|
||||||
|
),
|
||||||
prefixIcon: Icon(
|
prefixIcon: Icon(
|
||||||
Icons.search,
|
Icons.search,
|
||||||
color: Color(0xFF9E9DBD),
|
color: Color(0xFF9E9DBD),
|
||||||
@ -460,17 +481,19 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.grey.shade200, width: 0.5),
|
color: Colors.grey.shade200,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.grey.shade300, width: 1),
|
color: Colors.grey.shade300,
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
),
|
||||||
|
style: GoogleFonts.poppins(fontSize: 12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -479,6 +502,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
FutureBuilder<List<Plan>>(
|
FutureBuilder<List<Plan>>(
|
||||||
future: futurePlans,
|
future: futurePlans,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
final adjHgt = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (snapshot.hasError ||
|
} else if (snapshot.hasError ||
|
||||||
@ -490,7 +515,7 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 20),
|
// SizedBox(height: 20),
|
||||||
// Icon(Icons.error_outline,
|
// Icon(Icons.error_outline,
|
||||||
// color: Colors.redAccent, size: 60),
|
// color: Colors.redAccent, size: 60),
|
||||||
// SizedBox(height: 1),
|
// SizedBox(height: 1),
|
||||||
@ -499,21 +524,23 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
// fontSize: 22,
|
// fontSize: 22,
|
||||||
// fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
// color: Colors.redAccent)),
|
// color: Colors.redAccent)),
|
||||||
SizedBox(height: 20),
|
|
||||||
isDesktop
|
isDesktop
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
width:
|
width:
|
||||||
MediaQuery.of(context).size.width * 5.5,
|
MediaQuery.of(context).size.width * 5.5,
|
||||||
)
|
)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
|
SizedBox(height: adjHgt / 4),
|
||||||
|
|
||||||
Text("No Trips Pending For Your Approvals",
|
Text(
|
||||||
|
" No Trips Found",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontFamily: "Inter",
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w600,
|
color: Colors.black54,
|
||||||
color: Colors.black54)),
|
),
|
||||||
|
),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
// Text("Please Create Trip",
|
// Text("Please Create Trip",
|
||||||
// textAlign: TextAlign.center,
|
// textAlign: TextAlign.center,
|
||||||
@ -536,10 +563,13 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
List<Plan> plans =
|
List<Plan> plans =
|
||||||
searchController.text.isEmpty ? allPlans : filteredPlans;
|
searchController.text.isEmpty ? allPlans : filteredPlans;
|
||||||
|
|
||||||
plans.sort((a, b) =>
|
plans.sort(
|
||||||
int.parse(b.planId).compareTo(int.parse(a.planId)));
|
(a, b) =>
|
||||||
|
int.parse(b.planId).compareTo(int.parse(a.planId)),
|
||||||
|
);
|
||||||
|
|
||||||
List<Plan> paginatedPlans = plans
|
List<Plan> paginatedPlans =
|
||||||
|
plans
|
||||||
.skip(currentPage * itemsPerPage)
|
.skip(currentPage * itemsPerPage)
|
||||||
.take(itemsPerPage)
|
.take(itemsPerPage)
|
||||||
.toList();
|
.toList();
|
||||||
@ -555,117 +585,174 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
columnSpacing: isDesktop ? 24.0 : 16.0,
|
columnSpacing: isDesktop ? 24.0 : 16.0,
|
||||||
border: TableBorder(
|
border: TableBorder(
|
||||||
horizontalInside: BorderSide(
|
horizontalInside: BorderSide(
|
||||||
width: 0.5, color: Colors.grey.shade200),
|
width: 0.5,
|
||||||
|
color: Colors.grey.shade200,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
columns: [
|
columns: [
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Trip ID',
|
'Trip ID',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Trip Name',
|
'Trip Name',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Emp Code',
|
'Emp Code',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Traveller',
|
'Traveller',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Trip Type',
|
'Trip Type',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Created On',
|
'Created On',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Status',
|
'Status',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Actions',
|
'Actions',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600),
|
fontSize: 13,
|
||||||
)),
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
rows: paginatedPlans.map((plan) {
|
rows:
|
||||||
return DataRow(cells: [
|
paginatedPlans.map((plan) {
|
||||||
DataCell(Text(plan.planId,
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
|
plan.planId,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
))),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
DataCell(Text(plan.tripTitle,
|
DataCell(
|
||||||
|
Text(
|
||||||
|
plan.tripTitle,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
),
|
),
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
overflow: TextOverflow.ellipsis)),
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
DataCell(Text(plan.employeeCode ?? " - ",
|
DataCell(
|
||||||
|
Text(
|
||||||
|
plan.employeeCode ?? " - ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
))),
|
),
|
||||||
DataCell(Text(
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
plan.userName.isNotEmpty
|
plan.userName.isNotEmpty
|
||||||
? plan.userName
|
? plan.userName
|
||||||
: plan.travellerName,
|
: plan.travellerName,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
))),
|
),
|
||||||
DataCell(Text(plan.tripType,
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
|
plan.tripType,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
))),
|
),
|
||||||
DataCell(Text(_formatDate(plan.createdOn),
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
|
_formatDate(plan.createdOn),
|
||||||
// plan.createdOn,
|
// plan.createdOn,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
))),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(3),
|
padding: const EdgeInsets.all(3),
|
||||||
// width:
|
// width:
|
||||||
// 150, // Set your desired fixed size (equal width and height)
|
// 150, // Set your desired fixed size (equal width and height)
|
||||||
width: double
|
width:
|
||||||
|
double
|
||||||
.infinity, // Set your desired fixed size (equal width and height)
|
.infinity, // Set your desired fixed size (equal width and height)
|
||||||
height: 25,
|
height: 25,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: getStatusColor(plan.statusValue),
|
color: getStatusColor(
|
||||||
borderRadius: BorderRadius.circular(10),
|
plan.statusValue,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
10,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
plan.statusValue,
|
plan.statusValue,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: getStatusTextColor(
|
||||||
getStatusTextColor(plan.statusValue),
|
plan.statusValue,
|
||||||
|
),
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@ -681,29 +768,45 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
offset: Offset(0, 30),
|
offset: Offset(0, 30),
|
||||||
icon: Icon(Icons.more_vert,
|
icon: Icon(
|
||||||
color: Color(0xFF475569)),
|
Icons.more_vert,
|
||||||
itemBuilder: (context) => [
|
color: Color(0xFF475569),
|
||||||
|
),
|
||||||
|
itemBuilder:
|
||||||
|
(context) => [
|
||||||
CustomPopupMenuEntry(
|
CustomPopupMenuEntry(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding:
|
||||||
horizontal: 8, vertical: 8),
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize:
|
||||||
|
MainAxisSize.min,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment
|
||||||
|
.center,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.remove_red_eye,
|
Icons
|
||||||
color: Color(0xFF475569),
|
.remove_red_eye,
|
||||||
size: 16),
|
color: Color(
|
||||||
|
0xFF475569,
|
||||||
|
),
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context,
|
||||||
|
); // Close popup manually
|
||||||
ApiService.viewPlan(
|
ApiService.viewPlan(
|
||||||
context, plan.planId,
|
context,
|
||||||
isViewMode: true);
|
plan.planId,
|
||||||
|
isViewMode:
|
||||||
|
true,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// IconButton(
|
// IconButton(
|
||||||
@ -720,44 +823,65 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
// ),
|
// ),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons
|
||||||
size: 18),
|
.cancel_rounded,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
deletePlan(plan.planId);
|
context,
|
||||||
|
);
|
||||||
|
deletePlan(
|
||||||
|
plan.planId,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.download,
|
icon: Icon(
|
||||||
color: Color(0xFF114D8B),
|
Icons.download,
|
||||||
size: 18),
|
color: Color(
|
||||||
|
0xFF114D8B,
|
||||||
|
),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
apiService.getPdfDownload(
|
context,
|
||||||
plan.planId);
|
);
|
||||||
|
apiService
|
||||||
|
.getPdfDownload(
|
||||||
|
plan.planId,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.comment,
|
Icons.comment,
|
||||||
color: Color(0xFF475569),
|
color: Color(
|
||||||
|
0xFF475569,
|
||||||
|
),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context:
|
||||||
builder: (context) =>
|
context,
|
||||||
CommentModal(
|
builder:
|
||||||
|
(
|
||||||
|
context,
|
||||||
|
) => CommentModal(
|
||||||
// planId: plan.planId,
|
// planId: plan.planId,
|
||||||
planId: plan
|
planId:
|
||||||
.planId
|
plan.planId
|
||||||
.toString(),
|
.toString(),
|
||||||
layoutColorForUser:
|
layoutColorForUser:
|
||||||
layoutColor!,
|
layoutColor!,
|
||||||
role:
|
role:
|
||||||
"Travel Agent"),
|
"Travel Agent",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -807,7 +931,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
// apiService.getPdfDownload(plan.planId);
|
// apiService.getPdfDownload(plan.planId);
|
||||||
// }),
|
// }),
|
||||||
// ])),
|
// ])),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -821,8 +946,10 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
final plan = paginatedPlans[index];
|
final plan = paginatedPlans[index];
|
||||||
return Card(
|
return Card(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin:
|
margin: EdgeInsets.symmetric(
|
||||||
EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
horizontal: 12,
|
||||||
|
vertical: 6,
|
||||||
|
),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
@ -839,7 +966,9 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 8, vertical: 4),
|
horizontal: 8,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: getStatusColor(plan.statusValue),
|
color: getStatusColor(plan.statusValue),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -848,7 +977,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
plan.statusValue,
|
plan.statusValue,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: getStatusTextColor(
|
color: getStatusTextColor(
|
||||||
plan.statusValue),
|
plan.statusValue,
|
||||||
|
),
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
@ -871,11 +1001,14 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(' ${plan.tripTitle}',
|
Text(
|
||||||
|
' ${plan.tripTitle}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -890,24 +1023,28 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(' ${plan.tripType}',
|
Text(
|
||||||
|
' ${plan.tripType}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('${_formatDate(plan.createdOn)}',
|
Text(
|
||||||
|
'${_formatDate(plan.createdOn)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -927,7 +1064,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
color: Colors.black87),
|
color: Colors.black87,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -941,7 +1079,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
color: Colors.black87),
|
color: Colors.black87,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -963,14 +1102,17 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: isDesktop
|
child:
|
||||||
|
isDesktop
|
||||||
? (searchController.text.isNotEmpty &&
|
? (searchController.text.isNotEmpty &&
|
||||||
filteredPlans.isEmpty
|
filteredPlans.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"No matches found",
|
"No matches found",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14, color: Colors.grey),
|
fontSize: 14,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: SingleChildScrollView(
|
: SingleChildScrollView(
|
||||||
@ -983,7 +1125,9 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
"No matches found",
|
"No matches found",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14, color: Colors.grey),
|
fontSize: 14,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: buildMobileCardView(paginatedPlans)),
|
: buildMobileCardView(paginatedPlans)),
|
||||||
@ -1016,7 +1160,7 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1188,7 +1188,13 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.end, // important
|
crossAxisAlignment: CrossAxisAlignment.end, // important
|
||||||
children:
|
children:
|
||||||
tabs.entries.map((entry) {
|
tabs.entries.map((entry) {
|
||||||
|
final targetTab = entry.key;
|
||||||
|
|
||||||
|
print("TargetsTAb: $targetTab");
|
||||||
|
|
||||||
final isSelected = selectedTab == entry.key;
|
final isSelected = selectedTab == entry.key;
|
||||||
|
print("isSelected: $isSelected");
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -1201,6 +1207,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (isValid) {
|
if (isValid) {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
|
} else if (currentTab == "office" &&
|
||||||
|
targetTab == "personal") {
|
||||||
|
selectedTab = entry.key;
|
||||||
} else if (currentTab == "office") {
|
} else if (currentTab == "office") {
|
||||||
isValid = isValidDataTwo(userDetials);
|
isValid = isValidDataTwo(userDetials);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
@ -1306,6 +1315,37 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Widget> _buildBack(isDesktop, Color layoutColor) {
|
||||||
|
return [
|
||||||
|
MouseRegion(
|
||||||
|
cursor:
|
||||||
|
isViewMode
|
||||||
|
? SystemMouseCursors.forbidden
|
||||||
|
: SystemMouseCursors.click,
|
||||||
|
child: TextButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
|
foregroundColor:
|
||||||
|
isViewMode ? Colors.white : Colors.red, // Keep original color
|
||||||
|
disabledBackgroundColor:
|
||||||
|
layoutColor, // Ensure color remains when disabled
|
||||||
|
disabledForegroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(color: layoutColor, width: 2),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||||
|
),
|
||||||
|
onPressed: handleNext,
|
||||||
|
// onPressed:
|
||||||
|
// isViewMode ? null : handleNext, // Disable when in view mode
|
||||||
|
child: Text("Next"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> _buildSubmit(isDesktop, Color layoutColor) {
|
List<Widget> _buildSubmit(isDesktop, Color layoutColor) {
|
||||||
return [
|
return [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'app.dart';
|
import 'app.dart';
|
||||||
|
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
setUrlStrategy(PathUrlStrategy());
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user