CHANGE_ : Ticket New Changes Done
This commit is contained in:
parent
f5c8ee61de
commit
e8f5e0cdd6
8
.env
8
.env
@ -1,4 +1,4 @@
|
||||
API_URL=https://dev.venbait.in/nhance/uat/employeeRest/
|
||||
TICKET_API_URL=https://dev.venbait.in/nhance/helpdesk/uat/api
|
||||
BASE_HREF=/nhance/employee/uat/
|
||||
ENV=production
|
||||
API_URL=https://venbait.in/nhance/dev/employeeRest/
|
||||
TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api
|
||||
BASE_HREF=/nhance/employee/dev/
|
||||
ENV=development
|
||||
@ -12,7 +12,12 @@
|
||||
"package_name": "com.example.nhance_app_pwa"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "508866094093-n8l9fkevuc7vp50evicvhogiiibsc30m.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAZdKJco4fe0e1HP1A249BVZzA3WMYb_3g"
|
||||
@ -20,7 +25,12 @@
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "508866094093-n8l9fkevuc7vp50evicvhogiiibsc30m.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,12 +28,6 @@ import 'models/environment.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// await Firebase.initializeApp(
|
||||
// options: const FirebaseOptions(
|
||||
// apiKey: 'AIzaSyAdacw5svpqopDCpoEym7aDkI3F2AajEO4',
|
||||
// appId: '1:203846206303:android:01f39a22f39a50539b6cea',
|
||||
// messagingSenderId: '203846206303',
|
||||
// projectId: 'push-notification-enrollment'));
|
||||
await Firebase.initializeApp(
|
||||
options: const FirebaseOptions(
|
||||
apiKey: 'AIzaSyAZdKJco4fe0e1HP1A249BVZzA3WMYb_3g',
|
||||
|
||||
@ -178,7 +178,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
client_id = prefs.getString('client_id');
|
||||
print(client_id);
|
||||
|
||||
// print(empPrimaryId);
|
||||
// Call the API when the page enters
|
||||
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
||||
clientLogo = prefs.getString('clientLogo');
|
||||
@ -194,7 +193,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
getGmcEmpPolicyDetails(empPrimaryId);
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'phone');
|
||||
}
|
||||
@ -220,14 +218,10 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
print(clientLogo);
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -286,8 +280,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
gmcDataIsEmpty = 0;
|
||||
});
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -365,20 +357,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -467,20 +453,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -567,27 +547,16 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
['OpenForEnrollment'];
|
||||
addOnsDependentOpenForEnrollment =
|
||||
int.parse(intOpenForEnrollment);
|
||||
// if (addOnDependentPremiumValue != null) {
|
||||
// calculationForDependentSumValue('Add');
|
||||
// }
|
||||
}
|
||||
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -597,7 +566,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
|
||||
Future<void> fetchRelationshipList() async {
|
||||
// Replace the URL with your API endpoint
|
||||
try {
|
||||
final response = await apiService.fetchRelationshipListToApi();
|
||||
if (response['status'] == 'success') {
|
||||
@ -610,21 +578,11 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
'dependent': dependent,
|
||||
});
|
||||
}
|
||||
// final List<String> relationships =
|
||||
// List<String>.from(data.map((item) => item['relationship_name']));
|
||||
// setState(() {
|
||||
// relationshipOptions = relationships;
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Failed to fetch relationship list');
|
||||
throw Exception('Failed to fetch relationship list');
|
||||
}
|
||||
} catch (error) {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Error fetching relationship list: $error');
|
||||
print('Error fetching relationship list: $error');
|
||||
// Handle error accordingly, e.g., show a snackbar with an error message
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,16 +605,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
minDate = DateTime(now.year - max, now.month, now.day);
|
||||
print(minDate);
|
||||
|
||||
// if (formType == 'child') {
|
||||
// // For 'child' form type, allow 0-25 age
|
||||
// minDate = DateTime(now.year - 25, now.month, now.day);
|
||||
// maxDate = now;
|
||||
// } else {
|
||||
// // For other form types, allow 18-100 age
|
||||
// minDate = DateTime(1900);
|
||||
// maxDate = DateTime(now.year - 18, now.month, now.day);
|
||||
// }
|
||||
|
||||
// Ensure initialDate is within the range of minDate and maxDate
|
||||
DateTime initialDate =
|
||||
_selectedDate ?? maxDate; // Use maxDate if _selectedDate is null
|
||||
@ -688,7 +636,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
var id = deletedItem['employee_id'];
|
||||
final response = await apiService.deleteItemToApi(id);
|
||||
|
||||
// Check if the request was successful (status code 200)
|
||||
if (response['status'] == 'success') {
|
||||
formDataList.clear();
|
||||
selectedRelationships.clear();
|
||||
@ -758,7 +705,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
ToastHelper.showSuccessToast(context, 'Saved Successfully...');
|
||||
print('Form data sent successfully.');
|
||||
} else {
|
||||
// Request failed, handle error
|
||||
ToastHelper.showErrorToast(context, 'Failed');
|
||||
print('Failed to send form data. Error: ${response}');
|
||||
}
|
||||
@ -829,22 +775,17 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
_relationShipController.clear();
|
||||
_memberNameController.clear();
|
||||
_dobController.clear();
|
||||
// Navigator.pushNamed(context, 'empReviewDetails');
|
||||
// ToastHelper.showSuccessToast(context, 'Saved successfully!');
|
||||
print('Saved successfully!');
|
||||
} else {
|
||||
// Failed to save member
|
||||
// ToastHelper.showErrorToast(context, "Operation Failed!");
|
||||
ToastHelper.showErrorToast(context, 'Failed to save');
|
||||
print('Operation Failed!');
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Navigator.pushNamed(context, 'empReviewDetails');
|
||||
print('');
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,18 +846,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
_relationShipController.clear();
|
||||
_memberNameController.clear();
|
||||
_dobController.clear();
|
||||
// Navigator.pushNamed(context, 'empReviewDetails');
|
||||
// ToastHelper.showSuccessToast(context, 'Saved successfully!');
|
||||
print('Saved successfully!');
|
||||
} else {
|
||||
// Failed to save member
|
||||
// ToastHelper.showErrorToast(context, "Operation Failed!");
|
||||
// ToastHelper.showSuccessToast(context, 'Failed to Save...');
|
||||
print('Failed to Save...');
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -981,18 +916,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
_relationShipController.clear();
|
||||
_memberNameController.clear();
|
||||
_dobController.clear();
|
||||
// Navigator.pushNamed(context, 'empReviewDetails');
|
||||
// ToastHelper.showSuccessToast(context, 'Saved successfully!');
|
||||
print('Saved successfully!');
|
||||
} else {
|
||||
// Failed to save member
|
||||
// ToastHelper.showErrorToast(context, "Operation Failed!");
|
||||
// ToastHelper.showSuccessToast(context, 'Failed to Save...');
|
||||
print('Failed to Save...');
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1011,8 +940,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
print(response['data']);
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -1032,8 +959,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
print(response['data']);
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -1053,8 +978,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
print(response['data']);
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -1063,30 +986,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
}
|
||||
|
||||
void checkToCallRemoveEmpOrNot() {
|
||||
if (_topUpSiSwitcher == false &&
|
||||
_addOnsDependentSwitcher == false &&
|
||||
_topUpParentSiSwitcher == false) {
|
||||
removeAddonsGmcDependentToAPI();
|
||||
removeAddonsGmcSiToAPI();
|
||||
removeAddonsGmcParentSiToAPI();
|
||||
Navigator.pushNamed(context, 'empReviewDetails',
|
||||
arguments: {'siData': [], 'siParentData': [], 'dependentData': []});
|
||||
} else if (_topUpSiSwitcher == false) {
|
||||
removeAddonsGmcSiToAPI();
|
||||
Navigator.pushNamed(context, 'empReviewDetails',
|
||||
arguments: {'siData': [], 'siParentData': [], 'dependentData': []});
|
||||
} else if (_topUpParentSiSwitcher == false) {
|
||||
removeAddonsGmcParentSiToAPI();
|
||||
Navigator.pushNamed(context, 'empReviewDetails',
|
||||
arguments: {'siData': [], 'siParentData': [], 'dependentData': []});
|
||||
} else if (_addOnsDependentSwitcher == false) {
|
||||
removeAddonsGmcDependentToAPI();
|
||||
Navigator.pushNamed(context, 'empReviewDetails',
|
||||
arguments: {'siData': [], 'siParentData': [], 'dependentData': []});
|
||||
}
|
||||
}
|
||||
|
||||
void topUpSiCalculation(choosedSiValue) async {
|
||||
try {
|
||||
print(choosedSiValue);
|
||||
@ -1149,7 +1048,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1217,7 +1115,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1284,7 +1181,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
}
|
||||
} catch (error) {
|
||||
print('Error saving family members');
|
||||
// ToastHelper.showErrorToast(context, "Error saving family members");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,9 +1212,6 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
||||
'client_id': client_id,
|
||||
};
|
||||
|
||||
// Convert the list of objects to JSON
|
||||
// String formDataJson = jsonEncode(apiParams);
|
||||
|
||||
try {
|
||||
final response = await apiService.sendAddOnToAPI(apiParams);
|
||||
|
||||
|
||||
@ -8,14 +8,11 @@ import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import '../../models/environment.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../postEnrollment/chatbot.dart';
|
||||
@ -151,7 +148,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
fetchRelationshipList();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'phone');
|
||||
}
|
||||
@ -175,8 +171,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
prefs.setString('clientLogo', clientDetails['client']['client_logo']);
|
||||
prefs.setString('clientName', clientDetails['client']['client_name']);
|
||||
setState(() {
|
||||
// dynamic clientDetails = data['data'];
|
||||
// print(clientDetails);
|
||||
clientName = clientDetails['client']['client_name'];
|
||||
print(clientName);
|
||||
clientLogo = clientDetails['client']['client_logo'];
|
||||
@ -184,14 +178,10 @@ class _empDetailsState extends State<empDetails> {
|
||||
});
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -234,14 +224,10 @@ class _empDetailsState extends State<empDetails> {
|
||||
prefs.setString('selfEmpStatus', selfEmpStatus);
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -314,8 +300,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
gmcDataIsEmpty = 0;
|
||||
});
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -338,19 +322,11 @@ class _empDetailsState extends State<empDetails> {
|
||||
'dependent': dependent,
|
||||
});
|
||||
}
|
||||
// final List<String> relationships =
|
||||
// List<String>.from(data.map((item) => item['relationship_name']));
|
||||
// setState(() {
|
||||
// relationshipOptions = relationships;
|
||||
// });
|
||||
} else {
|
||||
throw Exception('Failed to fetch relationship list');
|
||||
}
|
||||
} catch (error) {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Error fetching relationship list: $error');
|
||||
print('Error fetching relationship list: $error');
|
||||
// Handle error accordingly, e.g., show a snackbar with an error message
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,9 +334,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
print(formType);
|
||||
var ageValidation = formType['age_validation'];
|
||||
print(ageValidation);
|
||||
// int min = int.parse(ageValidation['min']);
|
||||
// int max = int.parse(ageValidation['max']);
|
||||
// Ensure ageValidation is a Map and contains the expected values
|
||||
if (ageValidation is Map<String, dynamic>) {
|
||||
int min = ageValidation.containsKey('min')
|
||||
? int.tryParse(ageValidation['min'].toString()) ?? 0
|
||||
@ -381,16 +354,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
minDate = DateTime(now.year - max, now.month, now.day);
|
||||
print(minDate);
|
||||
|
||||
// if (formType['form_type'] == 'child') {
|
||||
// // For 'child' form type, allow 0-25 age
|
||||
// minDate = DateTime(now.year - 25, now.month, now.day);
|
||||
// maxDate = now;
|
||||
// } else {
|
||||
// // For other form types, allow 18-100 age
|
||||
// minDate = DateTime(1900);
|
||||
// maxDate = DateTime(now.year - 18, now.month, now.day);
|
||||
// }
|
||||
|
||||
// Ensure initialDate is within the range of minDate and maxDate
|
||||
DateTime initialDate =
|
||||
_selectedDate ?? maxDate; // Use maxDate if _selectedDate is null
|
||||
@ -413,8 +376,7 @@ class _empDetailsState extends State<empDetails> {
|
||||
colorScheme: ColorScheme.light(
|
||||
primary: Color(0xFFE26728), secondary: Color(0xFFE26728)),
|
||||
buttonTheme: ButtonThemeData(textTheme: ButtonTextTheme.primary),
|
||||
// dialogBackgroundColor:
|
||||
// Colors.white, // Background color of the dialog
|
||||
|
||||
iconTheme: IconThemeData(color: Color(0xFFE26728)),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
@ -855,7 +817,6 @@ class _empDetailsState extends State<empDetails> {
|
||||
: selfEmpStatus == 'enrolled'
|
||||
? CustomBottomNavigationBar(
|
||||
onTabChanged: (index) {
|
||||
// Add your navigation logic here
|
||||
// For example:
|
||||
if (index == 0) {
|
||||
Navigator.pushNamed(context, 'home');
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:intl/intl.dart';
|
||||
import 'package:nhance_app_pwa/customAppBar/enrollmentAppBar.dart';
|
||||
import 'package:nhance_app_pwa/pages/enrollment/service/api_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -166,7 +165,6 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
client_id = prefs.getString('client_id');
|
||||
print(client_id);
|
||||
|
||||
// print(empPrimaryId);
|
||||
// Call the API when the page enters
|
||||
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
||||
clientLogo = prefs.getString('clientLogo');
|
||||
@ -182,7 +180,6 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
primarySummary();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'phone');
|
||||
}
|
||||
@ -341,8 +338,6 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
gmcDataIsEmpty = 0;
|
||||
});
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -396,20 +391,14 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
topUpSiPolicies['gmc_si_topup']['eCardDownload'];
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -435,7 +424,6 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
print(topUpSiParentPolicies);
|
||||
});
|
||||
if (topUpSiParentPolicies.isNotEmpty) {
|
||||
// setState(() {
|
||||
topUpParentClientPolicyId =
|
||||
await topUpSiParentPolicies['gmc_si_parent_topup']
|
||||
['client_policy_id'];
|
||||
@ -487,22 +475,15 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
} else {
|
||||
showHideTopUpParentCard = 1;
|
||||
}
|
||||
// });
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
@ -526,7 +507,6 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
print('addOnsDependentPolicies');
|
||||
print(addOnsDependentPolicies);
|
||||
if (addOnsDependentPolicies.isNotEmpty) {
|
||||
// setState(() {
|
||||
addOnsDependentClientPolicyId =
|
||||
addOnsDependentPolicies['gmc_dependent_addon']
|
||||
['client_policy_id'];
|
||||
@ -560,20 +540,14 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
||||
addOnsDependentECardDownload =
|
||||
addOnsDependentPolicies['gmc_dependent_addon']['eCardDownload'];
|
||||
} else {
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'No data found in the response');
|
||||
print('No data found in the response');
|
||||
}
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response['code']}');
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -2,9 +2,7 @@ import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:nhance_app_pwa/pages/postEnrollment/service/svg_service.dart';
|
||||
import 'package:nhance_app_pwa/pages/verify.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
@ -83,14 +81,11 @@ class _loginState extends State<login> {
|
||||
}
|
||||
|
||||
Future<void> verifyMobileNumber() async {
|
||||
// _verifyPhoneNumber();
|
||||
// return;
|
||||
try {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
// var enteredMobileNumber = countryController.text + mobileController.text;
|
||||
var enteredMobileNumber = mobileController.text;
|
||||
final response = await http.post(
|
||||
Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
||||
@ -108,7 +103,6 @@ class _loginState extends State<login> {
|
||||
final SharedPreferences prefs =
|
||||
await SharedPreferences.getInstance();
|
||||
var enteredMobileNumber = mobileController.text;
|
||||
var countryCode = countryController.text;
|
||||
prefs.setString('empMobileNo', enteredMobileNumber);
|
||||
|
||||
_verifyPhoneNumber();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import 'package:dash_chat_2/dash_chat_2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nhance_app_pwa/pages/postEnrollment/service/api_service.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../customAppBar/customAppBar.dart';
|
||||
import 'data.dart';
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ class claimprocess extends StatefulWidget {
|
||||
|
||||
class _claimprocessState extends State<claimprocess> {
|
||||
late ApiService apiService;
|
||||
int _currentIndex = 0;
|
||||
bool isActive = true;
|
||||
dynamic _token;
|
||||
dynamic empCodeString;
|
||||
@ -70,7 +69,6 @@ class _claimprocessState extends State<claimprocess> {
|
||||
getCashlessAndReimbursement();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'login');
|
||||
}
|
||||
@ -363,24 +361,6 @@ class _claimprocessState extends State<claimprocess> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 20),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Please submit the Original claim documents along with duly filled claim form within 15 days from the date of discharge. ',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: Responsive.isDesktop(context)
|
||||
// ? 18
|
||||
// : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (cashLessClaimsDetails != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 20, left: 15),
|
||||
@ -568,24 +548,6 @@ class _claimprocessState extends State<claimprocess> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 20),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Please submit the Original claim documents along with duly filled claim form within 15 days from the date of discharge. ',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: Responsive.isDesktop(context)
|
||||
// ? 18
|
||||
// : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (reimbursementClaimsDetails != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 20, left: 15),
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
import 'dart:convert';
|
||||
import 'package:accordion/accordion.dart';
|
||||
import 'package:accordion/controllers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@ -136,11 +133,35 @@ class _claimsState extends State<claims> {
|
||||
print('check 1');
|
||||
if (response['success'] == true) {
|
||||
setState(() {
|
||||
trackClaimsList = response['data']
|
||||
.where((item) => item['department_name'] == 'Claims')
|
||||
.toList();
|
||||
List<dynamic> data = response['data'];
|
||||
|
||||
print('Data from response: $data');
|
||||
|
||||
trackClaimsList = data.where((item) {
|
||||
// Check if item is a Map and has the departmentId key
|
||||
if (item is Map<String, dynamic> &&
|
||||
item.containsKey('department_id')) {
|
||||
final departmentId = item['department_id'];
|
||||
|
||||
// Print each departmentId for debugging
|
||||
print('Item department_id: $departmentId');
|
||||
|
||||
// Ensure departmentId is an int or string, and compare
|
||||
if (departmentId is int) {
|
||||
return departmentId == 3 || departmentId == 4;
|
||||
} else if (departmentId is String) {
|
||||
return int.tryParse(departmentId) == 3 ||
|
||||
int.tryParse(departmentId) == 4;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).toList();
|
||||
|
||||
print('Filtered trackClaimsList: $trackClaimsList');
|
||||
reversedClaimsList = List<Map<String, dynamic>>.from(trackClaimsList);
|
||||
print('reversedClaimsList $reversedClaimsList');
|
||||
trackClaimsList = reversedClaimsList.reversed.toList();
|
||||
print('trackClaimsList $trackClaimsList');
|
||||
});
|
||||
print(trackClaimsList);
|
||||
} else {
|
||||
@ -595,12 +616,6 @@ class _claimsState extends State<claims> {
|
||||
trackClaimsList), // Replace 'yourDataList' with your actual data list
|
||||
),
|
||||
),
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
// children: [
|
||||
// ...generateTrackList(trackClaimsList),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: Responsive.isDesktop(context) ? 40 : 10),
|
||||
]),
|
||||
)),
|
||||
|
||||
@ -34,6 +34,13 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
dynamic policyStatus;
|
||||
dynamic policySubject;
|
||||
dynamic policyNo;
|
||||
dynamic hospitalName;
|
||||
dynamic admitDate;
|
||||
dynamic dischargeDate;
|
||||
dynamic claimAmount;
|
||||
dynamic member;
|
||||
dynamic accidentDate;
|
||||
dynamic departmentID;
|
||||
dynamic EmployeePolicy;
|
||||
List<Map<String, String>> employeeDetails = [];
|
||||
dynamic argumentsData;
|
||||
@ -77,11 +84,21 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -466,14 +483,7 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
//
|
||||
// },
|
||||
// child: Text('Reply'),
|
||||
// ),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
),
|
||||
),
|
||||
@ -510,8 +520,6 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
? null
|
||||
: CustomBottomNavigationBar(
|
||||
onTabChanged: (index) {
|
||||
// Add your navigation logic here
|
||||
// For example:
|
||||
if (index == 0) {
|
||||
Navigator.pushNamed(context, 'home');
|
||||
} else if (index == 1) {
|
||||
@ -552,38 +560,117 @@ class _claimtracklistformState extends State<claimtracklist> {
|
||||
}
|
||||
|
||||
Widget buildDesktopLayout(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Policy No', policyNo),
|
||||
buildExpandedColumn(context, 'Status', policyStatus),
|
||||
buildExpandedColumn(context, 'Subject', policySubject),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildMobileLayout(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Policy No', policyNo),
|
||||
// buildExpandedColumn(context, 'Policy No', policyNo),
|
||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||
buildExpandedColumn(context, 'Status', policyStatus),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Subject', policySubject),
|
||||
buildExpandedColumn(context, '', ''),
|
||||
],
|
||||
),
|
||||
if (departmentID == '4') // Conditional check for policy_type
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Member', member),
|
||||
buildExpandedColumn(context, 'Hospital Name', hospitalName),
|
||||
buildExpandedColumn(context, 'Claim Amount', claimAmount),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Admit Date', admitDate),
|
||||
buildExpandedColumn(context, 'Discharge Date', dischargeDate),
|
||||
buildExpandedColumn(context, '', ''),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (departmentID == '3') // Conditional check for policy_type
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Member', member),
|
||||
buildExpandedColumn(context, 'Accident Date', accidentDate),
|
||||
buildExpandedColumn(context, 'Claim Amount', claimAmount),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildMobileLayout(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Policy Name', policyName),
|
||||
buildExpandedColumn(context, 'Status', policyStatus),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Subject', policySubject),
|
||||
buildExpandedColumn(context, 'Member', member),
|
||||
],
|
||||
),
|
||||
if (departmentID == '4')
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Claim Amount', claimAmount),
|
||||
buildExpandedColumn(context, 'Hospital Name', hospitalName),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Admit Date', admitDate),
|
||||
buildExpandedColumn(
|
||||
context, 'Discharge Date', dischargeDate),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (departmentID == '3')
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
buildExpandedColumn(context, 'Claim Amount', claimAmount),
|
||||
buildExpandedColumn(context, 'Accident Date', accidentDate),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildExpandedColumn(
|
||||
BuildContext context, String title, String? value) {
|
||||
return Expanded(
|
||||
|
||||
@ -92,7 +92,6 @@ class _generalExclusionsDeductiblesState
|
||||
getCashlessAndReimbursement();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'login');
|
||||
}
|
||||
@ -105,15 +104,6 @@ class _generalExclusionsDeductiblesState
|
||||
print(response['data']);
|
||||
setState(() {
|
||||
generalExclusionsDetails = response['data'][3];
|
||||
// print(generalExclusionsDetails);
|
||||
// generalSectionName = generalExclusionsDetails['content_section'];
|
||||
// generalHeading = generalExclusionsDetails['heading'];
|
||||
// Map<String, dynamic> jsonData =
|
||||
// jsonDecode(generalExclusionsDetails['content']);
|
||||
// generalContent = Map<String, String>.from(jsonData);
|
||||
// print('generalContent');
|
||||
// print(generalContent);
|
||||
|
||||
type3 = response['data'][2];
|
||||
print(type3);
|
||||
type3SectionName = type3['content_section'];
|
||||
@ -276,16 +266,6 @@ class _generalExclusionsDeductiblesState
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Text(
|
||||
// type3Heading ?? '',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: Responsive.isDesktop(context)
|
||||
// ? 18
|
||||
// : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(height: 10),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
@ -481,23 +461,6 @@ class _generalExclusionsDeductiblesState
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 20),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// type4SectionName ?? '',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize:
|
||||
// Responsive.isDesktop(context) ? 18 : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (generalExclusionsDetails != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 20, left: 15),
|
||||
@ -595,23 +558,6 @@ class _generalExclusionsDeductiblesState
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 20),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// type4SectionName ?? '',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize:
|
||||
// Responsive.isDesktop(context) ? 18 : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (generalExclusionsDetails != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 20, left: 15),
|
||||
@ -709,23 +655,6 @@ class _generalExclusionsDeductiblesState
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 20),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// type4SectionName ?? '',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize:
|
||||
// Responsive.isDesktop(context) ? 18 : 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// color: Color(0xFF000000),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
if (generalExclusionsDetails != null)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 20, left: 15),
|
||||
|
||||
@ -95,7 +95,6 @@ class _helpState extends State<help> {
|
||||
getTrackClaimsList();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'login');
|
||||
}
|
||||
@ -151,9 +150,6 @@ class _helpState extends State<help> {
|
||||
});
|
||||
print(trackClaimsList);
|
||||
} else {
|
||||
// setState(() {
|
||||
// trackClaimsIsEmpty = 0;
|
||||
// });
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
}
|
||||
@ -996,7 +992,6 @@ class _helpState extends State<help> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
// Adjust space between icon and text
|
||||
Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Column(
|
||||
|
||||
@ -198,12 +198,6 @@ class _MyAppState extends State<MyApp> {
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
),
|
||||
// SizedBox(width: 5),
|
||||
// Image.asset(
|
||||
// 'assets/emoji.png', // Replace 'path_to_your_image' with the actual path to your image asset
|
||||
// width: 24, // Adjust the width as needed
|
||||
// height: 24, // Adjust the height as needed
|
||||
// ),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
@ -742,13 +736,6 @@ class _MyAppState extends State<MyApp> {
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Icon(
|
||||
// Icons.circle,
|
||||
// size: 5, // Your icon here
|
||||
// color: Color(
|
||||
// 0xFF785EFF), // Customize the icon color if needed
|
||||
// ),
|
||||
// SizedBox(width: 5),
|
||||
Text(
|
||||
policyHeading ?? '',
|
||||
textAlign: TextAlign.left,
|
||||
@ -884,20 +871,6 @@ class _MyAppState extends State<MyApp> {
|
||||
SizedBox(height: 7),
|
||||
],
|
||||
))),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerRight,
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.chevron_right,
|
||||
// color: Color(
|
||||
// 0xFFE26728), // Replace with your desired icon
|
||||
// size:
|
||||
// Responsive.isDesktop(context) ? 30 : 24,
|
||||
// ),
|
||||
// ),
|
||||
// ))
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:nhance_app_pwa/customAppBar/customAppBar.dart';
|
||||
import 'package:nhance_app_pwa/pages/postEnrollment/service/api_service.dart';
|
||||
@ -24,7 +24,7 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
dynamic empCodeString;
|
||||
dynamic empPrimaryId;
|
||||
dynamic client_id;
|
||||
dynamic policyList;
|
||||
List<Map<String, dynamic>> policyList = [];
|
||||
dynamic policyDataIsEmpty = 1;
|
||||
dynamic policyHeading;
|
||||
dynamic policyName;
|
||||
@ -38,11 +38,30 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
List<Map<String, dynamic>> policyNumberList = [];
|
||||
int? serviceId;
|
||||
int? policyNumberId;
|
||||
int? selectedMemberId;
|
||||
String? selectedMemberName;
|
||||
String? selectedServiceName;
|
||||
String? selectedPolicyNo;
|
||||
dynamic claimsDepartmentId;
|
||||
dynamic client_branch_id;
|
||||
dynamic policyTypeCondition;
|
||||
dynamic selfDetails;
|
||||
List<Map<String, dynamic>> employeePolicyList = [];
|
||||
|
||||
// Declare subjectController and bodyController as instance variables
|
||||
late TextEditingController subjectController;
|
||||
late TextEditingController messageController;
|
||||
late TextEditingController accidentDetailsController;
|
||||
late TextEditingController hospitalNameController;
|
||||
late TextEditingController claimAmountController;
|
||||
late TextEditingController admitDateController;
|
||||
late TextEditingController dischargeDateController;
|
||||
|
||||
DateTime? accidentDate;
|
||||
DateTime? admitDate;
|
||||
DateTime? dischargeDate;
|
||||
|
||||
List<Map<String, dynamic>> filteredPoliciesList = [];
|
||||
|
||||
// Create a unique form key for each accordion section
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
@ -52,13 +71,17 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
super.initState();
|
||||
subjectController = TextEditingController();
|
||||
messageController = TextEditingController();
|
||||
accidentDetailsController = TextEditingController();
|
||||
hospitalNameController = TextEditingController();
|
||||
claimAmountController = TextEditingController();
|
||||
admitDateController = TextEditingController();
|
||||
dischargeDateController = TextEditingController();
|
||||
apiService = ApiService(context); // Initialize ApiService here
|
||||
_loadToken();
|
||||
|
||||
// Check if fromClaimsPage is 0 and set serviceId to 'Claims' (id is 2)
|
||||
if (fromClaimsPage == 0) {
|
||||
setInitialServiceId();
|
||||
}
|
||||
// if (fromClaimsPage == 0) {
|
||||
// setInitialServiceId();
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
@ -66,6 +89,11 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
// Dispose the controllers to avoid memory leaks
|
||||
subjectController.dispose();
|
||||
messageController.dispose();
|
||||
accidentDetailsController.dispose();
|
||||
hospitalNameController.dispose();
|
||||
claimAmountController.dispose();
|
||||
admitDateController.dispose();
|
||||
dischargeDateController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -77,19 +105,45 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
argumentsData = arguments;
|
||||
claimsDetails = argumentsData['claimsDetails'];
|
||||
print(claimsDetails);
|
||||
|
||||
if (argumentsData.containsKey('fromClaimPage')) {
|
||||
fromClaimsPage = argumentsData['fromClaimPage'];
|
||||
print(fromClaimsPage);
|
||||
}
|
||||
if (fromClaimsPage == 0) {
|
||||
setInitialServiceId();
|
||||
claimsDepartmentId = claimsDetails['department_id'];
|
||||
print(claimsDepartmentId);
|
||||
|
||||
// employeePolicyList = claimsDetails['EmployeePolicy'];
|
||||
// print('employeePolicyList : $employeePolicyList');
|
||||
List<dynamic> empList = claimsDetails['EmployeePolicy'];
|
||||
setState(() {
|
||||
employeePolicyList = empList.map((memberList) {
|
||||
return {
|
||||
'id': int.parse(memberList['id']),
|
||||
'name': memberList['name'],
|
||||
};
|
||||
}).toList();
|
||||
print('employeePolicyList : $employeePolicyList');
|
||||
});
|
||||
|
||||
// if (claimsDetails['department_id'] == 3 ||
|
||||
// claimsDetails['department_id'] == 4) {
|
||||
policyTypeCondition = claimsDetails['department_id'];
|
||||
// } else {
|
||||
// String policyType = claimsDetails['policy_type'];
|
||||
// policyTypeCondition = policyType.split('-')[0].trim();
|
||||
// print('Output : $policyTypeCondition'); // Output: GMC
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInitialServiceId() {
|
||||
for (var department in departmentList) {
|
||||
if (department['name'] == 'Claims') {
|
||||
void setInitialServiceId(departmentListDetails) {
|
||||
print('departmentList : $departmentListDetails');
|
||||
for (var department in departmentListDetails) {
|
||||
print(department['id'] == claimsDepartmentId);
|
||||
if (department['id'] == claimsDepartmentId) {
|
||||
setState(() {
|
||||
serviceId = department['id'];
|
||||
});
|
||||
@ -117,9 +171,9 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
print(client_id);
|
||||
getActiveAndInactivePolicyDetails('Active');
|
||||
fetchDepartmentList();
|
||||
getSelfEmployeeProfile();
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'login');
|
||||
}
|
||||
@ -132,20 +186,12 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
print('check 1');
|
||||
final response = await apiService.getActiveAndInactivePolicyDetails(
|
||||
client_id!, empCodeString!, status, client_branch_id);
|
||||
print('check 1');
|
||||
print('check 1234 $response');
|
||||
if (response['status'] == 'success') {
|
||||
List<dynamic> policyListDetails = response['data'];
|
||||
setState(() {
|
||||
print(policyListDetails);
|
||||
policyNumberList = policyListDetails.map((policies) {
|
||||
return {
|
||||
'id': int.parse(policies['client_policy_id']),
|
||||
'policyName': policies['policy_name'],
|
||||
};
|
||||
}).toList();
|
||||
print('policyNumberList');
|
||||
print(policyNumberList);
|
||||
policyList = List<Map<String, dynamic>>.from(response['data']);
|
||||
});
|
||||
print(policyList);
|
||||
} else {
|
||||
setState(() {
|
||||
policyDataIsEmpty = 0;
|
||||
@ -154,6 +200,32 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getSelfEmployeeProfile() async {
|
||||
print(getSelfEmployeeProfile);
|
||||
if (client_id == null || empCodeString == null) {
|
||||
return;
|
||||
}
|
||||
print('check 1');
|
||||
final response = await apiService.getSelfEmployeeProfileDetails(
|
||||
client_id!, empCodeString!, client_branch_id!);
|
||||
print('check 1');
|
||||
if (response['status'] == 'success') {
|
||||
if (response.containsKey('data')) {
|
||||
setState(() {
|
||||
selfDetails = response['data'];
|
||||
print(selfDetails);
|
||||
});
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
} else {
|
||||
print('API request failed with status: ${response['status']}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> fetchDepartmentList() async {
|
||||
try {
|
||||
final response = await apiService.fetchDepartmentList();
|
||||
@ -169,7 +241,7 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
}).toList();
|
||||
});
|
||||
if (fromClaimsPage == 0) {
|
||||
setInitialServiceId();
|
||||
setInitialServiceId(departmentList);
|
||||
}
|
||||
} else {
|
||||
throw Exception('Failed to fetch department list');
|
||||
@ -179,17 +251,139 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
}
|
||||
}
|
||||
|
||||
void fetchPoliciesBasedOnService(int? serviceId) {
|
||||
if (policyList.isEmpty) {
|
||||
print('Policy list is empty. Ensure data is fetched before filtering.');
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
policyNumberId = null;
|
||||
policyTypeCondition = null;
|
||||
});
|
||||
print('1111 serviceId : $serviceId');
|
||||
if (serviceId == 3 || serviceId == 4) {
|
||||
print('2222');
|
||||
// Filter policies based on the department_id
|
||||
List<Map<String, dynamic>> filteredPolicies = policyList.where((policy) {
|
||||
return policy['department_id'] == serviceId;
|
||||
}).toList();
|
||||
|
||||
print('Filtered matching policies: $filteredPolicies');
|
||||
// if (filteredPolicies[0]['department_id'] == 3 ||
|
||||
// filteredPolicies[0]['department_id'] == 4) {
|
||||
setState(() {
|
||||
// Ensure unique IDs for dropdown values
|
||||
policyNumberList = filteredPolicies.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final policy = entry.value;
|
||||
|
||||
// Assign unique ID
|
||||
return {
|
||||
'policy_no': policy['policy_no'],
|
||||
'policy_name': policy['policy_name'],
|
||||
'id': index + 1 // Use index + 1 as a unique ID
|
||||
};
|
||||
}).toList();
|
||||
|
||||
print('policyNumberList : $policyNumberList');
|
||||
|
||||
policyTypeCondition = filteredPolicies[0]['department_id'];
|
||||
print('Output : $policyTypeCondition'); // Output: GMC
|
||||
});
|
||||
} else if (serviceId == 2) {
|
||||
setState(() {
|
||||
// Ensure unique IDs for dropdown values
|
||||
policyNumberList = policyList.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final policy = entry.value;
|
||||
|
||||
// Assign unique ID
|
||||
return {
|
||||
'policy_no': policy['policy_no'],
|
||||
'policy_name': policy['policy_name'],
|
||||
'id': index + 1 // Use index + 1 as a unique ID
|
||||
};
|
||||
}).toList();
|
||||
|
||||
print('policyNumberList : $policyNumberList');
|
||||
|
||||
policyTypeCondition = serviceId;
|
||||
print('Output : $policyTypeCondition');
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
policyTypeCondition = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void fetchMemberBasedOnPolicy(selectedPolicyNo) {
|
||||
if (policyList.isEmpty) {
|
||||
print('Policy list is empty. Ensure data is fetched before filtering.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (serviceId == 3 || serviceId == 4) {
|
||||
// Filter policies based on the department_id
|
||||
print('policyNumberId : $policyNumberId');
|
||||
|
||||
filteredPoliciesList = policyList.where((policy) {
|
||||
return policy['policy_no'] == selectedPolicyNo;
|
||||
}).toList();
|
||||
|
||||
print('Filtered matching policy_no: $filteredPoliciesList');
|
||||
|
||||
if (filteredPoliciesList.isNotEmpty) {
|
||||
// Assuming you need to access the first matched policy
|
||||
Map<String, dynamic> firstPolicy = filteredPoliciesList.first;
|
||||
|
||||
// Check if 'EmployeePolicy' key exists and is a List
|
||||
if (firstPolicy.containsKey('EmployeePolicy') &&
|
||||
firstPolicy['EmployeePolicy'] is List) {
|
||||
List<dynamic> empList = firstPolicy['EmployeePolicy'];
|
||||
|
||||
setState(() {
|
||||
employeePolicyList = empList.map((memberList) {
|
||||
return {
|
||||
'id': int.parse(memberList['id']),
|
||||
'name': memberList['name'],
|
||||
};
|
||||
}).toList();
|
||||
print('employeePolicyList : $employeePolicyList');
|
||||
});
|
||||
} else {
|
||||
print('No EmployeePolicy found in the filtered policy.');
|
||||
setState(() {
|
||||
employeePolicyList = []; // Clear the list or handle it as needed
|
||||
});
|
||||
}
|
||||
} else {
|
||||
print('No policies matched the selected policy number.');
|
||||
setState(() {
|
||||
employeePolicyList = []; // Clear the list or handle it as needed
|
||||
});
|
||||
}
|
||||
} else if (serviceId == 2) {
|
||||
filteredPoliciesList = policyList.where((policy) {
|
||||
return policy['policy_no'] == selectedPolicyNo;
|
||||
}).toList();
|
||||
|
||||
print('Filtered matching policy_no: $filteredPoliciesList');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> sendFormDataToApi() async {
|
||||
print('Help');
|
||||
print(employeePolicyList[0]['name']);
|
||||
print('Help $filteredPoliciesList');
|
||||
try {
|
||||
Map<String, dynamic> formData = {
|
||||
'opener': 'user',
|
||||
'department_id': serviceId,
|
||||
'subject': subjectController.text,
|
||||
'body': messageController.text,
|
||||
'policy_id': fromClaimsPage == 0
|
||||
? claimsDetails['client_policy_id']
|
||||
: policyNumberId,
|
||||
// 'policy_id': fromClaimsPage == 0
|
||||
// ? claimsDetails['client_policy_id']
|
||||
// : policyNumberId,
|
||||
'emp_code':
|
||||
decodedToken['emp_code'] != null ? decodedToken['emp_code'] : '',
|
||||
'mobile_number':
|
||||
@ -198,8 +392,49 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
? decodedToken['email_corporate']
|
||||
: '',
|
||||
'fullname': decodedToken['name'] != null ? decodedToken['name'] : '',
|
||||
'client_id': selfDetails['client_id'],
|
||||
'relationship': selfDetails['relationship'],
|
||||
'gender': selfDetails['gender'],
|
||||
'age': calculateAge(selfDetails['dob']).toString(),
|
||||
'policy_name': serviceId == 1
|
||||
? null
|
||||
: (fromClaimsPage == 0
|
||||
? claimsDetails['policy_name']
|
||||
: filteredPoliciesList[0]['policy_name']),
|
||||
'tpa': serviceId == 1
|
||||
? null
|
||||
: (fromClaimsPage == 0
|
||||
? claimsDetails['tpa_name']
|
||||
: filteredPoliciesList[0]['tpa_name']),
|
||||
'insurer': serviceId == 1
|
||||
? null
|
||||
: (fromClaimsPage == 0
|
||||
? claimsDetails['insurer_name']
|
||||
: filteredPoliciesList[0]['insurer_name']),
|
||||
};
|
||||
|
||||
// Conditionally add fields based on the first word in policy_type
|
||||
|
||||
if (policyTypeCondition == 3) {
|
||||
String formattedAccidentDate =
|
||||
DateFormat('yyyy-MM-dd').format(accidentDate!);
|
||||
// formData['accident_details'] = accidentDetailsController.text;
|
||||
formData['accident_details'] = messageController.text;
|
||||
formData['accident_date'] = formattedAccidentDate;
|
||||
formData['claim_amount'] = claimAmountController.text;
|
||||
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
||||
formData['member_name'] = selectedMemberName;
|
||||
formData['emp_policy_id'] = selectedMemberId;
|
||||
} else if (policyTypeCondition == 4) {
|
||||
formData['hospital_name'] = hospitalNameController.text;
|
||||
formData['admit_date'] = admitDateController.text;
|
||||
formData['discharge_date'] = dischargeDateController.text;
|
||||
formData['claim_amount'] = claimAmountController.text;
|
||||
formData['policyholder_name'] = employeePolicyList[0]['name'];
|
||||
formData['member_name'] = selectedMemberName;
|
||||
formData['emp_policy_id'] = selectedMemberId;
|
||||
}
|
||||
|
||||
// Convert integer values to strings
|
||||
formData = formData.map((key, value) => MapEntry(key, value.toString()));
|
||||
|
||||
@ -219,6 +454,57 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pickAccidentDate(BuildContext context) async {
|
||||
final DateTime? pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: accidentDate ?? DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now(),
|
||||
);
|
||||
if (pickedDate != null && pickedDate != accidentDate) {
|
||||
setState(() {
|
||||
accidentDate = pickedDate;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pickFromToDate(BuildContext context) async {
|
||||
final DateTimeRange? pickedDateRange = await showDateRangePicker(
|
||||
context: context,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
initialDateRange: admitDate != null && dischargeDate != null
|
||||
? DateTimeRange(start: admitDate!, end: dischargeDate!)
|
||||
: null,
|
||||
);
|
||||
|
||||
if (pickedDateRange != null) {
|
||||
setState(() {
|
||||
admitDate = pickedDateRange.start;
|
||||
dischargeDate = pickedDateRange.end;
|
||||
admitDateController.text = DateFormat('yyyy-MM-dd').format(admitDate!);
|
||||
dischargeDateController.text =
|
||||
DateFormat('yyyy-MM-dd').format(dischargeDate!);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
int calculateAge(String dob) {
|
||||
DateTime birthDate = DateTime.parse(dob); // Parse the dob string
|
||||
DateTime currentDate = DateTime.now();
|
||||
|
||||
int age = currentDate.year - birthDate.year;
|
||||
|
||||
// Adjust age if the birthday has not occurred yet this year
|
||||
if (currentDate.month < birthDate.month ||
|
||||
(currentDate.month == birthDate.month &&
|
||||
currentDate.day < birthDate.day)) {
|
||||
age--;
|
||||
}
|
||||
|
||||
return age;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -364,41 +650,181 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
key: formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
// Only show Select Policy field when Service value is 'Claims'
|
||||
|
||||
buildDropdownField(
|
||||
'Service',
|
||||
(value) {
|
||||
setState(() {
|
||||
serviceId = value;
|
||||
// Reset policyNumberId if Service is changed
|
||||
selectedServiceName =
|
||||
departmentList
|
||||
.firstWhere(
|
||||
(serList) =>
|
||||
serList[
|
||||
'id'] ==
|
||||
value,
|
||||
orElse: () =>
|
||||
{'name': ''},
|
||||
)['name'];
|
||||
policyNumberId =
|
||||
null;
|
||||
if (fromClaimsPage ==
|
||||
1) {
|
||||
// Reset policy number selection
|
||||
fetchPoliciesBasedOnService(
|
||||
serviceId);
|
||||
}
|
||||
});
|
||||
},
|
||||
fromClaimsPage == 0,
|
||||
departmentList,
|
||||
'name',
|
||||
serviceId, // Pass current serviceId as selectedValue
|
||||
),
|
||||
if (serviceId == 2 &&
|
||||
fromClaimsPage == 1)
|
||||
SizedBox(height: 15),
|
||||
if (fromClaimsPage == 1 &&
|
||||
(serviceId == 3 ||
|
||||
serviceId == 4 ||
|
||||
serviceId == 2))
|
||||
buildDropdownField(
|
||||
'Select Policy',
|
||||
(value) {
|
||||
setState(() {
|
||||
policyNumberId =
|
||||
value;
|
||||
selectedMemberId =
|
||||
null;
|
||||
String?
|
||||
selectedPolicyNo =
|
||||
policyNumberList.firstWhere(
|
||||
(item) =>
|
||||
item[
|
||||
'id'] ==
|
||||
value,
|
||||
orElse: () =>
|
||||
{
|
||||
'policy_no':
|
||||
''
|
||||
})['policy_no'];
|
||||
|
||||
if (selectedPolicyNo !=
|
||||
null &&
|
||||
fromClaimsPage ==
|
||||
1) {
|
||||
fetchMemberBasedOnPolicy(
|
||||
selectedPolicyNo);
|
||||
}
|
||||
});
|
||||
},
|
||||
fromClaimsPage == 0,
|
||||
policyNumberList,
|
||||
'policyName',
|
||||
'policy_no',
|
||||
policyNumberId, // Pass current policyNumberId as selectedValue
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
if (serviceId == 3 ||
|
||||
serviceId == 4)
|
||||
buildDropdownField(
|
||||
'Member Name',
|
||||
(value) {
|
||||
setState(() {
|
||||
selectedMemberId =
|
||||
value;
|
||||
selectedMemberName =
|
||||
employeePolicyList
|
||||
.firstWhere(
|
||||
(member) =>
|
||||
member[
|
||||
'id'] ==
|
||||
value,
|
||||
orElse: () => {
|
||||
'name': ''
|
||||
},
|
||||
)['name'];
|
||||
});
|
||||
},
|
||||
false,
|
||||
employeePolicyList,
|
||||
'name',
|
||||
selectedMemberId, // Pass current selectedMemberId as selectedValue
|
||||
),
|
||||
buildTextField('Subject',
|
||||
subjectController),
|
||||
SizedBox(height: 15),
|
||||
buildTextAreaField(
|
||||
'Message',
|
||||
serviceId == 3
|
||||
? 'Accident Details'
|
||||
: 'Message',
|
||||
messageController),
|
||||
SizedBox(height: 15),
|
||||
// if (policyTypeCondition ==
|
||||
// 3)
|
||||
// buildTextField(
|
||||
// 'Accident Details',
|
||||
// accidentDetailsController),
|
||||
SizedBox(height: 15),
|
||||
if (policyTypeCondition ==
|
||||
4)
|
||||
buildTextField(
|
||||
'Hospital Name',
|
||||
hospitalNameController),
|
||||
SizedBox(height: 15),
|
||||
if (policyTypeCondition ==
|
||||
3)
|
||||
buildDatePickerField(
|
||||
label:
|
||||
'Accident Date',
|
||||
selectedDate:
|
||||
accidentDate,
|
||||
allowFuture: false,
|
||||
onDateSelected:
|
||||
(selectedDate) {
|
||||
setState(() {
|
||||
accidentDate =
|
||||
selectedDate;
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
// buildTextAreaField(
|
||||
// 'Accident Details',
|
||||
// accidentDetailsController),
|
||||
// SizedBox(height: 15),
|
||||
if (policyTypeCondition ==
|
||||
4)
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
_pickFromToDate(
|
||||
context),
|
||||
child: InputDecorator(
|
||||
decoration:
|
||||
InputDecoration(
|
||||
labelText:
|
||||
'Admit Date - Discharge Date',
|
||||
border:
|
||||
OutlineInputBorder(),
|
||||
),
|
||||
child: Text(
|
||||
admitDate !=
|
||||
null &&
|
||||
dischargeDate !=
|
||||
null
|
||||
? '${admitDateController.text} to ${dischargeDateController.text}'
|
||||
: 'Select Admit and Discharge Dates',
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
if (serviceId == 3 ||
|
||||
serviceId == 4)
|
||||
buildTextField(
|
||||
'Claim Amount',
|
||||
claimAmountController,
|
||||
TextInputType.number,
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -517,31 +943,6 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDropdownField(
|
||||
String label,
|
||||
void Function(int?) onChanged,
|
||||
bool readOnly,
|
||||
List<Map<String, dynamic>> itemsList,
|
||||
String displayField) {
|
||||
return DropdownButtonFormField<int>(
|
||||
value: label == 'Service' ? serviceId : policyNumberId,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
items: itemsList.map<DropdownMenuItem<int>>((item) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: item['id'],
|
||||
child: Text(item[displayField]),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: readOnly ? null : onChanged,
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return 'Please select a $label';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTextAreaField(String label, TextEditingController controller) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
@ -555,4 +956,56 @@ class _planclaimsformState extends State<planclaimsform> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDatePickerField({
|
||||
required String label,
|
||||
required DateTime? selectedDate,
|
||||
required bool allowFuture,
|
||||
required ValueChanged<DateTime?> onDateSelected,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
_pickAccidentDate(context);
|
||||
},
|
||||
child: InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
child: Text(
|
||||
selectedDate != null
|
||||
? DateFormat('yyyy-MM-dd').format(selectedDate)
|
||||
: 'Select $label',
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDropdownField(
|
||||
String label,
|
||||
void Function(int?) onChanged,
|
||||
bool readOnly,
|
||||
List<Map<String, dynamic>> itemsList,
|
||||
String displayField,
|
||||
int? selectedValue // Added selectedValue parameter
|
||||
) {
|
||||
return DropdownButtonFormField<int>(
|
||||
value: selectedValue,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
items: itemsList.map<DropdownMenuItem<int>>((item) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: item['id'], // Ensure 'id' is correctly referenced
|
||||
child: Text(item[displayField]),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: readOnly ? null : onChanged,
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return 'Please select a $label';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:accordion/controllers.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_image_slideshow/flutter_image_slideshow.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
@ -17,7 +13,6 @@ import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:accordion/accordion.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class policies extends StatefulWidget {
|
||||
@ -86,7 +81,6 @@ class _policiesState extends State<policies> {
|
||||
print(client_id);
|
||||
} else {
|
||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
||||
// For now, let's navigate to the login screen
|
||||
ToastHelper.showErrorToast(context, 'Session Out');
|
||||
Navigator.pushReplacementNamed(context, 'login');
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class privacypolicy extends StatefulWidget {
|
||||
|
||||
@ -695,41 +695,3 @@ class _profileState extends State<profile> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// class AvatarDesign extends StatelessWidget {
|
||||
// final String gender;
|
||||
// final double radius;
|
||||
// final Color borderColor;
|
||||
// final double borderWidth;
|
||||
//
|
||||
// const AvatarDesign({
|
||||
// Key? key,
|
||||
// required this.gender,
|
||||
// this.radius = 40.0,
|
||||
// this.borderColor = Colors.white,
|
||||
// this.borderWidth = 2.0,
|
||||
// }) : super(key: key);
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// // Define URLs for male and female avatars
|
||||
// final String maleAvatarUrl = 'assets/Male.png';
|
||||
// final String femaleAvatarUrl = 'assets/Female.png';
|
||||
//
|
||||
// // Select the appropriate avatar URL based on the gender
|
||||
// final String avatarUrl = gender == 'M' ? maleAvatarUrl : femaleAvatarUrl;
|
||||
// return Container(
|
||||
// padding: EdgeInsets.all(borderWidth), // Add border width as padding
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: borderColor, // Border color
|
||||
// ),
|
||||
// child: CircleAvatar(
|
||||
// radius: radius,
|
||||
// backgroundImage: NetworkImage(avatarUrl),
|
||||
// backgroundColor: Color(
|
||||
// 0xFFFEEDED), // Background color in case the image fails to load
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class termsofuse extends StatefulWidget {
|
||||
const termsofuse({Key? key}) : super(key: key);
|
||||
|
||||
@ -8,7 +8,6 @@ import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:nhance_app_pwa/customAppBar/toastHelper.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../models/environment.dart';
|
||||
import '../postEnrollment/service/svg_service.dart';
|
||||
@ -147,9 +146,6 @@ class _pinPageState extends State<pinPage> {
|
||||
if (value.length != 4) {
|
||||
return 'Pin must be 4 digits';
|
||||
}
|
||||
// if (value != savedPin) {
|
||||
// return 'Incorrect pin';
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -181,27 +177,18 @@ class _pinPageState extends State<pinPage> {
|
||||
prefs.setString('clientLogo', clientDetails['client']['client_logo']);
|
||||
prefs.setString('clientName', clientDetails['client']['client_name']);
|
||||
setState(() {
|
||||
// dynamic clientDetails = data['data'];
|
||||
// print(clientDetails);
|
||||
clientName = clientDetails['client']['client_name'];
|
||||
print(clientName);
|
||||
clientLogo = clientDetails['client']['client_logo'];
|
||||
print(clientLogo);
|
||||
});
|
||||
} else {
|
||||
// Handle other status messages if needed
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'API request failed with status: ${data['status']}');
|
||||
print('API request failed with status: ${data['status']}');
|
||||
}
|
||||
} else {
|
||||
// Handle other status codes
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Request failed with status: ${response.statusCode}');
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle exceptions
|
||||
print('Exception occurred: $e');
|
||||
}
|
||||
}
|
||||
@ -393,9 +380,6 @@ class _pinPageState extends State<pinPage> {
|
||||
horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 4,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
// submittedPinTheme: submittedPinTheme,
|
||||
defaultPinTheme:
|
||||
defaultPinTheme,
|
||||
separatorBuilder: (index) =>
|
||||
|
||||
@ -135,19 +135,6 @@ class _changePinState extends State<changePin> {
|
||||
top: 0, // Example value for mobile
|
||||
);
|
||||
}
|
||||
// final defaultPinTheme = PinTheme(
|
||||
// width: 56,
|
||||
// height: 56,
|
||||
// textStyle: TextStyle(
|
||||
// fontSize: 20,
|
||||
// color: Color.fromRGBO(30, 60, 87, 1),
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color: Color.fromRGBO(234, 239, 243, 1)),
|
||||
// borderRadius: BorderRadius.circular(20),
|
||||
// ),
|
||||
// );
|
||||
|
||||
final defaultPinTheme = PinTheme(
|
||||
width: 56,
|
||||
@ -305,9 +292,6 @@ class _changePinState extends State<changePin> {
|
||||
horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 4,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
// submittedPinTheme: submittedPinTheme,
|
||||
defaultPinTheme:
|
||||
defaultPinTheme,
|
||||
separatorBuilder: (index) =>
|
||||
@ -410,10 +394,6 @@ class _changePinState extends State<changePin> {
|
||||
horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 4,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
// submittedPinTheme: submittedPinTheme,
|
||||
|
||||
defaultPinTheme:
|
||||
defaultPinTheme,
|
||||
separatorBuilder: (index) =>
|
||||
|
||||
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import '../../models/environment.dart';
|
||||
@ -191,7 +190,6 @@ class _pinSettingPageState extends State<pinSettingPage> {
|
||||
borderRadius: BorderRadius.circular(
|
||||
10), // Set border radius for the container
|
||||
),
|
||||
// padding: EdgeInsets.only(top: 0, bottom: 0, left: 10, right: 10),
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@ -317,9 +315,6 @@ class _pinSettingPageState extends State<pinSettingPage> {
|
||||
horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 4,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
// submittedPinTheme: submittedPinTheme,
|
||||
defaultPinTheme:
|
||||
defaultPinTheme,
|
||||
separatorBuilder: (index) =>
|
||||
@ -422,10 +417,6 @@ class _pinSettingPageState extends State<pinSettingPage> {
|
||||
horizontal: 0),
|
||||
child: Pinput(
|
||||
length: 4,
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// focusedPinTheme: focusedPinTheme,
|
||||
// submittedPinTheme: submittedPinTheme,
|
||||
|
||||
defaultPinTheme:
|
||||
defaultPinTheme,
|
||||
separatorBuilder: (index) =>
|
||||
|
||||
@ -145,58 +145,7 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
});
|
||||
}
|
||||
|
||||
// Future<void> checkTokenAvailability() async {
|
||||
// final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// final String? token = prefs.getString('token');
|
||||
// final String? emp_status = prefs.getString('emp_status');
|
||||
//
|
||||
// if (token != null && token.isNotEmpty) {
|
||||
// // Token available, navigate to home page
|
||||
// if (emp_status == 'enrolled') {
|
||||
// Navigator.pushReplacementNamed(context, 'home');
|
||||
// } else {
|
||||
// Navigator.pushReplacementNamed(context, 'empDetails');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<void> resendOTP(String mobileNumber) async {
|
||||
// print(mobileNumber);
|
||||
// // Update the UI as needed
|
||||
// setState(() {
|
||||
// _secondsRemaining = 60;
|
||||
// _isTimerRunning = true;
|
||||
// });
|
||||
// startTimer();
|
||||
// try {
|
||||
// final response = await http.post(
|
||||
// Uri.parse(Environment.apiUrl + 'verifyEmployeeNumber'),
|
||||
// body: json.encode({'mobile_number': mobileNumber}),
|
||||
// headers: {
|
||||
// HttpHeaders.contentTypeHeader: 'application/json',
|
||||
// },
|
||||
// );
|
||||
//
|
||||
// if (response.statusCode == 200) {
|
||||
// // Handle successful response
|
||||
// ToastHelper.showSuccessToast(context, 'OTP resent successfully');
|
||||
// } else {
|
||||
// // Handle other response status codes
|
||||
// ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
||||
// throw Exception('Failed to resend OTP');
|
||||
// }
|
||||
// } catch (e) {
|
||||
// // Handle API call errors
|
||||
// print('Error: $e');
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Failed to resend OTP. Please try again.');
|
||||
// }
|
||||
// }
|
||||
|
||||
void generateToken(bool otpVerifyStatus) async {
|
||||
// Retrieve the passed mobile number value
|
||||
// final String mobileNumber =
|
||||
// ModalRoute.of(context)!.settings.arguments as String;
|
||||
try {
|
||||
final response = await http.post(
|
||||
Uri.parse(Environment.apiUrl + 'getVerifiedUserData'),
|
||||
@ -272,7 +221,6 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
});
|
||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||
// Show a Snackbar if the OTP is invalid
|
||||
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||
print('Invalid OTP. Please try again');
|
||||
}
|
||||
} else {
|
||||
@ -289,8 +237,6 @@ class _MyVerifyState extends State<MyVerify> {
|
||||
print('Error: $e');
|
||||
ToastHelper.showWarningToast(context, 'Something went wrong');
|
||||
// Show a Snackbar if there's an error while verifying OTP
|
||||
// ToastHelper.showErrorToast(
|
||||
// context, 'Failed to verify OTP. Please try again.');
|
||||
print('Failed to verify OTP. Please try again.');
|
||||
}
|
||||
}
|
||||
|
||||
11
pubspec.yaml
11
pubspec.yaml
@ -35,7 +35,6 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
awesome_drawer_bar: ^1.2.0
|
||||
animated_bottom_navigation_bar: ^1.3.3
|
||||
pinput: ^4.0.0
|
||||
http: ^1.2.1
|
||||
@ -45,24 +44,16 @@ dependencies:
|
||||
jwt_decode: ^0.3.1
|
||||
google_fonts: ^6.2.1
|
||||
toastification: ^2.0.0
|
||||
flutter_animated_button: ^2.0.3
|
||||
carousel_slider: ^4.2.1
|
||||
flutter_image_slideshow: ^0.1.6
|
||||
intl: ^0.19.0
|
||||
accordion: ^2.6.0
|
||||
url_launcher: ^6.2.6
|
||||
flutter_svg: ^2.0.10+1
|
||||
webview_flutter: ^4.8.0
|
||||
webview_flutter_android: ^3.16.4
|
||||
path_provider: ^2.1.3
|
||||
dash_chat_2: ^0.0.21
|
||||
local_auth: ^2.2.0
|
||||
firebase_core: ^3.2.0
|
||||
firebase_messaging: ^15.0.3
|
||||
firebase_auth: ^5.1.2
|
||||
local_auth: ^2.2.0
|
||||
google_sign_in: ^6.2.1
|
||||
js: ^0.7.1
|
||||
firebase_auth_web: ^5.12.4
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="">
|
||||
<head>
|
||||
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
@ -58,7 +58,7 @@
|
||||
</head>
|
||||
<body style="overflow:hidden">
|
||||
<div id="loading_indicator" class="container overlay">
|
||||
<img class="indicator" src="assets/nhance-loader.gif">
|
||||
<img class="indicator" src="assets/nhance-loader.gif" alt="">
|
||||
</div>
|
||||
<script type="module">
|
||||
// Import the functions you need from the SDKs you need
|
||||
|
||||
Loading…
Reference in New Issue
Block a user