plan creation bugs

This commit is contained in:
venbaittech 2025-06-04 16:10:52 +05:30
parent 8c828b1dac
commit 7c9968c159
4 changed files with 1615 additions and 1405 deletions

View File

@ -9,14 +9,15 @@ class MiscellaneousListWidget extends StatelessWidget {
final Function(String, bool) onAddNew;
final bool isViewMode;
const MiscellaneousListWidget(
{super.key,
required this.miscellaneousList,
required this.onOpen,
required this.onDeleteMiscellaneous,
required this.apiData,
required this.onAddNew,
required this.isViewMode});
const MiscellaneousListWidget({
super.key,
required this.miscellaneousList,
required this.onOpen,
required this.onDeleteMiscellaneous,
required this.apiData,
required this.onAddNew,
required this.isViewMode,
});
@override
Widget build(BuildContext context) {
@ -34,16 +35,18 @@ class MiscellaneousListWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MouseRegion(
cursor: isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
cursor:
isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
child: GestureDetector(
onTap: isViewMode
? null
: () {
print("New data");
onAddNew("Miscellaneous", true);
},
onTap:
isViewMode
? null
: () {
print("New data");
onAddNew("Miscellaneous", true);
},
child: Row(
mainAxisSize:
MainAxisSize.min, // Ensures content fits nicely
@ -57,7 +60,7 @@ class MiscellaneousListWidget extends StatelessWidget {
Icons.add_circle_sharp,
size: 30,
color: Color(0xFF114D8B),
)
),
],
),
),
@ -95,7 +98,7 @@ class MiscellaneousListWidget extends StatelessWidget {
),
const SizedBox(height: 16),
// Scroll behavior based on device
_buildData(context, isDesktop)
_buildData(context, isDesktop),
],
),
),
@ -173,7 +176,8 @@ class MiscellaneousListWidget extends StatelessWidget {
),
SizedBox(width: 10),
GestureDetector(
onTap: () => onOpen(true, item, "Miscellaneous"),
// onTap: () => onOpen(true, item, "Miscellaneous"),
onTap: () => onDeleteMiscellaneous(item),
child: Tooltip(
message: 'Delete Miscellaneous Details',
child: Image.asset(
@ -185,68 +189,65 @@ class MiscellaneousListWidget extends StatelessWidget {
),
],
),
Divider(
color: Colors.blueGrey.shade50,
),
Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 4),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
"Special Request",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
Expanded(
flex: 3,
child: Text(
" Comments",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
],
)
children: [
Expanded(
flex: 2,
child: Text(
"Special Request",
style: GoogleFonts.poppins(fontSize: 11),
),
),
Expanded(
flex: 3,
child: Text(
" Comments",
style: GoogleFonts.poppins(fontSize: 11),
),
),
],
)
: SizedBox.shrink(),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
getRequestValue(
item["special_request"]?.toString()),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
children: [
Expanded(
flex: 2,
child: Text(
getRequestValue(
item["special_request"]?.toString(),
),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
Expanded(
flex: 3,
child: Text(
item["comments"],
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
Expanded(
flex: 3,
child: Text(
item["comments"],
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
)
),
],
)
: Column(
children: [
_buildRow(
"Special Request:",
getRequestValue(
item["special_request"]?.toString())),
SizedBox(width: 10),
_buildRow("Comments:", item["comments"] ?? "N/A"),
],
),
children: [
_buildRow(
"Special Request:",
getRequestValue(item["special_request"]?.toString()),
),
SizedBox(width: 10),
_buildRow("Comments:", item["comments"] ?? "N/A"),
],
),
],
),
),
@ -275,31 +276,35 @@ class MiscellaneousListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle:
TextStyle(color: Colors.black), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(value.substring(0, limit) + "...",
child:
exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle: TextStyle(
color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
overflow: TextOverflow.ellipsis),
)
: Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
overflow: TextOverflow.ellipsis,
),
)
: Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
),
],
);
@ -326,36 +331,36 @@ class MiscellaneousListWidget extends StatelessWidget {
children: [
Text(
title,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600),
),
SizedBox(width: 8),
Expanded(
child: exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle: TextStyle(
color: Colors.black, fontSize: 12), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
overflow: TextOverflow.ellipsis,
),
)
: Text(value),
child:
exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle: TextStyle(
color: Colors.black,
fontSize: 12,
), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
overflow: TextOverflow.ellipsis,
),
)
: Text(value),
),
],
);
}
//
//
// Widget _buildData(BuildContext context) {
// return Container(
// width: MediaQuery.of(context).size.width,

