user changes

This commit is contained in:
venbaittech 2025-06-06 13:59:38 +05:30
parent 194af031d0
commit a41402f929
4 changed files with 164 additions and 65 deletions

View File

@ -546,6 +546,33 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
printFormData();
}
void handleBack() async {
print("USR Detail back");
final tabs = {
"personal": "Personal Details",
"office": "Office Details",
"travel": "Travel Details",
};
final tabKeys = tabs.keys.toList(); // ["personal", "office", "travel"]
final currentIndex = tabKeys.indexOf(selectedTab ?? "travel");
print("currentIndex - $currentIndex");
if (currentIndex > 0) {
// Move to next tab
setState(() {
selectedTab = tabKeys[currentIndex - 1];
});
} else {
// Final step submit or show done
print("All tabs completed!");
// Submit the full form here
}
}
void handleNext() async {
print("USR Detail Next");
printFormData();
@ -959,15 +986,26 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
isDesktop
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children:
(selectedTab == "travel" ||
selectedRole == "5" ||
setSelectesUserType == true)
? _buildSubmit(isDesktop, layoutColor!)
: _buildNext(
isDesktop,
layoutColor!,
), // _buildGoBack(isDesktop, layoutColor!),
children: [
if (selectedTab != "personal")
..._buildBack(isDesktop, layoutColor!),
Spacer(), // spacing between buttons
// Next or Submit based on role or user type
if (selectedTab == "travel" ||
selectedRole == "5" ||
setSelectesUserType == true)
..._buildSubmit(isDesktop, layoutColor!)
else
..._buildNext(isDesktop, layoutColor!),
// (selectedTab == "travel" ||
// selectedRole == "5" ||
// setSelectesUserType == true)
// ? _buildSubmit(isDesktop, layoutColor!)
// : _buildNext(
// isDesktop,
// layoutColor!,
// ), // _buildGoBack(isDesktop, layoutColor!),
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.end,
@ -1325,22 +1363,22 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
child: TextButton(
style: ElevatedButton.styleFrom(
backgroundColor:
isViewMode ? layoutColor : layoutColor, // Keep original color
isViewMode ? Colors.white : Colors.white, // Keep original color
foregroundColor:
isViewMode ? Colors.white : Colors.red, // Keep original color
isViewMode ? layoutColor : layoutColor, // Keep original color
disabledBackgroundColor:
layoutColor, // Ensure color remains when disabled
disabledForegroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(color: layoutColor, width: 2),
side: BorderSide(color: Colors.white, width: 2),
),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 18),
),
onPressed: handleNext,
onPressed: handleBack,
// onPressed:
// isViewMode ? null : handleNext, // Disable when in view mode
child: Text("Next"),
child: Text("Back"),
),
),
];

View File

