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

View File

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