UI-HR-preEnrollement
This commit is contained in:
parent
8d470bec18
commit
65734fe2a6
@ -199,6 +199,7 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
empClientId: empClientId,
|
empClientId: empClientId,
|
||||||
empClientBranchId: empClientBranchId,
|
empClientBranchId: empClientBranchId,
|
||||||
empHrId: empHrId,
|
empHrId: empHrId,
|
||||||
|
empToken: _postToken,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -420,19 +421,21 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(),
|
appBar: CustomAppBar(),
|
||||||
body: Stack(children: [
|
body: Stack(children: [
|
||||||
SingleChildScrollView(
|
Container(
|
||||||
child: Container(
|
padding: const EdgeInsets.all(40),
|
||||||
padding:
|
|
||||||
EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
|
// padding: const EdgeInsets.only(
|
||||||
color: Color(0xFFEFF3F6),
|
// top: 20, bottom: 20, left: 50, right: 50),
|
||||||
|
color: const Color(0xFFEFF3F6),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 75,
|
// height: 75,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.12,
|
||||||
padding: Responsive.isDesktop(context)
|
padding: Responsive.isDesktop(context)
|
||||||
? EdgeInsets.only(
|
? const EdgeInsets.only(
|
||||||
top: 10, bottom: 10, left: 20, right: 20)
|
top: 10, bottom: 10, left: 20, right: 20)
|
||||||
: EdgeInsets.only(
|
: EdgeInsets.only(
|
||||||
top: 12,
|
top: 12,
|
||||||
@ -457,19 +460,17 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
if (loadingProgress == null) return child;
|
if (loadingProgress == null) return child;
|
||||||
return Center(
|
return Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
value:
|
value: loadingProgress.expectedTotalBytes !=
|
||||||
loadingProgress.expectedTotalBytes !=
|
|
||||||
null
|
null
|
||||||
? loadingProgress
|
? loadingProgress
|
||||||
.cumulativeBytesLoaded /
|
.cumulativeBytesLoaded /
|
||||||
loadingProgress
|
loadingProgress.expectedTotalBytes!
|
||||||
.expectedTotalBytes!
|
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
errorBuilder: (BuildContext context,
|
errorBuilder: (BuildContext context, Object error,
|
||||||
Object error, StackTrace? stackTrace) {
|
StackTrace? stackTrace) {
|
||||||
return Image.asset(
|
return Image.asset(
|
||||||
'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path
|
'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path
|
||||||
width: 80,
|
width: 80,
|
||||||
@ -486,8 +487,7 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
clientName ?? '',
|
clientName ?? '',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize:
|
fontSize: Responsive.isDesktop(context) ? 20 : 18,
|
||||||
Responsive.isDesktop(context) ? 20 : 18,
|
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -499,9 +499,10 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(5),
|
||||||
|
height: MediaQuery.of(context).size.height * 0.08,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(
|
color:
|
||||||
0xFFC4E3E6), // 🔹 Background behind the TabBar
|
Color(0xFFC4E3E6), // 🔹 Background behind the TabBar
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
border: Border.all(color: Colors.transparent),
|
border: Border.all(color: Colors.transparent),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
@ -564,414 +565,27 @@ class _hrDashboardState extends State<hrDashboard>
|
|||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
// Expanded TabBarView
|
// Expanded TabBarView
|
||||||
SizedBox(
|
Expanded(
|
||||||
height: 500, // Adjust height based on your layout
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: tabViews,
|
children: tabViews,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// SizedBox(
|
||||||
|
// height: MediaQuery.of(context).size.height * 0.55,
|
||||||
|
// // height: 500, // Adjust height based on your layout
|
||||||
// child: TabBarView(
|
// child: TabBarView(
|
||||||
// controller: _tabController,
|
// controller: _tabController,
|
||||||
// children: [
|
// children: tabViews,
|
||||||
// // Pre Enrollment Tab
|
|
||||||
// Card(
|
|
||||||
// elevation: 5,
|
|
||||||
// color: Colors.white,
|
|
||||||
// child: Container(
|
|
||||||
// child: GridView.builder(
|
|
||||||
// itemCount: getCardArrays.length,
|
|
||||||
// gridDelegate:
|
|
||||||
// const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
// crossAxisCount:
|
|
||||||
// 4, // Adjust for screen size (e.g., use 2 or 3 for tablets)
|
|
||||||
// crossAxisSpacing: 16,
|
|
||||||
// mainAxisSpacing: 0,
|
|
||||||
// childAspectRatio: 2,
|
|
||||||
// ),
|
// ),
|
||||||
// itemBuilder: (context, index) {
|
|
||||||
// return buildPolicyCard(
|
|
||||||
// getCardArrays[index]);
|
|
||||||
// },
|
|
||||||
// ),
|
// ),
|
||||||
// )),
|
|
||||||
//
|
|
||||||
// Center(child: Text("Active Policies")),
|
|
||||||
// Center(child: Text("CD")),
|
|
||||||
// Center(child: Text("Claims")),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
// 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,
|
|
||||||
// color: Colors.white,
|
|
||||||
// child: Padding(
|
|
||||||
// padding: Responsive.isDesktop(context)
|
|
||||||
// ? EdgeInsets.all(20)
|
|
||||||
// : EdgeInsets.all(10),
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment:
|
|
||||||
// CrossAxisAlignment.start,
|
|
||||||
// children: List.generate(
|
|
||||||
// numExpanded,
|
|
||||||
// (index) {
|
|
||||||
// var insurerName = getCardArrays[index]
|
|
||||||
// ['insurerName'];
|
|
||||||
// var policyDetails =
|
|
||||||
// getCardArrays[index]
|
|
||||||
// ['policyDetails'];
|
|
||||||
//
|
|
||||||
// // Determine the color for the policyDetails based on the index of the card in getCardArrays
|
|
||||||
// var cardColorIndex =
|
|
||||||
// getCardArrays.indexOf(
|
|
||||||
// getCardArrays[index]) %
|
|
||||||
// cardColors.length;
|
|
||||||
// var cardColor =
|
|
||||||
// cardColors[cardColorIndex];
|
|
||||||
//
|
|
||||||
// return Column(
|
|
||||||
// crossAxisAlignment:
|
|
||||||
// CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// insurerName,
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 18,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// color: Colors.black,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// 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,
|
|
||||||
// dragStartBehavior:
|
|
||||||
// DragStartBehavior
|
|
||||||
// .start,
|
|
||||||
// child: Row(
|
|
||||||
// children: List.generate(
|
|
||||||
// policyDetails.length,
|
|
||||||
// (index) => Container(
|
|
||||||
// width: 300,
|
|
||||||
// height:
|
|
||||||
// policyHeight,
|
|
||||||
// child:
|
|
||||||
// GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.pushNamed(
|
|
||||||
// context,
|
|
||||||
// 'hrPolicyDetails',
|
|
||||||
// arguments:
|
|
||||||
// policyDetails[
|
|
||||||
// index]);
|
|
||||||
// },
|
|
||||||
// child:
|
|
||||||
// MouseRegion(
|
|
||||||
// cursor:
|
|
||||||
// SystemMouseCursors
|
|
||||||
// .click,
|
|
||||||
// child: Card(
|
|
||||||
// elevation: 3,
|
|
||||||
// color:
|
|
||||||
// cardColor,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment:
|
|
||||||
// CrossAxisAlignment
|
|
||||||
// .start,
|
|
||||||
// children: [
|
|
||||||
// ListTile(
|
|
||||||
// title:
|
|
||||||
// SizedBox(
|
|
||||||
// height:
|
|
||||||
// 50,
|
|
||||||
// child:
|
|
||||||
// Text(
|
|
||||||
// '${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
|
|
||||||
// style:
|
|
||||||
// GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// softWrap:
|
|
||||||
// true,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height:
|
|
||||||
// 8),
|
|
||||||
// Padding(
|
|
||||||
// padding: EdgeInsets.only(
|
|
||||||
// left:
|
|
||||||
// 15,
|
|
||||||
// right:
|
|
||||||
// 15),
|
|
||||||
// child:
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// flex: 4,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// 'Draft',
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Text(
|
|
||||||
// policyDetails[index]['membersCountOfDraft'].toString(),
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w400,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// flex: 4,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// 'Enrolled',
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Text(
|
|
||||||
// policyDetails[index]['membersCountOfEnrolled'].toString(),
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w400,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// flex: 4,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// 'Total',
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Text(
|
|
||||||
// policyDetails[index]['totalMembersCount'].toString(),
|
|
||||||
// style: GoogleFonts.poppins(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w400,
|
|
||||||
// color: Color(0xFF000000),
|
|
||||||
// height: 1.5,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// IconButton(
|
|
||||||
// icon: Icon(
|
|
||||||
// Icons.arrow_forward),
|
|
||||||
// onPressed: () {
|
|
||||||
// _scrollController
|
|
||||||
// .animateTo(
|
|
||||||
// _scrollController
|
|
||||||
// .offset +
|
|
||||||
// 300,
|
|
||||||
// duration: Duration(
|
|
||||||
// milliseconds: 500),
|
|
||||||
// curve: Curves.easeInOut,
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 20),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
Container(
|
Container(
|
||||||
color: Color(0x98FFFCE5), // Semi-transparent background
|
color: Color(0x98FFFCE5), // Semi-transparent background
|
||||||
|
|||||||
@ -415,13 +415,30 @@ class ApiService {
|
|||||||
String clintID, String empRefId, String hr_id, String token) async {
|
String clintID, String empRefId, String hr_id, String token) async {
|
||||||
print("getCashDepositDetailsToApi1");
|
print("getCashDepositDetailsToApi1");
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
await _initializeToken();
|
||||||
|
}
|
||||||
|
final url = Uri.parse(
|
||||||
|
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=470');
|
||||||
|
|
||||||
|
final headers = {
|
||||||
|
'Authorization': 'Bearer $token' ?? '',
|
||||||
|
};
|
||||||
|
final response = await _makeGetRequest(url, headers);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, dynamic>> getActiveCashDepositDetailsToApi(String clintID,
|
||||||
|
String empRefId, String hr_id, String token, int emp_status) async {
|
||||||
|
print("getCashDepositDetailsToApi1");
|
||||||
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
// final url = Uri.parse(
|
// final url = Uri.parse(
|
||||||
// '${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=470');
|
// '${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=470');
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=$hr_id');
|
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&policy_status=$emp_status&hr_id=$hr_id');
|
||||||
|
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $token' ?? '',
|
'Authorization': 'Bearer $token' ?? '',
|
||||||
|
|||||||
@ -11,11 +11,13 @@ class ActivePolicies extends StatefulWidget {
|
|||||||
final String empClientId;
|
final String empClientId;
|
||||||
final String empClientBranchId;
|
final String empClientBranchId;
|
||||||
final String empHrId;
|
final String empHrId;
|
||||||
|
final String empToken;
|
||||||
|
|
||||||
const ActivePolicies(
|
const ActivePolicies(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
required this.empClientId,
|
required this.empClientId,
|
||||||
required this.empClientBranchId,
|
required this.empClientBranchId,
|
||||||
|
required this.empToken,
|
||||||
required this.empHrId});
|
required this.empHrId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -24,22 +26,221 @@ class ActivePolicies extends StatefulWidget {
|
|||||||
|
|
||||||
class _ActivePolicieState extends State<ActivePolicies> {
|
class _ActivePolicieState extends State<ActivePolicies> {
|
||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
dynamic getCardArrays = [];
|
// dynamic getCardArrays = [];
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 1;
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> getCardArrays = [
|
||||||
|
{
|
||||||
|
"client_policy_id": 392,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 2,
|
||||||
|
"is_addon": 1,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC",
|
||||||
|
"policy_name": "Group Medical Coverage",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 396,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 4,
|
||||||
|
"is_addon": 2,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC - Topup",
|
||||||
|
"policy_name": "Group Medical Coverage Topup",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 392,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 2,
|
||||||
|
"is_addon": 1,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC",
|
||||||
|
"policy_name": "Group Medical Coverage",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 396,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 4,
|
||||||
|
"is_addon": 2,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC - Topup",
|
||||||
|
"policy_name": "Group Medical Coverage Topup",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 396,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 4,
|
||||||
|
"is_addon": 2,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC - Topup",
|
||||||
|
"policy_name": "Group Medical Coverage Topup",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 392,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 2,
|
||||||
|
"is_addon": 1,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC",
|
||||||
|
"policy_name": "Group Medical Coverage",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_policy_id": 396,
|
||||||
|
"client_id": 58,
|
||||||
|
"policy_type_id": 4,
|
||||||
|
"is_addon": 2,
|
||||||
|
"OpenForEnrollment": 1,
|
||||||
|
"inception_type": 2,
|
||||||
|
"policy_no": "GMC-MA8596745566998855885",
|
||||||
|
"insurer_id": 1,
|
||||||
|
"type": "GMC - Topup",
|
||||||
|
"policy_name": "Group Medical Coverage Topup",
|
||||||
|
"insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
"insurer_short_name": "LIC",
|
||||||
|
"totalMembersCount": 7,
|
||||||
|
"membersCountOfEnrolled": 0,
|
||||||
|
"membersCountOfDraft": 7
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
apiService = ApiService(context);
|
apiService = ApiService(context);
|
||||||
|
_loadData();
|
||||||
|
|
||||||
|
print("_PreEnrollmentState 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadData() async {
|
||||||
|
await getCashDepositDetails(widget.empClientBranchId, widget.empClientId,
|
||||||
|
widget.empHrId, widget.empToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCashDepositDetails(
|
||||||
|
clintBranchId, clintID, hr_id, token) async {
|
||||||
|
print("_PreEnrollmentState 2");
|
||||||
|
print('IN');
|
||||||
|
print("clintBranchId -$clintBranchId");
|
||||||
|
print("clintID -$clintID");
|
||||||
|
print("hr_id -$hr_id");
|
||||||
|
print("token -$token");
|
||||||
|
|
||||||
|
// isLoading = true;
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = true;
|
||||||
|
// });
|
||||||
|
try {
|
||||||
|
if (clintBranchId == null || clintID == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await apiService.getActiveCashDepositDetailsToApi(
|
||||||
|
clintID!, clintBranchId!, hr_id, token, selectedIndex);
|
||||||
|
|
||||||
|
// final response = await apiService.getCashDepositDetailsToApi(
|
||||||
|
// clintID!, clintBranchId!, hr_id, token);
|
||||||
|
print('IN1');
|
||||||
|
if (response['status'] == 'success') {
|
||||||
|
// isLoading = false;
|
||||||
|
setState(() {
|
||||||
|
print('response');
|
||||||
|
print(response['data']);
|
||||||
|
|
||||||
|
print("_PreEnrollmentState 3");
|
||||||
|
getCardArrays = List<Map<String, dynamic>>.from(response['data']);
|
||||||
|
print('getCardArrays');
|
||||||
|
print(getCardArrays);
|
||||||
|
});
|
||||||
|
|
||||||
|
print('IN2');
|
||||||
|
print("getCardArrays9 - $getCardArrays");
|
||||||
|
} else {
|
||||||
|
print('API request failed with status');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
final screenHeight = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
final crossAxisCount = 4;
|
||||||
|
final spacing = 20.0; // crossAxisSpacing
|
||||||
|
final totalSpacing = (crossAxisCount - 1) * spacing;
|
||||||
|
final itemWidth = (screenWidth - totalSpacing) / crossAxisCount;
|
||||||
|
|
||||||
|
// Example: target card height
|
||||||
|
final itemHeight = screenHeight * 0.2;
|
||||||
|
|
||||||
|
// Dynamic aspect ratio:
|
||||||
|
final aspectRatio = screenWidth / screenHeight;
|
||||||
|
|
||||||
|
print("_PreEnrollmentState 4");
|
||||||
// TODO: implement build
|
// TODO: implement build
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.white,
|
// height: MediaQuery.of(context).size.height * 0.2,
|
||||||
|
|
||||||
|
// height: 400,
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
// color: Colors.yellow.shade100,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
//
|
||||||
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -70,36 +271,182 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Container(
|
SizedBox(
|
||||||
// color: Colors.amber,
|
height: 20,
|
||||||
// child: Card(
|
),
|
||||||
// elevation: 5,
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
// color: Colors.redAccent.shade100,
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
// child: GridView.builder(
|
// color: Colors.white,
|
||||||
// itemCount: getCardArrays.length,
|
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
height: MediaQuery.of(context).size.height * 0.4,
|
||||||
// crossAxisCount: 4,
|
// height: 400,
|
||||||
// crossAxisSpacing: 16,
|
|
||||||
// mainAxisSpacing: 0,
|
child: GridView.builder(
|
||||||
|
itemCount: getCardArrays.length,
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 4,
|
||||||
|
crossAxisSpacing: 20,
|
||||||
|
mainAxisSpacing: 20,
|
||||||
// childAspectRatio: 2,
|
// childAspectRatio: 2,
|
||||||
// ),
|
childAspectRatio: aspectRatio,
|
||||||
// itemBuilder: (context, index) {
|
// childAspectRatio: 2.1,
|
||||||
// return buildPolicyCard(getCardArrays[index]);
|
),
|
||||||
// },
|
itemBuilder: (context, index) {
|
||||||
// ),
|
return buildPolicyCard(getCardArrays[index]);
|
||||||
// ),
|
},
|
||||||
// ),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildTab(String title, int index) {
|
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
||||||
final isSelected = selectedIndex == index;
|
final mediaQuery = MediaQuery.of(context);
|
||||||
|
final devicePixelRatio = mediaQuery.devicePixelRatio;
|
||||||
|
final logicalWidth = 230 / devicePixelRatio;
|
||||||
|
final logicalHeight = 115 / devicePixelRatio;
|
||||||
|
|
||||||
|
print("logicalWidth - $logicalWidth");
|
||||||
|
print("logicalHeight - $logicalHeight");
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedIndex = index;
|
print("policy");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// height: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// width: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// width: logicalWidth,
|
||||||
|
// height: logicalHeight,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
|
||||||
|
// height: MediaQuery.of(context).size.height * 1,
|
||||||
|
// width: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// margin: EdgeInsets.only(bottom: 10.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
// color: Colors.yellow.shade50,
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black12,
|
||||||
|
blurRadius: 6,
|
||||||
|
spreadRadius: 1,
|
||||||
|
offset: Offset(0, 0), // Equal shadow in all directions
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.07,
|
||||||
|
// color: Colors.green.shade100,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"${policy['policy_no']} " ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: "Inter",
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"${policy['insurer_short_name']} - ${policy['policy_name']} " ??
|
||||||
|
'',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Container(
|
||||||
|
// color: Colors.pink.shade50,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.09,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfDraft'].toString(),
|
||||||
|
"Active",
|
||||||
|
Color(0xFF7BD9B6),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfEnrolled'].toString(),
|
||||||
|
"Inactive",
|
||||||
|
Color(0xFFFF2020),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
// _buildCountBox(
|
||||||
|
// policy['totalMembersCount'].toString(), "Total"),
|
||||||
|
// Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCountBox(String count, String label, Color boxColor) {
|
||||||
|
return Column(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
// width: 70,
|
||||||
|
// height: 40,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.05,
|
||||||
|
width: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: boxColor,
|
||||||
|
// color: const Color(0xFFDFF1F3),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
count,
|
||||||
|
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Spacer(),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(label,
|
||||||
|
style: const TextStyle(fontSize: 10, color: Color(0xFF848484))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildTab(String title, int index) {
|
||||||
|
final isSelected = selectedIndex == index + 1;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedIndex = index + 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -128,68 +475,4 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
|||||||
))),
|
))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
|
||||||
return Card(
|
|
||||||
elevation: 3,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
policy['type'] ?? '',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Text(
|
|
||||||
policy['policy_name'] ?? '',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
_buildCountBox(
|
|
||||||
policy['membersCountOfDraft'].toString(), "Draft"),
|
|
||||||
_buildCountBox(
|
|
||||||
policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
|
||||||
_buildCountBox(policy['totalMembersCount'].toString(), "Total"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildCountBox(String count, String label) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 50,
|
|
||||||
height: 40,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFDFF1F3),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
count,
|
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Text(label,
|
|
||||||
style: const TextStyle(fontSize: 12, color: Colors.black87)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,44 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
dynamic getCardArrays = [];
|
dynamic getCardArrays = [];
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
|
// List<Map<String, dynamic>> getCardArrays = [
|
||||||
|
// {
|
||||||
|
// "client_policy_id": 392,
|
||||||
|
// "client_id": 58,
|
||||||
|
// "policy_type_id": 2,
|
||||||
|
// "is_addon": 1,
|
||||||
|
// "OpenForEnrollment": 1,
|
||||||
|
// "inception_type": 2,
|
||||||
|
// "policy_no": "GMC-MA8596745566998855885",
|
||||||
|
// "insurer_id": 1,
|
||||||
|
// "type": "GMC",
|
||||||
|
// "policy_name": "Group Medical Coverage",
|
||||||
|
// "insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
// "insurer_short_name": "LIC",
|
||||||
|
// "totalMembersCount": 7,
|
||||||
|
// "membersCountOfEnrolled": 0,
|
||||||
|
// "membersCountOfDraft": 7
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "client_policy_id": 396,
|
||||||
|
// "client_id": 58,
|
||||||
|
// "policy_type_id": 4,
|
||||||
|
// "is_addon": 2,
|
||||||
|
// "OpenForEnrollment": 1,
|
||||||
|
// "inception_type": 2,
|
||||||
|
// "policy_no": "GMC-MA8596745566998855885",
|
||||||
|
// "insurer_id": 1,
|
||||||
|
// "type": "GMC - Topup",
|
||||||
|
// "policy_name": "Group Medical Coverage Topup",
|
||||||
|
// "insurer_name": "Life Insurance Corporation of India (LIC)",
|
||||||
|
// "insurer_short_name": "LIC",
|
||||||
|
// "totalMembersCount": 7,
|
||||||
|
// "membersCountOfEnrolled": 0,
|
||||||
|
// "membersCountOfDraft": 7
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -79,6 +117,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
print('IN2');
|
print('IN2');
|
||||||
|
print("getCardArrays9 - $getCardArrays");
|
||||||
} else {
|
} else {
|
||||||
print('API request failed with status');
|
print('API request failed with status');
|
||||||
}
|
}
|
||||||
@ -89,123 +128,173 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
final screenHeight = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
final crossAxisCount = 4;
|
||||||
|
final spacing = 20.0; // crossAxisSpacing
|
||||||
|
final totalSpacing = (crossAxisCount - 1) * spacing;
|
||||||
|
final itemWidth = (screenWidth - totalSpacing) / crossAxisCount;
|
||||||
|
|
||||||
|
// Example: target card height
|
||||||
|
final itemHeight = screenHeight * 0.2;
|
||||||
|
|
||||||
|
// Dynamic aspect ratio:
|
||||||
|
final aspectRatio = screenWidth / screenHeight;
|
||||||
|
|
||||||
print("_PreEnrollmentState 4");
|
print("_PreEnrollmentState 4");
|
||||||
// TODO: implement build
|
// TODO: implement build
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.white,
|
// height: MediaQuery.of(context).size.height * 0.2,
|
||||||
|
|
||||||
// height: 400,
|
// height: 400,
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
// color: Colors.yellow.shade100,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
//
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
// color: Colors.redAccent.shade100,
|
||||||
child: SizedBox(
|
// color: Colors.white,
|
||||||
height: 400,
|
// color: Colors.white,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
height: MediaQuery.of(context).size.height * 0.45,
|
||||||
|
// height: 400,
|
||||||
|
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: getCardArrays.length,
|
itemCount: getCardArrays.length,
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 4,
|
crossAxisCount: 4,
|
||||||
crossAxisSpacing: 16,
|
crossAxisSpacing: 20,
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 20,
|
||||||
childAspectRatio: 2,
|
// childAspectRatio: 2,
|
||||||
|
childAspectRatio: aspectRatio,
|
||||||
|
// childAspectRatio: 2.1,
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return buildPolicyCard(getCardArrays[index]);
|
return buildPolicyCard(getCardArrays[index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildTab(String title, int index) {
|
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
||||||
final isSelected = selectedIndex == index;
|
final mediaQuery = MediaQuery.of(context);
|
||||||
|
final devicePixelRatio = mediaQuery.devicePixelRatio;
|
||||||
|
final logicalWidth = 230 / devicePixelRatio;
|
||||||
|
final logicalHeight = 115 / devicePixelRatio;
|
||||||
|
|
||||||
|
print("logicalWidth - $logicalWidth");
|
||||||
|
print("logicalHeight - $logicalHeight");
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedIndex = index;
|
print("policy");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 6.5, bottom: 6.0, left: 20.0, right: 20.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isSelected ? const Color(0xFF009195) : Colors.transparent,
|
|
||||||
boxShadow: isSelected
|
|
||||||
? [
|
|
||||||
BoxShadow(
|
|
||||||
color: isSelected
|
|
||||||
? const Color(0xFF009195)
|
|
||||||
: Colors.transparent, // Grey shadow
|
|
||||||
spreadRadius: 0.2,
|
|
||||||
blurRadius: 1,
|
|
||||||
offset: const Offset(0, 1), // Horizontal, Vertical
|
|
||||||
),
|
|
||||||
]
|
|
||||||
: [],
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
|
||||||
),
|
|
||||||
child: Text(title,
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: isSelected ? Colors.white : Colors.black,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
))),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
// height: MediaQuery.of(context).size.height * 0.1,
|
||||||
return Card(
|
// width: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// width: logicalWidth,
|
||||||
|
// height: logicalHeight,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
|
||||||
|
// height: MediaQuery.of(context).size.height * 1,
|
||||||
|
// width: MediaQuery.of(context).size.height * 0.1,
|
||||||
|
// margin: EdgeInsets.only(bottom: 10.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
// color: Colors.yellow.shade50,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
elevation: 3,
|
borderRadius: BorderRadius.circular(12),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black12,
|
||||||
|
blurRadius: 6,
|
||||||
|
spreadRadius: 1,
|
||||||
|
offset: Offset(0, 0), // Equal shadow in all directions
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.07,
|
||||||
|
// color: Colors.green.shade100,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
policy['type'] ?? '',
|
"${policy['policy_no']} " ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 2),
|
|
||||||
Text(
|
Text(
|
||||||
policy['policy_name'] ?? '',
|
"${policy['insurer_short_name']} - ${policy['policy_name']} " ??
|
||||||
|
'',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
_buildCountBox(
|
|
||||||
policy['membersCountOfDraft'].toString(), "Draft"),
|
|
||||||
_buildCountBox(
|
|
||||||
policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
|
||||||
_buildCountBox(policy['totalMembersCount'].toString(), "Total"),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// Spacer(),
|
||||||
|
Container(
|
||||||
|
// color: Colors.pink.shade50,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.09,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfDraft'].toString(), "Draft"),
|
||||||
|
Spacer(),
|
||||||
|
_buildCountBox(policy['membersCountOfEnrolled'].toString(),
|
||||||
|
"Enrolled"),
|
||||||
|
Spacer(),
|
||||||
|
_buildCountBox(
|
||||||
|
policy['totalMembersCount'].toString(), "Total"),
|
||||||
|
// Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCountBox(String count, String label) {
|
Widget _buildCountBox(String count, String label) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 70,
|
// width: 70,
|
||||||
height: 40,
|
// height: 40,
|
||||||
|
height: MediaQuery.of(context).size.height * 0.05,
|
||||||
|
width: MediaQuery.of(context).size.height * 0.1,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xFFDFF1F3),
|
color: const Color(0xFFDFF1F3),
|
||||||
@ -213,9 +302,10 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
count,
|
count,
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// Spacer(),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(label,
|
Text(label,
|
||||||
style: const TextStyle(fontSize: 10, color: Color(0xFF848484))),
|
style: const TextStyle(fontSize: 10, color: Color(0xFF848484))),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user