@ -106,6 +106,8 @@ class TravellerDetailsState extends State<TravellerDetails> {
//To Create Controllers
List<String> dataHeader = [
"Fname",
"Mname",
"Lname",
"nationality",
"d_meal_pref",
@ -900,49 +902,52 @@ class TravellerDetailsState extends State<TravellerDetails> {
Widget _buildPassportDataRow1(bool isDesktop) {
return Container(
color: Colors.white,
child: Row(
children: [
Text(
"Name as per passport : ",
style: GoogleFonts.poppins(
fontSize: 11,
fontStyle: FontStyle.italic,
letterSpacing: 0.5,
),
),
Text(
"${widget.fullName} ",
style: GoogleFonts.poppins(
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: 0.5,
color: Colors.black87,
// fontStyle: FontStyle.italic,
),
),
],
),
// child: widget.isDesktop
// ? Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// buildFirstNameField(),
// Spacer(),
// buildLastNameField(),
// Spacer(), // Space after Last Name
// buildNationality(),
// ],
// )
// : Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// buildFirstNameField(),
// SizedBox(height: 8), // Vertical space
// buildLastNameField(),
// SizedBox(height: 8),
// buildNationality(),
// ],
// ),
// child: Row(
// children: [
// Text(
// "Name as per passport : ",
// style: GoogleFonts.poppins(
// fontSize: 11,
// fontStyle: FontStyle.italic,
// letterSpacing: 0.5,
// ),
// ),
// Text(
// "${widget.fullName} ",
// style: GoogleFonts.poppins(
// fontSize: 10,
// fontWeight: FontWeight.w600,
// letterSpacing: 0.5,
// color: Colors.black87,
// // fontStyle: FontStyle.italic,
// ),
// ),
// ],
// ),
child:
widget.isDesktop
? Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildFirstNameField(),
Spacer(), buildMiddleNameField(),
Spacer(),
buildLastNameField(),
SizedBox(width: 25), // Space after Last Name
buildNationality(),
],
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildFirstNameField(),
SizedBox(height: 8), buildMiddleNameField(),
SizedBox(height: 8), // Vertical space
buildLastNameField(),
SizedBox(height: 8),
buildNationality(),
],
),
);
}
@ -1039,6 +1044,48 @@ class TravellerDetailsState extends State<TravellerDetails> {
);
}
Widget buildMiddleNameField() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Middle Name",
style: GoogleFonts.poppins(
fontSize: 12,
fontWeight: FontWeight.w400,
color: Colors.black,
),
),
SizedBox(height: 5),
CustomTextFieldUserTravellerWrapper(
isFocused: false,
isDesktop: widget.isDesktop,
child: SizedBox(
height: 40,
child: TextField(
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
controller: controllers["Mname"],
enabled: !widget.isViewMode,
onChanged: (value) {
_clearError("middle_name");
},
decoration: InputDecoration(
labelText: "MiddleName",
labelStyle: GoogleFonts.poppins(
fontSize: 12,
color: Colors.grey,
),
floatingLabelBehavior: FloatingLabelBehavior.never,
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(vertical: 16),
),
),
),
),
],
);
}
Widget buildLastNameField() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -1054,6 +1101,10 @@ class TravellerDetailsState extends State<TravellerDetails> {
SizedBox(height: 5),
CustomTextFieldUserTravellerWrapper(
isFocused: false,
width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.13
: null,
isDesktop: widget.isDesktop,
child: SizedBox(
height: 40,
@ -1096,6 +1147,10 @@ class TravellerDetailsState extends State<TravellerDetails> {
SizedBox(height: 5),
CustomTextFieldUserTravellerWrapper(
isFocused: false,
width:
widget.isDesktop
? MediaQuery.of(context).size.width * 0.13
: null,
isDesktop: widget.isDesktop,
child: SizedBox(
height: 40,
@ -2789,7 +2844,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
controller: entry["controller_flier_number"],
enabled: !widget.isViewMode,
onChanged: (value) {
_clearError("first_name");
// _clearError("first_name");
},
decoration: InputDecoration(
labelText: "Frequent Flyer Information",
@ -3053,7 +3108,7 @@ class TravellerDetailsState extends State<TravellerDetails> {
controller: entry["controller_membership"],
enabled: !widget.isViewMode,
onChanged: (value) {
_clearError("first_name");
// _clearError("first_name");
},
decoration: InputDecoration(
labelText: "Hotel Membership Number",

View File

@ -321,8 +321,13 @@ class _CustomAppBarState extends State<CustomAppBar> {
errorBuilder: (context, error, stackTrace) {
return const CircleAvatar(
radius: 20,
backgroundColor: Colors.redAccent,
child: Icon(Icons.error, size: 10),
child: Icon(
Icons.add_a_photo,
size: 10,
color: Colors.grey,
),
// backgroundColor: Colors.redAccent,
// child: Icon(Icons.error, size: 10),
);
},
),
@ -339,6 +344,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
),
),
SizedBox(width: MediaQuery.of(context).size.width * 0.18),
// Spacer(),
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: Row(

View File

@ -112,9 +112,9 @@ class OrganizationSettingState extends State<OrganizationSetting> {
},
{
'value': '/forexTexmplate',
'icon': Icons.attach_money,
'label': 'Forex Template',
'description': 'Edit Template',
'icon': Icons.credit_card,
'label': 'Forex Documentation',
'description': 'Edit Document',
},
{
'value': '/templateList',