Plan Creation Bug

This commit is contained in:
venbaittech 2025-05-19 16:20:18 +05:30
parent b55b908f42
commit cafa8cbc95
14 changed files with 375 additions and 226 deletions

View File

@ -768,31 +768,32 @@ class _ListAllPlansState extends State<ListAllPlans> {
plan.planId); 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<ListAllPlans> {
plan: plan, plan: plan,
deletePlan: deletePlan, deletePlan: deletePlan,
apiService: apiService, 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"),
);
}),
], ],
), ),
], ],

View File

@ -819,6 +819,7 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
plan: plan, plan: plan,
deletePlan: deletePlan, deletePlan: deletePlan,
apiService: apiService, apiService: apiService,
layoutColor: layoutColor,
), ),
IconButton( IconButton(
icon: const Icon( icon: const Icon(

View File

@ -742,31 +742,33 @@ class _ApprovalListState extends State<ApprovalList> {
plan.planId); 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<ApprovalList> {
plan.planId); 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"),
);
}),
], ],
), ),

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:responsive_builder/responsive_builder.dart'; import 'package:responsive_builder/responsive_builder.dart';
@ -286,7 +287,8 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
mainAxisSize: mainAxisSize:
MainAxisSize.min, // Ensures content doesn't expand unnecessarily MainAxisSize.min, // Ensures content doesn't expand unnecessarily
children: [ children: [
Text("Please Select User", style: TextStyle(fontSize: 14)), Text("Please Select User",
style: GoogleFonts.poppins(fontSize: 14)),
SizedBox(height: 10), SizedBox(height: 10),
// Search Field // Search Field
@ -300,19 +302,21 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
? _filterUsersTravellers(query) ? _filterUsersTravellers(query)
: _filterUsers(query); : _filterUsers(query);
}, },
style: GoogleFonts.poppins(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(
hintText: "Search for a user", hintText: "Search for a user",
hintStyle: TextStyle(fontSize: 14), hintStyle:
GoogleFonts.poppins(fontSize: 14, color: Colors.grey),
prefixIcon: Icon(Icons.search), prefixIcon: Icon(Icons.search),
border: border:
OutlineInputBorder(borderRadius: BorderRadius.circular(8)), OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1), borderSide: BorderSide(color: Colors.grey.shade200, width: 1),
// borderSide: BorderSide(color: Color(0xFFF5F5F5), width: 2), // borderSide: BorderSide(color: Color(0xFFF5F5F5), width: 2),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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<UserSelectionDialog> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("or create a new traveler", Text("or create a new traveler",
style: TextStyle(fontSize: 14, color: Color(0xFF575A74))), style: GoogleFonts.poppins(
fontSize: 14, color: Color(0xFF575A74))),
TextButton( TextButton(
onPressed: () { onPressed: () {
setState(() { setState(() {
@ -333,7 +338,7 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
}); });
}, },
child: Text("Create", child: Text("Create",
style: TextStyle( style: GoogleFonts.poppins(
fontSize: 14, color: widget.layoutColorForUser)), fontSize: 14, color: widget.layoutColorForUser)),
), ),
], ],
@ -351,8 +356,8 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
? Center( ? Center(
child: Text( child: Text(
"No users found", "No users found",
style: style: GoogleFonts.poppins(
TextStyle(fontSize: 14, color: Colors.grey), fontSize: 14, color: Colors.grey),
), ),
) )
: ListView.builder( : ListView.builder(
@ -368,7 +373,9 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
return ListTile( return ListTile(
title: Text( title: Text(
"${user.firstName ?? "Unknown"} ${user.lastName ?? ""}"), "${user.firstName ?? "Unknown"} ${user.lastName ?? ""}",
style: GoogleFonts.poppins(fontSize: 11),
),
// subtitle: Text( // subtitle: Text(
// "ID: ${userType == "user" ? user.userId : user.travellerId}"), // "ID: ${userType == "user" ? user.userId : user.travellerId}"),
onTap: () { onTap: () {
@ -395,7 +402,7 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
if (_showTravellerForm) if (_showTravellerForm)
Container( Container(
height: 300, // Set a defined height height: 300, // Set a defined height
color: Color(0xFFF4F4FB), // color: Color(0xFFF4F4FB),
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TravelerForm( child: TravelerForm(
@ -435,6 +442,7 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
}, },
child: Text( child: Text(
"Cancel", "Cancel",
style: GoogleFonts.poppins(fontSize: 11),
), ),
), ),
SizedBox(width: 10), SizedBox(width: 10),
@ -456,7 +464,10 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
_searchController.text, userIdSelected, isTraveller); _searchController.text, userIdSelected, isTraveller);
Navigator.pop(context); Navigator.pop(context);
}, },
child: Text("Submit"), child: Text(
"Submit",
style: GoogleFonts.poppins(fontSize: 11),
),
), ),
], ],
), ),
@ -563,33 +574,37 @@ class _TravelerFormState extends State<TravelerForm> {
); );
if (response.statusCode == 200 || response.statusCode == 201) { if (response.statusCode == 200 || response.statusCode == 201) {
if (response.statusCode == 200 || response.statusCode == 201) { final Map<String, dynamic> responseData = jsonDecode(response.body);
final Map<String, dynamic> responseData = if (responseData.containsKey("data")) {
jsonDecode(response.body); // Parse response // Parse response
if (responseData["success"] == true &&
responseData.containsKey("data")) {
final travellerData = responseData["data"];
String travellerId = travellerData["traveller_id"]; print("responseData- $responseData ");
String firstName = travellerData["first_name"];
String lastName = travellerData["last_name"];
print( final travellerData = responseData["data"];
"Traveller Added: ID: $travellerId, Name: $firstName $lastName");
// Pass data to callback String travellerId = travellerData["traveller_id"];
widget.onSubmit("$firstName $lastName", travellerId, true); String firstName = travellerData["first_name"];
String lastName = travellerData["last_name"];
// Close the dialog print(
Navigator.pop(context); "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( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
"Traveller added successfully!", "Traveller added successfully!",
style: TextStyle(color: Colors.white), // Set text color style:
GoogleFonts.poppins(color: Colors.white), // Set text color
), ),
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
@ -643,12 +658,13 @@ class _TravelerFormState extends State<TravelerForm> {
onPressed: () { onPressed: () {
widget.formKey.currentState?.reset(); widget.formKey.currentState?.reset();
}, },
child: Text("Clear", style: TextStyle(color: Colors.grey)), child: Text("Clear",
style: GoogleFonts.poppins(color: Colors.grey)),
), ),
TextButton( TextButton(
onPressed: () => _onSubmit(context), onPressed: () => _onSubmit(context),
child: child: Text("Add",
Text("Add", style: TextStyle(color: Colors.blueAccent)), style: GoogleFonts.poppins(color: Colors.blueAccent)),
), ),
], ],
), ),

