From cafa8cbc95825ce579c9d625153d3737e9f28b57 Mon Sep 17 00:00:00 2001 From: venbaittech Date: Mon, 19 May 2025 16:20:18 +0530 Subject: [PATCH] Plan Creation Bug --- lib/Screens/allTrips/list_all_plans.dart | 59 ++---- lib/Screens/allTrips/travel_agent_list.dart | 1 + lib/Screens/approvals/approval_list.dart | 80 ++++---- lib/Screens/dialog/user_selection_dialog.dart | 78 ++++--- lib/Screens/itnerary/accomodations.dart | 7 + lib/Screens/itnerary/forex.dart | 2 +- lib/Screens/plans/create_plans.dart | 190 ++++++++++++++---- lib/Screens/plans/list_plans.dart | 76 ++++--- .../create_user/create_user.dart | 30 +-- .../create_user/office_details.dart | 3 +- .../create_user/personal_details.dart | 17 +- lib/routes/custom_appBar.dart | 2 +- lib/widgets/custom_text_traveller.dart | 37 ++-- lib/widgets/popup_listPlan_action.dart | 19 ++ 14 files changed, 375 insertions(+), 226 deletions(-) diff --git a/lib/Screens/allTrips/list_all_plans.dart b/lib/Screens/allTrips/list_all_plans.dart index 546276a..3f22c33 100644 --- a/lib/Screens/allTrips/list_all_plans.dart +++ b/lib/Screens/allTrips/list_all_plans.dart @@ -768,31 +768,32 @@ class _ListAllPlansState extends State { plan.planId); }, ), + IconButton( + icon: const Icon( + Icons.comment, + color: Color(0xFF475569), + size: 11, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) => + CommentModalList( + // planId: plan.planId, + planId: plan + .planId + .toString(), + layoutColorForUser: + layoutColor!, + role: "Admin"), + ); + }), ], ), ), ), ], ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: - plan.planId.toString(), - layoutColorForUser: - layoutColor!, - role: "Admin"), - ); - }), ], ), ), @@ -861,26 +862,8 @@ class _ListAllPlansState extends State { plan: plan, deletePlan: deletePlan, apiService: apiService, + layoutColor: layoutColor, ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: plan.planId - .toString(), - layoutColorForUser: - layoutColor!, - role: "Admin"), - ); - }), ], ), ], diff --git a/lib/Screens/allTrips/travel_agent_list.dart b/lib/Screens/allTrips/travel_agent_list.dart index bc1a7f4..83581b3 100644 --- a/lib/Screens/allTrips/travel_agent_list.dart +++ b/lib/Screens/allTrips/travel_agent_list.dart @@ -819,6 +819,7 @@ class _TravelAgentListPlansState extends State { plan: plan, deletePlan: deletePlan, apiService: apiService, + layoutColor: layoutColor, ), IconButton( icon: const Icon( diff --git a/lib/Screens/approvals/approval_list.dart b/lib/Screens/approvals/approval_list.dart index e2afbbf..1c8dd3c 100644 --- a/lib/Screens/approvals/approval_list.dart +++ b/lib/Screens/approvals/approval_list.dart @@ -742,31 +742,33 @@ class _ApprovalListState extends State { plan.planId); }, ), + IconButton( + icon: const Icon( + Icons.comment, + color: Color(0xFF475569), + size: 11, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) => + CommentModalList( + // planId: plan.planId, + planId: plan + .planId + .toString(), + layoutColorForUser: + layoutColor!, + role: + "Approver"), + ); + }), ], ), ), ), ], ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: - plan.planId.toString(), - layoutColorForUser: - layoutColor!, - role: "Approver"), - ); - }), ], ), ), @@ -934,31 +936,33 @@ class _ApprovalListState extends State { plan.planId); }, ), + IconButton( + icon: const Icon( + Icons.comment, + color: Color(0xFF475569), + size: 11, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) => + CommentModalList( + // planId: plan.planId, + planId: plan + .planId + .toString(), + layoutColorForUser: + layoutColor!, + role: + "Approver"), + ); + }), ], ), ), ), ], ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: - plan.planId.toString(), - layoutColorForUser: - layoutColor!, - role: "Approver"), - ); - }), ], ), diff --git a/lib/Screens/dialog/user_selection_dialog.dart b/lib/Screens/dialog/user_selection_dialog.dart index 515e5bc..8c417f3 100644 --- a/lib/Screens/dialog/user_selection_dialog.dart +++ b/lib/Screens/dialog/user_selection_dialog.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'package:google_fonts/google_fonts.dart'; import 'package:http/http.dart' as http; import 'package:flutter/material.dart'; import 'package:responsive_builder/responsive_builder.dart'; @@ -286,7 +287,8 @@ class _UserSelectionDialogState extends State { mainAxisSize: MainAxisSize.min, // Ensures content doesn't expand unnecessarily children: [ - Text("Please Select User", style: TextStyle(fontSize: 14)), + Text("Please Select User", + style: GoogleFonts.poppins(fontSize: 14)), SizedBox(height: 10), // Search Field @@ -300,19 +302,21 @@ class _UserSelectionDialogState extends State { ? _filterUsersTravellers(query) : _filterUsers(query); }, + style: GoogleFonts.poppins(fontSize: 12), decoration: InputDecoration( hintText: "Search for a user", - hintStyle: TextStyle(fontSize: 14), + hintStyle: + GoogleFonts.poppins(fontSize: 14, color: Colors.grey), prefixIcon: Icon(Icons.search), border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1), + borderSide: BorderSide(color: Colors.grey.shade200, width: 1), // borderSide: BorderSide(color: Color(0xFFF5F5F5), width: 2), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.blueAccent, width: 2), + borderSide: BorderSide(color: Colors.grey.shade200, width: 1), ), ), ), @@ -324,7 +328,8 @@ class _UserSelectionDialogState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("or create a new traveler", - style: TextStyle(fontSize: 14, color: Color(0xFF575A74))), + style: GoogleFonts.poppins( + fontSize: 14, color: Color(0xFF575A74))), TextButton( onPressed: () { setState(() { @@ -333,7 +338,7 @@ class _UserSelectionDialogState extends State { }); }, child: Text("Create", - style: TextStyle( + style: GoogleFonts.poppins( fontSize: 14, color: widget.layoutColorForUser)), ), ], @@ -351,8 +356,8 @@ class _UserSelectionDialogState extends State { ? Center( child: Text( "No users found", - style: - TextStyle(fontSize: 14, color: Colors.grey), + style: GoogleFonts.poppins( + fontSize: 14, color: Colors.grey), ), ) : ListView.builder( @@ -368,7 +373,9 @@ class _UserSelectionDialogState extends State { return ListTile( title: Text( - "${user.firstName ?? "Unknown"} ${user.lastName ?? ""}"), + "${user.firstName ?? "Unknown"} ${user.lastName ?? ""}", + style: GoogleFonts.poppins(fontSize: 11), + ), // subtitle: Text( // "ID: ${userType == "user" ? user.userId : user.travellerId}"), onTap: () { @@ -395,7 +402,7 @@ class _UserSelectionDialogState extends State { if (_showTravellerForm) Container( height: 300, // Set a defined height - color: Color(0xFFF4F4FB), + // color: Color(0xFFF4F4FB), child: Padding( padding: const EdgeInsets.all(16.0), child: TravelerForm( @@ -435,6 +442,7 @@ class _UserSelectionDialogState extends State { }, child: Text( "Cancel", + style: GoogleFonts.poppins(fontSize: 11), ), ), SizedBox(width: 10), @@ -456,7 +464,10 @@ class _UserSelectionDialogState extends State { _searchController.text, userIdSelected, isTraveller); Navigator.pop(context); }, - child: Text("Submit"), + child: Text( + "Submit", + style: GoogleFonts.poppins(fontSize: 11), + ), ), ], ), @@ -563,33 +574,37 @@ class _TravelerFormState extends State { ); if (response.statusCode == 200 || response.statusCode == 201) { - if (response.statusCode == 200 || response.statusCode == 201) { - final Map responseData = - jsonDecode(response.body); // Parse response - if (responseData["success"] == true && - responseData.containsKey("data")) { - final travellerData = responseData["data"]; + final Map responseData = jsonDecode(response.body); + if (responseData.containsKey("data")) { + // Parse response - String travellerId = travellerData["traveller_id"]; - String firstName = travellerData["first_name"]; - String lastName = travellerData["last_name"]; + print("responseData- $responseData "); - print( - "Traveller Added: ID: $travellerId, Name: $firstName $lastName"); + final travellerData = responseData["data"]; - // Pass data to callback - widget.onSubmit("$firstName $lastName", travellerId, true); + String travellerId = travellerData["traveller_id"]; + String firstName = travellerData["first_name"]; + String lastName = travellerData["last_name"]; - // Close the dialog - Navigator.pop(context); - } + print( + "Traveller Added: ID: $travellerId, Name: $firstName $lastName"); + + // // Pass data to callback + // widget.onSubmit("$firstName $lastName", travellerId, true); + + String fullName = "${firstName.trim()} ${lastName.trim()}"; + widget.onSubmit(fullName, travellerId, true); + + // Close the dialog + Navigator.pop(context); } ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( "Traveller added successfully!", - style: TextStyle(color: Colors.white), // ✅ Set text color + style: + GoogleFonts.poppins(color: Colors.white), // ✅ Set text color ), backgroundColor: Colors.green, ), @@ -643,12 +658,13 @@ class _TravelerFormState extends State { onPressed: () { widget.formKey.currentState?.reset(); }, - child: Text("Clear", style: TextStyle(color: Colors.grey)), + child: Text("Clear", + style: GoogleFonts.poppins(color: Colors.grey)), ), TextButton( onPressed: () => _onSubmit(context), - child: - Text("Add", style: TextStyle(color: Colors.blueAccent)), + child: Text("Add", + style: GoogleFonts.poppins(color: Colors.blueAccent)), ), ], ), diff --git a/lib/Screens/itnerary/accomodations.dart b/lib/Screens/itnerary/accomodations.dart index b931c87..b51bea4 100644 --- a/lib/Screens/itnerary/accomodations.dart +++ b/lib/Screens/itnerary/accomodations.dart @@ -158,6 +158,13 @@ class _AccomodationScreenState extends State { _checkInController.text = DateFormat('yyyy-MM-dd').format(parsedDate); } + final parsedEndDate = + DateTime.tryParse(flightLastTripDateNotifier.value ?? ''); + if (parsedEndDate != null) { + _checkOutController.text = + DateFormat('yyyy-MM-dd').format(parsedEndDate); + } + // ✅ Check and set default times if empty if (_checkInTimeController.text.isEmpty) { _checkInTimeController.text = '14:00'; // 2 PM diff --git a/lib/Screens/itnerary/forex.dart b/lib/Screens/itnerary/forex.dart index c9e67c2..3975a1a 100644 --- a/lib/Screens/itnerary/forex.dart +++ b/lib/Screens/itnerary/forex.dart @@ -492,7 +492,7 @@ class _ForexScreenState extends State { double.tryParse(textControllers["_telephone"]?.text ?? "0") ?? 0; double calclateVal = (transport + accommodation + telephone); - CalculatedOtherExpenses = (calclateVal).toStringAsFixed(2); + CalculatedOtherExpenses = (calclateVal).toStringAsFixed(0); // Convert selectedPerdiemAmount to double before performing the addition double perdiemAmount = double.tryParse(selectedPerdiemAmount ?? "0") ?? 0; diff --git a/lib/Screens/plans/create_plans.dart b/lib/Screens/plans/create_plans.dart index 77c737c..c0e6463 100644 --- a/lib/Screens/plans/create_plans.dart +++ b/lib/Screens/plans/create_plans.dart @@ -474,6 +474,31 @@ class CreateNewPlansState extends State { super.dispose(); } + void handleSelectedUser() { + if (widget.selectedPlanData != null) { + setState(() { + String userId = widget.selectedPlanData['user_id'] ?? ''; + String userName = widget.selectedPlanData['user_name'] ?? ''; + String travellerId = widget.selectedPlanData['traveller_id'] ?? ''; + String travellerName = widget.selectedPlanData['traveller_name'] ?? ''; + + print("TestplanUsrId $userId --- $travellerId"); + + if (travellerId.isNotEmpty && travellerId != "0") { + print("TestplanUsrId1: $travellerId"); + planTravlrId = travellerId; + _selectedOption = "Option 3"; + otherUserName = travellerName; + } else if (userId.isNotEmpty && userId != "0") { + print("TestplanUsrId : $userId"); + print("TestplanUsrIdSelf : $selfId"); + _selectedOption = (selfId != userId) ? "Option 2" : "Option 1"; + otherUserName = userName; + } + }); + } + } + void handleUpdateData() { if (widget.selectedPlanData != null) { setState(() { @@ -641,10 +666,11 @@ class CreateNewPlansState extends State { } void getSelectedPlanFor() { - if (!mounted) return; - + // if (!mounted) return; + print("getSelectedPlanFor"); setState(() { if (selectedplanUserId != null) { + print("Is Not USER ID - $planUsrId "); if (selectedIstravelUser!) { planUsrId = ""; planTravlrId = selectedplanUserId; @@ -653,8 +679,10 @@ class CreateNewPlansState extends State { planTravlrId = ""; } } else { + print("Is USER ID - $planUsrId "); planUsrId = selfId; planTravlrId = ""; + _selectedOption = "Option 1"; } }); @@ -676,8 +704,12 @@ class CreateNewPlansState extends State { } orgId = await getOrgId(); print("userDetails - $selfId"); + // handleSelectedUser(); getSelectedPlanFor(); setTripPlanAction(); + + handleSelectedUser(); + // handleUpdateData(); } Future getToken() async { @@ -1279,52 +1311,53 @@ class CreateNewPlansState extends State { color: Color(0xFF575A74)), ), SizedBox(height: 6), - isMobile + isDesktop ? SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( - children: _buildPlanTrip(isMobile), + children: _buildPlanTrip(isDesktop), ), ) : Row( - children: _buildPlanTrip(isMobile), + children: _buildPlanTrip(isDesktop), ), SizedBox(height: 7), - Text( - otherUserName ?? userName ?? " ", // Your label - - style: GoogleFonts.poppins( - fontSize: 12, - fontWeight: FontWeight.w400, - color: widget.layoutColor, - ), - ) - // Text.rich( - // TextSpan( - // text: "Trip Planned For : ", // Static text - // style: TextStyle( - // fontFamily: "Archivo", - // fontSize: 13, - // fontWeight: FontWeight.w600, - // color: Color(0xFF212121), - // // color: Color(0xFF575A74), // Default color - // ), - // children: [ - // TextSpan( - // text: otherUserName ?? - // userName ?? - // " ", // Dynamic username - // style: TextStyle( - // fontSize: 12, - // fontWeight: FontWeight.w400, - // color: widget - // .layoutColor, // Change this to any color - // // color: Colors.blueAccent, // Change this to any color - // ), - // ), - // ], + // Text( + // otherUserName ?? userName ?? " ", // Your label + // + // style: GoogleFonts.poppins( + // fontSize: 11, + // fontWeight: FontWeight.w400, + // color: widget.layoutColor, // ), // ), + + Text.rich( + TextSpan( + text: "Trip Planned User : ", // Static text + style: GoogleFonts.poppins( + fontSize: 11, + fontWeight: FontWeight.w400, + color: Color(0xFF212121), + // color: Color(0xFF575A74), // Default color + ), + children: [ + TextSpan( + text: otherUserName ?? + userName ?? + " ", // Dynamic username + style: GoogleFonts.poppins( + fontSize: 11, + fontWeight: FontWeight.w400, + color: widget + .layoutColor, // Change this to any color + // color: Colors.blueAccent, // Change this to any color + ), + ), + ], + ), + ), + SizedBox(height: 5), ], ), ), @@ -1483,6 +1516,7 @@ class CreateNewPlansState extends State { color: Color(0xFF575A74)), ), SizedBox(height: 5), + CustomTextFieldWrapper( isFocused: false, isDesktop: widget.isDesktop, @@ -1513,8 +1547,9 @@ class CreateNewPlansState extends State { dropdownDecoratorProps: const DropDownDecoratorProps( dropdownSearchDecoration: InputDecoration( border: InputBorder.none, // No underline + contentPadding: - EdgeInsets.symmetric(horizontal: 1, vertical: 5), + EdgeInsets.symmetric(horizontal: 10, vertical: 5), ), ), dropdownBuilder: (context, selectedItem) { @@ -2205,6 +2240,75 @@ class CreateNewPlansState extends State { {"title": "Others", "value": "Option 3"}, ]; + return [ + CustomTextFieldWrapper( + isFocused: false, + isDesktop: isDesktop, + layoutColor: widget.layoutColor, + child: SizedBox( + height: 35, + width: double.infinity, + child: DropdownSearch( + selectedItem: options + .firstWhere((opt) => opt['value'] == _selectedOption)['title'], + enabled: !widget.isViewMode, + items: options.map((opt) => opt['title']!).toList(), + popupProps: PopupProps.menu( + showSearchBox: false, + menuProps: const MenuProps( + backgroundColor: Colors.white, + ), + constraints: BoxConstraints(maxHeight: 100), + itemBuilder: (context, item, isSelected) => Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0), + child: Text( + item, + style: GoogleFonts.poppins(fontSize: 13), + ), + ), + ), + dropdownDecoratorProps: DropDownDecoratorProps( + dropdownSearchDecoration: InputDecoration( + border: InputBorder.none, + contentPadding: + const EdgeInsets.symmetric(horizontal: 10, vertical: 5), + ), + ), + dropdownBuilder: (context, selectedItem) { + return Text( + selectedItem ?? "Select Purpose", + style: GoogleFonts.poppins( + fontSize: 12, + color: selectedItem == null ? Colors.grey : Colors.black, + ), + ); + }, + onChanged: (String? newTitle) { + if (newTitle == null) return; + final selected = + options.firstWhere((opt) => opt["title"] == newTitle); + setState(() { + _selectedOption = selected["value"]!; + if (_selectedOption == "Option 2" || + _selectedOption == "Option 3") { + _showInputDialog(selected["title"]!); + } + }); + }, + ), + ), + ) + ]; + } + + List _buildPlanTrip1(bool isDesktop) { + List> options = [ + {"title": "Self", "value": "Option 1"}, + {"title": "Other Employee", "value": "Option 2"}, + {"title": "Others", "value": "Option 3"}, + ]; + print(" layoutColor: ${widget.layoutColor}"); return options.map((option) { return Padding( @@ -2502,7 +2606,8 @@ class CreateNewPlansState extends State { // ), // ), CustomTextFieldWrapper( - isFocused: _isdescriptionFocused, + isFocused: false, + // isFocused: _isdescriptionFocused, // width: isDesktop // ? MediaQuery.of(context).size.width * 0.38 // : MediaQuery.of(context).size.width * 0.85, @@ -2604,7 +2709,7 @@ class CreateNewPlansState extends State { decoration: InputDecoration( labelText: "Trip Name *", - labelStyle: GoogleFonts.poppins(fontSize: 14, color: Colors.grey), + labelStyle: GoogleFonts.poppins(fontSize: 14, color: Colors.black54), floatingLabelBehavior: FloatingLabelBehavior.never, border: InputBorder.none, contentPadding: EdgeInsets.symmetric(vertical: 16), @@ -3108,7 +3213,8 @@ class CreateNewPlansState extends State { getSelectedPlanFor(); }, onClose: () { - getSelectedPlanFor(); + print("Choosede Clsoes"); + fetchUserDetails(); }, layoutColorForUser: widget.layoutColor!, ); diff --git a/lib/Screens/plans/list_plans.dart b/lib/Screens/plans/list_plans.dart index aaf309f..384d37a 100644 --- a/lib/Screens/plans/list_plans.dart +++ b/lib/Screens/plans/list_plans.dart @@ -48,11 +48,24 @@ class _ListPlansState extends State { @override void initState() { super.initState(); + + super.initState(); + // futurePlans = fetchPlans(); + // + // futurePlans.then((plans) { + // setState(() { + // allPlans = plans; + // filteredPlans = plans; + // }); + // }); + getToken(); + initializeData(); + loadInitialData(); WidgetsBinding.instance.addPostFrameCallback((_) { - initializeData(); - loadInitialData(); + // initializeData(); + // loadInitialData(); // futurePlans.then((plans) { // setState(() { @@ -813,31 +826,32 @@ class _ListPlansState extends State { plan.planId); }, ), + IconButton( + icon: const Icon( + Icons.comment, + color: Color(0xFF475569), + size: 11, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) => + CommentModalList( + // planId: plan.planId, + planId: plan + .planId + .toString(), + layoutColorForUser: + layoutColor!, + role: "User"), + ); + }), ], ), ), ), ], ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: - plan.planId.toString(), - layoutColorForUser: - layoutColor!, - role: "User"), - ); - }), ], ), ), @@ -940,26 +954,8 @@ class _ListPlansState extends State { plan: plan, deletePlan: deletePlan, apiService: apiService, + layoutColor: layoutColor, ), - IconButton( - icon: const Icon( - Icons.comment, - color: Color(0xFF475569), - size: 11, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) => - CommentModalList( - // planId: plan.planId, - planId: - plan.planId.toString(), - layoutColorForUser: - layoutColor!, - role: "User"), - ); - }), ], ), diff --git a/lib/Screens/userManagement/create_user/create_user.dart b/lib/Screens/userManagement/create_user/create_user.dart index 4a92562..60d93e1 100644 --- a/lib/Screens/userManagement/create_user/create_user.dart +++ b/lib/Screens/userManagement/create_user/create_user.dart @@ -847,7 +847,6 @@ class _CreateUserFormDetialsState extends State { mainAxisAlignment: MainAxisAlignment.end, children: (selectedTab == "travel" || selectedRole == "5" || - isEditProfile || setSelectesUserType == true) ? _buildSubmit(isDesktop, layoutColor!) : _buildNext(isDesktop, layoutColor!), @@ -885,18 +884,18 @@ class _CreateUserFormDetialsState extends State { color: Colors.black, ), ), - if (isEditProfile) - IconButton( - icon: Icon( - Icons.edit, - color: Color(0xFF114D8B), - size: 14, - ), - onPressed: () { - setState(() { - isViewMode = !isViewMode; - }); - }) + // if (isEditProfile) + // IconButton( + // icon: Icon( + // Icons.edit, + // color: Color(0xFF114D8B), + // size: 14, + // ), + // onPressed: () { + // setState(() { + // isViewMode = !isViewMode; + // }); + // }) ], ), SizedBox( @@ -1115,8 +1114,9 @@ class _CreateUserFormDetialsState extends State { ), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), ), - onPressed: - isViewMode ? null : handleNext, // Disable when in view mode + onPressed: handleNext, + // onPressed: + // isViewMode ? null : handleNext, // Disable when in view mode child: Text("Next"), ), ) diff --git a/lib/Screens/userManagement/create_user/office_details.dart b/lib/Screens/userManagement/create_user/office_details.dart index 1cd3a01..c55e9d5 100644 --- a/lib/Screens/userManagement/create_user/office_details.dart +++ b/lib/Screens/userManagement/create_user/office_details.dart @@ -343,7 +343,8 @@ class _OfficeDetailsState extends State { child: SizedBox( height: 45, // Set appropriate height child: DropdownButtonFormField( - value: widget.isViewMode ? null : selectedDepartment, + value: selectedDepartment, + // value: widget.isViewMode ? null : selectedDepartment, style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), decoration: InputDecoration( border: InputBorder.none, diff --git a/lib/Screens/userManagement/create_user/personal_details.dart b/lib/Screens/userManagement/create_user/personal_details.dart index 48671b5..dc0bac0 100644 --- a/lib/Screens/userManagement/create_user/personal_details.dart +++ b/lib/Screens/userManagement/create_user/personal_details.dart @@ -280,7 +280,11 @@ class PersonalDetailsState extends State { try { final result = await apiService.fetchAllServices(); setState(() { - apiAllServices = result; + // apiAllServices = result; + setState(() { + apiAllServices = result + ..sort((a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0)); + }); }); print("Fetched services: $apiAllServices"); } catch (e) { @@ -418,14 +422,17 @@ class PersonalDetailsState extends State { height: 15, width: 15, decoration: BoxDecoration( - shape: BoxShape.circle, + shape: BoxShape.rectangle, border: Border.all( - color: isSelected ? Colors.green : Colors.grey, width: 1), + color: isSelected ? Colors.green : Colors.grey.shade400, + width: isSelected ? 2 : 1, + ), ), child: Icon( - Icons.check_circle, + Icons.check, size: 10, - color: isSelected ? Colors.green : Colors.grey, + + color: isSelected ? Colors.green : Colors.white10, // color: Colors.grey, )), ]), diff --git a/lib/routes/custom_appBar.dart b/lib/routes/custom_appBar.dart index 0cc3fc1..39e3a1a 100644 --- a/lib/routes/custom_appBar.dart +++ b/lib/routes/custom_appBar.dart @@ -374,7 +374,7 @@ class _CustomAppBarState extends State { extra: { "selectedUser": profileUserDetails, "isEditProfile": true, - "isViewMode": false, + "isViewMode": true, }, ); case '/logout': diff --git a/lib/widgets/custom_text_traveller.dart b/lib/widgets/custom_text_traveller.dart index e23e2cf..66eeace 100644 --- a/lib/widgets/custom_text_traveller.dart +++ b/lib/widgets/custom_text_traveller.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:responsive_builder/responsive_builder.dart'; class CustomTextField extends StatelessWidget { @@ -37,43 +38,51 @@ class CustomTextField extends StatelessWidget { controller: controller, keyboardType: keyboardType, cursorColor: Colors.blueAccent, - style: TextStyle(fontSize: 12.0), + style: GoogleFonts.poppins(fontSize: 12.0), decoration: InputDecoration( - hintStyle: TextStyle(color: Colors.grey), - floatingLabelStyle: TextStyle(color: Colors.blueAccent,), + hintStyle: GoogleFonts.poppins(color: Colors.grey), + floatingLabelStyle: GoogleFonts.poppins( + color: Colors.black, + ), floatingLabelBehavior: FloatingLabelBehavior.always, labelText: labelText, - contentPadding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), // Reduces inner padding - errorStyle: TextStyle(fontSize: 10, height: 0.8, color: Colors.red), + contentPadding: EdgeInsets.symmetric( + vertical: 8, horizontal: 12), // Reduces inner padding + errorStyle: GoogleFonts.poppins( + fontSize: 10, height: 0.8, color: Colors.red), border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.grey, width: 1), // Grey border + borderSide: + BorderSide(color: Colors.grey, width: 0.5), // Grey border ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.grey, width: 1), // Grey border when not focused + borderSide: BorderSide( + color: Colors.black54, + width: 0.2), // Grey border when not focused ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.blueAccent, width: 2), // Blue border when focused + borderSide: BorderSide( + color: Colors.grey, + width: 0.5), // Blue border when focused ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.grey, width: 1), // Same as normal + borderSide: BorderSide( + color: Colors.grey, width: 0.5), // Same as normal ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: Colors.blueAccent, width: 2), // Same as focused + borderSide: BorderSide( + color: Colors.grey, width: 0.5), // Same as focused ), ), validator: validator, - ), ), - ); - - }, + }, ); } } diff --git a/lib/widgets/popup_listPlan_action.dart b/lib/widgets/popup_listPlan_action.dart index ab8cc42..ecdde42 100644 --- a/lib/widgets/popup_listPlan_action.dart +++ b/lib/widgets/popup_listPlan_action.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../Screens/allTrips/remarks_list.dart'; import '../data/models/plan.dart'; import '../services/apiService.dart'; import 'custom_popup.dart'; @@ -9,12 +10,14 @@ class PlanPopupMenu extends StatelessWidget { final Plan plan; final Function(String planId) deletePlan; final ApiService apiService; + final Color? layoutColor; const PlanPopupMenu({ Key? key, required this.plan, required this.deletePlan, required this.apiService, + required this.layoutColor, }) : super(key: key); @override @@ -72,6 +75,22 @@ class PlanPopupMenu extends StatelessWidget { apiService.getPdfDownload(plan.planId); }, ), + IconButton( + icon: const Icon( + Icons.comment, + color: Color(0xFF475569), + size: 11, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) => CommentModalList( + // planId: plan.planId, + planId: plan.planId.toString(), + layoutColorForUser: layoutColor!, + role: "User"), + ); + }), ], ), ),