Broker Include

This commit is contained in:
venbaittech 2025-12-05 12:04:11 +05:30
parent 6d7e6f24b9
commit 0b0a30f9d6
20 changed files with 3931 additions and 534 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ import 'package:nhance_partner/core/routing/routes.dart';
import 'package:nhance_partner/presentation/screens/Enquiry/enquiryList.dart';
import 'package:nhance_partner/presentation/screens/Masters/PaymentMode/paymentList.dart';
import 'package:nhance_partner/presentation/screens/UserManagement/Profile/profile_web.dart';
import 'package:nhance_partner/presentation/screens/dashboard/dashboard.dart';
import 'package:nhance_partner/presentation/screens/dashboard/dashboard_nw.dart';
import 'package:nhance_partner/presentation/screens/payout/invoice_list.dart';
import '../../data/services/auth_service.dart';
@ -21,6 +21,7 @@ import '../../presentation/screens/UserManagement/Agent/agentList.dart';
import '../../presentation/screens/UserManagement/Profile/profile_mobile.dart';
import '../../presentation/screens/UserManagement/Staff/staff.dart';
import '../../presentation/screens/UserManagement/Staff/staffList.dart';
import '../../presentation/screens/dashboard/dashboard.dart';
import '../../presentation/screens/handler/enquiryList.dart';
import '../../presentation/screens/handler/enquiryListOld.dart';
import '../../presentation/screens/home/home_screen.dart';
@ -53,7 +54,8 @@ final GoRouter appRouter = GoRouter(
// ),
GoRoute(
path: AppRoutes.dashboard,
builder: (context, state) => const DashboardScreen(),
// builder: (context, state) => const DashboardScreen(),
builder: (context, state) => const Dashboard(),
),
GoRoute(

View File

@ -820,6 +820,28 @@ class ApiService {
return response;
}
Future<Map<String, dynamic>> deleteEnquiy(id, val) async {
final url = Uri.parse(
'${Env.apiUrl}/enquiry/updateEnquiryStatus?enquiry_id=$id&is_active=$val',
);
// final token = await getToken(); // Fetch token
if (_token == null) {
throw Exception('Token not found. Please log in.');
}
final headers = {
'Authorization': 'Bearer $_token',
'Content-Type': 'application/json',
'app-signature': Env.App_Signature,
// 'app-signature': 'nhance-partner-2025-signature-35468846JRhH551HK',
};
// final response = await _makePostRequestJson(url, data, headers);
final response = await _makeGetRequest(url, headers);
return response;
}
//------------------------------------ Quotation ------------------------------------------------
Future<Map<String, dynamic>> fetchQuickQuotationList(int managerId) async {

View File

@ -1,4 +1,4 @@
import 'package:firebase_app_check/firebase_app_check.dart';
// import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
@ -62,12 +62,12 @@ Future<void> main() async {
),
);
} else {
await Firebase.initializeApp();
await FirebaseAppCheck.instance.activate(
// webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
androidProvider: AndroidProvider.playIntegrity,
appleProvider: AppleProvider.appAttest,
);
// await Firebase.initializeApp();
// await FirebaseAppCheck.instance.activate(
// // webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
// androidProvider: AndroidProvider.playIntegrity,
// appleProvider: AppleProvider.appAttest,
// );
// FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
// FirebaseMessaging messaging = FirebaseMessaging.instance;

View File

@ -600,19 +600,20 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
data: staffQuotationsPendingList,
stringFlag: "Proposal",
role: role!,
onRefresh: refresh,
),
),
if (role == 'handler') ...[
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role,
data: unAssignedEnqList,
onRefresh: refresh,
),
// if (role == 'handler') ...[
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role!,
data: unAssignedEnqList,
onRefresh: refresh,
),
],
),
// ],
],
)
: Row(
@ -737,50 +738,40 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
],
),
),
const SizedBox(height: 5),
// Container(
// child: DynamicHorizontalBarChart(
// data: [
// {"label": "Jan", "value": 30},
// {"label": "Feb", "value": 45},
// {"label": "Mar", "value": 20},
// ],
// const SizedBox(height: 5),
// if (role == 'manager')
// SizedBox(
// // replace Expanded
// height: 350, // adjust height as needed
// child: Row(
// children: [
// Expanded(
// child: UnassignedEnq(
// key: UniqueKey(),
// title: "Unassigned Enquiries",
// role: role!,
// data: unAssignedEnqList,
// onRefresh: refresh,
// ),
// ),
// SizedBox(width: 16),
// Expanded(
// child: Performance(
// title: "Performing Partner",
// data: agentsPerformanceList,
// ),
// ),
// SizedBox(width: 16),
// Expanded(
// child: Performance(
// title: "Non-Performing Partner",
// data: nonAgentsPerformanceList,
// ),
// ),
// ],
// ),
// ),
// ),
const SizedBox(height: 5),
if (role == 'manager')
SizedBox(
// replace Expanded
height: 350, // adjust height as needed
child: Row(
children: [
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role!,
data: unAssignedEnqList,
onRefresh: refresh,
),
),
SizedBox(width: 16),
Expanded(
child: Performance(
title: "Performing Partner",
data: agentsPerformanceList,
),
),
SizedBox(width: 16),
Expanded(
child: Performance(
title: "Non-Performing Partner",
data: nonAgentsPerformanceList,
),
),
],
),
),
],
),
),
@ -1210,6 +1201,7 @@ class othersPendings extends StatelessWidget {
final String stringFlag;
String role;
final List<Map<String, dynamic>> data;
final VoidCallback? onRefresh;
othersPendings({
Key? key,
@ -1217,6 +1209,7 @@ class othersPendings extends StatelessWidget {
required this.role,
required this.data,
required this.stringFlag,
required this.onRefresh,
}) : super(key: key);
@override
@ -1228,12 +1221,33 @@ class othersPendings extends StatelessWidget {
int totalPending = 0;
int totalInProgress = 0;
int totalCompleted = 0;
int totalPrevPending = 0;
int totalPendingAll = 0;
for (var row in data) {
totalTodayAssigned += int.tryParse(row['today_assigned'] ?? '0') ?? 0;
totalPending += int.tryParse(row['pending_assigned'] ?? '0') ?? 0;
totalInProgress += int.tryParse(row['total_in_progress'] ?? '0') ?? 0;
totalCompleted += int.tryParse(row['total_completed'] ?? '0') ?? 0;
totalPending += int.tryParse(row['today_pending'] ?? '0') ?? 0;
totalInProgress += int.tryParse(row['today_in_progress'] ?? '0') ?? 0;
totalCompleted += int.tryParse(row['today_completed'] ?? '0') ?? 0;
totalPrevPending += int.tryParse(row['total_completed'] ?? '0') ?? 0;
int totalPendingdata =
int.tryParse(row['total_pending']?.toString() ?? '0') ?? 0;
int todayAssigned =
int.tryParse(row['today_assigned']?.toString() ?? '0') ?? 0;
// totalTodayAssigned += todayAssigned;
totalPendingAll += totalPendingdata;
int staffPending = totalPendingdata - todayAssigned;
// totalPrevPending += staffPending;
final rowPrevPending =
(int.tryParse(row['total_pending'] ?? '0') ?? 0) -
(int.tryParse(row['today_assigned'] ?? '0') ?? 0);
totalPrevPending += rowPrevPending < 0 ? 0 : rowPrevPending;
}
return Card(
@ -1247,7 +1261,19 @@ class othersPendings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title
Text(title, style: _title),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title, style: _title),
InkWell(
onTap: () {
onRefresh!();
},
child: Icon(Icons.refresh, size: 18),
),
],
),
const SizedBox(height: 10),
// Header row
@ -1345,6 +1371,14 @@ class othersPendings extends StatelessWidget {
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
'Prev Pending',
textAlign: TextAlign.center,
style: _headerStyle,
),
),
// Expanded(
// flex: 2,
// child: Text(
@ -1366,6 +1400,18 @@ class othersPendings extends StatelessWidget {
itemBuilder: (context, index) {
final row = data[index];
final totalPending =
int.tryParse(row['total_pending']?.toString() ?? '0') ??
0;
final todayAssigned =
int.tryParse(row['today_assigned']?.toString() ?? '0') ??
0;
final staffPending = (totalPending - todayAssigned);
final safePending = staffPending < 0 ? 0 : staffPending;
// final staffPending = totalPending - todayAssigned;
final issuedCount = stringFlag == "Policies"
? (row['total_policis_pending'] ?? 0).toString()
: (row['total_quotation_pending'] ?? 0).toString();
@ -1396,8 +1442,8 @@ class othersPendings extends StatelessWidget {
flex: 2,
child: Text(
row['staff_name'] ?? "",
textAlign: TextAlign.center,
textAlign: TextAlign.left,
// textAlign: TextAlign.center,
style: _tableDataStyle,
),
),
@ -1416,7 +1462,8 @@ class othersPendings extends StatelessWidget {
handleDashboardNavigation(
context,
status: "Assigned",
status: '',
// status: "Assigned",
staffId: row['staff_id'] ?? '',
role: role,
);
@ -1451,7 +1498,7 @@ class othersPendings extends StatelessWidget {
);
},
child: Text(
row['pending_assigned'] ?? "",
row['today_pending'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1481,7 +1528,7 @@ class othersPendings extends StatelessWidget {
},
child: Text(
row['total_in_progress'] ?? "",
row['today_in_progress'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1509,7 +1556,35 @@ class othersPendings extends StatelessWidget {
);
},
child: Text(
row['total_completed'] ?? "",
row['today_completed'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
),
),
),
),
),
Expanded(
flex: 2,
child: Material(
color: Colors.white,
child: Center(
child: InkWell(
hoverColor: Color(0xFFEAF6F4),
onTap: () async {
print(
'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
);
handleDashboardNavigation(
context,
status: 'PrevPending',
staffId: row['staff_id'] ?? '',
role: role,
);
},
child: Text(
safePending.toString() ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1585,6 +1660,14 @@ class othersPendings extends StatelessWidget {
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
totalPrevPending.toString(),
textAlign: TextAlign.center,
style: _headerStyle,
),
),
],
),
),

View File

@ -0,0 +1,146 @@
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:nhance_partner/presentation/screens/dashboard/tabs/bussiness.dart';
import 'package:nhance_partner/presentation/screens/dashboard/tabs/chart.dart';
import 'package:nhance_partner/presentation/screens/dashboard/tabs/live.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/quotation_staff_proivder.dart';
import '../../providers/userRoleProvider.dart';
import '../../themes/charts/barChart.dart';
import '../staff/Enquiry/tabs/tab.dart';
import '../staff/assignStaff.dart';
final enquiriesProvider = Provider<List<Map<String, String>>>((ref) {
return List.generate(5, (i) {
return {
"reg": "rrTN64V4387",
"Insurer": "rrNew India",
"date": "rr09/09/2025",
"time": "rr11:30 AM",
};
});
});
class Dashboard extends ConsumerStatefulWidget {
const Dashboard({super.key});
@override
ConsumerState<Dashboard> createState() => _DashboardState();
}
class _DashboardState extends ConsumerState<Dashboard>
with SingleTickerProviderStateMixin {
late TabController _tabController;
// Dynamic items (4 values)
final List<String> tabs = ["Live", "Business", "Partner", "Productivity"];
@override
void initState() {
super.initState();
_tabController = TabController(length: tabs.length, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
final List<Color> tabColors = [
Colors.amber.shade100, // Live
// Color(0XFFF1556C), // Business
// Color(0XFF02A8B5), // Business
Colors.blue.shade100, // Business
Colors.orange.shade100, // Partner
Colors.green.shade100, // Productivity
];
@override
Widget build(BuildContext context) {
return MainLayout(
title: "Dashboard",
body: SafeArea(
child: Container(
// color: Colors.amber.shade100,
child: Column(
children: [
// TabBar(
// padding: EdgeInsets.zero,
// controller: _tabController,
// isScrollable: false,
// indicatorColor: Colors.teal,
// labelColor: Colors.teal,
// unselectedLabelColor: Colors.grey,
// tabs: tabs.map((e) => Tab(text: e)).toList(),
// ),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List.generate(tabs.length, (index) {
final isSelected = _tabController.index == index;
return GestureDetector(
onTap: () {
_tabController.animateTo(index);
setState(() {});
},
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 10,
),
margin: EdgeInsets.only(left: 10),
decoration: BoxDecoration(
// color: isSelected ? Colors.teal : tabColors[index],
color: tabColors[index],
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: isSelected ? Colors.teal : tabColors[index],
width: 1,
),
),
child: Text(
tabs[index],
style: TextStyle(
// color: isSelected ? Colors.white : Colors.black87,
color: Colors.black87,
fontSize: 11,
fontWeight: FontWeight.w500,
),
),
),
);
}),
),
Expanded(
child: TabBarView(
controller: _tabController,
children: [
// Text('A'),
LiveDashboard(),
BussinessDashboard(),
// BarChartSample7(),
// ReportsPage(),
// UsersPage(),
// SettingsPage(),
],
),
),
],
),
),
),
);
}
}

