profile changes
This commit is contained in:
parent
db7df6b7de
commit
53f2c4d5b5
BIN
assets/images/login/login_terminal.png
Normal file
BIN
assets/images/login/login_terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
BIN
assets/images/login/login_travel.png
Normal file
BIN
assets/images/login/login_travel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
@ -256,7 +256,8 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
double formWidth = widget.isTablet ? 400 : 300;
|
double formWidth = widget.isTablet ? 400 : 300;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
color: Color(0xFF114D8B),
|
// color: Color(0xFF114D8B),
|
||||||
|
color: Color(0xFFf5f5f5),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -266,11 +267,15 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('assets/images/login/login_img1.png'),
|
image: AssetImage(
|
||||||
fit: BoxFit.fill
|
'assets/images/login/login_travel.png',
|
||||||
// fit: BoxFit.cover, // or BoxFit.contain, BoxFit.fill, etc.
|
),
|
||||||
),
|
|
||||||
color: Colors.blueAccent,
|
// fit: BoxFit.fill
|
||||||
|
// fit: BoxFit.contain
|
||||||
|
// fit: BoxFit.cover, // or BoxFit.contain, BoxFit.fill, etc.
|
||||||
|
),
|
||||||
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topRight: Radius.circular(25), // Rounded top-left corner
|
topRight: Radius.circular(25), // Rounded top-left corner
|
||||||
bottomRight:
|
bottomRight:
|
||||||
@ -278,7 +283,9 @@ class _LoginWidgetState extends State<LoginWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 0),
|
padding: const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
|
|||||||
@ -19,9 +19,11 @@ class FlightScreen extends StatefulWidget {
|
|||||||
final Function(bool) onClose;
|
final Function(bool) onClose;
|
||||||
final Function(Map<String, dynamic>) onSaveFlight;
|
final Function(Map<String, dynamic>) onSaveFlight;
|
||||||
final Map<String, dynamic>? selectedItem;
|
final Map<String, dynamic>? selectedItem;
|
||||||
|
final ValueNotifier<String?> tripTypeNotifier;
|
||||||
|
|
||||||
FlightScreen(
|
FlightScreen(
|
||||||
{required this.apiData,
|
{Key? key,
|
||||||
|
required this.apiData,
|
||||||
required this.loginUser,
|
required this.loginUser,
|
||||||
required this.onClose,
|
required this.onClose,
|
||||||
required this.onSaveFlight,
|
required this.onSaveFlight,
|
||||||
@ -29,13 +31,15 @@ class FlightScreen extends StatefulWidget {
|
|||||||
required this.flightData,
|
required this.flightData,
|
||||||
required this.hasAction,
|
required this.hasAction,
|
||||||
this.tripType,
|
this.tripType,
|
||||||
this.apiDataForClass});
|
required this.tripTypeNotifier,
|
||||||
|
this.apiDataForClass})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FlightScreenState createState() => _FlightScreenState();
|
FlightScreenState createState() => FlightScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FlightScreenState extends State<FlightScreen> {
|
class FlightScreenState extends State<FlightScreen> {
|
||||||
ApiService apiService = ApiService();
|
ApiService apiService = ApiService();
|
||||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@ -77,7 +81,7 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
|
|
||||||
List<List<Widget>> rowBuilders = []; // Holds row widgets
|
List<List<Widget>> rowBuilders = []; // Holds row widgets
|
||||||
List<TextEditingController> controllers = []; // Dynamic controllers
|
List<TextEditingController> controllers = []; // Dynamic controllers
|
||||||
|
bool _hasInitialTripTypeLoaded = false;
|
||||||
Map<String, String> errorMessages = {};
|
Map<String, String> errorMessages = {};
|
||||||
// forex_pre_paid_card_number
|
// forex_pre_paid_card_number
|
||||||
@override
|
@override
|
||||||
@ -86,6 +90,24 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
|
|
||||||
print("TripType - ${widget.tripType}");
|
print("TripType - ${widget.tripType}");
|
||||||
|
|
||||||
|
// final newTripType = widget.tripTypeNotifier.value;
|
||||||
|
// print("TripType1 - $newTripType");
|
||||||
|
|
||||||
|
// // Listen immediately
|
||||||
|
// widget.tripTypeNotifier.addListener(() {
|
||||||
|
// final newTripType = widget.tripTypeNotifier.value;
|
||||||
|
//
|
||||||
|
// if (newTripType != null && newTripType.isNotEmpty) {
|
||||||
|
// if (_hasInitialTripTypeLoaded) {
|
||||||
|
// print("🚀 FlightScreen reacting to new trip type: $newTripType");
|
||||||
|
// loadCountryList(newTripType);
|
||||||
|
// } else {
|
||||||
|
// print("🟡 Skipping initial tripTypeNotifier value: $newTripType");
|
||||||
|
// _hasInitialTripTypeLoaded = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
// _initializeRows();
|
// _initializeRows();
|
||||||
// List<dynamic> purposeList = widget.apiData?['flight_trip_type'] ?? [];
|
// List<dynamic> purposeList = widget.apiData?['flight_trip_type'] ?? [];
|
||||||
// selectedTripType ??= purposeList.isNotEmpty ? purposeList.first['dropdown_value'] : null;
|
// selectedTripType ??= purposeList.isNotEmpty ? purposeList.first['dropdown_value'] : null;
|
||||||
@ -135,7 +157,7 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
textControllers["_time${i}Controller"]
|
textControllers["_time${i}Controller"]
|
||||||
?.addListener(() => _clearError("time_$i"));
|
?.addListener(() => _clearError("time_$i"));
|
||||||
}
|
}
|
||||||
loadCountryList();
|
// loadCountryList();
|
||||||
|
|
||||||
flightFirstTripDateNotifier = ValueNotifier<String?>(null);
|
flightFirstTripDateNotifier = ValueNotifier<String?>(null);
|
||||||
flightLastTripDateNotifier = ValueNotifier<String?>(null);
|
flightLastTripDateNotifier = ValueNotifier<String?>(null);
|
||||||
@ -144,6 +166,14 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
final result = getFlightTripDateRange(widget.flightData);
|
final result = getFlightTripDateRange(widget.flightData);
|
||||||
flightFirstTripDateNotifier.value = result['firstTripDate'];
|
flightFirstTripDateNotifier.value = result['firstTripDate'];
|
||||||
flightLastTripDateNotifier.value = result['lastTripDate'];
|
flightLastTripDateNotifier.value = result['lastTripDate'];
|
||||||
|
final tripTypeValue = widget.tripTypeNotifier.value;
|
||||||
|
|
||||||
|
if (tripTypeValue != null && tripTypeValue.isNotEmpty) {
|
||||||
|
print("🚀 Initial loadCountryList for tripType: $tripTypeValue");
|
||||||
|
loadCountryList(tripTypeValue);
|
||||||
|
} else {
|
||||||
|
print("⚠️ tripType is null or empty, skipping loadCountryList");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,12 +233,14 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
// isCountryLoading = false;
|
// isCountryLoading = false;
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
Future<void> loadCountryList() async {
|
Future<void> loadCountryList(newTripType) async {
|
||||||
|
print("🔄 loadCountryList called with tripType: ${newTripType}");
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
isCountryLoading = true;
|
isCountryLoading = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
final result = await apiService.fetchFlightsCountryList(widget.tripType);
|
final result = await apiService.fetchFlightsCountryList(newTripType);
|
||||||
|
|
||||||
print("ResultCountry : $result");
|
print("ResultCountry : $result");
|
||||||
|
|
||||||
@ -1007,6 +1039,8 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildSecondRow(bool isDesktop, int index) {
|
List<Widget> _buildSecondRow(bool isDesktop, int index) {
|
||||||
|
bool isFlightClassLoading = widget.apiDataForClass?['flight_class'] == null;
|
||||||
|
|
||||||
List<dynamic> purposeList = widget.apiDataForClass?['flight_class'] ?? [];
|
List<dynamic> purposeList = widget.apiDataForClass?['flight_class'] ?? [];
|
||||||
|
|
||||||
List<DropdownMenuItem<String>> dropdownItems = purposeList
|
List<DropdownMenuItem<String>> dropdownItems = purposeList
|
||||||
@ -1344,7 +1378,7 @@ class _FlightScreenState extends State<FlightScreen> {
|
|||||||
// : MediaQuery.of(context).size.width * 0.66,
|
// : MediaQuery.of(context).size.width * 0.66,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: isCountryLoading
|
child: isFlightClassLoading
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
: DropdownButtonFormField<String>(
|
: DropdownButtonFormField<String>(
|
||||||
focusNode: focusNodes["_class${index}FocusNode"],
|
focusNode: focusNodes["_class${index}FocusNode"],
|
||||||
|
|||||||
@ -349,6 +349,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
|
|
||||||
void handleUpdatedField() async {
|
void handleUpdatedField() async {
|
||||||
// Set the selected value if available
|
// Set the selected value if available
|
||||||
|
|
||||||
userCardNumber = await getForexCardNumber();
|
userCardNumber = await getForexCardNumber();
|
||||||
// userCardNumber = "CD7909043";
|
// userCardNumber = "CD7909043";
|
||||||
print("userCardNumber - $userCardNumber");
|
print("userCardNumber - $userCardNumber");
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import '../../widgets/custom_radio_button.dart';
|
|||||||
import '../../widgets/custom_text_field.dart';
|
import '../../widgets/custom_text_field.dart';
|
||||||
import '../approvals/approval_dialogs.dart';
|
import '../approvals/approval_dialogs.dart';
|
||||||
import '../dialog/user_selection_dialog.dart';
|
import '../dialog/user_selection_dialog.dart';
|
||||||
|
import '../itnerary/flights.dart';
|
||||||
|
|
||||||
class CreatePlan extends StatefulWidget {
|
class CreatePlan extends StatefulWidget {
|
||||||
CreatePlan({super.key});
|
CreatePlan({super.key});
|
||||||
@ -294,6 +295,10 @@ class CreateNewPlan extends StatefulWidget {
|
|||||||
class CreateNewPlansState extends State<CreateNewPlan> {
|
class CreateNewPlansState extends State<CreateNewPlan> {
|
||||||
final GlobalKey<DynamicItineraryState> dynamicItineraryKey =
|
final GlobalKey<DynamicItineraryState> dynamicItineraryKey =
|
||||||
GlobalKey<DynamicItineraryState>();
|
GlobalKey<DynamicItineraryState>();
|
||||||
|
final GlobalKey<FlightScreenState> flightScreenKey =
|
||||||
|
GlobalKey<FlightScreenState>();
|
||||||
|
|
||||||
|
late final ValueNotifier<String?> flightTripTypeNotifier;
|
||||||
|
|
||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
@ -438,6 +443,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
flightTripTypeNotifier = ValueNotifier(null);
|
||||||
|
|
||||||
fetchUserDetails();
|
fetchUserDetails();
|
||||||
|
|
||||||
fetchPlans();
|
fetchPlans();
|
||||||
@ -479,6 +487,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
widget.selectedPlanData['description'] ?? '';
|
widget.selectedPlanData['description'] ?? '';
|
||||||
|
|
||||||
_selectedTripType = widget.selectedPlanData['trip_type'];
|
_selectedTripType = widget.selectedPlanData['trip_type'];
|
||||||
|
flightTripTypeNotifier.value = widget.selectedPlanData['trip_type'];
|
||||||
_selectedIsBillable =
|
_selectedIsBillable =
|
||||||
widget.selectedPlanData['is_billable'] == "1" ? "1" : "2";
|
widget.selectedPlanData['is_billable'] == "1" ? "1" : "2";
|
||||||
|
|
||||||
@ -1408,6 +1417,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: DynamicItinerary(
|
child: DynamicItinerary(
|
||||||
key: dynamicItineraryKey,
|
key: dynamicItineraryKey,
|
||||||
|
flightScreenKey: flightScreenKey,
|
||||||
|
tripTypeNotifier: flightTripTypeNotifier,
|
||||||
hasAction: hasAction,
|
hasAction: hasAction,
|
||||||
tripType: _selectedTripType,
|
tripType: _selectedTripType,
|
||||||
apiData: apiData,
|
apiData: apiData,
|
||||||
@ -1538,6 +1549,10 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_selectedTripType =
|
_selectedTripType =
|
||||||
newItem['dropdown_key'].toString();
|
newItem['dropdown_key'].toString();
|
||||||
|
// Notify FlightScreen
|
||||||
|
flightTripTypeNotifier.value = _selectedTripType;
|
||||||
|
print(
|
||||||
|
"flightTripTypeNotifier- ${flightTripTypeNotifier.value}");
|
||||||
fetchTrainFlightClass(
|
fetchTrainFlightClass(
|
||||||
int.parse(_selectedTripType!));
|
int.parse(_selectedTripType!));
|
||||||
dynamicItineraryKey.currentState
|
dynamicItineraryKey.currentState
|
||||||
|
|||||||
@ -36,6 +36,8 @@ class DynamicItinerary extends StatefulWidget {
|
|||||||
onItineraryUpdate; // Updated Signature
|
onItineraryUpdate; // Updated Signature
|
||||||
final Map<String, dynamic> selectedPlanData;
|
final Map<String, dynamic> selectedPlanData;
|
||||||
final bool isViewMode;
|
final bool isViewMode;
|
||||||
|
final GlobalKey<FlightScreenState> flightScreenKey;
|
||||||
|
final ValueNotifier<String?> tripTypeNotifier;
|
||||||
|
|
||||||
const DynamicItinerary(
|
const DynamicItinerary(
|
||||||
{super.key,
|
{super.key,
|
||||||
@ -47,7 +49,9 @@ class DynamicItinerary extends StatefulWidget {
|
|||||||
required this.isViewMode,
|
required this.isViewMode,
|
||||||
required this.hasAction,
|
required this.hasAction,
|
||||||
this.tripType,
|
this.tripType,
|
||||||
this.apiDataForClass});
|
this.apiDataForClass,
|
||||||
|
required this.tripTypeNotifier,
|
||||||
|
required this.flightScreenKey});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DynamicItineraryState createState() => DynamicItineraryState();
|
DynamicItineraryState createState() => DynamicItineraryState();
|
||||||
@ -692,6 +696,8 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
case "Flight":
|
case "Flight":
|
||||||
default:
|
default:
|
||||||
selectedWidget = FlightScreen(
|
selectedWidget = FlightScreen(
|
||||||
|
key: widget.flightScreenKey,
|
||||||
|
tripTypeNotifier: widget.tripTypeNotifier,
|
||||||
hasAction: widget.hasAction,
|
hasAction: widget.hasAction,
|
||||||
tripType: widget.tripType,
|
tripType: widget.tripType,
|
||||||
onClose: handleClose,
|
onClose: handleClose,
|
||||||
|
|||||||
@ -157,8 +157,10 @@ class _OfficeDetailsState extends State<OfficeDetails> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
// apiUserData = users;
|
// apiUserData = users;
|
||||||
|
|
||||||
apiUserData = users.where((user) => user["role_id"] == "4").toList();
|
print("Total users fetched from API: ${users.length}");
|
||||||
|
|
||||||
|
apiUserData = users.where((user) => user["role_id"] != "5").toList();
|
||||||
|
print("Total users fetched from API1: ${apiUserData?.length}");
|
||||||
print("APIUSerDATa - $apiUserData");
|
print("APIUSerDATa - $apiUserData");
|
||||||
|
|
||||||
userList = apiUserData ?? [];
|
userList = apiUserData ?? [];
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
Map<String, dynamic>? userData;
|
Map<String, dynamic>? userData;
|
||||||
Map<String, dynamic>? fetchedUserData;
|
Map<String, dynamic>? fetchedUserData;
|
||||||
Map<String, dynamic> userDetails = {};
|
Map<String, dynamic> userDetails = {};
|
||||||
|
Map<String, dynamic> profileUserDetails = {};
|
||||||
|
|
||||||
Map<String, dynamic>? selectedOrg;
|
Map<String, dynamic>? selectedOrg;
|
||||||
Color? layoutColor;
|
Color? layoutColor;
|
||||||
@ -59,6 +60,24 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getProfileUser() async {
|
||||||
|
print("getProfileUser - $userData");
|
||||||
|
print("getProfileUser - ${userData?['user_id']}");
|
||||||
|
|
||||||
|
final userIdRaw = userData?['user_id'];
|
||||||
|
final int? userId =
|
||||||
|
userIdRaw is int ? userIdRaw : int.tryParse(userIdRaw.toString());
|
||||||
|
|
||||||
|
if (userId != null) {
|
||||||
|
profileUserDetails = await apiService.getSingleUser(userId);
|
||||||
|
print("getProfileUser-$profileUserDetails");
|
||||||
|
} else {
|
||||||
|
print("❌ Invalid user_id: $userIdRaw");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("getProfileUser-$profileUserDetails");
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> initializeData() async {
|
Future<void> initializeData() async {
|
||||||
print("initializeDatainitializeData");
|
print("initializeDatainitializeData");
|
||||||
token = await getToken();
|
token = await getToken();
|
||||||
@ -72,6 +91,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
userData = fetchedUserData;
|
userData = fetchedUserData;
|
||||||
});
|
});
|
||||||
|
getProfileUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTabLabel(TabSelection tab) {
|
String getTabLabel(TabSelection tab) {
|
||||||
@ -480,8 +500,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
context.go(
|
context.go(
|
||||||
"/CreateUserDetails",
|
"/CreateUserDetails",
|
||||||
extra: {
|
extra: {
|
||||||
"selectedUser": userDetails,
|
"selectedUser": profileUserDetails,
|
||||||
"isEditProfile": true,
|
|
||||||
"isEditProfile": true,
|
"isEditProfile": true,
|
||||||
"isViewMode": false,
|
"isViewMode": false,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -67,6 +67,7 @@ Future<String?> getRoleUser() async {
|
|||||||
Future<String?> getForexCardNumber() async {
|
Future<String?> getForexCardNumber() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
final String? userDataString = prefs.getString('user_data');
|
final String? userDataString = prefs.getString('user_data');
|
||||||
|
// final String? userDataString = prefs.getString('user_data');
|
||||||
|
|
||||||
if (userDataString != null) {
|
if (userDataString != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -75,6 +75,8 @@ flutter:
|
|||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- assets/images/login/login_img1.png
|
- assets/images/login/login_img1.png
|
||||||
|
- assets/images/login/login_terminal.png
|
||||||
|
- assets/images/login/login_travel.png
|
||||||
- assets/images/login/travelSpend_Logo.png
|
- assets/images/login/travelSpend_Logo.png
|
||||||
- assets/images/login/TravelSpendsLogo1.png
|
- assets/images/login/TravelSpendsLogo1.png
|
||||||
- assets/images/login/VectorG.png
|
- assets/images/login/VectorG.png
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user