list
This commit is contained in:
parent
41010df10f
commit
d476f467ad
@ -763,7 +763,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
Icons.remove_red_eye,
|
Icons.remove_red_eye,
|
||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 18),
|
size: 18),
|
||||||
tooltip: 'View Trips',
|
tooltip: 'View The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context); // Close popup manually
|
||||||
@ -777,6 +777,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15),
|
||||||
|
tooltip: 'Edit The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
ApiService.viewPlan(
|
ApiService.viewPlan(
|
||||||
@ -788,7 +789,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
size: 18),
|
size: 18),
|
||||||
tooltip: 'Cancellation Trips',
|
tooltip: 'Cancellation The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
deletePlan(plan.planId);
|
deletePlan(plan.planId);
|
||||||
@ -798,7 +799,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
icon: Icon(Icons.download,
|
icon: Icon(Icons.download,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
size: 18),
|
size: 18),
|
||||||
tooltip: 'Download Trips Detials',
|
tooltip: 'Download The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(
|
apiService.getPdfDownload(
|
||||||
@ -811,7 +812,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
tooltip: 'Trips Comments',
|
tooltip: 'Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -747,6 +747,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
color:
|
color:
|
||||||
Color(0xFF475569),
|
Color(0xFF475569),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'View The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context); // Close popup manually
|
||||||
@ -760,6 +761,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15),
|
||||||
|
tooltip: 'Edit The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print(
|
print(
|
||||||
"Approver Edit : ${plan.approverId}");
|
"Approver Edit : ${plan.approverId}");
|
||||||
@ -780,6 +782,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Cancellation The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
deletePlan(plan.planId);
|
deletePlan(plan.planId);
|
||||||
@ -789,6 +792,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
icon: Icon(Icons.download,
|
icon: Icon(Icons.download,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Download The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(
|
apiService.getPdfDownload(
|
||||||
@ -801,6 +805,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
|
tooltip: 'Approver Comment',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -946,6 +951,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
color:
|
color:
|
||||||
Color(0xFF475569),
|
Color(0xFF475569),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'View The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context); // Close popup manually
|
||||||
@ -959,6 +965,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15),
|
||||||
|
tooltip: 'Edit The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
ApiService
|
ApiService
|
||||||
@ -975,6 +982,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Cancellation The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
deletePlan(plan.planId);
|
deletePlan(plan.planId);
|
||||||
@ -984,6 +992,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
icon: Icon(Icons.download,
|
icon: Icon(Icons.download,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Download The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(
|
apiService.getPdfDownload(
|
||||||
@ -996,6 +1005,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
|
tooltip: 'Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -535,10 +535,14 @@ class CostCenterListState extends State<CostCenterList> {
|
|||||||
// apiService.getSingleUser(id),
|
// apiService.getSingleUser(id),
|
||||||
// ),
|
// ),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit CostCenter Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
@ -611,10 +615,14 @@ class CostCenterListState extends State<CostCenterList> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit CostCenter Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
|
|||||||
@ -619,10 +619,14 @@ class DepartmentListState extends State<DepartmentList> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit Department Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
|
|||||||
@ -722,10 +722,14 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
// apiService.getSingleUser(id),
|
// apiService.getSingleUser(id),
|
||||||
// ),
|
// ),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit ForEx Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
@ -798,10 +802,14 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit Forex Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
@ -1040,4 +1048,6 @@ class ForexDataListState extends State<ForexDataList> {
|
|||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -603,10 +603,14 @@ class HotelsDataListState extends State<HotelsDataList> {
|
|||||||
// apiService.getSingleUser(id),
|
// apiService.getSingleUser(id),
|
||||||
// ),
|
// ),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Delete Hotel Details',
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/delete.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// final userId = getUserId(user['user_id']);
|
// final userId = getUserId(user['user_id']);
|
||||||
// final usersData = await getUserDetails(userId);
|
// final usersData = await getUserDetails(userId);
|
||||||
|
|||||||
@ -245,14 +245,26 @@ class AccomodationListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Accomodation"),
|
onTap: () => onOpen(true, item, "Accomodation"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Accomodation Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteAccommodation(item),
|
onTap: () => onDeleteAccommodation(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Accommodation Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -224,14 +224,26 @@ class BusListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Bus"),
|
onTap: () => onOpen(true, item, "Bus"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Edit Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteBus(item),
|
onTap: () => onDeleteBus(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Bus Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -290,14 +290,26 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => widget.onOpen(true, item, "Flight"),
|
onTap: () => widget.onOpen(true, item, "Flight"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Flight Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => widget.onDeleteFlight(item),
|
onTap: () => widget.onDeleteFlight(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Flight Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -261,14 +261,26 @@ class ForexListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Forex"),
|
onTap: () => onOpen(true, item, "Forex"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Forex Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteForex(item),
|
onTap: () => onDeleteForex(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Forex Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
item['forex_id'] != null
|
item['forex_id'] != null
|
||||||
? IconButton(
|
? IconButton(
|
||||||
|
|||||||
@ -202,14 +202,26 @@ class InsuranceListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Insurance"),
|
onTap: () => onOpen(true, item, "Insurance"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Insurance Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteInsurance(item),
|
onTap: () => onDeleteInsurance(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Insurance Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -445,14 +457,26 @@ class InsuranceListWidget extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Insurance"),
|
onTap: () => onOpen(true, item, "Insurance"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Insurance Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteInsurance(item),
|
onTap: () => onDeleteInsurance(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Insurance Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.keyboard_arrow_down_outlined,
|
icon: Icon(Icons.keyboard_arrow_down_outlined,
|
||||||
|
|||||||
@ -162,14 +162,26 @@ class MiscellaneousListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Miscellaneous"),
|
onTap: () => onOpen(true, item, "Miscellaneous"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Miscellaneous Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Miscellaneous"),
|
onTap: () => onOpen(true, item, "Miscellaneous"),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Miscellaneous Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -246,14 +246,26 @@ class TaxiListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Taxi"),
|
onTap: () => onOpen(true, item, "Taxi"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Taxi Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => (item),
|
onTap: () => (item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Taxi Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -333,14 +333,26 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => widget.onOpen(true, item, "Train"),
|
onTap: () => widget.onOpen(true, item, "Train"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Train Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => widget.onDeleteTrain(item),
|
onTap: () => widget.onDeleteTrain(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Train Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -301,14 +301,26 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
Spacer(),
|
Spacer(),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onOpen(true, item, "Visa"),
|
onTap: () => onOpen(true, item, "Visa"),
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Visa Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => onDeleteMiscellaneous(item),
|
onTap: () => onDeleteMiscellaneous(item),
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Visa Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -827,6 +827,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
Icons.remove_red_eye,
|
Icons.remove_red_eye,
|
||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'View The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context); // Close popup manually
|
||||||
@ -845,6 +846,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15),
|
||||||
|
tooltip: 'Edit Trip/Plans Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
ApiService.viewPlan(
|
ApiService.viewPlan(
|
||||||
@ -857,6 +859,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Cancellation The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
deletePlan(plan.planId);
|
deletePlan(plan.planId);
|
||||||
@ -866,6 +869,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
icon: Icon(Icons.download,
|
icon: Icon(Icons.download,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Download The Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(
|
apiService.getPdfDownload(
|
||||||
@ -878,6 +882,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
|
tooltip: 'Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -1023,6 +1028,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
Icons.remove_red_eye,
|
Icons.remove_red_eye,
|
||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'View The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context); // Close popup manually
|
context); // Close popup manually
|
||||||
@ -1041,6 +1047,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 15),
|
height: 15),
|
||||||
|
tooltip: 'Edit Trip/plan Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
ApiService.viewPlan(
|
ApiService.viewPlan(
|
||||||
@ -1053,6 +1060,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Cancellation The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
deletePlan(plan.planId);
|
deletePlan(plan.planId);
|
||||||
@ -1062,6 +1070,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
icon: Icon(Icons.download,
|
icon: Icon(Icons.download,
|
||||||
color: Color(0xFF114D8B),
|
color: Color(0xFF114D8B),
|
||||||
size: 18),
|
size: 18),
|
||||||
|
tooltip: 'Download The Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(
|
apiService.getPdfDownload(
|
||||||
@ -1074,6 +1083,7 @@ class _ListPlansState extends State<ListPlans> {
|
|||||||
color: Color(0xFF475569),
|
color: Color(0xFF475569),
|
||||||
size: 11,
|
size: 11,
|
||||||
),
|
),
|
||||||
|
tooltip: 'Trip Comments',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -1,17 +1,19 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:frontend/Screens/group/group.dart';
|
import 'package:frontend/utils/auth_utils.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:responsive_builder/responsive_builder.dart';
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../config/apiUrl.dart';
|
import '../../config/apiUrl.dart';
|
||||||
import '../../routes/custom_appBar.dart';
|
import '../../routes/custom_appBar.dart';
|
||||||
import '../../routes/custom_drawer.dart';
|
import '../../routes/custom_drawer.dart';
|
||||||
import '../../services/apiService.dart';
|
import '../../services/apiService.dart';
|
||||||
import '../../utils/auth_utils.dart';
|
import '../../utils/pagination.dart';
|
||||||
|
import '../../widgets/custom_popup.dart';
|
||||||
|
import '../../widgets/popup_userList_action.dart';
|
||||||
|
|
||||||
class PolicyList extends StatefulWidget {
|
class PolicyList extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@ -20,19 +22,42 @@ class PolicyList extends StatefulWidget {
|
|||||||
|
|
||||||
class _PolicyListState extends State<PolicyList> {
|
class _PolicyListState extends State<PolicyList> {
|
||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
List<dynamic>? apiAllGroups;
|
List<dynamic>? apiAllGroups;
|
||||||
|
late Future<List<dynamic>> futureUsers;
|
||||||
|
|
||||||
|
late Map<String, dynamic> userSingleData;
|
||||||
|
List<dynamic>? apiCountryData;
|
||||||
|
String? selectedUserId;
|
||||||
|
String? orgId;
|
||||||
|
|
||||||
Color? layoutColor;
|
Color? layoutColor;
|
||||||
Color? bodyColor;
|
Color? bodyColor;
|
||||||
|
|
||||||
|
List allUsers = [];
|
||||||
|
List filteredUsers = [];
|
||||||
|
TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
int currentPage = 0;
|
||||||
|
int itemsPerPage = 10;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
futureUsers = fetchUsers();
|
||||||
|
|
||||||
|
futureUsers.then((users) {
|
||||||
|
setState(() {
|
||||||
|
allUsers = users;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
loadAllGroups();
|
fetchCountryList();
|
||||||
loadInitialData();
|
loadInitialData();
|
||||||
|
loadAllGroups();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// futurePlans = fetchPlans();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadInitialData() async {
|
void loadInitialData() async {
|
||||||
@ -70,6 +95,238 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> getToken() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
return prefs.getString('auth_token');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<List<dynamic>> fetchSingleUsers(userId) async {
|
||||||
|
// orgId = await getOrgId();
|
||||||
|
// final String apiUrlData = '$apiUrl/api/users/find/$userId';
|
||||||
|
//
|
||||||
|
// final String? token = await getToken();
|
||||||
|
//
|
||||||
|
// print("Fetch Users");
|
||||||
|
// print("TOEKRWE: $token");
|
||||||
|
//
|
||||||
|
// if (token == null) {
|
||||||
|
// throw Exception('Token not found. Please log in.');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final response = await http.get(
|
||||||
|
// Uri.parse(apiUrlData),
|
||||||
|
// headers: {
|
||||||
|
// 'Authorization': 'Bearer $token',
|
||||||
|
// 'Content-Type': 'application/json',
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (response.statusCode == 200) {
|
||||||
|
// final data = json.decode(response.body);
|
||||||
|
// return data['data']; // Returning raw JSON list
|
||||||
|
// } else {
|
||||||
|
// throw Exception('Failed to load users');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<List<dynamic>> fetchUsers() async {
|
||||||
|
orgId = await getOrgId();
|
||||||
|
final String apiUrlData = '$apiUrl/api/users?org_id=$orgId';
|
||||||
|
final String? token = await getToken();
|
||||||
|
|
||||||
|
print("Fetch Users");
|
||||||
|
print("TOEKRWE: $token");
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('Token not found. Please log in.');
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(apiUrlData),
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final data = json.decode(response.body);
|
||||||
|
return data['data']; // Returning raw JSON list
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load users');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> fetchCountryList() async {
|
||||||
|
final String apiUrldata = '$apiUrl/api/getcountryMaster';
|
||||||
|
|
||||||
|
final token = await getToken();
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('Token not found. Please log in.');
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(apiUrldata),
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
try {
|
||||||
|
final data = json.decode(response.body);
|
||||||
|
print("Country - $data");
|
||||||
|
|
||||||
|
if (!data.containsKey('data') || data['data'] is! List) {
|
||||||
|
throw Exception(
|
||||||
|
"Invalid response format: 'data' field is missing or not a List");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<dynamic> plansJson = data['data']; // 'data' is a Map, not a List
|
||||||
|
|
||||||
|
if (data['data'] is List) {
|
||||||
|
List<dynamic> plansJson = data['data'];
|
||||||
|
print("plansJson.length - ${plansJson.length}");
|
||||||
|
} else {
|
||||||
|
print("The 'data' key does not contain a list.");
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
apiCountryData = plansJson; // Store API response in state
|
||||||
|
});
|
||||||
|
print('plansJSONContry - $plansJson');
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('Error parsing response: $e');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load plans');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleDelete(userId) {
|
||||||
|
print("handDel - $userId");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> createUserData(
|
||||||
|
Map<String, dynamic> userData, String userId, String newStatus) async {
|
||||||
|
final uri = Uri.parse('$apiUrl/api/users/update/$userId');
|
||||||
|
|
||||||
|
final String? token = await getToken();
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('Token not found. Please log in.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use MultipartRequest (POST only)
|
||||||
|
final request = http.MultipartRequest('POST', uri);
|
||||||
|
request.headers['Authorization'] = 'Bearer $token';
|
||||||
|
|
||||||
|
// If updating, spoof the method Laravel-style
|
||||||
|
|
||||||
|
request.fields['_method'] = 'PUT';
|
||||||
|
request.fields['user_id'] = userId;
|
||||||
|
|
||||||
|
print("STatus 2 - $newStatus");
|
||||||
|
|
||||||
|
// Add all non-null and non-empty user data fields
|
||||||
|
userData.forEach((key, value) {
|
||||||
|
if (value != null && value.toString().trim().isNotEmpty) {
|
||||||
|
request.fields[key] = value.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
request.fields['is_active'] = newStatus;
|
||||||
|
|
||||||
|
print("🚀 Sending request with fields: ${request.fields}");
|
||||||
|
|
||||||
|
try {
|
||||||
|
final streamedResponse = await request.send();
|
||||||
|
final response = await http.Response.fromStream(streamedResponse);
|
||||||
|
print("Response status: ${response.statusCode}");
|
||||||
|
print("Response body: ${response.body}");
|
||||||
|
|
||||||
|
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||||
|
print("✅ User Status submitted successfully! ");
|
||||||
|
print("📨 Response: ${response.body}");
|
||||||
|
|
||||||
|
refreshUserList();
|
||||||
|
} else {
|
||||||
|
print("❌ Submission failed. Status: ${response.statusCode}");
|
||||||
|
print("📨 Body: ${response.body}");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("🔥 Error submitting user: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleToggleUserStatus(String userId, String currentStatus,
|
||||||
|
Map<String, dynamic> userData) async {
|
||||||
|
print("Toggling user status - $userId (Current: $currentStatus)");
|
||||||
|
|
||||||
|
final String apiUrlData =
|
||||||
|
'$apiUrl/api/users/update/$userId'; // API for updating user
|
||||||
|
final String? token = await getToken();
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
print("Error: Token not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle status: If active ("1"), set to inactive ("0"); otherwise, activate ("1")
|
||||||
|
String newStatus = (currentStatus == "1") ? "0" : "1";
|
||||||
|
|
||||||
|
print("STatus 1 - $newStatus");
|
||||||
|
|
||||||
|
createUserData(userData, userId, newStatus);
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// final response = await http.put(
|
||||||
|
// Uri.parse(apiUrlData),
|
||||||
|
// headers: {
|
||||||
|
// 'Authorization': 'Bearer $token',
|
||||||
|
// 'Content-Type': 'application/json',
|
||||||
|
// },
|
||||||
|
// body: jsonEncode({
|
||||||
|
// "is_active": newStatus // Set new status dynamically
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (response.statusCode == 200) {
|
||||||
|
// print("User status updated successfully to $newStatus!");
|
||||||
|
// refreshUserList(); // Refresh users list after update
|
||||||
|
// } else {
|
||||||
|
// print("Failed to update user status. Status: ${response.statusCode}");
|
||||||
|
// print("Error: ${response.body}");
|
||||||
|
// }
|
||||||
|
// } catch (e) {
|
||||||
|
// print("Error updating user status: $e");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh user list after update
|
||||||
|
void refreshUserList() {
|
||||||
|
setState(() {
|
||||||
|
futureUsers = fetchUsers(); // Re-fetch users after status update
|
||||||
|
// Wait for futurePlans to be fetched and update allPlans
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void filterUsers(String query) {
|
||||||
|
print("allUsers before filtering: $query");
|
||||||
|
final lowerQuery = query.toLowerCase();
|
||||||
|
setState(() {
|
||||||
|
filteredUsers = allUsers.where((user) {
|
||||||
|
return (user['first_name']?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
|
(user['last_name']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
|
(user['email']?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
|
(user['role_value']?.toLowerCase().contains(lowerQuery) ?? false);
|
||||||
|
}).toList();
|
||||||
|
});
|
||||||
|
print("filteredPlans: $filteredUsers");
|
||||||
|
}
|
||||||
|
|
||||||
void handleActiveStatus(
|
void handleActiveStatus(
|
||||||
Map<String, dynamic> policyData,
|
Map<String, dynamic> policyData,
|
||||||
String policyId,
|
String policyId,
|
||||||
@ -133,15 +390,6 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
handleActiveStatus(policydata, policyId.toString(), status.toString());
|
handleActiveStatus(policydata, policyId.toString(), status.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> deleteGroupFromApi(int groupId) async {
|
|
||||||
// try {
|
|
||||||
// await apiService.deleteGroup(groupId); // your delete API call
|
|
||||||
// deleteGroup(groupId); // remove from UI list
|
|
||||||
// } catch (e) {
|
|
||||||
// print('Error deleting group: $e');
|
|
||||||
// }
|
|
||||||
// }'
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
||||||
@ -149,6 +397,8 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Color(0xFFf5f5f5),
|
backgroundColor: Color(0xFFf5f5f5),
|
||||||
|
// appBar: isDesktop ? null : const CustomAppBar(title: 'User Management'),
|
||||||
|
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||||
appBar: CustomAppBar(isDesktop: isDesktop),
|
appBar: CustomAppBar(isDesktop: isDesktop),
|
||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
@ -163,7 +413,8 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||||
Expanded(child: buildGroupList(isDesktop))
|
// const Expanded(child: Center(child: Text("User Page Content"))),
|
||||||
|
Expanded(child: buildGroupList(isDesktop)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -174,23 +425,23 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
Widget buildGroupList(bool isDesktop) {
|
Widget buildGroupList(bool isDesktop) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: isDesktop ? const EdgeInsets.only(top: 10.0, bottom: 10.0) : null,
|
margin: isDesktop ? const EdgeInsets.only(top: 10.0, bottom: 10.0) : null,
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10, top: 8),
|
padding: const EdgeInsets.all(1),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isDesktop ? Colors.white : Color(0xFFFCFCFC),
|
color: isDesktop ? Colors.white : Color(0xFFFCFCFC),
|
||||||
),
|
),
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// // color: Colors.amber,
|
// // color: Colors.amber,
|
||||||
// color: Color(0xFFE1F5FE),
|
|
||||||
// // color: bodyColor,
|
// // color: bodyColor,
|
||||||
|
// color: Color(0xFFE1F5FE),
|
||||||
// border: Border.all(
|
// border: Border.all(
|
||||||
// // color: Color(0xFFF7F7FB),
|
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
|
// // color: Color(0xFFF7F7FB),
|
||||||
// width: 3.5)),
|
// width: 3.5)),
|
||||||
child: buildGroupListLayout(isDesktop),
|
child: buildUserTable(isDesktop),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildGroupListLayout(bool isDesktop) {
|
Widget buildUserTable(bool isDesktop) {
|
||||||
return Container(
|
return Container(
|
||||||
// margin: isDesktop
|
// margin: isDesktop
|
||||||
// ? EdgeInsets.all(10.0)
|
// ? EdgeInsets.all(10.0)
|
||||||
@ -199,63 +450,113 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
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(
|
|
||||||
// border: isDesktop
|
child: Padding(
|
||||||
// ? Border.all(
|
padding: const EdgeInsets.all(10.0),
|
||||||
// width: 2,
|
child: Container(
|
||||||
// color: Colors.white,
|
color: Colors.white,
|
||||||
// // color: Color(0xFFF7F7FB),
|
padding: const EdgeInsets.all(10.0),
|
||||||
// )
|
|
||||||
// : null,
|
|
||||||
// color: Colors.white,
|
|
||||||
// // color: Color(0xFFF7F7FB),
|
|
||||||
//
|
|
||||||
// // color: Colors.amber,
|
|
||||||
// ),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
// Divider(
|
||||||
|
// thickness: 0.2, // how "thick" the line is
|
||||||
|
// color: Colors.grey, // optional
|
||||||
|
// ),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Policy List',
|
'Users',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: isDesktop ? 16 : 14,
|
fontSize: isDesktop ? 16 : 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.keyboard_arrow_down),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.28,
|
||||||
|
),
|
||||||
|
|
||||||
|
if (isDesktop)
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.2,
|
||||||
|
height: 40,
|
||||||
|
child: TextField(
|
||||||
|
controller: searchController,
|
||||||
|
onChanged: filterUsers,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: "Search for a User",
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 12, color: Color(0xFF9E9DBD)),
|
||||||
|
prefixIcon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Color(0xFF9E9DBD),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey.shade200, width: 0.5),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey.shade300, width: 1),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// SizedBox(width: 16),
|
||||||
|
Spacer(),
|
||||||
|
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
|
||||||
backgroundColor: Color(0xFF114D8B),
|
backgroundColor: Color(0xFF114D8B),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
disabledBackgroundColor: Color(0xFF114D8B),
|
||||||
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
// side: BorderSide(color: , width: 1),
|
side:
|
||||||
|
BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 20, vertical: 12),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// List<dynamic> users = await futureUsers;
|
List<dynamic> users = await futureUsers;
|
||||||
|
|
||||||
|
// Print the resolved value
|
||||||
|
print("CREATELIAS - $users");
|
||||||
|
|
||||||
context.go('/Policy');
|
context.go('/Policy');
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisSize:
|
||||||
|
MainAxisSize.min, // Ensures content fits nicely
|
||||||
children: [
|
children: [
|
||||||
Text('New Policy',
|
Text(
|
||||||
style: GoogleFonts.poppins(fontSize: 12)),
|
"Add Policy",
|
||||||
SizedBox(
|
style: GoogleFonts.poppins(
|
||||||
width: 5,
|
fontSize: isDesktop ? 13 : 11,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 8), // spacing between icon and text
|
||||||
Icon(
|
Icon(
|
||||||
Icons.add_circle_outline_rounded,
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 15,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -263,57 +564,272 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
if (!isDesktop)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Row(
|
isDesktop
|
||||||
|
? SizedBox.shrink()
|
||||||
|
: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Container(
|
||||||
child: Container(
|
width: MediaQuery.of(context).size.width * 0.8,
|
||||||
height: MediaQuery.of(context).size.height * 0.8,
|
height: 35,
|
||||||
padding: const EdgeInsets.all(10),
|
child: TextField(
|
||||||
// margin: const EdgeInsets.only(bottom: 10),
|
controller: searchController,
|
||||||
color: Colors.white,
|
onChanged: filterUsers,
|
||||||
// color: Colors.red.shade100,
|
decoration: InputDecoration(
|
||||||
child: SingleChildScrollView(
|
hintText: "Search for a User",
|
||||||
scrollDirection: Axis.vertical,
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 12, color: Color(0xFF9E9DBD)),
|
||||||
|
prefixIcon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Color(0xFF9E9DBD),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey.shade200,
|
||||||
|
width: 0.5),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Colors.grey.shade300, width: 1),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// SizedBox(width: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
FutureBuilder<List<dynamic>>(
|
||||||
|
future: futureUsers,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
} else if (snapshot.hasError ||
|
||||||
|
!snapshot.hasData ||
|
||||||
|
snapshot.data!.isEmpty) {
|
||||||
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
buildGroupListView(isDesktop),
|
// const Icon(Icons.error_outline,
|
||||||
|
// color: Colors.redAccent, size: 60),
|
||||||
|
// const SizedBox(height: 16),
|
||||||
|
// Text(
|
||||||
|
// "Oops!",
|
||||||
|
// style: GoogleFonts.poppins(
|
||||||
|
// fontSize: 20,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// color: Colors.redAccent),
|
||||||
|
// ),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
"No Policy Available",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Text(
|
||||||
|
"Please Create Policy",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 16, color: Colors.grey),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget buildGroupListView(bool isDesktop) {
|
List<dynamic> users =
|
||||||
// return Container(
|
filteredUsers.isNotEmpty ? filteredUsers : allUsers;
|
||||||
// child: Text("DAta"),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
Widget buildGroupListView(bool isDesktop) {
|
users.sort((a, b) {
|
||||||
if (apiAllGroups == null || apiAllGroups!.isEmpty) {
|
DateTime dateA = DateTime.parse(a['created_on']);
|
||||||
return Center(child: Text("No groups found."));
|
DateTime dateB = DateTime.parse(b['created_on']);
|
||||||
|
|
||||||
|
return dateB
|
||||||
|
.compareTo(dateA); // Descending: newest first
|
||||||
|
});
|
||||||
|
|
||||||
|
List paginatedUser = users
|
||||||
|
.skip(currentPage * itemsPerPage)
|
||||||
|
.take(itemsPerPage)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
Widget table = LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
double minWidth =
|
||||||
|
isDesktop ? constraints.maxWidth : 1300;
|
||||||
|
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(minWidth: minWidth),
|
||||||
|
child: DataTable(
|
||||||
|
dividerThickness: 0.5,
|
||||||
|
columnSpacing: isDesktop ? 24.0 : 16.0,
|
||||||
|
border: TableBorder(
|
||||||
|
horizontalInside: BorderSide(
|
||||||
|
width: 0.5, color: Colors.grey.shade200),
|
||||||
|
),
|
||||||
|
columns: [
|
||||||
|
DataColumn(
|
||||||
|
label: Text(
|
||||||
|
'Policy Name',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
DataColumn(
|
||||||
|
label: Text(
|
||||||
|
'Policy Type',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
DataColumn(
|
||||||
|
label: Text(
|
||||||
|
'Status',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
DataColumn(
|
||||||
|
label: Text(
|
||||||
|
'Actions',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
rows: paginatedUser.map((user) {
|
||||||
|
String userId =
|
||||||
|
user['user_id'].toString(); // Get user ID
|
||||||
|
bool isSelected = selectedUserId == userId;
|
||||||
|
|
||||||
|
return DataRow(cells: [
|
||||||
|
DataCell(Text(
|
||||||
|
"${user['name'] ?? ''}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontFamily: "Inter",
|
||||||
|
))),
|
||||||
|
DataCell(Text( user['domestic'] == "1"
|
||||||
|
? "Domestic"
|
||||||
|
: "International",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontFamily: "Inter",
|
||||||
|
))),
|
||||||
|
DataCell(GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
handleToggleUserStatus(user['user_id'],
|
||||||
|
user['is_active'], user);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
user['is_active'] == "1"
|
||||||
|
? "Active"
|
||||||
|
: "Inactive",
|
||||||
|
style: TextStyle(
|
||||||
|
color: user['is_active'] == "1"
|
||||||
|
? Colors.green
|
||||||
|
: Colors.grey,
|
||||||
|
fontFamily: "Inter",
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
))),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
final rawId = user['policy_id'];
|
||||||
|
final intPolicyId = rawId is int
|
||||||
|
? rawId
|
||||||
|
: int.tryParse(rawId.toString()) ?? 0;
|
||||||
|
|
||||||
|
Map<String, dynamic> policyData =
|
||||||
|
await apiService.getSinglePolicy(intPolicyId);
|
||||||
|
|
||||||
|
print("PolicyDATa: $policyData");
|
||||||
|
|
||||||
|
context.go("/Policy", extra: policyData);
|
||||||
|
},
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Edit Policy Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
final idStr = user['policy_id'];
|
||||||
|
final id = int.tryParse(idStr.toString());
|
||||||
|
|
||||||
|
if (id == null) {
|
||||||
|
print("group_id is null");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
final status = user['is_active'];
|
||||||
|
|
||||||
|
deletePolicy(user, id, status);
|
||||||
|
},
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'Delete Policy Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget buildMobileCardView(List<dynamic> paginatedUser) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
shrinkWrap: true,
|
itemCount: paginatedUser.length,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: apiAllGroups!.length,
|
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final policy = apiAllGroups![index];
|
final user = paginatedUser[index];
|
||||||
return Card(
|
return Card(
|
||||||
// color: bodyColor,
|
|
||||||
// color: Color(0xFFF5F5F5),
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
margin: EdgeInsets.symmetric(vertical: 6, horizontal: 10),
|
margin: EdgeInsets.symmetric(
|
||||||
|
horizontal: 12, vertical: 6),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
elevation: 3,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -340,14 +856,14 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: Text("${policy['name']}",
|
child: Text("${user['name']}",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13, fontWeight: FontWeight.w600)),
|
fontSize: 13, fontWeight: FontWeight.w600)),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
policy['domestic'] == "1"
|
user['domestic'] == "1"
|
||||||
? "Domestic"
|
? "Domestic"
|
||||||
: "International",
|
: "International",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
@ -360,7 +876,7 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final rawId = policy['policy_id'];
|
final rawId = user['policy_id'];
|
||||||
final intPolicyId = rawId is int
|
final intPolicyId = rawId is int
|
||||||
? rawId
|
? rawId
|
||||||
: int.tryParse(rawId.toString()) ?? 0;
|
: int.tryParse(rawId.toString()) ?? 0;
|
||||||
@ -372,30 +888,43 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
|
|
||||||
context.go("/Policy", extra: policyData);
|
context.go("/Policy", extra: policyData);
|
||||||
},
|
},
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit Policy Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5,
|
width: 5,
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final idStr = policy['policy_id'];
|
final idStr = user['policy_id'];
|
||||||
final id = int.tryParse(idStr.toString());
|
final id = int.tryParse(idStr.toString());
|
||||||
|
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
print("group_id is null");
|
print("group_id is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final status = policy['is_active'];
|
final status = user['is_active'];
|
||||||
|
|
||||||
deletePolicy(policy, id, status);
|
deletePolicy(user, id, status);
|
||||||
},
|
},
|
||||||
child: Image.asset('assets/images/IconsImg/delete.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Delete Policy Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/delete.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -403,4 +932,43 @@ class _PolicyListState extends State<PolicyList> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: isDesktop
|
||||||
|
? SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: table, // <-- your existing table
|
||||||
|
)
|
||||||
|
: buildMobileCardView(paginatedUser),
|
||||||
|
),
|
||||||
|
PaginationControls(
|
||||||
|
currentPage: currentPage,
|
||||||
|
itemsPerPage: itemsPerPage,
|
||||||
|
totalItems: users.length,
|
||||||
|
activeColor: layoutColor, // your theme color
|
||||||
|
onPageChanged: (page) {
|
||||||
|
setState(() {
|
||||||
|
currentPage = page;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onItemsPerPageChanged: (items) {
|
||||||
|
setState(() {
|
||||||
|
itemsPerPage = items;
|
||||||
|
currentPage = 0;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,8 +41,13 @@ class UserActionsMenu extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
child: Tooltip(
|
||||||
|
message: 'View User Details',
|
||||||
child: Icon(Icons.remove_red_eye,
|
child: Icon(Icons.remove_red_eye,
|
||||||
color: Color(0xFF475569), size: 18),
|
color: Color(0xFF475569), size: 18)
|
||||||
|
),
|
||||||
|
// child: Icon(Icons.remove_red_eye,
|
||||||
|
// color: Color(0xFF475569), size: 18,),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.pop(context); // Close the menu
|
Navigator.pop(context); // Close the menu
|
||||||
final userId = getUserId(user['user_id']);
|
final userId = getUserId(user['user_id']);
|
||||||
@ -55,8 +60,14 @@ class UserActionsMenu extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: Image.asset('assets/images/IconsImg/edit.png',
|
child: Tooltip(
|
||||||
width: 20, height: 15),
|
message: 'Edit User Details',
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/IconsImg/edit.png',
|
||||||
|
width: 20,
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.pop(context); // Close the menu
|
Navigator.pop(context); // Close the menu
|
||||||
final userId = getUserId(user['user_id']);
|
final userId = getUserId(user['user_id']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user