This commit is contained in:
venbaittech 2025-05-29 10:01:30 +05:30
commit 41ed141e13
9 changed files with 270 additions and 184 deletions

View File

@ -706,18 +706,18 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
isViewMode: true);
},
),
IconButton(
icon: Image.asset(
'assets/images/IconsImg/edit.png',
width: 20,
height: 15),
onPressed: () {
Navigator.pop(context);
ApiService.viewPlan(
context, plan.planId,
isViewMode: false);
},
),
// IconButton(
// icon: Image.asset(
// 'assets/images/IconsImg/edit.png',
// width: 20,
// height: 15),
// onPressed: () {
// Navigator.pop(context);
// ApiService.viewPlan(
// context, plan.planId,
// isViewMode: false);
// },
// ),
IconButton(
icon: Icon(
Icons.cancel_rounded,

View File

@ -98,6 +98,41 @@ class StatusDashboardState extends State<StatusDashboard> {
}
}
Color getStatusColor(String status) {
if (status == "Domestic") return Colors.white;
if (status == "International") return Colors.white;
if (status == "Partially Approved") return Colors.yellow.shade100;
if (status == "Pending Approval") return Colors.greenAccent.shade100;
if (status == "Approved") return Colors.green.shade100;
if (status == "Completed") return Colors.green.shade500;
if (status == "Rejected") return Colors.red.shade100;
if (status == "Cancelled") return Colors.red.shade200;
return Colors.grey.shade100;
}
IconData getStatusIcon(String title) {
switch (title) {
case "Domestic":
return Icons.directions_bus_filled_outlined;
case "International":
return Icons.airplanemode_active;
case "Partially Approved":
return Icons.pending;
case "Approved":
return Icons.check_circle_outline;
case "Completed":
return Icons.done_all;
case "Rejected":
return Icons.cancel_outlined;
case "Cancelled":
return Icons.cancel_schedule_send_outlined;
default:
return Icons.info_outline;
}
}
@override
Widget build(BuildContext context) {
final typeBasedCount = List<Map<String, dynamic>>.from(
@ -111,9 +146,12 @@ class StatusDashboardState extends State<StatusDashboard> {
print("statusBasedCount - => $statusBasedCount");
// 👇 Local function to create the card widget
Widget buildInfoCard(String title, int count, double width) {
print('title $title');
final color = getStatusColor(title);
final icon = getStatusIcon(title);
return Card(
elevation: 3,
color: Colors.white,
color: color,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Container(
width: width,
@ -121,10 +159,15 @@ class StatusDashboardState extends State<StatusDashboard> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 32, color: (title == 'Domestic' || title == 'International') ? Colors.green : Colors.black54), // 👈 Add Icon here
const SizedBox(height: 8),
Text(
title,
textAlign: TextAlign.center,
style: const TextStyle(fontWeight: FontWeight.w600),
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: (title == 'Domestic' || title == 'International') ? 16 : 14,
),
),
const SizedBox(height: 8),
Text(
@ -132,7 +175,7 @@ class StatusDashboardState extends State<StatusDashboard> {
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.blue,
// color: Colors.blue,
),
),
],
@ -154,54 +197,63 @@ class StatusDashboardState extends State<StatusDashboard> {
body: Padding(
padding: isDesktop
? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width * 0.1,
vertical: 0,
horizontal: MediaQuery.of(context).size.width *
0.1, // 30% of screen width as horizontal padding
vertical: 10, // 5% of screen height as vertical padding
)
: const EdgeInsets.all(0),
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 10,
runSpacing: 10,
children: typeBasedCount.map((item) {
double cardWidth = isDesktop
? (MediaQuery.of(context).size.width * 0.75 - 10) / 2 // 80% width padding adjusted
: MediaQuery.of(context).size.width - 24; // full width with padding
: EdgeInsets.all(0),
child:Container(
// padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: isDesktop ? Colors.white : const Color(0xFFFCFCFC),
borderRadius: BorderRadius.circular(12), // 👈 Set your desired radius
),
// color: isDesktop ? Colors.white : Color(0xFFFCFCFC),
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(30.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Wrap(
spacing: 10,
runSpacing: 10,
children: typeBasedCount.map((item) {
double cardWidth = isDesktop
? (MediaQuery.of(context).size.width * 0.75 - 10) / 2 // 80% width padding adjusted
: MediaQuery.of(context).size.width - 24; // full width with padding
return SizedBox(
width: cardWidth,
child: buildInfoCard(item['value'], item['count'], cardWidth),
);
}).toList(),
),
const SizedBox(height: 20),
Wrap(
spacing: 10,
runSpacing: 10,
children: statusBasedCount.map((item) {
double cardWidth = isDesktop
? (MediaQuery.of(context).size.width * 0.90 - 50) / 6 // desktop layout: 6 cards per row
: MediaQuery.of(context).size.width - 24; // mobile: full width
return SizedBox(
width: cardWidth,
child: buildInfoCard(item['value'], item['count'], cardWidth),
);
}).toList(),
),
const SizedBox(height: 20),
Wrap(
spacing: 10,
runSpacing: 10,
children: statusBasedCount.map((item) {
double cardWidth = isDesktop
? (MediaQuery.of(context).size.width * 0.90 - 50) / 6 // desktop layout: 6 cards per row
: MediaQuery.of(context).size.width - 24; // mobile: full width
return SizedBox(
width: cardWidth,
child: buildInfoCard(item['value'], item['count'], cardWidth),
);
}).toList(),
),
return SizedBox(
width: cardWidth,
child: buildInfoCard(item['value'], item['count'], cardWidth),
);
}).toList(),
),
],
),
),
),
],
),
],
),
),
),
],
),
)
),
);
});