View File

@ -158,6 +158,13 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
_checkInController.text = DateFormat('yyyy-MM-dd').format(parsedDate); _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 // Check and set default times if empty
if (_checkInTimeController.text.isEmpty) { if (_checkInTimeController.text.isEmpty) {
_checkInTimeController.text = '14:00'; // 2 PM _checkInTimeController.text = '14:00'; // 2 PM

View File

@ -492,7 +492,7 @@ class _ForexScreenState extends State<ForexScreen> {
double.tryParse(textControllers["_telephone"]?.text ?? "0") ?? 0; double.tryParse(textControllers["_telephone"]?.text ?? "0") ?? 0;
double calclateVal = (transport + accommodation + telephone); double calclateVal = (transport + accommodation + telephone);
CalculatedOtherExpenses = (calclateVal).toStringAsFixed(2); CalculatedOtherExpenses = (calclateVal).toStringAsFixed(0);
// Convert selectedPerdiemAmount to double before performing the addition // Convert selectedPerdiemAmount to double before performing the addition
double perdiemAmount = double.tryParse(selectedPerdiemAmount ?? "0") ?? 0; double perdiemAmount = double.tryParse(selectedPerdiemAmount ?? "0") ?? 0;

View File

@ -474,6 +474,31 @@ class CreateNewPlansState extends State<CreateNewPlan> {
super.dispose(); 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() { void handleUpdateData() {
if (widget.selectedPlanData != null) { if (widget.selectedPlanData != null) {
setState(() { setState(() {
@ -641,10 +666,11 @@ class CreateNewPlansState extends State<CreateNewPlan> {
} }
void getSelectedPlanFor() { void getSelectedPlanFor() {
if (!mounted) return; // if (!mounted) return;
print("getSelectedPlanFor");
setState(() { setState(() {
if (selectedplanUserId != null) { if (selectedplanUserId != null) {
print("Is Not USER ID - $planUsrId ");
if (selectedIstravelUser!) { if (selectedIstravelUser!) {
planUsrId = ""; planUsrId = "";
planTravlrId = selectedplanUserId; planTravlrId = selectedplanUserId;
@ -653,8 +679,10 @@ class CreateNewPlansState extends State<CreateNewPlan> {
planTravlrId = ""; planTravlrId = "";
} }
} else { } else {
print("Is USER ID - $planUsrId ");
planUsrId = selfId; planUsrId = selfId;
planTravlrId = ""; planTravlrId = "";
_selectedOption = "Option 1";
} }
}); });
@ -676,8 +704,12 @@ class CreateNewPlansState extends State<CreateNewPlan> {
} }
orgId = await getOrgId(); orgId = await getOrgId();
print("userDetails - $selfId"); print("userDetails - $selfId");
// handleSelectedUser();
getSelectedPlanFor(); getSelectedPlanFor();
setTripPlanAction(); setTripPlanAction();
handleSelectedUser();
// handleUpdateData();
} }
Future<String?> getToken() async { Future<String?> getToken() async {
@ -1279,52 +1311,53 @@ class CreateNewPlansState extends State<CreateNewPlan> {
color: Color(0xFF575A74)), color: Color(0xFF575A74)),
), ),
SizedBox(height: 6), SizedBox(height: 6),
isMobile isDesktop
? SingleChildScrollView( ? SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
children: _buildPlanTrip(isMobile), children: _buildPlanTrip(isDesktop),
), ),
) )
: Row( : Row(
children: _buildPlanTrip(isMobile), children: _buildPlanTrip(isDesktop),
), ),
SizedBox(height: 7), SizedBox(height: 7),
Text( // Text(
otherUserName ?? userName ?? " ", // Your label // otherUserName ?? userName ?? " ", // Your label
//
style: GoogleFonts.poppins( // style: GoogleFonts.poppins(
fontSize: 12, // fontSize: 11,
fontWeight: FontWeight.w400, // fontWeight: FontWeight.w400,
color: widget.layoutColor, // 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.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<CreateNewPlan> {
color: Color(0xFF575A74)), color: Color(0xFF575A74)),
), ),
SizedBox(height: 5), SizedBox(height: 5),
CustomTextFieldWrapper( CustomTextFieldWrapper(
isFocused: false, isFocused: false,
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
@ -1513,8 +1547,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
dropdownDecoratorProps: const DropDownDecoratorProps( dropdownDecoratorProps: const DropDownDecoratorProps(
dropdownSearchDecoration: InputDecoration( dropdownSearchDecoration: InputDecoration(
border: InputBorder.none, // No underline border: InputBorder.none, // No underline
contentPadding: contentPadding:
EdgeInsets.symmetric(horizontal: 1, vertical: 5), EdgeInsets.symmetric(horizontal: 10, vertical: 5),
), ),
), ),
dropdownBuilder: (context, selectedItem) { dropdownBuilder: (context, selectedItem) {
@ -2205,6 +2240,75 @@ class CreateNewPlansState extends State<CreateNewPlan> {
{"title": "Others", "value": "Option 3"}, {"title": "Others", "value": "Option 3"},
]; ];
return [
CustomTextFieldWrapper(
isFocused: false,
isDesktop: isDesktop,
layoutColor: widget.layoutColor,
child: SizedBox(
height: 35,
width: double.infinity,
child: DropdownSearch<String>(
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<Widget> _buildPlanTrip1(bool isDesktop) {
List<Map<String, String>> options = [
{"title": "Self", "value": "Option 1"},
{"title": "Other Employee", "value": "Option 2"},
{"title": "Others", "value": "Option 3"},
];
print(" layoutColor: ${widget.layoutColor}"); print(" layoutColor: ${widget.layoutColor}");
return options.map((option) { return options.map((option) {
return Padding( return Padding(
@ -2502,7 +2606,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
// ), // ),
// ), // ),
CustomTextFieldWrapper( CustomTextFieldWrapper(
isFocused: _isdescriptionFocused, isFocused: false,
// isFocused: _isdescriptionFocused,
// width: isDesktop // width: isDesktop
// ? MediaQuery.of(context).size.width * 0.38 // ? MediaQuery.of(context).size.width * 0.38
// : MediaQuery.of(context).size.width * 0.85, // : MediaQuery.of(context).size.width * 0.85,
@ -2604,7 +2709,7 @@ class CreateNewPlansState extends State<CreateNewPlan> {
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Trip Name *", labelText: "Trip Name *",
labelStyle: GoogleFonts.poppins(fontSize: 14, color: Colors.grey), labelStyle: GoogleFonts.poppins(fontSize: 14, color: Colors.black54),
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
border: InputBorder.none, border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(vertical: 16), contentPadding: EdgeInsets.symmetric(vertical: 16),
@ -3108,7 +3213,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
getSelectedPlanFor(); getSelectedPlanFor();
}, },
onClose: () { onClose: () {
getSelectedPlanFor(); print("Choosede Clsoes");
fetchUserDetails();
}, },
layoutColorForUser: widget.layoutColor!, layoutColorForUser: widget.layoutColor!,
); );

View File

@ -48,11 +48,24 @@ class _ListPlansState extends State<ListPlans> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
super.initState();
// futurePlans = fetchPlans();
//
// futurePlans.then((plans) {
// setState(() {
// allPlans = plans;
// filteredPlans = plans;
// });
// });
getToken(); getToken();
initializeData();
loadInitialData();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
initializeData(); // initializeData();
loadInitialData(); // loadInitialData();
// futurePlans.then((plans) { // futurePlans.then((plans) {
// setState(() { // setState(() {
@ -813,31 +826,32 @@ class _ListPlansState extends State<ListPlans> {
plan.planId); 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<ListPlans> {
plan: plan, plan: plan,
deletePlan: deletePlan, deletePlan: deletePlan,
apiService: apiService, 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"),
);
}),
], ],
), ),

View File

@ -847,7 +847,6 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: (selectedTab == "travel" || children: (selectedTab == "travel" ||
selectedRole == "5" || selectedRole == "5" ||
isEditProfile ||
setSelectesUserType == true) setSelectesUserType == true)
? _buildSubmit(isDesktop, layoutColor!) ? _buildSubmit(isDesktop, layoutColor!)
: _buildNext(isDesktop, layoutColor!), : _buildNext(isDesktop, layoutColor!),
@ -885,18 +884,18 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
color: Colors.black, color: Colors.black,
), ),
), ),
if (isEditProfile) // if (isEditProfile)
IconButton( // IconButton(
icon: Icon( // icon: Icon(
Icons.edit, // Icons.edit,
color: Color(0xFF114D8B), // color: Color(0xFF114D8B),
size: 14, // size: 14,
), // ),
onPressed: () { // onPressed: () {
setState(() { // setState(() {
isViewMode = !isViewMode; // isViewMode = !isViewMode;
}); // });
}) // })
], ],
), ),
SizedBox( SizedBox(
@ -1115,8 +1114,9 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
), ),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
), ),
onPressed: onPressed: handleNext,
isViewMode ? null : handleNext, // Disable when in view mode // onPressed:
// isViewMode ? null : handleNext, // Disable when in view mode
child: Text("Next"), child: Text("Next"),
), ),
) )

