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