user mangmnt validations
This commit is contained in:
parent
16e58dca07
commit
4121213bff
@ -867,6 +867,10 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (plan.statusValue ==
|
||||||
|
"Pending Approval" ||
|
||||||
|
plan.statusValue ==
|
||||||
|
"Partially Approved")
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
|
|||||||
@ -347,6 +347,8 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
(plan.userName?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.userName?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.travellerName?.toLowerCase().contains(lowerQuery) ??
|
(plan.travellerName?.toLowerCase().contains(lowerQuery) ??
|
||||||
false) ||
|
false) ||
|
||||||
|
(plan.approverName?.toLowerCase().contains(lowerQuery) ??
|
||||||
|
false) ||
|
||||||
(plan.tripType?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.tripType?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.createdOn?.toLowerCase().contains(lowerQuery) ?? false) ||
|
(plan.createdOn?.toLowerCase().contains(lowerQuery) ?? false) ||
|
||||||
(plan.statusValue?.toLowerCase().contains(lowerQuery) ?? false);
|
(plan.statusValue?.toLowerCase().contains(lowerQuery) ?? false);
|
||||||
@ -674,7 +676,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Emp Code',
|
'Traveller',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -683,7 +685,7 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
),
|
),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
'Traveller',
|
'Approver',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -753,19 +755,40 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Text(
|
Column(
|
||||||
plan.employeeCode ?? " - ",
|
crossAxisAlignment:
|
||||||
style: TextStyle(
|
CrossAxisAlignment.start,
|
||||||
fontSize: 13,
|
mainAxisAlignment:
|
||||||
fontFamily: "Inter",
|
MainAxisAlignment.center,
|
||||||
),
|
|
||||||
),
|
children: [
|
||||||
),
|
SizedBox(height: 1),
|
||||||
DataCell(
|
|
||||||
Text(
|
Text(
|
||||||
plan.userName.isNotEmpty
|
plan.userName.isNotEmpty
|
||||||
? plan.userName
|
? plan.userName
|
||||||
: plan.travellerName,
|
: plan.travellerName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontFamily: "Inter",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 3),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"(${plan.employeeCode})" ??
|
||||||
|
" - ",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 10,
|
||||||
|
// fontFamily: "Inter",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
Text(
|
||||||
|
plan.approverName ?? " ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
@ -877,6 +900,10 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (plan.statusValue ==
|
||||||
|
"Pending Approval" ||
|
||||||
|
plan.statusValue ==
|
||||||
|
"Partially Approved")
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
@ -1135,6 +1162,10 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (plan.statusValue ==
|
||||||
|
"Pending Approval" ||
|
||||||
|
plan.statusValue ==
|
||||||
|
"Partially Approved")
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Image.asset(
|
icon: Image.asset(
|
||||||
'assets/images/IconsImg/edit.png',
|
'assets/images/IconsImg/edit.png',
|
||||||
@ -1144,7 +1175,9 @@ class _ApprovalListState extends State<ApprovalList> {
|
|||||||
tooltip:
|
tooltip:
|
||||||
'Edit The Trip Details',
|
'Edit The Trip Details',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
|
context,
|
||||||
|
);
|
||||||
print(
|
print(
|
||||||
"Approver Edit3 : ${plan.approver_status}",
|
"Approver Edit3 : ${plan.approver_status}",
|
||||||
);
|
);
|
||||||
|
|||||||
@ -766,7 +766,7 @@ class _TravelerFormState extends State<TravelerForm> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Create Traveler",
|
"Create Traveller",
|
||||||
style: GoogleFonts.poppins(color: Colors.black54),
|
style: GoogleFonts.poppins(color: Colors.black54),
|
||||||
),
|
),
|
||||||
SizedBox(height: 7),
|
SizedBox(height: 7),
|
||||||
|
|||||||
@ -127,7 +127,6 @@ class ForexDataState extends State<ForexData> {
|
|||||||
selectedCountryName =
|
selectedCountryName =
|
||||||
data['country_name']; // For dropdown label or display
|
data['country_name']; // For dropdown label or display
|
||||||
selectedCurrency = data['currency']; // Optional if used elsewhere
|
selectedCurrency = data['currency']; // Optional if used elsewhere
|
||||||
|
|
||||||
controllers['currency']?.text = data['currency'] ?? '';
|
controllers['currency']?.text = data['currency'] ?? '';
|
||||||
controllers['cash']?.text = data['cash_percentage'] ?? '';
|
controllers['cash']?.text = data['cash_percentage'] ?? '';
|
||||||
controllers['card']?.text = data['card_percentage'] ?? '';
|
controllers['card']?.text = data['card_percentage'] ?? '';
|
||||||
@ -336,6 +335,16 @@ class ForexDataState extends State<ForexData> {
|
|||||||
|
|
||||||
selectedCountry ??= null;
|
selectedCountry ??= null;
|
||||||
|
|
||||||
|
void setCurrencyFromSelectedCountry(String selectedCountryCode) {
|
||||||
|
final matchedCountry = countryList.firstWhere(
|
||||||
|
(item) => item['country_code'] == selectedCountryCode,
|
||||||
|
orElse: () => {},
|
||||||
|
);
|
||||||
|
|
||||||
|
final currency = matchedCountry['currency'] ?? '';
|
||||||
|
controllers["currency"]?.text = currency;
|
||||||
|
}
|
||||||
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
contentPadding: const EdgeInsets.fromLTRB(34, 30, 34, 30),
|
contentPadding: const EdgeInsets.fromLTRB(34, 30, 34, 30),
|
||||||
@ -426,6 +435,7 @@ class ForexDataState extends State<ForexData> {
|
|||||||
.firstWhere((entry) => entry.value == newValue)
|
.firstWhere((entry) => entry.value == newValue)
|
||||||
.key;
|
.key;
|
||||||
selectedCountryName = newValue;
|
selectedCountryName = newValue;
|
||||||
|
setCurrencyFromSelectedCountry(selectedCountry!);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -457,6 +467,7 @@ class ForexDataState extends State<ForexData> {
|
|||||||
isFocused: false,
|
isFocused: false,
|
||||||
isDesktop: widget.isDesktop,
|
isDesktop: widget.isDesktop,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
|
|
||||||
// width: isDesktop
|
// width: isDesktop
|
||||||
// ? MediaQuery.of(context).size.width * 0.330
|
// ? MediaQuery.of(context).size.width * 0.330
|
||||||
// : MediaQuery.of(context).size.width * 0.66,
|
// : MediaQuery.of(context).size.width * 0.66,
|
||||||
@ -464,9 +475,13 @@ class ForexDataState extends State<ForexData> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: controllers["currency"],
|
controller: controllers["currency"],
|
||||||
style: const TextStyle(fontSize: 12),
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 11,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: "Currency",
|
labelText: "Currency",
|
||||||
|
enabled: false,
|
||||||
labelStyle: TextStyle(fontSize: 11, color: Colors.grey),
|
labelStyle: TextStyle(fontSize: 11, color: Colors.grey),
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
|||||||
@ -458,7 +458,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
print("flightFirstTripDateNotifier is null or empty");
|
print("flightFirstTripDateNotifier is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
final flightDateEnd = flightFirstTripDateNotifier.value;
|
final flightDateEnd = flightLastTripDateNotifier.value;
|
||||||
|
|
||||||
if (flightDateEnd != null && flightDateEnd.trim().isNotEmpty) {
|
if (flightDateEnd != null && flightDateEnd.trim().isNotEmpty) {
|
||||||
try {
|
try {
|
||||||
@ -2174,7 +2174,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Delivery Location",
|
"Delivery Location *",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -2194,6 +2194,9 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
focusNode: focusNodes["_deliveryLocation"],
|
focusNode: focusNodes["_deliveryLocation"],
|
||||||
controller: textControllers["_deliveryLocation"],
|
controller: textControllers["_deliveryLocation"],
|
||||||
|
onChanged: (value) {
|
||||||
|
errorMessages.remove("delivery_location");
|
||||||
|
},
|
||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Location",
|
labelText: "Location",
|
||||||
@ -2239,10 +2242,10 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
onChanged: (bool? value) {
|
onChanged: (bool? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
isChecked = value!;
|
isChecked = value!;
|
||||||
if (isChecked) {
|
// if (isChecked) {
|
||||||
textControllers["_cardNumber"]
|
// textControllers["_cardNumber"]
|
||||||
?.clear(); // Clear the value when isChecked is true
|
// ?.clear(); // Clear the value when isChecked is true
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -311,7 +311,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Number of Passenger",
|
"Number of Passenger*",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -461,9 +461,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
selectedCarType = newValue as String?;
|
selectedCarType = newValue as String?;
|
||||||
});
|
});
|
||||||
print(
|
print("Updating form data: -> ${newValue ?? ""}");
|
||||||
"Updating form data: -> ${newValue ?? ""}",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
@ -591,18 +589,12 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
|||||||
if (selectedItem == null || selectedItem.isEmpty) {
|
if (selectedItem == null || selectedItem.isEmpty) {
|
||||||
return Text(
|
return Text(
|
||||||
"Select ",
|
"Select ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(color: Colors.grey, fontSize: 13),
|
||||||
color: Colors.grey,
|
|
||||||
fontSize: 13,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
selectedItem['dropdown_value'] ?? '',
|
selectedItem['dropdown_value'] ?? '',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onChanged:
|
onChanged:
|
||||||
@ -611,9 +603,7 @@ class _TaxiScreenState extends State<TaxiScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
selectedReqTaxi = newValue as String?;
|
selectedReqTaxi = newValue as String?;
|
||||||
});
|
});
|
||||||
print(
|
print("Updating form data: -> ${newValue ?? ""}");
|
||||||
"Updating form data: -> ${newValue ?? ""}",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -282,6 +282,8 @@ class _CreatePlansState extends State<CreatePlan> {
|
|||||||
context.go('/listAllPlan');
|
context.go('/listAllPlan');
|
||||||
} else if (currentUri == "/createPlan") {
|
} else if (currentUri == "/createPlan") {
|
||||||
context.go('/listPlan');
|
context.go('/listPlan');
|
||||||
|
} else if (currentUri == "/approver/plans") {
|
||||||
|
context.go('/approvallist');
|
||||||
} else {
|
} else {
|
||||||
isApprover ? context.go('/approvallist') : context.go('/listPlan');
|
isApprover ? context.go('/approvallist') : context.go('/listPlan');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1420,6 +1420,7 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
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),
|
||||||
side: BorderSide(color: layoutColor, width: 2),
|
side: BorderSide(color: layoutColor, width: 2),
|
||||||
@ -1482,9 +1483,10 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
|||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
side: BorderSide(color: Colors.white, width: 2),
|
side: BorderSide(color: layoutColor, width: 2),
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 18),
|
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
),
|
),
|
||||||
onPressed: handleBack,
|
onPressed: handleBack,
|
||||||
// onPressed:
|
// onPressed:
|
||||||
|
|||||||
@ -314,8 +314,8 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
_buildPassportDataRow1(widget.isDesktop),
|
// _buildPassportDataRow1(widget.isDesktop),
|
||||||
SizedBox(height: 10),
|
// SizedBox(height: 10),
|
||||||
_buildFirstRow(widget.isDesktop),
|
_buildFirstRow(widget.isDesktop),
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
_buildSecondRow(widget.isDesktop),
|
_buildSecondRow(widget.isDesktop),
|
||||||
|
|||||||
@ -203,11 +203,6 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
print("Invalid passport date format");
|
print("Invalid passport date format");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMessages.isNotEmpty) {
|
|
||||||
print("Validation failed with errors: $errorMessages");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Additional validation starts - travelDetailsData passport
|
// Additional validation starts - travelDetailsData passport
|
||||||
// DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
// DateTime? start_Date = travelDetailsData?['date_of_issue'];
|
||||||
// DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
// DateTime? end_Date = travelDetailsData?['date_of_expiry'];
|
||||||
@ -232,28 +227,44 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// valid_from: 20-06-2025, valid_upto: 19-06-2025
|
// ✅ Visa entries: Validate valid_from < valid_upto for each entry
|
||||||
// DateTime? valid_from = data?['valid_from'];
|
for (var entry in visaEntries) {
|
||||||
// DateTime? valid_upto = data?['valid_upto'];
|
final localId = entry["local_id"];
|
||||||
//
|
final fromText = entry["controller_valid_from"]?.text.trim();
|
||||||
// if (valid_from != null &&
|
final toText = entry["controller_valid_upto"]?.text.trim();
|
||||||
// valid_upto != null &&
|
|
||||||
// valid_from.toString().isNotEmpty &&
|
if (fromText != null &&
|
||||||
// valid_upto.toString().isNotEmpty) {
|
toText != null &&
|
||||||
// try {
|
fromText.isNotEmpty &&
|
||||||
// final format = DateFormat("dd-MM-yyyy");
|
toText.isNotEmpty) {
|
||||||
// final checkValidFrom = format.parse("$valid_from");
|
try {
|
||||||
// final checkValidUpto = format.parse("$valid_upto");
|
final fromDate = format.parseStrict(fromText);
|
||||||
//
|
final toDate = format.parseStrict(toText);
|
||||||
// if (checkValidUpto.isBefore(checkValidFrom)) {
|
|
||||||
// // return "valid upto cannot be earlier than valid from";
|
if (toDate.isBefore(fromDate)) {
|
||||||
// }
|
print("VisaErroer1");
|
||||||
// } catch (e) {
|
errorMessages["valid_upto${entry['local_id']}"] =
|
||||||
// // return "valid upto cannot be earlier than valid from";
|
"Invalid date range";
|
||||||
//
|
// errorMessages["valid_upto_$localId"] =
|
||||||
// // errorMessages["end_date"] = "Invalid date format";
|
// "Valid Upto can't be before Valid From";
|
||||||
// }
|
} else {
|
||||||
// }
|
print("VisaErroer2");
|
||||||
|
// errorMessages.remove("valid_upto$localId");
|
||||||
|
errorMessages.remove("valid_upto${entry['local_id']}");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("VisaErroer3");
|
||||||
|
errorMessages["valid_upto${entry['local_id']}"] =
|
||||||
|
"Invalid date format";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorMessages.isNotEmpty) {
|
||||||
|
print("Validation failed with errors: $errorMessages");
|
||||||
|
setState(() {}); // Refresh UI to show errors
|
||||||
|
return false;
|
||||||
|
}
|
||||||
print("travel validation end");
|
print("travel validation end");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2205,7 +2216,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
vertical: 8,
|
vertical: 8,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
item['dropdown_value'] ?? '',
|
item['dropdown_value'] ?? 'Select',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -2217,7 +2228,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
dropdownDecoratorProps: const DropDownDecoratorProps(
|
dropdownDecoratorProps: const DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: "Select Seat",
|
hintText: "Select",
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 5,
|
vertical: 5,
|
||||||
@ -2230,7 +2241,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
dropdownBuilder: (context, selectedItem) {
|
dropdownBuilder: (context, selectedItem) {
|
||||||
if (selectedItem == null || selectedItem.isEmpty) {
|
if (selectedItem == null || selectedItem.isEmpty) {
|
||||||
return Text(
|
return Text(
|
||||||
"Select Seat", // fallback text
|
"Select ", // fallback text
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
@ -2238,7 +2249,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
selectedItem['dropdown_value'] ?? "Select Seat",
|
selectedItem['dropdown_value'] ?? "Select ",
|
||||||
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -2618,7 +2629,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
vertical: 8,
|
vertical: 8,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
item['dropdown_value'] ?? '',
|
item['dropdown_value'] ?? 'Select Seat',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
@ -4168,6 +4179,9 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print("CheckOut - $_selectedCheckOutDate");
|
||||||
|
print("CheckIn - $_selectedCheckInDate");
|
||||||
|
|
||||||
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
|
if (pickedDate != null && pickedDate != _selectedCheckOutDate) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedCheckInDate = pickedDate;
|
_selectedCheckInDate = pickedDate;
|
||||||
@ -4178,9 +4192,14 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
// Revalidate expiry
|
// Revalidate expiry
|
||||||
if (_selectedCheckOutDate != null &&
|
if (_selectedCheckOutDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] = "Invalid Date Range";
|
print("Entry - $entry");
|
||||||
|
print("errorMessages - $errorMessages");
|
||||||
|
errorMessages["valid_upto${entry['local_id']}"] =
|
||||||
|
"Invalid Date Range";
|
||||||
|
// errorMessages["valid_upto"] = "Invalid Date Range";
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto${entry['local_id']}");
|
||||||
|
// errorMessages.remove("valid_upto");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -4295,9 +4314,10 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
|
|
||||||
if (_selectedCheckInDate != null &&
|
if (_selectedCheckInDate != null &&
|
||||||
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
_selectedCheckOutDate!.isBefore(_selectedCheckInDate!)) {
|
||||||
errorMessages["valid_upto"] = "Invalid Date Range";
|
errorMessages["valid_upto${entry['local_id']}"] =
|
||||||
|
"Invalid Date Range";
|
||||||
} else {
|
} else {
|
||||||
errorMessages.remove("valid_upto");
|
errorMessages.remove("valid_upto${entry['local_id']}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -4326,6 +4346,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
errorMessages.remove("valid_upto${entry['local_id']}");
|
||||||
await _selectValidUpToDate(context);
|
await _selectValidUpToDate(context);
|
||||||
},
|
},
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
@ -4352,10 +4373,10 @@ class TravellerDetailsState extends State<TravellerDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (errorMessages["valid_upto"] != null) ...[
|
if (errorMessages["valid_upto${entry['local_id']}"] != null) ...[
|
||||||
SizedBox(height: 5), // Space before error message
|
SizedBox(height: 5), // Space before error message
|
||||||
Text(
|
Text(
|
||||||
errorMessages["valid_upto"]!,
|
errorMessages["valid_upto${entry['local_id']}"]!,
|
||||||
style: GoogleFonts.poppins(color: Colors.red, fontSize: 10),
|
style: GoogleFonts.poppins(color: Colors.red, fontSize: 10),
|
||||||
maxLines: 2, // Allow it to wrap onto two lines
|
maxLines: 2, // Allow it to wrap onto two lines
|
||||||
overflow:
|
overflow:
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class Plan {
|
|||||||
|
|
||||||
final String userName;
|
final String userName;
|
||||||
final String travellerName;
|
final String travellerName;
|
||||||
|
final String approverName;
|
||||||
final String statusValue;
|
final String statusValue;
|
||||||
final String createdOn;
|
final String createdOn;
|
||||||
final String? approverId;
|
final String? approverId;
|
||||||
@ -35,6 +36,7 @@ class Plan {
|
|||||||
required this.isBillable,
|
required this.isBillable,
|
||||||
required this.userName,
|
required this.userName,
|
||||||
required this.travellerName,
|
required this.travellerName,
|
||||||
|
required this.approverName,
|
||||||
required this.statusValue,
|
required this.statusValue,
|
||||||
required this.createdOn,
|
required this.createdOn,
|
||||||
this.approverId,
|
this.approverId,
|
||||||
@ -64,6 +66,10 @@ class Plan {
|
|||||||
json["traveller_name"] == null
|
json["traveller_name"] == null
|
||||||
? ''
|
? ''
|
||||||
: json["traveller_name"]!.toString(),
|
: json["traveller_name"]!.toString(),
|
||||||
|
approverName:
|
||||||
|
json["approver_name"] == null
|
||||||
|
? ''
|
||||||
|
: json["approver_name"]!.toString(),
|
||||||
statusValue: json["status_value"]!.toString(),
|
statusValue: json["status_value"]!.toString(),
|
||||||
createdOn: json["created_on"],
|
createdOn: json["created_on"],
|
||||||
approverId:
|
approverId:
|
||||||
|
|||||||
@ -21,7 +21,6 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
required this.layoutColor,
|
required this.layoutColor,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Align(
|
return Align(
|
||||||
@ -30,12 +29,9 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
offset: Offset(0, 30),
|
offset: Offset(0, 30),
|
||||||
icon: Icon(
|
icon: Icon(Icons.more_vert, color: Color(0xFF475569), size: 15),
|
||||||
Icons.more_vert,
|
itemBuilder:
|
||||||
color: Color(0xFF475569),
|
(context) => [
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
itemBuilder: (context) => [
|
|
||||||
CustomPopupMenuEntry(
|
CustomPopupMenuEntry(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 4),
|
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 4),
|
||||||
@ -48,8 +44,11 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
icon: Icon(Icons.remove_red_eye, size: 18),
|
icon: Icon(Icons.remove_red_eye, size: 18),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
ApiService.viewPlan(context, plan.planId,
|
ApiService.viewPlan(
|
||||||
isViewMode: true);
|
context,
|
||||||
|
plan.planId,
|
||||||
|
isViewMode: true,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
@ -62,7 +61,6 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
// isViewMode: false);
|
// isViewMode: false);
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.cancel_rounded, size: 18),
|
icon: Icon(Icons.cancel_rounded, size: 18),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -71,8 +69,11 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.download,
|
icon: Icon(
|
||||||
color: Color(0xFF114D8B), size: 18),
|
Icons.download,
|
||||||
|
color: Color(0xFF114D8B),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
apiService.getPdfDownload(plan.planId);
|
apiService.getPdfDownload(plan.planId);
|
||||||
@ -87,13 +88,16 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => CommentModalList(
|
builder:
|
||||||
|
(context) => CommentModalList(
|
||||||
// planId: plan.planId,
|
// planId: plan.planId,
|
||||||
planId: plan.planId.toString(),
|
planId: plan.planId.toString(),
|
||||||
layoutColorForUser: layoutColor!,
|
layoutColorForUser: layoutColor!,
|
||||||
role: "User"),
|
role: "User",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.comment,
|
Icons.comment,
|
||||||
@ -103,13 +107,16 @@ class PlanPopupMenu extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => CommentModal(
|
builder:
|
||||||
|
(context) => CommentModal(
|
||||||
// planId: plan.planId,
|
// planId: plan.planId,
|
||||||
planId: plan.planId.toString(),
|
planId: plan.planId.toString(),
|
||||||
layoutColorForUser: layoutColor!,
|
layoutColorForUser: layoutColor!,
|
||||||
role: "Travel Agent"),
|
role: "Travel Agent",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user