View File

@ -343,7 +343,8 @@ class _OfficeDetailsState extends State<OfficeDetails> {
child: SizedBox( child: SizedBox(
height: 45, // Set appropriate height height: 45, // Set appropriate height
child: DropdownButtonFormField<String>( child: DropdownButtonFormField<String>(
value: widget.isViewMode ? null : selectedDepartment, value: selectedDepartment,
// value: widget.isViewMode ? null : selectedDepartment,
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), style: GoogleFonts.poppins(fontSize: 12, color: Colors.black),
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,

View File

@ -280,7 +280,11 @@ class PersonalDetailsState extends State<PersonalDetails> {
try { try {
final result = await apiService.fetchAllServices(); final result = await apiService.fetchAllServices();
setState(() { setState(() {
apiAllServices = result; // apiAllServices = result;
setState(() {
apiAllServices = result
..sort((a, b) => (a['order'] ?? 0).compareTo(b['order'] ?? 0));
});
}); });
print("Fetched services: $apiAllServices"); print("Fetched services: $apiAllServices");
} catch (e) { } catch (e) {
@ -418,14 +422,17 @@ class PersonalDetailsState extends State<PersonalDetails> {
height: 15, height: 15,
width: 15, width: 15,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.rectangle,
border: Border.all( border: Border.all(
color: isSelected ? Colors.green : Colors.grey, width: 1), color: isSelected ? Colors.green : Colors.grey.shade400,
width: isSelected ? 2 : 1,
),
), ),
child: Icon( child: Icon(
Icons.check_circle, Icons.check,
size: 10, size: 10,
color: isSelected ? Colors.green : Colors.grey,
color: isSelected ? Colors.green : Colors.white10,
// color: Colors.grey, // color: Colors.grey,
)), )),
]), ]),

