diff --git a/lib/Screens/approvals/approval_list.dart b/lib/Screens/approvals/approval_list.dart index 05e1b14..f02dabf 100644 --- a/lib/Screens/approvals/approval_list.dart +++ b/lib/Screens/approvals/approval_list.dart @@ -1395,277 +1395,550 @@ class _ApprovalListState extends State { ), 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), - 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, + // 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( + // 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, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - PopupMenuButton( - 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, - ); - }, + SizedBox(width: 10), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + ' ${plan.tripTitle}', + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: + FontWeight.w500, ), - 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, + SizedBox(width: 10), + Column( + children: [ + PopupMenuButton( + 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, ), - 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: + 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, + ); // 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 .toString(), - layoutColorForUser: + layoutColorForUser: layoutColor!, - role: + 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, - ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.end, + + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '${plan.userName.isNotEmpty ? plan.userName : plan.travellerName} ${(plan.employeeCode) ?? ''}', + 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 ], ), ), diff --git a/lib/Screens/plans/list_plans.dart b/lib/Screens/plans/list_plans.dart index 10e0735..f76b84a 100644 --- a/lib/Screens/plans/list_plans.dart +++ b/lib/Screens/plans/list_plans.dart @@ -1386,273 +1386,550 @@ class _ListPlansState extends State { 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, + // 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( + // 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, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - // PlanPopupMenu( - // plan: plan, - // deletePlan: deletePlan, - // apiService: apiService, - // layoutColor: layoutColor, - // ), - PopupMenuButton( - 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, - ); - }, + SizedBox(width: 10), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '${plan.tripTitle}', + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: + FontWeight.w500, ), - if (plan.statusValue == - "Pending Approval" || - plan.statusValue == - "Partially Approved") - IconButton( - icon: Image.asset( - 'assets/images/IconsImg/edit.png', - width: 20, - height: 15, + ), + ], + ), + ), + + SizedBox(width: 10), + Column( + children: [ + PopupMenuButton( + 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: - '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", + 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 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), - // Trip Id and Trip Name - Row( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - ' ${plan.tripTitle}', - style: TextStyle( - fontSize: 12, - fontFamily: "Inter", - fontWeight: FontWeight.bold, - ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.end, + + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + // 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, + ), + ), + 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 ], ), ),