ticket flow added merge
This commit is contained in:
commit
fb37bd257f
@ -131,10 +131,13 @@ class MyApp extends StatelessWidget {
|
||||
'profile': (context) => profile(),
|
||||
'wellness': (context) => wellness(),
|
||||
'planclaimsform': (context) => planclaimsform(),
|
||||
'claimtracklist': (context) => claimtracklist(),
|
||||
'claimtracklist': (context) => claimtracklist(
|
||||
ticketID: "",
|
||||
),
|
||||
'privacypolicy': (context) => privacypolicy(),
|
||||
'termsofuse': (context) => termsofuse(),
|
||||
'generalExclusionsDeductibles': (context) => generalExclusionsDeductibles(),
|
||||
'generalExclusionsDeductibles': (context) =>
|
||||
generalExclusionsDeductibles(),
|
||||
// 'home': (context) => kIsWeb ? Home() : BotmanScaffold(currentRoute: 'home', child: Home()),
|
||||
// 'policies': (context) => kIsWeb ? policies() : BotmanScaffold(currentRoute: 'policies', child: policies()),
|
||||
// 'claims': (context) => kIsWeb ? claims() : BotmanScaffold(currentRoute: 'claims', child: claims()),
|
||||
@ -215,4 +218,3 @@ class SplashScreen extends StatelessWidget {
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@ -15,7 +15,8 @@ import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
|
||||
class claimtracklist extends StatefulWidget {
|
||||
const claimtracklist({Key? key}) : super(key: key);
|
||||
final String ticketID;
|
||||
const claimtracklist({Key? key, required this.ticketID}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<claimtracklist> createState() => _claimtracklistformState();
|
||||
@ -23,6 +24,7 @@ class claimtracklist extends StatefulWidget {
|
||||
|
||||
class _claimtracklistformState extends State<claimtracklist> {
|
||||
late ApiService apiService;
|
||||
late String ticketID;
|
||||
dynamic _token;
|
||||
bool isLoading = false;
|
||||
dynamic empCodeString;
|
||||
@ -32,9 +34,12 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
dynamic policyDataIsEmpty = 1;
|
||||
dynamic policyHeading;
|
||||
dynamic policyName;
|
||||
dynamic policyType;
|
||||
dynamic policyTickID;
|
||||
dynamic policyDate;
|
||||
dynamic policyStatus;
|
||||
dynamic policySubject;
|
||||
dynamic policyMessage;
|
||||
dynamic policyNo;
|
||||
dynamic hospitalName;
|
||||
dynamic admitDate;
|
||||
@ -47,9 +52,13 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
List<Map<String, String>> employeeDetails = [];
|
||||
dynamic argumentsData;
|
||||
dynamic decodedToken;
|
||||
dynamic claimTrackMsgList;
|
||||
// dynamic claimTrackMsgList;
|
||||
List<dynamic> claimTrackMsgList = [];
|
||||
|
||||
dynamic claimTrackMasterList;
|
||||
dynamic claimTrackList;
|
||||
dynamic empName;
|
||||
dynamic ticketID;
|
||||
// dynamic ticketID;
|
||||
late TextEditingController messageController;
|
||||
final Map<String, Color> statusColors = {
|
||||
'Open': Colors.green,
|
||||
@ -65,8 +74,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
ticketID = widget.ticketID;
|
||||
print('ticketID: $ticketID');
|
||||
apiService = ApiService(context); // Initialize ApiService here
|
||||
_loadToken();
|
||||
|
||||
messageController = TextEditingController();
|
||||
}
|
||||
|
||||
@ -77,33 +89,15 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
||||
if (arguments != null && arguments is Map<String, dynamic>) {
|
||||
argumentsData = arguments;
|
||||
print('argumentsData');
|
||||
print(argumentsData);
|
||||
ticketID = argumentsData['id'];
|
||||
claimTrackMsgList = argumentsData['message_list'];
|
||||
departmentID = argumentsData['department_id'];
|
||||
policyName = argumentsData['policy_name'];
|
||||
policyStatus = argumentsData['status_value'];
|
||||
policyNo = argumentsData['policy_no'];
|
||||
policySubject = argumentsData['subject'];
|
||||
policyDate = formatDateWithTime(argumentsData['date']);
|
||||
claimAmount = argumentsData['claim_amount'];
|
||||
member = argumentsData['member_name'];
|
||||
if (departmentID == '3') {
|
||||
accidentDate = argumentsData['accident_date'];
|
||||
} else if (departmentID == '4') {
|
||||
hospitalName = argumentsData['hospital_name'];
|
||||
admitDate = argumentsData['admit_date'];
|
||||
dischargeDate = argumentsData['discharge_date'];
|
||||
}
|
||||
print(claimTrackMsgList);
|
||||
}
|
||||
}
|
||||
// void didChangeDependencies() {
|
||||
// super.didChangeDependencies();
|
||||
// print('ticket');
|
||||
// dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
||||
// if (arguments != null && arguments is int) {
|
||||
// ticketID = arguments;
|
||||
// print('ticketID: $ticketID');
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
print('_loadToken');
|
||||
@ -118,10 +112,12 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
print(decodedToken);
|
||||
empName = decodedToken['name'];
|
||||
empCodeString = prefs.getString('empCode');
|
||||
print(empCodeString); // Check if emp_code is correct
|
||||
print('empCodeString - $empCodeString'); // Check if emp_code is correct
|
||||
empPrimaryId = prefs.getString('empPrimaryId');
|
||||
print('empPrimaryId- $empPrimaryId');
|
||||
client_id = prefs.getString('client_id');
|
||||
print(client_id);
|
||||
print('client_id- $client_id');
|
||||
getTicketConvoList();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
@ -135,18 +131,20 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
isLoading = true;
|
||||
});
|
||||
try {
|
||||
print("FORMDATA - $formData");
|
||||
formData = formData.map((key, value) => MapEntry(key, value.toString()));
|
||||
|
||||
print("FORMDATA1 - $formData");
|
||||
final response = await apiService.sendClaimsMessageToApi(formData);
|
||||
|
||||
if (response['success'] == 1) {
|
||||
print("REs - $response");
|
||||
if (response['status'] == 'success') {
|
||||
messageController.clear();
|
||||
ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
||||
// ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
||||
messageController.clear();
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
Navigator.pushNamed(context, 'claims', arguments: 0);
|
||||
// Navigator.pushNamed(context, 'claims', arguments: 0);
|
||||
getTicketConvoList();
|
||||
print('Form data sent successfully.');
|
||||
} else {
|
||||
print('Failed to submit form data: ${response['status']}');
|
||||
@ -164,6 +162,72 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getTicketConvoList() async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
|
||||
try {
|
||||
print('check getTicketList 1');
|
||||
final response = await apiService.getTicketConverList(ticketID);
|
||||
print('check getTicketList 2');
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
// if (response['success'] == true && response['data'] is List) {
|
||||
setState(() {
|
||||
claimTrackList = response['data'];
|
||||
print("TCtt1 - $claimTrackList");
|
||||
claimTrackMasterList = response['data']['master'];
|
||||
print("TCtt2 - $claimTrackMasterList");
|
||||
claimTrackMsgList = response['data']['notes'];
|
||||
print("TCtt3 - $claimTrackMsgList");
|
||||
|
||||
if (claimTrackMasterList != []) {
|
||||
print("ClaimLST - ");
|
||||
print(claimTrackMasterList[0]['thz_id']);
|
||||
policyTickID = claimTrackMasterList[0]['thz_id'];
|
||||
policyName = claimTrackMasterList[0]['policy_no'];
|
||||
policyType = claimTrackMasterList[0]['ticket_type'];
|
||||
policyStatus = claimTrackMasterList[0]['status'];
|
||||
member = claimTrackMasterList[0]['assignee_name'];
|
||||
policySubject = claimTrackMasterList[0]['subject'];
|
||||
policyMessage = claimTrackMasterList[0]['message'];
|
||||
// print("ClaimLST - ${claimTrackMasterList['thz_id'].toString()}");
|
||||
}
|
||||
// reversedTicketList = List<Map<String, dynamic>>.from(ticketList);
|
||||
// print("TC2 - $ticketList");
|
||||
// ticketList = reversedTicketList.reversed.toList();
|
||||
// print("TC3 - $ticketList");
|
||||
});
|
||||
// }
|
||||
// else if (response['status'] == "error" &&
|
||||
// response['message'] == "No tickets found") {
|
||||
// setState(() {
|
||||
// ticketList = [];
|
||||
// trackClaimsList = [];
|
||||
// trackClaimsClosedList = [];
|
||||
// });
|
||||
// ToastHelper.showErrorToast(context, 'No tickets found');
|
||||
// } else {
|
||||
// setState(() {
|
||||
// isLoading = false;
|
||||
// });
|
||||
// ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||
// print('API request failed with status: ${response['status']}');
|
||||
// }
|
||||
} catch (e) {
|
||||
// ToastHelper.showErrorToast(context, 'Failed to load data');
|
||||
print('Error in getTicketList: $e');
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -289,210 +353,314 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
: buildMobileLayout(context)
|
||||
],
|
||||
), // Space between rows
|
||||
// Add more rows as needed
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Color(
|
||||
// 0xFFFFFCE5), // Set background color for the container
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// 10), // Set border radius for the container
|
||||
// ),
|
||||
// padding: Responsive.isDesktop(context)
|
||||
// ? EdgeInsets.only(
|
||||
// top: 20,
|
||||
// bottom: 20,
|
||||
// left: 10,
|
||||
// right: 10)
|
||||
// : EdgeInsets.only(
|
||||
// top: 10,
|
||||
// bottom: 10,
|
||||
// left: 10,
|
||||
// right: 10),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Row(
|
||||
// children: [
|
||||
// buildExpandedColumn(context,
|
||||
// 'Subject', policySubject),
|
||||
// ],
|
||||
// ),
|
||||
//
|
||||
// SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// buildExpandedColumn(context,
|
||||
// 'Message', policyMessage),
|
||||
// ],
|
||||
// ),
|
||||
// // Add more rows as needed
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 15),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Color(
|
||||
// 0xFFFFFCE5), // Set background color for the container
|
||||
borderRadius: BorderRadius.circular(
|
||||
10), // Set border radius for the container
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
...claimTrackMsgList
|
||||
.map<Widget>((message) {
|
||||
bool isUserMessage =
|
||||
message['staff_name'] == null;
|
||||
String messageContent =
|
||||
message['message'];
|
||||
String messageDate = message['date'];
|
||||
dynamic messagername;
|
||||
if (isUserMessage) {
|
||||
messagername = empName;
|
||||
} else {
|
||||
messagername = message['staff_name'];
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4.0),
|
||||
child: Align(
|
||||
alignment: isUserMessage
|
||||
? Alignment.centerLeft
|
||||
: Alignment.centerLeft,
|
||||
child: Container(
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: 800),
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isUserMessage
|
||||
? Colors.blue[100]
|
||||
: Colors.green[100],
|
||||
borderRadius:
|
||||
BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
messageContent,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(
|
||||
context)
|
||||
? 14
|
||||
: 12,
|
||||
fontWeight:
|
||||
FontWeight.w400,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Color(
|
||||
0xFFE26728),
|
||||
size: 15,
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
messagername,
|
||||
style: GoogleFonts
|
||||
.poppins(
|
||||
fontSize: Responsive
|
||||
.isDesktop(
|
||||
context)
|
||||
? 16
|
||||
: 14,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w500,
|
||||
color: Color(
|
||||
0xFF000000),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
formatDateWithTime(
|
||||
messageDate),
|
||||
style:
|
||||
GoogleFonts.poppins(
|
||||
fontSize: Responsive
|
||||
.isDesktop(
|
||||
context)
|
||||
? 12
|
||||
: 10,
|
||||
fontWeight:
|
||||
FontWeight.w400,
|
||||
color:
|
||||
Color(0xFF636363),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4.0, horizontal: 4.0),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"Conversation",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(
|
||||
context)
|
||||
? 18
|
||||
: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(
|
||||
context)
|
||||
? 10
|
||||
: 9,
|
||||
child: TextFormField(
|
||||
controller: messageController,
|
||||
onChanged: (value) => null,
|
||||
decoration: InputDecoration(
|
||||
border:
|
||||
OutlineInputBorder(),
|
||||
hintText: 'Message',
|
||||
labelText: 'Message',
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
horizontal: 15),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null ||
|
||||
value.isEmpty) {
|
||||
return 'Message is required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(
|
||||
context)
|
||||
? 2
|
||||
: 3,
|
||||
child: Container(
|
||||
alignment:
|
||||
Alignment.centerRight,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Check if any of the fields are empty
|
||||
if (messageController
|
||||
.text.isEmpty) {
|
||||
ToastHelper
|
||||
.showWarningToast(
|
||||
context,
|
||||
'All fields are required');
|
||||
} else {
|
||||
// Create a map to hold the form data
|
||||
Map<String, dynamic>
|
||||
formData = {
|
||||
'ticket_id': ticketID,
|
||||
'replier': 'user',
|
||||
'message':
|
||||
messageController
|
||||
.text,
|
||||
// Add more form fields as needed
|
||||
};
|
||||
...claimTrackMsgList
|
||||
.map<Widget>((message) {
|
||||
bool isUserMessage;
|
||||
// bool isUserMessage =
|
||||
// message['notes_by'] == null;
|
||||
String messageContent =
|
||||
message['notes'];
|
||||
String messageDate =
|
||||
message['created_at'];
|
||||
dynamic messagername;
|
||||
messagername =
|
||||
message['notes_by'];
|
||||
// if (isUserMessage) {
|
||||
// messagername = empName;
|
||||
// } else {
|
||||
// messagername = message['staff_name'];
|
||||
// }
|
||||
|
||||
// Call the function to send form data to API
|
||||
sendClaimsMessage(
|
||||
formData);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Reply',
|
||||
style:
|
||||
GoogleFonts.poppins(
|
||||
color:
|
||||
Colors.white),
|
||||
if (messagername == "Staff") {
|
||||
isUserMessage = true;
|
||||
} else {
|
||||
isUserMessage = false;
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 4.0,
|
||||
horizontal: 4.0),
|
||||
child: Align(
|
||||
alignment: isUserMessage
|
||||
? Alignment.centerLeft
|
||||
: Alignment.centerLeft,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 800),
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isUserMessage
|
||||
? Colors.blue[100]
|
||||
: Colors.green[100],
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
10),
|
||||
),
|
||||
style: ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
Color(0xFFE26728),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(5),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Text(
|
||||
messageContent,
|
||||
style: GoogleFonts
|
||||
.poppins(
|
||||
fontSize: Responsive
|
||||
.isDesktop(
|
||||
context)
|
||||
? 14
|
||||
: 12,
|
||||
fontWeight:
|
||||
FontWeight.w400,
|
||||
color: Color(
|
||||
0xFF000000),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Color(
|
||||
0xFFE26728),
|
||||
size: 15,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5),
|
||||
Text(
|
||||
messagername,
|
||||
style: GoogleFonts
|
||||
.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(context)
|
||||
? 16
|
||||
: 14,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w500,
|
||||
color: Color(
|
||||
0xFF000000),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
// formatDateWithTime(
|
||||
// messageDate),
|
||||
|
||||
formatDateWithTime(
|
||||
messageDate),
|
||||
style: GoogleFonts
|
||||
.poppins(
|
||||
fontSize: Responsive
|
||||
.isDesktop(
|
||||
context)
|
||||
? 12
|
||||
: 10,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w400,
|
||||
color: Color(
|
||||
0xFF636363),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Divider(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex:
|
||||
Responsive.isDesktop(
|
||||
context)
|
||||
? 10
|
||||
: 9,
|
||||
child: TextFormField(
|
||||
controller:
|
||||
messageController,
|
||||
onChanged: (value) =>
|
||||
null,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
border:
|
||||
OutlineInputBorder(),
|
||||
hintText: 'Message',
|
||||
labelText: 'Message',
|
||||
contentPadding:
|
||||
EdgeInsets
|
||||
.symmetric(
|
||||
vertical:
|
||||
10,
|
||||
horizontal:
|
||||
15),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null ||
|
||||
value.isEmpty) {
|
||||
return 'Message is required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
]),
|
||||
Expanded(
|
||||
flex:
|
||||
Responsive.isDesktop(
|
||||
context)
|
||||
? 2
|
||||
: 3,
|
||||
child: Container(
|
||||
alignment: Alignment
|
||||
.centerRight,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Check if any of the fields are empty
|
||||
if (messageController
|
||||
.text.isEmpty) {
|
||||
ToastHelper
|
||||
.showWarningToast(
|
||||
context,
|
||||
'All fields are required');
|
||||
} else {
|
||||
// Create a map to hold the form data
|
||||
Map<String,
|
||||
dynamic>
|
||||
formData = {
|
||||
'thz_id':
|
||||
ticketID,
|
||||
'notes':
|
||||
messageController
|
||||
.text,
|
||||
'notes_by':
|
||||
'User',
|
||||
// Add more form fields as needed
|
||||
};
|
||||
|
||||
// Call the function to send form data to API
|
||||
sendClaimsMessage(
|
||||
formData);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Reply',
|
||||
style: GoogleFonts
|
||||
.poppins(
|
||||
color: Colors
|
||||
.white),
|
||||
),
|
||||
style: ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
Color(
|
||||
0xFFE26728),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
5),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -570,14 +738,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
}
|
||||
|
||||
String formatDateWithTime(String timestamp) {
|
||||
// Convert the timestamp string to milliseconds
|
||||
int milliseconds = int.parse(timestamp) * 1000;
|
||||
// Parse the input string to DateTime
|
||||
DateTime date = DateFormat("yyyy-MM-dd HH:mm:ss").parse(timestamp);
|
||||
|
||||
// Create a DateTime object from milliseconds
|
||||
DateTime date = DateTime.fromMillisecondsSinceEpoch(milliseconds);
|
||||
|
||||
// Format the DateTime object with date and time
|
||||
String formattedDate = DateFormat('d MMM, y HH:mm a').format(date);
|
||||
// Format to your desired output
|
||||
String formattedDate = DateFormat("dd, MMM yy h:mm a").format(date);
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
@ -588,10 +753,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// buildExpandedColumn(context, 'Policy No', policyNo),
|
||||
buildExpandedColumn(context, 'Policy No', policyTickID),
|
||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||
buildExpandedColumn(context, 'Ticket Type', policyType),
|
||||
buildExpandedColumn(context, 'Status', policyStatus),
|
||||
buildExpandedColumn(context, 'Subject', policySubject),
|
||||
buildExpandedColumn(context, 'Assign To', member),
|
||||
],
|
||||
),
|
||||
if (departmentID == '4') // Conditional check for policy_type
|
||||
@ -642,8 +808,16 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Policy No', policyTickID),
|
||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Status', policyStatus),
|
||||
buildExpandedColumn(context, 'Ticket Type', policyType),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
@ -651,7 +825,7 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Subject', policySubject),
|
||||
buildExpandedColumn(context, 'Member', member),
|
||||
buildExpandedColumn(context, 'Assigned To', member),
|
||||
],
|
||||
),
|
||||
if (departmentID == '4')
|
||||
@ -699,10 +873,10 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
return Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
// alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
@ -738,4 +912,43 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildExpandedRow(BuildContext context, String title, String? value) {
|
||||
return Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Text(
|
||||
title,
|
||||
// textAlign: TextAlign.center,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(context) ? 18 : 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: Responsive.isDesktop(context) ? 10 : 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
value ?? '', // Null check for value
|
||||
// textAlign: TextAlign.center,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(context) ? 18 : 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import 'claimtracklist.dart';
|
||||
|
||||
class help extends StatefulWidget {
|
||||
const help({Key? key}) : super(key: key);
|
||||
@ -32,6 +33,7 @@ class _helpState extends State<help> {
|
||||
int closedTrackActive = 1;
|
||||
int allClaimsActive = 0;
|
||||
bool _isArgsHandled = false;
|
||||
int ticketsActive = 1;
|
||||
dynamic _token;
|
||||
dynamic empCodeString;
|
||||
dynamic empPrimaryId;
|
||||
@ -50,6 +52,8 @@ class _helpState extends State<help> {
|
||||
dynamic empMobileNo;
|
||||
List<dynamic> reversedClaimsList = [];
|
||||
List<dynamic> trackClaimsList = [];
|
||||
List<dynamic> ticketList = [];
|
||||
List<dynamic> reversedTicketList = [];
|
||||
List<dynamic> reversedClaimsClosedList = [];
|
||||
List<dynamic> trackClaimsClosedList = [];
|
||||
final Map<String, Color> statusColors = {
|
||||
@ -191,6 +195,58 @@ class _helpState extends State<help> {
|
||||
// }
|
||||
}
|
||||
|
||||
Future<void> getTicketList() async {
|
||||
if (client_id == null || empCodeString == null) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
|
||||
try {
|
||||
print('check getTicketList 1');
|
||||
final response = await apiService.getTicketListByMobile(empMobileNo!);
|
||||
print('check getTicketList 2');
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
// if (response['success'] == true && response['data'] is List) {
|
||||
setState(() {
|
||||
ticketList = response['data'].toList();
|
||||
print("TC1 - $ticketList");
|
||||
reversedTicketList = List<Map<String, dynamic>>.from(ticketList);
|
||||
print("TC2 - $ticketList");
|
||||
ticketList = reversedTicketList.reversed.toList();
|
||||
print("TC3 - $ticketList");
|
||||
});
|
||||
// }
|
||||
// else if (response['status'] == "error" &&
|
||||
// response['message'] == "No tickets found") {
|
||||
// setState(() {
|
||||
// ticketList = [];
|
||||
// trackClaimsList = [];
|
||||
// trackClaimsClosedList = [];
|
||||
// });
|
||||
// ToastHelper.showErrorToast(context, 'No tickets found');
|
||||
// } else {
|
||||
// setState(() {
|
||||
// isLoading = false;
|
||||
// });
|
||||
// ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||
// print('API request failed with status: ${response['status']}');
|
||||
// }
|
||||
} catch (e) {
|
||||
// ToastHelper.showErrorToast(context, 'Failed to load data');
|
||||
print('Error in getTicketList: $e');
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Color getStatusColor(String? policyStatus) {
|
||||
if (policyStatus != null && statusColors.containsKey(policyStatus)) {
|
||||
return statusColors[policyStatus]!;
|
||||
@ -494,6 +550,7 @@ class _helpState extends State<help> {
|
||||
allClaimsActive = 0;
|
||||
closedTrackActive = 1;
|
||||
tickets = 1;
|
||||
ticketsActive = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -509,6 +566,7 @@ class _helpState extends State<help> {
|
||||
allClaimsActive = 1;
|
||||
closedTrackActive = 0;
|
||||
tickets = 1;
|
||||
ticketsActive = 1;
|
||||
});
|
||||
getTrackClaimsList();
|
||||
},
|
||||
@ -525,7 +583,9 @@ class _helpState extends State<help> {
|
||||
allClaimsActive = 1;
|
||||
closedTrackActive = 1;
|
||||
tickets = 0;
|
||||
ticketsActive = 0;
|
||||
});
|
||||
getTicketList();
|
||||
// getTrackClaimsList();
|
||||
},
|
||||
),
|
||||
@ -546,6 +606,7 @@ class _helpState extends State<help> {
|
||||
allClaimsActive = 0;
|
||||
closedTrackActive = 1;
|
||||
tickets = 1;
|
||||
ticketsActive = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -560,6 +621,7 @@ class _helpState extends State<help> {
|
||||
allClaimsActive = 1;
|
||||
closedTrackActive = 0;
|
||||
tickets = 1;
|
||||
ticketsActive = 1;
|
||||
});
|
||||
getTrackClaimsList();
|
||||
},
|
||||
@ -572,11 +634,16 @@ class _helpState extends State<help> {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isActive = false;
|
||||
ticketsActive = 0;
|
||||
allClaimsActive = 1;
|
||||
closedTrackActive = 1;
|
||||
tickets = 0;
|
||||
// isActive = false;
|
||||
// allClaimsActive = 1;
|
||||
// closedTrackActive = 1;
|
||||
// tickets = 0;
|
||||
});
|
||||
getTrackClaimsList();
|
||||
// getTrackClaimsList();
|
||||
getTicketList();
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -615,7 +682,7 @@ class _helpState extends State<help> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.string(
|
||||
SvgService.getSvg('tickets'),
|
||||
SvgService.getSvg('claims'),
|
||||
width: 60,
|
||||
height: 60,
|
||||
),
|
||||
@ -682,7 +749,7 @@ class _helpState extends State<help> {
|
||||
trackClaimsList), // Replace 'yourDataList' with your actual data list
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
// SizedBox(height: 15),
|
||||
if (closedTrackActive == 0)
|
||||
if (trackClaimsClosedList == null ||
|
||||
trackClaimsClosedList.isEmpty)
|
||||
@ -783,7 +850,110 @@ class _helpState extends State<help> {
|
||||
trackClaimsClosedList), // Replace 'yourDataList' with your actual data list
|
||||
),
|
||||
),
|
||||
// SizedBox(height: Responsive.isDesktop(context) ? 40 : 70),
|
||||
|
||||
if (ticketsActive == 0)
|
||||
if (ticketList == null || ticketList.isEmpty)
|
||||
Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Color(0xFFD9D9D9), // Set the border color here
|
||||
width: 1.0, // Set the border width here
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
8.0), // Set the border radius here
|
||||
),
|
||||
child: Column(children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors
|
||||
.white, // Set background color for the container
|
||||
),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.only(
|
||||
top: 10, bottom: 10, left: 10, right: 10)
|
||||
: EdgeInsets.only(
|
||||
top: 10, bottom: 10, left: 10, right: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 11,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.string(
|
||||
SvgService.getSvg('tickets'),
|
||||
width: 60,
|
||||
height: 60,
|
||||
),
|
||||
SizedBox(
|
||||
width:
|
||||
10), // Adjust space between icon and text
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'No service request yet!',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(context)
|
||||
? 18
|
||||
: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: Responsive.isDesktop(
|
||||
context)
|
||||
? 800
|
||||
: 250), // Adjust the maximum width as needed
|
||||
child: Text(
|
||||
'Please raise a service request, if you have any concerns with your policy.',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(context)
|
||||
? 14
|
||||
: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF777777),
|
||||
),
|
||||
softWrap:
|
||||
true, // Ensure text automatically wraps
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
if (ticketList != null)
|
||||
if (ticketsActive == 0)
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: generateClaimsTicketList(
|
||||
ticketList), // Replace 'yourDataList' with your actual data list
|
||||
),
|
||||
),
|
||||
SizedBox(height: Responsive.isDesktop(context) ? 40 : 70),
|
||||
|
||||
// generateClaimsTicketList
|
||||
]),
|
||||
)),
|
||||
if (isLoading)
|
||||
@ -928,7 +1098,7 @@ class _helpState extends State<help> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.string(
|
||||
SvgService.getSvg('tickets'),
|
||||
SvgService.getSvg('claims'),
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
@ -1284,6 +1454,217 @@ class _helpState extends State<help> {
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> generateClaimsTicketList(List<dynamic> data) {
|
||||
return [
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: data.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var item = data[index];
|
||||
|
||||
// String claimsName = item['user_name'];
|
||||
String claimsSubject = item['subject'] ?? '';
|
||||
String claimsDate = item['created_at'] ?? '';
|
||||
String claimStatus = item['status'] ?? '';
|
||||
String claimsDepartmentName = item['ticket_type'] ?? '';
|
||||
// String claimsReplies = item['replies'];
|
||||
// List<dynamic> messageList = item['message_list'];
|
||||
print("item - $item");
|
||||
print('generateTrackList');
|
||||
print(claimsSubject);
|
||||
print(claimsDate);
|
||||
print(claimStatus);
|
||||
print(claimsDepartmentName);
|
||||
|
||||
final Map<String, Color> statusColors = {
|
||||
'Received': Colors.amber,
|
||||
'Rejected': Colors.red,
|
||||
'Cancelled': Colors.red,
|
||||
'Returned': Colors.deepOrange,
|
||||
'Closed': Colors.grey,
|
||||
'Approved': Colors.green,
|
||||
'Settled': Colors.lightBlueAccent,
|
||||
'Under Process': Colors.brown,
|
||||
};
|
||||
|
||||
// Determine the color based on the claimStatus
|
||||
Color statusColor;
|
||||
if (claimStatus != null) {
|
||||
statusColor = statusColors[claimStatus!] ?? Color(0xFF979797);
|
||||
} else {
|
||||
statusColor = Color(0xFF979797); // Default color if status is null
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
print("Navigating with thz_id: ${item['thz_id']}");
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
claimtracklist(ticketID: item['thz_id']),
|
||||
),
|
||||
);
|
||||
|
||||
// Navigator.pushNamed(
|
||||
// context,
|
||||
// 'claimtracklist',
|
||||
// arguments: item['thz_id'],
|
||||
// );
|
||||
},
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Color(0xFFD9D9D9), // Set the border color here
|
||||
width: 1.0, // Set the border width here
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
8.0), // Set the border radius here
|
||||
),
|
||||
child: Column(children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors
|
||||
.white, // Set background color for the container
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 10, bottom: 10, left: 10, right: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.string(
|
||||
SvgService.getSvg('tickets'),
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
SizedBox(
|
||||
width:
|
||||
10), // Adjust space between icon and text
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
claimsDepartmentName ?? '',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(context)
|
||||
? 18
|
||||
: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Container(
|
||||
alignment: Alignment
|
||||
.centerLeft, // Set a fixed width or adjust based on your layout
|
||||
child: Tooltip(
|
||||
message: claimsSubject,
|
||||
child: Text(
|
||||
claimsSubject.length > 30
|
||||
? '${claimsSubject.substring(0, 30)}...'
|
||||
: claimsSubject,
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(
|
||||
context)
|
||||
? 14
|
||||
: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF777777),
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
// Adjust space between icon and text
|
||||
Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: statusColor,
|
||||
borderRadius: BorderRadius.circular(
|
||||
50), // Border radius set to 50
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Text(
|
||||
claimStatus,
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(
|
||||
context)
|
||||
? 12
|
||||
: 10,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors
|
||||
.white, // Text color against the background
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
formatDateWithTime(claimsDate),
|
||||
textAlign: TextAlign.right,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(context)
|
||||
? 14
|
||||
: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF777777),
|
||||
), // Ensure text automatically wraps
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
])),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
String formatDateWithTime(String timestamp) {
|
||||
// Parse the timestamp string to DateTime
|
||||
DateTime date = DateTime.parse(timestamp);
|
||||
|
||||
@ -105,6 +105,40 @@ class ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getTicketListByMobile(String empMobileNo) async {
|
||||
print(_token);
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
}
|
||||
|
||||
final url2 =
|
||||
Uri.parse('${Environment.apiUrl}ticketList?mobile=$empMobileNo');
|
||||
|
||||
final url = Uri.parse('${Environment.apiUrl}ticketList?mobile=1234567890');
|
||||
final headers = {
|
||||
'Authorization': 'Bearer $_token' ?? '',
|
||||
};
|
||||
final response = await _makeGetRequest(url, headers);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getTicketConverList(String thz_id) async {
|
||||
print(_token);
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
}
|
||||
|
||||
final url1 = Uri.parse('${Environment.apiUrl}ticketList?mobile=$thz_id');
|
||||
|
||||
final url =
|
||||
Uri.parse('${Environment.apiUrl}ticketConversationList?thz_id=$thz_id');
|
||||
final headers = {
|
||||
'Authorization': 'Bearer $_token' ?? '',
|
||||
};
|
||||
final response = await _makeGetRequest(url, headers);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getWellnessLink() async {
|
||||
print(_token);
|
||||
if (_token == null) {
|
||||
@ -150,13 +184,16 @@ class ApiService {
|
||||
|
||||
Future<Map<String, dynamic>> sendClaimsMessageToApi(
|
||||
Map<String, dynamic> formData) async {
|
||||
final url = Uri.parse('${Environment.apiUrlTicket}/messages/create');
|
||||
print("sendClaimsMessageToApi");
|
||||
final url = Uri.parse('${Environment.apiUrl}ticketConversationSave');
|
||||
// final url = Uri.parse('${Environment.apiUrlTicket}/messages/create');
|
||||
// Convert formData to Map<String, String>
|
||||
print("sendClaimsMessageToApi1");
|
||||
Map<String, String> stringFormData =
|
||||
formData.map((key, value) => MapEntry(key, value.toString()));
|
||||
final response = await _makePostRequest(url, stringFormData, {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Token': Environment.ticketToken,
|
||||
'Authorization': 'Bearer $_token' ?? '',
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -146,6 +146,35 @@ class SvgService {
|
||||
</svg>
|
||||
''';
|
||||
|
||||
static const String claims =
|
||||
'''<svg width="22" height="18" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.14033 5.9817L6.55504 6.03372L7.38447 6.44984L8.45089 6.86596L9.39881 7.12603L10.8207 7.33409L11.0577 7.54215V11.3392L10.7614 12.3275L10.4652 12.9517L9.93201 13.7319L9.28032 14.4081L8.80636 14.8242L7.79919 15.5004L6.73278 16.0206L6.4958 16.1246H6.08108L4.95542 15.6045L4.12599 15.0843L3.53354 14.6162L3.23731 14.3561L2.70411 13.836L2.23015 13.1598L1.75619 12.2235L1.51921 11.4433L1.45996 11.0272V7.54215L1.69694 7.33409L3.11882 7.12603L4.54071 6.70991L5.66637 6.24178L6.14033 5.9817Z" fill="#E26728"/>
|
||||
<path d="M8.21452 2.44472H17.3383L17.8122 2.70479L20.2413 4.8374L20.4783 5.20151V15.4485L20.182 15.9686L19.7081 16.3327L19.2341 16.4888H8.57L7.97754 16.2287L8.27377 16.0206L8.74773 15.7605L19.1749 15.7085L19.4711 15.5525L19.5896 15.3444L19.6488 5.56561H17.4568L17.1013 5.35755L16.9236 5.04546V3.17293L8.33301 3.22494L8.03679 3.433L7.9183 3.69308L7.85905 5.82569L7.14811 5.5136L7.08887 5.46158V3.433L7.32585 3.01688L7.56283 2.75681L7.9183 2.54875L8.21452 2.44472Z" fill="#E26728"/>
|
||||
<path d="M8.21452 2.44472H17.3383L17.4568 2.49673V2.65278L17.1605 2.80882L17.1013 3.17293L8.56999 3.12091L8.4515 2.86084L8.56999 2.80882V2.70479L8.21452 2.65278L8.15527 2.49673L8.21452 2.44472Z" fill="#E26728"/>
|
||||
<path d="M8.51077 8.89458L8.92549 8.94659L9.16247 9.25868L9.10322 9.51876L8.74775 9.88286L8.45153 10.1429L7.91832 10.5591L7.5036 10.9752L6.9704 11.3913L6.67417 11.6514L6.02248 12.2235L5.72625 12.4836L5.31153 12.4316V12.3276C5.31153 12.3276 5.10508 12.3199 5.07455 12.2235C5.06228 12.1848 5.07455 12.1195 5.07455 12.1195L4.83757 12.0155L4.30437 11.4953L3.53418 10.8191V10.455L3.83041 10.195H4.12663L5.48927 11.3913L5.72625 11.3393L8.51077 8.89458Z" fill="white"/>
|
||||
<path d="M13.7829 11.4433H18.2263L18.5225 11.6514V11.9635L18.2855 12.1715H13.7829L13.5459 11.9635V11.6514L13.7829 11.4433Z" fill="#E26728"/>
|
||||
<path d="M13.7236 9.05061H18.3448L18.5225 9.20666V9.57076L18.2855 9.72681H13.7829L13.5459 9.57076V9.20666L13.7236 9.05061Z" fill="#E26728"/>
|
||||
<path d="M13.7236 6.60591H18.2855L18.5225 6.81397L18.4632 7.17808L18.2855 7.28211H13.7236L13.5459 7.12606V6.76196L13.7236 6.60591Z" fill="#E26728"/>
|
||||
<path d="M7.68132 3.06888L7.9183 3.27694L7.97754 3.53701L7.9183 3.69306L7.85905 5.82567L7.14811 5.51358L7.08887 5.46157V3.43298L7.20736 3.17291H7.50358L7.68132 3.06888Z" fill="#E26728"/>
|
||||
<path d="M13.8428 6.60591H18.2862L18.5231 6.81397L18.4639 7.17808L18.2862 7.28211H13.8428V7.23009L16.1533 7.17808V7.07405L17.9307 7.02203L17.4567 6.97002L17.5752 6.81397L17.9899 6.86599V6.70994L17.516 6.76196H14.4945V6.70994L13.8428 6.65793V6.60591Z" fill="#E26728"/>
|
||||
<path d="M12.0654 6.44986H12.4801L12.7764 6.65792L12.8356 6.76195V7.17807L12.5394 7.43814L12.4209 7.49016H12.0654L11.7692 7.2821L11.71 7.17807V6.70993L12.0654 6.44986Z" fill="#E26728"/>
|
||||
<path d="M12.1247 11.2872H12.4801L12.7764 11.4953L12.8356 11.5993V12.0154L12.5986 12.2755L12.0654 12.3275L11.7692 12.1195L11.71 12.0154V11.5993L12.0062 11.3392L12.1247 11.2872Z" fill="#E26728"/>
|
||||
<path d="M12.0654 8.89458H12.5394L12.8356 9.20667V9.57077L12.5986 9.83085L12.4801 9.88286H12.0062L11.71 9.57077V9.20667L11.9469 8.94659L12.0654 8.89458Z" fill="#E26728"/>
|
||||
<path d="M18.2266 9.05061L18.4636 9.15464L18.5228 9.20666V9.57076L18.2266 9.72681L16.6862 9.67479L16.7454 9.46673L16.9824 9.41472L16.9232 9.31069L16.627 9.25867V9.20666L17.8119 9.15464L18.2266 9.05061Z" fill="#E26728"/>
|
||||
<path d="M13.8428 9.05061H18.2269V9.10263L17.8122 9.20666H17.3382L16.9235 9.25867L16.9828 9.41472L16.7458 9.51875L16.6865 9.67479H18.2269V9.72681H13.8428V9.67479L16.6273 9.62278V9.51875H16.1533L15.8571 9.46673V9.41472H16.1533L16.0941 9.20666L16.1533 9.15464L13.8428 9.10263V9.05061Z" fill="#E26728"/>
|
||||
<path d="M13.902 11.9114H17.516L17.9899 11.9635V12.0675H15.1462L13.8428 12.0155L13.902 11.9114Z" fill="#E26728"/>
|
||||
<path d="M13.6051 11.5993H13.6644L13.7236 11.9634L13.7829 12.0154H18.3448L18.2855 12.1715H13.7829L13.5459 11.9634V11.6513L13.6051 11.5993Z" fill="#E26728"/>
|
||||
<path d="M13.8428 6.60591H18.2269L18.0492 6.70994L17.516 6.76196H14.4945V6.70994L13.8428 6.65793V6.60591Z" fill="#E26728"/>
|
||||
<path d="M18.582 3.43301L18.9967 3.7451L20.2409 4.83742L20.1224 4.94145L19.5892 4.47331L19.293 4.21324L19.1745 4.00518H18.9375L18.7598 3.7451L18.582 3.53704V3.43301Z" fill="#E26728"/>
|
||||
<path d="M6.14095 10.9751L6.25944 11.1312H6.43718V11.3913H5.90397L5.84473 11.6513L5.78548 11.7034H5.48926V11.4953H5.66699L5.78548 11.2872L6.14095 10.9751Z" fill="white"/>
|
||||
<path d="M4.83691 10.8191L5.13314 10.9231L5.37012 11.1312H5.6071V11.2352H5.78484L5.66635 11.4433L5.42937 11.3913L4.83691 10.8711V10.8191Z" fill="#E26728"/>
|
||||
<path d="M13.724 6.60591L14.3164 6.65793V6.81397L13.6055 6.86599V6.70994L13.724 6.60591Z" fill="#E26728"/>
|
||||
<path d="M17.7529 2.75679L17.9899 2.86082L18.5824 3.38097L18.4639 3.485L17.7529 2.86082V2.75679Z" fill="#E26728"/>
|
||||
<path d="M7.85905 10.6111L8.03679 10.6631V10.7671H7.79981L7.85905 10.9752L7.44434 11.0272L7.79981 10.6631L7.85905 10.6111Z" fill="#E26728"/>
|
||||
<path d="M12.5983 11.5993H12.7168L12.8353 11.7033L12.776 11.9114L12.7168 12.0674H12.5983L12.5391 11.7033L12.5983 11.5993Z" fill="#E26728"/>
|
||||
<path d="M8.51074 8.89458H8.68848L8.74772 9.05062L8.27376 9.25868L8.15527 9.20667L8.51074 8.89458Z" fill="white"/>
|
||||
</svg>''';
|
||||
|
||||
static const String smartphone = '''
|
||||
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M17.5 26.2501H17.5145M10.2083 2.91675H24.7916C26.4025 2.91675 27.7083 4.22258 27.7083 5.83341V29.1667C27.7083 30.7776 26.4025 32.0834 24.7916 32.0834H10.2083C8.59746 32.0834 7.29163 30.7776 7.29163 29.1667V5.83341C7.29163 4.22258 8.59746 2.91675 10.2083 2.91675Z" stroke="#E26828" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
@ -305,8 +334,6 @@ class SvgService {
|
||||
</svg>
|
||||
''';
|
||||
|
||||
// Add more SVG strings here as needed
|
||||
|
||||
static String getSvg(String svgName) {
|
||||
switch (svgName) {
|
||||
case 'ECard':
|
||||
@ -329,6 +356,8 @@ class SvgService {
|
||||
return fileClaims;
|
||||
case 'tickets':
|
||||
return tickets;
|
||||
case 'claims':
|
||||
return claims;
|
||||
case 'help':
|
||||
return help;
|
||||
case 'email':
|
||||
@ -342,4 +371,6 @@ class SvgService {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add more SVG strings here as needed
|
||||
}
|
||||
|
||||
@ -29,15 +29,15 @@ class _ticketsState extends State<tickets> {
|
||||
dynamic client_id;
|
||||
List<Map<String, dynamic>> policyList = [];
|
||||
dynamic policyDataIsEmpty = 1;
|
||||
int? fromClaimsPage;
|
||||
int? fromClaimsPage;
|
||||
dynamic decodedToken;
|
||||
List<Map<String, dynamic>> policyNumberList = [];
|
||||
dynamic serviceId;
|
||||
dynamic policyNumberId;
|
||||
String? selectedMemberName;
|
||||
String? selectedMemberName;
|
||||
String? selectedServiceName;
|
||||
String? selectedPolicyNo;
|
||||
dynamic client_branch_id;
|
||||
dynamic client_branch_id;
|
||||
dynamic mobileNo;
|
||||
dynamic policyTypeCondition;
|
||||
dynamic client_policy_id;
|
||||
@ -63,8 +63,6 @@ class _ticketsState extends State<tickets> {
|
||||
bool isSubjectValid = true;
|
||||
bool isMessageValid = true;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -82,9 +80,6 @@ class _ticketsState extends State<tickets> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
print('_loadToken');
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
@ -120,15 +115,16 @@ class _ticketsState extends State<tickets> {
|
||||
try {
|
||||
// Call both APIs
|
||||
final responseActive = await apiService.getActiveAndInactivePolicyDetails(
|
||||
client_id!, empCodeString!, 'Active', client_branch_id,mobileNo
|
||||
);
|
||||
client_id!, empCodeString!, 'Active', client_branch_id, mobileNo);
|
||||
|
||||
final responseInactive = await apiService.getActiveAndInactivePolicyDetails(
|
||||
client_id!, empCodeString!, 'Inactive', client_branch_id,mobileNo
|
||||
);
|
||||
final responseInactive =
|
||||
await apiService.getActiveAndInactivePolicyDetails(client_id!,
|
||||
empCodeString!, 'Inactive', client_branch_id, mobileNo);
|
||||
|
||||
final bool isActiveSuccess = responseActive['status'] == 'success' && responseActive['data'] != null;
|
||||
final bool isInactiveSuccess = responseInactive['status'] == 'success' && responseInactive['data'] != null;
|
||||
final bool isActiveSuccess = responseActive['status'] == 'success' &&
|
||||
responseActive['data'] != null;
|
||||
final bool isInactiveSuccess = responseInactive['status'] == 'success' &&
|
||||
responseInactive['data'] != null;
|
||||
|
||||
final List<Map<String, dynamic>> activeData = isActiveSuccess
|
||||
? List<Map<String, dynamic>>.from(responseActive['data'])
|
||||
@ -268,7 +264,6 @@ class _ticketsState extends State<tickets> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -277,135 +272,141 @@ class _ticketsState extends State<tickets> {
|
||||
body: Stack(children: [
|
||||
SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.2, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0.05, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(10),
|
||||
color: Colors.white,
|
||||
child: Column(children: [
|
||||
Card(
|
||||
elevation: 5,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.2, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0.05, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(10),
|
||||
color: Colors.white,
|
||||
child: Column(children: [
|
||||
Card(
|
||||
elevation: 5,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(15.0), // Set border radius here
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, // Set background color to white
|
||||
borderRadius: BorderRadius.circular(
|
||||
15.0), // Set border radius for Container
|
||||
),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15)
|
||||
: EdgeInsets.only(
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, // Set background color to white
|
||||
borderRadius: BorderRadius.circular(
|
||||
15.0), // Set border radius for Container
|
||||
),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15)
|
||||
: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
left: 10,
|
||||
right: 10), // Add padding to the container
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(
|
||||
0xFFFFFCE5), // Set background color for the container
|
||||
borderRadius: BorderRadius.circular(
|
||||
10), // Set border radius for the container
|
||||
),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.only(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(
|
||||
0xFFFFFCE5), // Set background color for the container
|
||||
borderRadius: BorderRadius.circular(
|
||||
10), // Set border radius for the container
|
||||
),
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.only(
|
||||
top: 20,
|
||||
bottom: 20,
|
||||
left: 0,
|
||||
right: 0)
|
||||
: EdgeInsets.only(
|
||||
: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
left: 10,
|
||||
right: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context,'help');
|
||||
},
|
||||
child: Icon(
|
||||
Icons
|
||||
.chevron_left, // Replace with your desired icon
|
||||
color: Color(0xFF000000),
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, 'help');
|
||||
},
|
||||
child: Icon(
|
||||
Icons
|
||||
.chevron_left, // Replace with your desired icon
|
||||
color: Color(0xFF000000),
|
||||
size: 30,
|
||||
),
|
||||
Expanded(
|
||||
flex: 11,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 11,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
Responsive.isDesktop(context)
|
||||
? MainAxisAlignment.center
|
||||
: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text('Raise a Ticket',
|
||||
textAlign: TextAlign.start,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
children: [
|
||||
Text(
|
||||
'Raise a Ticket',
|
||||
textAlign: TextAlign.start,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize:
|
||||
Responsive.isDesktop(
|
||||
context)
|
||||
context)
|
||||
? 20
|
||||
: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
), // Space between rows
|
||||
// Add more rows as needed
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
), // Space between rows
|
||||
// Add more rows as needed
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Form(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -511,30 +512,62 @@ class _ticketsState extends State<tickets> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
))),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
sendFormDataToApi();
|
||||
},
|
||||
child: Text(
|
||||
'Send',
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Color(0xFFE26728),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
))),
|
||||
],
|
||||
),
|
||||
SizedBox(height: Responsive.isDesktop(context) ? 40 : 60),
|
||||
]),
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(height: Responsive.isDesktop(context) ? 40 : 60),
|
||||
]),
|
||||
)),
|
||||
if (isLoading)
|
||||
Container(
|
||||
color: Color(0x98FFFCE5), // Semi-transparent background
|
||||
child: Center(
|
||||
child: // Your GIF loader widget
|
||||
Image.asset(
|
||||
height: 60,
|
||||
width: 60,
|
||||
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
|
||||
Image.asset(
|
||||
height: 60,
|
||||
width: 60,
|
||||
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
|
||||
),
|
||||
),
|
||||
if (Responsive.isDesktop(context))
|
||||
@ -560,36 +593,36 @@ class _ticketsState extends State<tickets> {
|
||||
bottomNavigationBar: Responsive.isDesktop(context)
|
||||
? null
|
||||
: CustomBottomNavigationBar(
|
||||
onTabChanged: (index) {
|
||||
// repositionBotman();
|
||||
if (index == 0) {
|
||||
Navigator.pushNamed(context, 'home');
|
||||
} else if (index == 1) {
|
||||
Navigator.pushNamed(context, 'claims');
|
||||
} else if (index == 2) {
|
||||
Navigator.pushNamed(context, 'profile');
|
||||
} else if (index == 3) {
|
||||
Navigator.pushNamed(context, 'help');
|
||||
// Navigator.pushNamed(context, 'help');
|
||||
} else if (index == 4) {
|
||||
Navigator.pushNamed(context, 'wellness');
|
||||
}
|
||||
},
|
||||
icons: [
|
||||
Icons.home_outlined,
|
||||
Icons.sticky_note_2_outlined,
|
||||
Icons.person_outline_outlined,
|
||||
Icons.headset_mic_outlined,
|
||||
Icons.health_and_safety_outlined,
|
||||
],
|
||||
labels: [
|
||||
"Home",
|
||||
"Claim",
|
||||
"Profile",
|
||||
"Help",
|
||||
"Wellness",
|
||||
], // Initial index of the bottom navigation bar
|
||||
),
|
||||
onTabChanged: (index) {
|
||||
// repositionBotman();
|
||||
if (index == 0) {
|
||||
Navigator.pushNamed(context, 'home');
|
||||
} else if (index == 1) {
|
||||
Navigator.pushNamed(context, 'claims');
|
||||
} else if (index == 2) {
|
||||
Navigator.pushNamed(context, 'profile');
|
||||
} else if (index == 3) {
|
||||
Navigator.pushNamed(context, 'help');
|
||||
// Navigator.pushNamed(context, 'help');
|
||||
} else if (index == 4) {
|
||||
Navigator.pushNamed(context, 'wellness');
|
||||
}
|
||||
},
|
||||
icons: [
|
||||
Icons.home_outlined,
|
||||
Icons.sticky_note_2_outlined,
|
||||
Icons.person_outline_outlined,
|
||||
Icons.headset_mic_outlined,
|
||||
Icons.health_and_safety_outlined,
|
||||
],
|
||||
labels: [
|
||||
"Home",
|
||||
"Claim",
|
||||
"Profile",
|
||||
"Help",
|
||||
"Wellness",
|
||||
], // Initial index of the bottom navigation bar
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -622,23 +655,23 @@ class _ticketsState extends State<tickets> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget buildDropdownField<T>(
|
||||
String label,
|
||||
void Function(T?) onChanged,
|
||||
bool readOnly,
|
||||
List<Map<String, dynamic>> itemsList,
|
||||
String displayField,
|
||||
T? selectedValue, {
|
||||
String valueKey = 'id',
|
||||
}) {
|
||||
String label,
|
||||
void Function(T?) onChanged,
|
||||
bool readOnly,
|
||||
List<Map<String, dynamic>> itemsList,
|
||||
String displayField,
|
||||
T? selectedValue, {
|
||||
String valueKey = 'id',
|
||||
}) {
|
||||
return DropdownButtonFormField<T>(
|
||||
value: selectedValue,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
items: itemsList.map<DropdownMenuItem<T>>((item) {
|
||||
return DropdownMenuItem<T>(
|
||||
value: item[valueKey] as T, // ✅ cast to generic type
|
||||
child: Text(item[displayField].toString()), // always display as String
|
||||
child:
|
||||
Text(item[displayField].toString()), // always display as String
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: readOnly ? null : onChanged,
|
||||
@ -650,5 +683,4 @@ class _ticketsState extends State<tickets> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||
FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin"))
|
||||
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user