View File

@ -11,14 +11,15 @@ class TaxiListWidget extends StatelessWidget {
final Function(String, bool) onAddNew;
final bool isViewMode;
const TaxiListWidget(
{super.key,
required this.taxiList,
required this.apiData,
required this.onOpen,
required this.onDeleteTaxi,
required this.onAddNew,
required this.isViewMode});
const TaxiListWidget({
super.key,
required this.taxiList,
required this.apiData,
required this.onOpen,
required this.onDeleteTaxi,
required this.onAddNew,
required this.isViewMode,
});
@override
Widget build(BuildContext context) {
@ -36,17 +37,19 @@ class TaxiListWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MouseRegion(
cursor: isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
cursor:
isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
child: GestureDetector(
onTap: isViewMode
? null
: () {
print("New data");
onAddNew("Taxi", true);
},
onTap:
isViewMode
? null
: () {
print("New data");
onAddNew("Taxi", true);
},
child: Row(
mainAxisSize:
MainAxisSize.min, // Ensures content fits nicely
@ -60,7 +63,7 @@ class TaxiListWidget extends StatelessWidget {
Icons.add_circle_sharp,
size: 30,
color: Color(0xFF114D8B),
)
),
],
),
),
@ -99,9 +102,9 @@ class TaxiListWidget extends StatelessWidget {
],
),
const SizedBox(height: 16),
// Scroll behavior based on device
_buildData(context, isDesktop)
// Scroll behavior based on device
_buildData(context, isDesktop),
],
),
),
@ -187,8 +190,11 @@ class TaxiListWidget extends StatelessWidget {
if (hour == 24 && minute == 0) {
// 24:00 is treated as 00:00 on the next day
dateTime = DateTime(now.year, now.month, now.day)
.add(const Duration(days: 1));
dateTime = DateTime(
now.year,
now.month,
now.day,
).add(const Duration(days: 1));
} else {
if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
throw FormatException("Invalid hour or minute");
@ -238,11 +244,12 @@ class TaxiListWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger",
style: GoogleFonts.poppins(
fontSize: 13,
fontWeight: FontWeight.w800,
)),
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger",
style: GoogleFonts.poppins(
fontSize: 13,
fontWeight: FontWeight.w800,
),
),
Spacer(),
GestureDetector(
onTap: () => onOpen(true, item, "Taxi"),
@ -257,7 +264,7 @@ class TaxiListWidget extends StatelessWidget {
),
SizedBox(width: 10),
GestureDetector(
onTap: () => (item),
onTap: () => onDeleteTaxi(item),
child: Tooltip(
message: 'Delete Taxi Details',
child: Image.asset(
@ -269,108 +276,104 @@ class TaxiListWidget extends StatelessWidget {
),
],
),
Divider(
color: Colors.blueGrey.shade50,
),
Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 4),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
"City",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
Expanded(
flex: 2,
child: Text(
" Location",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
Expanded(
flex: 2,
child: Text(
" Date",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
Expanded(
flex: 2,
child: Text(
"Comments",
style: GoogleFonts.poppins(
fontSize: 11,
),
)),
],
)
children: [
Expanded(
flex: 2,
child: Text(
"City",
style: GoogleFonts.poppins(fontSize: 11),
),
),
Expanded(
flex: 2,
child: Text(
" Location",
style: GoogleFonts.poppins(fontSize: 11),
),
),
Expanded(
flex: 2,
child: Text(
" Date",
style: GoogleFonts.poppins(fontSize: 11),
),
),
Expanded(
flex: 2,
child: Text(
"Comments",
style: GoogleFonts.poppins(fontSize: 11),
),
),
],
)
: SizedBox.shrink(),
SizedBox(height: 4),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
"${item["destination_city"]}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
children: [
Expanded(
flex: 2,
child: Text(
"${item["destination_city"]}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${item["location_of_pickup"]}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${item["location_of_pickup"]}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${formatDate(item["date"]!)} ${formatTime(item["time"]!)}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: Text(
"${formatDate(item["date"]!)} ${formatTime(item["time"]!)}",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
" Comments:", item["comments"] ?? "N/A"),
),
SizedBox(width: 10),
Expanded(
flex: 2,
child: _buildComments(
" Comments:",
item["comments"] ?? "N/A",
),
],
)
),
],
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildRow("City:", item["destination_city"]),
SizedBox(width: 10),
_buildRow("Pickup:", item["location_of_pickup"]!),
SizedBox(width: 10),
_buildDateTimeRow(
"Date:",
formatDate(item["date"]!),
formatTime(item["time"]!),
),
_buildRow("TaxiFor:", item["car_required_for"]!),
_buildRow("Comments:", item["comments"] ?? "N/A"),
],
)
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildRow("City:", item["destination_city"]),
SizedBox(width: 10),
_buildRow("Pickup:", item["location_of_pickup"]!),
SizedBox(width: 10),
_buildDateTimeRow(
"Date:",
formatDate(item["date"]!),
formatTime(item["time"]!),
),
_buildRow("TaxiFor:", item["car_required_for"]!),
_buildRow("Comments:", item["comments"] ?? "N/A"),
],
),
],
),
),
@ -399,31 +402,35 @@ class TaxiListWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle:
TextStyle(color: Colors.black), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(value.substring(0, limit) + "...",
child:
exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle: TextStyle(
color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
overflow: TextOverflow.ellipsis),
)
: Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
overflow: TextOverflow.ellipsis,
),
)
: Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
),
],
);
@ -450,34 +457,30 @@ class TaxiListWidget extends StatelessWidget {
children: [
Text(
title,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 12,
),
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12),
),
SizedBox(width: 8),
Expanded(
child: exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle:
TextStyle(color: Colors.black), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(value.substring(0, limit) + "...",
child:
exceedsLimit
? Tooltip(
message: wrapText(value, 50),
decoration: BoxDecoration(
color: Colors.grey.shade200, // Black background
borderRadius: BorderRadius.circular(6),
),
textStyle: TextStyle(
color: Colors.black,
), // Tooltip text color
padding: EdgeInsets.all(8),
preferBelow: false,
child: Text(
value.substring(0, limit) + "...",
style: TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis),
)
: Text(
value,
style: GoogleFonts.poppins(
fontSize: 12,
),
),
overflow: TextOverflow.ellipsis,
),
)
: Text(value, style: GoogleFonts.poppins(fontSize: 12)),
),
],
);
@ -489,19 +492,11 @@ class TaxiListWidget extends StatelessWidget {
children: [
Text(
title,
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
style: GoogleFonts.poppins(fontSize: 12, fontWeight: FontWeight.w600),
),
SizedBox(width: 8),
Expanded(
child: Text(
"$date, $time",
style: GoogleFonts.poppins(
fontSize: 12,
),
),
child: Text("$date, $time", style: GoogleFonts.poppins(fontSize: 12)),
),
],
);

File diff suppressed because it is too large Load Diff

View File

@ -273,6 +273,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
location.contains('/listTravelAgentPlan')) {
selectedTab = TabSelection.myTrips;
} else if (location.contains('/ApprovalList') ||
location.contains('/approvallist') ||
location.contains('/approver/plans')) {
selectedTab = TabSelection.myApprovals;
} else {