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,38 +1395,324 @@ class _ApprovalListState extends State<ApprovalList> {
),
elevation: 3,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
padding: const EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Status and Employee Code
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () => _showDetails(plan.planId),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// 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: TextStyle(
// color: getStatusTextColor(
// 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(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
// 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,
),
decoration: BoxDecoration(
color: getStatusColor(plan.statusValue),
borderRadius: BorderRadius.circular(8),
),
child: Text(
plan.statusValue,
style: TextStyle(
color: getStatusTextColor(
plan.statusValue,
),
fontSize: 10,
fontWeight: FontWeight.w600,
],
),
),
SizedBox(width: 10),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripTitle}',
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight:
FontWeight.w500,
),
),
],
),
),
SizedBox(width: 10),
Column(
children: [
PopupMenuButton<int>(
color: Colors.white,
padding: EdgeInsets.zero,
@ -1440,19 +1726,25 @@ class _ApprovalListState extends State<ApprovalList> {
(context) => [
CustomPopupMenuEntry(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
padding:
EdgeInsets.symmetric(
horizontal: 1,
vertical: 1,
// horizontal: 8,
// vertical: 8,
),
child: Row(
mainAxisSize:
MainAxisSize.min,
MainAxisSize
.min,
mainAxisAlignment:
MainAxisAlignment.center,
MainAxisAlignment
.center,
children: [
IconButton(
icon: Icon(
Icons.remove_red_eye,
Icons
.remove_red_eye,
color: Color(
0xFF475569,
),
@ -1481,32 +1773,28 @@ class _ApprovalListState extends State<ApprovalList> {
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height: 15,
height:
15,
),
tooltip:
'Edit The Trip Details',
onPressed: () {
Navigator.pop(
context,
);
print(
"Approver Edit3 : ${plan.approver_status}",
);
ApiService.viewPlanForApprover(
context,
); // Close popup manually
viewPlanforApprover(
plan.planId,
plan.approverId,
plan.delegaterId,
plan.approver_status,
isViewMode: false,
isViewMode: true,
isApprover: true,
);
},
),
IconButton(
icon: Icon(
Icons.cancel_rounded,
Icons
.cancel_rounded,
size: 18,
),
tooltip:
@ -1518,7 +1806,8 @@ class _ApprovalListState extends State<ApprovalList> {
),
IconButton(
icon: Icon(
Icons.download,
Icons
.download,
color: Color(
0xFF114D8B,
),
@ -1536,13 +1825,15 @@ class _ApprovalListState extends State<ApprovalList> {
),
IconButton(
icon: const Icon(
Icons.comment,
Icons
.comment,
color: Color(
0xFF475569,
),
size: 11,
),
tooltip: 'Trip Comments',
tooltip:
'Trip Comments',
onPressed: () {
showDialog(
context: context,
@ -1570,102 +1861,84 @@ class _ApprovalListState extends State<ApprovalList> {
),
],
),
],
),
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,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripType}',
style: TextStyle(
fontSize: 9,
'${plan.userName.isNotEmpty ? plan.userName : plan.travellerName} ${(plan.employeeCode) ?? ''}',
style: GoogleFonts.poppins(
fontSize: 10,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
color: Colors.grey,
),
),
],
),
],
),
SizedBox(height: 3),
// Name
Row(
children: [
Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment.end,
children: [
Text(
plan.userName.isNotEmpty
? '${plan.userName}'
: '${plan.travellerName}',
style: TextStyle(
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,
fontFamily: "Inter",
color: Colors.black87,
fontWeight:
FontWeight.w600,
),
),
],
),
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,69 +1386,356 @@ class _ListPlansState extends State<ListPlans> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Status and Employee Code
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
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: TextStyle(
color: getStatusTextColor(
plan.statusValue,
),
fontSize: 10,
fontWeight: FontWeight.w600,
),
),
),
),
// PlanPopupMenu(
// plan: plan,
// deletePlan: deletePlan,
// apiService: apiService,
// layoutColor: layoutColor,
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// 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: TextStyle(
// color: getStatusTextColor(
// 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,
),
],
),
),
SizedBox(width: 10),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${plan.tripTitle}',
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight:
FontWeight.w500,
),
),
],
),
),
SizedBox(width: 10),
Column(
children: [
PopupMenuButton<int>(
color: Colors.white,
padding: EdgeInsets.zero,
offset: Offset(0, 30),
icon: Icon(
Icons.more_vert,
size: 14,
color: Color(0xFF475569),
size: 14,
),
itemBuilder:
(context) => [
CustomPopupMenuEntry(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
padding:
EdgeInsets.symmetric(
horizontal: 1,
vertical: 1,
// horizontal: 8,
// vertical: 8,
),
child: Row(
mainAxisSize:
MainAxisSize.min,
MainAxisSize
.min,
mainAxisAlignment:
MainAxisAlignment.center,
MainAxisAlignment
.center,
children: [
IconButton(
icon: Icon(
Icons.remove_red_eye,
Icons
.remove_red_eye,
color: Color(
0xFF475569,
),
@ -1476,10 +1763,11 @@ class _ListPlansState extends State<ListPlans> {
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height: 15,
height:
15,
),
tooltip:
'Edit Trip Details',
'Edit The Trip Details',
onPressed: () {
Navigator.pop(
context,
@ -1494,7 +1782,8 @@ class _ListPlansState extends State<ListPlans> {
),
IconButton(
icon: Icon(
Icons.cancel_rounded,
Icons
.cancel_rounded,
size: 18,
),
tooltip:
@ -1506,7 +1795,8 @@ class _ListPlansState extends State<ListPlans> {
),
IconButton(
icon: Icon(
Icons.download,
Icons
.download,
color: Color(
0xFF114D8B,
),
@ -1524,13 +1814,15 @@ class _ListPlansState extends State<ListPlans> {
),
IconButton(
icon: const Icon(
Icons.comment,
Icons
.comment,
color: Color(
0xFF475569,
),
size: 11,
),
tooltip: 'Trip Comments',
tooltip:
'Trip Comments',
onPressed: () {
showDialog(
context: context,
@ -1557,102 +1849,87 @@ class _ListPlansState extends State<ListPlans> {
),
],
),
],
),
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,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripType}',
style: TextStyle(
fontSize: 9,
// plan.userName.isNotEmpty
// ? plan.userName
// : '${plan.travellerName}',
'${plan.userName.isNotEmpty ? plan.userName : plan.travellerName} (${plan.employeeCode ?? 'No Data'})',
style: GoogleFonts.poppins(
fontSize: 10,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
color: Colors.grey,
),
),
],
),
],
),
SizedBox(height: 3),
// Name
Row(
children: [
Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
CrossAxisAlignment.end,
children: [
Text(
plan.userName.isNotEmpty
? '${plan.userName}'
: '${plan.travellerName}',
style: TextStyle(
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,
fontFamily: "Inter",
color: Colors.black87,
fontWeight:
FontWeight.w600,
),
),
],
),
Spacer(),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
plan.employeeCode ?? 'No Data',
style: TextStyle(
fontSize: 9,
fontFamily: "Inter",
color: Colors.black87,
),
),
],
),
],
),
// Actions
// Actions
],
),
),
),
],
),
),