ItineratRefresh

This commit is contained in:
venbaittech 2025-06-09 18:43:20 +05:30
parent a8712dcb68
commit 4887c69950
16 changed files with 107 additions and 33 deletions

View File

@ -913,7 +913,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
size: 18,
),
tooltip:
'Download The Trip Details',
'Download The PDF',
onPressed: () {
Navigator.pop(
context,

View File

@ -931,7 +931,7 @@ class _ApprovalListState extends State<ApprovalList> {
size: 18,
),
tooltip:
'Download The Trip Details',
'Download The PDF',
onPressed: () {
Navigator.pop(
context,
@ -1170,7 +1170,7 @@ class _ApprovalListState extends State<ApprovalList> {
size: 18,
),
tooltip:
'Download The Trip Details',
'Download The PDF',
onPressed: () {
Navigator.pop(context);
apiService

View File

@ -559,6 +559,7 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
initialDate: initialDate,
firstDate: initialDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// DateTime? pickedDate = await showDatePicker(
@ -703,6 +704,7 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
initialDate: initialDate,
firstDate: firstDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {

View File

@ -376,6 +376,7 @@ class _BusScreenState extends State<BusScreen> {
: today,
firstDate: today,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
@ -418,8 +419,6 @@ class _BusScreenState extends State<BusScreen> {
if (isToday && isPastTime) {
setState(() {
errorMessages["time"] = "You can't select a past time.";
_selectedCheckOutTime = null; // Reset time variable
_timeController.text = ""; // Clear text field
});
return;
} else {
@ -585,7 +584,11 @@ class _BusScreenState extends State<BusScreen> {
child: SizedBox(
height: 40,
child: GestureDetector(
onTap: () => _selectCheckOutTime(context),
onTap: () {
// _selectedCheckOutTime = null; // Reset time variable
_timeController.text = ""; // Clear text field
_selectCheckOutTime(context);
},
child: AbsorbPointer(
child: TextField(
focusNode: _timeFocusNode,

View File

@ -1208,6 +1208,7 @@ class FlightScreenState extends State<FlightScreen> {
initialDate: initialDate,
firstDate: firstDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {

View File

@ -819,6 +819,7 @@ class _ForexScreenState extends State<ForexScreen> {
initialDate: initialDate,
firstDate: initialDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// DateTime? pickedDate = await showDatePicker(
@ -870,6 +871,7 @@ class _ForexScreenState extends State<ForexScreen> {
initialDate: initialDate,
firstDate: initialDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// DateTime? pickedDate = await showDatePicker(

View File

@ -576,6 +576,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
initialDate: initialDate,
firstDate: initialDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// DateTime? pickedDate = await showDatePicker(
@ -602,12 +603,12 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
DateTime now = DateTime.now();
DateTime today = DateTime(now.year, now.month, now.day);
DateTime? checkInDate;
try {
checkInDate = DateTime.parse(_startdateController.text);
} catch (e) {
checkInDate = today;
}
// DateTime? checkInDate;
// try {
// checkInDate = DateTime.parse(_startdateController.text);
// } catch (e) {
// checkInDate = today;
// }
// // Ensure at least today is used
// DateTime firstDate = checkInDate.isAfter(today) ? checkInDate : today;
@ -616,20 +617,52 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
// ? _selectedCheckOutDate!
// : firstDate;
DateTime firstDate = checkInDate;
DateTime initialDate =
_selectedCheckOutDate != null &&
_selectedCheckOutDate!.isAfter(firstDate)
? _selectedCheckOutDate!
: firstDate;
// DateTime firstDate = checkInDate;
// DateTime initialDate =
// _selectedCheckOutDate != null &&
// _selectedCheckOutDate!.isAfter(firstDate)
// ? _selectedCheckOutDate!
// : firstDate;
DateTime? validFromDate;
try {
String fromDateText = _startdateController.text.trim();
print("Valid From Text: $fromDateText");
if (fromDateText.isNotEmpty) {
validFromDate = DateFormat('dd-MM-yyyy').parseStrict(fromDateText);
print("Parsed Valid From: $validFromDate");
}
} catch (e) {
print("Error parsing valid from date: $e");
}
// Use max(today, validFromDate) as firstDate
// DateTime firstDate = today;
DateTime firstDate = validFromDate ?? today;
if (validFromDate != null && validFromDate.isAfter(today)) {
firstDate = validFromDate;
}
final pickedDate = await showDatePicker(
context: context,
initialDate: initialDate,
// initialDate: initialDate,
// firstDate: initialDate,
// firstDate: DateTime(1900),
initialDate: firstDate,
firstDate: firstDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// final pickedDate = await showDatePicker(
// context: context,
// // initialDate: initialDate,
// initialDate: initialDate,
// firstDate: initialDate,
// lastDate: DateTime(2100),
// initialEntryMode: DatePickerEntryMode.calendarOnly,
// );
// DateTime? pickedDate = await showDatePicker(
// context: context,
// initialDate: _selectedCheckOutDate != null &&

View File

@ -484,6 +484,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
: today,
firstDate: today,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {

View File

@ -243,6 +243,12 @@ class _TrainScreenState extends State<TrainScreen> {
}
}
if (selectedFrom == selectedTo) {
errorMessages["to_station"] = "Change Destination";
}
print("Error: to_place -> Change Destination (selectedFrom == selectedTo)");
return errorMessages.isEmpty; // Valid if there are no errors
}
@ -464,6 +470,7 @@ class _TrainScreenState extends State<TrainScreen> {
: today,
firstDate: today,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
@ -801,7 +808,10 @@ class _TrainScreenState extends State<TrainScreen> {
),
if (errorMessages["to_station"] != null) ...[
SizedBox(height: 5), // Space before error message
Text("Required", style: TextStyle(color: Colors.red, fontSize: 12)),
Text(
errorMessages["to_station"]!,
style: TextStyle(color: Colors.red, fontSize: 12),
),
],
],
),

View File

@ -394,6 +394,7 @@ class _VisaScreenState extends State<VisaScreen> {
initialDate: initialDate,
firstDate: initialDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
// DateTime? pickedDate = await showDatePicker(

View File

@ -107,6 +107,7 @@ class DynamicItineraryState extends State<DynamicItinerary> {
// selectedIndex = null;
// selectedItem = null;
// });
updateTripType(widget.tripType);
}
}
@ -166,6 +167,20 @@ class DynamicItineraryState extends State<DynamicItinerary> {
}
List<String> getAllowedServiceNames() {
print(
"DID Updatee changee - $selectedOption $selectedListOption $isSelected $selectedItem $selectedIndex",
);
setState(() {
selectedOption = "";
selectedListOption = "";
isSelected = false;
selectedIndex = null;
selectedItem = null;
});
print(
"DID Updatee changee - $selectedOption $isSelected $selectedItem $selectedIndex",
);
if (widget.tripType == "1") {
return ["flight", "accomodation", "train", "bus", "taxi"];
} else if (widget.tripType == "2") {

View File

@ -1009,7 +1009,7 @@ class _ListPlansState extends State<ListPlans> {
size: 18,
),
tooltip:
'Download The Trip Comments',
'Download The PDF',
onPressed: () {
Navigator.pop(
context,
@ -1256,7 +1256,7 @@ class _ListPlansState extends State<ListPlans> {
size: 18,
),
tooltip:
'Download The Trip Comments',
'Download The PDF',
onPressed: () {
Navigator.pop(context);
apiService

View File

@ -1342,6 +1342,7 @@ class _OfficeDetailsState extends State<OfficeDetails> {
: today,
firstDate: today,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
@ -1450,6 +1451,7 @@ class _OfficeDetailsState extends State<OfficeDetails> {
: minDate,
firstDate: minDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedEndDate) {

View File

@ -639,7 +639,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
children: [
if (!widget.apiselectedUser) ...[
buildPassword(),
SizedBox(width: MediaQuery.of(context).size.width*0.015),
SizedBox(
width: MediaQuery.of(context).size.width * 0.015,
),
buildRole(),
] else ...[
// TextButton(
@ -1046,6 +1048,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
: today,
firstDate: DateTime(1900),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedDateOfBirth) {

View File

@ -163,8 +163,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
if (!isValid) {
setState(() {
errorMessages["passport_number"] =
"Enter 8 characters";
errorMessages["passport_number"] = "Enter 8 characters";
});
return false;
} else {
@ -177,8 +176,6 @@ class TravellerDetailsState extends State<TravellerDetails> {
return true;
}
Future<void> apiCheckDuplicate(
String label,
String field,
@ -1370,6 +1367,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
// firstDate: today,
firstDate: DateTime(1900),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedDateOfIssue) {
@ -1480,16 +1478,17 @@ class TravellerDetailsState extends State<TravellerDetails> {
DateTime? pickedDate = await showDatePicker(
context: context,
// initialDate:
// _selectedDateOfExpiry != null &&
// _selectedDateOfExpiry!.isAfter(firstDate)
// ? _selectedDateOfExpiry!
// : today,
initialDate:firstDate,
initialDate: firstDate,
firstDate: firstDate,
// firstDate: DateTime(1900),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null) {
@ -2060,7 +2059,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
vertical: 8,
),
child: Text(
item['dropdown_value'] ?? "Select Seat",
item['dropdown_value'] ?? "Select Seat",
style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
@ -2602,6 +2601,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
: today,
firstDate: DateTime(1900),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedExpiryDate) {
@ -3790,6 +3790,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
// firstDate: initialDate,
firstDate: DateTime(1900),
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
@ -3866,7 +3867,6 @@ class TravellerDetailsState extends State<TravellerDetails> {
print("buildVisaValidUpTo ");
print("buildVisaValidUpTo - ${entry["controller_valid_from"].text}");
// Parse date from notifier if available, else use today
DateTime initialDate = today;
@ -3903,6 +3903,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
initialDate: firstDate,
firstDate: firstDate,
lastDate: DateTime(2100),
initialEntryMode: DatePickerEntryMode.calendarOnly,
);
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {

View File

@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// import 'package:flutter/rendering.dart';
import 'package:flutter/rendering.dart';
import 'dart:html' as html;
import 'package:frontend/config/apiUrl.dart'; // 1 newly added
import 'package:frontend/services/apiService.dart';
@ -31,7 +31,7 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// SemanticsBinding.instance.ensureSemantics(); // Safe here
SemanticsBinding.instance.ensureSemantics(); // Safe here
if (kIsWeb) {
final uri = Uri.parse(html.window.location.href);
if (uri.path == '/authredirection' &&