TP_Service_Changes Trip_Info_Modal
This commit is contained in:
parent
de7491cc6e
commit
f0a0eb3c1d
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:frontend/Screens/allTrips/plan_info_mdl.dart';
|
||||
import 'package:frontend/Screens/allTrips/remarks_list.dart';
|
||||
import 'package:frontend/data/models/plan.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -1196,6 +1197,34 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons
|
||||
.info_outlined,
|
||||
color: Color(
|
||||
0xFF475569,
|
||||
),
|
||||
size: 18,
|
||||
),
|
||||
tooltip:
|
||||
'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context:
|
||||
context,
|
||||
builder:
|
||||
(
|
||||
context,
|
||||
) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId:
|
||||
plan.planId.toString(),
|
||||
layoutColorForUser:
|
||||
layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -1490,6 +1519,34 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons
|
||||
.info_outline_rounded,
|
||||
color: Color(
|
||||
0xFF475569,
|
||||
),
|
||||
size: 20,
|
||||
),
|
||||
tooltip:
|
||||
'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context:
|
||||
context,
|
||||
builder:
|
||||
(
|
||||
context,
|
||||
) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId:
|
||||
plan.planId.toString(),
|
||||
layoutColorForUser:
|
||||
layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
208
lib/Screens/allTrips/plan_info_mdl.dart
Normal file
208
lib/Screens/allTrips/plan_info_mdl.dart
Normal file
@ -0,0 +1,208 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../config/apiUrl.dart';
|
||||
import '../../utils/auth_utils.dart';
|
||||
|
||||
class TripInformation extends StatefulWidget {
|
||||
final String planId;
|
||||
final Color layoutColorForUser;
|
||||
|
||||
const TripInformation({
|
||||
Key? key,
|
||||
required this.planId,
|
||||
required this.layoutColorForUser,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TripInformationState createState() => _TripInformationState();
|
||||
}
|
||||
|
||||
class _TripInformationState extends State<TripInformation> {
|
||||
late Future<Map<String, dynamic>> _tripInfoFuture;
|
||||
|
||||
Future<Map<String, dynamic>> fetchComments() async {
|
||||
final String apiUrldata =
|
||||
'$apiUrl/api/plans/planInfo?plan_id=${widget.planId}';
|
||||
|
||||
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',
|
||||
'app-signature': 'ts-traveltool-2025-signature-123456',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final jsonData = json.decode(response.body);
|
||||
final Map<String, dynamic> dataMap =
|
||||
jsonData['data'] as Map<String, dynamic>;
|
||||
return dataMap;
|
||||
} else {
|
||||
throw Exception('Failed to load comments');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tripInfoFuture = fetchComments();
|
||||
|
||||
print('_tripInfoFuture : $_tripInfoFuture');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
title: Text(
|
||||
'Trip Information',
|
||||
style: GoogleFonts.poppins(color: Colors.black),
|
||||
),
|
||||
content: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 500, // ✅ You can adjust this width
|
||||
maxHeight:
|
||||
400, // ✅ Optional: limit height to make it scrollable vertically
|
||||
),
|
||||
child: FutureBuilder<Map<String, dynamic>>(
|
||||
future: _tripInfoFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
return Text(
|
||||
'Error: ${snapshot.error}',
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
);
|
||||
}
|
||||
|
||||
if (!snapshot.hasData) {
|
||||
return Text(
|
||||
'No data found.',
|
||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||
);
|
||||
}
|
||||
|
||||
final data = snapshot.data!;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
keyValueColumn("Traveller", data["traveller"] ?? ""),
|
||||
keyValueColumn("Group Name", data["group_name"] ?? ""),
|
||||
keyValueColumn(
|
||||
"Allowed Plan Type",
|
||||
data["allowed_plan_type"] ?? "",
|
||||
),
|
||||
keyValueColumn(
|
||||
"Policy Action Flow",
|
||||
data["policy_action_flow"] ?? "",
|
||||
),
|
||||
keyValueColumn("Policy Type", data["policy_type"] ?? ""),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"Approval Criteria:",
|
||||
style: GoogleFonts.poppins(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
|
||||
...List.generate((data["approval_criteria"] as List).length, (
|
||||
index,
|
||||
) {
|
||||
final item = data["approval_criteria"][index];
|
||||
return Card(
|
||||
elevation: 1,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
keyValueRow("Action", item["action"]),
|
||||
keyValueRow("Approver", item["approver"]),
|
||||
keyValueRow(
|
||||
"Is Action Done",
|
||||
item["is_action_done"],
|
||||
),
|
||||
keyValueRow("Action On", item["action_on"]),
|
||||
keyValueRow("Email Status", item["email_status"]),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
);
|
||||
}
|
||||
|
||||
Widget keyValueColumn(String key, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"$key ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(value, style: GoogleFonts.poppins(fontSize: 13)),
|
||||
// Expanded(
|
||||
// child: Text(value, style: GoogleFonts.poppins(fontSize: 13)),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget keyValueRow(String key, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 4),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"$key ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Expanded(
|
||||
child: Text(value, style: GoogleFonts.poppins(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:frontend/Screens/allTrips/plan_info_mdl.dart';
|
||||
import 'package:frontend/data/models/plan.dart';
|
||||
import 'package:frontend/utils/travelAgent_remarks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -947,6 +948,35 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons
|
||||
.info_outlined,
|
||||
color: Color(
|
||||
0xFF475569,
|
||||
),
|
||||
size: 18,
|
||||
),
|
||||
tooltip:
|
||||
'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context:
|
||||
context,
|
||||
builder:
|
||||
(
|
||||
context,
|
||||
) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId:
|
||||
plan.planId
|
||||
.toString(),
|
||||
layoutColorForUser:
|
||||
layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -635,6 +635,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
|
||||
if (_isForexDataComplete()) {
|
||||
if (tripuserId != null) {
|
||||
print('tripuserId - $tripuserId');
|
||||
postgetForexData(getForexData);
|
||||
} else {
|
||||
print("tripuserId is null");
|
||||
@ -686,6 +687,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
});
|
||||
|
||||
if (_isForexDataComplete()) {
|
||||
print('_isForexDataComplete');
|
||||
postgetForexData(getForexData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,10 +29,13 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -64,6 +67,22 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Accomodation");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
||||
@ -88,73 +107,73 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
if (widget.accommodationList.isNotEmpty && orgHasService)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Accomodation", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Accomodation", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
//
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
//
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
// MouseRegion(
|
||||
// cursor: isViewMode
|
||||
// ? SystemMouseCursors.forbidden
|
||||
@ -328,31 +347,34 @@ class _AccomodationListWidgetState extends State<AccomodationListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Accomodation"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Accomodation Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black87,
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Accomodation"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Accomodation Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color:
|
||||
isDesktop ? Color(0xFF114D8B) : Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteAccommodation(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Accommodation Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteAccommodation(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Accommodation Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -35,11 +35,13 @@ class _BusListWidgetState extends State<BusListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -71,6 +73,22 @@ class _BusListWidgetState extends State<BusListWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Bus");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
||||
@ -95,87 +113,87 @@ class _BusListWidgetState extends State<BusListWidget> {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
if (widget.busList.isNotEmpty && orgHasService)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Bus", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Bus", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Bus", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Bus", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@ -306,32 +324,36 @@ class _BusListWidgetState extends State<BusListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Bus"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Bus Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
// color: Color(0xFF114D8B),
|
||||
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||
|
||||
if (widget.busList.isNotEmpty && orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Bus"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Bus Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
// color: Color(0xFF114D8B),
|
||||
color:
|
||||
!isDesktop ? Colors.black : Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteBus(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Bus Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteBus(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Bus Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -37,6 +37,8 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
|
||||
bool orgHasService = false;
|
||||
|
||||
// late Map<String, String> countryMap;
|
||||
Map<String, String> countryMap = {};
|
||||
|
||||
@ -45,6 +47,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
super.initState();
|
||||
loadCountryList(); // Call your method here
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -76,6 +79,22 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Flight");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
Future<void> loadCountryList() async {
|
||||
final result = await apiService.fetchFlightsCountryList(widget.tripType);
|
||||
|
||||
@ -225,7 +244,7 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
),
|
||||
|
||||
// Right side: either "Add" icon or nothing
|
||||
if (widget.flightList.isNotEmpty)
|
||||
if (widget.flightList.isNotEmpty && orgHasService)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
@ -247,23 +266,24 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
),
|
||||
)
|
||||
else if (!isDesktop)
|
||||
// Centered "No Data Found" message for mobile and empty list
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
"No Data Found",
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox.shrink(),
|
||||
// Centered "No Data Found" message for mobile and empty list
|
||||
// Expanded(
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// "No Data Found",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: 18,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
isDesktop ? SizedBox(height: 16) : SizedBox(height: 5),
|
||||
|
||||
// Actual flight data UI
|
||||
_buildData(context, isDesktop),
|
||||
@ -430,32 +450,37 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Flight"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Flight Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color:
|
||||
isDesktop ? Color(0xFF114D8B) : Colors.black87,
|
||||
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Flight"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Flight Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color:
|
||||
isDesktop
|
||||
? Color(0xFF114D8B)
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteFlight(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Flight Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteFlight(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Flight Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -36,6 +36,7 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -72,6 +73,22 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Forex");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
||||
@ -334,32 +351,37 @@ class _ForexListWidgetState extends State<ForexListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Forex"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Forex Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
// color: Color(0xFF114D8B),
|
||||
color: !isDesktop ? Colors.black : Color(0xFF575A74),
|
||||
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Forex"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Forex Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
// color: Color(0xFF114D8B),
|
||||
color:
|
||||
!isDesktop ? Colors.black : Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteForex(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Forex Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteForex(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Forex Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
item['forex_id'] != null
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
|
||||
@ -33,11 +33,29 @@ class _InsuranceListWidgetState extends State<InsuranceListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Insurance");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -267,31 +285,33 @@ class _InsuranceListWidgetState extends State<InsuranceListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Insurance"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Insurance Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Insurance"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Insurance Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteInsurance(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Insurance Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteInsurance(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Insurance Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
|
||||
@ -30,11 +30,29 @@ class _MiscellaneousListWidgetState extends State<MiscellaneousListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Miscellaneous");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -90,84 +108,86 @@ class _MiscellaneousListWidgetState extends State<MiscellaneousListWidget> {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
|
||||
if (orgHasService && widget.miscellaneousList.isNotEmpty)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Miscellaneous", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Miscellaneous", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: Color(0xFF114D8B), // Outline color
|
||||
// width: 2, // Outline thickness
|
||||
// ),
|
||||
// ),
|
||||
// height: 30,
|
||||
// width: 30,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 20,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// onAddNew("Miscellaneous", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// onAddNew("Miscellaneous", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@ -244,32 +264,34 @@ class _MiscellaneousListWidgetState extends State<MiscellaneousListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Miscellaneous"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Miscellaneous Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Miscellaneous"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Miscellaneous Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
// onTap: () => onOpen(true, item, "Miscellaneous"),
|
||||
onTap: () => widget.onDeleteMiscellaneous(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Miscellaneous Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
// onTap: () => onOpen(true, item, "Miscellaneous"),
|
||||
onTap: () => widget.onDeleteMiscellaneous(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Miscellaneous Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -31,11 +31,29 @@ class _TaxiListWidgetState extends State<TaxiListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Taxi");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -91,69 +109,71 @@ class _TaxiListWidgetState extends State<TaxiListWidget> {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
if (orgHasService && widget.taxiList.isNotEmpty)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Taxi", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
widget.onAddNew("Taxi", true);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Taxi", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Taxi", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@ -315,31 +335,33 @@ class _TaxiListWidgetState extends State<TaxiListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Taxi"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Taxi Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Taxi"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Taxi Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteTaxi(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Taxi Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteTaxi(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Taxi Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -40,12 +40,30 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
||||
Color? layoutColor;
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
loadCountryList(); // Call your method here
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Train");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -145,7 +163,7 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if ((!isDesktop))
|
||||
if ((!isDesktop) && widget.trainList.isNotEmpty)
|
||||
Text(
|
||||
" ",
|
||||
style: const TextStyle(
|
||||
@ -153,91 +171,93 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
child: MouseRegion(
|
||||
|
||||
if (orgHasService && widget.trainList.isNotEmpty)
|
||||
MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
child: MouseRegion(
|
||||
cursor:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
checkClass();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
? SystemMouseCursors.forbidden
|
||||
: SystemMouseCursors.click,
|
||||
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
print("New data");
|
||||
checkClass();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures content fits nicely
|
||||
children: [
|
||||
// Text(
|
||||
// "Add New",
|
||||
// style: TextStyle(fontSize: 13),
|
||||
// ),
|
||||
// SizedBox(width: 8), // spacing between icon and text
|
||||
Icon(
|
||||
Icons.add_circle_sharp,
|
||||
size: 30,
|
||||
color: Color(0xFF114D8B),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
//
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
//
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Train", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
// child: ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Color(0xFF114D8B),
|
||||
// foregroundColor: Colors.white,
|
||||
// disabledBackgroundColor: Color(0xFF114D8B),
|
||||
// disabledForegroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
// ),
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
// ),
|
||||
// onPressed: isViewMode
|
||||
// ? null
|
||||
// : () {
|
||||
// print("New data");
|
||||
// onAddNew("Train", true);
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Ensures content fits nicely
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.add_circle_sharp,
|
||||
// size: 30,
|
||||
// color: Color(0xFF114D8B),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@ -387,31 +407,34 @@ class _TrainListWidgetState extends State<TrainListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Train"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Train Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Train"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Train Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteTrain(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Train Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteTrain(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Train Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -33,10 +33,13 @@ class _VisaListWidgetState extends State<VisaListWidget> {
|
||||
Color? secondColor;
|
||||
Color? thridColor;
|
||||
|
||||
bool orgHasService = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadInitialData();
|
||||
getOrgServices();
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
@ -68,6 +71,22 @@ class _VisaListWidgetState extends State<VisaListWidget> {
|
||||
});
|
||||
}
|
||||
|
||||
void getOrgServices() async {
|
||||
final services = await getOrgServicesName();
|
||||
print("getOrgServices storage: $services");
|
||||
|
||||
// just names
|
||||
final names = services.map((s) => s['name']).toList();
|
||||
print("Names only: $names");
|
||||
final hasFlight = names.contains("Visa");
|
||||
|
||||
setState(() {
|
||||
orgHasService = hasFlight;
|
||||
});
|
||||
|
||||
print("orgHasService: $orgHasService");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = MediaQuery.of(context).size.width > 1024;
|
||||
@ -364,31 +383,34 @@ class _VisaListWidgetState extends State<VisaListWidget> {
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Visa"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Visa Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
|
||||
if (orgHasService) ...[
|
||||
GestureDetector(
|
||||
onTap: () => widget.onOpen(true, item, "Visa"),
|
||||
child: Tooltip(
|
||||
message: 'Edit Visa Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/edit.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: isDesktop ? Color(0xFF114D8B) : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteMiscellaneous(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Visa Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
SizedBox(width: 10),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDeleteMiscellaneous(item),
|
||||
child: Tooltip(
|
||||
message: 'Delete Visa Details',
|
||||
child: Image.asset(
|
||||
'assets/images/IconsImg/delete.png',
|
||||
width: 20,
|
||||
height: 15,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Divider(color: Colors.blueGrey.shade50),
|
||||
|
||||
@ -485,8 +485,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
"exceptional_plan_reason": _excepntldescriptionController.text,
|
||||
"functional_department": selectedFuncDept,
|
||||
"so_number": _soNumberController.text,
|
||||
"created_by": selfId,
|
||||
"updated_by": selfId,
|
||||
// "created_by": selfId,
|
||||
// "updated_by": selfId,
|
||||
"is_active": "1",
|
||||
"flight": flightList,
|
||||
"accomodation": accommodationList,
|
||||
@ -562,6 +562,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
print("approverStatus - ${widget.approverStatus}");
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadInitialData();
|
||||
dynamicItineraryKey.currentState?.updateSelectedServices();
|
||||
});
|
||||
|
||||
// if (widget.selectedPlanData != null) {
|
||||
@ -876,7 +877,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
var userTripId;
|
||||
// if (!mounted) return;
|
||||
print("getSelectedPlanFor");
|
||||
setState(() {
|
||||
setState(() async {
|
||||
if (selectedplanUserId != null) {
|
||||
print("Is Not USER ID - $planUsrId ");
|
||||
if (selectedIstravelUser!) {
|
||||
@ -904,6 +905,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
}
|
||||
|
||||
void fetchUserDetails() async {
|
||||
print('FetchHandleUSe');
|
||||
final details = await getUserDetails();
|
||||
TripPlanAction = await getTripPlanAction();
|
||||
print("TripPlanAction- $TripPlanAction");
|
||||
@ -926,6 +928,30 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
// handleUpdateData();
|
||||
}
|
||||
|
||||
void fetchUsrDtlFromSelectedTripUser() async {
|
||||
// final details = await getUserDetails();
|
||||
|
||||
TripPlanAction = await getTripPlanActionFromSelectedUsr();
|
||||
print("TripPlanAction- $TripPlanAction");
|
||||
// print("details- $details");
|
||||
//
|
||||
// if (details != null) {
|
||||
// setState(() {
|
||||
// userDetails = details.toString(); // Store the full Map
|
||||
// userName = details['name']; // Extract the name
|
||||
// selfId = details['user_id'];
|
||||
// });
|
||||
// }
|
||||
// orgId = await getOrgId();
|
||||
// print("userDetails - $selfId");
|
||||
// handleSelectedUser();
|
||||
// getSelectedPlanFor();
|
||||
setTripPlanAction();
|
||||
|
||||
// handleSelectedUser();
|
||||
// handleUpdateData();
|
||||
}
|
||||
|
||||
Future<String?> getToken() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString('auth_token');
|
||||
@ -1496,6 +1522,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
|
||||
if (selectedPlanId != null && selectedPlanId!.isNotEmpty) {
|
||||
planData['plan_id'] = selectedPlanId; // Add plan_id for update
|
||||
planData['updated_by'] = selfId; // Add plan_id for update
|
||||
} else {
|
||||
planData['created_by'] = selfId; // Add plan_id for update
|
||||
}
|
||||
|
||||
print("POSTPlanTesting------- $planData}");
|
||||
@ -3288,13 +3317,21 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
final selected = options.firstWhere(
|
||||
(opt) => opt["title"] == newTitle,
|
||||
);
|
||||
setState(() {
|
||||
setState(() async {
|
||||
_selectedOption = selected["value"]!;
|
||||
if (_selectedOption == "Option 2" ||
|
||||
_selectedOption == "Option 3") {
|
||||
_selectedTripType = null;
|
||||
_showInputDialog(selected["title"]!);
|
||||
} else if (_selectedOption == "Option 1") {
|
||||
otherUserName = userName;
|
||||
await apiService.handleTripWiseToken(selfId!);
|
||||
fetchUserDetails();
|
||||
_selectedTripType = null;
|
||||
dynamicItineraryKey.currentState
|
||||
?.loadOrgSelectedAlServices();
|
||||
dynamicItineraryKey.currentState
|
||||
?.updateSelectedServices();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -3306,237 +3343,6 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> _buildPlanTrip1(bool isDesktop) {
|
||||
List<Map<String, String>> options = [
|
||||
{"title": "Self", "value": "Option 1"},
|
||||
{"title": "Other Employee", "value": "Option 2"},
|
||||
{"title": "Others (Non Employee)", "value": "Option 3"},
|
||||
];
|
||||
|
||||
print(" layoutColor: ${widget.layoutColor}");
|
||||
return options.map((option) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 0),
|
||||
child: CustomTextFieldWrapper(
|
||||
// color: Color(0xFFF4F4FB),
|
||||
color: Color(0xFFF5F5F5),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
layoutColor: widget.layoutColor,
|
||||
width:
|
||||
option["value"] == "Option 2"
|
||||
? 185
|
||||
: 125, // Adjust width conditionally
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
isFocused: _selectedOption == option["value"],
|
||||
isDesktop: isDesktop,
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
_selectedOption = option["value"]!;
|
||||
if (option["value"] == 'Option 2' ||
|
||||
option["value"] == 'Option 3') {
|
||||
_showInputDialog(option["title"]!);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
option["title"]!,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color:
|
||||
_selectedOption == option["value"]
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight:
|
||||
_selectedOption == option["value"]
|
||||
? FontWeight.w500
|
||||
: null,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 15,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
// color: _selectedOption == option["value"]
|
||||
// ? Colors.blueAccent
|
||||
// : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(4), // Rounded rectangle
|
||||
border: Border.all(
|
||||
color:
|
||||
_selectedOption == option["value"]
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
width: _selectedOption == option["value"] ? 2 : 1,
|
||||
),
|
||||
),
|
||||
child:
|
||||
_selectedOption == option["value"]
|
||||
? Icon(Icons.rectangle, size: 8, color: Colors.white)
|
||||
: null, // Add checkmark if selected
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Widget> _buildTripType(bool isMobile) {
|
||||
return [
|
||||
if (showDomestic == true)
|
||||
GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
_selectedTripType = "1";
|
||||
fetchTrainFlightClass(1);
|
||||
|
||||
dynamicItineraryKey.currentState
|
||||
?.updateSelectedServices();
|
||||
});
|
||||
},
|
||||
child: CustomTextFieldWrapper(
|
||||
color: Color(0xFFF4F4FB),
|
||||
layoutColor: widget.layoutColor,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
width: 130,
|
||||
isFocused: _selectedTripType == "1",
|
||||
isDesktop: widget.isDesktop,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Domestic",
|
||||
style: TextStyle(
|
||||
color:
|
||||
_selectedTripType == "1" ? Colors.white : Colors.black,
|
||||
fontWeight:
|
||||
_selectedTripType == "1" ? FontWeight.w500 : null,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 15,
|
||||
height: 15,
|
||||
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
// color: _selectedOption == option["value"]
|
||||
// ? Colors.blueAccent
|
||||
// : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(4), // Rounded rectangle
|
||||
border: Border.all(
|
||||
color:
|
||||
_selectedTripType == "1"
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
width: _selectedTripType == "1" ? 2 : 1,
|
||||
),
|
||||
),
|
||||
child:
|
||||
_selectedTripType == "1"
|
||||
? Icon(Icons.rectangle, size: 8, color: Colors.white)
|
||||
: null, // Add checkmark if selected
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
if (showInternational)
|
||||
GestureDetector(
|
||||
onTap:
|
||||
widget.isViewMode
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
_selectedTripType = "2";
|
||||
fetchTrainFlightClass(2);
|
||||
dynamicItineraryKey.currentState
|
||||
?.updateSelectedServices();
|
||||
});
|
||||
},
|
||||
child: CustomTextFieldWrapper(
|
||||
color: Color(0xFFF4F4FB),
|
||||
layoutColor: widget.layoutColor,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
width: 150,
|
||||
// padding: EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||
isFocused: _selectedTripType == "2",
|
||||
isDesktop: widget.isDesktop,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"International",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color:
|
||||
_selectedTripType == "2" ? Colors.white : Colors.black,
|
||||
fontWeight:
|
||||
_selectedTripType == "2" ? FontWeight.w500 : null,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 15,
|
||||
height: 15,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
// color: _selectedOption == option["value"]
|
||||
// ? Colors.blueAccent
|
||||
// : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(4), // Rounded rectangle
|
||||
border: Border.all(
|
||||
color:
|
||||
_selectedTripType == "2"
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
width: _selectedTripType == "2" ? 2 : 1,
|
||||
),
|
||||
),
|
||||
child:
|
||||
_selectedTripType == "2"
|
||||
? Icon(Icons.rectangle, size: 8, color: Colors.white)
|
||||
: null, // Add checkmark if selected
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// RadioListTile<String>(
|
||||
// activeColor: Colors.blueAccent,
|
||||
// contentPadding: EdgeInsets.zero,
|
||||
// dense: true,
|
||||
// title: Text("International"),
|
||||
// value: "2",
|
||||
// groupValue: _selectedTripType,
|
||||
// onChanged: widget.isViewMode
|
||||
// ? null
|
||||
// : (value) {
|
||||
// setState(() {
|
||||
// _selectedTripType = value!;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
void _showExceptionalReasonModal(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -4424,7 +4230,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
builder: (BuildContext context) {
|
||||
return UserSelectionDialog(
|
||||
title: title,
|
||||
onSubmit: (input, userId, isTraveller) {
|
||||
onSubmit: (input, userId, isTraveller) async {
|
||||
setState(() {
|
||||
otherUserName = input;
|
||||
selectedplanUserId = userId;
|
||||
@ -4432,9 +4238,25 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
});
|
||||
print("USer entered : $otherUserName $userId $isTraveller");
|
||||
getSelectedPlanFor();
|
||||
|
||||
if (isTraveller) {
|
||||
await apiService.handleTripWiseToken(
|
||||
selfId!,
|
||||
); // since userId is for traveller
|
||||
} else {
|
||||
await apiService.handleTripWiseToken(
|
||||
userId,
|
||||
); // fallback to selfId
|
||||
}
|
||||
|
||||
fetchUsrDtlFromSelectedTripUser();
|
||||
|
||||
dynamicItineraryKey.currentState?.loadOrgSelectedAlServices();
|
||||
dynamicItineraryKey.currentState?.updateSelectedServices();
|
||||
},
|
||||
onClose: () {
|
||||
onClose: () async {
|
||||
print("Choosede Clsoes");
|
||||
await apiService.handleTripWiseToken(selfId!);
|
||||
fetchUserDetails();
|
||||
},
|
||||
layoutColorForUser: widget.layoutColor!,
|
||||
|
||||
4218
lib/Screens/plans/create_plans_token_bfr_17_Sep.dart
Normal file
4218
lib/Screens/plans/create_plans_token_bfr_17_Sep.dart
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,10 @@ import 'package:frontend/Screens/itnerary_list/train_list.dart';
|
||||
import 'package:frontend/utils/auth_utils.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../services/apiService.dart';
|
||||
import '../../utils/auth_utils.dart';
|
||||
import '../itnerary/accomodations.dart';
|
||||
import '../itnerary/bus.dart';
|
||||
import '../itnerary/flights.dart';
|
||||
@ -84,7 +86,8 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
||||
int? selectedIndex;
|
||||
|
||||
List<dynamic>? selectedAllServices;
|
||||
List<Map<String, String>> selectedOrgServiceIds = [];
|
||||
// List<Map<String, String>> selectedOrgServiceIds = [];
|
||||
List<Map<String, dynamic>> selectedOrgServiceIds = [];
|
||||
List<dynamic>? ServicesChoosed;
|
||||
List<String> filledItineraryKeys = [];
|
||||
|
||||
@ -206,7 +209,9 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Org token based services
|
||||
Future<void> loadOrgSelectedAlServices() async {
|
||||
print('loadOrgSelectedAlServices');
|
||||
try {
|
||||
final result = await apiService.fetchOrganization();
|
||||
|
||||
@ -239,6 +244,39 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> saveSelectedOrgServices(
|
||||
List<Map<String, dynamic>> services,
|
||||
) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final jsonString = jsonEncode(services);
|
||||
await prefs.setString("selectedOrgServiceName", jsonString);
|
||||
}
|
||||
|
||||
Future<void> OrgServices() async {
|
||||
print('loadOrgSelectedAlServices');
|
||||
try {
|
||||
List<Map<String, String>> formattedName =
|
||||
selectedOrgServiceIds.map((e) {
|
||||
final id = e['service_id'].toString();
|
||||
|
||||
// find matching service from master list
|
||||
final match = selectedAllServices?.firstWhere(
|
||||
(service) => service['service_id'].toString() == id,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
return {
|
||||
"service_id": id,
|
||||
"name": match.isNotEmpty ? match['name'].toString() : "",
|
||||
};
|
||||
}).toList();
|
||||
await saveSelectedOrgServices(formattedName);
|
||||
print("ServiceformattedName: $formattedName");
|
||||
} catch (e) {
|
||||
print('Error fetching role list: $e');
|
||||
}
|
||||
}
|
||||
|
||||
List<String> getAllowedServiceNames() {
|
||||
print(
|
||||
"DID Updatee changee - $selectedOption $selectedListOption $isSelected $selectedItem $selectedIndex",
|
||||
@ -336,6 +374,7 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
||||
Future<void> updateSelectedServices() async {
|
||||
await loadAllServices();
|
||||
await loadOrgSelectedAlServices();
|
||||
await OrgServices();
|
||||
|
||||
final allowedServiceNames = getAllowedServiceNames();
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import '../../utils/pagination.dart';
|
||||
import '../../utils/travelAgent_remarks.dart';
|
||||
import '../../widgets/custom_popup.dart';
|
||||
import '../../widgets/popup_listPlan_action.dart';
|
||||
import '../allTrips/plan_info_mdl.dart';
|
||||
import '../allTrips/remarks_list.dart';
|
||||
|
||||
class ListPlans extends StatefulWidget {
|
||||
@ -1315,6 +1316,34 @@ class _ListPlansState extends State<ListPlans> {
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons
|
||||
.info_outlined,
|
||||
color: Color(
|
||||
0xFF475569,
|
||||
),
|
||||
size: 18,
|
||||
),
|
||||
tooltip:
|
||||
'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context:
|
||||
context,
|
||||
builder:
|
||||
(
|
||||
context,
|
||||
) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId:
|
||||
plan.planId.toString(),
|
||||
layoutColorForUser:
|
||||
layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -1632,6 +1661,35 @@ class _ListPlansState extends State<ListPlans> {
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons
|
||||
.info_outlined,
|
||||
color: Color(
|
||||
0xFF475569,
|
||||
),
|
||||
size: 18,
|
||||
),
|
||||
tooltip:
|
||||
'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context:
|
||||
context,
|
||||
builder:
|
||||
(
|
||||
context,
|
||||
) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId:
|
||||
plan.planId.toString(),
|
||||
layoutColorForUser:
|
||||
layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -44,7 +44,18 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
final ApiService apiService = ApiService();
|
||||
|
||||
// List<String> services = [];
|
||||
List<String> definedServices = [
|
||||
'Flight',
|
||||
'Accomodation',
|
||||
'Forex',
|
||||
'Insurance',
|
||||
'Visa',
|
||||
'Miscellaneous',
|
||||
'Taxi',
|
||||
'Bus',
|
||||
'Train',
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> services = [];
|
||||
String? servicesJson;
|
||||
Color? layoutColor;
|
||||
@ -297,16 +308,18 @@ class _PolicyState extends State<Policy> {
|
||||
);
|
||||
print("exisitingService ${exisitingService}");
|
||||
|
||||
final filtered =
|
||||
exisitingService!
|
||||
.where(
|
||||
(service) =>
|
||||
selectedIds.contains(service['service_id'].toString()),
|
||||
)
|
||||
.toList();
|
||||
// final filtered =
|
||||
// exisitingService!
|
||||
// .where(
|
||||
// (service) =>
|
||||
// selectedIds.contains(service['service_id'].toString()),
|
||||
// )
|
||||
// .toList();
|
||||
|
||||
setState(() {
|
||||
ServicesChoosed = filtered;
|
||||
// ServicesChoosed = exisitingService;
|
||||
ServicesChoosed = selectedAllServices;
|
||||
// ServicesChoosed = filtered;
|
||||
});
|
||||
print("298 ServicesChoosed ${ServicesChoosed}");
|
||||
|
||||
@ -357,17 +370,18 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
print("Filtered Selected Services Added to Policy: $ServicesChoosed");
|
||||
} else {
|
||||
final filtered =
|
||||
selectedAllServices!
|
||||
.where(
|
||||
(service) =>
|
||||
selectedIds.contains(service['service_id'].toString()),
|
||||
)
|
||||
.toList();
|
||||
// final filtered =
|
||||
// selectedAllServices!
|
||||
// .where(
|
||||
// (service) =>
|
||||
// selectedIds.contains(service['service_id'].toString()),
|
||||
// )
|
||||
// .toList();
|
||||
|
||||
print("ServicesChoosedYY: $ServicesChoosed");
|
||||
setState(() {
|
||||
ServicesChoosed = filtered;
|
||||
ServicesChoosed = selectedAllServices;
|
||||
// ServicesChoosed = filtered;
|
||||
// services = ServicesChoosed!
|
||||
// .map((service) => service['name'].toString())
|
||||
// .toList();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* File : web/index.html - change below
|
||||
* <base href="/adfactor/"> (or) <base href="/adfactor/"> replaced to <base href="/tstat/">
|
||||
* Check File : App.dart -> line 37 need to uncomment it "SemanticsBinding" **/
|
||||
// const String apiUrl = 'https://apitest.tripapprovaltool.com/tstat_be';
|
||||
const String apiUrl = 'https://apitest.tripapprovaltool.com/tstat_be';
|
||||
|
||||
/** Note : TSTAT UAT BE URL
|
||||
* incase "adfactor" or "aujas" href means changed to "tstat"
|
||||
@ -33,4 +33,4 @@
|
||||
* incase "tstat" or "adfactor" href means changed to "aujas"
|
||||
* File : web/index.html - change below
|
||||
* <base href="/tstat/"> (or) <base href="/adfactor/"> replaced to <base href="/aujas/"> **/
|
||||
const String apiUrl = 'https://tripapprovaltool.com/aujas_be';
|
||||
// const String apiUrl = 'https://tripapprovaltool.com/aujas_be';
|
||||
|
||||
@ -38,8 +38,44 @@ class ApiService {
|
||||
|
||||
// userRole = userData['role'];
|
||||
|
||||
print("userData - $userData");
|
||||
print("userData11 - ${userData['role']}");
|
||||
print("store1userData - $userData");
|
||||
print("store2userData11 - ${userData['role']}");
|
||||
// print("userData12 - $userRole");
|
||||
}
|
||||
|
||||
await getOrganizationData();
|
||||
} catch (e) {
|
||||
print('Error decoding token: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> storeTripUserDetails(String token) async {
|
||||
try {
|
||||
final parts = token.split('.');
|
||||
if (parts.length != 3) throw Exception('Invalid token format');
|
||||
|
||||
final payload = json.decode(
|
||||
utf8.decode(base64Url.decode(base64Url.normalize(parts[1]))),
|
||||
);
|
||||
|
||||
final userData = payload['data'];
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString('trip_auth_token', token);
|
||||
await prefs.setString(
|
||||
'trip_user_data',
|
||||
jsonEncode(userData),
|
||||
); // Store full user data
|
||||
|
||||
if (userData != null) {
|
||||
final pref = await SharedPreferences.getInstance();
|
||||
await pref.setString('trip_auth_token', token);
|
||||
await pref.setString('trip_user_data', jsonEncode(userData));
|
||||
|
||||
// userRole = userData['role'];
|
||||
|
||||
print("storetrip_userData - $userData");
|
||||
print("storetrip_2userData11 - ${userData['role']}");
|
||||
// print("userData12 - $userRole");
|
||||
}
|
||||
|
||||
@ -677,6 +713,37 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> handleTripWiseToken(String userId) async {
|
||||
final String apiUrldata =
|
||||
'$apiUrl/api/user/refreshUserToken?user_id=$userId';
|
||||
print("API URL: $userId");
|
||||
// final token = await getToken();
|
||||
|
||||
final token = await getToken();
|
||||
|
||||
final response = await http.get(
|
||||
Uri.parse(apiUrldata),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
'Content-Type': 'application/json',
|
||||
'app-signature': 'ts-traveltool-2025-signature-123456',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
print("data- $data");
|
||||
|
||||
final token = data['token']; // Assuming the token is in response
|
||||
// final userId = data['user_id'].toString();
|
||||
|
||||
print("Token - $token");
|
||||
await storeTripUserDetails(token);
|
||||
} else {
|
||||
throw Exception('Failed to load plans');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> viewPlan(
|
||||
BuildContext context,
|
||||
String planId, {
|
||||
|
||||
@ -79,6 +79,16 @@ Future<String?> getRoleUser() async {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> getOrgServicesName() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final jsonString = prefs.getString("selectedOrgServiceName");
|
||||
|
||||
if (jsonString != null) {
|
||||
return List<Map<String, dynamic>>.from(jsonDecode(jsonString));
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
Future<String?> getForexCardNumber() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? userDataString = prefs.getString('user_data');
|
||||
@ -110,6 +120,23 @@ Future<String?> getTripPlanAction() async {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<String?> getTripPlanActionFromSelectedUsr() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
// final String? userDataString = prefs.getString('user_data');
|
||||
final String? userDataString = prefs.getString('trip_user_data');
|
||||
|
||||
if (userDataString != null) {
|
||||
try {
|
||||
final Map<String, dynamic> userData = jsonDecode(userDataString);
|
||||
print("TRIPUSRDATAT - $userData");
|
||||
return userData["plan_action"]?.toString();
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>?> getUserServices() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? userDataString = prefs.getString('user_data');
|
||||
@ -128,3 +155,22 @@ Future<List<Map<String, dynamic>>?> getUserServices() async {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<List<dynamic>?> fetchTripUserServices() async {
|
||||
String? orgId = await getOrgId();
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? userDataString = prefs.getString('trip_user_data');
|
||||
|
||||
if (userDataString != null) {
|
||||
try {
|
||||
final Map<String, dynamic> userData = jsonDecode(userDataString);
|
||||
print("TRIPUSRSERVICE - $userData");
|
||||
return userData["service"]; // this is a List<dynamic>
|
||||
} catch (e) {
|
||||
print("Error decoding trip_user_data: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../Screens/allTrips/plan_info_mdl.dart';
|
||||
import '../Screens/allTrips/remarks_list.dart';
|
||||
import '../data/models/plan.dart';
|
||||
import '../services/apiService.dart';
|
||||
@ -133,6 +134,26 @@ class PlanPopupMenu extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.info_outlined,
|
||||
color: Color(0xFF475569),
|
||||
size: 18,
|
||||
),
|
||||
tooltip: 'Trip Info',
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => TripInformation(
|
||||
// planId: plan.planId,
|
||||
planId: plan.planId.toString(),
|
||||
layoutColorForUser: layoutColor!,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
232
pubspec.lock
232
pubspec.lock
@ -1,6 +1,22 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
_fe_analyzer_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "85.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.7.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -65,6 +81,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
cli_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_config
|
||||
sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -89,6 +113,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
coverage:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: coverage
|
||||
sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -355,6 +395,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "11.0.0"
|
||||
flutter_riverpod:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_riverpod
|
||||
sha256: ca2480512a8e840291325249f4857e363ffa5d1b77b132e189c9313a9d9fb9e0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -373,6 +421,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.2.12"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
go_router:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -421,6 +485,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
http_parser:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -509,6 +581,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.20.2"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -621,6 +709,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
node_preamble:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_preamble
|
||||
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -709,6 +813,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.2"
|
||||
posix:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -725,6 +837,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.5"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
quill_native_bridge:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -813,6 +933,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
riverpod:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: riverpod
|
||||
sha256: "135723ec44dfba141bc4696224048a408336e794228a0117439e7ad0a8be6d05"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -869,11 +997,59 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.2"
|
||||
shelf_packages_handler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_packages_handler
|
||||
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
shelf_static:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_static
|
||||
sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
source_map_stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_map_stack_trace
|
||||
sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
source_maps:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_maps
|
||||
sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.13"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -890,6 +1066,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.1"
|
||||
state_notifier:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: state_notifier
|
||||
sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -922,6 +1106,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
test:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.25.15"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -930,6 +1122,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1082,6 +1282,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
sha256: "5bf046f41320ac97a469d506261797f35254fa61c641741ef32dacda98b7d39c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
web:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1090,6 +1298,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket
|
||||
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
webkit_inspection_protocol:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webkit_inspection_protocol
|
||||
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -64,6 +64,7 @@ dependencies:
|
||||
flutter_quill_delta_from_html: ^1.5.2
|
||||
flutter_launcher_icons: ^0.14.4
|
||||
dotted_border: ^3.1.0
|
||||
flutter_riverpod: ^3.0.0
|
||||
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="/aujas/">
|
||||
<base href="/tstat/">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user