approval and my trips

This commit is contained in:
venba-Inspriron-3558 2025-07-19 09:36:57 +05:30
parent 9fac4152ab
commit ea0456d97c
2 changed files with 1053 additions and 503 deletions

View File

@ -1395,277 +1395,550 @@ class _ApprovalListState extends State<ApprovalList> {
), ),
elevation: 3, elevation: 3,
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(10.0),
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Status and Employee Code // Status and Employee Code
Row( // Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.spaceBetween, // MainAxisAlignment.spaceBetween,
children: [ // children: [
GestureDetector( // GestureDetector(
onTap: () => _showDetails(plan.planId), // onTap: () => _showDetails(plan.planId),
child: Container( // child: Container(
padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
horizontal: 8, // horizontal: 8,
vertical: 4, // vertical: 4,
), // ),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: getStatusColor(plan.statusValue), // color: getStatusColor(plan.statusValue),
borderRadius: BorderRadius.circular(8), // borderRadius: BorderRadius.circular(8),
), // ),
child: Text( // child: Text(
plan.statusValue, // plan.statusValue,
style: TextStyle( // style: TextStyle(
color: getStatusTextColor( // color: getStatusTextColor(
plan.statusValue, // plan.statusValue,
// ),
// fontSize: 10,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
// ),
// PopupMenuButton<int>(
// color: Colors.white,
// padding: EdgeInsets.zero,
// offset: Offset(0, 30),
// icon: Icon(
// Icons.more_vert,
// color: Color(0xFF475569),
// size: 14,
// ),
// itemBuilder:
// (context) => [
// CustomPopupMenuEntry(
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 8,
// ),
// child: Row(
// mainAxisSize:
// MainAxisSize.min,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// IconButton(
// icon: Icon(
// Icons.remove_red_eye,
// color: Color(
// 0xFF475569,
// ),
// size: 18,
// ),
// tooltip:
// 'View The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// ); // Close popup manually
// viewPlanforApprover(
// plan.planId,
// plan.approverId,
// plan.delegaterId,
// isViewMode: true,
// isApprover: true,
// );
// },
// ),
// if (plan.statusValue ==
// "Pending Approval" ||
// plan.statusValue ==
// "Partially Approved")
// IconButton(
// icon: Image.asset(
// 'assets/images/IconsImg/edit.png',
// width: 20,
// height: 15,
// ),
// tooltip:
// 'Edit The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// );
// print(
// "Approver Edit3 : ${plan.approver_status}",
// );
//
// ApiService.viewPlanForApprover(
// context,
// plan.planId,
// plan.approverId,
// plan.delegaterId,
// plan.approver_status,
// isViewMode: false,
// isApprover: true,
// );
// },
// ),
// IconButton(
// icon: Icon(
// Icons.cancel_rounded,
// size: 18,
// ),
// tooltip:
// 'Cancellation The Trip Details',
// onPressed: () {
// Navigator.pop(context);
// deletePlan(plan.planId);
// },
// ),
// IconButton(
// icon: Icon(
// Icons.download,
// color: Color(
// 0xFF114D8B,
// ),
// size: 18,
// ),
// tooltip:
// 'Download The PDF',
// onPressed: () {
// Navigator.pop(context);
// apiService
// .getPdfDownload(
// plan.planId,
// );
// },
// ),
// IconButton(
// icon: const Icon(
// Icons.comment,
// color: Color(
// 0xFF475569,
// ),
// size: 11,
// ),
// tooltip: 'Trip Comments',
// onPressed: () {
// showDialog(
// context: context,
// builder:
// (
// context,
// ) => CommentModalList(
// // planId: plan.planId,
// planId:
// plan.planId
// .toString(),
// layoutColorForUser:
// layoutColor!,
// role:
// "Approver",
// ),
// );
// },
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 2),
// // Trip Id and Trip Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripTitle}',
// style: TextStyle(
// fontSize: 12,
// fontFamily: "Inter",
// fontWeight: FontWeight.bold,
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 2),
// // Type and Created On
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripType}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// '${_formatDate(plan.createdOn)}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 3),
// // Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.userName.isNotEmpty
// ? '${plan.userName}'
// : '${plan.travellerName}',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// Spacer(),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.employeeCode ?? 'No Data',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// ],
// ),
// Actions
Expanded(
child: Container(
// color: Colors.yellow.shade50,
child: Column(
children: [
Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
children: [
Container(
// color: Colors.red.shade50,
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Image.asset(
plan.tripType == 'Domestic'
? 'assets/images/IconsImg/Domestic_new.png'
: 'assets/images/IconsImg/International_new.png',
// width: 65,
height: plan.tripType == 'Domestic' ? 28 : 30,
),
],
),
), ),
fontSize: 10, SizedBox(width: 10),
fontWeight: FontWeight.w600, Expanded(
), flex: 1,
), child: Column(
), crossAxisAlignment:
), CrossAxisAlignment.start,
PopupMenuButton<int>( children: [
color: Colors.white, Text(
padding: EdgeInsets.zero, ' ${plan.tripTitle}',
offset: Offset(0, 30), style: GoogleFonts.poppins(
icon: Icon( fontSize: 12,
Icons.more_vert, fontWeight:
color: Color(0xFF475569), FontWeight.w500,
size: 14,
),
itemBuilder:
(context) => [
CustomPopupMenuEntry(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
),
child: Row(
mainAxisSize:
MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
IconButton(
icon: Icon(
Icons.remove_red_eye,
color: Color(
0xFF475569,
),
size: 18,
),
tooltip:
'View The Trip Details',
onPressed: () {
Navigator.pop(
context,
); // Close popup manually
viewPlanforApprover(
plan.planId,
plan.approverId,
plan.delegaterId,
isViewMode: true,
isApprover: true,
);
},
), ),
if (plan.statusValue == ),
"Pending Approval" || ],
plan.statusValue == ),
"Partially Approved") ),
IconButton(
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height: 15,
),
tooltip:
'Edit The Trip Details',
onPressed: () {
Navigator.pop(
context,
);
print(
"Approver Edit3 : ${plan.approver_status}",
);
ApiService.viewPlanForApprover( SizedBox(width: 10),
context, Column(
plan.planId, children: [
plan.approverId, PopupMenuButton<int>(
plan.delegaterId, color: Colors.white,
plan.approver_status, padding: EdgeInsets.zero,
isViewMode: false, offset: Offset(0, 30),
isApprover: true, icon: Icon(
); Icons.more_vert,
}, color: Color(0xFF475569),
), size: 14,
IconButton( ),
icon: Icon( itemBuilder:
Icons.cancel_rounded, (context) => [
size: 18, CustomPopupMenuEntry(
), child: Container(
tooltip: padding:
'Cancellation The Trip Details', EdgeInsets.symmetric(
onPressed: () { horizontal: 1,
Navigator.pop(context); vertical: 1,
deletePlan(plan.planId); // horizontal: 8,
}, // vertical: 8,
),
IconButton(
icon: Icon(
Icons.download,
color: Color(
0xFF114D8B,
), ),
size: 18, child: Row(
), mainAxisSize:
tooltip: MainAxisSize
'Download The PDF', .min,
onPressed: () { mainAxisAlignment:
Navigator.pop(context); MainAxisAlignment
apiService .center,
.getPdfDownload( children: [
plan.planId, IconButton(
); icon: Icon(
}, Icons
), .remove_red_eye,
IconButton( color: Color(
icon: const Icon( 0xFF475569,
Icons.comment, ),
color: Color( size: 18,
0xFF475569, ),
), tooltip:
size: 11, 'View The Trip Details',
), onPressed: () {
tooltip: 'Trip Comments', Navigator.pop(
onPressed: () { context,
showDialog( ); // Close popup manually
context: context, viewPlanforApprover(
builder: plan.planId,
( plan.approverId,
context, plan.delegaterId,
) => CommentModalList( isViewMode: true,
// planId: plan.planId, isApprover: true,
planId: );
},
),
if (plan.statusValue ==
"Pending Approval" ||
plan.statusValue ==
"Partially Approved")
IconButton(
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height:
15,
),
tooltip:
'Edit The Trip Details',
onPressed: () {
Navigator.pop(
context,
); // Close popup manually
viewPlanforApprover(
plan.planId,
plan.approverId,
plan.delegaterId,
isViewMode: true,
isApprover: true,
);
},
),
IconButton(
icon: Icon(
Icons
.cancel_rounded,
size: 18,
),
tooltip:
'Cancellation The Trip Details',
onPressed: () {
Navigator.pop(context);
deletePlan(plan.planId);
},
),
IconButton(
icon: Icon(
Icons
.download,
color: Color(
0xFF114D8B,
),
size: 18,
),
tooltip:
'Download The PDF',
onPressed: () {
Navigator.pop(context);
apiService
.getPdfDownload(
plan.planId,
);
},
),
IconButton(
icon: const Icon(
Icons
.comment,
color: Color(
0xFF475569,
),
size: 11,
),
tooltip:
'Trip Comments',
onPressed: () {
showDialog(
context: context,
builder:
(
context,
) => CommentModalList(
// planId: plan.planId,
planId:
plan.planId plan.planId
.toString(), .toString(),
layoutColorForUser: layoutColorForUser:
layoutColor!, layoutColor!,
role: role:
"Approver", "Approver",
), ),
); );
}, },
),
],
),
),
), ),
], ],
), ),
), ],
), ),
], ],
), ),
],
),
SizedBox(height: 2), Row(
// Trip Id and Trip Name mainAxisAlignment:
Row( MainAxisAlignment.spaceBetween,
children: [ crossAxisAlignment:
Column( CrossAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start, children: [
children: [ Column(
Text( crossAxisAlignment:
' ${plan.tripTitle}', CrossAxisAlignment.start,
style: TextStyle( children: [
fontSize: 12, Text(
fontFamily: "Inter", '${plan.userName.isNotEmpty ? plan.userName : plan.travellerName} ${(plan.employeeCode) ?? ''}',
fontWeight: FontWeight.bold, style: GoogleFonts.poppins(
), fontSize: 10,
color: Colors.black87,
),
),
Text(
'${_formatDate(plan.createdOn)}',
style: GoogleFonts.poppins(
fontSize: 9,
color: Colors.grey,
),
),
],
),
Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
GestureDetector(
onTap:
() => _showDetails(
plan.planId,
),
child: Container(
padding:
EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: getStatusColor(
plan.statusValue,
),
borderRadius:
BorderRadius.circular(
8,
),
),
child: Text(
plan.statusValue,
style: GoogleFonts.poppins(
color:
getStatusTextColor(
plan.statusValue,
),
fontSize: 9,
fontWeight:
FontWeight.w600,
),
),
),
),
],
),
],
), ),
], ],
), ),
], ),
), ),
SizedBox(height: 2),
// Type and Created On
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripType}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
],
),
SizedBox(height: 3),
// Name
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
plan.userName.isNotEmpty
? '${plan.userName}'
: '${plan.travellerName}',
style: TextStyle(
fontSize: 9,
fontFamily: "Inter",
color: Colors.black87,
),
),
],
),
Spacer(),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
plan.employeeCode ?? 'No Data',
style: TextStyle(
fontSize: 9,
fontFamily: "Inter",
color: Colors.black87,
),
),
],
),
],
),
// Actions
// Actions
], ],
), ),
), ),

