This commit is contained in:
Venba 2024-07-10 08:46:55 +05:30
parent 17280b1bb8
commit 653dd27018
15 changed files with 5771 additions and 5184 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
class _CustomAppBarState extends State<CustomAppBar> {
bool showBackToHR = true;
bool hideInactiveStatus = true;
// bool hideInactiveStatus = true;
@override
void initState() {
@ -32,7 +32,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
showBackToHR = (hrtoken != null && hrtoken.isNotEmpty) &&
(token != null && token.isNotEmpty);
hideInactiveStatus = token != null && token.isNotEmpty;
// hideInactiveStatus = token != null && token.isNotEmpty;
});
}
@ -113,14 +113,14 @@ class _CustomAppBarState extends State<CustomAppBar> {
Container(), // Set an empty container as we have the logo separately
title: Text(''),
navBarItems: [
if (Responsive.isDesktop(context))
if (hideInactiveStatus)
NavBarItem(
text: "Inactive Policy",
onTap: () {
Navigator.pushNamed(context, 'oldPolicy');
},
),
// if (Responsive.isDesktop(context))
// if (hideInactiveStatus)
// NavBarItem(
// text: "Inactive Policy",
// onTap: () {
// Navigator.pushNamed(context, 'oldPolicy');
// },
// ),
if (showBackToHR)
NavBarItem(
text: "Back To HR",

View File

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class CustomFooter extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(8.0),
color: Color(0xFFFFFBDE), // Background color of the footer
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Copyright@ 2024 Nhance - Jubiliant',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600], // Text color
),
),
],
),
);
}
}

View File

