diff --git a/.env b/.env index 62cddb0..359dfdf 100644 --- a/.env +++ b/.env @@ -1,2 +1,4 @@ API_URL=https://venbait.in/nhance/dev/employeeRest/ -TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api/ \ No newline at end of file +TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api/ +BASE_HREF=/nhance/employee/dev/ +ENV=development \ No newline at end of file diff --git a/.env.development b/.env.development index 62cddb0..359dfdf 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,4 @@ API_URL=https://venbait.in/nhance/dev/employeeRest/ -TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api/ \ No newline at end of file +TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api/ +BASE_HREF=/nhance/employee/dev/ +ENV=development \ No newline at end of file diff --git a/.env.production b/.env.production index 62cddb0..a96bf9f 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,4 @@ -API_URL=https://venbait.in/nhance/dev/employeeRest/ -TICKET_API_URL=https://venbait.in/nhance/helpdesk/dev/api/ \ No newline at end of file +API_URL=https://venbait.in/nhance/uat/employeeRest/ +TICKET_API_URL=https://venbait.in/nhance/helpdesk/uat/api/ +BASE_HREF=/nhance/employee/uat/ +ENV=production \ No newline at end of file diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..6bf47a1 --- /dev/null +++ b/.env.test @@ -0,0 +1,4 @@ +API_URL=https://venbait.in/nhance/test/employeeRest/ +TICKET_API_URL=https://venbait.in/nhance/helpdesk/test/api/ +BASE_HREF=/nhance/employee/test/ +ENV=test \ No newline at end of file diff --git a/assets/ECard.svg b/assets/ECard.svg new file mode 100644 index 0000000..3fa7361 --- /dev/null +++ b/assets/ECard.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/Group.png b/assets/Group.png deleted file mode 100644 index 7777491..0000000 Binary files a/assets/Group.png and /dev/null differ diff --git a/assets/cashLess.svg b/assets/cashLess.svg new file mode 100644 index 0000000..120268c --- /dev/null +++ b/assets/cashLess.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/claimTab.svg b/assets/claimTab.svg new file mode 100644 index 0000000..a08f2f3 --- /dev/null +++ b/assets/claimTab.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/cliamHistory.svg b/assets/cliamHistory.svg new file mode 100644 index 0000000..291b786 --- /dev/null +++ b/assets/cliamHistory.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/contactUs.svg b/assets/contactUs.svg new file mode 100644 index 0000000..685c77a --- /dev/null +++ b/assets/contactUs.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/fileClaims.svg b/assets/fileClaims.svg new file mode 100644 index 0000000..c85465e --- /dev/null +++ b/assets/fileClaims.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/fileaclaims.svg b/assets/fileaclaims.svg new file mode 100644 index 0000000..e93f27e --- /dev/null +++ b/assets/fileaclaims.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/general.svg b/assets/general.svg new file mode 100644 index 0000000..1b09b78 --- /dev/null +++ b/assets/general.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/helpTab.svg b/assets/helpTab.svg new file mode 100644 index 0000000..df9b282 --- /dev/null +++ b/assets/helpTab.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/homeTab.svg b/assets/homeTab.svg new file mode 100644 index 0000000..5f3afdd --- /dev/null +++ b/assets/homeTab.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/needHelp.svg b/assets/needHelp.svg new file mode 100644 index 0000000..74a37a2 --- /dev/null +++ b/assets/needHelp.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/policyCoverage.svg b/assets/policyCoverage.svg new file mode 100644 index 0000000..13797bf --- /dev/null +++ b/assets/policyCoverage.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/profileTab.svg b/assets/profileTab.svg new file mode 100644 index 0000000..5d85a5a --- /dev/null +++ b/assets/profileTab.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/slider1.png b/assets/slider1.png deleted file mode 100644 index 66626b4..0000000 Binary files a/assets/slider1.png and /dev/null differ diff --git a/assets/slider2.png b/assets/slider2.png deleted file mode 100644 index 7ad4c86..0000000 Binary files a/assets/slider2.png and /dev/null differ diff --git a/assets/slider3.png b/assets/slider3.png deleted file mode 100644 index a4a9cdb..0000000 Binary files a/assets/slider3.png and /dev/null differ diff --git a/build_dev_apk.sh b/build_dev_apk.sh new file mode 100755 index 0000000..3eeb65f --- /dev/null +++ b/build_dev_apk.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Define the path to the .env file for development +ENV_FILE_PATH=".env.development" + +# Check if the .env file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env file for development to .env +cp $ENV_FILE_PATH .env + +# Build the APK for development +flutter build apk --debug + +# Optionally, remove the .env file after the build +# rm .env diff --git a/build_prod_apk.sh b/build_prod_apk.sh new file mode 100755 index 0000000..9261516 --- /dev/null +++ b/build_prod_apk.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Define the path to the .env file for production +ENV_FILE_PATH=".env.production" + +# Check if the .env file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env file for production to .env +cp $ENV_FILE_PATH .env + +# Build the APK for production +flutter build apk --release + +# Optionally, remove the .env file after the build +# rm .env diff --git a/build_test_apk.sh b/build_test_apk.sh new file mode 100755 index 0000000..ff990f3 --- /dev/null +++ b/build_test_apk.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Define the path to the .env file for testing +ENV_FILE_PATH=".env.test" + +# Check if the .env file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env file for testing to .env +cp $ENV_FILE_PATH .env + +# Build the APK for testing +flutter build apk --debug + +# Optionally, remove the .env file after the build +# rm .env diff --git a/build_web_dev.sh b/build_web_dev.sh new file mode 100755 index 0000000..c6ff6ab --- /dev/null +++ b/build_web_dev.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Define the path to the .env.development file +ENV_FILE_PATH=".env.development" + +# Check if the .env.development file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env.development file to .env +cp $ENV_FILE_PATH .env + +# Check if the BASE_HREF variable exists in the .env file +if ! grep -q BASE_HREF .env; then + echo "BASE_HREF not found in .env file" + exit 1 +fi + +# Extract the BASE_HREF value +BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2) + +# Check if the BASE_HREF value is empty +if [ -z "$BASE_HREF" ]; then + echo "BASE_HREF value is empty" + exit 1 +fi + +# Build the web app for development with base href +flutter build web --debug --base-href "$BASE_HREF" + +# Optionally, remove the .env file after the build +# rm .env diff --git a/build_web_production.sh b/build_web_production.sh new file mode 100755 index 0000000..7463034 --- /dev/null +++ b/build_web_production.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Define the path to the .env file for production +ENV_FILE_PATH=".env.production" + +# Check if the .env file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env file for production to .env +cp $ENV_FILE_PATH .env + +# Check if the BASE_HREF variable exists in the .env file +if ! grep -q BASE_HREF .env; then + echo "BASE_HREF not found in .env file" + exit 1 +fi + +# Extract the BASE_HREF value +BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2) + +# Check if the BASE_HREF value is empty +if [ -z "$BASE_HREF" ]; then + echo "BASE_HREF value is empty" + exit 1 +fi + +# Build the web app for production environment with base href +flutter build web --release --base-href "$BASE_HREF" + +# Optionally, remove the .env file after the build +# rm .env diff --git a/build_web_test.sh b/build_web_test.sh new file mode 100755 index 0000000..5bdc17d --- /dev/null +++ b/build_web_test.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Define the path to the .env file for testing +ENV_FILE_PATH=".env.test" + +# Check if the .env file exists +if [ ! -f $ENV_FILE_PATH ]; then + echo "$ENV_FILE_PATH does not exist" + exit 1 +fi + +# Copy the .env file for testing to .env +cp $ENV_FILE_PATH .env + +# Check if the BASE_HREF variable exists in the .env file +if ! grep -q BASE_HREF .env; then + echo "BASE_HREF not found in .env file" + exit 1 +fi + +# Extract the BASE_HREF value +BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2) + +# Check if the BASE_HREF value is empty +if [ -z "$BASE_HREF" ]; then + echo "BASE_HREF value is empty" + exit 1 +fi + +# Build the web app for test environment with base href +flutter build web --debug --base-href "$BASE_HREF" + +# Optionally, remove the .env file after the build +# rm .env diff --git a/lib/customAppBar/customAppBar.dart b/lib/customAppBar/customAppBar.dart index a6ccd03..f9b7246 100644 --- a/lib/customAppBar/customAppBar.dart +++ b/lib/customAppBar/customAppBar.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:adaptive_navbar/adaptive_navbar.dart'; -import 'package:nhance_app_pwa/customAppBar/responsive.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:nhance_app_pwa/customAppBar/responsive.dart'; class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { @override @@ -24,113 +24,91 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { await prefs.clear(); Navigator.pushNamed(context, 'hrLogin'); } - // Navigator.pushNamed(context, "phone"); } @override Widget build(BuildContext context) { final sw = MediaQuery.of(context).size.width; - return Scaffold( - backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar - appBar: PreferredSize( - preferredSize: preferredSize, - child: SafeArea( - child: Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.symmetric(horizontal: 16.0) - : EdgeInsets.symmetric(horizontal: 0), - child: Row( - children: [ - // Logo Column + return ClipRRect( + borderRadius: Responsive.isDesktop(context) + ? BorderRadius.zero + : BorderRadius.only( + bottomLeft: Radius.circular(32.0), + bottomRight: Radius.circular(32.0), + ), + child: AppBar( + backgroundColor: Color(0xFFFFFBDE), // Set background color for AppBar + toolbarHeight: kToolbarHeight, + titleSpacing: 0.0, + automaticallyImplyLeading: false, + title: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(horizontal: 16.0) + : EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + // Logo Column + Expanded( + flex: Responsive.isDesktop(context) ? 3 : 9, + child: Row( + mainAxisAlignment: Responsive.isDesktop(context) + ? MainAxisAlignment.spaceEvenly + : MainAxisAlignment + .start, // Adjust the alignment as needed + children: [ + Container( + margin: EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10), + width: Responsive.isDesktop(context) ? 230 : 170, + height: Responsive.isDesktop(context) ? 230 : 170, + child: Image.asset( + 'assets/nhance_client_logo.png', + fit: BoxFit.contain, // Adjust the fit as needed + ), + ), + ], + ), + ), + // AdaptiveNavBar Column + if (Responsive.isDesktop(context)) Expanded( - flex: Responsive.isDesktop(context) ? 3 : 9, - child: Row( - mainAxisAlignment: Responsive.isDesktop(context) - ? MainAxisAlignment.spaceEvenly - : MainAxisAlignment - .start, // Adjust the alignment as needed - children: [ - Container( - margin: EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10), - width: Responsive.isDesktop(context) ? 230 : 170, - height: Responsive.isDesktop(context) ? 230 : 170, - child: Image.asset( - 'assets/nhance_client_logo.png', - fit: BoxFit.contain, // Adjust the fit as needed - ), + flex: Responsive.isDesktop(context) ? 9 : 3, + child: AdaptiveNavBar( + screenWidth: sw, + backgroundColor: Color(0xFFFFFBDE), + leading: + Container(), // Set an empty container as we have the logo separately + title: Text(''), + navBarItems: [ + NavBarItem( + text: "Home", + onTap: () { + Navigator.pushNamed(context, 'home'); + }, + ), + NavBarItem( + text: "Claim", + onTap: () { + Navigator.pushNamed(context, 'claims'); + }, + ), + NavBarItem( + text: "Help", + onTap: () { + Navigator.pushNamed(context, 'help'); + }, + ), + NavBarItem( + text: "Profile", + onTap: () { + Navigator.pushNamed(context, 'profile'); + }, ), ], ), ), - // AdaptiveNavBar Column - if (Responsive.isDesktop(context)) - Expanded( - flex: Responsive.isDesktop(context) ? 9 : 3, - child: AdaptiveNavBar( - screenWidth: sw, - backgroundColor: Color(0xFFFFFCE5), - leading: - Container(), // Set an empty container as we have the logo separately - title: Text(''), - navBarItems: [ - NavBarItem( - text: "Home", - onTap: () { - Navigator.pushNamed(context, 'home'); - }, - ), - NavBarItem( - text: "Claim", - onTap: () { - Navigator.pushNamed(context, 'claims'); - }, - ), - NavBarItem( - text: "Help", - onTap: () { - Navigator.pushNamed(context, 'help'); - }, - ), - NavBarItem( - text: "Profile", - onTap: () { - Navigator.pushNamed(context, 'profile'); - }, - ), - ], - ), - ), - // Expanded( - // flex: Responsive.isDesktop(context) ? 1 : 3, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment - // .end, // Aligns the content to the right - // children: [ - // Icon(Icons.notifications, color: Colors.black), - // ], - // ), - // ], - // ), - // ), - // SizedBox(width: Responsive.isDesktop(context) ? 10 : 3), - // if (Responsive.isDesktop(context)) - // Expanded( - // flex: Responsive.isDesktop(context) ? 2 : 3, - // child: Row( - // children: [ - // Icon(Icons.account_circle, color: Colors.black), - // ], - // ), - // ), - // SizedBox(width: Responsive.isDesktop(context) ? 5 : 0), - ], - ), + ], ), ), ), diff --git a/lib/customAppBar/customFooter.dart b/lib/customAppBar/customFooter.dart index d4823d9..db7f7b2 100644 --- a/lib/customAppBar/customFooter.dart +++ b/lib/customAppBar/customFooter.dart @@ -4,7 +4,7 @@ class CustomFooter extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.all(16.0), + padding: EdgeInsets.all(8.0), color: Color(0xFFFFFBDE), // Background color of the footer child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/main.dart b/lib/main.dart index 14c5a91..a9376ae 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,15 +2,21 @@ import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:nhance_app_pwa/pages/claimprocess.dart'; import 'package:nhance_app_pwa/pages/claims.dart'; +import 'package:nhance_app_pwa/pages/claimtracklist.dart'; +import 'package:nhance_app_pwa/pages/generalexclusionsdeductibles.dart'; import 'package:nhance_app_pwa/pages/help.dart'; import 'package:nhance_app_pwa/pages/home.dart'; import 'package:nhance_app_pwa/pages/login.dart'; +import 'package:nhance_app_pwa/pages/planclaimsform.dart'; import 'package:nhance_app_pwa/pages/policies.dart'; +import 'package:nhance_app_pwa/pages/privacypolicy.dart'; import 'package:nhance_app_pwa/pages/profile.dart'; +import 'package:nhance_app_pwa/pages/termsofuse.dart'; import 'package:nhance_app_pwa/pages/verify.dart'; import 'models/environment.dart'; Future main() async { + WidgetsFlutterBinding.ensureInitialized(); await dotenv.load(fileName: Environment.fileName); runApp(MaterialApp( @@ -25,6 +31,12 @@ Future main() async { 'help': (context) => help(), 'claimprocess': (context) => claimprocess(), 'profile': (context) => profile(), + 'planclaimsform': (context) => planclaimsform(), + 'claimtracklist': (context) => claimtracklist(), + 'privacypolicy': (context) => privacypolicy(), + 'termsofuse': (context) => termsofuse(), + 'generalExclusionsDeductibles': (context) => + generalExclusionsDeductibles(), }, )); } diff --git a/lib/models/environment.dart b/lib/models/environment.dart index c289544..0d144de 100644 --- a/lib/models/environment.dart +++ b/lib/models/environment.dart @@ -3,17 +3,32 @@ import 'package:flutter_dotenv/flutter_dotenv.dart'; class Environment { static String get fileName { - if (kReleaseMode) { - return '.env.production'; - } + const bool isProduction = + bool.fromEnvironment('dart.vm.product', defaultValue: false); + const bool isTest = + bool.fromEnvironment('dart.vm.environment', defaultValue: false); - return '.env.development'; + if (isProduction) { + return '.env.production'; + } else if (isTest) { + return '.env.test'; + } else { + return '.env.development'; + } } static String get apiUrl { return dotenv.env['API_URL'] ?? 'API_URL not found!'; } + static String get baseHref { + return dotenv.env['BASE_HREF'] ?? 'BASE_HREF not found!'; + } + + static String get env { + return dotenv.env['ENV'] ?? 'ENV not found!'; + } + static String get apiUrlTicket { return dotenv.env['TICKET_API_URL'] ?? 'API_URL not found!'; } diff --git a/lib/pages/claimprocess.dart b/lib/pages/claimprocess.dart index 22fd1a9..a7ff625 100644 --- a/lib/pages/claimprocess.dart +++ b/lib/pages/claimprocess.dart @@ -11,6 +11,8 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; +import '../service/api_service.dart'; + class claimprocess extends StatefulWidget { const claimprocess({Key? key}) : super(key: key); @@ -19,29 +21,29 @@ class claimprocess extends StatefulWidget { } class _claimprocessState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; dynamic empCodeString; dynamic empPrimaryId; dynamic client_id; - dynamic policyList; - dynamic policyDataIsEmpty = 1; - dynamic policyHeading; - dynamic policyName; - dynamic EmployeePolicy; - List> employeeDetails = []; - dynamic argumentsData; + dynamic cashLessClaimsDetails; + dynamic reimbursementClaimsDetails; + dynamic cashLessSectionName; + dynamic cashLessHeading; + late Map cashLessContent; + late Map cashLessNotes; - void _onTabChanged(int index) { - setState(() { - _currentIndex = index; - }); - } + dynamic reimbursementSectionName; + dynamic reimbursementHeading; + late Map reimbursementContent; + late Map reimbursementNotes; @override void initState() { super.initState(); + apiService = ApiService(context); // Initialize ApiService here _loadToken(); } @@ -66,55 +68,57 @@ class _claimprocessState extends State { empPrimaryId = prefs.getString('empPrimaryId'); client_id = prefs.getString('client_id'); print(client_id); - getActiveAndInactivePolicyDetails('Active'); + 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, 'phone'); + Navigator.pushReplacementNamed(context, 'login'); } } - Future getActiveAndInactivePolicyDetails(Status) async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeActiveOrInactivePolicy?client_id=$client_id&emp_code=$empCodeString&type=$Status'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['status'] == 'success') { - setState(() { - policyList = data['data']; - }); - // Assuming data is a List - print(policyList); - } else { - setState(() { - policyDataIsEmpty = 0; - }); - // 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 { - setState(() { - policyDataIsEmpty = 0; - }); - // 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'); + Future getCashlessAndReimbursement() async { + final response = await apiService.getCashlessAndReimbursementToApi(); + print('check 1'); + if (response['status'] == 'success') { + print(response['data']); + setState(() { + cashLessClaimsDetails = response['data'][0]; + print(cashLessClaimsDetails); + cashLessSectionName = cashLessClaimsDetails['content_section']; + cashLessHeading = cashLessClaimsDetails['heading']; + Map jsonData = + jsonDecode(cashLessClaimsDetails['content']); + cashLessContent = Map.from(jsonData); + print('cashLessContent'); + print(cashLessContent); + + Map notesJsonData = + jsonDecode(cashLessClaimsDetails['notes']); + cashLessNotes = Map.from(notesJsonData); + print('cashLessNotes'); + print(cashLessNotes); + + reimbursementClaimsDetails = response['data'][1]; + print(reimbursementClaimsDetails); + reimbursementSectionName = + reimbursementClaimsDetails['content_section']; + reimbursementHeading = reimbursementClaimsDetails['heading']; + Map reimbursementJsonData = + jsonDecode(reimbursementClaimsDetails['content']); + reimbursementContent = Map.from(reimbursementJsonData); + print('reimbursementContent'); + print(reimbursementContent); + + Map reimbursementNotesJsonData = + jsonDecode(reimbursementClaimsDetails['notes']); + reimbursementNotes = + Map.from(reimbursementNotesJsonData); + print('reimbursementNotes'); + print(reimbursementNotes); + }); + } else { + print('API request failed with status: ${response['status']}'); } } @@ -122,392 +126,663 @@ class _claimprocessState extends State { Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar(), - body: Stack(children: [ - SingleChildScrollView( + body: Stack( + children: [ + SingleChildScrollView( child: Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * - 0.2, // 30% of screen width as horizontal padding - vertical: MediaQuery.of(context).size.height * - 0.03, // 5% of screen height as vertical padding - ) - : EdgeInsets.all(10), - color: Colors.white, - child: Column(children: [ - Container( padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 0, bottom: 0, left: 0, right: 0), + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * 0.2, + vertical: MediaQuery.of(context).size.height * 0.03, + ) + : EdgeInsets.all(10), + color: Colors.white, child: Column( - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: InkWell( - onTap: () { - Navigator.pushNamed(context, 'claims'); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - if (!Responsive.isDesktop(context)) - Icon( - Icons - .chevron_left, // Replace with your desired icon - color: Color(0xFF000000), - size: 30, - ), - SizedBox( - width: Responsive.isDesktop(context) - ? 0 - : 5), // Adjust space between icon and text - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Health Insurance Claim Process', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'claims'); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop(context)) + Icon( + Icons.chevron_left, + color: Color(0xFF000000), + size: 30, + ), + SizedBox( + width: Responsive.isDesktop(context) + ? 0 + : 5), + Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Health Insurance Claim Process', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + ], ), - ), - ], + ], + ), ), - ], + ), + ], + ), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + color: Color(0xFFF6FAFF), + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 6, + child: GestureDetector( + onTap: () { + setState(() { + isActive = true; + }); + }, + child: isActive + ? Material( + elevation: 5, + borderRadius: + BorderRadius.circular(10), + color: Colors.white, + child: TextButton( + onPressed: () {}, + style: TextButton.styleFrom( + padding: + EdgeInsets.symmetric( + horizontal: + Responsive.isDesktop( + context) + ? 80 + : 40, + vertical: + Responsive.isDesktop( + context) + ? 12 + : 7, + ), + ), + child: Text( + cashLessSectionName ?? '', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + fontWeight: + FontWeight.w500, + color: Color(0xFF593AFF), + ), + ), + ), + ) + : Text( + cashLessSectionName ?? '', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF636363), + ), + ), + ), + ), + Expanded( + flex: 6, + child: GestureDetector( + onTap: () { + setState(() { + isActive = false; + }); + }, + child: !isActive + ? Material( + elevation: 5, + borderRadius: + BorderRadius.circular(10), + color: Colors.white, + child: TextButton( + onPressed: () {}, + style: TextButton.styleFrom( + padding: + EdgeInsets.symmetric( + horizontal: + Responsive.isDesktop( + context) + ? 80 + : 40, + vertical: + Responsive.isDesktop( + context) + ? 12 + : 7, + ), + ), + child: Text( + reimbursementSectionName ?? + '', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + fontWeight: + FontWeight.w500, + color: Color(0xFF593AFF), + ), + ), + ), + ) + : Text( + reimbursementSectionName ?? '', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF636363), + ), + ), + ), + ), + ], + ), + ], + ), ), ), - ), - ], + ], + ), ), - // Add more rows as needed - ], - ), - ), - SizedBox(height: 15), - Container( - decoration: BoxDecoration( - color: - Color(0xFFF6FAFF), // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.center, - child: GestureDetector( - onTap: () { - setState(() { - isActive = true; - policyList.clear(); - }); - getActiveAndInactivePolicyDetails( - 'Active'); - }, - child: isActive - ? Material( - elevation: 5, - borderRadius: - BorderRadius.circular(10), - color: Colors.white, - child: TextButton( - onPressed: () {}, - style: TextButton.styleFrom( - padding: EdgeInsets.symmetric( - horizontal: Responsive - .isDesktop( - context) - ? 80 - : 40, - vertical: Responsive - .isDesktop( - context) - ? 12 - : 7), - // primary: Color(0xFF000000), - ), - child: Text( - 'Cashless Claim', - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 12, + SizedBox(height: 15), + if (isActive) + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + cashLessHeading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + cashLessContent.length * itemHeight; + double maxHeight = + constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: cashLessContent.length, + itemBuilder: (context, index) { + String key = cashLessContent.keys + .elementAt(index); + String value = + cashLessContent[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, fontWeight: - FontWeight.w500, - color: Color( - 0xFF593AFF)), - ), - ), - ) - : Text( - 'Cashless Claim', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF636363), - ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.center, - child: GestureDetector( - onTap: () { - setState(() { - isActive = false; - }); - }, - child: !isActive - ? Material( - elevation: 5, - borderRadius: - BorderRadius.circular(10), - color: Colors.white, - child: TextButton( - onPressed: () {}, - style: TextButton.styleFrom( - padding: EdgeInsets.symmetric( - horizontal: Responsive - .isDesktop( - context) - ? 80 - : 40, - vertical: Responsive - .isDesktop( - context) - ? 12 - : 7), - // primary: Color(0xFF000000), - ), - child: Text( - 'Reimbursement Claims', - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 12, - color: - Color(0xFF593AFF), - fontWeight: - FontWeight.w500, + FontWeight.w400, + color: + Color(0xFFE26728), + ), ), ), - ), - ) - : Text( - 'Reimbursement Claims', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF636363), - ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], ), - ), - )) - ], - ) - ], - ))), + ); + }, + ), + ); + }, + ), + ], + ), + ), + if (cashLessClaimsDetails != null) + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Notes', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 70; // Adjust item height based on content + double listViewHeight = + cashLessNotes.length * itemHeight; + double maxHeight = + constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: cashLessNotes.length, + itemBuilder: (context, index) { + String key = cashLessNotes.keys + .elementAt(index); + String value = + cashLessNotes[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ) + else + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + reimbursementHeading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + reimbursementContent.length * + itemHeight; + double maxHeight = + constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: + reimbursementContent.length, + itemBuilder: (context, index) { + String key = reimbursementContent + .keys + .elementAt(index); + String value = + reimbursementContent[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + if (reimbursementClaimsDetails != null) + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Notes', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 70; // Adjust item height based on content + double listViewHeight = + reimbursementNotes.length * + itemHeight; + double maxHeight = + constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: + reimbursementNotes.length, + itemBuilder: (context, index) { + String key = reimbursementNotes + .keys + .elementAt(index); + String value = + reimbursementNotes[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), ], ), ), - SizedBox(height: 15), - if (isActive) - Container( - decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '111 Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. Amet ut enim nisi in et sed ut feugiat pellentesque. Ultricies.', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. Amet ut enim nisi in et sed ut feugiat .', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. ', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. ', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ) - ], - ))), - ], - ), - ), - if (!isActive) - Container( - decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. Amet ut enim nisi in et sed ut feugiat pellentesque. Ultricies.', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. Amet ut enim nisi in et sed ut feugiat .', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. ', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - SizedBox(height: 10), - Text( - 'Lorem ipsum dolor sit amet consectetur. Fames duis nulla etiam eu. ', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF000000), - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), - ]), - )), - if (Responsive.isDesktop(context)) - Align( - alignment: Alignment.bottomCenter, - child: Container( - width: double.infinity, // Make the footer full width - child: CustomFooter(), - ), ), - ]), - // floatingActionButton: Responsive.isDesktop(context) - // ? null - // : FloatingActionButton( - // onPressed: () { - // // Add your onPressed logic here - // }, - // child: Icon(Icons.add), - // ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, + child: CustomFooter(), + ), + ), + ], + ), floatingActionButtonLocation: Responsive.isDesktop(context) ? null : FloatingActionButtonLocation.centerDocked, @@ -515,8 +790,6 @@ class _claimprocessState extends State { ? null : CustomBottomNavigationBar( onTabChanged: (index) { - // Add your navigation logic here - // For example: if (index == 0) { Navigator.pushNamed(context, 'home'); } else if (index == 1) { @@ -528,10 +801,10 @@ class _claimprocessState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", @@ -539,7 +812,6 @@ class _claimprocessState extends State { "Profile", "Help", ], - initialIndex: 1, // Initial index of the bottom navigation bar ), ); } diff --git a/lib/pages/claims.dart b/lib/pages/claims.dart index 07150ef..d71bc4e 100644 --- a/lib/pages/claims.dart +++ b/lib/pages/claims.dart @@ -2,6 +2,7 @@ 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'; import 'package:intl/intl.dart'; import 'package:jwt_decode/jwt_decode.dart'; @@ -14,6 +15,8 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; +import '../service/api_service.dart'; + class claims extends StatefulWidget { const claims({Key? key}) : super(key: key); @@ -22,6 +25,7 @@ class claims extends StatefulWidget { } class _claimsState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; @@ -37,14 +41,13 @@ class _claimsState extends State { dynamic policyName; dynamic EmployeePolicy; List> employeeDetails = []; - dynamic departmentList = []; dynamic argumentsData; dynamic empMobileNo; dynamic trackClaimsList; int trackClaimsActive = 1; int yourPlanActive = 0; - late TextEditingController messageController; int? serviceId; + dynamic client_branch_id; List> getDepartmentItems() { return [ @@ -63,13 +66,12 @@ class _claimsState extends State { @override void initState() { super.initState(); - messageController = TextEditingController(); + apiService = ApiService(context); _loadToken(); } @override void dispose() { - messageController.dispose(); super.dispose(); } @@ -84,6 +86,7 @@ class _claimsState extends State { // Decode the JWT token received from the API response decodedToken = Jwt.parseJwt(token); print(decodedToken); + client_branch_id = decodedToken['client_branch_id']; empMobileNo = decodedToken['mobile']; empName = decodedToken['name']; empCodeString = prefs.getString('empCode'); @@ -92,158 +95,54 @@ class _claimsState extends State { client_id = prefs.getString('client_id'); print(client_id); getActiveAndInactivePolicyDetails('Active'); - fetchDepartmentList(); - // getTrackClaimsList(); + 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, 'phone'); + Navigator.pushReplacementNamed(context, 'login'); } } - Future getActiveAndInactivePolicyDetails(Status) async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeActiveOrInactivePolicy?client_id=$client_id&emp_code=$empCodeString&type=$Status'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['status'] == 'success') { - setState(() { - policyList = data['data']; - }); - // Assuming data is a List - print(policyList); - } else { - setState(() { - policyDataIsEmpty = 0; - }); - // 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 { - setState(() { - policyDataIsEmpty = 0; - }); - // 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'); + Future getActiveAndInactivePolicyDetails(String status) async { + if (client_id == null || empCodeString == null) { + return; } - } - - Future sendFormDataToApi(Map formData) async { - try { - // Convert integer values to strings - formData = formData.map((key, value) => MapEntry(key, value.toString())); - - String ticketToken = Environment.ticketToken; // Replace with your API URL - final response = await http.post( - Uri.parse('${Environment.apiUrlTicket}tickets/create'), - body: formData, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Token': ticketToken, - }, - ); - - if (response.statusCode == 200) { - ToastHelper.showSuccessToast(context, 'Saved Successfully...'); - serviceId = null; - departmentList.clear(); - getActiveAndInactivePolicyDetails('Active'); - getTrackClaimsList(); - fetchDepartmentList(); - print('Form data submitted successfully'); - } else { - // Handle error response - print('Failed to submit form data: ${response.statusCode}'); - } - } catch (e) { - print('Error submitting form data: $e'); + print('check 1'); + final response = await apiService.getActiveAndInactivePolicyDetails( + client_id!, empCodeString!, status, client_branch_id); + print('check 1'); + if (response['status'] == 'success') { + setState(() { + policyList = response['data']; + }); + print(policyList); + } else { + setState(() { + policyDataIsEmpty = 0; + }); + print('API request failed with status: ${response['status']}'); } } Future getTrackClaimsList() async { - String ticketToken = Environment.ticketToken; - var url = Uri.parse(Environment.apiUrlTicket + - 'ticket/get_ticket_data?emp_code=$empCodeString&mobile_number=$empMobileNo'); - try { - var response = await http.get( - url, - headers: { - 'Token': ticketToken, - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['success'] == true) { - setState(() { - trackClaimsList = data['data']; - }); - // Assuming data is a List - print(trackClaimsList); - } else { - setState(() { - trackClaimsIsEmpty = 0; - }); - // 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 { - setState(() { - trackClaimsIsEmpty = 0; - }); - print('Request failed with status: ${response.statusCode}'); - } - } catch (e) { - // Handle exceptions - print('Exception occurred: $e'); + if (client_id == null || empCodeString == null) { + return; } - } - - Future fetchDepartmentList() async { - // Replace the URL with your API endpoint - String ticketToken = Environment.ticketToken; - final url = Uri.parse(Environment.apiUrlTicket + 'departments'); - try { - final response = await http.get( - url, - headers: { - 'Token': ticketToken, - }, - ); - if (response.statusCode == 200) { - dynamic data = jsonDecode(response.body); - print(data); - // Parse departments list - List departments = data['departments']; - print(departments); - setState(() { - departmentList = departments; - }); - print(departmentList); - } else { - throw Exception('Failed to fetch department list'); - } - } catch (error) { - print('Error fetching department list: $error'); - // Handle error accordingly, e.g., show a snackbar with an error message + print('check 1'); + final response = + await apiService.getTrackClaimsList(empMobileNo!, empCodeString!); + print('check 1'); + if (response['success'] == true) { + setState(() { + trackClaimsList = response['data']; + }); + print(trackClaimsList); + } else { + setState(() { + trackClaimsIsEmpty = 0; + }); + print('API request failed with status: ${response['status']}'); } } @@ -260,50 +159,6 @@ class _claimsState extends State { return formattedDate; } - void cancelPopUp() { - messageController.clear(); - } - - void cancelPopUpClaims() { - serviceId = null; - departmentList.clear(); - } - - void sendClaimsMessage(Map formData) async { - // formDataList.add({ - // 'relationship': formData['relationship'], - // 'name': formData['memberName'], - // 'dob': formData['dateOfBirth'], - // }); - - // Convert the list of objects to JSON - formData = formData.map((key, value) => MapEntry(key, value.toString())); - // Prepare the API request - String ticketToken = Environment.ticketToken; // Replace with your API URL - var url = Uri.parse(Environment.apiUrlTicket + 'messages/create'); - var response = await http.post( - url, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Token': ticketToken, // Add token to the Authorization header - }, - body: formData, - ); - - // Check the response - if (response.statusCode == 200) { - messageController.clear(); - ToastHelper.showSuccessToast(context, 'Saved Successfully...'); - messageController.clear(); - getTrackClaimsList(); - print('Form data sent successfully.'); - } else { - // Request failed, handle error - ToastHelper.showErrorToast(context, 'Failed'); - print('Failed to send form data. Error: ${response.reasonPhrase}'); - } - } - @override Widget build(BuildContext context) { dynamic arguments = ModalRoute.of(context)!.settings.arguments; @@ -334,8 +189,8 @@ class _claimsState extends State { child: Column(children: [ Container( padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 0, bottom: 0, left: 0, right: 0), + ? EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10) + : EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -375,7 +230,7 @@ class _claimsState extends State { ), ), Text( - 'We can help manage your claim quickly', + 'Manage your claims', textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: @@ -416,7 +271,7 @@ class _claimsState extends State { ), ), Text( - 'We can help manage your claim quickly', + 'Manage your claims', textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) @@ -435,6 +290,165 @@ class _claimsState extends State { ), ), SizedBox(height: 15), + MouseRegion( + cursor: SystemMouseCursors.click, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'help'); + }, + 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: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 10, right: 10) + : EdgeInsets.only( + top: 15, bottom: 15, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/contactUs.svg', + width: 25, + height: 25, + ), + SizedBox( + width: + 7), // Adjust space between icon and text + Text( + 'Contact Us', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 12, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + Icons + .chevron_right, // Replace with your desired icon + color: Color(0xFFE26728), + size: 20, + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + SizedBox(height: 15), + MouseRegion( + cursor: SystemMouseCursors.click, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'claimprocess'); + }, + 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: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 10, right: 10) + : EdgeInsets.only( + top: 15, bottom: 15, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/fileClaims.svg', + width: 25, + height: 25, + ), + SizedBox( + width: + 7), // Adjust space between icon and text + Text( + 'Know how to file a claim', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 12, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + Icons + .chevron_right, // Replace with your desired icon + color: Color(0xFFE26728), + size: 20, + ), + ], + ), + ), + ], + ), + ), + ])), + ), + ), + SizedBox(height: 15), Container( decoration: BoxDecoration( color: @@ -443,7 +457,7 @@ class _claimsState extends State { 5), // Set border radius for the container ), padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) + ? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25) : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -487,12 +501,12 @@ class _claimsState extends State { horizontal: Responsive .isDesktop( context) - ? 80 - : 40, + ? 140 + : 50, vertical: Responsive .isDesktop( context) - ? 12 + ? 15 : 7), // primary: Color(0xFF000000), ), @@ -503,7 +517,7 @@ class _claimsState extends State { .isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w500, color: Color( @@ -518,7 +532,7 @@ class _claimsState extends State { Responsive.isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w400, color: Color(0xFF636363), ), @@ -552,12 +566,12 @@ class _claimsState extends State { horizontal: Responsive .isDesktop( context) - ? 80 - : 40, + ? 130 + : 50, vertical: Responsive .isDesktop( context) - ? 12 + ? 15 : 7), // primary: Color(0xFF000000), ), @@ -569,7 +583,7 @@ class _claimsState extends State { .isDesktop( context) ? 18 - : 12, + : 14, color: Color(0xFF000000), fontWeight: @@ -585,7 +599,7 @@ class _claimsState extends State { Responsive.isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w400, color: Color(0xFF636363), ), @@ -605,11 +619,7 @@ class _claimsState extends State { Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - // ...generateCards(policyList), - if (!Responsive.isDesktop(context)) - ...generateAccordionsMobile(policyList), - if (Responsive.isDesktop(context)) - ...generateAccordionsWeb(policyList), + ...generateYourPlanList(policyList), ], ), if (trackClaimsList != null && trackClaimsList.length > 0) @@ -627,166 +637,6 @@ class _claimsState extends State { // ...generateTrackList(trackClaimsList), // ], // ), - SizedBox(height: 15), - 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: [ - Container( - padding: EdgeInsets.all( - 10), // Adjust padding as needed - decoration: BoxDecoration( - color: Color( - 0xFFFEF3C4), // Replace with your desired background color - borderRadius: BorderRadius.circular( - 8), // Add rounded corners if needed - ), - child: Icon( - Icons - .list_alt, // Replace with your desired icon - color: Color(0xFFFFC208), - size: 20, - ), - ), - SizedBox( - width: - 7), // Adjust space between icon and text - Text( - 'Contact an insurer', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF404040), - ), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Icon( - Icons - .chevron_right, // Replace with your desired icon - color: Color(0xFFE26728), - size: 20, - ), - ], - ), - ), - ], - ), - ), - ])), - SizedBox(height: 15), - 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: [ - Container( - padding: EdgeInsets.all( - 10), // Adjust padding as needed - decoration: BoxDecoration( - color: Color( - 0xFFD5F6FD), // Replace with your desired background color - borderRadius: BorderRadius.circular( - 8), // Add rounded corners if needed - ), - child: Icon( - Icons - .description, // Replace with your desired icon - color: Color(0xFF2DCCF6), - size: 20, - ), - ), - SizedBox( - width: - 7), // Adjust space between icon and text - Text( - 'Know how to file a claim', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF404040), - ), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Icon( - Icons - .chevron_right, // Replace with your desired icon - color: Color(0xFFE26728), - size: 20, - ), - ], - ), - ), - ], - ), - ), - ])), SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), ]), )), @@ -827,10 +677,10 @@ class _claimsState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", @@ -843,17 +693,11 @@ class _claimsState extends State { ); } - List generateAccordionsMobile(List data) { + List generateYourPlanList(List data) { return [ - GridView.builder( + ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 1, - crossAxisSpacing: 20.0, - mainAxisSpacing: 20.0, - childAspectRatio: 4.5, - ), itemCount: data.length, itemBuilder: (BuildContext context, int index) { var item = data[index]; @@ -867,7 +711,9 @@ class _claimsState extends State { return GestureDetector( onTap: () { - showClaimsPopup(item); + var details = {'claimsDetails': item, 'fromClaimPage': 0}; + Navigator.pushNamed(context, 'planclaimsform', + arguments: details); }, child: MouseRegion( cursor: SystemMouseCursors.click, @@ -893,12 +739,13 @@ class _claimsState extends State { child: Container( alignment: Alignment.centerLeft, child: Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Supplier', - style: TextStyle( + 'Insurer', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 : 12, fontWeight: FontWeight.w400, @@ -907,7 +754,8 @@ class _claimsState extends State { ), Text( policyName ?? '', - style: TextStyle( + textAlign: TextAlign.left, + style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 18 : 14, fontWeight: FontWeight.w600, @@ -923,12 +771,13 @@ class _claimsState extends State { child: Container( alignment: Alignment.centerRight, child: Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( 'Cover Amount', - style: TextStyle( + textAlign: TextAlign.end, + style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 : 12, fontWeight: FontWeight.w400, @@ -937,7 +786,8 @@ class _claimsState extends State { ), Text( '₹ $si_value', - style: TextStyle( + textAlign: TextAlign.end, + style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 18 : 14, fontWeight: FontWeight.w600, @@ -970,846 +820,155 @@ class _claimsState extends State { ]; } - List generateAccordionsWeb(List data) { - return data.map((item) { - String policyHeading = item['heading']; - String policyName = item['policy_name']; - String si_value = item['si_value']; - String policyEndDate = item['policy_end_date']; - String policyNo = item['policy_no']; - String clientPolicyId = item['client_policy_id']; - List employeePolicy = item['EmployeePolicy']; - - // Create unique controllers for each accordion section - TextEditingController openerController = TextEditingController(); - TextEditingController subjectController = TextEditingController(); - TextEditingController bodyController = TextEditingController(); - TextEditingController policyIdController = TextEditingController(); - TextEditingController empCodeController = TextEditingController(); - TextEditingController mobileNumberController = TextEditingController(); - TextEditingController emailController = TextEditingController(); - TextEditingController nameController = TextEditingController(); - - // Set initial values for controllers - policyIdController.text = clientPolicyId; - openerController.text = 'user'; - mobileNumberController.text = - decodedToken['mobile'] != null ? decodedToken['mobile'] : ''; - emailController.text = decodedToken['email_corporate'] != null - ? decodedToken['email_corporate'] - : ''; - empCodeController.text = - decodedToken['emp_code'] != null ? decodedToken['emp_code'] : ''; - nameController.text = - decodedToken['name'] != null ? decodedToken['name'] : ''; - - // Create a unique form key for each accordion section - final GlobalKey formKey = GlobalKey(); - - return Accordion( - headerBorderColor: Color(0xFFD9D9D9), - headerBorderColorOpened: Color(0xFFD9D9D9), - headerBorderWidth: 1, - headerBackgroundColor: Colors.white, - headerBackgroundColorOpened: Colors.white, - contentBackgroundColor: Colors.white, - contentBorderColor: Color(0xFFD9D9D9), - contentBorderWidth: 1, - contentHorizontalPadding: 20, - scaleWhenAnimating: true, - openAndCloseAnimation: true, - headerPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - sectionOpeningHapticFeedback: SectionHapticFeedback.heavy, - sectionClosingHapticFeedback: SectionHapticFeedback.light, - children: [ - AccordionSection( - isOpen: false, - contentVerticalPadding: 20, - rightIcon: Icon( - Icons.arrow_drop_down, - color: Color(0xFFE26728), - size: 25, - ), - header: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 8, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Supplier', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 16 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - policyName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 18 : 14, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ), - ), - ), - Expanded( - flex: 4, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - 'Cover Amount', - textAlign: TextAlign.end, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 16 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - '₹ $si_value', - textAlign: TextAlign.end, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 18 : 14, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ), - ), - ), - ], - ), - ), - content: Form( - key: formKey, - child: Column( - children: [ - !Responsive.isDesktop(context) - ? Column( - children: [ - buildDropdownField( - 'Service', (value) => serviceId = value), - buildTextField('Subject', subjectController), - ], - ) - : Row( - children: [ - Expanded( - child: buildDropdownField( - 'Service', (value) => serviceId = value)), - SizedBox(width: 16), - Expanded( - child: buildTextField( - 'Subject', subjectController)), - ], - ), - !Responsive.isDesktop(context) - ? Column( - children: [ - buildTextAreaField('Body', bodyController), - ], - ) - : Row( - children: [ - Expanded( - child: - buildTextAreaField('Body', bodyController)), - ], - ), - SizedBox(height: 20), - ElevatedButton( - onPressed: () { - if (formKey.currentState?.validate() ?? false) { - formKey.currentState?.save(); - - // Prepare form data - Map formData = { - 'opener': openerController.text, - 'department_id': serviceId, - 'subject': subjectController.text, - 'body': bodyController.text, - 'policy_id': policyIdController.text, - 'emp_code': empCodeController.text, - 'mobile_number': mobileNumberController.text, - 'email': emailController.text, - 'fullname': nameController.text, - }; - - sendFormDataToApi(formData).then((_) { - // Clear form fields after submission - subjectController.clear(); - bodyController.clear(); - serviceId = null; - formKey.currentState?.reset(); - departmentList.clear(); - }); - - // Send form data to API - // sendFormDataToApi(formData); - } - }, - child: Text( - 'Submit', - style: GoogleFonts.poppins(color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - ), - ), - ), - ], - ), - ), - ), - ], - ); - }).toList(); - } - - void showClaimsPopup(Map item) { - print(item); - String clientPolicyId = item['client_policy_id']; - // Create unique controllers for each accordion section - TextEditingController openerController = TextEditingController(); - TextEditingController subjectController = TextEditingController(); - TextEditingController bodyController = TextEditingController(); - TextEditingController policyIdController = TextEditingController(); - TextEditingController empCodeController = TextEditingController(); - TextEditingController mobileNumberController = TextEditingController(); - TextEditingController emailController = TextEditingController(); - TextEditingController nameController = TextEditingController(); - - // Set initial values for controllers - policyIdController.text = clientPolicyId; - openerController.text = 'user'; - mobileNumberController.text = - decodedToken['mobile'] != null ? decodedToken['mobile'] : ''; - emailController.text = decodedToken['email_corporate'] != null - ? decodedToken['email_corporate'] - : ''; - empCodeController.text = - decodedToken['emp_code'] != null ? decodedToken['emp_code'] : ''; - nameController.text = - decodedToken['name'] != null ? decodedToken['name'] : ''; - - // Create a unique form key for each accordion section - final GlobalKey formKey = GlobalKey(); - - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - elevation: 0, - backgroundColor: Colors.transparent, - content: SizedBox( - width: 1000, - child: SingleChildScrollView( - child: Card( - elevation: 0, - child: Padding( - padding: EdgeInsets.all(30), - child: Column( - children: [ - Container( - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Form( - key: formKey, - child: Column( - children: [ - !Responsive.isDesktop(context) - ? Column( - children: [ - buildDropdownField( - 'Service', - (value) => serviceId = - value), - buildTextField('Subject', - subjectController), - ], - ) - : Row( - children: [ - Expanded( - child: buildDropdownField( - 'Service', - (value) => - serviceId = - value)), - SizedBox(width: 16), - Expanded( - child: buildTextField( - 'Subject', - subjectController)), - ], - ), - !Responsive.isDesktop(context) - ? Column( - children: [ - buildTextAreaField('Body', - bodyController), - ], - ) - : Row( - children: [ - Expanded( - child: buildTextAreaField( - 'Body', - bodyController)), - ], - ), - ], - ), - ), - ], - ), - ), - ], - ), - SizedBox(height: 15), - Row( - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerLeft, - child: ElevatedButton( - onPressed: () { - // Close the dialog without sending data - cancelPopUpClaims(); - Navigator.of(context).pop(); - }, - child: Text( - 'Cancel', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: () { - if (formKey.currentState?.validate() ?? - false) { - formKey.currentState?.save(); - - // Prepare form data - Map formData = { - 'opener': openerController.text, - 'department_id': serviceId, - 'subject': subjectController.text, - 'body': bodyController.text, - 'policy_id': - policyIdController.text, - 'emp_code': empCodeController.text, - 'mobile_number': - mobileNumberController.text, - 'email': emailController.text, - 'fullname': nameController.text, - }; - - sendFormDataToApi(formData).then((_) { - // Clear form fields after submission - subjectController.clear(); - bodyController.clear(); - serviceId = null; - formKey.currentState?.reset(); - departmentList.clear(); - Navigator.of(context).pop(); - }); - } - }, - child: Text( - 'Save', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - ), - ), - ), - ), - ), - ], - ), - ], - ), - ), - ], - ), - ), - ), - ), - ), - ); - }, - ); - } - - Widget buildTextField(String label, TextEditingController controller, - [TextInputType keyboardType = TextInputType.text]) { - return TextFormField( - controller: controller, - decoration: InputDecoration(labelText: label), - keyboardType: keyboardType, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter the $label'; - } - return null; - }, - ); - } - - Widget buildDropdownField(String label, void Function(int?) onChanged) { - return DropdownButtonFormField( - value: serviceId, - decoration: InputDecoration(labelText: label), - items: departmentList.map>((department) { - return DropdownMenuItem( - value: int.parse(department['id']), - child: Text(department['name']), - ); - }).toList(), - onChanged: onChanged, - validator: (value) { - if (value == null) { - return 'Please select a $label'; - } - return null; - }, - ); - } - - Widget buildTextAreaField(String label, TextEditingController controller) { - return TextFormField( - controller: controller, - decoration: InputDecoration(labelText: label), - maxLines: 1, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter the $label'; - } - return null; - }, - ); - } - List generateTrackList(List data) { - return data.map((item) { - String claimsName = item['user_name']; - String claimsSubject = item['subject']; - String claimsReplies = item['replies']; - String claimsDepartmentName = item['department_name']; - List messageList = item['message_list']; + 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 claimsReplies = item['replies']; + String claimStatus = item['status_value']; + String claimsDepartmentName = item['department_name']; + List messageList = item['message_list']; - return Accordion( - headerBorderColor: Color(0xFFD9D9D9), - headerBorderColorOpened: Color(0xFFD9D9D9), - headerBorderWidth: 1, - headerBackgroundColor: Colors.white, - headerBackgroundColorOpened: Colors.white, - contentBackgroundColor: Colors.white, - contentBorderColor: Color(0xFFD9D9D9), - contentBorderWidth: 1, - contentHorizontalPadding: 20, - scaleWhenAnimating: true, - openAndCloseAnimation: true, - headerPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - sectionOpeningHapticFeedback: SectionHapticFeedback.heavy, - sectionClosingHapticFeedback: SectionHapticFeedback.light, - children: [ - AccordionSection( - isOpen: false, - contentVerticalPadding: 20, - rightIcon: Icon( - Icons.arrow_drop_down, - color: Color(0xFFE26728), - size: 25, - ), - header: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Department', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 16 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - claimsDepartmentName, - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ), - ), - ), - Expanded( - flex: 4, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Subject', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 16 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - claimsSubject ?? '', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ), - ), - ), - // Expanded( - // flex: 4, - // child: GestureDetector( - // onTap: () { - // showReplyPopup(item); - // }, - // child: Container( - // alignment: Alignment.center, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // Text( - // 'Reply', - // textAlign: TextAlign.center, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) ? 16 : 12, - // fontWeight: FontWeight.w400, - // color: Color(0xFF593AFF), - // decoration: - // TextDecoration.underline, // Underline text - // // Optionally change cursor to pointer - // // cursor: SystemMouseCursors.click, - // ), - // ), - // ], - // ), - // ), - // ), - // ), - ], + final Map statusColors = { + 'Open': Colors.green, + 'Answered': Colors.blue, + 'Awaiting Reply': Colors.orange, + 'Inprogress': Colors.yellow, + 'Closed': Colors.red, + }; + + // 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: () { + Navigator.pushNamed(context, 'claimtracklist', arguments: item); + }, + child: MouseRegion( + cursor: SystemMouseCursors.click, + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), ), - ), - content: SingleChildScrollView( - child: Column(children: [ - ...messageList.map((message) { - bool isUserMessage = message['staff_name'] == null; - String messageContent = message['message']; - String messageDate = message['date']; - print('isUserMessage'); - print(isUserMessage); - dynamic messagername; - if (isUserMessage) { - messagername = empName; - } else { - messagername = message['staff_name']; - } - - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: Align( - alignment: isUserMessage - ? Alignment.centerLeft - : Alignment.centerRight, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15.0), + ), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, // Center content horizontally + crossAxisAlignment: + CrossAxisAlignment.center, // Center content vertically + children: [ + Expanded( + flex: 4, child: Container( - constraints: BoxConstraints(maxWidth: 300), - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: isUserMessage - ? Colors.blue[100] - : Colors.green[100], - borderRadius: BorderRadius.circular(10), - ), + alignment: Alignment.centerLeft, child: Column( - crossAxisAlignment: isUserMessage - ? CrossAxisAlignment.start - : CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: isUserMessage - ? MainAxisAlignment.end - : MainAxisAlignment - .start, // Aligns children to the end (right) of the row - children: [ - Text( - messagername, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) - ? 16 - : 14, - fontWeight: FontWeight.w500, - color: Color(0xFF000000), - ), - ), - SizedBox(width: 5), - Icon( - Icons - .person, // Replace with your desired icon - color: Color( - 0xFFE26728), // Customize the icon color - size: 15, // Customize the icon size - ), - ], - ), Text( - messageContent, + 'Service', + textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop(context) ? 14 : 12, + Responsive.isDesktop(context) ? 16 : 12, fontWeight: FontWeight.w400, - color: Color(0xFF000000), + color: Color(0xFF979797), ), ), - SizedBox(height: 5), Text( - formatDate(messageDate), + claimsDepartmentName, + textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop(context) ? 12 : 10, - fontWeight: FontWeight.w400, - color: Color(0xFF636363), + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), ), ), ], ), ), ), - ); - }).toList(), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: ElevatedButton( - onPressed: () { - showReplyPopup(item); - }, - child: Text('Reply'), - ), - ), - ]), - )), - ], - ); - }).toList(); - } - - void showReplyPopup(Map item) { - print(item); - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), - elevation: 0, - backgroundColor: Colors.transparent, - content: SizedBox( - width: Responsive.isDesktop(context) ? 500 : 800, - child: SingleChildScrollView( - child: Card( - elevation: 0, - child: Padding( - padding: EdgeInsets.all(30), - child: Column( - children: [ - Container( - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: TextFormField( - controller: messageController, - onChanged: (value) => null, - decoration: InputDecoration( - border: OutlineInputBorder(), - hintText: 'Message', - labelText: 'Message', - contentPadding: - EdgeInsets.symmetric( - vertical: 10, - horizontal: 15), - ), - validator: (value) { - if (value == null || - value.isEmpty) { - return 'Message is required'; - } - return null; - }, - ), - ), - ], - ), + Expanded( + flex: 4, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Subject', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF979797), ), - ], - ), - SizedBox(height: 15), - Row( - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerLeft, - child: ElevatedButton( - onPressed: () { - // Close the dialog without sending data - cancelPopUp(); - Navigator.of(context).pop(); - }, - child: Text( - 'Cancel', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: () { - // Check if any of the fields are empty - if (messageController.text.isEmpty) { - ToastHelper.showWarningToast(context, - 'All fields are required'); - } else { - // Create a map to hold the form data - Map formData = { - 'ticket_id': item['id'], - 'replier': 'user', - 'message': messageController.text, - // Add more form fields as needed - }; - - // Call the function to send form data to API - sendClaimsMessage(formData); - - // Close the dialog - Navigator.of(context).pop(); - } - }, - child: Text( - 'Save', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - ), - ), - ), - ), + ), + Text( + claimsSubject ?? '', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), ), - ], - ), - ], + ), + ], + ), + ), + ), + Expanded( + flex: 3, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + claimStatus ?? '', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 12, + fontWeight: FontWeight.w400, + color: statusColor, + ), + ), + ], + ), + ), + ), + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: Icon( + Icons.chevron_right, + color: Color(0xFFE26728), + size: Responsive.isDesktop(context) ? 30 : 26, + ), ), ), ], @@ -1817,156 +976,9 @@ class _claimsState extends State { ), ), ), - ), - ); - }, - ); + ); + }, + ), + ]; } - -// List generateCards(List data) { - // print('generateCards'); - // print(data); - // return [ - // GridView.builder( - // shrinkWrap: true, - // physics: NeverScrollableScrollPhysics(), - // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - // crossAxisCount: 1, - // crossAxisSpacing: 20.0, - // mainAxisSpacing: 20.0, - // childAspectRatio: 10.5, - // ), - // itemCount: data.length, - // itemBuilder: (BuildContext context, int index) { - // var item = data[index]; - // String policyHeading = item['heading']; - // String policyName = item['policy_name']; - // String si_value = item['si_value']; - // String policyEndDate = item['policy_end_date']; - // List employeePolicy = item['EmployeePolicy']; - // - // return GestureDetector( - // onTap: () { - // Navigator.pushNamed(context, 'policies', arguments: item); - // }, - // 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: 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: 6, - // child: Container( - // alignment: Alignment.centerLeft, - // child: Column( - // mainAxisAlignment: - // MainAxisAlignment.start, - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Text( - // 'Supplier', - // textAlign: TextAlign.left, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) - // ? 16 - // : 12, - // fontWeight: FontWeight.w400, - // color: Color(0xFF979797), - // ), - // ), - // Text( - // policyName ?? '', - // textAlign: TextAlign.left, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) - // ? 18 - // : 16, - // fontWeight: FontWeight.w600, - // color: Color(0xFF000000), - // ), - // ), - // ], - // ))), - // Expanded( - // flex: 5, - // child: Container( - // alignment: Alignment.centerRight, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.end, - // crossAxisAlignment: - // CrossAxisAlignment.end, - // children: [ - // Text( - // 'Cover Amount', - // textAlign: TextAlign.end, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) - // ? 16 - // : 12, - // fontWeight: FontWeight.w400, - // color: Color(0xFF979797), - // ), - // ), - // Text( - // '₹ $si_value', - // textAlign: TextAlign.end, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) - // ? 18 - // : 16, - // fontWeight: FontWeight.w600, - // color: Color(0xFF000000), - // ), - // ), - // ], - // ))), - // Expanded( - // flex: 1, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Icon( - // Icons - // .chevron_right, // Replace with your desired icon - // color: Color(0xFFE26728), - // size: 20, - // ), - // ], - // ), - // ), - // ], - // ), - // ), - // ])), - // )); - // }, - // ), - // ]; - // } } diff --git a/lib/pages/claimtracklist.dart b/lib/pages/claimtracklist.dart new file mode 100644 index 0000000..5513108 --- /dev/null +++ b/lib/pages/claimtracklist.dart @@ -0,0 +1,512 @@ +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:shared_preferences/shared_preferences.dart'; +import '../customAppBar/customAppBar.dart'; +import '../customAppBar/customFooter.dart'; +import '../customAppBar/tabs.dart'; +import '../customAppBar/responsive.dart'; +import '../customAppBar/toastHelper.dart'; +import '../models/environment.dart'; +import 'package:http/http.dart' as http; + +import '../service/api_service.dart'; + +class claimtracklist extends StatefulWidget { + const claimtracklist({Key? key}) : super(key: key); + + @override + State createState() => _claimtracklistformState(); +} + +class _claimtracklistformState extends State { + late ApiService apiService; + dynamic _token; + dynamic empCodeString; + dynamic empPrimaryId; + dynamic client_id; + dynamic policyList; + dynamic policyDataIsEmpty = 1; + dynamic policyHeading; + dynamic policyName; + dynamic EmployeePolicy; + List> employeeDetails = []; + dynamic argumentsData; + dynamic decodedToken; + dynamic claimTrackMsgList; + dynamic empName; + dynamic ticketID; + late TextEditingController messageController; + + // Create a unique form key for each accordion section + final GlobalKey formKey = GlobalKey(); + + @override + void initState() { + super.initState(); + apiService = ApiService(context); // Initialize ApiService here + _loadToken(); + messageController = TextEditingController(); + } + + @override + void dispose() { + super.dispose(); + messageController.dispose(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + dynamic arguments = ModalRoute.of(context)!.settings.arguments; + if (arguments != null && arguments is Map) { + argumentsData = arguments; + print('argumentsData'); + print(argumentsData); + ticketID = argumentsData['id']; + claimTrackMsgList = argumentsData['message_list']; + print(claimTrackMsgList); + } + } + + Future _loadToken() async { + print('_loadToken'); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + final String? token = prefs.getString('token'); + if (token != null && token.isNotEmpty) { + setState(() { + _token = token; + }); + // Decode the JWT token received from the API response + decodedToken = Jwt.parseJwt(token); + print(decodedToken); + empName = decodedToken['name']; + empCodeString = prefs.getString('empCode'); + print(empCodeString); // Check if emp_code is correct + empPrimaryId = prefs.getString('empPrimaryId'); + client_id = prefs.getString('client_id'); + 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'); + } + } + + void sendClaimsMessage(Map formData) async { + try { + formData = formData.map((key, value) => MapEntry(key, value.toString())); + + final response = await apiService.sendClaimsMessageToApi(formData); + + if (response['success'] == 1) { + messageController.clear(); + ToastHelper.showSuccessToast(context, 'Saved Successfully...'); + messageController.clear(); + Navigator.pushNamed(context, 'claims', arguments: 0); + print('Form data sent successfully.'); + } else { + print('Failed to submit form data: ${response['status']}'); + } + } catch (e) { + print('Error submitting form data: $e'); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar(), + body: Stack(children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * + 0.2, // 30% of screen width as horizontal padding + vertical: MediaQuery.of(context).size.height * + 0.03, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(10), + color: Colors.white, + child: Column(children: [ + Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(15.0), // Set border radius here + ), + child: Container( + decoration: BoxDecoration( + color: Colors.white, // Set background color to white + borderRadius: BorderRadius.circular( + 15.0), // Set border radius for Container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only( + top: 10, + bottom: 10, + left: 10, + right: 10), // Add padding to the container + child: Row( + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, + bottom: 15, + left: 25, + right: 25) + : EdgeInsets.only( + top: 0, bottom: 0, left: 0, right: 0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed( + context, 'claims'); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop( + context)) + Icon( + Icons + .chevron_left, // Replace with your desired icon + color: Color(0xFF000000), + size: 30, + ), + SizedBox( + width: Responsive + .isDesktop( + context) + ? 0 + : 5), // Adjust space between icon and text + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + 'Claims Track', + textAlign: + TextAlign.start, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w600, + color: + Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + // Add more rows as needed + ], + ), + ), + SizedBox(height: 15), + Container( + child: SingleChildScrollView( + child: Column(children: [ + ...claimTrackMsgList.map((message) { + bool isUserMessage = + message['staff_name'] == null; + String messageContent = + message['message']; + String messageDate = message['date']; + print('isUserMessage'); + print(isUserMessage); + dynamic messagername; + if (isUserMessage) { + messagername = empName; + } else { + messagername = message['staff_name']; + } + + return Padding( + padding: const EdgeInsets.symmetric( + vertical: 4.0), + child: Align( + alignment: isUserMessage + ? Alignment.centerLeft + : Alignment.centerRight, + child: Container( + constraints: + BoxConstraints(maxWidth: 300), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: isUserMessage + ? Colors.blue[100] + : Colors.green[100], + borderRadius: + BorderRadius.circular(10), + ), + child: Column( + crossAxisAlignment: isUserMessage + ? CrossAxisAlignment.start + : CrossAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: isUserMessage + ? MainAxisAlignment.end + : MainAxisAlignment + .start, // Aligns children to the end (right) of the row + children: [ + Text( + messagername, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 16 + : 14, + fontWeight: + FontWeight.w500, + color: + Color(0xFF000000), + ), + ), + SizedBox(width: 5), + Icon( + Icons + .person, // Replace with your desired icon + color: Color( + 0xFFE26728), // Customize the icon color + size: + 15, // Customize the icon size + ), + ], + ), + Text( + messageContent, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 14 + : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 5), + Text( + formatDate(messageDate), + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 12 + : 10, + fontWeight: FontWeight.w400, + color: Color(0xFF636363), + ), + ), + ], + ), + ), + ), + ); + }).toList(), + Padding( + padding: const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + children: [ + Expanded( + flex: + Responsive.isDesktop(context) + ? 10 + : 9, + child: TextFormField( + controller: messageController, + onChanged: (value) => null, + decoration: InputDecoration( + border: OutlineInputBorder(), + hintText: 'Message', + labelText: 'Message', + contentPadding: + EdgeInsets.symmetric( + vertical: 10, + horizontal: 15), + ), + validator: (value) { + if (value == null || + value.isEmpty) { + return 'Message is required'; + } + return null; + }, + ), + ), + Expanded( + flex: + Responsive.isDesktop(context) + ? 2 + : 3, + child: Container( + alignment: + Alignment.centerRight, + child: ElevatedButton( + onPressed: () { + // Check if any of the fields are empty + if (messageController + .text.isEmpty) { + ToastHelper.showWarningToast( + context, + 'All fields are required'); + } else { + // Create a map to hold the form data + Map + formData = { + 'ticket_id': ticketID, + 'replier': 'user', + 'message': + messageController + .text, + // Add more form fields as needed + }; + + // Call the function to send form data to API + sendClaimsMessage( + formData); + } + }, + child: Text( + 'Reply', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: + ElevatedButton.styleFrom( + backgroundColor: + Color(0xFFE26728), + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 5), + ), + ), + ), + ), + ), + ], + ) + // ElevatedButton( + // onPressed: () { + // + // }, + // child: Text('Reply'), + // ), + ), + ]), + )), + ], + ))), + ], + ), + ), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), + ]), + )), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), + // floatingActionButton: Responsive.isDesktop(context) + // ? null + // : FloatingActionButton( + // onPressed: () { + // // Add your onPressed logic here + // }, + // child: Icon(Icons.add), + // ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // For example: + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], // Initial index of the bottom navigation bar + ), + ); + } + + String formatDate(String timestamp) { + // Convert the timestamp string to milliseconds + int milliseconds = int.parse(timestamp) * 1000; + + // Create a DateTime object from milliseconds + DateTime date = DateTime.fromMillisecondsSinceEpoch(milliseconds); + + // Format the DateTime object + String formattedDate = DateFormat('d MMM, y').format(date); + + return formattedDate; + } +} diff --git a/lib/pages/generalexclusionsdeductibles.dart b/lib/pages/generalexclusionsdeductibles.dart new file mode 100644 index 0000000..cc751f5 --- /dev/null +++ b/lib/pages/generalexclusionsdeductibles.dart @@ -0,0 +1,863 @@ +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/customAppBar.dart'; +import '../customAppBar/customFooter.dart'; +import '../customAppBar/tabs.dart'; +import '../customAppBar/responsive.dart'; +import '../customAppBar/toastHelper.dart'; +import '../models/environment.dart'; +import 'package:http/http.dart' as http; + +import '../service/api_service.dart'; + +class generalExclusionsDeductibles extends StatefulWidget { + const generalExclusionsDeductibles({Key? key}) : super(key: key); + + @override + State createState() => + _generalExclusionsDeductiblesState(); +} + +class _generalExclusionsDeductiblesState + extends State { + late ApiService apiService; + int _currentIndex = 0; + bool isActive = true; + dynamic _token; + dynamic empCodeString; + dynamic empPrimaryId; + dynamic client_id; + dynamic generalExclusionsDetails; + dynamic reimbursementClaimsDetails; + dynamic generalSectionName; + dynamic generalHeading; + late Map generalContent; + late Map generalNotes; + + dynamic type3; + dynamic type3SectionName; + dynamic type3Heading; + late Map type3Content; + + dynamic type4; + dynamic type4SectionName; + dynamic type4Heading; + late Map type4Content; + + dynamic type5; + dynamic type5SectionName; + dynamic type5Heading; + late Map type5Content; + + dynamic type6; + dynamic type6SectionName; + dynamic type6Heading; + late Map type6Content; + + dynamic type7; + dynamic type7SectionName; + dynamic type7Heading; + late Map type7Content; + + @override + void initState() { + super.initState(); + apiService = ApiService(context); // Initialize ApiService here + _loadToken(); + } + + @override + void dispose() { + super.dispose(); + } + + Future _loadToken() async { + print('_loadToken'); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + final String? token = prefs.getString('token'); + if (token != null && token.isNotEmpty) { + setState(() { + _token = token; + }); + // Decode the JWT token received from the API response + Map? decodedToken = Jwt.parseJwt(token); + print(decodedToken); + empCodeString = prefs.getString('empCode'); + print(empCodeString); // Check if emp_code is correct + empPrimaryId = prefs.getString('empPrimaryId'); + client_id = prefs.getString('client_id'); + print(client_id); + 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'); + } + } + + Future getCashlessAndReimbursement() async { + final response = await apiService.getCashlessAndReimbursementToApi(); + print('check 1'); + if (response['status'] == 'success') { + print(response['data']); + setState(() { + generalExclusionsDetails = response['data'][3]; + // print(generalExclusionsDetails); + // generalSectionName = generalExclusionsDetails['content_section']; + // generalHeading = generalExclusionsDetails['heading']; + // Map jsonData = + // jsonDecode(generalExclusionsDetails['content']); + // generalContent = Map.from(jsonData); + // print('generalContent'); + // print(generalContent); + + type3 = response['data'][2]; + print(type3); + type3SectionName = type3['content_section']; + type3Heading = type3['heading']; + Map type3ContentjsonData = + jsonDecode(type3['content']); + type3Content = Map.from(type3ContentjsonData); + print('type3Content'); + print(type3Content); + + type4 = response['data'][3]; + print(type4); + type4SectionName = type4['content_section']; + type4Heading = type4['heading']; + Map type4ContentjsonData = + jsonDecode(type4['content']); + type4Content = Map.from(type4ContentjsonData); + print('type4Content'); + print(type4Content); + + type5 = response['data'][4]; + print(type5); + type5SectionName = type5['content_section']; + type5Heading = type5['heading']; + Map type5ContentjsonData = + jsonDecode(type5['content']); + type5Content = Map.from(type5ContentjsonData); + print('type5Content'); + print(type5Content); + + type6 = response['data'][5]; + print(type6); + type6SectionName = type6['content_section']; + type6Heading = type6['heading']; + Map type6ContentjsonData = + jsonDecode(type6['content']); + type6Content = Map.from(type6ContentjsonData); + print('type6Content'); + print(type6Content); + + type7 = response['data'][6]; + print(type7); + type7SectionName = type7['content_section']; + type7Heading = type7['heading']; + Map type7ContentjsonData = + jsonDecode(type7['content']); + type7Content = Map.from(type7ContentjsonData); + print('type7Content'); + print(type7Content); + }); + } else { + print('API request failed with status: ${response['status']}'); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar(), + body: Stack( + children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * 0.2, + vertical: MediaQuery.of(context).size.height * 0.03, + ) + : EdgeInsets.all(10), + color: Colors.white, + child: Column( + children: [ + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'claims'); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop(context)) + Icon( + Icons.chevron_left, + color: Color(0xFF000000), + size: 30, + ), + SizedBox( + width: Responsive.isDesktop(context) + ? 0 + : 5), + Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'General Exclusions & Deductibles', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type3SectionName ?? '', + 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), + 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) { + double itemHeight = + 50; // Adjust item height based on content + double listViewHeight = + type3Content.length * itemHeight; + double maxHeight = constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: type3Content.length, + itemBuilder: (context, index) { + String key = type3Content.keys + .elementAt(index); + String value = type3Content[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type4Heading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + type4Content.length * itemHeight; + double maxHeight = constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: type4Content.length, + itemBuilder: (context, index) { + String key = type4Content.keys + .elementAt(index); + String value = type4Content[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type5Heading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + type5Content.length * itemHeight; + double maxHeight = constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: type5Content.length, + itemBuilder: (context, index) { + String key = type5Content.keys + .elementAt(index); + String value = type5Content[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type6Heading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + type6Content.length * itemHeight; + double maxHeight = constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: type6Content.length, + itemBuilder: (context, index) { + String key = type6Content.keys + .elementAt(index); + String value = type6Content[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + 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), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type7Heading ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + LayoutBuilder( + builder: (context, constraints) { + double itemHeight = + 40; // Adjust item height based on content + double listViewHeight = + type7Content.length * itemHeight; + double maxHeight = constraints.maxHeight; + + if (listViewHeight > maxHeight) { + listViewHeight = maxHeight; + } + + return Container( + height: listViewHeight, + child: ListView.builder( + itemCount: type7Content.length, + itemBuilder: (context, index) { + String key = type7Content.keys + .elementAt(index); + String value = type7Content[key]!; + return Padding( + padding: + const EdgeInsets.symmetric( + vertical: 8.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only( + left: 20.0), + child: Text( + "• ", + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + value, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w400, + color: + Color(0xFF000000), + ), + ), + ), + ], + ), + ); + }, + ), + ); + }, + ), + ], + ), + ), + ]), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), + ], + ), + ), + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, + child: CustomFooter(), + ), + ), + ], + ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], + ), + ); + } +} diff --git a/lib/pages/help.dart b/lib/pages/help.dart index d60baae..87f7611 100644 --- a/lib/pages/help.dart +++ b/lib/pages/help.dart @@ -11,6 +11,8 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; +import '../service/api_service.dart'; + class help extends StatefulWidget { const help({Key? key}) : super(key: key); @@ -19,6 +21,7 @@ class help extends StatefulWidget { } class _helpState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; @@ -32,6 +35,9 @@ class _helpState extends State { dynamic EmployeePolicy; List> employeeDetails = []; dynamic argumentsData; + dynamic accountManagerDetails; + dynamic accountManagerMobileNo; + dynamic accountManagerEmail; void _onTabChanged(int index) { setState(() { @@ -42,6 +48,7 @@ class _helpState extends State { @override void initState() { super.initState(); + apiService = ApiService(context); // Initialize ApiService here _loadToken(); } @@ -66,55 +73,37 @@ class _helpState extends State { empPrimaryId = prefs.getString('empPrimaryId'); client_id = prefs.getString('client_id'); print(client_id); - getActiveAndInactivePolicyDetails('Active'); + 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, 'phone'); + Navigator.pushReplacementNamed(context, 'login'); } } - Future getActiveAndInactivePolicyDetails(Status) async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeActiveOrInactivePolicy?client_id=$client_id&emp_code=$empCodeString&type=$Status'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['status'] == 'success') { - setState(() { - policyList = data['data']; - }); - // Assuming data is a List - print(policyList); - } else { - setState(() { - policyDataIsEmpty = 0; - }); - // 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 { - setState(() { - policyDataIsEmpty = 0; - }); - // 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'); + Future getSelfEmployeeProfile() async { + print(getSelfEmployeeProfile); + if (client_id == null || empCodeString == null) { + return; + } + print('check 1'); + final response = await apiService.getSelfEmployeeProfileDetails( + client_id!, empCodeString!); + print('check 1'); + if (response['status'] == 'success') { + print(response); + setState(() { + accountManagerDetails = response['AccountManagerDetails']; + print('accountManagerDetails'); + print(accountManagerDetails); + accountManagerEmail = accountManagerDetails['email']; + print(accountManagerEmail); + accountManagerMobileNo = accountManagerDetails['mobile']; + print(accountManagerMobileNo); + }); + } else { + print('API request failed with status: ${response['status']}'); } } @@ -142,6 +131,31 @@ class _helpState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ + if (!Responsive.isDesktop(context)) + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'home'); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon( + Icons + .chevron_left, // Replace with your desired icon + color: Color(0xFF000000), + size: 30, + ), + ], + ), + ), + ), + ], + ), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -225,8 +239,10 @@ class _helpState extends State { ), Container( constraints: BoxConstraints( - maxWidth: - 250), // Adjust the maximum width as needed + 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, @@ -271,7 +287,14 @@ class _helpState extends State { height: 150, alignment: Alignment.center, child: ElevatedButton( - onPressed: () {}, + onPressed: () { + var details = { + 'claimsDetails': '', + 'fromClaimPage': 1 + }; + Navigator.pushNamed(context, 'planclaimsform', + arguments: details); + }, child: Text( 'Raise a request', style: GoogleFonts.poppins(color: Colors.white), @@ -287,6 +310,98 @@ class _helpState extends State { ], ), ), + SizedBox(height: 15), + if (accountManagerDetails != null) + 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: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + 'Nhance Account Manager Contact', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF777777), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 10), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment + .center, // Center align the row + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + Icons.email, + size: 20, + color: Color(0xFFE26728), + ), + SizedBox( + width: 10), // Space between icon and text + Text( + accountManagerEmail ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + SizedBox( + height: + 10), // Space between email and mobile rows + Row( + mainAxisAlignment: MainAxisAlignment + .center, // Center align the row + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + Icons.smartphone, + size: 20, + color: Color(0xFFE26728), + ), + SizedBox( + width: 10), // Space between icon and text + Text( + accountManagerMobileNo ?? '', + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ) + ]), + ), SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), ]), )), @@ -327,10 +442,10 @@ class _helpState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", @@ -342,151 +457,4 @@ class _helpState extends State { ), ); } - - List generateCards(List data) { - print('generateCards'); - print(data); - return [ - GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 1, - crossAxisSpacing: 20.0, - mainAxisSpacing: 20.0, - childAspectRatio: 10.5, - ), - itemCount: data.length, - itemBuilder: (BuildContext context, int index) { - var item = data[index]; - String policyHeading = item['heading']; - String policyName = item['policy_name']; - String si_value = item['si_value']; - String policyEndDate = item['policy_end_date']; - List employeePolicy = item['EmployeePolicy']; - - return GestureDetector( - onTap: () { - Navigator.pushNamed(context, 'policies', arguments: item); - }, - 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: 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: 6, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Supplier', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 16 - : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - policyName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ))), - Expanded( - flex: 5, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - 'Cover Amount', - textAlign: TextAlign.end, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 16 - : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF979797), - ), - ), - Text( - '₹ $si_value', - textAlign: TextAlign.end, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - ), - ], - ))), - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Icon( - Icons - .chevron_right, // Replace with your desired icon - color: Color(0xFFE26728), - size: 20, - ), - ], - ), - ), - ], - ), - ), - ])), - )); - }, - ), - ]; - } } diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 7d13380..fbb9444 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_image_slideshow/flutter_image_slideshow.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; @@ -13,6 +14,8 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; +import '../service/api_service.dart'; + class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @@ -21,6 +24,7 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; @@ -33,6 +37,9 @@ class _MyAppState extends State { dynamic policyName; dynamic EmployeePolicy; dynamic emp_name; + dynamic client_branch_id; + List advertisementImages = []; + bool isLoading = true; void _onTabChanged(int index) { setState(() { @@ -43,6 +50,7 @@ class _MyAppState extends State { @override void initState() { super.initState(); + apiService = ApiService(context); // Initialize ApiService here _loadToken(); } @@ -58,65 +66,66 @@ class _MyAppState extends State { if (token != null && token.isNotEmpty) { setState(() { _token = token; + + // Decode the JWT token received from the API response + Map? decodedToken = Jwt.parseJwt(token); + print(decodedToken); + client_branch_id = decodedToken['client_branch_id']; + empCodeString = prefs.getString('empCode'); + print(empCodeString); // Check if emp_code is correct + empPrimaryId = prefs.getString('empPrimaryId'); + client_id = prefs.getString('client_id'); + print(client_id); + getAdvertisementSliderImage(); + getActiveAndInactivePolicyDetails('Active'); }); - // Decode the JWT token received from the API response - Map? decodedToken = Jwt.parseJwt(token); - print(decodedToken); - empCodeString = prefs.getString('empCode'); - print(empCodeString); // Check if emp_code is correct - empPrimaryId = prefs.getString('empPrimaryId'); - client_id = prefs.getString('client_id'); - print(client_id); - getActiveAndInactivePolicyDetails('Active'); } 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'); + Navigator.pushReplacementNamed(context, 'login'); } } - Future getActiveAndInactivePolicyDetails(Status) async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeActiveOrInactivePolicy?client_id=$client_id&emp_code=$empCodeString&type=$Status'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['status'] == 'success') { - setState(() { - policyList = data['data']; - emp_name = data['emp_name']; - }); - // Assuming data is a List - print(policyList); - } else { - setState(() { - policyDataIsEmpty = 0; - }); - // 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 { - setState(() { - policyDataIsEmpty = 0; - }); - // 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'); + Future getActiveAndInactivePolicyDetails(String status) async { + print(getActiveAndInactivePolicyDetails); + if (client_id == null || empCodeString == null) { + return; + } + print('check 1'); + final response = await apiService.getActiveAndInactivePolicyDetails( + client_id!, empCodeString!, status, client_branch_id); + print('check 1'); + if (response['status'] == 'success') { + setState(() { + policyList = response['data']; + emp_name = response['emp_name']; + }); + print(policyList); + } else { + setState(() { + policyDataIsEmpty = 0; + }); + print('API request failed with status: ${response['status']}'); + } + } + + Future getAdvertisementSliderImage() async { + final response = await apiService.getAdvertisementImageToApi(); + print('check 1'); + if (response['status'] == 'success') { + setState(() { + advertisementImages = List.from(response['data']); + print('advertisementImages'); + print(advertisementImages); + isLoading = false; + }); + // print(policyList); + } else { + print('API request failed with status: ${response['status']}'); + setState(() { + isLoading = false; + }); } } @@ -139,6 +148,11 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { + if (!Responsive.isDesktop(context)) + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarColor: Color(0xFFFFFBDE), // Status bar color + statusBarIconBrightness: Brightness.dark, // Light icons for status bar + )); return Scaffold( appBar: CustomAppBar(), body: Stack(children: [ @@ -151,18 +165,10 @@ class _MyAppState extends State { vertical: MediaQuery.of(context).size.height * 0.03, // 5% of screen height as vertical padding ) - : EdgeInsets.all(10), + : EdgeInsets.all(15), color: Colors.white, child: Column(children: [ Container( - decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -182,17 +188,17 @@ class _MyAppState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 20 - : 16, + : 20, fontWeight: FontWeight.w500, 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 - ), + // 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( @@ -200,7 +206,7 @@ class _MyAppState extends State { textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop(context) ? 12 : 10, + Responsive.isDesktop(context) ? 12 : 14, fontWeight: FontWeight.w400, color: Color(0xFF7A7A7A), ), @@ -210,89 +216,102 @@ class _MyAppState extends State { ], ), ), - Container( - decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: ImageSlideshow( - /// Width of the [ImageSlideshow]. - width: double.infinity, + SizedBox(height: 15), + if (advertisementImages != null) + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: isLoading + ? Center(child: CircularProgressIndicator()) + : advertisementImages.isEmpty + ? Center(child: Text("No images available")) + : Container( + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: ImageSlideshow( + /// Width of the [ImageSlideshow]. + width: double.infinity, - /// Height of the [ImageSlideshow]. - height: Responsive.isDesktop(context) ? 200 : 130, + /// Height of the [ImageSlideshow]. + height: 200, - /// The page to show when first creating the [ImageSlideshow]. - initialPage: 0, + /// The page to show when first creating the [ImageSlideshow]. + initialPage: 0, - /// The color to paint the indicator. - indicatorColor: Color(0xFFE26728), + /// The color to paint the indicator. + indicatorColor: + Color(0xFFE26728), - /// The color to paint behind th indicator. - indicatorBackgroundColor: Colors.grey, + /// The color to paint behind the indicator. + indicatorBackgroundColor: + Colors.grey, - /// The widgets to display in the [ImageSlideshow]. - /// Add the sample image file into the images folder - children: [ - Image.asset( - 'assets/slider1.png', - fit: BoxFit.cover, - ), - Image.asset( - 'assets/slider2.png', - fit: BoxFit.cover, - ), - Image.asset( - 'assets/slider3.png', - fit: BoxFit.cover, - ), - ], + /// The widgets to display in the [ImageSlideshow]. + children: + advertisementImages + .map( + (imageUrl) => + ClipRRect( + borderRadius: + BorderRadius + .circular( + 8), + child: Image + .network( + imageUrl, + fit: BoxFit + .cover, + ), + ), + ) + .toList(), - /// Called whenever the page in the center of the viewport changes. - onPageChanged: (value) { - print('Page changed: $value'); - }, + /// Called whenever the page in the center of the viewport changes. + onPageChanged: (value) { + print( + 'Page changed: $value'); + }, - /// Auto scroll interval. - /// Do not auto scroll with null or 0. - autoPlayInterval: 3000, + /// Auto scroll interval. + /// Do not auto scroll with null or 0. + autoPlayInterval: 3000, - /// Loops back to first slide. - isLoop: true, - ), - ), - ], + /// Loops back to the first slide. + isLoop: true, + ), + ), + ], + ), + ), + ), + ], + ), + ), ), ), - ), - ], + ], + ), ), - ), + SizedBox(height: 15), Container( - decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -312,7 +331,7 @@ class _MyAppState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 18 - : 16, + : 18, fontWeight: FontWeight.w500, color: Color(0xFF000000), ), @@ -324,7 +343,7 @@ class _MyAppState extends State { textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop(context) ? 12 : 10, + Responsive.isDesktop(context) ? 12 : 14, fontWeight: FontWeight.w400, color: Color(0xFF7A7A7A), ), @@ -343,7 +362,7 @@ class _MyAppState extends State { 5), // Set border radius for the container ), padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) + ? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25) : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -385,8 +404,8 @@ class _MyAppState extends State { horizontal: Responsive .isDesktop( context) - ? 80 - : 40, + ? 160 + : 60, vertical: Responsive .isDesktop( context) @@ -400,7 +419,7 @@ class _MyAppState extends State { .isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w500, color: Color( @@ -415,7 +434,7 @@ class _MyAppState extends State { Responsive.isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w400, color: Color(0xFF636363), ), @@ -448,8 +467,8 @@ class _MyAppState extends State { horizontal: Responsive .isDesktop( context) - ? 80 - : 40, + ? 150 + : 60, vertical: Responsive .isDesktop( context) @@ -465,7 +484,7 @@ class _MyAppState extends State { .isDesktop( context) ? 18 - : 12, + : 14, color: Color(0xFF593AFF), fontWeight: @@ -481,7 +500,7 @@ class _MyAppState extends State { Responsive.isDesktop( context) ? 18 - : 12, + : 14, fontWeight: FontWeight.w400, color: Color(0xFF636363), ), @@ -543,10 +562,10 @@ class _MyAppState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", diff --git a/lib/pages/login.dart b/lib/pages/login.dart index f8ff537..7db04ae 100644 --- a/lib/pages/login.dart +++ b/lib/pages/login.dart @@ -507,12 +507,26 @@ class _loginState extends State { color: Colors.black, fontSize: 9, ), - children: [ - TextSpan( - text: 'privacy policy ', - style: GoogleFonts.poppins( - color: Color(0xFF00989E), - fontSize: 9, + children: [ + WidgetSpan( + child: MouseRegion( + cursor: + SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + Navigator.pushNamed(context, + 'privacypolicy'); + }, + child: Text( + 'privacy policy ', + style: GoogleFonts.poppins( + color: Color(0xFF00989E), + fontSize: 9, + decoration: TextDecoration + .underline, + ), + ), + ), ), ), TextSpan( @@ -522,11 +536,25 @@ class _loginState extends State { fontSize: 9, ), ), - TextSpan( - text: 'terms of use', - style: GoogleFonts.poppins( - color: Color(0xFF00989E), - fontSize: 9, + WidgetSpan( + child: MouseRegion( + cursor: + SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + Navigator.pushNamed( + context, 'termsofuse'); + }, + child: Text( + 'terms of use', + style: GoogleFonts.poppins( + color: Color(0xFF00989E), + fontSize: 9, + decoration: TextDecoration + .underline, + ), + ), + ), ), ), ], diff --git a/lib/pages/planclaimsform.dart b/lib/pages/planclaimsform.dart new file mode 100644 index 0000000..3d2e1c0 --- /dev/null +++ b/lib/pages/planclaimsform.dart @@ -0,0 +1,628 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:jwt_decode/jwt_decode.dart'; +import 'package:nhance_app_pwa/pages/policies.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import '../customAppBar/customAppBar.dart'; +import '../customAppBar/customFooter.dart'; +import '../customAppBar/tabs.dart'; +import '../customAppBar/responsive.dart'; +import '../customAppBar/toastHelper.dart'; +import '../models/environment.dart'; +import 'package:http/http.dart' as http; + +import '../service/api_service.dart'; + +class planclaimsform extends StatefulWidget { + const planclaimsform({Key? key}) : super(key: key); + + @override + State createState() => _planclaimsformState(); +} + +class _planclaimsformState extends State { + late ApiService apiService; + dynamic _token; + dynamic empCodeString; + dynamic empPrimaryId; + dynamic client_id; + dynamic policyList; + dynamic policyDataIsEmpty = 1; + dynamic policyHeading; + dynamic policyName; + dynamic EmployeePolicy; + List> employeeDetails = []; + dynamic argumentsData; + dynamic claimsDetails; + int? fromClaimsPage; + dynamic decodedToken; + List> departmentList = []; + List> policyNumberList = []; + int? serviceId; + int? policyNumberId; + dynamic client_branch_id; + + // Declare subjectController and bodyController as instance variables + late TextEditingController subjectController; + late TextEditingController messageController; + + // Create a unique form key for each accordion section + final GlobalKey formKey = GlobalKey(); + + @override + void initState() { + super.initState(); + subjectController = TextEditingController(); + messageController = 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(); + } + } + + @override + void dispose() { + // Dispose the controllers to avoid memory leaks + subjectController.dispose(); + messageController.dispose(); + super.dispose(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + dynamic arguments = ModalRoute.of(context)!.settings.arguments; + if (arguments != null && arguments is Map) { + argumentsData = arguments; + claimsDetails = argumentsData['claimsDetails']; + print(claimsDetails); + if (argumentsData.containsKey('fromClaimPage')) { + fromClaimsPage = argumentsData['fromClaimPage']; + print(fromClaimsPage); + } + if (fromClaimsPage == 0) { + setInitialServiceId(); + } + } + } + + void setInitialServiceId() { + for (var department in departmentList) { + if (department['name'] == 'Claims') { + setState(() { + serviceId = department['id']; + }); + break; + } + } + } + + Future _loadToken() async { + print('_loadToken'); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + final String? token = prefs.getString('token'); + if (token != null && token.isNotEmpty) { + setState(() { + _token = token; + }); + // Decode the JWT token received from the API response + decodedToken = Jwt.parseJwt(token); + print(decodedToken); + client_branch_id = decodedToken['client_branch_id']; + empCodeString = prefs.getString('empCode'); + print(empCodeString); // Check if emp_code is correct + empPrimaryId = prefs.getString('empPrimaryId'); + client_id = prefs.getString('client_id'); + print(client_id); + getActiveAndInactivePolicyDetails('Active'); + fetchDepartmentList(); + } 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'); + } + } + + Future getActiveAndInactivePolicyDetails(String status) async { + if (client_id == null || empCodeString == null) { + return; + } + print('check 1'); + final response = await apiService.getActiveAndInactivePolicyDetails( + client_id!, empCodeString!, status, client_branch_id); + print('check 1'); + if (response['status'] == 'success') { + List 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); + }); + } else { + setState(() { + policyDataIsEmpty = 0; + }); + print('API request failed with status: ${response['status']}'); + } + } + + Future fetchDepartmentList() async { + try { + final response = await apiService.fetchDepartmentList(); + if (response['departments'] != null) { + List departments = response['departments']; + setState(() { + departmentList = departments.map((department) { + return { + 'id': int.parse(department['id']), + 'name': department['name'], + 'private': department['private'], + }; + }).toList(); + }); + if (fromClaimsPage == 0) { + setInitialServiceId(); + } + } else { + throw Exception('Failed to fetch department list'); + } + } catch (error) { + print('Error fetching department list: $error'); + } + } + + Future sendFormDataToApi() async { + print('Help'); + try { + Map formData = { + 'opener': 'user', + 'department_id': serviceId, + 'subject': subjectController.text, + 'body': messageController.text, + 'policy_id': fromClaimsPage == 0 + ? claimsDetails['client_policy_id'] + : policyNumberId, + 'emp_code': + decodedToken['emp_code'] != null ? decodedToken['emp_code'] : '', + 'mobile_number': + decodedToken['mobile'] != null ? decodedToken['mobile'] : '', + 'email': decodedToken['email_corporate'] != null + ? decodedToken['email_corporate'] + : '', + 'fullname': decodedToken['name'] != null ? decodedToken['name'] : '', + }; + + // Convert integer values to strings + formData = formData.map((key, value) => MapEntry(key, value.toString())); + + final response = await apiService.sendFormDataToApi(formData); + + if (response['success'] == 1) { + ToastHelper.showSuccessToast(context, response['message']); + serviceId = null; + departmentList.clear(); + Navigator.pushNamed(context, 'claims'); + print('Form data submitted successfully'); + } else { + print('Failed to submit form data: ${response['status']}'); + } + } catch (e) { + print('Error submitting form data: $e'); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar(), + body: Stack(children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * + 0.2, // 30% of screen width as horizontal padding + vertical: MediaQuery.of(context).size.height * + 0.05, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(10), + color: Colors.white, + child: Column(children: [ + Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(15.0), // Set border radius here + ), + child: Container( + decoration: BoxDecoration( + color: Colors.white, // Set background color to white + borderRadius: BorderRadius.circular( + 15.0), // Set border radius for Container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only( + top: 10, + bottom: 10, + left: 10, + right: 10), // Add padding to the container + child: Row( + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, + bottom: 15, + left: 25, + right: 25) + : EdgeInsets.only( + top: 0, bottom: 0, left: 0, right: 0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed( + context, 'claims'); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop( + context)) + Icon( + Icons.chevron_left, + // Replace with your desired icon + color: Color(0xFF000000), + size: 30, + ), + if (!Responsive.isDesktop( + context)) + SizedBox( + width: Responsive + .isDesktop( + context) + ? 0 + : 5), + // Adjust space between icon and text + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + claimsDetails[ + 'policy_name'], + textAlign: + TextAlign.start, + style: + GoogleFonts.poppins( + fontSize: 16, + fontWeight: + FontWeight.w600, + color: + Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + // Add more rows as needed + ], + ), + ), + SizedBox(height: 15), + Container( + child: Column( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Form( + key: formKey, + child: Column( + children: [ + !Responsive.isDesktop( + context) + ? Column( + children: [ + if (fromClaimsPage != + 0) + buildDropdownField( + 'Select Policy', + (value) { + setState( + () { + policyNumberId = + value; + }); + }, + fromClaimsPage == + 0, + policyNumberList, + 'policyName'), + buildDropdownField( + 'Service', + (value) { + setState(() { + serviceId = + value; + }); + }, + fromClaimsPage == + 0, + departmentList, + 'name'), + buildTextField( + 'Subject', + subjectController), + ], + ) + : Row( + children: [ + if (fromClaimsPage != + 0) ...[ + Expanded( + child: buildDropdownField( + 'Select Policy', + (value) { + setState( + () { + policyNumberId = + value; + }); + }, + fromClaimsPage == + 0, + policyNumberList, + 'policyName'), + ), + ], + if (fromClaimsPage != + 0) + SizedBox( + width: + 12), + Expanded( + child: buildDropdownField( + 'Service', + (value) { + setState( + () { + serviceId = + value; + }); + }, + fromClaimsPage == + 0, + departmentList, + 'name'), + ), + SizedBox( + width: 12), + Expanded( + child: buildTextField( + 'Subject', + subjectController)), + ], + ), + !Responsive.isDesktop( + context) + ? Column( + children: [ + buildTextAreaField( + 'Message', + messageController), + ], + ) + : Row( + children: [ + Expanded( + child: buildTextAreaField( + 'Message', + messageController)), + ], + ), + ], + ), + ), + ], + ), + ), + ], + ), + SizedBox(height: 15), + Row( + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerRight, + child: ElevatedButton( + onPressed: () { + sendFormDataToApi(); + }, + child: Text( + 'Send', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: + Color(0xFFE26728), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 5), + ), + ), + ), + ), + ), + ], + ), + ], + ), + ), + ], + ))), + ], + ), + ), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), + ]), + )), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), + // floatingActionButton: Responsive.isDesktop(context) + // ? null + // : FloatingActionButton( + // onPressed: () { + // // Add your onPressed logic here + // }, + // child: Icon(Icons.add), + // ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // For example: + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + // Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], // Initial index of the bottom navigation bar + ), + ); + } + + Widget buildTextField(String label, TextEditingController controller, + [TextInputType keyboardType = TextInputType.text]) { + return TextFormField( + controller: controller, + decoration: InputDecoration(labelText: label), + keyboardType: keyboardType, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the $label'; + } + return null; + }, + ); + } + + Widget buildDropdownField( + String label, + void Function(int?) onChanged, + bool readOnly, + List> itemsList, + String displayField) { + return DropdownButtonFormField( + value: label == 'Service' ? serviceId : policyNumberId, + decoration: InputDecoration(labelText: label), + items: itemsList.map>((item) { + return DropdownMenuItem( + 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, + decoration: InputDecoration(labelText: label), + maxLines: 5, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter the $label'; + } + return null; + }, + ); + } +} diff --git a/lib/pages/policies.dart b/lib/pages/policies.dart index ae2bef2..e9079b3 100644 --- a/lib/pages/policies.dart +++ b/lib/pages/policies.dart @@ -1,6 +1,7 @@ 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'; @@ -16,6 +17,9 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; import 'package:accordion/accordion.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +import '../service/api_service.dart'; class policies extends StatefulWidget { const policies({Key? key}) : super(key: key); @@ -25,6 +29,7 @@ class policies extends StatefulWidget { } class _policiesState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; @@ -38,6 +43,7 @@ class _policiesState extends State { dynamic EmployeePolicy; List> employeeDetails = []; dynamic argumentsData; + bool _isExpanded = false; void _onTabChanged(int index) { setState(() { @@ -45,9 +51,16 @@ class _policiesState extends State { }); } + void _toggleExpansion() { + setState(() { + _isExpanded = !_isExpanded; + }); + } + @override void initState() { super.initState(); + apiService = ApiService(context); // Initialize ApiService here _loadToken(); } @@ -72,55 +85,11 @@ class _policiesState extends State { empPrimaryId = prefs.getString('empPrimaryId'); client_id = prefs.getString('client_id'); print(client_id); - getActiveAndInactivePolicyDetails('Active'); } 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'); - } - } - - Future getActiveAndInactivePolicyDetails(Status) async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeActiveOrInactivePolicy?client_id=$client_id&emp_code=$empCodeString&type=$Status'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - Map data = json.decode(response.body); - if (data['status'] == 'success') { - setState(() { - policyList = data['data']; - }); - // Assuming data is a List - print(policyList); - } else { - setState(() { - policyDataIsEmpty = 0; - }); - // 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 { - setState(() { - policyDataIsEmpty = 0; - }); - // 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'); + Navigator.pushReplacementNamed(context, 'login'); } } @@ -181,25 +150,26 @@ class _policiesState extends State { 0.03, // 5% of screen height as vertical padding ) : EdgeInsets.all(0), - color: Colors.white, + color: + Responsive.isDesktop(context) ? Colors.white : Color(0xFFFFFCE5), child: Column(children: [ Container( decoration: BoxDecoration( color: Color(0xFFFFFCE5), // Set background color for the container borderRadius: BorderRadius.circular( - 5), // Set border radius for the container + 10), // Set border radius for the container ), padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 15, bottom: 15, left: 25, right: 25) + ? EdgeInsets.only(top: 20, bottom: 20, left: 25, right: 25) : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (!Responsive.isDesktop(context)) - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop(context)) Expanded( flex: 1, child: InkWell( @@ -210,52 +180,35 @@ class _policiesState extends State { Icons .chevron_left, // Replace with your desired icon color: Color(0xFF000000), - size: 20, + size: 30, ), ), ), - Expanded( - flex: 11, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - // Icon( - // Icons - // .subtitles, // Replace with your desired icon - // color: Color(0xFFE26728), - // size: 20, - // ), - // SizedBox( - // width: - // 3), // Adjust space between icon and text - Text( - '', - ), - ], - ), - ) - ], - ), - SizedBox(height: Responsive.isDesktop(context) ? 0 : 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ Expanded( - flex: 12, - child: Text( - argumentsData['policy_name'] ?? '', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 20 : 16, - fontWeight: FontWeight.w600, - color: Color(0xFF000000), - ), - )) + flex: !Responsive.isDesktop(context) ? 11 : 12, + child: Row( + mainAxisAlignment: Responsive.isDesktop(context) + ? MainAxisAlignment.center + : MainAxisAlignment.start, + children: [ + Text( + argumentsData['policy_name'] ?? '', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 20 : 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ) + ], + ), + ) ], ), SizedBox( height: Responsive.isDesktop(context) - ? 40 + ? 20 : 20), // Space between rows Column( children: [ @@ -267,77 +220,12 @@ class _policiesState extends State { SizedBox( height: Responsive.isDesktop(context) ? 40 - : 20), // Space between rows + : 30), // Space between rows Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - // Expanded( - // flex: Responsive.isDesktop(context) ? 4 : 6, - // child: Container( - // alignment: Alignment.center, - // child: GestureDetector( - // onTap: () { - // setState(() {}); - // }, - // child: Material( - // elevation: 0, - // borderRadius: BorderRadius.circular(5), - // color: Color(0xFFFFF8BF), - // child: SizedBox( - // width: Responsive.isDesktop(context) - // ? 200 - // : 160, - // child: TextButton( - // onPressed: () {}, - // style: TextButton.styleFrom( - // padding: - // Responsive.isDesktop(context) - // ? EdgeInsets.only( - // top: 5, - // bottom: 5, - // left: 15, - // right: 15) - // : EdgeInsets.only( - // top: 3, - // bottom: 3, - // left: 10, - // right: 10) - // // primary: Color(0xFF000000), - // ), - // child: Row( - // mainAxisSize: MainAxisSize.min, - // children: [ - // Icon( - // Icons - // .download, // Replace with your desired icon - // color: Color(0xFFE26728), - // size: - // Responsive.isDesktop(context) - // ? 25 - // : 20, - // ), - // SizedBox( - // width: - // 8), // Adjust space between icon and text - // Text( - // 'Download Policy', - // style: GoogleFonts.poppins( - // fontSize: Responsive.isDesktop( - // context) - // ? 16 - // : 12, - // fontWeight: FontWeight.w600, - // color: Color(0xFF000000), - // ), - // ), - // ], - // ), - // ), - // ))), - // )), - Expanded( - flex: 6, + flex: Responsive.isDesktop(context) ? 4 : 6, child: Container( alignment: Alignment.center, child: GestureDetector( @@ -351,7 +239,7 @@ class _policiesState extends State { child: SizedBox( width: Responsive.isDesktop(context) ? 200 - : 150, + : 180, child: TextButton( onPressed: () { _launchURL( @@ -368,14 +256,10 @@ class _policiesState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons - .subtitles, // Replace with your desired icon - color: Color(0xFFE26728), - size: - Responsive.isDesktop(context) - ? 25 - : 20, + SvgPicture.asset( + 'assets/ECard.svg', + width: 25, + height: 25, ), SizedBox( width: @@ -385,8 +269,8 @@ class _policiesState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop( context) - ? 18 - : 14, + ? 16 + : 12, fontWeight: FontWeight.w600, color: Color(0xFF000000), ), @@ -396,8 +280,10 @@ class _policiesState extends State { ), ))), )), + if (Responsive.isDesktop(context)) + Expanded(flex: 4, child: Container()), Expanded( - flex: 6, + flex: Responsive.isDesktop(context) ? 4 : 6, child: Container( alignment: Alignment.center, child: GestureDetector( @@ -409,7 +295,7 @@ class _policiesState extends State { child: SizedBox( width: Responsive.isDesktop(context) ? 200 - : 160, + : 180, child: TextButton( onPressed: () { Navigator.pushNamed( @@ -433,14 +319,10 @@ class _policiesState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons - .fact_check, // Replace with your desired icon - color: Color(0xFFE26728), - size: - Responsive.isDesktop(context) - ? 25 - : 20, + SvgPicture.asset( + 'assets/fileaclaims.svg', + width: 25, + height: 25, ), SizedBox( width: @@ -463,63 +345,73 @@ class _policiesState extends State { )), ], ), + SizedBox(height: Responsive.isDesktop(context) ? 30 : 20), // Add more rows as needed ], ), ), - SizedBox(height: Responsive.isDesktop(context) ? 20 : 0), Container( decoration: BoxDecoration( - // Set background color for the container - borderRadius: BorderRadius.circular( - 10), // Set border radius for the container + color: Colors.white, // Set background color for the container + borderRadius: BorderRadius.only( + topLeft: Radius.circular(40.0), + topRight: Radius.circular(40.0), + ), // Set border radius for the container ), padding: Responsive.isDesktop(context) - ? EdgeInsets.only(top: 0, bottom: 0, left: 0, right: 0) - : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), + ? EdgeInsets.only(top: 15, bottom: 15, left: 0, right: 0) + : EdgeInsets.only(top: 20, bottom: 10, left: 10, right: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Card( - elevation: 4, + 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: Color( 0xFFECF2FF), // Set background color for the container borderRadius: BorderRadius.only( - topLeft: Radius.circular(5), + topLeft: Radius.circular(10), topRight: Radius.circular( - 5)), // Set border radius for the container + 10)), // Set border radius for the container ), padding: Responsive.isDesktop(context) ? EdgeInsets.only( top: 15, bottom: 15, left: 15, right: 15) : EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10), + top: 20, bottom: 20, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( flex: 12, child: Container( - alignment: Alignment.center, + alignment: Alignment.centerLeft, child: Column( mainAxisAlignment: - MainAxisAlignment.center, + MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.center, + CrossAxisAlignment.start, children: [ Text( 'Insured Members', - textAlign: TextAlign.center, + textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 18 - : 14, + : 12, color: Color(0xFF404040), - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w400, ), ), ], @@ -533,17 +425,22 @@ class _policiesState extends State { ), padding: Responsive.isDesktop(context) ? EdgeInsets.all(30) - : EdgeInsets.all(15), + : EdgeInsets.only( + top: 15, bottom: 15, left: 20, right: 20), child: Column( children: employeeDetails.map((detail) { + int index = employeeDetails.indexOf(detail); return Container( decoration: BoxDecoration( border: Border( - bottom: BorderSide( - color: Color(0xFFBDBDBD), - width: - 1.0, // Adjust the width as needed - ), + bottom: + index != employeeDetails.length - 1 + ? BorderSide( + color: Color(0xFFD9D9D9), + width: + 1.0, // Adjust the width as needed + ) + : BorderSide.none, ), ), child: Row( @@ -561,8 +458,8 @@ class _policiesState extends State { left: 10, right: 10) : EdgeInsets.only( - top: 7, - bottom: 7, + top: 15, + bottom: 15, left: 7, right: 7), child: Text( @@ -572,7 +469,7 @@ class _policiesState extends State { fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF000000), fontWeight: FontWeight.w400, ), @@ -590,7 +487,7 @@ class _policiesState extends State { fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF404040), fontWeight: FontWeight.w400, ), @@ -604,96 +501,254 @@ class _policiesState extends State { ) ])), SizedBox(height: 10), - Accordion( - headerBorderColor: Color(0xFFD9D9D9), - headerBorderColorOpened: Color(0xFFD9D9D9), - headerBorderWidth: 1, - headerBackgroundColor: Colors.white, - headerBackgroundColorOpened: Colors.white, - contentBackgroundColor: Colors.white, - contentBorderColor: Color(0xFFD9D9D9), - contentBorderWidth: 1, - contentHorizontalPadding: 20, - scaleWhenAnimating: true, - openAndCloseAnimation: true, - headerPadding: - EdgeInsets.symmetric(vertical: 15, horizontal: 15), - sectionOpeningHapticFeedback: SectionHapticFeedback.heavy, - sectionClosingHapticFeedback: SectionHapticFeedback.light, - children: [ - AccordionSection( - isOpen: false, - contentVerticalPadding: 20, - rightIcon: Icon( - Icons.arrow_drop_down, // Custom arrow icon - color: Color( - 0xFFE26728), // Set the color for the arrow icon - size: 25, + 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: [ + InkWell( + onTap: _toggleExpansion, + child: Container( + decoration: BoxDecoration( + color: Colors + .white, // Set background color for the container ), - leftIcon: Icon( - Icons - .switch_account, // Replace with your desired icon - color: Color(0xFF855000), - size: 25, + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(15) + : EdgeInsets.symmetric( + vertical: 20, horizontal: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 8, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/policyCoverage.svg', + width: 25, + height: 25, + ), + SizedBox( + width: + 10), // Adjust space between icon and text + Text( + 'Policy coverage', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF404040), + ), + ), + ], + ), + ), + Expanded( + flex: 4, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + _isExpanded ? Icons.remove : Icons.add, + color: Color(0xFFE26728), + size: 25, + ), + ], + ), + ), + ], ), - header: Text( - 'Policy coverage', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 18 : 12, - fontWeight: FontWeight.w400, - color: Color(0xFF404040), - ), + ), + ), + if (_isExpanded) + Container( + decoration: BoxDecoration( + color: Colors.white, ), - content: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: argumentsData['policy_terms'] - .entries - .where((entry) => entry.value is String) - .map((entry) => Container( - width: double.infinity, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color(0xFFD9D9D9), - width: 1.0, - ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.symmetric( + vertical: 15, horizontal: 20), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: argumentsData['policy_terms'] + .entries + .where((entry) => entry.value is String) + .toList() + .asMap() + .entries + .map((entry) { + int index = entry.key; + MapEntry value = entry.value; + bool isLast = index == + argumentsData['policy_terms'].length - 1; + return Container( + width: double.infinity, + decoration: BoxDecoration( + border: isLast + ? null + : Border( + bottom: BorderSide( + color: Color(0xFFD9D9D9), + width: 1.0, ), ), - child: Padding( - padding: EdgeInsets.symmetric( - vertical: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - entry.key, + ), + child: Padding( + padding: + EdgeInsets.symmetric(vertical: 8.0), + child: Responsive.isDesktop(context) + ? Row( + children: [ + Expanded( + flex: 6, + child: Text( + value.key, style: GoogleFonts.poppins( fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFF777777), ), ), - SizedBox(height: 4), - Text( - entry.value, + ), + Expanded( + flex: 6, + child: Text( + value.value, + textAlign: TextAlign.end, style: GoogleFonts.poppins( fontSize: 16, fontWeight: FontWeight.w400, color: Color(0xFF000000), ), ), - ], - ), + ), + ], + ) + : Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + value.key, + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF777777), + ), + ), + SizedBox(height: 4), + Text( + value.value, + style: GoogleFonts.poppins( + fontSize: 16, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], ), - )) - .toList(), - ), + ), + ); + }).toList(), )), - ]), + ), + ])), + SizedBox(height: 10), + MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () => { + Navigator.pushNamed( + context, 'generalExclusionsDeductibles') + }, + 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: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + 'assets/general.svg', + width: 25, + height: 25, + ), + SizedBox( + width: + 10), // Adjust space between icon and text + Text( + 'General Exclusions & Deductibles', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 12, + fontWeight: FontWeight.w400, + color: Color(0xFF404040), + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + Icons + .chevron_right, // Replace with your desired icon + color: Color(0xFFE26728), + size: 20, + ), + ], + ), + ), + ], + ), + ), + ]), + ), + ), + ), + SizedBox(height: 10), Card( elevation: 0, shape: RoundedRectangleBorder( @@ -736,11 +791,10 @@ class _policiesState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ - Icon( - Icons - .question_mark, // Replace with your desired icon - color: Color(0xFF9B85B4), - size: 25, + SvgPicture.asset( + 'assets/needHelp.svg', + width: 25, + height: 25, ), SizedBox(height: 10), Text( @@ -778,11 +832,10 @@ class _policiesState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ - Icon( - Icons - .emoji_flags, // Replace with your desired icon - color: Color(0xFF2CCEFE), - size: 25, + SvgPicture.asset( + 'assets/cliamHistory.svg', + width: 25, + height: 25, ), SizedBox(height: 10), Text( @@ -827,20 +880,19 @@ class _policiesState extends State { ? EdgeInsets.only( top: 15, bottom: 15, left: 15, right: 15) : EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10), + top: 20, bottom: 20, left: 10, right: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - flex: 12, + flex: 11, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - Icon( - Icons - .phonelink_ring, // Replace with your desired icon - color: Color(0xFF038500), - size: 25, + SvgPicture.asset( + 'assets/cashLess.svg', + width: 25, + height: 25, ), SizedBox( width: @@ -859,6 +911,20 @@ class _policiesState extends State { ], ), ), + Expanded( + flex: 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + Icons + .chevron_right, // Replace with your desired icon + color: Color(0xFFE26728), + size: 20, + ), + ], + ), + ), ], ), ), @@ -906,10 +972,10 @@ class _policiesState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", @@ -952,6 +1018,7 @@ class _policiesState extends State { children: [ buildExpandedColumn(context, 'Policy Expiry', convertDateFormat(argumentsData['policy_end_date'])), + buildExpandedColumn(context, '', ''), ], ), ], @@ -971,17 +1038,17 @@ class _policiesState extends State { title, textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 18 : 12, + fontSize: Responsive.isDesktop(context) ? 18 : 14, fontWeight: FontWeight.w400, color: Color(0xFF000000), ), ), - SizedBox(height: Responsive.isDesktop(context) ? 10 : 5), + SizedBox(height: Responsive.isDesktop(context) ? 10 : 4), Text( value, textAlign: TextAlign.center, style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 18 : 14, + fontSize: Responsive.isDesktop(context) ? 18 : 16, fontWeight: FontWeight.w600, color: Color(0xFF000000), ), diff --git a/lib/pages/privacypolicy.dart b/lib/pages/privacypolicy.dart new file mode 100644 index 0000000..b20536f --- /dev/null +++ b/lib/pages/privacypolicy.dart @@ -0,0 +1,958 @@ +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/customAppBar.dart'; +import '../customAppBar/customFooter.dart'; +import '../customAppBar/tabs.dart'; +import '../customAppBar/responsive.dart'; +import '../customAppBar/toastHelper.dart'; +import '../models/environment.dart'; +import 'package:http/http.dart' as http; + +class privacypolicy extends StatefulWidget { + const privacypolicy({Key? key}) : super(key: key); + + @override + State createState() => _privacypolicyState(); +} + +class _privacypolicyState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Stack( + children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * 0.2, + vertical: MediaQuery.of(context).size.height * 0.03, + ) + : EdgeInsets.all(10), + color: Colors.white, + child: Column( + children: [ + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'claims'); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon( + Icons.chevron_left, + color: Color(0xFF000000), + size: 30, + ), + SizedBox( + width: Responsive.isDesktop(context) + ? 0 + : 5), + Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Privacy Policy', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Navigating the health insurance claim process can be daunting, but understanding how to utilize a cashless claim can simplify and expedite access to medical care. Here is a detailed guide on how to effectively manage the cashless claim process.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'What is a Cashless Claim?', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 15), + Text( + 'A cashless claim is a facility offered by health insurance companies where the insurer directly settles the medical expenses with the hospital, eliminating the need for the policyholder to pay out-of-pocket at the time of treatment. This facility is available only at network hospitals that have a tie-up with the insurance company.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Steps to File a Cashless Claim', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '1. Identify Network Hospitals:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Before seeking treatment, check the list of network hospitals associated with your insurance provider. This list can usually be found on the insurance company’s website or by contacting their customer service.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '2. Inform the Insurance Provider:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Notify your insurance company as soon as possible about the planned hospitalization. For emergency admissions, inform them within the stipulated time frame (usually 24 hours) after admission.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Fill out a pre-authorization form available at the hospitals insurance desk or download it from the insurers website. This form will require details about the policyholder and the nature of the medical treatment.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '3. Submit Pre-Authorization Form:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'The completed pre-authorization form must be submitted to the hospital’s insurance desk, which will then send it to the insurer or the Third-Party Administrator (TPA) for approval.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Include all necessary medical documents, such as doctor’s prescriptions, diagnosis reports, and hospital records.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '4. Approval from Insurer:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'The insurer or TPA will review the submitted documents and decide on the approval. This can take anywhere from a few hours to a couple of days.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'If approved, the insurer will issue an authorization letter to the hospital, detailing the covered expenses and any limits.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '5. Hospitalization and Treatment:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Upon receiving approval, you can undergo the required treatment. The hospital will manage the coordination with the insurance company for the expenses covered under the policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Ensure that any non-covered expenses (like consumables, personal items, or certain specific treatments) are settled directly by you.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '6. Discharge and Settlement:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Upon receiving approval, you can undergo the required treatment. The hospital will manage the coordination with the insurance company for the expenses covered under the policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Review the bill for any non-covered items and pay for those out of your pocket.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '7. Post-Discharge Procedure:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Retain copies of all bills, receipts, and discharge summaries for your records.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Follow up with the insurance company if there are any discrepancies or if you receive any communication regarding the claim.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Tips for a Smooth Cashless Claim Process', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Maintain Updated Records: Always keep your insurance policy documents and health records updated and accessible.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Understand Your Policy: Be aware of the inclusions, exclusions, and the claim procedure specific to your health insurance policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Communicate Clearly: Ensure clear and prompt communication with the hospitals insurance desk and your insurance provider.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Check for Network Hospitals: Regularly update yourself with the list of network hospitals to avoid any last-minute surprises.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Emergency Preparedness: Keep a list of nearby network hospitals for emergencies.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Conclusion', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 15), + Text( + 'The cashless claim process is designed to provide financial relief and convenience during medical emergencies and planned treatments. By following the outlined steps and maintaining clear communication with your insurer, you can navigate the process smoothly and focus on recovery without financial stress.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + ]), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), + ], + ), + ), + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, + child: CustomFooter(), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/profile.dart b/lib/pages/profile.dart index 366c9c6..fdace53 100644 --- a/lib/pages/profile.dart +++ b/lib/pages/profile.dart @@ -12,6 +12,8 @@ import '../customAppBar/toastHelper.dart'; import '../models/environment.dart'; import 'package:http/http.dart' as http; +import '../service/api_service.dart'; + class profile extends StatefulWidget { const profile({Key? key}) : super(key: key); @@ -20,6 +22,7 @@ class profile extends StatefulWidget { } class _profileState extends State { + late ApiService apiService; int _currentIndex = 0; bool isActive = true; dynamic _token; @@ -55,6 +58,7 @@ class _profileState extends State { @override void initState() { super.initState(); + apiService = ApiService(context); // Initialize ApiService here _loadToken(); } @@ -95,56 +99,43 @@ class _profileState extends State { } Future getSelfEmployeeProfile() async { - var url = Uri.parse(Environment.apiUrl + - 'getEmployeeProfile?emp_code=$empCodeString&client_id=$client_id'); - try { - var response = await http.get( - url, - headers: { - 'Authorization': - 'Bearer $_token', // Add token to the Authorization header - }, - ); - if (response.statusCode == 200) { - // print('response.statusCode == 200'); - Map data = json.decode(response.body); - // print(data); - - if (data.containsKey('data')) { - setState(() { - dynamic selfDetails = data['data']; - print(selfDetails); - selfRelationship = selfDetails['relationship']; - selfName = selfDetails['name']; - selfMobile = selfDetails['mobile']; - selfDesignation = selfDetails['designation']; - selfDob = convertDate(selfDetails['dob']); - selfDoj = convertDate(selfDetails['doj']); - selfGender = selfDetails['gender']; - selfEmailCorporate = selfDetails['email_corporate']; - selfEmailPersonal = selfDetails['email_personal']; - selfEmpCode = selfDetails['emp_code']; - selfFamilyFloaterKey = selfDetails['family_floater_key']; - // print(clientDetails); - selfEmpStatus = selfDetails['emp_status']; - }); - final SharedPreferences prefs = await SharedPreferences.getInstance(); - 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: ${data['status']}'); - } + print(getSelfEmployeeProfile); + if (client_id == null || empCodeString == null) { + return; + } + print('check 1'); + final response = await apiService.getSelfEmployeeProfileDetails( + client_id!, empCodeString!); + print('check 1'); + if (response['status'] == 'success') { + if (response.containsKey('data')) { + setState(() { + dynamic selfDetails = response['data']; + print(selfDetails); + selfRelationship = selfDetails['relationship']; + selfName = selfDetails['name']; + selfMobile = selfDetails['mobile']; + selfDesignation = selfDetails['designation']; + selfDob = convertDate(selfDetails['dob']); + selfDoj = convertDate(selfDetails['doj']); + selfGender = selfDetails['gender']; + selfEmailCorporate = selfDetails['email_corporate']; + selfEmailPersonal = selfDetails['email_personal']; + selfEmpCode = selfDetails['emp_code']; + selfFamilyFloaterKey = selfDetails['family_floater_key']; + // print(clientDetails); + selfEmpStatus = selfDetails['emp_status']; + }); + final SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString('selfEmpStatus', selfEmpStatus); } else { - // Handle other status codes + // Handle other status messages if needed // ToastHelper.showErrorToast( - // context, 'Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.statusCode}'); + // context, 'API request failed with status: ${data['status']}'); + print('API request failed with status: ${response['status']}'); } - } catch (e) { - // Handle exceptions - print('Exception occurred: $e'); + } else { + print('API request failed with status: ${response['status']}'); } } @@ -175,7 +166,7 @@ class _profileState extends State { if (selfName != null) Container( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.start, @@ -203,14 +194,6 @@ class _profileState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - AvatarDesign( - gender: - selfGender, // Replace with your image URL - radius: 50.0, - borderColor: Color(0xFFFEEDED), - borderWidth: 4.0, - ), - SizedBox(height: 10), Text( selfName ?? '', textAlign: TextAlign.center, @@ -220,7 +203,33 @@ class _profileState extends State { color: Color(0xFF000000), ), ), - SizedBox(height: 10), + ], + ), + ], + ), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (!Responsive.isDesktop(context)) + Expanded( + flex: 1, + child: Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.only(top: 10, left: 10), + child: Text(''))), + Expanded( + flex: Responsive.isDesktop(context) ? 12 : 11, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Adjust space between icon and text + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ RichText( text: TextSpan( children: [ @@ -260,10 +269,15 @@ class _profileState extends State { if (selfName != null) Card( elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10), // Set the border radius here + ), child: Column(children: [ Container( decoration: BoxDecoration( color: Colors.white, + borderRadius: BorderRadius.circular(10), ), padding: Responsive.isDesktop(context) ? EdgeInsets.all(30) @@ -278,6 +292,10 @@ class _profileState extends State { ), ), ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only(top: 10, bottom: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -302,7 +320,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF777777), fontWeight: FontWeight.w500, ), @@ -319,7 +337,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 16, color: Color(0xFF2D5A82), fontWeight: FontWeight.w400, ), @@ -337,6 +355,10 @@ class _profileState extends State { ), ), ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only(top: 10, bottom: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -361,7 +383,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF777777), fontWeight: FontWeight.w500, ), @@ -378,7 +400,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 16, color: Color(0xFF2D5A82), fontWeight: FontWeight.w400, ), @@ -396,6 +418,10 @@ class _profileState extends State { ), ), ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only(top: 10, bottom: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -420,7 +446,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF777777), fontWeight: FontWeight.w500, ), @@ -437,7 +463,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 16, color: Color(0xFF2D5A82), fontWeight: FontWeight.w400, ), @@ -447,14 +473,10 @@ class _profileState extends State { ], )), Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color(0xFFBDBDBD), - width: 1.0, // Adjust the width as needed - ), - ), - ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 15, bottom: 15, left: 15, right: 15) + : EdgeInsets.only(top: 10, bottom: 10), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -479,7 +501,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 14, color: Color(0xFF777777), fontWeight: FontWeight.w500, ), @@ -496,7 +518,7 @@ class _profileState extends State { style: GoogleFonts.poppins( fontSize: Responsive.isDesktop(context) ? 16 - : 12, + : 16, color: Color(0xFF2D5A82), fontWeight: FontWeight.w400, ), @@ -591,10 +613,10 @@ class _profileState extends State { } }, icons: [ - Icons.home, - Icons.sticky_note_2_sharp, - Icons.account_circle, - Icons.help, + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, ], labels: [ "Home", diff --git a/lib/pages/termsofuse.dart b/lib/pages/termsofuse.dart new file mode 100644 index 0000000..19a0e9c --- /dev/null +++ b/lib/pages/termsofuse.dart @@ -0,0 +1,958 @@ +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/customAppBar.dart'; +import '../customAppBar/customFooter.dart'; +import '../customAppBar/tabs.dart'; +import '../customAppBar/responsive.dart'; +import '../customAppBar/toastHelper.dart'; +import '../models/environment.dart'; +import 'package:http/http.dart' as http; + +class termsofuse extends StatefulWidget { + const termsofuse({Key? key}) : super(key: key); + + @override + State createState() => _termsofuseState(); +} + +class _termsofuseState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Stack( + children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * 0.2, + vertical: MediaQuery.of(context).size.height * 0.03, + ) + : EdgeInsets.all(10), + color: Colors.white, + child: Column( + children: [ + Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: InkWell( + onTap: () { + Navigator.pushNamed(context, 'claims'); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon( + Icons.chevron_left, + color: Color(0xFF000000), + size: 30, + ), + SizedBox( + width: Responsive.isDesktop(context) + ? 0 + : 5), + Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Terms of Use', + textAlign: TextAlign.start, + style: GoogleFonts.poppins( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xFF000000), + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric(vertical: 15, horizontal: 25) + : EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Navigating the health insurance claim process can be daunting, but understanding how to utilize a cashless claim can simplify and expedite access to medical care. Here is a detailed guide on how to effectively manage the cashless claim process.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'What is a Cashless Claim?', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 15), + Text( + 'A cashless claim is a facility offered by health insurance companies where the insurer directly settles the medical expenses with the hospital, eliminating the need for the policyholder to pay out-of-pocket at the time of treatment. This facility is available only at network hospitals that have a tie-up with the insurance company.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Steps to File a Cashless Claim', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '1. Identify Network Hospitals:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Before seeking treatment, check the list of network hospitals associated with your insurance provider. This list can usually be found on the insurance company’s website or by contacting their customer service.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '2. Inform the Insurance Provider:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Notify your insurance company as soon as possible about the planned hospitalization. For emergency admissions, inform them within the stipulated time frame (usually 24 hours) after admission.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Fill out a pre-authorization form available at the hospitals insurance desk or download it from the insurers website. This form will require details about the policyholder and the nature of the medical treatment.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '3. Submit Pre-Authorization Form:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'The completed pre-authorization form must be submitted to the hospital’s insurance desk, which will then send it to the insurer or the Third-Party Administrator (TPA) for approval.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Include all necessary medical documents, such as doctor’s prescriptions, diagnosis reports, and hospital records.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '4. Approval from Insurer:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'The insurer or TPA will review the submitted documents and decide on the approval. This can take anywhere from a few hours to a couple of days.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'If approved, the insurer will issue an authorization letter to the hospital, detailing the covered expenses and any limits.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '5. Hospitalization and Treatment:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Upon receiving approval, you can undergo the required treatment. The hospital will manage the coordination with the insurance company for the expenses covered under the policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Ensure that any non-covered expenses (like consumables, personal items, or certain specific treatments) are settled directly by you.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '6. Discharge and Settlement:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Upon receiving approval, you can undergo the required treatment. The hospital will manage the coordination with the insurance company for the expenses covered under the policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Review the bill for any non-covered items and pay for those out of your pocket.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '7. Post-Discharge Procedure:', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Retain copies of all bills, receipts, and discharge summaries for your records.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Follow up with the insurance company if there are any discrepancies or if you receive any communication regarding the claim.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Tips for a Smooth Cashless Claim Process', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Maintain Updated Records: Always keep your insurance policy documents and health records updated and accessible.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Understand Your Policy: Be aware of the inclusions, exclusions, and the claim procedure specific to your health insurance policy.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Communicate Clearly: Ensure clear and prompt communication with the hospitals insurance desk and your insurance provider.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Check for Network Hospitals: Regularly update yourself with the list of network hospitals to avoid any last-minute surprises.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: Text( + "• ", + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFFE26728), + ), + ), + ), + Expanded( + child: Text( + 'Emergency Preparedness: Keep a list of nearby network hospitals for emergencies.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 16 + : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(bottom: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Conclusion', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 16, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), + ), + ), + SizedBox(height: 15), + Text( + 'The cashless claim process is designed to provide financial relief and convenience during medical emergencies and planned treatments. By following the outlined steps and maintaining clear communication with your insurer, you can navigate the process smoothly and focus on recovery without financial stress.', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 16 : 14, + fontWeight: FontWeight.w400, + color: Color(0xFF000000), + ), + ), + ], + ), + ), + ]), + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), + ], + ), + ), + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, + child: CustomFooter(), + ), + ), + ], + ), + ); + } +} diff --git a/lib/service/api_service.dart b/lib/service/api_service.dart new file mode 100644 index 0000000..db6e764 --- /dev/null +++ b/lib/service/api_service.dart @@ -0,0 +1,151 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:nhance_app_pwa/customAppBar/toastHelper.dart'; +import 'package:nhance_app_pwa/models/environment.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'dart:convert'; + +class ApiService { + final BuildContext context; + String? _token; + + ApiService(this.context) { + _initializeToken(); + } + + Future _initializeToken() async { + final prefs = await SharedPreferences.getInstance(); + _token = prefs.getString('token') ?? ''; + } + + Future> getActiveAndInactivePolicyDetails( + String clientId, String empCode, String status, String branchID) async { + print(_token); + if (_token == null) { + await _initializeToken(); + } + final url = Uri.parse( + '${Environment.apiUrl}getEmployeeActiveOrInactivePolicy?client_id=$clientId&emp_code=$empCode&type=$status&client_branch_id=$branchID'); + final headers = { + 'Authorization': _token ?? '', + }; + final response = await _makeGetRequest(url, headers); + return response; + } + + Future> getAdvertisementImageToApi() async { + print(_token); + if (_token == null) { + await _initializeToken(); + } + final url = Uri.parse('${Environment.apiUrl}getAdvertisementImage'); + final headers = { + 'Authorization': _token ?? '', + }; + final response = await _makeGetRequest(url, headers); + return response; + } + + Future> getCashlessAndReimbursementToApi() async { + print(_token); + if (_token == null) { + await _initializeToken(); + } + final url = Uri.parse('${Environment.apiUrl}getFEContent'); + final headers = { + 'Authorization': _token ?? '', + }; + final response = await _makeGetRequest(url, headers); + return response; + } + + Future> getSelfEmployeeProfileDetails( + String clientId, String empCode) async { + print(_token); + if (_token == null) { + await _initializeToken(); + } + final url = Uri.parse( + '${Environment.apiUrl}getEmployeeProfile?emp_code=$empCode&client_id=$clientId'); + final headers = { + 'Authorization': Environment.ticketToken ?? '', + }; + final response = await _makeGetRequest(url, headers); + return response; + } + + Future> getTrackClaimsList( + String empMobileNo, String empCode) async { + final url = Uri.parse( + '${Environment.apiUrlTicket}/ticket/get_ticket_data?emp_code=$empCode&mobile_number=$empMobileNo'); + final response = await _makeGetRequest(url, { + 'Token': Environment.ticketToken, + }); + return response; + } + + Future> fetchDepartmentList() async { + final url = Uri.parse('${Environment.apiUrlTicket}/departments'); + final response = await _makeGetRequest(url, { + 'Token': Environment.ticketToken, + }); + return response; + } + + Future> sendFormDataToApi( + Map formData) async { + final url = Uri.parse('${Environment.apiUrlTicket}/tickets/create'); + // Convert formData to Map + Map stringFormData = + formData.map((key, value) => MapEntry(key, value.toString())); + final response = await _makePostRequest(url, stringFormData, { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Token': Environment.ticketToken, + }); + return response; + } + + Future> sendClaimsMessageToApi( + Map formData) async { + final url = Uri.parse('${Environment.apiUrlTicket}/messages/create'); + // Convert formData to Map + Map stringFormData = + formData.map((key, value) => MapEntry(key, value.toString())); + final response = await _makePostRequest(url, stringFormData, { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Token': Environment.ticketToken, + }); + return response; + } + + Future> _makeGetRequest( + Uri url, Map headers) async { + final response = await http.get(url, headers: headers); + return _handleResponse(response); + } + + Future> _makePostRequest( + Uri url, Map body, Map headers) async { + final response = await http.post(url, headers: headers, body: body); + return _handleResponse(response); + } + + Future> _handleResponse(http.Response response) async { + if (response.statusCode == 200) { + return jsonDecode(response.body); + } else if (response.statusCode == 401) { + await _clearLocalStorageAndRedirect(); + return {}; + } else { + throw Exception('Failed to load data'); + } + } + + Future _clearLocalStorageAndRedirect() async { + final prefs = await SharedPreferences.getInstance(); + await prefs.clear(); + // Assuming you have access to the context + ToastHelper.showErrorToast(context, 'Session Out'); + Navigator.pushNamed(context, 'login'); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index a75c6bf..55ead05 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: intl: ^0.19.0 accordion: ^2.6.0 url_launcher: ^6.2.6 + flutter_svg: ^2.0.10+1 dev_dependencies: flutter_test: diff --git a/web/index.html b/web/index.html index 84f9da5..f2925a2 100644 --- a/web/index.html +++ b/web/index.html @@ -32,6 +32,35 @@ nhance_app_pwa + + - + +
+ +
- - +