Plan Creation Bug
This commit is contained in:
parent
b55b908f42
commit
cafa8cbc95
@ -768,31 +768,32 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
||||
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,
|
||||
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"),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -819,6 +819,7 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
||||
plan: plan,
|
||||
deletePlan: deletePlan,
|
||||
apiService: apiService,
|
||||
layoutColor: layoutColor,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
|
||||
@ -742,31 +742,33 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
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);
|
||||
},
|
||||
),
|
||||
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"),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
@ -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<UserSelectionDialog> {
|
||||
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<UserSelectionDialog> {
|
||||
? _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<UserSelectionDialog> {
|
||||
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<UserSelectionDialog> {
|
||||
});
|
||||
},
|
||||
child: Text("Create",
|
||||
style: TextStyle(
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14, color: widget.layoutColorForUser)),
|
||||
),
|
||||
],
|
||||
@ -351,8 +356,8 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
|
||||
? 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<UserSelectionDialog> {
|
||||
|
||||
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<UserSelectionDialog> {
|
||||
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<UserSelectionDialog> {
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: GoogleFonts.poppins(fontSize: 11),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
@ -456,7 +464,10 @@ class _UserSelectionDialogState extends State<UserSelectionDialog> {
|
||||
_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<TravelerForm> {
|
||||
);
|
||||
|
||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||
final Map<String, dynamic> responseData =
|
||||
jsonDecode(response.body); // Parse response
|
||||
if (responseData["success"] == true &&
|
||||
responseData.containsKey("data")) {
|
||||
final travellerData = responseData["data"];
|
||||
final Map<String, dynamic> 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<TravelerForm> {
|
||||
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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -158,6 +158,13 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
||||
_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
|
||||
|
||||
@ -492,7 +492,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
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;
|
||||
|
||||
@ -474,6 +474,31 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
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<CreateNewPlan> {
|
||||
}
|
||||
|
||||
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<CreateNewPlan> {
|
||||
planTravlrId = "";
|
||||
}
|
||||
} else {
|
||||
print("Is USER ID - $planUsrId ");
|
||||
planUsrId = selfId;
|
||||
planTravlrId = "";
|
||||
_selectedOption = "Option 1";
|
||||
}
|
||||
});
|
||||
|
||||
@ -676,8 +704,12 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
}
|
||||
orgId = await getOrgId();
|
||||
print("userDetails - $selfId");
|
||||
// handleSelectedUser();
|
||||
getSelectedPlanFor();
|
||||
setTripPlanAction();
|
||||
|
||||
handleSelectedUser();
|
||||
// handleUpdateData();
|
||||
}
|
||||
|
||||
Future<String?> getToken() async {
|
||||
@ -1279,52 +1311,53 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
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<CreateNewPlan> {
|
||||
color: Color(0xFF575A74)),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
@ -1513,8 +1547,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
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<CreateNewPlan> {
|
||||
{"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}");
|
||||
return options.map((option) {
|
||||
return Padding(
|
||||
@ -2502,7 +2606,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
||||
// ),
|
||||
// ),
|
||||
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<CreateNewPlan> {
|
||||
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<CreateNewPlan> {
|
||||
getSelectedPlanFor();
|
||||
},
|
||||
onClose: () {
|
||||
getSelectedPlanFor();
|
||||
print("Choosede Clsoes");
|
||||
fetchUserDetails();
|
||||
},
|
||||
layoutColorForUser: widget.layoutColor!,
|
||||
);
|
||||
|
||||
@ -48,11 +48,24 @@ class _ListPlansState extends State<ListPlans> {
|
||||
@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<ListPlans> {
|
||||
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,
|
||||
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"),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
@ -847,7 +847,6 @@ class _CreateUserFormDetialsState extends State<CreateUserFormDetials> {
|
||||
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<CreateUserFormDetials> {
|
||||
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<CreateUserFormDetials> {
|
||||
),
|
||||
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"),
|
||||
),
|
||||
)
|
||||
|
||||
@ -343,7 +343,8 @@ class _OfficeDetailsState extends State<OfficeDetails> {
|
||||
child: SizedBox(
|
||||
height: 45, // Set appropriate height
|
||||
child: DropdownButtonFormField<String>(
|
||||
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,
|
||||
|
||||
@ -280,7 +280,11 @@ class PersonalDetailsState extends State<PersonalDetails> {
|
||||
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<PersonalDetails> {
|
||||
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,
|
||||
)),
|
||||
]),
|
||||
|
||||
@ -374,7 +374,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
extra: {
|
||||
"selectedUser": profileUserDetails,
|
||||
"isEditProfile": true,
|
||||
"isViewMode": false,
|
||||
"isViewMode": true,
|
||||
},
|
||||
);
|
||||
case '/logout':
|
||||
|
||||
@ -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,
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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"),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user