View File

@ -11,6 +11,7 @@ import '../../layouts/main_layout.dart';
import '../../providers/manager_provider.dart';
import '../../providers/quotation_staff_proivder.dart';
import '../../providers/userRoleProvider.dart';
import '../../themes/charts/barChart.dart';
import '../staff/Enquiry/tabs/tab.dart';
import '../staff/assignStaff.dart';
@ -584,7 +585,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
? MediaQuery.of(context).size.height *
0.69 //400
: (role == 'manager')
? MediaQuery.of(context).size.height * 0.5
? MediaQuery.of(context).size.height * 0.85
: (role == 'staff' || role == 'handler')
? MediaQuery.of(context).size.height * 0.85
: MediaQuery.of(context).size.height *
@ -599,19 +600,20 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
data: staffQuotationsPendingList,
stringFlag: "Proposal",
role: role!,
onRefresh: refresh,
),
),
if (role == 'handler') ...[
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role,
data: unAssignedEnqList,
onRefresh: refresh,
),
// if (role == 'handler') ...[
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role!,
data: unAssignedEnqList,
onRefresh: refresh,
),
],
),
// ],
],
)
: Row(
@ -736,39 +738,40 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
],
),
),
const SizedBox(height: 5),
if (role == 'manager')
SizedBox(
// replace Expanded
height: 350, // adjust height as needed
child: Row(
children: [
Expanded(
child: UnassignedEnq(
key: UniqueKey(),
title: "Unassigned Enquiries",
role: role!,
data: unAssignedEnqList,
onRefresh: refresh,
),
),
SizedBox(width: 16),
Expanded(
child: Performance(
title: "Performing Partner",
data: agentsPerformanceList,
),
),
SizedBox(width: 16),
Expanded(
child: Performance(
title: "Non-Performing Partner",
data: nonAgentsPerformanceList,
),
),
],
),
),
// const SizedBox(height: 5),
// if (role == 'manager')
// SizedBox(
// // replace Expanded
// height: 350, // adjust height as needed
// child: Row(
// children: [
// Expanded(
// child: UnassignedEnq(
// key: UniqueKey(),
// title: "Unassigned Enquiries",
// role: role!,
// data: unAssignedEnqList,
// onRefresh: refresh,
// ),
// ),
// SizedBox(width: 16),
// Expanded(
// child: Performance(
// title: "Performing Partner",
// data: agentsPerformanceList,
// ),
// ),
// SizedBox(width: 16),
// Expanded(
// child: Performance(
// title: "Non-Performing Partner",
// data: nonAgentsPerformanceList,
// ),
// ),
// ],
// ),
// ),
],
),
),
@ -1198,6 +1201,7 @@ class othersPendings extends StatelessWidget {
final String stringFlag;
String role;
final List<Map<String, dynamic>> data;
final VoidCallback? onRefresh;
othersPendings({
Key? key,
@ -1205,12 +1209,47 @@ class othersPendings extends StatelessWidget {
required this.role,
required this.data,
required this.stringFlag,
required this.onRefresh,
}) : super(key: key);
@override
Widget build(BuildContext context) {
print(' Data: $data');
// Compute totals
int totalTodayAssigned = 0;
int totalPending = 0;
int totalInProgress = 0;
int totalCompleted = 0;
int totalPrevPending = 0;
int totalPendingAll = 0;
for (var row in data) {
totalTodayAssigned += int.tryParse(row['today_assigned'] ?? '0') ?? 0;
totalPending += int.tryParse(row['today_pending'] ?? '0') ?? 0;
totalInProgress += int.tryParse(row['today_in_progress'] ?? '0') ?? 0;
totalCompleted += int.tryParse(row['today_completed'] ?? '0') ?? 0;
totalPrevPending += int.tryParse(row['total_completed'] ?? '0') ?? 0;
int totalPendingdata =
int.tryParse(row['total_pending']?.toString() ?? '0') ?? 0;
int todayAssigned =
int.tryParse(row['today_assigned']?.toString() ?? '0') ?? 0;
totalTodayAssigned += todayAssigned;
totalPendingAll += totalPendingdata;
int staffPending = totalPendingdata - todayAssigned;
// totalPrevPending += staffPending;
final rowPrevPending =
(int.tryParse(row['total_pending'] ?? '0') ?? 0) -
(int.tryParse(row['today_assigned'] ?? '0') ?? 0);
totalPrevPending += rowPrevPending < 0 ? 0 : rowPrevPending;
}
return Card(
color: Colors.white,
// color: const Color(0xFFEAF6F4),
@ -1222,7 +1261,19 @@ class othersPendings extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title
Text(title, style: _title),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title, style: _title),
InkWell(
onTap: () {
onRefresh!();
},
child: Icon(Icons.refresh, size: 18),
),
],
),
const SizedBox(height: 10),
// Header row
@ -1320,6 +1371,14 @@ class othersPendings extends StatelessWidget {
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
'Prev Pending',
textAlign: TextAlign.center,
style: _headerStyle,
),
),
// Expanded(
// flex: 2,
// child: Text(
@ -1341,6 +1400,18 @@ class othersPendings extends StatelessWidget {
itemBuilder: (context, index) {
final row = data[index];
final totalPending =
int.tryParse(row['total_pending']?.toString() ?? '0') ??
0;
final todayAssigned =
int.tryParse(row['today_assigned']?.toString() ?? '0') ??
0;
final staffPending = (totalPending - todayAssigned);
final safePending = staffPending < 0 ? 0 : staffPending;
// final staffPending = totalPending - todayAssigned;
final issuedCount = stringFlag == "Policies"
? (row['total_policis_pending'] ?? 0).toString()
: (row['total_quotation_pending'] ?? 0).toString();
@ -1350,9 +1421,9 @@ class othersPendings extends StatelessWidget {
: row['total_premium_value'];
return Container(
margin: const EdgeInsets.symmetric(vertical: 5),
margin: const EdgeInsets.symmetric(vertical: 3),
padding: const EdgeInsets.symmetric(
vertical: 5,
vertical: 4,
horizontal: 12,
),
decoration: BoxDecoration(
@ -1367,25 +1438,6 @@ class othersPendings extends StatelessWidget {
),
child: Row(
children: [
// Expanded(
// flex: 1,
// child: Text(
// (index + 1).toString(),
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
// if (role == 'manager') ...[
// Expanded(
// flex: 2,
// child: Text(
// row['handler_name'] ?? "",
//
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
// ],
Expanded(
flex: 2,
child: Text(
@ -1396,44 +1448,6 @@ class othersPendings extends StatelessWidget {
),
),
// Expanded(
// flex: 2,
// child: Text(
// row['total_assigned'] ?? "",
// // row['total_approval_pending'] ?? "",
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
// Expanded(
// flex: 2,
// child: Material(
// color: Colors.white,
// child: Center(
// child: InkWell(
// hoverColor: Color(0xFFEAF6F4),
// onTap: () {
// print(
// 'total_assigned : ${row['total_assigned']}',
// );
//
// handleDashboardNavigation(
// context,
// status: "Assigned",
// staffId: row['staff_id'] ?? '',
// role: role,
// );
// },
// child: Text(
// row['total_assigned'] ?? "",
// // row['total_approval_pending'] ?? "",
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
// ),
// ),
// ),
Expanded(
flex: 2,
child: Material(
@ -1483,7 +1497,7 @@ class othersPendings extends StatelessWidget {
);
},
child: Text(
row['pending_assigned'] ?? "",
row['today_pending'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1513,7 +1527,7 @@ class othersPendings extends StatelessWidget {
},
child: Text(
row['total_in_progress'] ?? "",
row['today_in_progress'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1541,7 +1555,35 @@ class othersPendings extends StatelessWidget {
);
},
child: Text(
row['total_completed'] ?? "",
row['today_completed'] ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
),
),
),
),
),
Expanded(
flex: 2,
child: Material(
color: Colors.white,
child: Center(
child: InkWell(
hoverColor: Color(0xFFEAF6F4),
onTap: () async {
print(
'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
);
handleDashboardNavigation(
context,
status: 'PrevPending',
staffId: row['staff_id'] ?? '',
role: role,
);
},
child: Text(
safePending.toString() ?? "",
// row['total_approval_pending'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
@ -1566,6 +1608,60 @@ class othersPendings extends StatelessWidget {
},
),
),
const SizedBox(height: 8),
// Header row
Container(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
decoration: BoxDecoration(
color: Color(0xFFF1F5F9),
// color: Color(0xFFE3F9F8),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
Expanded(
flex: 2,
child: Text(
"Total",
textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
totalTodayAssigned.toString(),
textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
totalPending.toString(),
textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
totalInProgress.toString(),
textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
totalPrevPending.toString(),
textAlign: TextAlign.center,
style: _headerStyle,
),
),
],
),
),
],
),
),

View File

@ -0,0 +1,48 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../../themes/charts/barChart.dart';
class BussinessDashboard extends ConsumerStatefulWidget {
const BussinessDashboard({super.key});
@override
ConsumerState<BussinessDashboard> createState() => _BussinessDashboardState();
}
class _BussinessDashboardState extends ConsumerState<BussinessDashboard> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(10),
// color: Colors.white,
// color: Colors.amber.shade100,
child: Column(
children: [
Row(
children: [
Text('Product Wise', style: _headerStyle2),
// BarChart(
// dataList: [
// _BarData(Colors.blue, 10, 8),
// _BarData(Colors.orange, 12, 10),
// _BarData(Colors.green, 8, 5),
// ],
// labels: ["A", "B", "C"],
// ),
],
),
],
),
);
}
}
final _headerStyle2 = GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
fontWeight: FontWeight.w500,
);

View File

@ -0,0 +1,242 @@
import 'dart:math' as math;
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../../../themes/charts/appChartColors.dart';
class BarChartSample7 extends StatefulWidget {
BarChartSample7({super.key});
final shadowColor = const Color(0xFFCCCCCC);
final dataList = [
_BarData(AppColors.contentColorYellow, 18, 18),
_BarData(AppColors.contentColorGreen, 17, 8),
_BarData(AppColors.contentColorOrange, 10, 15),
_BarData(AppColors.contentColorPink, 2.5, 5),
_BarData(AppColors.contentColorBlue, 2, 2.5),
_BarData(AppColors.contentColorRed, 2, 2),
];
@override
State<BarChartSample7> createState() => _BarChartSample7State();
}
class _BarChartSample7State extends State<BarChartSample7> {
BarChartGroupData generateBarGroup(
int x,
Color color,
double value,
double shadowValue,
) {
return BarChartGroupData(
x: x,
barRods: [
BarChartRodData(toY: value, color: color, width: 6),
BarChartRodData(toY: shadowValue, color: widget.shadowColor, width: 6),
],
showingTooltipIndicators: touchedGroupIndex == x ? [0] : [],
);
}
int touchedGroupIndex = -1;
int rotationTurns = 1;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(24),
child: Column(
children: [
Row(
children: [
Expanded(child: Container()),
const Text(
'Horizontal Bar Chart',
style: TextStyle(color: AppColors.mainTextColor1, fontSize: 20),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Tooltip(
message: 'Rotate the chart 90 degrees (cw)',
child: IconButton(
onPressed: () {
setState(() {
rotationTurns += 1;
});
},
icon: RotatedBox(
quarterTurns: rotationTurns - 1,
child: const Icon(Icons.rotate_90_degrees_cw),
),
),
),
),
),
],
),
const SizedBox(height: 18),
AspectRatio(
aspectRatio: 1.4,
child: BarChart(
BarChartData(
alignment: BarChartAlignment.spaceBetween,
rotationQuarterTurns: rotationTurns,
borderData: FlBorderData(
show: true,
border: Border.symmetric(
horizontal: BorderSide(
color: AppColors.borderColor.withValues(alpha: 0.2),
),
),
),
titlesData: FlTitlesData(
show: true,
leftTitles: const AxisTitles(
drawBelowEverything: true,
sideTitles: SideTitles(showTitles: true, reservedSize: 30),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 50,
getTitlesWidget: (value, meta) {
final index = value.toInt();
return SideTitleWidget(
meta: meta,
child: Text('data'),
// child: _IconWidget(
// color: widget.dataList[index].color,
// isSelected: touchedGroupIndex == index,
// ),
);
},
),
),
// rightTitles: const AxisTitles(),
// topTitles: const AxisTitles(),
),
gridData: FlGridData(
show: true,
drawVerticalLine: false,
getDrawingHorizontalLine: (value) => FlLine(
color: AppColors.borderColor.withValues(alpha: 0.2),
strokeWidth: 1,
),
),
barGroups: widget.dataList.asMap().entries.map((e) {
final index = e.key;
final data = e.value;
return generateBarGroup(
index,
data.color,
data.value,
data.shadowValue,
);
}).toList(),
maxY: 20,
barTouchData: BarTouchData(
enabled: true,
handleBuiltInTouches: false,
touchTooltipData: BarTouchTooltipData(
getTooltipColor: (group) => Colors.transparent,
tooltipMargin: 0,
getTooltipItem:
(
BarChartGroupData group,
int groupIndex,
BarChartRodData rod,
int rodIndex,
) {
return BarTooltipItem(
rod.toY.toString(),
TextStyle(
fontWeight: FontWeight.bold,
color: rod.color,
fontSize: 18,
shadows: const [
Shadow(color: Colors.black26, blurRadius: 12),
],
),
);
},
),
touchCallback: (event, response) {
if (event.isInterestedForInteractions &&
response != null &&
response.spot != null) {
setState(() {
touchedGroupIndex = response.spot!.touchedBarGroupIndex;
});
} else {
setState(() {
touchedGroupIndex = -1;
});
}
},
),
),
),
),
],
),
);
}
}
class _BarData {
const _BarData(this.color, this.value, this.shadowValue);
final Color color;
final double value;
final double shadowValue;
}
class _IconWidget extends ImplicitlyAnimatedWidget {
const _IconWidget({required this.color, required this.isSelected})
: super(duration: const Duration(milliseconds: 300));
final Color color;
final bool isSelected;
@override
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() =>
_IconWidgetState();
}
class _IconWidgetState extends AnimatedWidgetBaseState<_IconWidget> {
Tween<double>? _rotationTween;
@override
Widget build(BuildContext context) {
final rotation = math.pi * 4 * _rotationTween!.evaluate(animation);
final scale = 1 + _rotationTween!.evaluate(animation) * 0.5;
return Transform(
transform: Matrix4.identity()..scale(0.8),
// transform: Matrix4.rotationZ(rotation)..scaled(scale, scale, scale),
// transform: Matrix4.rotationZ(rotation)..scale(scale, scale, scale),
origin: const Offset(14, 14),
child: Icon(
widget.isSelected ? Icons.face_retouching_natural : Icons.face,
color: widget.color,
size: 28,
),
);
}
@override
void forEachTween(TweenVisitor<dynamic> visitor) {
_rotationTween =
visitor(
_rotationTween,
widget.isSelected ? 1.0 : 0.0,
(dynamic value) => Tween<double>(
begin: value as double,
end: widget.isSelected ? 1.0 : 0.0,
),
)
as Tween<double>?;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2413,6 +2413,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInlineTST> {
print("Enquiry saved successfully");
// RESET FORM
raiseEnqKey.currentState?.resetFormFields();
getStaffDetailsForEnquiryAssignment(userId);
} catch (e) {
showDialog(
context: context,

View File

@ -10,7 +10,7 @@ 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:nhance_partner/presentation/screens/dashboard/dashboard.dart';
import 'package:nhance_partner/presentation/screens/dashboard/dashboard_nw.dart';
import 'package:nhance_partner/presentation/screens/staff/Enquiry/quotationPopUpAccptReject.dart';
import 'package:nhance_partner/presentation/screens/staff/Enquiry/raise_enq_form.dart';
import 'package:nhance_partner/presentation/screens/staff/Enquiry/staff_policy.dart';

View File

@ -192,6 +192,8 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
// 3. Reset form validation
_formKey.currentState?.reset();
setState(() {});
}
Future<void> getVehicleType() async {
@ -365,6 +367,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
// color: Color(0xFFFCFCFC),
// margin: const EdgeInsets.symmetric(vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 25),
height: MediaQuery.of(context).size.height * 0.16,
decoration: BoxDecoration(
color: Colors.white,
// color: Colors.amber,
@ -387,7 +390,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
key: _formKey,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
buildAgentName(context, fromHeader: true),
if (roleId != 'staff') ...[buildSelectStaffMem(context)],
@ -398,6 +401,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
// buildInsuredName(context, fromHeader: true),
buildVehicleNumber(context),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
buildRefresh(context),
SizedBox(width: 5),
@ -952,9 +956,25 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
horizontal: 8,
vertical: 3,
),
child: Text(
item['name'].toString(),
style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
item['name'].toString(),
style: GoogleFonts.inter(
fontSize: 12,
color: Colors.black,
),
),
Text(
"(${item['today_assigned']} / ${item['total_pending']})",
style: GoogleFonts.poppins(
fontSize: 10,
color: Colors.blueGrey.shade200,
),
),
],
),
);
},

