UI_DASHBOARD
This commit is contained in:
parent
dc87e4b818
commit
6e7d4914fb
File diff suppressed because one or more lines are too long
@ -1,12 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../../core/responsive/responsive_builder.dart';
|
||||
import '../../../core/routing/routes.dart';
|
||||
import '../../../core/services/api_service.dart';
|
||||
import '../../layouts/main_layout.dart';
|
||||
import '../../providers/manager_provider.dart';
|
||||
import '../../providers/userRoleProvider.dart';
|
||||
import '../staff/assignStaff.dart';
|
||||
|
||||
final enquiriesProvider = Provider<List<Map<String, String>>>((ref) {
|
||||
return List.generate(5, (i) {
|
||||
@ -69,7 +73,8 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
List<Map<String, dynamic>> unAssignedEnqList = []; // cross verify
|
||||
List<Map<String, dynamic>> agentsPerformanceList = []; // cross verify
|
||||
List<Map<String, dynamic>> nonAgentsPerformanceList = []; // cross verify
|
||||
|
||||
dynamic prefid;
|
||||
dynamic prefroleId;
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
@ -80,16 +85,46 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
Future.microtask(() {
|
||||
// final id = ref.read(managerIdProvider);
|
||||
final id = ref.read(userIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final prefid = ref.read(userIdProvider);
|
||||
final prefroleId = ref.read(userRoleProvider);
|
||||
|
||||
print("B81 => roleId: $roleId | userId: $id ");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
print("B81 => roleId: $prefroleId | userId: $prefid ");
|
||||
if (prefid != null) {
|
||||
getStaffList(prefid, prefroleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
print("REFRESH-");
|
||||
getStaffList(prefid, prefroleId);
|
||||
}
|
||||
|
||||
Future<void> handleEdit(String id) async {
|
||||
// Navigator.pop(context);
|
||||
print('EDITStaff');
|
||||
print('EDITStaff - $id');
|
||||
// dynamic id = data['id'];
|
||||
// context.go('/tabEnquiry/$id');
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
// ✅ Remove old value (if any)
|
||||
await prefs.remove('enqAgentDataId');
|
||||
|
||||
// setState(() {
|
||||
// final id = item['id'].toString();
|
||||
// ✅ Save the new id
|
||||
// await prefs.setString('enqAgentDataId', id.toString());
|
||||
await prefs.setString('enqAgentDataId', id);
|
||||
ref.read(enquiryIdProvider.notifier).state = id;
|
||||
|
||||
// });
|
||||
// update provider
|
||||
|
||||
context.go(AppRoutes.tabEnquiry);
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('B89 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
@ -160,9 +195,23 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
);
|
||||
|
||||
agentsPerformanceList.sort((a, b) {
|
||||
int aValue = a['total_policis_pending'] ?? 0;
|
||||
int bValue = b['total_policis_pending'] ?? 0;
|
||||
return aValue.compareTo(bValue); // ascending
|
||||
// int aValue = a['total_policis_pending'] ?? 0;
|
||||
// int bValue = b['total_policis_pending'] ?? 0;
|
||||
|
||||
int aValue = (a['total_policis_pending'] ?? 0) is int
|
||||
? a['total_policis_pending']
|
||||
: int.tryParse(
|
||||
a['total_policis_pending']?.toString() ?? '0',
|
||||
) ??
|
||||
0;
|
||||
int bValue = (b['total_policis_pending'] ?? 0) is int
|
||||
? b['total_policis_pending']
|
||||
: int.tryParse(
|
||||
b['total_policis_pending']?.toString() ?? '0',
|
||||
) ??
|
||||
0;
|
||||
return aValue.compareTo(bValue);
|
||||
// return aValue.compareTo(bValue); // ascending
|
||||
});
|
||||
}
|
||||
|
||||
@ -176,8 +225,20 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
// Sort descending
|
||||
nonAgentsPerformanceList.sort((a, b) {
|
||||
int aValue = a['total_policy_pending'] ?? 0;
|
||||
int bValue = b['total_policy_pending'] ?? 0;
|
||||
// int aValue = a['total_policy_pending'] ?? 0;
|
||||
// int bValue = b['total_policy_pending'] ?? 0;
|
||||
int aValue = (a['total_policis_pending'] ?? 0) is int
|
||||
? a['total_policis_pending']
|
||||
: int.tryParse(
|
||||
a['total_policis_pending']?.toString() ?? '0',
|
||||
) ??
|
||||
0;
|
||||
int bValue = (b['total_policis_pending'] ?? 0) is int
|
||||
? b['total_policis_pending']
|
||||
: int.tryParse(
|
||||
b['total_policis_pending']?.toString() ?? '0',
|
||||
) ??
|
||||
0;
|
||||
return bValue.compareTo(aValue); // descending
|
||||
});
|
||||
}
|
||||
@ -459,6 +520,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
title:
|
||||
"Awaiting Quotation (${quotationsPendingList.length})",
|
||||
data: quotationsPendingList,
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
)
|
||||
: (role == 'manager')
|
||||
? othersPendings(
|
||||
@ -471,6 +538,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
title:
|
||||
"Awaiting Quotation (${quotationsPendingList.length})",
|
||||
data: quotationsPendingList,
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@ -480,6 +553,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
title:
|
||||
"Awaiting Approval (${awaitingApprovalList.length})",
|
||||
data: awaitingApprovalList,
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
)
|
||||
: (role == 'manager')
|
||||
? awaitingApproval(
|
||||
@ -492,6 +571,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
title:
|
||||
"Awaiting Approval (${awaitingApprovalList.length})",
|
||||
data: awaitingApprovalList,
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@ -502,6 +587,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
"Awaiting Policy (${policiesPendingList.length})",
|
||||
data: policiesPendingList,
|
||||
stringFlag: "Policies",
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
)
|
||||
: (role == 'manager')
|
||||
? othersPendings(
|
||||
@ -515,6 +606,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
"Awaiting Policy (${policiesPendingList.length})",
|
||||
data: policiesPendingList,
|
||||
stringFlag: "Policies",
|
||||
role: role!,
|
||||
onEdit: (row) {
|
||||
handleEdit(
|
||||
row,
|
||||
); // parent method is called
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -529,8 +626,10 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnassignedEnq(
|
||||
key: UniqueKey(),
|
||||
title: "Unassigned Enquires",
|
||||
data: unAssignedEnqList,
|
||||
onRefresh: refresh,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
@ -861,170 +960,25 @@ class StatCard extends StatelessWidget {
|
||||
class agentPendings extends StatelessWidget {
|
||||
final String title;
|
||||
final String? stringFlag;
|
||||
String role;
|
||||
final List<Map<String, dynamic>> data;
|
||||
const agentPendings({
|
||||
|
||||
// final Function(Map<String, dynamic>)? onEdit;
|
||||
final Function(String)? onEdit;
|
||||
|
||||
agentPendings({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.data,
|
||||
this.stringFlag,
|
||||
required this.role,
|
||||
required this.onEdit,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('-Data: $data');
|
||||
// final data = List.generate(
|
||||
// 10,
|
||||
// (i) => {
|
||||
// "date": "12/09/2025",
|
||||
// "time": "11.30",
|
||||
// "reg": "TN64V438777",
|
||||
// "company": "New India",
|
||||
// },
|
||||
// );
|
||||
|
||||
// return Card(
|
||||
// color: const Color(0xFFEAF6F4), // light mint background
|
||||
// elevation: 0,
|
||||
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(12.0),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// title,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontWeight: FontWeight.bold,
|
||||
// fontSize: 20,
|
||||
// color: Color(0xff425B5B),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(height: 20),
|
||||
// Container(
|
||||
// padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
// decoration: BoxDecoration(
|
||||
// color: const Color(0xFF3E5B56),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// "Date & Time",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// fontSize: 18,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// "Registration number",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// fontSize: 18,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// "Insurer Company",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// fontSize: 18,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: ListView(
|
||||
// children: [
|
||||
// const SizedBox(height: 4),
|
||||
//
|
||||
// ...data.map(
|
||||
// (row) => Container(
|
||||
// margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// vertical: 5,
|
||||
// horizontal: 12,
|
||||
// ),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Center(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// row["date"]!,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// row["time"]!,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 10,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row["reg"]!,
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row["company"]!,
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
return Card(
|
||||
color: const Color(0xFFEAF6F4),
|
||||
elevation: 0,
|
||||
@ -1108,59 +1062,71 @@ class agentPendings extends StatelessWidget {
|
||||
time = parts.length > 1 ? parts[1] : "";
|
||||
}
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
// Date & Time
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(date, style: _tableDataStyle),
|
||||
Text(time, style: _tableDataStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Registration number
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['reg_no'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
if (stringFlag == "Policies") ...[
|
||||
// Insurer company
|
||||
return InkWell(
|
||||
focusColor: Color(0xFF3E5B56),
|
||||
highlightColor: Color(0xFF3E5B56),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
onTap: (role == 'manager')
|
||||
? null
|
||||
: () {
|
||||
print("Clicked ID role : $role - ${row['id']}");
|
||||
onEdit!(row['id'].toString());
|
||||
// onEdit!(row['id']);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 1,
|
||||
child: Text(
|
||||
row['insurer_short_name'] ?? "",
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
// Date & Time
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(date, style: _tableDataStyle),
|
||||
Text(time, style: _tableDataStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Registration number
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['reg_no'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
if (stringFlag == "Policies") ...[
|
||||
// Insurer company
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['insurer_short_name'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -1266,59 +1232,67 @@ class othersPendings extends StatelessWidget {
|
||||
? '0'
|
||||
: row['total_premium_value'];
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
return InkWell(
|
||||
focusColor: Color(0xFF3E5B56),
|
||||
highlightColor: Color(0xFF3E5B56),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
onTap: () {
|
||||
print("Clicked ID: ${row['id']}");
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['staff_name'] ?? "",
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['staff_name'] ?? "",
|
||||
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
issuedCount,
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
issuedCount,
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
// stringFlag == "Policies"
|
||||
// ? Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// formatToCroresLakhsAndThousands(permiumValue),
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : const SizedBox.shrink(),
|
||||
],
|
||||
// stringFlag == "Policies"
|
||||
// ? Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// formatToCroresLakhsAndThousands(permiumValue),
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -1424,59 +1398,67 @@ class awaitingApproval extends StatelessWidget {
|
||||
? '0'
|
||||
: row['total_premium_value'];
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
return InkWell(
|
||||
focusColor: Color(0xFF3E5B56),
|
||||
highlightColor: Color(0xFF3E5B56),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
onTap: () {
|
||||
print("Clicked ID: ${row['id']}");
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['staff_name'] ?? "",
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['staff_name'] ?? "",
|
||||
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
// issuedCount,
|
||||
(row['total_approval_pending'] ?? 0).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
// issuedCount,
|
||||
(row['total_approval_pending'] ?? 0).toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
// stringFlag == "Policies"
|
||||
// ? Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// formatToCroresLakhsAndThousands(permiumValue),
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : const SizedBox.shrink(),
|
||||
],
|
||||
// stringFlag == "Policies"
|
||||
// ? Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// formatToCroresLakhsAndThousands(permiumValue),
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -1633,9 +1615,14 @@ class Performance extends StatelessWidget {
|
||||
class UnassignedEnq extends StatelessWidget {
|
||||
final String title;
|
||||
final List<Map<String, dynamic>> data;
|
||||
final VoidCallback? onRefresh;
|
||||
|
||||
UnassignedEnq({Key? key, required this.title, required this.data})
|
||||
: super(key: key);
|
||||
UnassignedEnq({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.data,
|
||||
this.onRefresh,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -1694,43 +1681,86 @@ class UnassignedEnq extends StatelessWidget {
|
||||
itemBuilder: (context, index) {
|
||||
final row = data[index];
|
||||
|
||||
return Container(
|
||||
// height: 5200,
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
(index + 1).toString(), // convert int to string
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
String date = "";
|
||||
String time = "";
|
||||
if ((row['created_on'] ?? "").isNotEmpty) {
|
||||
final parts = row['created_on'].split(' ');
|
||||
date = parts[0];
|
||||
if (parts.isNotEmpty) {
|
||||
DateTime parsedDate = DateTime.parse(parts[0]);
|
||||
date = DateFormat(
|
||||
'dd/MM/yyyy',
|
||||
).format(parsedDate); // 19/09/2025
|
||||
}
|
||||
time = parts.length > 1 ? parts[1] : "";
|
||||
}
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['reg_no'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
return InkWell(
|
||||
focusColor: Color(0xFF3E5B56),
|
||||
highlightColor: Color(0xFF3E5B56),
|
||||
borderRadius: BorderRadius.circular(2), // for ripple effect
|
||||
// border: Border.all(
|
||||
// color: Colors.green ,
|
||||
// width: 2,
|
||||
// ),
|
||||
onTap: () {
|
||||
// Print the id when row is clicked
|
||||
print("Clicked ID: ${row['id']}");
|
||||
// You can also navigate or perform any action here
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['created_on'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AssignStaffDialog(
|
||||
enquiryPrimaryId: row['id'],
|
||||
regNum: row['reg_no'],
|
||||
userId: 1,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New assignY: $value");
|
||||
if (onRefresh != null) {
|
||||
onRefresh!(); // ✅ call the parent's refresh
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
// height: 5200,
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
(index + 1).toString(), // convert int to string
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['reg_no'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
"$date $time",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@ -255,7 +255,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
builder: (ctx) => AssignStaffDialog(
|
||||
enquiryPrimaryId: id,
|
||||
regNum: regNum,
|
||||
userId: 1,
|
||||
userId: userId,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New assignY: $value");
|
||||
refresh();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user