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/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import '../../../core/responsive/responsive_builder.dart';
|
import '../../../core/responsive/responsive_builder.dart';
|
||||||
|
import '../../../core/routing/routes.dart';
|
||||||
import '../../../core/services/api_service.dart';
|
import '../../../core/services/api_service.dart';
|
||||||
import '../../layouts/main_layout.dart';
|
import '../../layouts/main_layout.dart';
|
||||||
import '../../providers/manager_provider.dart';
|
import '../../providers/manager_provider.dart';
|
||||||
import '../../providers/userRoleProvider.dart';
|
import '../../providers/userRoleProvider.dart';
|
||||||
|
import '../staff/assignStaff.dart';
|
||||||
|
|
||||||
final enquiriesProvider = Provider<List<Map<String, String>>>((ref) {
|
final enquiriesProvider = Provider<List<Map<String, String>>>((ref) {
|
||||||
return List.generate(5, (i) {
|
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>> unAssignedEnqList = []; // cross verify
|
||||||
List<Map<String, dynamic>> agentsPerformanceList = []; // cross verify
|
List<Map<String, dynamic>> agentsPerformanceList = []; // cross verify
|
||||||
List<Map<String, dynamic>> nonAgentsPerformanceList = []; // cross verify
|
List<Map<String, dynamic>> nonAgentsPerformanceList = []; // cross verify
|
||||||
|
dynamic prefid;
|
||||||
|
dynamic prefroleId;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -80,16 +85,46 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
|
|
||||||
Future.microtask(() {
|
Future.microtask(() {
|
||||||
// final id = ref.read(managerIdProvider);
|
// final id = ref.read(managerIdProvider);
|
||||||
final id = ref.read(userIdProvider);
|
final prefid = ref.read(userIdProvider);
|
||||||
final roleId = ref.read(userRoleProvider);
|
final prefroleId = ref.read(userRoleProvider);
|
||||||
|
|
||||||
print("B81 => roleId: $roleId | userId: $id ");
|
print("B81 => roleId: $prefroleId | userId: $prefid ");
|
||||||
if (id != null) {
|
if (prefid != null) {
|
||||||
getStaffList(id, roleId);
|
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 {
|
Future<void> getStaffList(int managerId, role) async {
|
||||||
print('B89 => Fns called => $managerId | $role');
|
print('B89 => Fns called => $managerId | $role');
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -160,9 +195,23 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
agentsPerformanceList.sort((a, b) {
|
agentsPerformanceList.sort((a, b) {
|
||||||
int aValue = a['total_policis_pending'] ?? 0;
|
// int aValue = a['total_policis_pending'] ?? 0;
|
||||||
int bValue = b['total_policis_pending'] ?? 0;
|
// int bValue = b['total_policis_pending'] ?? 0;
|
||||||
return aValue.compareTo(bValue); // ascending
|
|
||||||
|
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
|
// Sort descending
|
||||||
nonAgentsPerformanceList.sort((a, b) {
|
nonAgentsPerformanceList.sort((a, b) {
|
||||||
int aValue = a['total_policy_pending'] ?? 0;
|
// int aValue = a['total_policy_pending'] ?? 0;
|
||||||
int bValue = b['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
|
return bValue.compareTo(aValue); // descending
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -459,6 +520,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
title:
|
title:
|
||||||
"Awaiting Quotation (${quotationsPendingList.length})",
|
"Awaiting Quotation (${quotationsPendingList.length})",
|
||||||
data: quotationsPendingList,
|
data: quotationsPendingList,
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
)
|
)
|
||||||
: (role == 'manager')
|
: (role == 'manager')
|
||||||
? othersPendings(
|
? othersPendings(
|
||||||
@ -471,6 +538,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
title:
|
title:
|
||||||
"Awaiting Quotation (${quotationsPendingList.length})",
|
"Awaiting Quotation (${quotationsPendingList.length})",
|
||||||
data: quotationsPendingList,
|
data: quotationsPendingList,
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
@ -480,6 +553,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
title:
|
title:
|
||||||
"Awaiting Approval (${awaitingApprovalList.length})",
|
"Awaiting Approval (${awaitingApprovalList.length})",
|
||||||
data: awaitingApprovalList,
|
data: awaitingApprovalList,
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
)
|
)
|
||||||
: (role == 'manager')
|
: (role == 'manager')
|
||||||
? awaitingApproval(
|
? awaitingApproval(
|
||||||
@ -492,6 +571,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
title:
|
title:
|
||||||
"Awaiting Approval (${awaitingApprovalList.length})",
|
"Awaiting Approval (${awaitingApprovalList.length})",
|
||||||
data: awaitingApprovalList,
|
data: awaitingApprovalList,
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
@ -502,6 +587,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
"Awaiting Policy (${policiesPendingList.length})",
|
"Awaiting Policy (${policiesPendingList.length})",
|
||||||
data: policiesPendingList,
|
data: policiesPendingList,
|
||||||
stringFlag: "Policies",
|
stringFlag: "Policies",
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
)
|
)
|
||||||
: (role == 'manager')
|
: (role == 'manager')
|
||||||
? othersPendings(
|
? othersPendings(
|
||||||
@ -515,6 +606,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
"Awaiting Policy (${policiesPendingList.length})",
|
"Awaiting Policy (${policiesPendingList.length})",
|
||||||
data: policiesPendingList,
|
data: policiesPendingList,
|
||||||
stringFlag: "Policies",
|
stringFlag: "Policies",
|
||||||
|
role: role!,
|
||||||
|
onEdit: (row) {
|
||||||
|
handleEdit(
|
||||||
|
row,
|
||||||
|
); // parent method is called
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -529,8 +626,10 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: UnassignedEnq(
|
child: UnassignedEnq(
|
||||||
|
key: UniqueKey(),
|
||||||
title: "Unassigned Enquires",
|
title: "Unassigned Enquires",
|
||||||
data: unAssignedEnqList,
|
data: unAssignedEnqList,
|
||||||
|
onRefresh: refresh,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
@ -861,170 +960,25 @@ class StatCard extends StatelessWidget {
|
|||||||
class agentPendings extends StatelessWidget {
|
class agentPendings extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final String? stringFlag;
|
final String? stringFlag;
|
||||||
|
String role;
|
||||||
final List<Map<String, dynamic>> data;
|
final List<Map<String, dynamic>> data;
|
||||||
const agentPendings({
|
|
||||||
|
// final Function(Map<String, dynamic>)? onEdit;
|
||||||
|
final Function(String)? onEdit;
|
||||||
|
|
||||||
|
agentPendings({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.data,
|
required this.data,
|
||||||
this.stringFlag,
|
this.stringFlag,
|
||||||
|
required this.role,
|
||||||
|
required this.onEdit,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print('-Data: $data');
|
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(
|
return Card(
|
||||||
color: const Color(0xFFEAF6F4),
|
color: const Color(0xFFEAF6F4),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@ -1108,59 +1062,71 @@ class agentPendings extends StatelessWidget {
|
|||||||
time = parts.length > 1 ? parts[1] : "";
|
time = parts.length > 1 ? parts[1] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return InkWell(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
focusColor: Color(0xFF3E5B56),
|
||||||
padding: const EdgeInsets.symmetric(
|
highlightColor: Color(0xFF3E5B56),
|
||||||
vertical: 5,
|
borderRadius: BorderRadius.circular(2),
|
||||||
horizontal: 12,
|
onTap: (role == 'manager')
|
||||||
),
|
? null
|
||||||
decoration: BoxDecoration(
|
: () {
|
||||||
color: Colors.white,
|
print("Clicked ID role : $role - ${row['id']}");
|
||||||
borderRadius: BorderRadius.circular(10),
|
onEdit!(row['id'].toString());
|
||||||
),
|
// onEdit!(row['id']);
|
||||||
child: Row(
|
},
|
||||||
children: [
|
child: Container(
|
||||||
Expanded(
|
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||||
flex: 1,
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Text(
|
vertical: 5,
|
||||||
(index + 1).toString(),
|
horizontal: 12,
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
style: _tableDataStyle,
|
decoration: BoxDecoration(
|
||||||
),
|
color: Colors.white,
|
||||||
),
|
borderRadius: BorderRadius.circular(10),
|
||||||
// Date & Time
|
),
|
||||||
Expanded(
|
child: Row(
|
||||||
flex: 1,
|
children: [
|
||||||
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(
|
Expanded(
|
||||||
flex: 2,
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
row['insurer_short_name'] ?? "",
|
(index + 1).toString(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _tableDataStyle,
|
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'
|
? '0'
|
||||||
: row['total_premium_value'];
|
: row['total_premium_value'];
|
||||||
|
|
||||||
return Container(
|
return InkWell(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
focusColor: Color(0xFF3E5B56),
|
||||||
padding: const EdgeInsets.symmetric(
|
highlightColor: Color(0xFF3E5B56),
|
||||||
vertical: 5,
|
borderRadius: BorderRadius.circular(2),
|
||||||
horizontal: 12,
|
onTap: () {
|
||||||
),
|
print("Clicked ID: ${row['id']}");
|
||||||
decoration: BoxDecoration(
|
},
|
||||||
color: Colors.white,
|
child: Container(
|
||||||
borderRadius: BorderRadius.circular(10),
|
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Row(
|
vertical: 5,
|
||||||
children: [
|
horizontal: 12,
|
||||||
Expanded(
|
),
|
||||||
flex: 1,
|
decoration: BoxDecoration(
|
||||||
child: Text(
|
color: Colors.white,
|
||||||
(index + 1).toString(),
|
borderRadius: BorderRadius.circular(10),
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
style: _tableDataStyle,
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
(index + 1).toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
flex: 2,
|
||||||
flex: 2,
|
child: Text(
|
||||||
child: Text(
|
row['staff_name'] ?? "",
|
||||||
row['staff_name'] ?? "",
|
|
||||||
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _tableDataStyle,
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
issuedCount,
|
issuedCount,
|
||||||
// row['total_approval_pending'] ?? "",
|
// row['total_approval_pending'] ?? "",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _tableDataStyle,
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
// stringFlag == "Policies"
|
||||||
// stringFlag == "Policies"
|
// ? Expanded(
|
||||||
// ? Expanded(
|
// flex: 2,
|
||||||
// flex: 2,
|
// child: Text(
|
||||||
// child: Text(
|
// formatToCroresLakhsAndThousands(permiumValue),
|
||||||
// formatToCroresLakhsAndThousands(permiumValue),
|
// textAlign: TextAlign.center,
|
||||||
// textAlign: TextAlign.center,
|
// style: GoogleFonts.inter(
|
||||||
// style: GoogleFonts.inter(
|
// fontSize: 14,
|
||||||
// fontSize: 14,
|
// fontWeight: FontWeight.w500,
|
||||||
// fontWeight: FontWeight.w500,
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// )
|
||||||
// )
|
// : const SizedBox.shrink(),
|
||||||
// : const SizedBox.shrink(),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -1424,59 +1398,67 @@ class awaitingApproval extends StatelessWidget {
|
|||||||
? '0'
|
? '0'
|
||||||
: row['total_premium_value'];
|
: row['total_premium_value'];
|
||||||
|
|
||||||
return Container(
|
return InkWell(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
focusColor: Color(0xFF3E5B56),
|
||||||
padding: const EdgeInsets.symmetric(
|
highlightColor: Color(0xFF3E5B56),
|
||||||
vertical: 5,
|
borderRadius: BorderRadius.circular(2),
|
||||||
horizontal: 12,
|
onTap: () {
|
||||||
),
|
print("Clicked ID: ${row['id']}");
|
||||||
decoration: BoxDecoration(
|
},
|
||||||
color: Colors.white,
|
child: Container(
|
||||||
borderRadius: BorderRadius.circular(10),
|
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Row(
|
vertical: 5,
|
||||||
children: [
|
horizontal: 12,
|
||||||
Expanded(
|
),
|
||||||
flex: 1,
|
decoration: BoxDecoration(
|
||||||
child: Text(
|
color: Colors.white,
|
||||||
(index + 1).toString(),
|
borderRadius: BorderRadius.circular(10),
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
style: _tableDataStyle,
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
(index + 1).toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
flex: 2,
|
||||||
flex: 2,
|
child: Text(
|
||||||
child: Text(
|
row['staff_name'] ?? "",
|
||||||
row['staff_name'] ?? "",
|
|
||||||
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _tableDataStyle,
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
// issuedCount,
|
// issuedCount,
|
||||||
(row['total_approval_pending'] ?? 0).toString(),
|
(row['total_approval_pending'] ?? 0).toString(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _tableDataStyle,
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
// stringFlag == "Policies"
|
||||||
// stringFlag == "Policies"
|
// ? Expanded(
|
||||||
// ? Expanded(
|
// flex: 2,
|
||||||
// flex: 2,
|
// child: Text(
|
||||||
// child: Text(
|
// formatToCroresLakhsAndThousands(permiumValue),
|
||||||
// formatToCroresLakhsAndThousands(permiumValue),
|
// textAlign: TextAlign.center,
|
||||||
// textAlign: TextAlign.center,
|
// style: GoogleFonts.inter(
|
||||||
// style: GoogleFonts.inter(
|
// fontSize: 14,
|
||||||
// fontSize: 14,
|
// fontWeight: FontWeight.w500,
|
||||||
// fontWeight: FontWeight.w500,
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// )
|
||||||
// )
|
// : const SizedBox.shrink(),
|
||||||
// : const SizedBox.shrink(),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -1633,9 +1615,14 @@ class Performance extends StatelessWidget {
|
|||||||
class UnassignedEnq extends StatelessWidget {
|
class UnassignedEnq extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
||||||
final List<Map<String, dynamic>> data;
|
final List<Map<String, dynamic>> data;
|
||||||
|
final VoidCallback? onRefresh;
|
||||||
|
|
||||||
UnassignedEnq({Key? key, required this.title, required this.data})
|
UnassignedEnq({
|
||||||
: super(key: key);
|
Key? key,
|
||||||
|
required this.title,
|
||||||
|
required this.data,
|
||||||
|
this.onRefresh,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -1694,43 +1681,86 @@ class UnassignedEnq extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final row = data[index];
|
final row = data[index];
|
||||||
|
|
||||||
return Container(
|
String date = "";
|
||||||
// height: 5200,
|
String time = "";
|
||||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
if ((row['created_on'] ?? "").isNotEmpty) {
|
||||||
padding: const EdgeInsets.symmetric(
|
final parts = row['created_on'].split(' ');
|
||||||
vertical: 5,
|
date = parts[0];
|
||||||
horizontal: 12,
|
if (parts.isNotEmpty) {
|
||||||
),
|
DateTime parsedDate = DateTime.parse(parts[0]);
|
||||||
decoration: BoxDecoration(
|
date = DateFormat(
|
||||||
color: Colors.white,
|
'dd/MM/yyyy',
|
||||||
borderRadius: BorderRadius.circular(10),
|
).format(parsedDate); // 19/09/2025
|
||||||
),
|
}
|
||||||
child: Row(
|
time = parts.length > 1 ? parts[1] : "";
|
||||||
children: [
|
}
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
(index + 1).toString(), // convert int to string
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
return InkWell(
|
||||||
child: Text(
|
focusColor: Color(0xFF3E5B56),
|
||||||
row['reg_no'] ?? "",
|
highlightColor: Color(0xFF3E5B56),
|
||||||
textAlign: TextAlign.center,
|
borderRadius: BorderRadius.circular(2), // for ripple effect
|
||||||
style: _tableDataStyle,
|
// 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(
|
showDialog(
|
||||||
child: Text(
|
context: context,
|
||||||
row['created_on'] ?? "",
|
builder: (ctx) => AssignStaffDialog(
|
||||||
textAlign: TextAlign.center,
|
enquiryPrimaryId: row['id'],
|
||||||
style: _tableDataStyle,
|
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(
|
builder: (ctx) => AssignStaffDialog(
|
||||||
enquiryPrimaryId: id,
|
enquiryPrimaryId: id,
|
||||||
regNum: regNum,
|
regNum: regNum,
|
||||||
userId: 1,
|
userId: userId,
|
||||||
onSubmit: (value) {
|
onSubmit: (value) {
|
||||||
debugPrint("New assignY: $value");
|
debugPrint("New assignY: $value");
|
||||||
refresh();
|
refresh();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user