View File

@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
class AppColors {
static const Color primary = contentColorCyan;
static const Color menuBackground = Color(0xFF090912);
static const Color itemsBackground = Color(0xFF1B2339);
static const Color pageBackground = Color(0xFF282E45);
static const Color mainTextColor1 = Colors.white;
static const Color mainTextColor2 = Colors.white70;
static const Color mainTextColor3 = Colors.white38;
static const Color mainGridLineColor = Colors.white10;
static const Color borderColor = Colors.white54;
static const Color gridLinesColor = Color(0x11FFFFFF);
static const Color contentColorBlack = Colors.black;
static const Color contentColorWhite = Colors.white;
static const Color contentColorBlue = Color(0xFF2196F3);
static const Color contentColorYellow = Color(0xFFFFC300);
static const Color contentColorOrange = Color(0xFFFF683B);
static const Color contentColorGreen = Color(0xFF3BFF49);
static const Color contentColorPurple = Color(0xFF6E1BFF);
static const Color contentColorPink = Color(0xFFFF3AF2);
static const Color contentColorRed = Color(0xFFE80054);
static const Color contentColorCyan = Color(0xFF50E4FF);
}

View File

@ -1,87 +1,136 @@
// import 'package:fl_chart/fl_chart.dart';
// import 'package:flutter/material.dart';
//
// class DynamicHorizontalBarChart extends StatelessWidget {
// final List<Map<String, dynamic>> data;
// // Example:
// // [
// // {"label": "Apple", "value": 35},
// // {"label": "Banana", "value": 20},
// // {"label": "Orange", "value": 15},
// // ]
//
// const DynamicHorizontalBarChart({super.key, required this.data});
//
// @override
// Widget build(BuildContext context) {
// double maxValue = data
// .map((e) => e["value"] as double)
// .reduce((a, b) => a > b ? a : b);
//
// return SizedBox(
// height: data.length * 50,
// child: BarChart(
// BarChartData(
// maxY: maxValue + 10,
// barTouchData: BarTouchData(enabled: false),
//
// titlesData: FlTitlesData(
// leftTitles: AxisTitles(
// sideTitles: SideTitles(
// showTitles: true,
// reservedSize: 100,
// getTitlesWidget: (value, meta) {
// int index = value.toInt();
// if (index < data.length) {
// return Text(
// data[index]["label"],
// style: const TextStyle(fontSize: 12),
// );
// }
// return Container();
// },
// ),
// ),
// rightTitles: AxisTitles(),
// topTitles: AxisTitles(),
// bottomTitles: AxisTitles(),
// ),
//
// gridData: FlGridData(show: false),
// borderData: FlBorderData(show: false),
//
// barGroups: List.generate(data.length, (index) {
// final item = data[index];
// final double value = item["value"] * 1.0;
//
// return BarChartGroupData(
// x: index,
// barRods: [
// BarChartRodData(
// toY: value,
// width: 25,
// color: Colors.teal,
// borderRadius: BorderRadius.circular(5),
//
// // 🟩 LABEL INSIDE THE BAR
// rodStackItems: [
// BarChartRodStackItem(
// 0,
// value,
// Colors.transparent,
// // BorderSide(),
// // StackItemLabel(
// // label: "${value.toInt()}",
// // labelStyle: const TextStyle(color: Colors.white),
// // ),
// ),
// ],
// ),
// ],
// );
// }),
// ),
// ),
// );
// }
// }
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'appChartColors.dart';
class BarChart extends StatefulWidget {
final List<_BarData>? dataList;
final List<String>? labels;
final String title;
final double maxY;
final int initialRotation;
const BarChart(
BarChartData barChartData, {
super.key,
this.dataList,
this.labels,
this.title = "Horizontal Bar Chart",
this.maxY = 20,
this.initialRotation = 1,
});
final shadowColor = const Color(0xFFCCCCCC);
@override
State<BarChart> createState() => _BarChartState();
}
class _BarChartState extends State<BarChart> {
int touchedGroupIndex = -1;
late int rotationTurns;
@override
void initState() {
super.initState();
rotationTurns = widget.initialRotation;
}
BarChartGroupData generateBarGroup(
int x,
Color color,
double value,
double shadowValue,
) {
return BarChartGroupData(
x: x,
barRods: [
BarChartRodData(toY: value, color: color, width: 6),
BarChartRodData(toY: shadowValue, color: widget.shadowColor, width: 6),
],
showingTooltipIndicators: touchedGroupIndex == x ? [0] : [],
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(24),
child: Column(
children: [
Row(
children: [
const Spacer(),
Text(
widget.title,
style: const TextStyle(
color: AppColors.mainTextColor1,
fontSize: 20,
),
),
Spacer(),
IconButton(
onPressed: () {
setState(() => rotationTurns += 1);
},
icon: RotatedBox(
quarterTurns: rotationTurns - 1,
child: const Icon(Icons.rotate_90_degrees_cw),
),
),
],
),
const SizedBox(height: 18),
AspectRatio(
aspectRatio: 1.4,
child: BarChart(
BarChartData(
alignment: BarChartAlignment.spaceBetween,
rotationQuarterTurns: rotationTurns,
borderData: FlBorderData(show: false),
titlesData: FlTitlesData(
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) {
final i = value.toInt();
if (i >= widget.labels!.length) return const SizedBox();
return SideTitleWidget(
meta: meta,
child: Text(widget.labels![i]),
);
},
),
),
leftTitles: const AxisTitles(),
),
gridData: const FlGridData(show: false),
barGroups: widget.dataList?.asMap().entries.map((e) {
final index = e.key;
final data = e.value;
return generateBarGroup(
index,
data.color,
data.value,
data.shadowValue,
);
}).toList(),
maxY: widget.maxY,
),
// dataList: [],
// labels: [],
),
),
],
),
);
}
}
class _BarData {
final Color color;
final double value;
final double shadowValue;
const _BarData(this.color, this.value, this.shadowValue);
}

View File

@ -200,7 +200,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
message: 'Filter',
child: IconButton(
icon: const Icon(
Icons.filter_alt_outlined,
Icons.search_rounded,
size: 18,
color: const Color(0xFF94A3B8),
),

View File

@ -7,7 +7,6 @@ import Foundation
import connectivity_plus
import file_picker
import firebase_app_check
import firebase_auth
import firebase_core
import firebase_messaging
@ -23,7 +22,6 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FLTFirebaseAppCheckPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAppCheckPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))

View File

@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: _flutterfire_internals
sha256: "948f7d74f41dd6f2d563ea9f4c21d7ea764f8e047d2b24138974c19c24d37eb6"
sha256: "8a1f5f3020ef2a74fb93f7ab3ef127a8feea33a7a2276279113660784ee7516a"
url: "https://pub.dev"
source: hosted
version: "1.3.61"
version: "1.3.64"
analyzer:
dependency: transitive
description:
@ -297,30 +297,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "10.3.3"
firebase_app_check:
dependency: "direct main"
description:
name: firebase_app_check
sha256: "3bf5d9c9043723ae12c09b2a012ca5f32653a1bc30a0a9818983766ea06d72a8"
url: "https://pub.dev"
source: hosted
version: "0.4.0+1"
firebase_app_check_platform_interface:
dependency: transitive
description:
name: firebase_app_check_platform_interface
sha256: bdda519aa487be605a53093ececa564d48afadd1a1d018520ce45d00415ac03d
url: "https://pub.dev"
source: hosted
version: "0.2.0+1"
firebase_app_check_web:
dependency: transitive
description:
name: firebase_app_check_web
sha256: ab7b57c95faf266e2d5cd9fc57cda54d1fdfbc2c429c09b095830d4186f25920
url: "https://pub.dev"
source: hosted
version: "0.2.0+16"
firebase_auth:
dependency: "direct main"
description:
@ -349,26 +325,26 @@ packages:
dependency: "direct main"
description:
name: firebase_core
sha256: "967dae9a65f69377beb9f4ab292ea63ce5befa1ce24682cab1b69ca4b7a46927"
sha256: "1f2dfd9f535d81f8b06d7a50ecda6eac1e6922191ed42e09ca2c84bd2288927c"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "4.2.1"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: "5dbc900677dcbe5873d22ad7fbd64b047750124f1f9b7ebe2a33b9ddccc838eb"
sha256: cccb4f572325dc14904c02fcc7db6323ad62ba02536833dddb5c02cac7341c64
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "6.0.2"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: f7ee08febc1c4451588ce58ffcf28edaee857e9a196fee88b85deb889990094a
sha256: ff18fabb0ad0ed3595d2f2c85007ecc794aadecdff5b3bb1460b7ee47cded398
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.3.0"
firebase_messaging:
dependency: "direct main"
description:
@ -401,6 +377,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
fl_chart:
dependency: "direct main"
description:
name: fl_chart
sha256: "5276944c6ffc975ae796569a826c38a62d2abcf264e26b88fa6f482e107f4237"
url: "https://pub.dev"
source: hosted
version: "0.70.2"
flutter:
dependency: "direct main"
description: flutter

View File

@ -58,7 +58,6 @@ dependencies:
google_sign_in: ^7.1.1
firebase_core: ^4.1.0
firebase_auth: ^6.0.2
firebase_app_check: ^0.4.0+1
package_info_plus: ^8.3.1
flutter_lints: ^6.0.0
easy_loading_button: ^0.4.0
@ -69,6 +68,8 @@ dependencies:
dropdown_search: ^6.0.2
file_picker: ^10.3.3
fluttertoast: ^9.0.0
fl_chart: ^0.70.0
# fl_chart: ^1.1.0