View File

@ -1386,273 +1386,550 @@ class _ListPlansState extends State<ListPlans> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Status and Employee Code // Status and Employee Code
Row( // Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.spaceBetween, // MainAxisAlignment.spaceBetween,
children: [ // children: [
GestureDetector( // GestureDetector(
onTap: () => _showDetails(plan.planId), // onTap: () => _showDetails(plan.planId),
child: Container( // child: Container(
padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
horizontal: 8, // horizontal: 8,
vertical: 4, // vertical: 4,
), // ),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: getStatusColor( // color: getStatusColor(
plan.statusValue, // plan.statusValue,
), // ),
borderRadius: BorderRadius.circular( // borderRadius: BorderRadius.circular(
8, // 8,
), // ),
), // ),
child: Text( // child: Text(
plan.statusValue, // plan.statusValue,
style: TextStyle( // style: TextStyle(
color: getStatusTextColor( // color: getStatusTextColor(
plan.statusValue, // plan.statusValue,
// ),
// fontSize: 10,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
// ),
// // PlanPopupMenu(
// // plan: plan,
// // deletePlan: deletePlan,
// // apiService: apiService,
// // layoutColor: layoutColor,
// // ),
// PopupMenuButton<int>(
// color: Colors.white,
// padding: EdgeInsets.zero,
// offset: Offset(0, 30),
// icon: Icon(
// Icons.more_vert,
// size: 14,
// color: Color(0xFF475569),
// ),
// itemBuilder:
// (context) => [
// CustomPopupMenuEntry(
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 8,
// ),
// child: Row(
// mainAxisSize:
// MainAxisSize.min,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// IconButton(
// icon: Icon(
// Icons.remove_red_eye,
// color: Color(
// 0xFF475569,
// ),
// size: 18,
// ),
// tooltip:
// 'View The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// ); // Close popup manually
// ApiService.viewPlan(
// context,
// plan.planId,
// isViewMode: true,
// isMyTrips: true,
// );
// },
// ),
// if (plan.statusValue ==
// "Pending Approval" ||
// plan.statusValue ==
// "Partially Approved")
// IconButton(
// icon: Image.asset(
// 'assets/images/IconsImg/edit.png',
// width: 20,
// height: 15,
// ),
// tooltip:
// 'Edit Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// );
// ApiService.viewPlan(
// context,
// plan.planId,
// isViewMode: false,
// isMyTrips: true,
// );
// },
// ),
// IconButton(
// icon: Icon(
// Icons.cancel_rounded,
// size: 18,
// ),
// tooltip:
// 'Cancellation The Trip Details',
// onPressed: () {
// Navigator.pop(context);
// deletePlan(plan.planId);
// },
// ),
// IconButton(
// icon: Icon(
// Icons.download,
// color: Color(
// 0xFF114D8B,
// ),
// size: 18,
// ),
// tooltip:
// 'Download The PDF',
// onPressed: () {
// Navigator.pop(context);
// apiService
// .getPdfDownload(
// plan.planId,
// );
// },
// ),
// IconButton(
// icon: const Icon(
// Icons.comment,
// color: Color(
// 0xFF475569,
// ),
// size: 11,
// ),
// tooltip: 'Trip Comments',
// onPressed: () {
// showDialog(
// context: context,
// builder:
// (
// context,
// ) => CommentModalList(
// // planId: plan.planId,
// planId:
// plan.planId
// .toString(),
// layoutColorForUser:
// layoutColor!,
// role: "User",
// ),
// );
// },
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 2),
// // Trip Id and Trip Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripTitle}',
// style: TextStyle(
// fontSize: 12,
// fontFamily: "Inter",
// fontWeight: FontWeight.bold,
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 2),
// // Type and Created On
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripType}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// '${_formatDate(plan.createdOn)}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 3),
// // Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.userName.isNotEmpty
// ? '${plan.userName}'
// : '${plan.travellerName}',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// Spacer(),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.employeeCode ?? 'No Data',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// ],
// ),
// Actions
Expanded(
child: Container(
// color: Colors.yellow.shade50,
child: Column(
children: [
Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
children: [
Container(
// color: Colors.red.shade50,
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Image.asset(
plan.tripType == 'Domestic'
? 'assets/images/IconsImg/Domestic_new.png'
: 'assets/images/IconsImg/International_new.png',
// width: 65,
height:
plan.tripType ==
'Domestic'
? 28
: 30,
),
],
),
), ),
fontSize: 10, SizedBox(width: 10),
fontWeight: FontWeight.w600, Expanded(
), flex: 1,
), child: Column(
), crossAxisAlignment:
), CrossAxisAlignment.start,
// PlanPopupMenu( children: [
// plan: plan, Text(
// deletePlan: deletePlan, '${plan.tripTitle}',
// apiService: apiService, style: GoogleFonts.poppins(
// layoutColor: layoutColor, fontSize: 12,
// ), fontWeight:
PopupMenuButton<int>( FontWeight.w500,
color: Colors.white,
padding: EdgeInsets.zero,
offset: Offset(0, 30),
icon: Icon(
Icons.more_vert,
size: 14,
color: Color(0xFF475569),
),
itemBuilder:
(context) => [
CustomPopupMenuEntry(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
),
child: Row(
mainAxisSize:
MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
IconButton(
icon: Icon(
Icons.remove_red_eye,
color: Color(
0xFF475569,
),
size: 18,
),
tooltip:
'View The Trip Details',
onPressed: () {
Navigator.pop(
context,
); // Close popup manually
ApiService.viewPlan(
context,
plan.planId,
isViewMode: true,
isMyTrips: true,
);
},
), ),
if (plan.statusValue == ),
"Pending Approval" || ],
plan.statusValue == ),
"Partially Approved") ),
IconButton(
icon: Image.asset( SizedBox(width: 10),
'assets/images/IconsImg/edit.png', Column(
width: 20, children: [
height: 15, PopupMenuButton<int>(
color: Colors.white,
padding: EdgeInsets.zero,
offset: Offset(0, 30),
icon: Icon(
Icons.more_vert,
color: Color(0xFF475569),
size: 14,
),
itemBuilder:
(context) => [
CustomPopupMenuEntry(
child: Container(
padding:
EdgeInsets.symmetric(
horizontal: 1,
vertical: 1,
// horizontal: 8,
// vertical: 8,
), ),
tooltip: child: Row(
'Edit Trip Details', mainAxisSize:
onPressed: () { MainAxisSize
Navigator.pop( .min,
context, mainAxisAlignment:
); MainAxisAlignment
ApiService.viewPlan( .center,
context, children: [
plan.planId, IconButton(
isViewMode: false, icon: Icon(
isMyTrips: true, Icons
); .remove_red_eye,
}, color: Color(
), 0xFF475569,
IconButton( ),
icon: Icon( size: 18,
Icons.cancel_rounded,
size: 18,
),
tooltip:
'Cancellation The Trip Details',
onPressed: () {
Navigator.pop(context);
deletePlan(plan.planId);
},
),
IconButton(
icon: Icon(
Icons.download,
color: Color(
0xFF114D8B,
),
size: 18,
),
tooltip:
'Download The PDF',
onPressed: () {
Navigator.pop(context);
apiService
.getPdfDownload(
plan.planId,
);
},
),
IconButton(
icon: const Icon(
Icons.comment,
color: Color(
0xFF475569,
),
size: 11,
),
tooltip: 'Trip Comments',
onPressed: () {
showDialog(
context: context,
builder:
(
context,
) => CommentModalList(
// planId: plan.planId,
planId:
plan.planId
.toString(),
layoutColorForUser:
layoutColor!,
role: "User",
), ),
); tooltip:
}, 'View The Trip Details',
onPressed: () {
Navigator.pop(
context,
); // Close popup manually
ApiService.viewPlan(
context,
plan.planId,
isViewMode: true,
isMyTrips: true,
);
},
),
if (plan.statusValue ==
"Pending Approval" ||
plan.statusValue ==
"Partially Approved")
IconButton(
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height:
15,
),
tooltip:
'Edit The Trip Details',
onPressed: () {
Navigator.pop(
context,
);
ApiService.viewPlan(
context,
plan.planId,
isViewMode: false,
isMyTrips: true,
);
},
),
IconButton(
icon: Icon(
Icons
.cancel_rounded,
size: 18,
),
tooltip:
'Cancellation The Trip Details',
onPressed: () {
Navigator.pop(context);
deletePlan(plan.planId);
},
),
IconButton(
icon: Icon(
Icons
.download,
color: Color(
0xFF114D8B,
),
size: 18,
),
tooltip:
'Download The PDF',
onPressed: () {
Navigator.pop(context);
apiService
.getPdfDownload(
plan.planId,
);
},
),
IconButton(
icon: const Icon(
Icons
.comment,
color: Color(
0xFF475569,
),
size: 11,
),
tooltip:
'Trip Comments',
onPressed: () {
showDialog(
context: context,
builder:
(
context,
) => CommentModalList(
// planId: plan.planId,
planId:
plan.planId
.toString(),
layoutColorForUser:
layoutColor!,
role: "User",
),
);
},
),
],
),
),
), ),
], ],
), ),
), ],
), ),
], ],
), ),
],
),
SizedBox(height: 2), Row(
// Trip Id and Trip Name mainAxisAlignment:
Row( MainAxisAlignment.spaceBetween,
children: [ crossAxisAlignment:
Column( CrossAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start, children: [
children: [ Column(
Text( crossAxisAlignment:
' ${plan.tripTitle}', CrossAxisAlignment.start,
style: TextStyle( children: [
fontSize: 12, Text(
fontFamily: "Inter", // plan.userName.isNotEmpty
fontWeight: FontWeight.bold, // ? plan.userName
), // : '${plan.travellerName}',
'${plan.userName.isNotEmpty ? plan.userName : plan.travellerName} (${plan.employeeCode ?? 'No Data'})',
style: GoogleFonts.poppins(
fontSize: 10,
color: Colors.black87,
),
),
Text(
'${_formatDate(plan.createdOn)}',
style: GoogleFonts.poppins(
fontSize: 9,
color: Colors.grey,
),
),
],
),
Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
GestureDetector(
onTap:
() => _showDetails(
plan.planId,
),
child: Container(
padding:
EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: getStatusColor(
plan.statusValue,
),
borderRadius:
BorderRadius.circular(
8,
),
),
child: Text(
plan.statusValue,
style: GoogleFonts.poppins(
color:
getStatusTextColor(
plan.statusValue,
),
fontSize: 9,
fontWeight:
FontWeight.w600,
),
),
),
),
],
),
],
), ),
], ],
), ),
], ),
), ),
SizedBox(height: 2),
// Type and Created On
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripType}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
],
),
SizedBox(height: 3),
// Name
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
plan.userName.isNotEmpty
? '${plan.userName}'
: '${plan.travellerName}',
style: TextStyle(
fontSize: 9,
fontFamily: "Inter",
color: Colors.black87,
),
),
],
),
Spacer(),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
plan.employeeCode ?? 'No Data',
style: TextStyle(
fontSize: 9,
fontFamily: "Inter",
color: Colors.black87,
),
),
],
),
],
),
// Actions
// Actions
], ],
), ),
), ),