@ -17,6 +17,8 @@ import 'dart:async';
import 'package:nhancepolicy/responsive.dart';
import 'package:url_launcher/url_launcher.dart';
import 'customAppBar/customFooter.dart';
class empDetails extends StatefulWidget {
const empDetails({Key? key}) : super(key: key);
@ -682,6 +684,7 @@ class _empDetailsState extends State<empDetails> {
children: [
Card(
elevation: 0,
color: Colors.white,
child: Container(
width: double.infinity,
height: 75,
@ -753,6 +756,7 @@ class _empDetailsState extends State<empDetails> {
SizedBox(height: 16),
Card(
elevation: 0,
color: Colors.white,
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
@ -798,6 +802,7 @@ class _empDetailsState extends State<empDetails> {
children: [
Card(
elevation: 0,
color: Colors.white,
child: Container(
width: double.infinity,
height: 75,
@ -870,6 +875,7 @@ class _empDetailsState extends State<empDetails> {
if (gpaPolicies != null && gpaPolicies.length > 0)
Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
@ -1224,6 +1230,7 @@ class _empDetailsState extends State<empDetails> {
if (gmcPolicies != null && gmcPolicies.length > 0)
Card(
elevation: 0,
color: Colors.white,
child: Container(
width: double.infinity,
height: 75,
@ -1266,13 +1273,14 @@ class _empDetailsState extends State<empDetails> {
),
),
),
SizedBox(height: 30),
],
),
),
),
if (isLoading)
Container(
color: Color(0xFFFFFCE5), // Semi-transparent background
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
@ -1281,6 +1289,13 @@ class _empDetailsState extends State<empDetails> {
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
]));
}
}
@ -1348,6 +1363,7 @@ class _empDetailsState extends State<empDetails> {
child: SingleChildScrollView(
child: Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
@ -1602,6 +1618,7 @@ class _empDetailsState extends State<empDetails> {
child: SingleChildScrollView(
child: Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
@ -2216,6 +2233,7 @@ class _empDetailsState extends State<empDetails> {
Widget card = Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:jwt_decode/jwt_decode.dart';
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
import 'dart:convert';
@ -17,6 +18,8 @@ import 'package:csv/csv.dart';
import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
import 'customAppBar/customFooter.dart';
class excelVerify extends StatefulWidget {
const excelVerify({Key? key}) : super(key: key);
@ -43,6 +46,7 @@ class _excelVerifyState extends State<excelVerify> {
dynamic argumentsData;
List<Map<String, dynamic>> originalData = []; // Original data source
List<Map<String, dynamic>> filteredData = []; // Filtered data source
List<Map<String, dynamic>> tableData = []; // Filtered data source
dynamic policy_name;
dynamic clientPolicyId;
@ -52,6 +56,12 @@ class _excelVerifyState extends State<excelVerify> {
dynamic invalidRelationships = 0;
dynamic dobAgeCheckCount = 0;
dynamic empRefId;
List<String> excelHeader = [];
List<List<Map<String, dynamic>>> excelData = [];
late int excelValidationStaus = 1;
bool isSuccess = false;
String successContent = '';
bool isLoading = false;
@override
void initState() {
@ -135,8 +145,9 @@ class _excelVerifyState extends State<excelVerify> {
html.window.localStorage['fileBytes'] = jsonString;
print('File Name: $fileName');
print('File Bytes: $fileBytes');
sendExcelFIleTOAPI(fileBytes, fileName);
// Call the function to process Excel data here
_processExcelData(fileBytes, fileName);
// _processExcelData(fileBytes, fileName);
}
}
});
@ -387,7 +398,12 @@ class _excelVerifyState extends State<excelVerify> {
}
}
Future<void> sendExcelFIleTOAPI(Uint8List fileBytes, String fileName) async {
Future<void> sendExcelFIleTOAPI(Uint8List fileBytes, fileName) async {
// Future.delayed(Duration(seconds: 3), () {
// setState(() {
isLoading = true;
// });
// });
print('submit');
print(fileBytes);
if (fileBytes == null) {
@ -434,19 +450,43 @@ class _excelVerifyState extends State<excelVerify> {
print('else');
// Check the status code of the response
if (response.statusCode == 200) {
isLoading = false;
Map<String, dynamic> data = json.decode(responseString);
if (data['status'] == 'success') {
html.window.localStorage.remove('fileBytes');
// ToastHelper.showSuccessToast(context, 'File uploaded successfully');
ToastHelper.showSuccessToast(
context, 'Data Successfully Imported...');
print('Data Successfully Imported');
Navigator.pushNamed(context, 'hrPolicyDetails',
arguments: argumentsData);
ToastHelper.showSuccessToast(context, data['message']);
print('Table');
setState(() {
isSuccess = true;
successContent = data['message'];
excelValidationStaus = 0;
// excelHeader = List<String>.from(data['data']['excel_header']);
// print('excelHeader : $excelHeader');
// excelData = (data['data']['excel_data'] as List)
// .map<List<Map<String, dynamic>>>((row) => row
// .map<Map<String, dynamic>>(
// (cell) => Map<String, dynamic>.from(cell))
// .toList())
// .toList();
// print('excelHeader : $excelHeader');
});
} else {
// ToastHelper.showSuccessToast(context, 'File uploaded successfully');
ToastHelper.showErrorToast(context, 'Failed to Imported...');
// Navigator.pushNamed(context, 'hrHome');
ToastHelper.showErrorToast(context, data['message']);
print('Table');
setState(() {
isSuccess = false;
excelValidationStaus = 1;
excelHeader = List<String>.from(data['data']['excel_header']);
print('excelHeader : $excelHeader');
excelData = (data['data']['excel_data'] as List)
.map<List<Map<String, dynamic>>>((row) => row
.map<Map<String, dynamic>>(
(cell) => Map<String, dynamic>.from(cell))
.toList())
.toList();
print('excelHeader : $excelHeader');
});
}
} else {
// ToastHelper.showSuccessToast(
@ -483,26 +523,28 @@ class _excelVerifyState extends State<excelVerify> {
fileBytes = null;
fileName = null;
_currentStep = 0;
excelHeader.clear();
excelData.clear();
extractedData = [];
originalData = [];
filteredData = [];
validationArray = [];
nonExcelFilteredData = [];
print('filteredData');
print(filteredData);
print(validationArray);
missingColumnErrorMsg = 0;
print(missingColumnErrorMsg);
columnMissingCount = 0;
print(columnMissingCount);
columnIndexMismatchCount = 0;
print(columnIndexMismatchCount);
invalidRelationships = 0;
dobAgeCheckCount = 0;
html.window.localStorage.remove('fileBytes');
// extractedData = [];
// originalData = [];
// filteredData = [];
// validationArray = [];
// nonExcelFilteredData = [];
// print('filteredData');
// print(filteredData);
// print(validationArray);
//
// missingColumnErrorMsg = 0;
// print(missingColumnErrorMsg);
// columnMissingCount = 0;
// print(columnMissingCount);
// columnIndexMismatchCount = 0;
// print(columnIndexMismatchCount);
// invalidRelationships = 0;
// dobAgeCheckCount = 0;
//
// html.window.localStorage.remove('fileBytes');
});
}
@ -517,7 +559,8 @@ class _excelVerifyState extends State<excelVerify> {
return Scaffold(
appBar: CustomAppBar(),
body: SafeArea(
body: Stack(children: [
SafeArea(
child: Theme(
data: ThemeData(
canvasColor: Color(0xFFF4F7FE),
@ -531,7 +574,8 @@ class _excelVerifyState extends State<excelVerify> {
padding: const EdgeInsets.all(20),
color: Color(0xFFEFF3F6),
child: Card(
elevation: 0,
elevation: 1,
color: Colors.white,
child: Column(
children: [
Expanded(
@ -544,33 +588,39 @@ class _excelVerifyState extends State<excelVerify> {
alignment: Alignment.bottomCenter,
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
ElevatedButton(
onPressed: () {
html.window.localStorage.remove('fileBytes');
html.window.localStorage
.remove('fileBytes');
fileBytes = null;
fileName = null;
_currentStep = 0;
missingColumnErrorMsg = 0;
columnIndexMismatchCount = 0;
columnMissingCount = 0;
invalidRelationships = 0;
dobAgeCheckCount = 0;
nonExcelFilteredData = [];
excelHeader.clear();
excelData.clear();
// missingColumnErrorMsg = 0;
// columnIndexMismatchCount = 0;
// columnMissingCount = 0;
// invalidRelationships = 0;
// dobAgeCheckCount = 0;
// nonExcelFilteredData = [];
Navigator.pushNamed(
context, 'hrPolicyDetails',
arguments: argumentsData);
},
child: Text(
'Close',
style: TextStyle(color: Color(0xFFE26728)),
style:
TextStyle(color: Color(0xFFE26728)),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: BorderSide(color: Color(0xFFE26728)),
side: BorderSide(
color: Color(0xFFE26728)),
),
),
),
@ -611,33 +661,21 @@ class _excelVerifyState extends State<excelVerify> {
},
child: Text(
'Previous',
style: TextStyle(color: Color(0xFFE26728)),
style:
TextStyle(color: Color(0xFFE26728)),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side:
BorderSide(color: Color(0xFFE26728)),
borderRadius:
BorderRadius.circular(5),
side: BorderSide(
color: Color(0xFFE26728)),
),
),
),
SizedBox(width: 10),
if (_currentStep != 2)
ElevatedButton(
onPressed: _currentStep == 0
? (fileName != null
? controls.onStepContinue!
: null)
: (_currentStep == 1
? (missingColumnErrorMsg == 0 &&
columnIndexMismatchCount ==
0 &&
invalidRelationships == 0 &&
dobAgeCheckCount == 0
? controls.onStepContinue!
: null)
: null),
child: const Text(
'NEXT',
style: TextStyle(color: Colors.white),
@ -648,24 +686,48 @@ class _excelVerifyState extends State<excelVerify> {
borderRadius: BorderRadius.circular(5),
),
),
// Disable button if excelValidationStatus is 1
// Use ternary operator to conditionally set onPressed to null
onPressed: (_currentStep == 0 &&
fileName == null) ||
(_currentStep == 1 &&
excelValidationStaus == 1)
? null
: () {
if (_currentStep == 0) {
// For Step 0: Enable continue if fileName is not null
if (fileName != null) {
controls.onStepContinue!();
}
} else if (_currentStep == 1) {
// For Step 1: Check excelValidationStatus
if (excelValidationStaus == 0) {
// Navigate to hrPolicyDetails page
Navigator.pushNamed(
context, 'hrPolicyDetails',
arguments: argumentsData);
}
// If excelValidationStatus is 1, button will be disabled (do nothing)
}
},
),
SizedBox(width: 10),
if (_currentStep == 2)
ElevatedButton(
onPressed: () {
_retrieveAndUploadFile();
},
child: Text(
'Submit',
style: TextStyle(color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
),
// if (_currentStep == 2)
// ElevatedButton(
// onPressed: () {
// _retrieveAndUploadFile();
// },
// child: Text(
// 'Submit',
// style: TextStyle(color: Colors.white),
// ),
// style: ElevatedButton.styleFrom(
// backgroundColor: Color(0xFFE26728),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(5),
// ),
// ),
// ),
],
),
);
@ -757,19 +819,24 @@ class _excelVerifyState extends State<excelVerify> {
height:
250, // Adjust height as needed
child: DragTarget(
onAccept:
(html.File droppedFile) {
onAccept: (html.File
droppedFile) {
setState(() {
fileName = droppedFile.name;
fileName =
droppedFile.name;
});
_dragAndDropFile(droppedFile);
_dragAndDropFile(
droppedFile);
},
builder: (BuildContext context,
List<String?> candidateData,
builder:
(BuildContext context,
List<String?>
candidateData,
List<dynamic>
rejectedData) {
return Container(
alignment: Alignment.center,
alignment:
Alignment.center,
child: Column(
mainAxisAlignment:
MainAxisAlignment
@ -812,7 +879,8 @@ class _excelVerifyState extends State<excelVerify> {
Icon(
Icons
.upload_file, // Choose the appropriate icon
size: 35,
size:
35,
color: Color(
0xFFE26728), // Adjust the size as needed
),
@ -829,8 +897,8 @@ class _excelVerifyState extends State<excelVerify> {
height:
25), // Add some space between the icon and text
MouseRegion(
cursor: SystemMouseCursors
.click, // Set cursor to pointer on hover
cursor:
SystemMouseCursors.click, // Set cursor to pointer on hover
child:
GestureDetector(
onTap:
@ -844,17 +912,13 @@ class _excelVerifyState extends State<excelVerify> {
children: [
Icon(
Icons.delete_forever, // Choose the remove icon
size:
20, // Adjust the size as needed
color:
Colors.red, // Set the color of the remove icon
size: 20, // Adjust the size as needed
color: Colors.red, // Set the color of the remove icon
),
SizedBox(
width: 1), // Add some space between the icon and text
SizedBox(width: 1), // Add some space between the icon and text
Text(
'Remove',
style:
TextStyle(fontSize: 13, color: Color(0xFF727272)),
style: TextStyle(fontSize: 13, color: Color(0xFF727272)),
),
],
),
@ -869,8 +933,8 @@ class _excelVerifyState extends State<excelVerify> {
child: Text(
'Select File',
style: TextStyle(
color: Colors
.white),
color:
Colors.white),
),
style: ElevatedButton
.styleFrom(
@ -879,8 +943,10 @@ class _excelVerifyState extends State<excelVerify> {
0xFFE26728),
),
),
SizedBox(height: 20),
if (fileName == null)
SizedBox(
height: 20),
if (fileName ==
null)
Text(
'Supported Files : XLSX')
// Add more Text widgets for additional lines of text
@ -900,19 +966,21 @@ class _excelVerifyState extends State<excelVerify> {
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [
Text(
'Ensure that the import file is in the correct format by comparing it with our template file.',
textAlign: TextAlign.center,
textAlign:
TextAlign.center,
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight.w400,
)),
MouseRegion(
cursor:
SystemMouseCursors.click,
cursor: SystemMouseCursors
.click,
child: GestureDetector(
onTap: () {
downloadSampleFile();
@ -943,131 +1011,158 @@ class _excelVerifyState extends State<excelVerify> {
'Excel Validation',
style: TextStyle(color: Color(0xFFE26728)),
),
content: Padding(
padding: EdgeInsets.only(
top: 30,
bottom: 30,
left: 300,
right:
300), // Adjust the horizontal padding as needed
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_buildRowWithIcon(
missingColumnErrorMsg == 0
? Icons.check_circle
: Icons.error,
'No of column missing : $missingColumnErrorMsg Column',
iconColor: missingColumnErrorMsg == 0
? Colors.green
: Colors
.red, // Set color based on condition
),
if (missingColumnErrorMsg == 0)
_buildRowWithIcon(
columnIndexMismatchCount == 0
? Icons.check_circle
: Icons.error,
'Mismatch in Column Order : $columnIndexMismatchCount - Column',
iconColor: columnIndexMismatchCount == 0
? Colors.green
: Colors.red,
),
_buildRowWithIcon(
invalidRelationships == 0
? Icons.check_circle
: Icons.error,
'Invalid Relationships : $invalidRelationships - Rows',
iconColor: invalidRelationships == 0
? Colors.green
: Colors.red,
),
_buildRowWithIcon(
dobAgeCheckCount == 0
? Icons.check_circle
: Icons.error,
'Age Config - $dobAgeCheckCount - Rows',
iconColor: dobAgeCheckCount == 0
? Colors.green
: Colors.red,
),
],
),
),
isActive: _currentStep == 1,
),
Step(
title: Text(
'Preview',
style: TextStyle(color: Color(0xFFE26728)),
),
content: Column(
children: [
Row(
children: [
Expanded(
flex: 10,
child: Container(
alignment: Alignment.centerLeft,
child: Container(
width:
350, // Set your desired width here
height:
40, // Set your desired height here
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromRGBO(
255,
255,
255,
0.5), // Shadow color with opacity
offset: Offset(5,
5), // Shadow position (horizontal, vertical)
blurRadius: 10, // Blur radius
spreadRadius:
0, // Spread radius
),
],
borderRadius:
BorderRadius.circular(5),
),
child: TextField(
textAlignVertical: TextAlignVertical
.center, // Center the text vertically
decoration: InputDecoration(
hintText: 'Search',
suffixIcon: Icon(Icons.search),
contentPadding: EdgeInsets.all(
10), // Adjust the horizontal padding
border: OutlineInputBorder(
borderSide: BorderSide(
color: Color(
0xFFf5f5f7)), // Set border color to gray
),
),
onChanged:
search, // Call the search method on text change
),
)),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
child: SingleChildScrollView(
child: _buildDataTable(),
content: isSuccess
? Center(
child: Text(
successContent,
style: TextStyle(
fontSize: 20, color: Colors.green),
),
)
],
: excelHeader.isNotEmpty &&
excelData.isNotEmpty
? SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: excelHeader
.map((header) => DataColumn(
label: Text(header)))
.toList(),
rows: excelData
.map((row) => DataRow(
cells: row
.map(
(cell) =>
DataCell(
cell.containsKey(
'error')
? Row(
children: [
Text(cell['value'] ?? ''),
SizedBox(width: 5),
IconButton(
icon: Icon(
Icons.error_outline,
color: Colors.red,
size: 16,
),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
elevation: 0,
backgroundColor: Colors.white,
title: Text('Error Details'),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: (cell['error'] as List).map((e) => Text(e)).toList(),
),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('OK'),
),
],
);
},
);
},
),
isActive: _currentStep == 2,
],
)
: Text(cell['value'] ??
''),
))
.toList(),
))
.toList(),
),
),
)
: Center(
child: CircularProgressIndicator()),
isActive: _currentStep == 1,
),
// Step(
// title: Text(
// 'Preview',
// style: TextStyle(color: Color(0xFFE26728)),
// ),
// content: Column(
// children: [
// Row(
// children: [
// Expanded(
// flex: 10,
// child: Container(
// alignment: Alignment.centerLeft,
// child: Container(
// width:
// 350, // Set your desired width here
// height:
// 40, // Set your desired height here
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// color: Color.fromRGBO(
// 255,
// 255,
// 255,
// 0.5), // Shadow color with opacity
// offset: Offset(5,
// 5), // Shadow position (horizontal, vertical)
// blurRadius: 10, // Blur radius
// spreadRadius:
// 0, // Spread radius
// ),
// ],
// borderRadius:
// BorderRadius.circular(5),
// ),
// child: TextField(
// textAlignVertical: TextAlignVertical
// .center, // Center the text vertically
// decoration: InputDecoration(
// hintText: 'Search',
// suffixIcon: Icon(Icons.search),
// contentPadding: EdgeInsets.all(
// 10), // Adjust the horizontal padding
// border: OutlineInputBorder(
// borderSide: BorderSide(
// color: Color(
// 0xFFf5f5f7)), // Set border color to gray
// ),
// ),
// onChanged:
// search, // Call the search method on text change
// ),
// )),
// ),
// ],
// ),
// SizedBox(height: 20),
// Row(
// children: [
// Expanded(
// child: SingleChildScrollView(
// child: _buildDataTable(),
// ),
// )
// ],
// ),
// ],
// ),
// isActive: _currentStep == 2,
// ),
],
),
),
@ -1095,7 +1190,25 @@ class _excelVerifyState extends State<excelVerify> {
),
),
),
);
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
height: 60,
width: 60,
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
]));
}
Widget _buildDataTable() {

View File

@ -11,6 +11,7 @@ import 'package:nhancepolicy/service/api_service.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
import 'customAppBar/customAppBar.dart';
import 'customAppBar/customFooter.dart';
import 'customAppBar/toastHelper.dart';
import 'package:universal_html/html.dart' as html;
import 'package:intl/intl.dart';
@ -24,10 +25,10 @@ class hrDashboard extends StatefulWidget {
class _hrDashboardState extends State<hrDashboard> {
late ApiService apiService;
bool isLoading = true;
bool isLoading = false;
late String _token;
dynamic getPolicyNo;
bool _isLoading = false;
// bool _isLoading = false;
dynamic getPolicyNameDetails;
dynamic clintID;
dynamic policy_name;
@ -41,17 +42,18 @@ class _hrDashboardState extends State<hrDashboard> {
Color(0xFFDBFFDE),
Color(0xFFE4DFFF),
];
ScrollController _scrollController = ScrollController();
@override
void initState() {
super.initState();
apiService = ApiService(context); // Initialize ApiService here
_loadToken();
Future.delayed(Duration(seconds: 3), () {
setState(() {
isLoading = false;
});
});
// Future.delayed(Duration(seconds: 3), () {
// setState(() {
// isLoading = false;
// });
// });
}
@override
@ -134,9 +136,10 @@ class _hrDashboardState extends State<hrDashboard> {
}
Future<void> getCashDepositDetails(String clintID) async {
setState(() {
_isLoading = true;
});
isLoading = true;
// setState(() {
// _isLoading = true;
// });
try {
if (clintID == null || empRefId == null) {
return;
@ -144,6 +147,7 @@ class _hrDashboardState extends State<hrDashboard> {
final response =
await apiService.getCashDepositDetailsToApi(clintID!, empRefId!);
if (response['status'] == 'success') {
isLoading = false;
setState(() {
getCardArrays = List<Map<String, dynamic>>.from(response['data']);
print(getCardArrays);
@ -223,12 +227,13 @@ class _hrDashboardState extends State<hrDashboard> {
SingleChildScrollView(
child: Container(
padding:
EdgeInsets.only(top: 30, bottom: 30, left: 50, right: 50),
EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
color: Color(0xFFEFF3F6),
child: Column(
children: [
Card(
elevation: 0,
color: Colors.white,
child: Container(
width: double.infinity,
height: 75,
@ -298,117 +303,119 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
SizedBox(height: 16),
// if (getCardArrays.length != 0)
// Card(
// elevation: 0,
// color: Colors.white,
// child: Container(
// width: double.infinity,
// padding: Responsive.isDesktop(context)
// ? EdgeInsets.all(20)
// : EdgeInsets.all(
// 10), // Add padding to the container
// child: Column(children: [
// Row(children: [
// Text(
// 'Cash Transaction',
// style: GoogleFonts.poppins(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// color: Colors.black,
// ),
// )
// ]),
// SizedBox(height: 8),
// Row(
// children: [
// // Create an Expanded widget with flex of 4 for each card
// for (var cardData in getCardArrays)
// Container(
// width:
// 300, // Set a fixed width for the card
// height: cardHeight,
// child: Card(
// elevation: 3,
// color: cardColors[
// getCardArrays.indexOf(cardData) %
// cardColors.length],
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// ListTile(
// title: SizedBox(
// height: 50,
// child: Text(
// cardData['insurerName'],
// style: GoogleFonts.poppins(
// fontSize: 18,
// fontWeight: FontWeight.w500,
// color: Color(0xFF000000),
// height: 1.5,
// ),
// ),
// ),
// subtitle: Text(
// 'Balance: ₹ ${cardData['balance']}',
// style: GoogleFonts.poppins(
// fontSize: 16,
// fontWeight: FontWeight.w400,
// color: Color(0xFF000000),
// height: 1.5,
// ),
// ),
// ),
// SizedBox(height: 10),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 15),
// child: GestureDetector(
// onTap: () {
// openForm(
// cardData['depositData'],
// cardData['insurerName'],
// cardData['clientId'],
// cardData['insurerId'],
// cardColors[getCardArrays
// .indexOf(cardData) %
// cardColors.length],
// );
// },
// child: MouseRegion(
// cursor:
// SystemMouseCursors.click,
// child: Align(
// alignment:
// Alignment.centerRight,
// child: Text(
// 'View Details',
// style:
// GoogleFonts.poppins(
// color:
// Color(0xFF000000),
// fontSize: 14,
// fontWeight:
// FontWeight.w300,
// height: 1.5,
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ])),
// ),
// SizedBox(height: 16),
if (getCardArrays.length != 0)
Card(
elevation: 0,
child: Container(
width: double.infinity,
padding: Responsive.isDesktop(context)
? EdgeInsets.all(20)
: EdgeInsets.all(
10), // Add padding to the container
child: Column(children: [
Row(children: [
Text(
'Cash Transaction',
style: GoogleFonts.poppins(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black,
),
)
]),
SizedBox(height: 8),
Row(
children: [
// Create an Expanded widget with flex of 4 for each card
for (var cardData in getCardArrays)
Container(
width:
300, // Set a fixed width for the card
height: cardHeight,
child: Card(
elevation: 3,
color: cardColors[
getCardArrays.indexOf(cardData) %
cardColors.length],
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
ListTile(
title: SizedBox(
height: 50,
child: Text(
cardData['insurerName'],
style: GoogleFonts.poppins(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
),
),
),
subtitle: Text(
'Balance: ₹ ${cardData['balance']}',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
),
),
),
SizedBox(height: 10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 15),
child: GestureDetector(
onTap: () {
openForm(
cardData['depositData'],
cardData['insurerName'],
cardData['clientId'],
cardData['insurerId'],
cardColors[getCardArrays
.indexOf(cardData) %
cardColors.length],
);
},
child: MouseRegion(
cursor:
SystemMouseCursors.click,
child: Align(
alignment:
Alignment.centerRight,
child: Text(
'View Details',
style:
GoogleFonts.poppins(
color:
Color(0xFF000000),
fontSize: 14,
fontWeight:
FontWeight.w300,
height: 1.5,
),
),
),
),
),
),
],
),
),
),
],
),
])),
),
SizedBox(height: 16),
if (getCardArrays.length != 0)
Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(20)
@ -424,8 +431,7 @@ class _hrDashboardState extends State<hrDashboard> {
children: List.generate(
numExpanded,
(index) {
var insurerName =
getCardArrays[index]
var insurerName = getCardArrays[index]
['insurerName'];
var policyDetails =
getCardArrays[index]
@ -452,20 +458,42 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
SizedBox(height: 8),
Row(
children: [
IconButton(
icon:
Icon(Icons.arrow_back),
onPressed: () {
_scrollController
.animateTo(
_scrollController
.offset -
300,
duration: Duration(
milliseconds: 500),
curve: Curves.easeInOut,
);
},
),
Expanded(
child:
SingleChildScrollView(
scrollDirection:
Axis.horizontal,
controller:
ScrollController(), // Adding ScrollController
_scrollController,
dragStartBehavior:
DragStartBehavior.start,
DragStartBehavior
.start,
child: Row(
children: List.generate(
policyDetails.length,
(index) => Container(
width: 300,
height: policyHeight,
child: GestureDetector(
height:
policyHeight,
child:
GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
@ -474,14 +502,15 @@ class _hrDashboardState extends State<hrDashboard> {
policyDetails[
index]);
},
child: MouseRegion(
child:
MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Card(
elevation: 3,
color:
cardColor, // Use the determined color
cardColor,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
@ -495,19 +524,15 @@ class _hrDashboardState extends State<hrDashboard> {
child:
Text(
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
style: GoogleFonts
.poppins(
fontSize:
16,
fontWeight:
FontWeight.w500,
color:
Color(0xFF000000),
height:
1.5,
style:
GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
),
softWrap:
true, // Allow text to wrap to the next line if needed
true,
),
),
),
@ -520,15 +545,13 @@ class _hrDashboardState extends State<hrDashboard> {
15,
right:
15),
child: Row(
child:
Row(
children: [
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
flex: 4,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Draft',
@ -552,12 +575,9 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
flex: 4,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Enrolled',
@ -581,12 +601,9 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
flex: 4,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Total',
@ -610,8 +627,8 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
],
), // Adjust the horizontal padding as needed
)
),
),
],
),
),
@ -621,6 +638,24 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
),
),
IconButton(
icon: Icon(
Icons.arrow_forward),
onPressed: () {
_scrollController
.animateTo(
_scrollController
.offset +
300,
duration: Duration(
milliseconds: 500),
curve: Curves.easeInOut,
);
},
),
],
),
SizedBox(height: 20),
],
);
@ -629,17 +664,18 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
],
)
),
],
),
))
),
)
],
),
),
),
if (isLoading)
Container(
color: Color(0xFFFFFCE5), // Semi-transparent background
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
@ -648,6 +684,13 @@ class _hrDashboardState extends State<hrDashboard> {
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
]));
}
}

View File

@ -267,7 +267,7 @@ class _MyPhoneState extends State<MyHrLogin> {
return Image.asset(
'assets/hrLogin.jpg',
height: _size.height,
fit: BoxFit.fill,
fit: BoxFit.cover,
);
} else {
return SizedBox();
@ -327,23 +327,23 @@ class _MyPhoneState extends State<MyHrLogin> {
flex: 8,
child: Align(
alignment: Alignment
.centerRight, // Align to the start
.topRight, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
height: 70,
)
: _size.width > 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
),
)),
],
@ -598,7 +598,12 @@ class _MyPhoneState extends State<MyHrLogin> {
SizedBox(
height: _size.height * 0.1,
),
Container(
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double
.infinity, // Make the footer full width
child: Container(
alignment: Alignment.bottomCenter,
padding:
EdgeInsets.symmetric(vertical: 8),
@ -607,28 +612,28 @@ class _MyPhoneState extends State<MyHrLogin> {
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
style: GoogleFonts.poppins(
color: Color(0xFF00989E),
fontSize: 9,
),
@ -637,6 +642,8 @@ class _MyPhoneState extends State<MyHrLogin> {
),
),
),
),
),
],
),
),

View File

@ -19,6 +19,8 @@ import 'package:excel/excel.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as path;
import 'customAppBar/customFooter.dart';
class hrPolicyDetails extends StatefulWidget {
const hrPolicyDetails({Key? key}) : super(key: key);
@ -31,6 +33,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
Uint8List? fileBytes;
late String _token;
List<Map<String, dynamic>> getEmpDependenceByClintId = [];
bool isLoading = false;
bool _isLoading = false;
// dynamic clintID;
late TabController _tabController;
@ -133,6 +136,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
}
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
isLoading = true;
setState(() {
_isLoading = true;
});
@ -140,6 +144,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
final response = await apiService.getEmployeeAndDependenceToApi(
clintID!, getPolicyNo!, empRefId!);
if (response['status'] == 'success') {
isLoading = false;
setState(() {
getEmpDependenceByClintId =
List<Map<String, dynamic>>.from(response['data']);
@ -293,7 +298,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
if (filteredData == []) {
return Scaffold(
appBar: CustomAppBar(),
body: SingleChildScrollView(
body: Stack(children: [
SingleChildScrollView(
child: Container(
color: Color(0xFFEFF3F6),
child: Column(
@ -304,15 +310,36 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
],
),
),
));
),
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
height: 60,
width: 60,
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
]));
} else {
return Scaffold(
appBar: CustomAppBar(),
body: Container(
body: Stack(children: [
Container(
padding: const EdgeInsets.all(20),
color: Color(0xFFEFF3F6),
child: Card(
elevation: 0,
color: Colors.white,
child: SingleChildScrollView(
child: Column(
children: [
@ -341,223 +368,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
'$policyName - ($policyType)',
textAlign: TextAlign
.center, // Align text to the center
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
),
Expanded(
flex: 6,
child: Container(
alignment: Alignment
.centerRight, // Align text to the center
child: MouseRegion(
cursor:
SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
'hrDashboard');
},
child: Icon(
Icons
.close, // Replace with your desired icon
color: Colors
.white, // Replace with your desired icon color
),
),
),
),
),
],
),
),
SizedBox(height: 20),
Row(
children: [
Expanded(
flex: (policyType == 'GPA' ||
policyType == 'GMC')
? 8
: 10,
child: Container(
alignment: Alignment.centerLeft,
child: Container(
width:
350, // Set your desired width here
height:
40, // Set your desired height here
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromRGBO(
255,
255,
255,
0.5), // Shadow color with opacity
offset: Offset(5,
5), // Shadow position (horizontal, vertical)
blurRadius:
10, // Blur radius
spreadRadius:
0, // Spread radius
),
],
borderRadius:
BorderRadius.circular(
5),
),
child: TextField(
textAlignVertical:
TextAlignVertical
.center, // Center the text vertically
decoration: InputDecoration(
hintText: 'Search',
suffixIcon:
Icon(Icons.search),
contentPadding:
EdgeInsets.all(
10), // Adjust the horizontal padding
border:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(
0xFFf5f5f7)), // Set border color to gray
),
),
controller:
searchController,
onChanged:
search, // Call the search method on text change
),
)),
),
Expanded(
flex: 2,
child: Container(
alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
child: ElevatedButton(
onPressed: () =>
{downloadExcel()},
child: Text(
'Export',
style: TextStyle(
color:
Colors.white),
),
style: ElevatedButton
.styleFrom(
backgroundColor:
Color(0xFFE26728),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(5),
),
),
),
),
],
),
),
),
SizedBox(
width: (policyType == 'GPA' ||
policyType == 'GMC')
? 5
: 0),
if ((policyType == 'GPA' ||
policyType == 'GMC') &&
inceptionType == 2)
Expanded(
flex: 2,
child: Container(
alignment:
Alignment.centerRight,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
child: ElevatedButton(
onPressed: () =>
_uploadFile(
policyType),
child: Text(
'Import Data',
style: TextStyle(
color:
Colors.white),
),
style: ElevatedButton
.styleFrom(
backgroundColor:
Color(0xFFE26728),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(
5),
),
),
),
),
],
),
),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
child: SingleChildScrollView(
child:
_buildDataTableGPA(context),
),
)
],
),
],
))
: Container(
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.all(
10), // Set your desired padding
color: Color(
0xFFE26728), // Set your desired background color
child: Row(
children: [
Expanded(
flex: 6,
child: Container(
alignment: Alignment
.centerLeft, // Align text to the center
child: Text(
(policyName != null &&
policyType != null)
? '$policyName - ($policyType)'
: '',
textAlign: TextAlign
.center, // Align text to the center
style: GoogleFonts.poppins(
style:
GoogleFonts.poppins(
fontSize: 16,
fontWeight:
FontWeight.w500,
@ -593,6 +405,236 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
],
),
),
SizedBox(height: 20),
Row(
children: [
Expanded(
flex: (policyType == 'GPA' ||
policyType == 'GMC')
? 8
: 10,
child: Container(
alignment:
Alignment.centerLeft,
child: Container(
width:
350, // Set your desired width here
height:
40, // Set your desired height here
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color.fromRGBO(
255,
255,
255,
0.5), // Shadow color with opacity
offset: Offset(5,
5), // Shadow position (horizontal, vertical)
blurRadius:
10, // Blur radius
spreadRadius:
0, // Spread radius
),
],
borderRadius:
BorderRadius
.circular(5),
),
child: TextField(
textAlignVertical:
TextAlignVertical
.center, // Center the text vertically
decoration:
InputDecoration(
hintText: 'Search',
suffixIcon: Icon(
Icons.search),
contentPadding:
EdgeInsets.all(
10), // Adjust the horizontal padding
border:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(
0xFFf5f5f7)), // Set border color to gray
),
),
controller:
searchController,
onChanged:
search, // Call the search method on text change
),
)),
),
Expanded(
flex: 2,
child: Container(
alignment:
Alignment.centerRight,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: ElevatedButton(
onPressed: () =>
{downloadExcel()},
child: Text(
'Export',
style: TextStyle(
color: Colors
.white),
),
style: ElevatedButton
.styleFrom(
backgroundColor:
Color(
0xFFE26728),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(
5),
),
),
),
),
],
),
),
),
SizedBox(
width: (policyType == 'GPA' ||
policyType == 'GMC')
? 5
: 0),
if ((policyType == 'GPA' ||
policyType == 'GMC') &&
inceptionType == 2)
Expanded(
flex: 2,
child: Container(
alignment:
Alignment.centerRight,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Expanded(
child: ElevatedButton(
onPressed: () =>
_uploadFile(
policyType),
child: Text(
'Import Data',
style: TextStyle(
color: Colors
.white),
),
style:
ElevatedButton
.styleFrom(
backgroundColor:
Color(
0xFFE26728),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(
5),
),
),
),
),
],
),
),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
child: SingleChildScrollView(
child: _buildDataTableGPA(
context),
),
)
],
),
],
))
: Container(
height:
MediaQuery.of(context).size.height,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.all(
10), // Set your desired padding
color: Color(
0xFFE26728), // Set your desired background color
child: Row(
children: [
Expanded(
flex: 6,
child: Container(
alignment: Alignment
.centerLeft, // Align text to the center
child: Text(
(policyName != null &&
policyType !=
null)
? '$policyName - ($policyType)'
: '',
textAlign: TextAlign
.center, // Align text to the center
style:
GoogleFonts.poppins(
fontSize: 16,
fontWeight:
FontWeight.w500,
color: Colors.white,
),
),
),
),
Expanded(
flex: 6,
child: Container(
alignment: Alignment
.centerRight, // Align text to the center
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
'hrDashboard');
},
child: Icon(
Icons
.close, // Replace with your desired icon
color: Colors
.white, // Replace with your desired icon color
),
),
),
),
),
],
),
),
SizedBox(height: 200),
if (inceptionType == 2)
Center(
@ -604,12 +646,15 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
style: TextStyle(
color: Colors.white),
),
style: ElevatedButton.styleFrom(
style:
ElevatedButton.styleFrom(
backgroundColor:
Color(0xFFE26728),
shape: RoundedRectangleBorder(
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5),
BorderRadius.circular(
5),
),
),
),
@ -635,7 +680,25 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
),
)),
),
);
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
height: 60,
width: 60,
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
]));
}
}
@ -645,7 +708,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
return Text('No available data');
} else {
return Card(
elevation: 0, // Set elevation to 0 for no shadow
elevation: 0,
color: Colors.white, // Set elevation to 0 for no shadow
child: PaginatedDataTable(
rowsPerPage: 25, // Adjust rows per page as needed
columns: [

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
import 'package:nhancepolicy/models/environment.dart';
import 'package:pinput/pinput.dart';
@ -404,7 +405,7 @@ class _MyVerifyState extends State<MyHrVerify> {
return Image.asset(
'assets/hrLogin.jpg',
height: _size.height,
fit: BoxFit.fill,
fit: BoxFit.cover,
);
} else {
return SizedBox();
@ -429,23 +430,23 @@ class _MyVerifyState extends State<MyHrVerify> {
flex: 8,
child: Align(
alignment: Alignment
.centerRight, // Align to the start
.topRight, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
height: 70,
)
: _size.width > 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
),
)),
],
@ -462,7 +463,7 @@ class _MyVerifyState extends State<MyHrVerify> {
children: [
Text(
"Welcome to Nhance",
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.bold,
),
@ -481,14 +482,14 @@ class _MyVerifyState extends State<MyHrVerify> {
text: TextSpan(
text:
"Please enter the one-time usage code sent to your mobile number $mobileNumber",
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 12,
height: 1.5,
color: Color(0xFF000000)),
children: [
TextSpan(
text: " (Change Number)",
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 12,
color: Color(
0xFFE26728)), // Change color as desired
@ -531,7 +532,7 @@ class _MyVerifyState extends State<MyHrVerify> {
_isTimerRunning
? Text(
"Resend OTP in $_secondsRemaining seconds",
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.black),
)
: InkWell(
@ -540,7 +541,7 @@ class _MyVerifyState extends State<MyHrVerify> {
},
child: Text(
"Resend OTP",
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.blue),
),
),
@ -574,7 +575,7 @@ class _MyVerifyState extends State<MyHrVerify> {
},
child: Text(
"Submit",
style: TextStyle(
style: GoogleFonts.poppins(
color: Color(0xFFFFFFFF)),
),
),
@ -592,7 +593,7 @@ class _MyVerifyState extends State<MyHrVerify> {
SizedBox(height: 30),
Text(
"Benefits of Login",
style: TextStyle(
style: GoogleFonts.poppins(
fontSize: 20,
fontWeight: FontWeight.bold,
),
@ -687,7 +688,12 @@ class _MyVerifyState extends State<MyHrVerify> {
SizedBox(
height: _size.height * 0.1,
),
Container(
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double
.infinity, // Make the footer full width
child: Container(
alignment: Alignment.bottomCenter,
padding:
EdgeInsets.symmetric(vertical: 8),
@ -696,28 +702,28 @@ class _MyVerifyState extends State<MyHrVerify> {
text: TextSpan(
text:
'By continuing, you agree with our ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 9,
),
children: <TextSpan>[
TextSpan(
text: 'privacy policy ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Color(0xFF00989E),
fontSize: 9,
),
),
TextSpan(
text: 'and ',
style: TextStyle(
style: GoogleFonts.poppins(
color: Colors.black,
fontSize: 9,
),
),
TextSpan(
text: 'terms of use',
style: TextStyle(
style: GoogleFonts.poppins(
color: Color(0xFF00989E),
fontSize: 9,
),
@ -726,6 +732,8 @@ class _MyVerifyState extends State<MyHrVerify> {
),
),
),
),
),
],
),
),

View File

@ -273,25 +273,25 @@ class _MyPhoneState extends State<MyPhone> {
child: Align(
alignment: Responsive.isDesktop(
context)
? Alignment.centerLeft
? Alignment.topLeft
: Alignment
.bottomCenter, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
height: 70,
)
: _size.width > 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
),
)),
Expanded(
@ -581,7 +581,12 @@ class _MyPhoneState extends State<MyPhone> {
SizedBox(
height: _size.height * 0.1,
),
Container(
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double
.infinity, // Make the footer full width
child: Container(
alignment: Alignment.bottomCenter,
padding:
EdgeInsets.symmetric(vertical: 8),
@ -620,6 +625,8 @@ class _MyPhoneState extends State<MyPhone> {
),
),
),
),
),
],
),
),

View File

@ -32,7 +32,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getClientDetails?client_id=$clientId&emp_code=$empCode&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -47,7 +47,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getEmployeeProfile?emp_code=$empCode&client_id=$clientId&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -60,7 +60,7 @@ class ApiService {
}
final url = Uri.parse('${Environment.apiUrl}relationshipList');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -75,7 +75,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -90,7 +90,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -105,7 +105,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getAddOnPolicy?client_id=$client_id&emp_code=$emp_code&policy=$policy&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -120,7 +120,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getAddOnPolicy?client_id=$client_id&emp_code=$emp_code&policy=$policy&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -135,7 +135,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getAddOnPolicy?client_id=$client_id&emp_code=$emp_code&policy=$policy&client_branch_id=$branchID');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -150,7 +150,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}removeEmpAndEmpPolicyData?emp_code=$empCodeString&client_policy_id=$addOnsDependentClientPolicyId');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -165,7 +165,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}removeEmpAndEmpPolicyData?emp_code=$empCodeString&client_policy_id=$topUpClientPolicyId');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -180,7 +180,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}removeEmpAndEmpPolicyData?emp_code=$empCodeString&client_policy_id=$topUpParentClientPolicyId');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -193,7 +193,7 @@ class ApiService {
}
final url = Uri.parse('${Environment.apiUrl}deleteDependence?id=$id');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -208,7 +208,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}addEmployeeAndDependence');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -229,7 +229,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}addEmployeeAndDependence');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -251,7 +251,7 @@ class ApiService {
final url =
Uri.parse('${Environment.apiUrl}createOrUpdateEmployeePolicySiAmount');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -273,7 +273,7 @@ class ApiService {
final url =
Uri.parse('${Environment.apiUrl}createOrUpdateEmployeePolicySiAmount');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -295,7 +295,7 @@ class ApiService {
final url =
Uri.parse('${Environment.apiUrl}createOrUpdateEmployeePolicySiAmount');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -316,7 +316,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}iAgreeForAddOn');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -336,7 +336,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}calculatePremium');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -357,7 +357,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}calculatePremium');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -378,7 +378,7 @@ class ApiService {
final url = Uri.parse('${Environment.apiUrl}calculatePremium');
final headers = {
'Authorization': _token ?? '',
'Authorization': 'Bearer $_token' ?? '',
'Content-Type': 'application/json', // Ensure content type is JSON
};
@ -401,7 +401,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getCashDepositData?client_id=$clintID&client_branch_id=$empRefId');
final headers = {
'Authorization': _hrtoken ?? '',
'Authorization': 'Bearer $_hrtoken' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;
@ -416,7 +416,7 @@ class ApiService {
final url = Uri.parse(
'${Environment.apiUrl}getEmployeeAndDependenceByClientId?client_id=$clintID&client_policy_id=$getPolicyNo&client_branch_id=$empRefId');
final headers = {
'Authorization': _hrtoken ?? '',
'Authorization': 'Bearer $_hrtoken' ?? '',
};
final response = await _makeGetRequest(url, headers);
return response;

View File

@ -397,25 +397,25 @@ class _MyVerifyState extends State<MyVerify> {
child: Align(
alignment: Responsive.isDesktop(
context)
? Alignment.centerLeft
? Alignment.topLeft
: Alignment
.bottomCenter, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/Nhance-Logo-Final-mobile.png',
width: 150,
height: 150,
height: 70,
)
: _size.width > 1100
? Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
)
: Image.asset(
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
height: 70,
),
)),
],
@ -658,7 +658,12 @@ class _MyVerifyState extends State<MyVerify> {
SizedBox(
height: _size.height * 0.1,
),
Container(
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double
.infinity, // Make the footer full width
child: Container(
alignment: Alignment.bottomCenter,
padding:
EdgeInsets.symmetric(vertical: 8),
@ -697,6 +702,8 @@ class _MyVerifyState extends State<MyVerify> {
),
),
),
),
),
],
),
),

View File

@ -53,6 +53,7 @@ dependencies:
flutter_animated_button: ^2.0.3
spreadsheet_decoder: ^2.2.0
url_launcher: ^6.2.6
font_awesome_flutter: ^10.7.0
dev_dependencies: