This commit is contained in:
venbaittech 2025-07-22 14:46:43 +05:30
parent 058875d571
commit cf23f4f936
12 changed files with 1580 additions and 1536 deletions

View File

@ -811,11 +811,13 @@ class _ListAllPlansState extends State<ListAllPlans> {
),
columns: [
DataColumn(
label: Text(
'S.NO',
style: GoogleFonts.poppins(
fontSize: 13,
fontWeight: FontWeight.w600,
label: Expanded(
child: Text(
'S.NO',
style: GoogleFonts.poppins(
fontSize: 13,
fontWeight: FontWeight.w600,
),
),
),
),
@ -928,8 +930,11 @@ class _ListAllPlansState extends State<ListAllPlans> {
fontSize: 13,
fontFamily: "Inter",
),
softWrap: true,
overflow: TextOverflow.ellipsis,
softWrap: true, // Allows wrapping
overflow:
TextOverflow
.visible, // Ensures full display
maxLines: null,
),
),
DataCell(
@ -1251,6 +1256,12 @@ class _ListAllPlansState extends State<ListAllPlans> {
fontWeight:
FontWeight.w500,
),
softWrap:
true, // Allows wrapping
overflow:
TextOverflow
.visible, // Ensures full display
maxLines: null,
),
],
),

View File

@ -26,13 +26,15 @@ class MiscellaneousListWidget extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
margin: const EdgeInsets.only(top: 16.0),
// color: Color(0xFFE8F0FC),
margin: const EdgeInsets.only(top: 28.0),
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Header with title and button
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.end,
children: [
MouseRegion(
cursor:
@ -56,10 +58,23 @@ class MiscellaneousListWidget extends StatelessWidget {
// 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,
),
),
),
],
),
@ -159,7 +174,8 @@ class MiscellaneousListWidget extends StatelessWidget {
getRequestValue(item["special_request"]?.toString()),
style: GoogleFonts.poppins(
fontSize: 14,
fontWeight: FontWeight.w800,
color: Color(0xFF114D8B),
fontWeight: FontWeight.w500,
),
),
Spacer(),
@ -189,54 +205,67 @@ class MiscellaneousListWidget extends StatelessWidget {
),
],
),
Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 4),
// Divider(color: Colors.blueGrey.shade50),
SizedBox(height: 10),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
"Special Request",
style: GoogleFonts.poppins(fontSize: 11),
),
),
// Expanded(
// flex: 2,
// child: Text(
// "Special Request",
// style: GoogleFonts.poppins(fontSize: 11),
// ),
// ),
Expanded(
flex: 3,
child: Text(
" Comments",
style: GoogleFonts.poppins(fontSize: 11),
"Comments",
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
fontWeight: FontWeight.w600,
),
),
),
],
)
: SizedBox.shrink(),
SizedBox(height: 4),
isDesktop
? Row(
children: [
Expanded(
flex: 2,
child: Text(
getRequestValue(
item["special_request"]?.toString(),
? Container(
// color: Color(0xFFE8F0FC),
color: Colors.white,
child: Expanded(
child: Row(
children: [
// Expanded(
// flex: 2,
// child: Text(
// getRequestValue(
// item["special_request"]?.toString(),
// ),
// style: GoogleFonts.poppins(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
Container(
// width: MediaQuery.of(context).size.width * 0.6,
// padding: EdgeInsets.all(16),
// color: Color(0xFFE8F0FC),
child: Expanded(
// flex: 1,
child: Text(
item["comments"],
style: GoogleFonts.poppins(fontSize: 11),
),
),
),
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
],
),
Expanded(
flex: 3,
child: Text(
item["comments"],
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
),
),
),
],
),
)
: Column(
children: [

View File

@ -32,12 +32,10 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
Color(0xFF027E87), // Blue Shade
Color(0xFF12B24B), // Green
Color(0xFFe30f01), // Emerald Green
// Color(0xFFef3030), // Emerald Green
Color(0xFFf26157), // Emerald Green
// Color(0xFF2ECC71), // Emerald Green
Color(0xFFFF9800), // Orange
Color(0xFFE67E22), // Orange 2
Color(0xFFBF4C0D), // Orange dark orange 3
Color(0xFF3F51B5), // Orange 2
Color(0xFF00695C), // Orange dark orange 3
Color(0xFFD9067A), // rose
Color(0xFFc94b92), // rose light
Color(0xFF9C27B0), // Purple
@ -45,31 +43,32 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
];
final List<Color> layoutSecondaryColors = [
Color(0xFF00B0FF), // Lighter Blue
Color(0xFF00ACC1), // Teal Blue
Color(0xFF43A047), // Dark Green
Color(0xFF27AE60), // Medium Emerald
Color(0xFFFFC107), // Amber (complementary to orange)
Color(0xFFFFA726), // Light orange
Color(0xFFE64A19), // Deep Orange
Color(0xFFFF4081), // Bright Pink (complementary to rose)
Color(0xFF82B1FF), // Lighter BlueAccent
Color(0xFF4DD0E1), // Lighter Teal
Color(0xFF43A047), // Light Green
Color(0xFFEF5350), // Lighter Red
Color(0xFFFF8A65), // Coral Peach
Color(0xFFFFB74D), // Amber Orange
Color(0xFF7986CB), // Indigo Soft
Color(0xFF4DB6AC), // Soft Teal
Color(0xFFF06292), // Light Rose
Color(0xFFF48FB1), // Light Pink
Color(0xFFBA68C8), // Light Purple
Color(0xFFAB47BC), // Orchid Purple
Color(0xFFBA68C8), // Soft Purple
Color(0xFFDDA0DD), // Plum
];
final List<Color> layoutTertiaryColors = [
Color(0xFF82B1FF), // Very Light Blue
Color(0xFF4DD0E1), // Lighter Teal
Color(0xFF81C784), // Light Green
Color(0xFFAAF0D1), // Pastel Mint
Color(0xFFFFE0B2), // Pale Orange
Color(0xFFFFCCBC), // Light Orange Peach
Color(0xFFFFAB91), // Light Coral
Color(0xFFF8BBD0), // Pastel Rose
Color(0xFFF8BBD0), // Pastel Pink
Color(0xFFE1BEE7), // Lavender
Color(0xFFD1C4E9), // Light Purple Grey
Color(0xFFE3F2FD), // Very Light Blue
Color(0xFFE0F7FA), // Very Light Teal
Color(0xFFC8E6C9), // Mint Green
Color(0xFFFFCDD2), // Light Coral/Red
Color(0xFFFFE0B2), // Peach
Color(0xFFFFF3E0), // Lightest Orange
Color(0xFFFFEBEE), // Very Light Rose
Color(0xFFFCE4EC), // Pastel Pink
Color(0xFFF3E5F5), // Light Lavender
Color(0xFFEDE7F6), // Soft Purple Grey
Color(0xFFF8F9FA), // Near-white Neutral
];
// Body colors

View File

@ -659,6 +659,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
} else if (userId.isNotEmpty && userId != "0") {
print("TestplanUsrId : $userId");
print("TestplanUsrIdSelf : $selfId");
planUsrId = userId;
print("TestplanUsrId2 : $planUsrId");
_selectedOption = (selfId != userId) ? "Option 2" : "Option 1";
otherUserName = userName;
}
@ -3766,7 +3768,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
reverse: false, // show right-end on overflow
physics: BouncingScrollPhysics(),
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: isDesktop ? MediaQuery.of(context).size.width * 0.5 : 180),
constraints: BoxConstraints(
minWidth: isDesktop ? MediaQuery.of(context).size.width * 0.5 : 180,
),
child: IntrinsicWidth(
child: TextField(
controller: _tripTitleController,
@ -3786,9 +3790,15 @@ class CreateNewPlansState extends State<CreateNewPlan> {
),
floatingLabelBehavior: FloatingLabelBehavior.never,
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 1, vertical: 16),
contentPadding: EdgeInsets.symmetric(
horizontal: 1,
vertical: 16,
),
errorText: validationErrors["trip_title"],
errorStyle: GoogleFonts.poppins(fontSize: 12, color: Colors.red),
errorStyle: GoogleFonts.poppins(
fontSize: 12,
color: Colors.red,
),
),
keyboardType: TextInputType.text,
scrollPhysics: BouncingScrollPhysics(),
@ -3799,7 +3809,6 @@ class CreateNewPlansState extends State<CreateNewPlan> {
);
}
Widget _buildApprovalItem(String title, String name) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:dotted_border/dotted_border.dart';
import 'package:easy_stepper/easy_stepper.dart';
import 'package:flutter/material.dart';
import 'package:frontend/Screens/itnerary_list/accomodation_list.dart';
@ -7,6 +8,7 @@ import 'package:frontend/Screens/itnerary_list/bus_list.dart';
import 'package:frontend/Screens/itnerary_list/flight_list.dart';
import 'package:frontend/Screens/itnerary_list/taxi_list.dart';
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';
@ -64,6 +66,14 @@ class DynamicItinerary extends StatefulWidget {
class DynamicItineraryState extends State<DynamicItinerary> {
final ApiService apiService = ApiService();
late ScrollController _scrollController;
bool _canScrollLeft = false;
bool _canScrollRight = true;
Color? layoutColor;
Color? secondColor;
Color? thridColor;
String? _tripType;
String selectedOption = "";
String selectedListOption = "";
@ -98,6 +108,13 @@ class DynamicItineraryState extends State<DynamicItinerary> {
handleSelectedPlan();
updateSelectedServices();
_tripType = widget.tripType;
loadInitialData();
_scrollController = ScrollController();
_scrollController.addListener(_updateScrollButtonState);
// Delay check after layout is built
WidgetsBinding.instance.addPostFrameCallback((_) {
_updateScrollButtonState(); // Initial scroll check
});
}
@override
@ -116,6 +133,54 @@ class DynamicItineraryState extends State<DynamicItinerary> {
}
}
@override
void dispose() {
_scrollController.removeListener(_updateScrollButtonState);
_scrollController.dispose();
super.dispose();
}
void _updateScrollButtonState() {
if (!_scrollController.hasClients) return;
final max = _scrollController.position.maxScrollExtent;
final offset = _scrollController.offset;
setState(() {
_canScrollLeft = offset > 0;
_canScrollRight = offset < max;
});
}
void loadInitialData() async {
String? layoutString = await getLayoutColor();
String? secondString = await getSecondaryColor();
String? thridString = await getTernaryColor();
// String? bodyStringColor = await getBodyColor();
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
secondColor =
layoutString != null
? Color(int.parse(secondString!))
: Colors.orange;
thridColor =
layoutString != null
? Color(int.parse(thridString!))
: Colors.orangeAccent;
// bodyColor =
// bodyStringColor != null
// ? Color(int.parse(bodyStringColor))
// : Colors.white;
});
}
void updateTripType(String? newTripType) {
if (_tripType != newTripType) {
setState(() {
@ -823,10 +888,11 @@ class DynamicItineraryState extends State<DynamicItinerary> {
left: MediaQuery.of(context).size.width * 0.05,
right: MediaQuery.of(context).size.width * 0.05,
child: Container(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12),
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 2),
decoration: BoxDecoration(
color: Colors.white, // Card background
borderRadius: BorderRadius.circular(8),
// color: thridColor, // Card background
borderRadius: BorderRadius.circular(40),
// color: Color(0xFFE6E7F5)
// border: Border.all(color: Colors.black12, width: 1.3),
@ -840,16 +906,54 @@ class DynamicItineraryState extends State<DynamicItinerary> {
),
],
),
child:
child: Row(
children: [
isMobile
? SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(children: _buildOptions()),
? IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black54,
// color: _canScrollLeft ? Colors.black : Colors.grey,
),
onPressed:
_canScrollLeft
? () {
_scrollBy(-100);
}
: null,
)
: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: _buildOptions(),
),
: SizedBox.shrink(),
Expanded(
child:
isMobile
? SingleChildScrollView(
controller: _scrollController,
scrollDirection: Axis.horizontal,
child: Row(children: _buildOptions()),
)
: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: _buildOptions(),
),
),
isMobile
? IconButton(
icon: Icon(
Icons.arrow_forward_ios,
color: Colors.black54,
// color: _canScrollRight ? Colors.black : Colors.grey,
),
onPressed:
_canScrollRight
? () {
_scrollBy(100);
}
: null,
)
: SizedBox.shrink(),
],
),
),
),
],
@ -858,6 +962,21 @@ class DynamicItineraryState extends State<DynamicItinerary> {
);
}
void _scrollBy(double offset) {
if (!_scrollController.hasClients) return;
final targetOffset = (_scrollController.offset + offset).clamp(
_scrollController.position.minScrollExtent,
_scrollController.position.maxScrollExtent,
);
_scrollController.animateTo(
targetOffset,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
bool hasValidItineraryEntries() {
if (ServicesChoosed == null || ServicesChoosed!.isEmpty) return false;
@ -986,39 +1105,66 @@ class DynamicItineraryState extends State<DynamicItinerary> {
},
child: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: isOptionSelected ? Color(0xFF114D8B) : Colors.transparent,
width: 2,
),
),
// border: Border(
// bottom: BorderSide(
// color: isOptionSelected ? Color(0xFF114D8B) : Colors.transparent,
// width: 2,
// ),
// ),
),
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 10),
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 3),
child: Column(
children: [
iconUrl.isNotEmpty
? Image.network(
iconUrl,
width: 18,
height: 18,
errorBuilder: (context, error, stackTrace) {
return Icon(
fallbackIcon,
size: 25,
color:
isOptionSelected
? Color(0xFF114D8B)
: Color(0xFF475569),
);
},
)
: Icon(
fallbackIcon,
size: 25,
color:
isOptionSelected ? Color(0xFF114D8B) : Color(0xFF475569),
DottedBorder(
options: RoundedRectDottedBorderOptions(
dashPattern: [1, 3],
strokeWidth: 1.5,
radius: Radius.circular(46),
color: isOptionSelected ? secondColor! : Colors.transparent,
padding: EdgeInsets.all(3.5),
),
child: Container(
decoration: BoxDecoration(
color: isOptionSelected ? secondColor : Colors.white,
borderRadius: BorderRadius.circular(20.0),
),
SizedBox(height: 2),
padding: const EdgeInsets.all(3.0),
child:
iconUrl.isNotEmpty
? Image.network(
iconUrl,
width: 15,
height: 15,
errorBuilder: (context, error, stackTrace) {
return Icon(
fallbackIcon,
size: 20,
color:
isOptionSelected
? Colors.white
: Colors.black87,
// color:
// isOptionSelected
// ? Color(0xFF114D8B)
// : Color(0xFF475569),
);
},
)
: Icon(
fallbackIcon,
size: 20,
color:
isOptionSelected ? Colors.white : Colors.black87,
// color:
// isOptionSelected
// ? Color(0xFF114D8B)
// : Color(0xFF475569),
),
),
),
SizedBox(height: 1),
Row(
children: [
Text(
@ -1027,15 +1173,16 @@ class DynamicItineraryState extends State<DynamicItinerary> {
// style: GoogleFonts.poppins( fontSize: 12,
// fontWeight: FontWeight.w600,
// color: Color(0xFF575A74))
style: TextStyle(
fontSize: 14,
color:
isOptionSelected
? Color(0xFF114D8B)
: Color(0xFF475569),
fontFamily: "Inter",
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
// color:
// isOptionSelected
// ? Color(0xFF114D8B)
// : Color(0xFF475569),
// fontFamily: "Inter",
fontWeight:
isOptionSelected ? FontWeight.bold : FontWeight.w500,
isOptionSelected ? FontWeight.w700 : FontWeight.w400,
),
),
SizedBox(width: 4),

View File

@ -40,7 +40,7 @@ class Policy extends StatefulWidget {
class _PolicyState extends State<Policy> {
final GlobalKey<PolicyCriteriaState> policyCriteriaKey =
GlobalKey<PolicyCriteriaState>();
GlobalKey<PolicyCriteriaState>();
final ApiService apiService = ApiService();
@ -84,23 +84,22 @@ class _PolicyState extends State<Policy> {
Map<String, dynamic> get policyData {
List<Map<String, dynamic>> policyDetails =
policy_details!.where((service) {
// Only check these specific fields for emptiness
final fieldsToCheck = [
'cost',
'class',
'a1_action',
'a2_action',
'a3_action',
];
// If any of the important fields has a value, keep it
return fieldsToCheck.any((field) {
final value = service[field];
return value != null && value.toString().trim().isNotEmpty;
});
}).toList();
policy_details!.where((service) {
// Only check these specific fields for emptiness
final fieldsToCheck = [
'cost',
'class',
'a1_action',
'a2_action',
'a3_action',
];
// If any of the important fields has a value, keep it
return fieldsToCheck.any((field) {
final value = service[field];
return value != null && value.toString().trim().isNotEmpty;
});
}).toList();
Map<String, dynamic> data = {
"name": _policyController.text,
@ -153,6 +152,7 @@ class _PolicyState extends State<Policy> {
// }
// });
}
void _addFocusListener(FocusNode node, Function(bool) updateState) {
node.addListener(() {
setState(() {
@ -160,6 +160,7 @@ class _PolicyState extends State<Policy> {
});
});
}
void _checkAuthAndLoadData() async {
final String? token = await getToken(); // Your async function to get token
@ -198,14 +199,14 @@ class _PolicyState extends State<Policy> {
setState(() {
layoutColor =
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
layoutString != null
? Color(int.parse(layoutString))
: Colors.redAccent;
bodyColor =
bodyStringColor != null
? Color(int.parse(bodyStringColor))
: Colors.white;
bodyStringColor != null
? Color(int.parse(bodyStringColor))
: Colors.white;
});
}
@ -237,9 +238,9 @@ class _PolicyState extends State<Policy> {
try {
List<dynamic> decoded = json.decode(rawServices);
List<Map<String, String>> formatted =
decoded
.map((e) => {"service_id": e['service_id'].toString()})
.toList();
decoded
.map((e) => {"service_id": e['service_id'].toString()})
.toList();
setState(() {
selectedOrgServiceIds = formatted;
@ -264,7 +265,7 @@ class _PolicyState extends State<Policy> {
await loadOrgSelectedAlServices();
final selectedIds =
selectedOrgServiceIds.map((e) => e['service_id']).toSet();
selectedOrgServiceIds.map((e) => e['service_id']).toSet();
if (widget.policy != null) {
final details = List<Map<String, dynamic>>.from(
@ -277,12 +278,12 @@ class _PolicyState extends State<Policy> {
// pr int("UUFiltered Selected Services - $details");
final filtered =
selectedAllServices!
.where(
(service) =>
selectedIds.contains(service['service_id'].toString()),
)
.toList();
selectedAllServices!
.where(
(service) =>
selectedIds.contains(service['service_id'].toString()),
)
.toList();
setState(() {
ServicesChoosed = filtered;
@ -307,11 +308,11 @@ class _PolicyState extends State<Policy> {
List<Map<String, dynamic>>.from(decoded)
.map(
(service) => {
'service_id': service['service_id'].toString(),
'name': service['name'].toString(),
'order': service['order'].toString(),
},
)
'service_id': service['service_id'].toString(),
'name': service['name'].toString(),
'order': service['order'].toString(),
},
)
.toList();
});
@ -321,12 +322,12 @@ 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();
selectedAllServices!
.where(
(service) =>
selectedIds.contains(service['service_id'].toString()),
)
.toList();
print("ServicesChoosedYY: $ServicesChoosed");
setState(() {
@ -341,12 +342,12 @@ class _PolicyState extends State<Policy> {
ServicesChoosed!
.map(
(service) => {
'service_id': service['service_id'].toString(),
'name':
service['name'].toString(), // no space before 'name'
'order': service['order'].toString(),
},
)
'service_id': service['service_id'].toString(),
'name':
service['name'].toString(), // no space before 'name'
'order': service['order'].toString(),
},
)
.toList();
});
@ -461,7 +462,6 @@ class _PolicyState extends State<Policy> {
});
}
bool isValidData(Map<String, dynamic> data) {
errorMessages.clear(); // Reset previous errors
@ -480,7 +480,7 @@ class _PolicyState extends State<Policy> {
if (domestic != "1" && international != "1") {
errorMessages["trip_type"] =
"Required"; // "Please select Domestic or International.";
"Required"; // "Please select Domestic or International.";
}
// Validate at least one policy_detail with valid content
@ -502,7 +502,7 @@ class _PolicyState extends State<Policy> {
if (!hasAtLeastOneDetail) {
errorMessages["policy_details"] =
"Required"; // "At least one valid policy detail is required.";
"Required"; // "At least one valid policy detail is required.";
}
return errorMessages.isEmpty;
@ -571,16 +571,16 @@ class _PolicyState extends State<Policy> {
drawer: CustomDrawer(isDesktop: false),
body: Padding(
padding:
isDesktop
? EdgeInsets.symmetric(
horizontal:
MediaQuery.of(context).size.width *
0.1, // 30% of screen width as horizontal padding
vertical:
MediaQuery.of(context).size.height *
0, // 5% of screen height as vertical padding
)
: EdgeInsets.all(8),
isDesktop
? EdgeInsets.symmetric(
horizontal:
MediaQuery.of(context).size.width *
0.1, // 30% of screen width as horizontal padding
vertical:
MediaQuery.of(context).size.height *
0, // 5% of screen height as vertical padding
)
: EdgeInsets.all(8),
child: Column(
children: [
Expanded(
@ -666,15 +666,15 @@ class _PolicyState extends State<Policy> {
color: Colors.white,
padding: const EdgeInsets.all(8.0),
child:
isDesktop
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: _buildSubmit(isDesktop),
)
: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: _buildSubmit(isDesktop),
),
isDesktop
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: _buildSubmit(isDesktop),
)
: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: _buildSubmit(isDesktop),
),
),
],
),
@ -687,9 +687,9 @@ class _PolicyState extends State<Policy> {
// ? EdgeInsets.all(10.0)
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
height:
isDesktop
? MediaQuery.of(context).size.height * 0.98
: MediaQuery.of(context).size.height,
isDesktop
? MediaQuery.of(context).size.height * 0.98
: MediaQuery.of(context).size.height,
// decoration: BoxDecoration(
// border: isDesktop
// ? Border.all(
@ -738,23 +738,23 @@ class _PolicyState extends State<Policy> {
Container(
padding: isDesktop ? const EdgeInsets.only(left: 35) : null,
child:
isDesktop
? Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: _buildPolicyNameField(isDesktop)),
Spacer(),
Expanded(child: _buildPolicyTypeField(isDesktop)),
],
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildPolicyNameField(isDesktop),
SizedBox(height: 20),
_buildPolicyTypeField(isDesktop),
],
),
isDesktop
? Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: _buildPolicyNameField(isDesktop)),
Spacer(),
Expanded(child: _buildPolicyTypeField(isDesktop)),
],
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildPolicyNameField(isDesktop),
SizedBox(height: 20),
_buildPolicyTypeField(isDesktop),
],
),
),
SizedBox(height: 10),
Divider(thickness: 0.1, color: Colors.grey),
@ -767,66 +767,66 @@ class _PolicyState extends State<Policy> {
],
isDesktop
? Padding(
padding: const EdgeInsets.only(left: 30.0, right: 98.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Approval Criteria",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xFF575A74),
),
padding: const EdgeInsets.only(left: 30.0, right: 98.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Approval Criteria",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xFF575A74),
),
),
Text(
"Service Priority",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xFF575A74),
),
),
],
),
Text(
"Service Priority",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xFF575A74),
),
),
],
),
)
)
: SizedBox.shrink(),
isDesktop
? Container(
// color: Colors.yellow.shade50,
height: MediaQuery.of(context).size.height * 0.54,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
// color: Colors.yellow.shade50,
height: MediaQuery.of(context).size.height * 0.54,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildPolicyOrdering(isDesktop),
_buildPolicyCategory(isDesktop),
Column(
children: [
_buildPolicyOrdering(isDesktop),
_buildPolicyCategory(isDesktop),
],
),
Column(children: [_buildPolicyCategoryList(isDesktop)]),
],
),
Column(children: [_buildPolicyCategoryList(isDesktop)]),
],
),
),
)
),
)
: Expanded(
child: Container(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
_buildPolicyCategoryList(isDesktop),
_buildPolicyOrdering(isDesktop),
_buildPolicyCategory(isDesktop),
],
child: Container(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
_buildPolicyCategoryList(isDesktop),
_buildPolicyOrdering(isDesktop),
_buildPolicyCategory(isDesktop),
],
),
),
),
),
),
),
// isDesktop
// ? Expanded(
// child: Row(
@ -940,28 +940,28 @@ class _PolicyState extends State<Policy> {
border: Border.all(color: Colors.blueGrey.shade100, width: 0.35),
),
child:
isDesktop
? Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [_buildPolicySubCategoryList(isDesktop)],
),
)
: Column(
children: [
Container(
// color: Colors.amber,
child: _buildPolicySubCategoryList(isDesktop),
// child: Text("FAta"),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [_buildPolicySubCategoryList(isDesktop)],
// ),
),
],
),
isDesktop
? Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [_buildPolicySubCategoryList(isDesktop)],
),
)
: Column(
children: [
Container(
// color: Colors.amber,
child: _buildPolicySubCategoryList(isDesktop),
// child: Text("FAta"),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [_buildPolicySubCategoryList(isDesktop)],
// ),
),
],
),
);
}
@ -1118,21 +1118,21 @@ class _PolicyState extends State<Policy> {
width: isDesktop ? MediaQuery.of(context).size.width * 0.62 : null,
// width: isDesktop ? MediaQuery.of(context).size.width * 0.75 : null,
child:
isDesktop
? Container(
// color: Colors.amber,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [_buildPolicyServiceOrdering(isDesktop)],
),
)
: Container(
// color: Colors.amber,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [_buildPolicyServiceOrdering(isDesktop)],
),
),
isDesktop
? Container(
// color: Colors.amber,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [_buildPolicyServiceOrdering(isDesktop)],
),
)
: Container(
// color: Colors.amber,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [_buildPolicyServiceOrdering(isDesktop)],
),
),
);
}
@ -1143,14 +1143,16 @@ class _PolicyState extends State<Policy> {
// Sort services by 'order'
ServicesChoosed!.sort(
(a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0),
(a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0),
);
List<String> services =
ServicesChoosed!.map((service) => service['name'].toString()).toList();
ServicesChoosed!.map((service) => service['name'].toString()).toList();
List<String> serviceDBvalue =
ServicesChoosed!.map((service) => service['service_id'].toString()).toList();
ServicesChoosed!
.map((service) => service['service_id'].toString())
.toList();
print("1093");
print(services);
@ -1162,109 +1164,110 @@ class _PolicyState extends State<Policy> {
child: Flex(
direction: Axis.horizontal,
children:
services.asMap().entries.map((entry) {
int index = entry.key + 1;
String service = entry.value;
String serviceId = index.toString();
bool isSelected =
selectedServiceIndex.value == index.toString();
services.asMap().entries.map((entry) {
int index = entry.key + 1;
String service = entry.value;
String serviceId = index.toString();
bool isSelected =
selectedServiceIndex.value == index.toString();
return SizedBox(
// width: isDesktop ? 40 : null,
height:
isDesktop
? max(
(MediaQuery.of(context).size.height * 0.075),
10,
)
: 45,
return SizedBox(
// width: isDesktop ? 40 : null,
height:
isDesktop
? max(
(MediaQuery.of(context).size.height * 0.075),
10,
)
: 45,
// max((MediaQuery.of(context).size.height * 0.09), 10)
child: GestureDetector(
onTap: () {
print("Selected Services - $service - $index");
setState(() {
selectedServiceIndex.value = index.toString();
selectedServiceDBValue = serviceDBvalue[entry.key];
selectedService = service;
// max((MediaQuery.of(context).size.height * 0.09), 10)
child: GestureDetector(
onTap: () {
print("Selected Services - $service - $index");
setState(() {
selectedServiceIndex.value = index.toString();
selectedServiceDBValue = serviceDBvalue[entry.key];
selectedService = service;
print(
" selectedServiceIndex.value - ${selectedServiceIndex.value}",
);
print(
" selectedServiceIndex.value - ${selectedServiceIndex.value}",
);
print(
" selectedServiceDBValue.value - ${selectedServiceDBValue}",
);
print(
" selectedServiceDBValue.value - ${selectedServiceDBValue}",
);
// policyCriteriaKey.currentState?.fieldForPolicy();
// policyCriteriaKey.currentState
// ?.addOrUpdatePolicy(selectedServiceIndex.value);
print("policyselectedService - $selectedService");
if (selectedService == "Flight" ||
selectedService == "Train" || selectedService == "Accomodation") {
showClass = true;
showCost = false;
int serviceCode = selectedService == "Flight" ? 1 : 2;
print("policyselectedService1 - $selectedService");
policyCriteriaKey.currentState
?.fetchTrainFlightClass();
}
// else if (selectedService == "Accommodation") {
// showClass = true;
// showCost = false;
// }
else {
showClass = false;
showCost = false;
}
});
},
child: Container(
margin: const EdgeInsets.all(5),
padding:
isDesktop
? const EdgeInsets.all(8)
: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
service,
style: GoogleFonts.poppins(
color:
isSelected
? const Color(0xFF114D8B)
: Colors.black87,
fontSize: 13,
fontWeight:
isSelected
? FontWeight.bold
: FontWeight.w500,
decoration:
TextDecoration
.none, // remove built-in underline
),
// policyCriteriaKey.currentState?.fieldForPolicy();
// policyCriteriaKey.currentState
// ?.addOrUpdatePolicy(selectedServiceIndex.value);
print("policyselectedService - $selectedService");
if (selectedService == "Flight" ||
selectedService == "Train" ||
selectedService == "Accomodation") {
showClass = true;
showCost = false;
int serviceCode = selectedService == "Flight" ? 1 : 2;
print("policyselectedService1 - $selectedService");
policyCriteriaKey.currentState
?.fetchTrainFlightClass();
}
// else if (selectedService == "Accommodation") {
// showClass = true;
// showCost = false;
// }
else {
showClass = false;
showCost = false;
}
});
},
child: Container(
margin: const EdgeInsets.all(5),
padding:
isDesktop
? const EdgeInsets.all(8)
: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
service,
style: GoogleFonts.poppins(
color:
isSelected
? const Color(0xFF114D8B)
: Colors.black87,
fontSize: 13,
fontWeight:
isSelected
? FontWeight.bold
: FontWeight.w500,
decoration:
TextDecoration
.none, // remove built-in underline
),
),
if (isSelected)
const SizedBox(
height: 1,
), // spacing between text and underline
if (isSelected)
Container(
height: 2,
width: 30, // or based on text width
color: const Color(0xFF114D8B),
),
],
),
if (isSelected)
const SizedBox(
height: 1,
), // spacing between text and underline
if (isSelected)
Container(
height: 2,
width: 30, // or based on text width
color: const Color(0xFF114D8B),
),
],
),
),
),
),
);
}).toList(),
);
}).toList(),
),
),
);
@ -1288,7 +1291,7 @@ class _PolicyState extends State<Policy> {
}
List<String> services =
ServicesChoosed!.map((service) => service['name'].toString()).toList();
ServicesChoosed!.map((service) => service['name'].toString()).toList();
return Expanded(
child: SingleChildScrollView(
@ -1296,88 +1299,88 @@ class _PolicyState extends State<Policy> {
child: Flex(
direction: isDesktop ? Axis.vertical : Axis.horizontal,
children:
services.asMap().entries.map((entry) {
int index = entry.key + 1;
String service = entry.value;
bool isSelected =
selectedServiceIndex.value == index.toString();
services.asMap().entries.map((entry) {
int index = entry.key + 1;
String service = entry.value;
bool isSelected =
selectedServiceIndex.value == index.toString();
return SizedBox(
width: isDesktop ? 180 : null,
height:
isDesktop
? max(
(MediaQuery.of(context).size.height * 0.075),
10,
)
: 45,
return SizedBox(
width: isDesktop ? 180 : null,
height:
isDesktop
? max(
(MediaQuery.of(context).size.height * 0.075),
10,
)
: 45,
// max((MediaQuery.of(context).size.height * 0.09), 10)
child: GestureDetector(
onTap: () {
print("Selected Services - $service - $index");
setState(() {
// selectedServiceIndex.value = index.toString();
// selectedService = service;
//
// if (selectedService == "Flight" ||
// selectedService == "Train") {
// showClass = true;
// showCost = true;
// int serviceCode = selectedService == "Flight" ? 1 : 2;
// policyCriteriaKey.currentState?.fetchTrainFlightClass();
// } else if (selectedService == "Accommodation") {
// showClass = true;
// showCost = false;
// } else {
// showClass = false;
// showCost = false;
// }
});
},
child: Container(
margin: EdgeInsets.all(5),
padding:
isDesktop
? EdgeInsets.all(8)
: EdgeInsets.only(
top: 3,
bottom: 3,
left: 8,
right: 8,
),
decoration: BoxDecoration(
// color: Colors.blue,
color: isSelected ? Color(0xFF114D8B) : Colors.white,
// : Color(0xFFEBEBF7),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Colors.white, // Light grey border
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.grey.withAlpha(90), // Shadow color
blurRadius: 1, // Blur radius
spreadRadius: 1, // Spread radius
offset: Offset(0, 1), // Shadow position
// max((MediaQuery.of(context).size.height * 0.09), 10)
child: GestureDetector(
onTap: () {
print("Selected Services - $service - $index");
setState(() {
// selectedServiceIndex.value = index.toString();
// selectedService = service;
//
// if (selectedService == "Flight" ||
// selectedService == "Train") {
// showClass = true;
// showCost = true;
// int serviceCode = selectedService == "Flight" ? 1 : 2;
// policyCriteriaKey.currentState?.fetchTrainFlightClass();
// } else if (selectedService == "Accommodation") {
// showClass = true;
// showCost = false;
// } else {
// showClass = false;
// showCost = false;
// }
});
},
child: Container(
margin: EdgeInsets.all(5),
padding:
isDesktop
? EdgeInsets.all(8)
: EdgeInsets.only(
top: 3,
bottom: 3,
left: 8,
right: 8,
),
decoration: BoxDecoration(
// color: Colors.blue,
color: isSelected ? Color(0xFF114D8B) : Colors.white,
// : Color(0xFFEBEBF7),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Colors.white, // Light grey border
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.grey.withAlpha(90), // Shadow color
blurRadius: 1, // Blur radius
spreadRadius: 1, // Spread radius
offset: Offset(0, 1), // Shadow position
),
],
),
alignment: Alignment.center,
child: Text(
service,
style: GoogleFonts.poppins(
color: isSelected ? Colors.white : Colors.black87,
fontSize: 13,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.w100,
),
),
],
),
alignment: Alignment.center,
child: Text(
service,
style: GoogleFonts.poppins(
color: isSelected ? Colors.white : Colors.black87,
fontSize: 13,
fontWeight:
isSelected ? FontWeight.bold : FontWeight.w100,
),
),
),
),
);
}).toList(),
);
}).toList(),
),
),
);
@ -1455,14 +1458,14 @@ class _PolicyState extends State<Policy> {
borderRadius: BorderRadius.circular(4), // Rounded rectangle
border: Border.all(
color:
_selectedTripType == "1" ? Colors.green : Colors.black,
_selectedTripType == "1" ? Colors.green : Colors.black,
width: _selectedTripType == "1" ? 2 : 1,
),
),
child:
_selectedTripType == "1"
? Icon(Icons.rectangle, size: 8, color: Colors.green)
: null, // Add checkmark if selected
_selectedTripType == "1"
? Icon(Icons.rectangle, size: 8, color: Colors.green)
: null, // Add checkmark if selected
),
),
],
@ -1511,14 +1514,14 @@ class _PolicyState extends State<Policy> {
borderRadius: BorderRadius.circular(4), // Rounded rectangle
border: Border.all(
color:
_selectedTripType == "2" ? Colors.green : Colors.black,
_selectedTripType == "2" ? Colors.green : Colors.black,
width: _selectedTripType == "2" ? 2 : 1,
),
),
child:
_selectedTripType == "2"
? Icon(Icons.rectangle, size: 8, color: Colors.green)
: null, // Add checkmark if selected
_selectedTripType == "2"
? Icon(Icons.rectangle, size: 8, color: Colors.green)
: null, // Add checkmark if selected
),
),
],
@ -1563,17 +1566,17 @@ class _PolicyState extends State<Policy> {
SizedBox(width: 20),
MouseRegion(
cursor:
isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
isViewMode
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
isViewMode ? layoutColor : layoutColor, // Keep original color
isViewMode ? layoutColor : layoutColor, // Keep original color
foregroundColor:
isViewMode ? Colors.white : Colors.white, // Keep original color
isViewMode ? Colors.white : Colors.white, // Keep original color
disabledBackgroundColor:
layoutColor, // Ensure color remains when disabled
layoutColor, // Ensure color remains when disabled
disabledForegroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@ -1582,8 +1585,8 @@ class _PolicyState extends State<Policy> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
onPressed:
// isViewMode ? null : handleSubmit, // Disable when in view mode
isViewMode || isDisable ? null : handleSubmit,
// isViewMode ? null : handleSubmit, // Disable when in view mode
isViewMode || isDisable ? null : handleSubmit,
child: Text("Submit", style: GoogleFonts.poppins(fontSize: 10)),
),
),
@ -1655,4 +1658,4 @@ class _PolicyState extends State<Policy> {
),
];
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -31,14 +31,34 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
SemanticsBinding.instance.ensureSemantics(); // Safe here - for testing uncomment this
SemanticsBinding.instance
.ensureSemantics(); // Safe here -only for testing uncomment, Otherwise Email Template wont allow to type
if (kIsWeb) {
final uri = Uri.parse(html.window.location.href);
print("URI - $uri");
final fragment = uri.fragment; // e.g., 'authredirection?code=xyz123'
if (uri.path == '/tstat/authredirection' &&
uri.queryParameters['code'] != null) {
_authCode = uri.queryParameters['code'];
print("Full URI: $uri");
print("Fragment: $fragment");
// Parse just the fragment safely
final fragmentParts = fragment.split('?');
print("fragmentParts: $fragmentParts");
final fragmentPath = fragmentParts.first;
print("fragmentPath: $fragmentPath");
final query = fragmentParts.length > 1 ? fragmentParts[1] : '';
print("query: $query");
final queryParams = Uri.splitQueryString(query);
print("query: $query");
final authCode = queryParams['code'];
if (fragmentPath == '/authredirection' && authCode != null) {
// _authCode = uri.queryParameters['code'];
_authCode = queryParams['code'];
// _isAuthRedirect = true;
html.window.console.log("Auth code detected: $_authCode");
// print(">>> _isAuthRedirect: $_isAuthRedirect");
@ -54,9 +74,14 @@ class _MyAppState extends State<MyApp> {
}
Future<void> handleTokenUsingMS(String? authCode) async {
print("handleTokenUsingMS- $authCode");
if (authCode == null) return;
// final url =
// 'http://localhost:40617/tstat/auth/verifyMSAuthUser?code=$authCode';
final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
print("url- $url");
try {
final response = await http.get(
Uri.parse(url),
@ -103,57 +128,6 @@ class _MyAppState extends State<MyApp> {
}
}
// Future<void> handleTokenUsingMS(authCode) async {
// if (authCode == null) return;
//
// final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
// try {
// final response = await http.get(
// Uri.parse(url),
// headers: {'Content-Type': 'application/json'},
// );
//
// if (response.statusCode == 200) {
// final MS_Token = json.decode(response.body)['token'];
// print("MS_Token - $MS_Token");
//
// if (MS_Token != '') {
// print('Microsoft - Token Available');
// await storeUserDetails(MS_Token);
//
// print("userRole - $userRole");
//
// if (userRole == "Travel Agent") {
// router.go('/listTravelAgentPlan');
// } else if (userRole == "Org Admin" || userRole == "Travel Admin") {
// router.go('/listAllPlan');
// } else {
// router.go('/listPlan');
// }
// } else {
// print('Microsoft - Token Not Available');
// throw Exception('Token not Founded');
// }
// } else {
// // final errorMessage = json.decode(response.body)['message'];
// // print(errorMessage);
// // throw Exception(errorMessage);
//
// try {
// final errorMessage = json.decode(response.body)['message'];
// print(errorMessage);
// throw Exception(errorMessage);
// } catch (_) {
// print("Non-JSON error from server: ${response.body}");
// throw Exception("Authentication failed: ${response.body}");
// }
// }
// } catch (e) {
// router.go('/');
// print("Error: $e");
// }
// }
Future<void> storeUserDetails(String token) async {
try {
final parts = token.split('.');
@ -209,176 +183,3 @@ class _MyAppState extends State<MyApp> {
);
}
}
//
// import 'package:flutter/foundation.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/rendering.dart';
// import 'package:flutter_quill/flutter_quill.dart';
// import 'package:flutter_localizations/flutter_localizations.dart';
//
// import 'package:frontend/routes/custom_router.dart';
// import 'dart:html' as html;
// import 'package:frontend/config/apiUrl.dart'; // 1 newly added
// import 'package:go_router/go_router.dart';
// import 'package:http/http.dart' as http; // 2 newly added
// import 'dart:convert'; // 3 newly added
//
// import 'package:shared_preferences/shared_preferences.dart';
//
// import 'Screens/myTemplates/templateTest.dart';
//
// class MyApp extends StatefulWidget {
// const MyApp({super.key});
//
// @override
// State<MyApp> createState() => _MyAppState();
// }
//
// class _MyAppState extends State<MyApp> {
// String? _authCode;
// String? userRole;
// bool _isAuthRedirect = false;
// @override
// void initState() {
// super.initState();
// SemanticsBinding.instance.ensureSemantics(); // Safe here
// if (kIsWeb) {
// final uri = Uri.parse(html.window.location.href);
// if (uri.path == '/authredirection' &&
// uri.queryParameters['code'] != null) {
// _authCode = uri.queryParameters['code'];
// // _isAuthRedirect = true;
// html.window.console.log("Auth code detected: $_authCode");
// // print(">>> _isAuthRedirect: $_isAuthRedirect");
// print(">>> Auth code found at startup: $_authCode");
//
// WidgetsBinding.instance.addPostFrameCallback((_) {
// handleTokenUsingMS(_authCode);
// });
// } else {
// html.window.console.log("No auth code found or wrong path.");
// }
// }
// }
//
// Future<void> handleTokenUsingMS(authCode) async {
// if (authCode == null) return;
//
// final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
// try {
// final response = await http.get(
// Uri.parse(url),
// headers: {'Content-Type': 'application/json'},
// );
//
// if (response.statusCode == 200) {
// final MS_Token = json.decode(response.body)['token'];
// print("MS_Token - $MS_Token");
//
// if (MS_Token != '') {
// print('Microsoft - Token Available');
// await storeUserDetails(MS_Token);
//
// print("userRole - $userRole");
//
// if (userRole == "Travel Agent") {
// router.go('/listTravelAgentPlan');
// } else if (userRole == "Org Admin" || userRole == "Travel Admin") {
// router.go('/listAllPlan');
// } else {
// router.go('/listPlan');
// }
// } else {
// print('Microsoft - Token Not Available');
// throw Exception('Token not Founded');
// }
// } else {
// final errorMessage = json.decode(response.body)['message'];
// print(errorMessage);
// throw Exception(errorMessage);
// }
// } catch (e) {
// print("Error: $e");
// }
// }
//
// Future<void> storeUserDetails(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('auth_token', token);
// await prefs.setString(
// 'user_data',
// jsonEncode(userData),
// ); // Store full user data
//
// if (userData != null) {
// final pref = await SharedPreferences.getInstance();
// await pref.setString('auth_token', token);
// await pref.setString('user_data', jsonEncode(userData));
//
// userRole = userData['role'];
//
// print("userData - $userData");
// print("userData11 - ${userData['role']}");
// print("userData12 - $userRole");
// }
// } catch (e) {
// print('Error decoding token: $e');
// }
// }
//
// @override
// Widget build(BuildContext context) {
// // if (_isAuthRedirect) {
// // print("Rendering MicrosoftPage with code: $_authCode");
// // return MaterialApp(
// // home: MicrosoftPage(code: _authCode),
// // debugShowCheckedModeBanner: false,
// // );
// // }
// // return MaterialApp(
// // title: 'Quill Web Test',
// // localizationsDelegates: const [
// // GlobalMaterialLocalizations.delegate,
// // GlobalCupertinoLocalizations.delegate,
// // GlobalWidgetsLocalizations.delegate,
// // FlutterQuillLocalizations.delegate,
// // ],
// // supportedLocales: const [Locale('en')],
// // home: const MyHomePage(title: 'Flutter Demo Home Page'),
// // );
// return MaterialApp.router(
// title: 'TRIP MANAGEMENT',
// routerConfig: router,
// debugShowCheckedModeBanner: false,
// localizationsDelegates: const [
// GlobalMaterialLocalizations.delegate,
// GlobalCupertinoLocalizations.delegate,
// GlobalWidgetsLocalizations.delegate,
// FlutterQuillLocalizations.delegate,
// ],
// supportedLocales: const [
// Locale('en'),
// Locale('es'), // Add more as needed
// ],
// localeResolutionCallback: (locale, supportedLocales) {
// for (var supportedLocale in supportedLocales) {
// if (supportedLocale.languageCode == locale?.languageCode) {
// return supportedLocale;
// }
// }
// return supportedLocales.first;
// },
// );
// }
// }

View File

@ -1,4 +1,5 @@
//api url
// const String apiUrl = 'http://localhost/tstat_be';
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be'; // look at this
const String apiUrl =
'http://apitest.tripapprovaltool.com/tstat_be'; // look at this

View File

@ -145,6 +145,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.1"
dotted_border:
dependency: "direct main"
description:
name: dotted_border
sha256: "99b091ec6891ba0c5331fdc2b502993c7c108f898995739a73c6845d71dad70c"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
dropdown_search:
dependency: "direct main"
description:

View File

@ -63,6 +63,7 @@ dependencies:
html2md: ^1.3.2
flutter_quill_delta_from_html: ^1.5.2
flutter_launcher_icons: ^0.14.4
dotted_border: ^3.1.0

View File

@ -31,7 +31,7 @@
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>frontend</title>
<title>Trip Approval Tool</title>
<link rel="manifest" href="manifest.json">
</head>
<body>