View File

@ -493,7 +493,7 @@ class ForexDataState extends State<ForexData> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Cash",
"Cash (%)",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
@ -540,7 +540,7 @@ class ForexDataState extends State<ForexData> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Card",
"Card (%)",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,

View File

@ -276,7 +276,7 @@ class _GroupListState extends State<GroupList> {
children: [
Expanded(
child: Container(
// height: MediaQuery.of(context).size.height * 0.89,
height: MediaQuery.of(context).size.height * 0.75,
padding: const EdgeInsets.all(10),
// margin: const EdgeInsets.only(bottom: 10),
color: Colors.white,
@ -309,125 +309,124 @@ class _GroupListState extends State<GroupList> {
itemCount: apiAllGroups!.length,
itemBuilder: (context, index) {
final group = apiAllGroups![index];
return Card(
// color: bodyColor,
// color: Color(0xFFF5F5F5),
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 6, horizontal: 10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text("Group Name",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("Domestic Policy",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("International Policy",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("Description",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
],
),
SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text("${group['name']}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600)),
),
Expanded(
child: Text("${group['domestic_policy_name'] ?? 'N/A'}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600)),
),
Expanded(
child: Text("${group['international_policy_name']}",
return Card(
// color: bodyColor,
// color: Color(0xFFF5F5F5),
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 6, horizontal: 10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text("Group Name",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600))),
Expanded(
child: Text("${group['description'] ?? 'N/A'}",
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("Domestic Policy",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600))),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () async {
if (group['group_id'] != null) {
final newGroupID = int.tryParse(group['group_id'].toString());
if (newGroupID != null) {
final data = await apiService.getGroupDetailsFind(newGroupID); // Always an int
showDialog(
context: context,
builder: (context) => GroupData(
isDesktop: isDesktop,
groupId: newGroupID, // Pass the ID
groupData: data,
layoutColor: layoutColor!,
fetchGetGroup: refreshData
),
);
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("International Policy",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
Expanded(
child: Text("Description",
style: GoogleFonts.poppins(
fontSize: 11.5, fontWeight: FontWeight.w400)),
),
],
),
SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text("${group['name']}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600)),
),
Expanded(
child: Text("${group['domestic_policy_name'] ?? 'N/A'}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600)),
),
Expanded(
child: Text("${group['international_policy_name']}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600))),
Expanded(
child: Text("${group['description'] ?? 'N/A'}",
style: GoogleFonts.poppins(
fontSize: 13, fontWeight: FontWeight.w600))),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () async {
if (group['group_id'] != null) {
final newGroupID = int.tryParse(
group['group_id'].toString());
if (newGroupID != null) {
final data = await apiService.getGroupDetailsFind(
newGroupID); // Always an int
showDialog(
context: context,
builder: (context) =>
GroupData(
isDesktop: isDesktop,
groupId: newGroupID,
// Pass the ID
groupData: data,
layoutColor: layoutColor!,
fetchGetGroup: refreshData
),
);
}
} else {
print("something went wrong check properly");
}
},
} else {
print("something went wrong check properly");
}
},
// onTap: () {
// context.go("/CreateGroup", extra: group);
// },
child: Image.asset('assets/images/IconsImg/edit.png',
width: 20, height: 15),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
final idStr = group['group_id'];
final id = int.tryParse(idStr.toString());
// onTap: () {
// context.go("/CreateGroup", extra: group);
// },
child: Image.asset('assets/images/IconsImg/edit.png',
width: 20, height: 15),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
final idStr = group['group_id'];
final id = int.tryParse(idStr.toString());
if (id == null) {
print("group_id is null");
return;
}
final status = group['is_active'];
// print("GroupId : ${group['group_id']} ");
deleteGroup(group, id, status);
},
child: Image.asset('assets/images/IconsImg/delete.png',
width: 20, height: 15),
),
],
),
],
if (id == null) {
print("group_id is null");
return;
}
final status = group['is_active'];
// print("GroupId : ${group['group_id']} ");
deleteGroup(group, id, status);
},
child: Image.asset('assets/images/IconsImg/delete.png',
width: 20, height: 15),
),
],
),
],
),
),
),
);
);
},
);
}