View File

@ -374,7 +374,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
extra: { extra: {
"selectedUser": profileUserDetails, "selectedUser": profileUserDetails,
"isEditProfile": true, "isEditProfile": true,
"isViewMode": false, "isViewMode": true,
}, },
); );
case '/logout': case '/logout':

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:responsive_builder/responsive_builder.dart'; import 'package:responsive_builder/responsive_builder.dart';
class CustomTextField extends StatelessWidget { class CustomTextField extends StatelessWidget {
@ -37,43 +38,51 @@ class CustomTextField extends StatelessWidget {
controller: controller, controller: controller,
keyboardType: keyboardType, keyboardType: keyboardType,
cursorColor: Colors.blueAccent, cursorColor: Colors.blueAccent,
style: TextStyle(fontSize: 12.0), style: GoogleFonts.poppins(fontSize: 12.0),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.grey), hintStyle: GoogleFonts.poppins(color: Colors.grey),
floatingLabelStyle: TextStyle(color: Colors.blueAccent,), floatingLabelStyle: GoogleFonts.poppins(
color: Colors.black,
),
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: labelText, labelText: labelText,
contentPadding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), // Reduces inner padding contentPadding: EdgeInsets.symmetric(
errorStyle: TextStyle(fontSize: 10, height: 0.8, color: Colors.red), vertical: 8, horizontal: 12), // Reduces inner padding
errorStyle: GoogleFonts.poppins(
fontSize: 10, height: 0.8, color: Colors.red),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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( errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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( focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8), 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, validator: validator,
), ),
), ),
); );
},
},
); );
} }
} }

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../Screens/allTrips/remarks_list.dart';
import '../data/models/plan.dart'; import '../data/models/plan.dart';
import '../services/apiService.dart'; import '../services/apiService.dart';
import 'custom_popup.dart'; import 'custom_popup.dart';
@ -9,12 +10,14 @@ class PlanPopupMenu extends StatelessWidget {
final Plan plan; final Plan plan;
final Function(String planId) deletePlan; final Function(String planId) deletePlan;
final ApiService apiService; final ApiService apiService;
final Color? layoutColor;
const PlanPopupMenu({ const PlanPopupMenu({
Key? key, Key? key,
required this.plan, required this.plan,
required this.deletePlan, required this.deletePlan,
required this.apiService, required this.apiService,
required this.layoutColor,
}) : super(key: key); }) : super(key: key);
@override @override
@ -72,6 +75,22 @@ class PlanPopupMenu extends StatelessWidget {
apiService.getPdfDownload(plan.planId); 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"),
);
}),
], ],
), ),
), ),