UI_TICKET_CONVERSATION
This commit is contained in:
parent
9f4241fc9d
commit
955f1470ae
@ -131,10 +131,13 @@ class MyApp extends StatelessWidget {
|
|||||||
'profile': (context) => profile(),
|
'profile': (context) => profile(),
|
||||||
'wellness': (context) => wellness(),
|
'wellness': (context) => wellness(),
|
||||||
'planclaimsform': (context) => planclaimsform(),
|
'planclaimsform': (context) => planclaimsform(),
|
||||||
'claimtracklist': (context) => claimtracklist(),
|
'claimtracklist': (context) => claimtracklist(
|
||||||
|
ticketID: "",
|
||||||
|
),
|
||||||
'privacypolicy': (context) => privacypolicy(),
|
'privacypolicy': (context) => privacypolicy(),
|
||||||
'termsofuse': (context) => termsofuse(),
|
'termsofuse': (context) => termsofuse(),
|
||||||
'generalExclusionsDeductibles': (context) => generalExclusionsDeductibles(),
|
'generalExclusionsDeductibles': (context) =>
|
||||||
|
generalExclusionsDeductibles(),
|
||||||
// 'home': (context) => kIsWeb ? Home() : BotmanScaffold(currentRoute: 'home', child: Home()),
|
// 'home': (context) => kIsWeb ? Home() : BotmanScaffold(currentRoute: 'home', child: Home()),
|
||||||
// 'policies': (context) => kIsWeb ? policies() : BotmanScaffold(currentRoute: 'policies', child: policies()),
|
// 'policies': (context) => kIsWeb ? policies() : BotmanScaffold(currentRoute: 'policies', child: policies()),
|
||||||
// 'claims': (context) => kIsWeb ? claims() : BotmanScaffold(currentRoute: 'claims', child: claims()),
|
// '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';
|
import '../../customAppBar/toastHelper.dart';
|
||||||
|
|
||||||
class claimtracklist extends StatefulWidget {
|
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
|
@override
|
||||||
State<claimtracklist> createState() => _claimtracklistformState();
|
State<claimtracklist> createState() => _claimtracklistformState();
|
||||||
@ -23,6 +24,7 @@ class claimtracklist extends StatefulWidget {
|
|||||||
|
|
||||||
class _claimtracklistformState extends State<claimtracklist> {
|
class _claimtracklistformState extends State<claimtracklist> {
|
||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
|
late String ticketID;
|
||||||
dynamic _token;
|
dynamic _token;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
dynamic empCodeString;
|
dynamic empCodeString;
|
||||||
@ -32,9 +34,12 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
dynamic policyDataIsEmpty = 1;
|
dynamic policyDataIsEmpty = 1;
|
||||||
dynamic policyHeading;
|
dynamic policyHeading;
|
||||||
dynamic policyName;
|
dynamic policyName;
|
||||||
|
dynamic policyType;
|
||||||
|
dynamic policyTickID;
|
||||||
dynamic policyDate;
|
dynamic policyDate;
|
||||||
dynamic policyStatus;
|
dynamic policyStatus;
|
||||||
dynamic policySubject;
|
dynamic policySubject;
|
||||||
|
dynamic policyMessage;
|
||||||
dynamic policyNo;
|
dynamic policyNo;
|
||||||
dynamic hospitalName;
|
dynamic hospitalName;
|
||||||
dynamic admitDate;
|
dynamic admitDate;
|
||||||
@ -47,9 +52,13 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
List<Map<String, String>> employeeDetails = [];
|
List<Map<String, String>> employeeDetails = [];
|
||||||
dynamic argumentsData;
|
dynamic argumentsData;
|
||||||
dynamic decodedToken;
|
dynamic decodedToken;
|
||||||
dynamic claimTrackMsgList;
|
// dynamic claimTrackMsgList;
|
||||||
|
List<dynamic> claimTrackMsgList = [];
|
||||||
|
|
||||||
|
dynamic claimTrackMasterList;
|
||||||
|
dynamic claimTrackList;
|
||||||
dynamic empName;
|
dynamic empName;
|
||||||
dynamic ticketID;
|
// dynamic ticketID;
|
||||||
late TextEditingController messageController;
|
late TextEditingController messageController;
|
||||||
final Map<String, Color> statusColors = {
|
final Map<String, Color> statusColors = {
|
||||||
'Open': Colors.green,
|
'Open': Colors.green,
|
||||||
@ -65,8 +74,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
ticketID = widget.ticketID;
|
||||||
|
print('ticketID: $ticketID');
|
||||||
apiService = ApiService(context); // Initialize ApiService here
|
apiService = ApiService(context); // Initialize ApiService here
|
||||||
_loadToken();
|
_loadToken();
|
||||||
|
|
||||||
messageController = TextEditingController();
|
messageController = TextEditingController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,33 +89,15 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
// void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
// super.didChangeDependencies();
|
||||||
dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
// print('ticket');
|
||||||
if (arguments != null && arguments is Map<String, dynamic>) {
|
// dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
||||||
argumentsData = arguments;
|
// if (arguments != null && arguments is int) {
|
||||||
print('argumentsData');
|
// ticketID = arguments;
|
||||||
print(argumentsData);
|
// print('ticketID: $ticketID');
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _loadToken() async {
|
Future<void> _loadToken() async {
|
||||||
print('_loadToken');
|
print('_loadToken');
|
||||||
@ -118,10 +112,12 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
print(decodedToken);
|
print(decodedToken);
|
||||||
empName = decodedToken['name'];
|
empName = decodedToken['name'];
|
||||||
empCodeString = prefs.getString('empCode');
|
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');
|
empPrimaryId = prefs.getString('empPrimaryId');
|
||||||
|
print('empPrimaryId- $empPrimaryId');
|
||||||
client_id = prefs.getString('client_id');
|
client_id = prefs.getString('client_id');
|
||||||
print(client_id);
|
print('client_id- $client_id');
|
||||||
|
getTicketConvoList();
|
||||||
} else {
|
} else {
|
||||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||||
// For now, let's navigate to the login screen
|
// For now, let's navigate to the login screen
|
||||||
@ -135,18 +131,20 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
print("FORMDATA - $formData");
|
||||||
formData = formData.map((key, value) => MapEntry(key, value.toString()));
|
formData = formData.map((key, value) => MapEntry(key, value.toString()));
|
||||||
|
print("FORMDATA1 - $formData");
|
||||||
final response = await apiService.sendClaimsMessageToApi(formData);
|
final response = await apiService.sendClaimsMessageToApi(formData);
|
||||||
|
print("REs - $response");
|
||||||
if (response['success'] == 1) {
|
if (response['status'] == 'success') {
|
||||||
messageController.clear();
|
messageController.clear();
|
||||||
ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
// ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
||||||
messageController.clear();
|
messageController.clear();
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
Navigator.pushNamed(context, 'claims', arguments: 0);
|
// Navigator.pushNamed(context, 'claims', arguments: 0);
|
||||||
|
getTicketConvoList();
|
||||||
print('Form data sent successfully.');
|
print('Form data sent successfully.');
|
||||||
} else {
|
} else {
|
||||||
print('Failed to submit form data: ${response['status']}');
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -289,61 +353,145 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
: buildMobileLayout(context)
|
: buildMobileLayout(context)
|
||||||
],
|
],
|
||||||
), // Space between rows
|
), // Space between rows
|
||||||
// Add more rows as needed
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
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(
|
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: SingleChildScrollView(
|
||||||
child: Column(children: [
|
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
...claimTrackMsgList
|
...claimTrackMsgList
|
||||||
.map<Widget>((message) {
|
.map<Widget>((message) {
|
||||||
bool isUserMessage =
|
bool isUserMessage;
|
||||||
message['staff_name'] == null;
|
// bool isUserMessage =
|
||||||
|
// message['notes_by'] == null;
|
||||||
String messageContent =
|
String messageContent =
|
||||||
message['message'];
|
message['notes'];
|
||||||
String messageDate = message['date'];
|
String messageDate =
|
||||||
|
message['created_at'];
|
||||||
dynamic messagername;
|
dynamic messagername;
|
||||||
if (isUserMessage) {
|
messagername =
|
||||||
messagername = empName;
|
message['notes_by'];
|
||||||
|
// if (isUserMessage) {
|
||||||
|
// messagername = empName;
|
||||||
|
// } else {
|
||||||
|
// messagername = message['staff_name'];
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (messagername == "Staff") {
|
||||||
|
isUserMessage = true;
|
||||||
} else {
|
} else {
|
||||||
messagername = message['staff_name'];
|
isUserMessage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
vertical: 4.0),
|
const EdgeInsets.symmetric(
|
||||||
|
vertical: 4.0,
|
||||||
|
horizontal: 4.0),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: isUserMessage
|
alignment: isUserMessage
|
||||||
? Alignment.centerLeft
|
? Alignment.centerLeft
|
||||||
: Alignment.centerLeft,
|
: Alignment.centerLeft,
|
||||||
child: Container(
|
child: Container(
|
||||||
constraints:
|
constraints: BoxConstraints(
|
||||||
BoxConstraints(maxWidth: 800),
|
maxWidth: 800),
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isUserMessage
|
color: isUserMessage
|
||||||
? Colors.blue[100]
|
? Colors.blue[100]
|
||||||
: Colors.green[100],
|
: Colors.green[100],
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(10),
|
BorderRadius.circular(
|
||||||
|
10),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
messageContent,
|
messageContent,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts
|
||||||
fontSize:
|
.poppins(
|
||||||
Responsive.isDesktop(
|
fontSize: Responsive
|
||||||
|
.isDesktop(
|
||||||
context)
|
context)
|
||||||
? 14
|
? 14
|
||||||
: 12,
|
: 12,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w400,
|
FontWeight.w400,
|
||||||
color: Color(0xFF000000),
|
color: Color(
|
||||||
|
0xFF000000),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
@ -360,14 +508,14 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
0xFFE26728),
|
0xFFE26728),
|
||||||
size: 15,
|
size: 15,
|
||||||
),
|
),
|
||||||
SizedBox(width: 5),
|
SizedBox(
|
||||||
|
width: 5),
|
||||||
Text(
|
Text(
|
||||||
messagername,
|
messagername,
|
||||||
style: GoogleFonts
|
style: GoogleFonts
|
||||||
.poppins(
|
.poppins(
|
||||||
fontSize: Responsive
|
fontSize:
|
||||||
.isDesktop(
|
Responsive.isDesktop(context)
|
||||||
context)
|
|
||||||
? 16
|
? 16
|
||||||
: 14,
|
: 14,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
@ -380,23 +528,28 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
// formatDateWithTime(
|
||||||
|
// messageDate),
|
||||||
|
|
||||||
formatDateWithTime(
|
formatDateWithTime(
|
||||||
messageDate),
|
messageDate),
|
||||||
style:
|
style: GoogleFonts
|
||||||
GoogleFonts.poppins(
|
.poppins(
|
||||||
fontSize: Responsive
|
fontSize: Responsive
|
||||||
.isDesktop(
|
.isDesktop(
|
||||||
context)
|
context)
|
||||||
? 12
|
? 12
|
||||||
: 10,
|
: 10,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w400,
|
FontWeight
|
||||||
color:
|
.w400,
|
||||||
Color(0xFF636363),
|
color: Color(
|
||||||
|
0xFF636363),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
// Divider(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -404,27 +557,35 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
|
const EdgeInsets.symmetric(
|
||||||
vertical: 8.0),
|
vertical: 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: Responsive.isDesktop(
|
flex:
|
||||||
|
Responsive.isDesktop(
|
||||||
context)
|
context)
|
||||||
? 10
|
? 10
|
||||||
: 9,
|
: 9,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: messageController,
|
controller:
|
||||||
onChanged: (value) => null,
|
messageController,
|
||||||
decoration: InputDecoration(
|
onChanged: (value) =>
|
||||||
|
null,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
border:
|
border:
|
||||||
OutlineInputBorder(),
|
OutlineInputBorder(),
|
||||||
hintText: 'Message',
|
hintText: 'Message',
|
||||||
labelText: 'Message',
|
labelText: 'Message',
|
||||||
contentPadding:
|
contentPadding:
|
||||||
EdgeInsets.symmetric(
|
EdgeInsets
|
||||||
vertical: 10,
|
.symmetric(
|
||||||
horizontal: 15),
|
vertical:
|
||||||
|
10,
|
||||||
|
horizontal:
|
||||||
|
15),
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null ||
|
if (value == null ||
|
||||||
@ -436,13 +597,14 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: Responsive.isDesktop(
|
flex:
|
||||||
|
Responsive.isDesktop(
|
||||||
context)
|
context)
|
||||||
? 2
|
? 2
|
||||||
: 3,
|
: 3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment:
|
alignment: Alignment
|
||||||
Alignment.centerRight,
|
.centerRight,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Check if any of the fields are empty
|
// Check if any of the fields are empty
|
||||||
@ -454,13 +616,16 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
'All fields are required');
|
'All fields are required');
|
||||||
} else {
|
} else {
|
||||||
// Create a map to hold the form data
|
// Create a map to hold the form data
|
||||||
Map<String, dynamic>
|
Map<String,
|
||||||
|
dynamic>
|
||||||
formData = {
|
formData = {
|
||||||
'ticket_id': ticketID,
|
'thz_id':
|
||||||
'replier': 'user',
|
ticketID,
|
||||||
'message':
|
'notes':
|
||||||
messageController
|
messageController
|
||||||
.text,
|
.text,
|
||||||
|
'notes_by':
|
||||||
|
'User',
|
||||||
// Add more form fields as needed
|
// Add more form fields as needed
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -471,20 +636,22 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reply',
|
'Reply',
|
||||||
style:
|
style: GoogleFonts
|
||||||
GoogleFonts.poppins(
|
.poppins(
|
||||||
color:
|
color: Colors
|
||||||
Colors.white),
|
.white),
|
||||||
),
|
),
|
||||||
style: ElevatedButton
|
style: ElevatedButton
|
||||||
.styleFrom(
|
.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Color(0xFFE26728),
|
Color(
|
||||||
|
0xFFE26728),
|
||||||
shape:
|
shape:
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius
|
BorderRadius
|
||||||
.circular(5),
|
.circular(
|
||||||
|
5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -495,6 +662,7 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
@ -570,14 +738,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String formatDateWithTime(String timestamp) {
|
String formatDateWithTime(String timestamp) {
|
||||||
// Convert the timestamp string to milliseconds
|
// Parse the input string to DateTime
|
||||||
int milliseconds = int.parse(timestamp) * 1000;
|
DateTime date = DateFormat("yyyy-MM-dd HH:mm:ss").parse(timestamp);
|
||||||
|
|
||||||
// Create a DateTime object from milliseconds
|
// Format to your desired output
|
||||||
DateTime date = DateTime.fromMillisecondsSinceEpoch(milliseconds);
|
String formattedDate = DateFormat("dd, MMM yy h:mm a").format(date);
|
||||||
|
|
||||||
// Format the DateTime object with date and time
|
|
||||||
String formattedDate = DateFormat('d MMM, y HH:mm a').format(date);
|
|
||||||
|
|
||||||
return formattedDate;
|
return formattedDate;
|
||||||
}
|
}
|
||||||
@ -588,10 +753,11 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
// buildExpandedColumn(context, 'Policy No', policyNo),
|
buildExpandedColumn(context, 'Policy No', policyTickID),
|
||||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||||
|
buildExpandedColumn(context, 'Ticket Type', policyType),
|
||||||
buildExpandedColumn(context, 'Status', policyStatus),
|
buildExpandedColumn(context, 'Status', policyStatus),
|
||||||
buildExpandedColumn(context, 'Subject', policySubject),
|
buildExpandedColumn(context, 'Assign To', member),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (departmentID == '4') // Conditional check for policy_type
|
if (departmentID == '4') // Conditional check for policy_type
|
||||||
@ -642,8 +808,16 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
buildExpandedColumn(context, 'Policy No', policyTickID),
|
||||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
buildExpandedColumn(context, 'Status', policyStatus),
|
buildExpandedColumn(context, 'Status', policyStatus),
|
||||||
|
buildExpandedColumn(context, 'Ticket Type', policyType),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
@ -651,7 +825,7 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
buildExpandedColumn(context, 'Subject', policySubject),
|
buildExpandedColumn(context, 'Subject', policySubject),
|
||||||
buildExpandedColumn(context, 'Member', member),
|
buildExpandedColumn(context, 'Assigned To', member),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (departmentID == '4')
|
if (departmentID == '4')
|
||||||
@ -699,10 +873,10 @@ class _claimtracklistformState extends State<claimtracklist> {
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
// alignment: Alignment.center,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
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/responsive.dart';
|
||||||
import '../../customAppBar/tabs.dart';
|
import '../../customAppBar/tabs.dart';
|
||||||
import '../../customAppBar/toastHelper.dart';
|
import '../../customAppBar/toastHelper.dart';
|
||||||
|
import 'claimtracklist.dart';
|
||||||
|
|
||||||
class help extends StatefulWidget {
|
class help extends StatefulWidget {
|
||||||
const help({Key? key}) : super(key: key);
|
const help({Key? key}) : super(key: key);
|
||||||
@ -31,6 +32,7 @@ class _helpState extends State<help> {
|
|||||||
int tickets = 1;
|
int tickets = 1;
|
||||||
int closedTrackActive = 1;
|
int closedTrackActive = 1;
|
||||||
int allClaimsActive = 0;
|
int allClaimsActive = 0;
|
||||||
|
int ticketsActive = 1;
|
||||||
dynamic _token;
|
dynamic _token;
|
||||||
dynamic empCodeString;
|
dynamic empCodeString;
|
||||||
dynamic empPrimaryId;
|
dynamic empPrimaryId;
|
||||||
@ -49,6 +51,8 @@ class _helpState extends State<help> {
|
|||||||
dynamic empMobileNo;
|
dynamic empMobileNo;
|
||||||
List<dynamic> reversedClaimsList = [];
|
List<dynamic> reversedClaimsList = [];
|
||||||
List<dynamic> trackClaimsList = [];
|
List<dynamic> trackClaimsList = [];
|
||||||
|
List<dynamic> ticketList = [];
|
||||||
|
List<dynamic> reversedTicketList = [];
|
||||||
List<dynamic> reversedClaimsClosedList = [];
|
List<dynamic> reversedClaimsClosedList = [];
|
||||||
List<dynamic> trackClaimsClosedList = [];
|
List<dynamic> trackClaimsClosedList = [];
|
||||||
final Map<String, Color> statusColors = {
|
final Map<String, Color> statusColors = {
|
||||||
@ -170,6 +174,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) {
|
Color getStatusColor(String? policyStatus) {
|
||||||
if (policyStatus != null && statusColors.containsKey(policyStatus)) {
|
if (policyStatus != null && statusColors.containsKey(policyStatus)) {
|
||||||
return statusColors[policyStatus]!;
|
return statusColors[policyStatus]!;
|
||||||
@ -473,6 +529,7 @@ class _helpState extends State<help> {
|
|||||||
allClaimsActive = 0;
|
allClaimsActive = 0;
|
||||||
closedTrackActive = 1;
|
closedTrackActive = 1;
|
||||||
tickets = 1;
|
tickets = 1;
|
||||||
|
ticketsActive = 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -488,6 +545,7 @@ class _helpState extends State<help> {
|
|||||||
allClaimsActive = 1;
|
allClaimsActive = 1;
|
||||||
closedTrackActive = 0;
|
closedTrackActive = 0;
|
||||||
tickets = 1;
|
tickets = 1;
|
||||||
|
ticketsActive = 1;
|
||||||
});
|
});
|
||||||
getTrackClaimsList();
|
getTrackClaimsList();
|
||||||
},
|
},
|
||||||
@ -504,7 +562,9 @@ class _helpState extends State<help> {
|
|||||||
allClaimsActive = 1;
|
allClaimsActive = 1;
|
||||||
closedTrackActive = 1;
|
closedTrackActive = 1;
|
||||||
tickets = 0;
|
tickets = 0;
|
||||||
|
ticketsActive = 0;
|
||||||
});
|
});
|
||||||
|
getTicketList();
|
||||||
// getTrackClaimsList();
|
// getTrackClaimsList();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -525,6 +585,7 @@ class _helpState extends State<help> {
|
|||||||
allClaimsActive = 0;
|
allClaimsActive = 0;
|
||||||
closedTrackActive = 1;
|
closedTrackActive = 1;
|
||||||
tickets = 1;
|
tickets = 1;
|
||||||
|
ticketsActive = 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -539,6 +600,7 @@ class _helpState extends State<help> {
|
|||||||
allClaimsActive = 1;
|
allClaimsActive = 1;
|
||||||
closedTrackActive = 0;
|
closedTrackActive = 0;
|
||||||
tickets = 1;
|
tickets = 1;
|
||||||
|
ticketsActive = 1;
|
||||||
});
|
});
|
||||||
getTrackClaimsList();
|
getTrackClaimsList();
|
||||||
},
|
},
|
||||||
@ -551,11 +613,16 @@ class _helpState extends State<help> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
isActive = false;
|
isActive = false;
|
||||||
|
ticketsActive = 0;
|
||||||
allClaimsActive = 1;
|
allClaimsActive = 1;
|
||||||
closedTrackActive = 1;
|
closedTrackActive = 1;
|
||||||
tickets = 0;
|
// isActive = false;
|
||||||
|
// allClaimsActive = 1;
|
||||||
|
// closedTrackActive = 1;
|
||||||
|
// tickets = 0;
|
||||||
});
|
});
|
||||||
getTrackClaimsList();
|
// getTrackClaimsList();
|
||||||
|
getTicketList();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -594,7 +661,7 @@ class _helpState extends State<help> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.string(
|
SvgPicture.string(
|
||||||
SvgService.getSvg('tickets'),
|
SvgService.getSvg('claims'),
|
||||||
width: 60,
|
width: 60,
|
||||||
height: 60,
|
height: 60,
|
||||||
),
|
),
|
||||||
@ -661,7 +728,7 @@ class _helpState extends State<help> {
|
|||||||
trackClaimsList), // Replace 'yourDataList' with your actual data list
|
trackClaimsList), // Replace 'yourDataList' with your actual data list
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
// SizedBox(height: 15),
|
||||||
if (closedTrackActive == 0)
|
if (closedTrackActive == 0)
|
||||||
if (trackClaimsClosedList == null ||
|
if (trackClaimsClosedList == null ||
|
||||||
trackClaimsClosedList.isEmpty)
|
trackClaimsClosedList.isEmpty)
|
||||||
@ -762,7 +829,110 @@ class _helpState extends State<help> {
|
|||||||
trackClaimsClosedList), // Replace 'yourDataList' with your actual data list
|
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),
|
SizedBox(height: Responsive.isDesktop(context) ? 40 : 70),
|
||||||
|
|
||||||
|
// generateClaimsTicketList
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
@ -907,7 +1077,7 @@ class _helpState extends State<help> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.string(
|
SvgPicture.string(
|
||||||
SvgService.getSvg('tickets'),
|
SvgService.getSvg('claims'),
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
),
|
),
|
||||||
@ -1263,6 +1433,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) {
|
String formatDateWithTime(String timestamp) {
|
||||||
// Parse the timestamp string to DateTime
|
// Parse the timestamp string to DateTime
|
||||||
DateTime date = DateTime.parse(timestamp);
|
DateTime date = DateTime.parse(timestamp);
|
||||||
|
|||||||
@ -105,6 +105,40 @@ class ApiService {
|
|||||||
return response;
|
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 {
|
Future<Map<String, dynamic>> getWellnessLink() async {
|
||||||
print(_token);
|
print(_token);
|
||||||
if (_token == null) {
|
if (_token == null) {
|
||||||
@ -150,13 +184,16 @@ class ApiService {
|
|||||||
|
|
||||||
Future<Map<String, dynamic>> sendClaimsMessageToApi(
|
Future<Map<String, dynamic>> sendClaimsMessageToApi(
|
||||||
Map<String, dynamic> formData) async {
|
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>
|
// Convert formData to Map<String, String>
|
||||||
|
print("sendClaimsMessageToApi1");
|
||||||
Map<String, String> stringFormData =
|
Map<String, String> stringFormData =
|
||||||
formData.map((key, value) => MapEntry(key, value.toString()));
|
formData.map((key, value) => MapEntry(key, value.toString()));
|
||||||
final response = await _makePostRequest(url, stringFormData, {
|
final response = await _makePostRequest(url, stringFormData, {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Token': Environment.ticketToken,
|
'Authorization': 'Bearer $_token' ?? '',
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,6 +146,35 @@ class SvgService {
|
|||||||
</svg>
|
</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 = '''
|
static const String smartphone = '''
|
||||||
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<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"/>
|
<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>
|
</svg>
|
||||||
''';
|
''';
|
||||||
|
|
||||||
// Add more SVG strings here as needed
|
|
||||||
|
|
||||||
static String getSvg(String svgName) {
|
static String getSvg(String svgName) {
|
||||||
switch (svgName) {
|
switch (svgName) {
|
||||||
case 'ECard':
|
case 'ECard':
|
||||||
@ -329,6 +356,8 @@ class SvgService {
|
|||||||
return fileClaims;
|
return fileClaims;
|
||||||
case 'tickets':
|
case 'tickets':
|
||||||
return tickets;
|
return tickets;
|
||||||
|
case 'claims':
|
||||||
|
return claims;
|
||||||
case 'help':
|
case 'help':
|
||||||
return help;
|
return help;
|
||||||
case 'email':
|
case 'email':
|
||||||
@ -342,4 +371,6 @@ class SvgService {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add more SVG strings here as needed
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,8 +63,6 @@ class _ticketsState extends State<tickets> {
|
|||||||
bool isPolicyValid = true;
|
bool isPolicyValid = true;
|
||||||
bool isSubjectValid = true;
|
bool isSubjectValid = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -82,9 +80,6 @@ class _ticketsState extends State<tickets> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<void> _loadToken() async {
|
Future<void> _loadToken() async {
|
||||||
print('_loadToken');
|
print('_loadToken');
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
@ -120,15 +115,16 @@ class _ticketsState extends State<tickets> {
|
|||||||
try {
|
try {
|
||||||
// Call both APIs
|
// Call both APIs
|
||||||
final responseActive = await apiService.getActiveAndInactivePolicyDetails(
|
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(
|
final responseInactive =
|
||||||
client_id!, empCodeString!, 'Inactive', client_branch_id,mobileNo
|
await apiService.getActiveAndInactivePolicyDetails(client_id!,
|
||||||
);
|
empCodeString!, 'Inactive', client_branch_id, mobileNo);
|
||||||
|
|
||||||
final bool isActiveSuccess = responseActive['status'] == 'success' && responseActive['data'] != null;
|
final bool isActiveSuccess = responseActive['status'] == 'success' &&
|
||||||
final bool isInactiveSuccess = responseInactive['status'] == 'success' && responseInactive['data'] != null;
|
responseActive['data'] != null;
|
||||||
|
final bool isInactiveSuccess = responseInactive['status'] == 'success' &&
|
||||||
|
responseInactive['data'] != null;
|
||||||
|
|
||||||
final List<Map<String, dynamic>> activeData = isActiveSuccess
|
final List<Map<String, dynamic>> activeData = isActiveSuccess
|
||||||
? List<Map<String, dynamic>>.from(responseActive['data'])
|
? List<Map<String, dynamic>>.from(responseActive['data'])
|
||||||
@ -187,9 +183,7 @@ class _ticketsState extends State<tickets> {
|
|||||||
isSubjectValid = subjectController.text.trim().isNotEmpty;
|
isSubjectValid = subjectController.text.trim().isNotEmpty;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isServiceValid &&
|
if (isServiceValid && isPolicyValid && isSubjectValid) {
|
||||||
isPolicyValid &&
|
|
||||||
isSubjectValid) {
|
|
||||||
// Proceed to submit
|
// Proceed to submit
|
||||||
} else {
|
} else {
|
||||||
ToastHelper.showErrorToast(context, 'Please Fill Required Fields');
|
ToastHelper.showErrorToast(context, 'Please Fill Required Fields');
|
||||||
@ -228,15 +222,12 @@ class _ticketsState extends State<tickets> {
|
|||||||
'client_id': selfDetails['client_id'],
|
'client_id': selfDetails['client_id'],
|
||||||
'relationship': selfDetails['relationship'],
|
'relationship': selfDetails['relationship'],
|
||||||
'gender': selfDetails['gender'],
|
'gender': selfDetails['gender'],
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (policyTypeCondition == 1) {
|
if (policyTypeCondition == 1) {
|
||||||
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
||||||
formData['member_name'] = selectedMemberName;
|
formData['member_name'] = selectedMemberName;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
||||||
formData['member_name'] = selectedMemberName;
|
formData['member_name'] = selectedMemberName;
|
||||||
}
|
}
|
||||||
@ -263,7 +254,6 @@ class _ticketsState extends State<tickets> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -342,7 +332,7 @@ class _ticketsState extends State<tickets> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context,'help');
|
context, 'help');
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons
|
Icons
|
||||||
@ -360,7 +350,8 @@ class _ticketsState extends State<tickets> {
|
|||||||
? MainAxisAlignment.center
|
? MainAxisAlignment.center
|
||||||
: MainAxisAlignment.start,
|
: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('Raise a Ticket',
|
Text(
|
||||||
|
'Raise a Ticket',
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize:
|
||||||
@ -403,19 +394,31 @@ class _ticketsState extends State<tickets> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
|
buildDropdownField<
|
||||||
buildDropdownField<int>(
|
int>(
|
||||||
'Service',
|
'Service',
|
||||||
(value) {
|
(value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
serviceId = value;
|
serviceId =
|
||||||
selectedServiceName = serviceList.firstWhere(
|
value;
|
||||||
(serList) => serList['id'] == value,
|
selectedServiceName =
|
||||||
orElse: () => {'name': ''},
|
serviceList
|
||||||
|
.firstWhere(
|
||||||
|
(serList) =>
|
||||||
|
serList[
|
||||||
|
'id'] ==
|
||||||
|
value,
|
||||||
|
orElse: () =>
|
||||||
|
{
|
||||||
|
'name': ''
|
||||||
|
},
|
||||||
)['name'];
|
)['name'];
|
||||||
isServiceValid = true;
|
isServiceValid =
|
||||||
|
true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
@ -427,45 +430,60 @@ class _ticketsState extends State<tickets> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
if (selectedServiceName == "Service")
|
if (selectedServiceName ==
|
||||||
|
"Service")
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
|
buildDropdownField<
|
||||||
buildDropdownField<String>(
|
String>(
|
||||||
'Policy Number',
|
'Policy Number',
|
||||||
(value) {
|
(value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
policyNumberId = value;
|
policyNumberId =
|
||||||
isPolicyValid = true;
|
value;
|
||||||
|
isPolicyValid =
|
||||||
|
true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
policyList,
|
policyList,
|
||||||
'policy_no',
|
'policy_no',
|
||||||
policyNumberId,
|
policyNumberId,
|
||||||
valueKey: 'policy_no',
|
valueKey:
|
||||||
|
'policy_no',
|
||||||
),
|
),
|
||||||
if (!isPolicyValid)
|
if (!isPolicyValid)
|
||||||
Text('Please select a policy',
|
Text(
|
||||||
style: TextStyle(color: Colors.red)),
|
'Please select a policy',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors
|
||||||
|
.red)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
children: [
|
children: [
|
||||||
buildTextField('Subject',
|
buildTextField(
|
||||||
|
'Subject',
|
||||||
subjectController),
|
subjectController),
|
||||||
if (!isSubjectValid)
|
if (!isSubjectValid)
|
||||||
Text('Please enter the Subject', style: TextStyle(color: Colors.red)),
|
Text(
|
||||||
SizedBox(height: 15),
|
'Please enter the Subject',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors
|
||||||
|
.red)),
|
||||||
|
SizedBox(
|
||||||
|
height: 15),
|
||||||
buildTextAreaField(
|
buildTextAreaField(
|
||||||
'Message',
|
'Message',
|
||||||
messageController),
|
messageController),
|
||||||
]
|
]),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -483,7 +501,7 @@ class _ticketsState extends State<tickets> {
|
|||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// sendFormDataToApi();
|
sendFormDataToApi();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Send',
|
'Send',
|
||||||
@ -612,7 +630,6 @@ class _ticketsState extends State<tickets> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget buildDropdownField<T>(
|
Widget buildDropdownField<T>(
|
||||||
String label,
|
String label,
|
||||||
void Function(T?) onChanged,
|
void Function(T?) onChanged,
|
||||||
@ -628,7 +645,8 @@ class _ticketsState extends State<tickets> {
|
|||||||
items: itemsList.map<DropdownMenuItem<T>>((item) {
|
items: itemsList.map<DropdownMenuItem<T>>((item) {
|
||||||
return DropdownMenuItem<T>(
|
return DropdownMenuItem<T>(
|
||||||
value: item[valueKey] as T, // ✅ cast to generic type
|
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(),
|
}).toList(),
|
||||||
onChanged: readOnly ? null : onChanged,
|
onChanged: readOnly ? null : onChanged,
|
||||||
@ -640,5 +658,4 @@ class _ticketsState extends State<tickets> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||||
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
|
||||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
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"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user