View File

@ -214,6 +214,14 @@ class BusListWidget extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"${item["from"]} - ${item["to"]}",
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w800,
),
),
Spacer(),
GestureDetector(
onTap: () => onOpen(true, item, "Bus"),
child: Image.asset('assets/images/IconsImg/edit.png',

View File

@ -192,6 +192,14 @@ class InsuranceListWidget extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
getRequestForInsuranceType(item["type_of_insurance"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w800,
),
),
Spacer(),
GestureDetector(
onTap: () => onOpen(true, item, "Insurance"),
child: Image.asset('assets/images/IconsImg/edit.png',

View File

@ -152,6 +152,14 @@ class MiscellaneousListWidget extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
getRequestValue(item["special_request"]?.toString()),
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w800,
),
),
Spacer(),
GestureDetector(
onTap: () => onOpen(true, item, "Miscellaneous"),
child: Image.asset('assets/images/IconsImg/edit.png',

View File

@ -291,6 +291,14 @@ class VisaListWidget extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
getRequestForVisa(item["type_of_visa"]!.toString()),
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w800,
),
),
Spacer(),
GestureDetector(
onTap: () => onOpen(true, item, "Visa"),
child: Image.asset('assets/images/IconsImg/edit.png',

View File

@ -21,6 +21,7 @@ class PlanPopupMenu extends StatelessWidget {
required this.layoutColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Align(
@ -51,15 +52,17 @@ class PlanPopupMenu extends StatelessWidget {
isViewMode: true);
},
),
IconButton(
icon: Image.asset('assets/images/IconsImg/edit.png',
width: 20, height: 15),
onPressed: () {
Navigator.pop(context);
ApiService.viewPlan(context, plan.planId,
isViewMode: false);
},
),
// IconButton(
// icon: Image.asset('assets/images/IconsImg/edit.png',
// width: 20, height: 15),
// onPressed: () {
// Navigator.pop(context);
// ApiService.viewPlan(context, plan.planId,
// isViewMode: false);
// },
// ),
IconButton(
icon: Icon(Icons.cancel_rounded, size: 18),
onPressed: () {