Merge branch 'main' of bitbucket.org:venbainformationtechnology/ts-tat
This commit is contained in:
commit
2e85273b06
File diff suppressed because it is too large
Load Diff
@ -1096,8 +1096,9 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["end_date"]!,
|
errorMessages["end_date"]!,
|
||||||
// "Select End Date",
|
style: const TextStyle(color: Colors.red, fontSize: 12),
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
|
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -38,20 +38,21 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
|
|
||||||
final FocusNode _tripTypeFocusNode = FocusNode();
|
final FocusNode _tripTypeFocusNode = FocusNode();
|
||||||
final FocusNode _hotelNameFocusNode = FocusNode();
|
final FocusNode _hotelNameFocusNode = FocusNode();
|
||||||
final FocusNode _fromFocusNode = FocusNode();
|
final FocusNode _startDateFocusNode = FocusNode();
|
||||||
final FocusNode _dateFocusNode = FocusNode();
|
final FocusNode _endDateFocusNode = FocusNode();
|
||||||
final FocusNode _commentsFocusNode = FocusNode();
|
final FocusNode _commentsFocusNode = FocusNode();
|
||||||
final FocusNode _nomineeFocusNode = FocusNode();
|
final FocusNode _nomineeFocusNode = FocusNode();
|
||||||
|
|
||||||
late TextEditingController _tripTypeController = TextEditingController();
|
late TextEditingController _tripTypeController = TextEditingController();
|
||||||
late TextEditingController _startdateController = TextEditingController();
|
late TextEditingController _startDateController = TextEditingController();
|
||||||
late TextEditingController _endDateController = TextEditingController();
|
late TextEditingController _endDateController = TextEditingController();
|
||||||
late TextEditingController _insuranceCommentsController =
|
late TextEditingController _insuranceCommentsController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
late TextEditingController _nomineeController = TextEditingController();
|
late TextEditingController _nomineeController = TextEditingController();
|
||||||
|
|
||||||
bool _isHotelNameFocused = false;
|
bool _isHotelNameFocused = false;
|
||||||
bool _dateFocus = false;
|
bool _startDateFocus = false;
|
||||||
|
bool _endDateFocus = false;
|
||||||
bool _commentsFocus = false;
|
bool _commentsFocus = false;
|
||||||
bool _nomineeFocus = false;
|
bool _nomineeFocus = false;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
Map<String, dynamic> get InsuranceData {
|
Map<String, dynamic> get InsuranceData {
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
"type_of_insurance": selectedInsuranceType,
|
"type_of_insurance": selectedInsuranceType,
|
||||||
"start_date": _startdateController.text,
|
"start_date": _startDateController.text,
|
||||||
"end_date": _endDateController.text,
|
"end_date": _endDateController.text,
|
||||||
"comments": _insuranceCommentsController.text,
|
"comments": _insuranceCommentsController.text,
|
||||||
"nominee_name": _nomineeController.text,
|
"nominee_name": _nomineeController.text,
|
||||||
@ -93,9 +94,14 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
_isHotelNameFocused = _hotelNameFocusNode.hasFocus;
|
_isHotelNameFocused = _hotelNameFocusNode.hasFocus;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
_dateFocusNode.addListener(() {
|
_endDateFocusNode.addListener(() {
|
||||||
setState(() {
|
setState(() {
|
||||||
_dateFocus = _fromFocusNode.hasFocus;
|
_endDateFocus = _endDateFocusNode.hasFocus;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
_startDateFocusNode.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
_startDateFocus = _startDateFocusNode.hasFocus;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
_commentsFocusNode.addListener(() {
|
_commentsFocusNode.addListener(() {
|
||||||
@ -113,7 +119,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
_insuranceCommentsController = TextEditingController(
|
_insuranceCommentsController = TextEditingController(
|
||||||
text: widget.selectedItem?["comments"] ?? "",
|
text: widget.selectedItem?["comments"] ?? "",
|
||||||
);
|
);
|
||||||
_startdateController = TextEditingController(
|
_startDateController = TextEditingController(
|
||||||
text: widget.selectedItem?["start_date"] ?? "",
|
text: widget.selectedItem?["start_date"] ?? "",
|
||||||
);
|
);
|
||||||
_endDateController = TextEditingController(
|
_endDateController = TextEditingController(
|
||||||
@ -141,26 +147,15 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
// ✅ Only set controller after value is updated
|
// ✅ Only set controller after value is updated
|
||||||
// final parsedDate =
|
// final parsedDate =
|
||||||
// DateTime.tryParse(flightFirstTripDateNotifier.value ?? '');
|
// DateTime.tryParse(flightFirstTripDateNotifier.value ?? '');
|
||||||
final parsedDate = DateFormat(
|
final parsedDate = DateFormat("dd-MM-yyyy").parse(flightFirstTripDateNotifier.value ?? '');
|
||||||
"dd-MM-yyyy",
|
if (parsedDate != null) { _startDateController.text = DateFormat('dd-MM-yyyy').format(parsedDate); }
|
||||||
).parse(flightFirstTripDateNotifier.value ?? '');
|
|
||||||
if (parsedDate != null) {
|
|
||||||
_startdateController.text = DateFormat('dd-MM-yyyy').format(parsedDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
final parsedEndDate = DateFormat(
|
final parsedEndDate = DateFormat("dd-MM-yyyy").parse(flightLastTripDateNotifier.value ?? '');
|
||||||
"dd-MM-yyyy",
|
if (parsedEndDate != null) { _endDateController.text = DateFormat('dd-MM-yyyy').format(parsedEndDate); }
|
||||||
).parse(flightLastTripDateNotifier.value ?? '');
|
|
||||||
if (parsedEndDate != null) {
|
print("parsedDate $parsedDate");
|
||||||
_endDateController.text = DateFormat(
|
print("parsedEndDate $parsedEndDate");
|
||||||
'dd-MM-yyyy',
|
|
||||||
).format(parsedEndDate);
|
|
||||||
|
|
||||||
print("parsedDate");
|
|
||||||
print(parsedDate);
|
|
||||||
print("parsedEndDate");
|
|
||||||
print(parsedEndDate);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +262,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
_tripTypeFocusNode.dispose();
|
_tripTypeFocusNode.dispose();
|
||||||
_tripTypeController.dispose();
|
_tripTypeController.dispose();
|
||||||
_startdateController.dispose();
|
_startDateController.dispose();
|
||||||
|
_endDateController.dispose();
|
||||||
_insuranceCommentsController.dispose();
|
_insuranceCommentsController.dispose();
|
||||||
_nomineeController.dispose();
|
_nomineeController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@ -592,105 +588,23 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
|
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedCheckOutDate = pickedDate;
|
_selectedCheckOutDate = pickedDate;
|
||||||
_startdateController.text = DateFormat(
|
_startDateController.text = DateFormat(
|
||||||
'dd-MM-yyyy',
|
'dd-MM-yyyy',
|
||||||
).format(pickedDate);
|
).format(pickedDate);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> _selectEndCheckOutDate(BuildContext context) async {
|
|
||||||
// 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;
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
// // // Ensure at least today is used
|
|
||||||
// // DateTime firstDate = checkInDate.isAfter(today) ? checkInDate : today;
|
|
||||||
// // 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,
|
|
||||||
// // 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 &&
|
|
||||||
// // _selectedCheckOutDate!.isAfter(today)
|
|
||||||
// // ? _selectedCheckOutDate!
|
|
||||||
// // : today,
|
|
||||||
// // firstDate: today,
|
|
||||||
// // lastDate: DateTime(2100),
|
|
||||||
// // );
|
|
||||||
//
|
|
||||||
// if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
|
|
||||||
// setState(() {
|
|
||||||
// _selectedCheckOutDate = pickedDate;
|
|
||||||
// _endDateController.text = DateFormat('dd-MM-yyyy').format(pickedDate);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<void> _selectEndCheckOutDate(BuildContext context) async {
|
Future<void> _selectEndCheckOutDate(BuildContext context) async {
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
DateTime today = DateTime(now.year, now.month, now.day);
|
DateTime today = DateTime(now.year, now.month, now.day);
|
||||||
|
|
||||||
DateTime? checkInDate;
|
// DateTime? checkInDate;
|
||||||
try {
|
// try {
|
||||||
checkInDate = DateTime.parse(_startdateController.text);
|
// checkInDate = DateTime.parse(_startDateController.text);
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
checkInDate = today;
|
// checkInDate = today;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// // Ensure at least today is used
|
// // Ensure at least today is used
|
||||||
// DateTime firstDate = checkInDate.isAfter(today) ? checkInDate : today;
|
// DateTime firstDate = checkInDate.isAfter(today) ? checkInDate : today;
|
||||||
@ -699,20 +613,52 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
// ? _selectedCheckOutDate!
|
// ? _selectedCheckOutDate!
|
||||||
// : firstDate;
|
// : firstDate;
|
||||||
|
|
||||||
DateTime firstDate = checkInDate;
|
// DateTime firstDate = checkInDate;
|
||||||
DateTime initialDate =
|
// DateTime initialDate =
|
||||||
_selectedCheckOutDate != null &&
|
// _selectedCheckOutDate != null &&
|
||||||
_selectedCheckOutDate!.isAfter(firstDate)
|
// _selectedCheckOutDate!.isAfter(firstDate)
|
||||||
? _selectedCheckOutDate!
|
// ? _selectedCheckOutDate!
|
||||||
: firstDate;
|
// : 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(
|
final pickedDate = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: initialDate,
|
// initialDate: initialDate,
|
||||||
|
// firstDate: initialDate,
|
||||||
|
// firstDate: DateTime(1900),
|
||||||
|
initialDate: firstDate,
|
||||||
firstDate: firstDate,
|
firstDate: firstDate,
|
||||||
lastDate: DateTime(2100),
|
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(
|
// DateTime? pickedDate = await showDatePicker(
|
||||||
// context: context,
|
// context: context,
|
||||||
// initialDate: _selectedCheckOutDate != null &&
|
// initialDate: _selectedCheckOutDate != null &&
|
||||||
@ -806,7 +752,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
child: DropdownSearch<Map<String, dynamic>>(
|
child: DropdownSearch<Map<String, dynamic>>(
|
||||||
items: purposeList.cast<Map<String, dynamic>>(),
|
items: purposeList.cast<Map<String, dynamic>>(),
|
||||||
selectedItem: purposeList.firstWhere(
|
selectedItem: purposeList.firstWhere(
|
||||||
(item) => item['dropdown_key'] == selectedInsuranceType,
|
(item) => item['dropdown_key'] == selectedInsuranceType,
|
||||||
orElse: () => {},
|
orElse: () => {},
|
||||||
),
|
),
|
||||||
itemAsString: (item) => item['dropdown_value'] ?? '',
|
itemAsString: (item) => item['dropdown_value'] ?? '',
|
||||||
@ -833,10 +779,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
dropdownDecoratorProps: const DropDownDecoratorProps(
|
dropdownDecoratorProps: const DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 10,),
|
||||||
horizontal: 10,
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (context, selectedItem) {
|
||||||
@ -858,19 +801,18 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onChanged:
|
onChanged:
|
||||||
purposeList.isNotEmpty
|
purposeList.isNotEmpty
|
||||||
? (Map<String, dynamic>? newValue) {
|
? (Map<String, dynamic>? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedInsuranceType = newValue?['dropdown_key'];
|
selectedInsuranceType= newValue?['dropdown_key'];
|
||||||
print(
|
print("selected Insurance Type: ${selectedInsuranceType}");
|
||||||
"selected Insurance Type: ${selectedInsuranceType}",
|
});
|
||||||
);
|
}
|
||||||
});
|
: null,
|
||||||
}
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
@ -925,7 +867,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: _dateFocus,
|
isFocused: _startDateFocus,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -933,7 +875,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _selectCheckOutDate(context);
|
await _selectCheckOutDate(context);
|
||||||
if (_startdateController.text.isNotEmpty) {
|
if (_startDateController.text.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
errorMessages.remove(
|
errorMessages.remove(
|
||||||
"start_date",
|
"start_date",
|
||||||
@ -943,8 +885,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
},
|
},
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: _dateFocusNode,
|
focusNode: _startDateFocusNode,
|
||||||
controller: _startdateController,
|
controller: _startDateController,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "Select ",
|
labelText: "Select ",
|
||||||
@ -983,7 +925,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: _dateFocus,
|
isFocused: _endDateFocus,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -993,7 +935,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
await _selectEndCheckOutDate(context);
|
await _selectEndCheckOutDate(context);
|
||||||
|
|
||||||
if (_endDateController.text.isNotEmpty) {
|
if (_endDateController.text.isNotEmpty) {
|
||||||
DateTime? startDate = _parseDate(_startdateController.text);
|
DateTime? startDate = _parseDate(_startDateController.text);
|
||||||
DateTime? endDate = _parseDate(_endDateController.text);
|
DateTime? endDate = _parseDate(_endDateController.text);
|
||||||
|
|
||||||
if (startDate != null &&
|
if (startDate != null &&
|
||||||
@ -1012,7 +954,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
},
|
},
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: _dateFocusNode,
|
focusNode: _endDateFocusNode,
|
||||||
controller: _endDateController,
|
controller: _endDateController,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
@ -1035,9 +977,10 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
|||||||
if (errorMessages["end_date"] != null) ...[
|
if (errorMessages["end_date"] != null) ...[
|
||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
// "Required",
|
|
||||||
errorMessages["end_date"]!,
|
errorMessages["end_date"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: const TextStyle(color: Colors.red, fontSize: 12),
|
||||||
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
|
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -334,7 +334,7 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Visa Type",
|
" Country",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
@ -342,7 +342,7 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
" Country",
|
" Visa Type",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
@ -372,8 +372,8 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
getRequestForVisa(
|
getRequestForCountry(
|
||||||
item["type_of_visa"]!.toString()),
|
item["country_code"]!.toString()),
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -384,8 +384,8 @@ class VisaListWidget extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
getRequestForCountry(
|
getRequestForVisa(
|
||||||
item["country_code"]!.toString()),
|
item["type_of_visa"]!.toString()),
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|||||||
@ -42,9 +42,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
final GlobalKey<PersonalDetailsState> personalDetailsKey =
|
final GlobalKey<PersonalDetailsState> personalDetailsKey =
|
||||||
GlobalKey<PersonalDetailsState>();
|
GlobalKey<PersonalDetailsState>();
|
||||||
final GlobalKey<TravellerDetailsState> travellerDetailsKey =
|
final GlobalKey<TravellerDetailsState> travellerDetailsKey =
|
||||||
GlobalKey<TravellerDetailsState>();
|
GlobalKey<TravellerDetailsState>();
|
||||||
|
|
||||||
// late List<Map<String, dynamic>?> travelDetailsData;
|
// late List<Map<String, dynamic>?> travelDetailsData;
|
||||||
Map<String, dynamic>? travelDetailsData;
|
Map<String, dynamic>? travelDetailsData;
|
||||||
@ -299,7 +299,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// Fix the invalid JSON (dangerous if the format changes)
|
// Fix the invalid JSON (dangerous if the format changes)
|
||||||
final fixedJson = raw.replaceAllMapped(
|
final fixedJson = raw.replaceAllMapped(
|
||||||
RegExp(r'(\w+):'), // matches `service_id:`
|
RegExp(r'(\w+):'), // matches `service_id:`
|
||||||
(match) => '"${match.group(1)}":',
|
(match) => '"${match.group(1)}":',
|
||||||
);
|
);
|
||||||
|
|
||||||
List<dynamic> decodedList = jsonDecode(fixedJson);
|
List<dynamic> decodedList = jsonDecode(fixedJson);
|
||||||
@ -363,7 +363,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
final extraData =
|
final extraData =
|
||||||
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
GoRouterState.of(context).extra as Map<String, dynamic>?;
|
||||||
|
|
||||||
if (extraData != null) {
|
if (extraData != null) {
|
||||||
print("extraData: ${extraData['selectedUser']}");
|
print("extraData: ${extraData['selectedUser']}");
|
||||||
@ -381,8 +381,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
// Handle selectedUser as a Map (not a List)
|
// Handle selectedUser as a Map (not a List)
|
||||||
apiselectedUser =
|
apiselectedUser =
|
||||||
extraData['selectedUser']
|
extraData['selectedUser']
|
||||||
as Map<String, dynamic>?; // Cast it as a Map
|
as Map<String, dynamic>?; // Cast it as a Map
|
||||||
isViewMode = extraData['isViewMode'] ?? false;
|
isViewMode = extraData['isViewMode'] ?? false;
|
||||||
isEditProfile = extraData['isEditProfile'] ?? false;
|
isEditProfile = extraData['isEditProfile'] ?? false;
|
||||||
});
|
});
|
||||||
@ -444,7 +444,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
userMap = {
|
userMap = {
|
||||||
for (var user in userList)
|
for (var user in userList)
|
||||||
user['user_id'].toString():
|
user['user_id'].toString():
|
||||||
"${user['first_name']} ${user['last_name']}",
|
"${user['first_name']} ${user['last_name']}",
|
||||||
};
|
};
|
||||||
userIdsApi = userMap.keys.toList();
|
userIdsApi = userMap.keys.toList();
|
||||||
});
|
});
|
||||||
@ -483,14 +483,14 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
layoutColor =
|
layoutColor =
|
||||||
layoutString != null
|
layoutString != null
|
||||||
? Color(int.parse(layoutString))
|
? Color(int.parse(layoutString))
|
||||||
: Colors.redAccent;
|
: Colors.redAccent;
|
||||||
|
|
||||||
bodyColor =
|
bodyColor =
|
||||||
bodyStringColor != null
|
bodyStringColor != null
|
||||||
? Color(int.parse(bodyStringColor))
|
? Color(int.parse(bodyStringColor))
|
||||||
: Colors.white;
|
: Colors.white;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +700,47 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
|
|
||||||
print("USERDETAILS : $data");
|
print("USERDETAILS : $data");
|
||||||
|
|
||||||
|
// block-submit-here
|
||||||
|
|
||||||
|
// Additional validation starts - travelDetailsData passport
|
||||||
|
DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
||||||
|
DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
||||||
|
|
||||||
|
if (start_Date != null && end_Date != null && start_Date.toString().isNotEmpty && end_Date.toString().isNotEmpty) {
|
||||||
|
try {
|
||||||
|
final format = DateFormat("dd-MM-yyyy");
|
||||||
|
final checkStartDate = format.parse("$start_Date");
|
||||||
|
final checkEndDate = format.parse("$end_Date");
|
||||||
|
|
||||||
|
if (checkEndDate.isBefore(checkStartDate)) {
|
||||||
|
// return "End date cannot be earlier than start date";;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (e) { // return "End date cannot be earlier than start date";
|
||||||
|
return ;
|
||||||
|
// errorMessages["end_date"] = "Invalid date format";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// valid_from: 20-06-2025, valid_upto: 19-06-2025
|
||||||
|
DateTime? valid_from = data?['valid_from'];
|
||||||
|
DateTime? valid_upto = data?['valid_upto'];
|
||||||
|
|
||||||
|
if (valid_from != null && valid_upto != null && valid_from.toString().isNotEmpty && valid_upto.toString().isNotEmpty) {
|
||||||
|
try {
|
||||||
|
final format = DateFormat("dd-MM-yyyy");
|
||||||
|
final checkValidFrom = format.parse("$valid_from");
|
||||||
|
final checkValidUpto = format.parse("$valid_upto");
|
||||||
|
|
||||||
|
if (checkValidUpto.isBefore(checkValidFrom)) {
|
||||||
|
// return "valid upto cannot be earlier than valid from";
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
} catch (e) { // return "valid upto cannot be earlier than valid from";
|
||||||
|
return ;
|
||||||
|
// errorMessages["end_date"] = "Invalid date format";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Map<String, dynamic> data = userDetials;
|
// Map<String, dynamic> data = userDetials;
|
||||||
|
|
||||||
if (!isValidData(data) && isValidDataTwo(data)) {
|
if (!isValidData(data) && isValidDataTwo(data)) {
|
||||||
@ -744,7 +785,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (data["mobile_no"] != null && data["mobile_no"].toString().isNotEmpty) {
|
if (data["mobile_no"] != null && data["mobile_no"].toString().isNotEmpty) {
|
||||||
if (!RegExp(r"^\d{10}$").hasMatch(data["mobile_no"].toString())) {
|
if (!RegExp(r"^\d{10}$").hasMatch(data["mobile_no"].toString())) {
|
||||||
errorMessages["mobile_no"] =
|
errorMessages["mobile_no"] =
|
||||||
"Enter 10 digits"; // Invalid mobile number format
|
"Enter 10 digits"; // Invalid mobile number format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +795,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
r"^\d{10}$",
|
r"^\d{10}$",
|
||||||
).hasMatch(data["alternate_mobile_no"].toString())) {
|
).hasMatch(data["alternate_mobile_no"].toString())) {
|
||||||
errorMessages["alternate_mobile_no"] =
|
errorMessages["alternate_mobile_no"] =
|
||||||
"Enter 10 digits"; // Invalid mobile number format
|
"Enter 10 digits"; // Invalid mobile number format
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +985,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
// ✅ Ensure UI updates
|
// ✅ Ensure UI updates
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
errorMessages["password"] =
|
errorMessages["password"] =
|
||||||
"New password is not similar to old password";
|
"New password is not similar to old password";
|
||||||
print(" Password match!");
|
print(" Password match!");
|
||||||
} else {
|
} else {
|
||||||
print(" Password NOT match!");
|
print(" Password NOT match!");
|
||||||
@ -973,16 +1014,16 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding:
|
padding:
|
||||||
isDesktop
|
isDesktop
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal:
|
horizontal:
|
||||||
MediaQuery.of(context).size.width *
|
MediaQuery.of(context).size.width *
|
||||||
0.1, // 30% of screen width as horizontal padding
|
0.1, // 30% of screen width as horizontal padding
|
||||||
vertical:
|
vertical:
|
||||||
MediaQuery.of(context).size.height *
|
MediaQuery.of(context).size.height *
|
||||||
0, // 5% of screen height as vertical padding
|
0, // 5% of screen height as vertical padding
|
||||||
)
|
)
|
||||||
: EdgeInsets.all(0),
|
: EdgeInsets.all(0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [Expanded(child: buildData(isDesktop, context))],
|
children: [Expanded(child: buildData(isDesktop, context))],
|
||||||
),
|
),
|
||||||
@ -1004,9 +1045,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
height:
|
height:
|
||||||
isDesktop
|
isDesktop
|
||||||
? MediaQuery.of(context).size.height * 0.98
|
? MediaQuery.of(context).size.height * 0.98
|
||||||
: MediaQuery.of(context).size.height,
|
: MediaQuery.of(context).size.height,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(0.0),
|
padding: EdgeInsets.all(0.0),
|
||||||
child: _buildUserDetails(isDesktop),
|
child: _buildUserDetails(isDesktop),
|
||||||
@ -1018,39 +1059,39 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child:
|
child:
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
if (selectedTab != "personal")
|
if (selectedTab != "personal")
|
||||||
..._buildBack(isDesktop, layoutColor!),
|
..._buildBack(isDesktop, layoutColor!),
|
||||||
Spacer(), // spacing between buttons
|
Spacer(), // spacing between buttons
|
||||||
// Next or Submit based on role or user type
|
// Next or Submit based on role or user type
|
||||||
if (selectedTab == "travel" ||
|
if (selectedTab == "travel" ||
|
||||||
selectedRole == "5" ||
|
selectedRole == "5" ||
|
||||||
setSelectesUserType == true)
|
setSelectesUserType == true)
|
||||||
..._buildSubmit(isDesktop, layoutColor!)
|
..._buildSubmit(isDesktop, layoutColor!)
|
||||||
else
|
else
|
||||||
..._buildNext(isDesktop, layoutColor!),
|
..._buildNext(isDesktop, layoutColor!),
|
||||||
// (selectedTab == "travel" ||
|
// (selectedTab == "travel" ||
|
||||||
// selectedRole == "5" ||
|
// selectedRole == "5" ||
|
||||||
// setSelectesUserType == true)
|
// setSelectesUserType == true)
|
||||||
// ? _buildSubmit(isDesktop, layoutColor!)
|
// ? _buildSubmit(isDesktop, layoutColor!)
|
||||||
// : _buildNext(
|
// : _buildNext(
|
||||||
// isDesktop,
|
// isDesktop,
|
||||||
// layoutColor!,
|
// layoutColor!,
|
||||||
// ), // _buildGoBack(isDesktop, layoutColor!),
|
// ), // _buildGoBack(isDesktop, layoutColor!),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children:
|
children:
|
||||||
(selectedTab == "travel" ||
|
(selectedTab == "travel" ||
|
||||||
selectedRole == "5" ||
|
selectedRole == "5" ||
|
||||||
setSelectesUserType == true)
|
setSelectesUserType == true)
|
||||||
? _buildSubmit(isDesktop, layoutColor!)
|
? _buildSubmit(isDesktop, layoutColor!)
|
||||||
: _buildNext(isDesktop, layoutColor!),
|
: _buildNext(isDesktop, layoutColor!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -1095,9 +1136,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
isDesktop
|
isDesktop
|
||||||
? buildTabsForUser()
|
? buildTabsForUser()
|
||||||
: SingleChildScrollView(
|
: SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: buildTabsForUser(),
|
child: buildTabsForUser(),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// color: Colors.yellow.shade50,
|
// color: Colors.yellow.shade50,
|
||||||
height: MediaQuery.of(context).size.height * 0.64,
|
height: MediaQuery.of(context).size.height * 0.64,
|
||||||
@ -1200,8 +1241,8 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
);
|
);
|
||||||
case "travel":
|
case "travel":
|
||||||
final fullName =
|
final fullName =
|
||||||
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
"${controllers["Fname"]?.text ?? ""} ${controllers["Lname"]?.text ?? ""}"
|
||||||
.trim();
|
.trim();
|
||||||
return TravellerDetails(
|
return TravellerDetails(
|
||||||
key: travellerDetailsKey,
|
key: travellerDetailsKey,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
@ -1260,69 +1301,69 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end, // important
|
crossAxisAlignment: CrossAxisAlignment.end, // important
|
||||||
children:
|
children:
|
||||||
tabs.entries.map((entry) {
|
tabs.entries.map((entry) {
|
||||||
final targetTab = entry.key;
|
final targetTab = entry.key;
|
||||||
|
|
||||||
print("TargetsTAb: $targetTab");
|
print("TargetsTAb: $targetTab");
|
||||||
|
|
||||||
final isSelected = selectedTab == entry.key;
|
final isSelected = selectedTab == entry.key;
|
||||||
print("isSelected: $isSelected");
|
print("isSelected: $isSelected");
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
|
|
||||||
final currentTab = selectedTab;
|
final currentTab = selectedTab;
|
||||||
if (currentTab == "personal") {
|
if (currentTab == "personal") {
|
||||||
isValid = isValidData(userDetials);
|
isValid = isValidData(userDetials);
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
} else if (currentTab == "office" &&
|
} else if (currentTab == "office" &&
|
||||||
targetTab == "personal") {
|
targetTab == "personal") {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
} else if (currentTab == "office") {
|
} else if (currentTab == "office") {
|
||||||
isValid = isValidDataTwo(userDetials);
|
isValid = isValidDataTwo(userDetials);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isValid =
|
isValid =
|
||||||
true; // Travel tab might not need validation at this point
|
true; // Travel tab might not need validation at this point
|
||||||
selectedTab = entry.key;
|
selectedTab = entry.key;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
right: 24.0,
|
right: 24.0,
|
||||||
), // space between tabs
|
), // space between tabs
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
entry.value,
|
entry.value,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color:
|
color:
|
||||||
isSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
isSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
AnimatedContainer(
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
height: 2,
|
|
||||||
width: isSelected ? 50 : 0, // small line
|
|
||||||
color: Color(0xFF114D8B),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 8),
|
||||||
);
|
AnimatedContainer(
|
||||||
}).toList(),
|
duration: Duration(milliseconds: 300),
|
||||||
|
height: 2,
|
||||||
|
width: isSelected ? 50 : 0, // small line
|
||||||
|
color: Color(0xFF114D8B),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,17 +1373,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1361,17 +1402,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1392,17 +1433,17 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
return [
|
return [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? Colors.white : Colors.white, // Keep original color
|
isViewMode ? Colors.white : Colors.white, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1440,19 +1481,19 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
if (!isViewMode)
|
if (!isViewMode)
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? SystemMouseCursors.forbidden
|
? SystemMouseCursors.forbidden
|
||||||
: SystemMouseCursors.click,
|
: SystemMouseCursors.click,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
isViewMode ? layoutColor : layoutColor, // Keep original color
|
isViewMode ? layoutColor : layoutColor, // Keep original color
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
isViewMode
|
isViewMode
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Colors.white, // Keep original color
|
: Colors.white, // Keep original color
|
||||||
disabledBackgroundColor:
|
disabledBackgroundColor:
|
||||||
layoutColor, // Ensure color remains when disabled
|
layoutColor, // Ensure color remains when disabled
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -1461,7 +1502,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||||
),
|
),
|
||||||
onPressed:
|
onPressed:
|
||||||
isViewMode ? null : handleSubmit, // Disable when in view mode
|
isViewMode ? null : handleSubmit, // Disable when in view mode
|
||||||
child: Text("Submit"),
|
child: Text("Submit"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -692,6 +692,9 @@ class _OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
enabled: !widget.isViewMode,
|
enabled: !widget.isViewMode,
|
||||||
|
|
||||||
popupProps: PopupProps.menu(
|
popupProps: PopupProps.menu(
|
||||||
|
menuProps: const MenuProps(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
),
|
||||||
showSearchBox: true,
|
showSearchBox: true,
|
||||||
fit: FlexFit.loose, // Allows flexible height
|
fit: FlexFit.loose, // Allows flexible height
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
|
|||||||
@ -1584,7 +1584,9 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["date_of_expiry"]!,
|
errorMessages["date_of_expiry"]!,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: const TextStyle(color: Colors.red, fontSize: 10),
|
||||||
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
|
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -4085,7 +4087,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
// Revalidate expiry
|
// Revalidate expiry
|
||||||
if (_selectedCheckOutDate != null &&
|
if (_selectedCheckOutDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] = "end date cannot be earlier than from date";
|
errorMessages["valid_upto"] = "valid upto cannot be earlier than valid from";
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto");
|
||||||
}
|
}
|
||||||
@ -4201,7 +4203,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
|
|
||||||
if (_selectedCheckInDate != null &&
|
if (_selectedCheckInDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] = "end date cannot be earlier than from date";
|
errorMessages["valid_upto"] = "valid upto cannot be earlier than valid from";
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto");
|
||||||
}
|
}
|
||||||
@ -4257,6 +4259,15 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (errorMessages["valid_upto"] != null) ...[
|
||||||
|
SizedBox(height: 5), // Space before error message
|
||||||
|
Text(
|
||||||
|
errorMessages["valid_upto"]!,
|
||||||
|
style: const TextStyle(color: Colors.red, fontSize: 10),
|
||||||
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
|
overflow: TextOverflow.ellipsis, // Add ellipsis if it still overflows
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user