tracker items fix

This commit is contained in:
venbaittech 2025-12-11 16:26:54 +05:30
parent 8cc66eb233
commit 4362ffad32
17 changed files with 154 additions and 118 deletions

File diff suppressed because one or more lines are too long

View File

@ -778,38 +778,6 @@ class ApiService {
// ----------------------------------- ENQUIRY ------------------------------------------------- // ----------------------------------- ENQUIRY -------------------------------------------------
Future<Map<String, dynamic>> fetchEnquiryList1(int id, role) async {
// print(_token);
if (_token == null) {
await _initializeToken();
}
final url;
if (role == 'manager') {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?manager_id=$id&from_date=&to_date=',
);
} else if (role == 'staff') {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?staff_id=$id&from_date=&to_date=',
);
} else {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?agent_id=$id&from_date=&to_date=',
);
}
// final url = Uri.parse(
// 'https://venbait.in/nhance/partner/dev/api/agent/agentList?manager_id=${managerId}',
// );
final headers = {
'Authorization': 'Bearer $_token' ?? '',
'app-signature': Env.App_Signature,
};
final response = await _makeGetRequest(url, headers);
return response;
}
Future<Map<String, dynamic>> fetchEnquiryList( Future<Map<String, dynamic>> fetchEnquiryList(
int managerid, int managerid,
int id, int id,
@ -1207,23 +1175,26 @@ class ApiService {
return response; return response;
} }
Future<Map<String, dynamic>> fetchClaimList(int id, role) async { Future<Map<String, dynamic>> fetchClaimList(
managerId,
int userId,
role,
) async {
// print(_token); // print(_token);
if (_token == null) { if (_token == null) {
await _initializeToken(); await _initializeToken();
} }
final userId = '1';
final url; final url;
if (role == 'manager') { if (role == 'manager') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?manager_id=$id'); url = Uri.parse('${Env.apiUrl}claim/ClaimList?manager_id=$managerId');
} else if (role == 'agent') { } else if (role == 'agent') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?agent_id=$id'); url = Uri.parse('${Env.apiUrl}claim/ClaimList?agent_id=$userId');
} else if (role == 'handler') { } else if (role == 'handler') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?handler_id=$id'); url = Uri.parse('${Env.apiUrl}claim/ClaimList?handler_id=$userId');
} else { } else {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?staff_id=$id'); url = Uri.parse('${Env.apiUrl}claim/ClaimList?staff_id=$userId');
} }
// final url = Uri.parse( // final url = Uri.parse(
@ -1254,18 +1225,21 @@ class ApiService {
// ----------------------------------- ENDORSEMENT ------------------------------------------------- // ----------------------------------- ENDORSEMENT -------------------------------------------------
Future<Map<String, dynamic>> fetchEndorsementList(int id, role) async { Future<Map<String, dynamic>> fetchEndorsementList(
managerId,
int id,
role,
) async {
// print(_token); // print(_token);
if (_token == null) { if (_token == null) {
await _initializeToken(); await _initializeToken();
} }
final userId = '1';
final url; final url;
if (role == 'manager') { if (role == 'manager') {
url = Uri.parse( url = Uri.parse(
'${Env.apiUrl}endorsement/endorsementList?manager_id=$id', '${Env.apiUrl}endorsement/endorsementList?manager_id=$managerId',
); );
} else if (role == 'agent') { } else if (role == 'agent') {
url = Uri.parse('${Env.apiUrl}endorsement/endorsementList?agent_id=$id'); url = Uri.parse('${Env.apiUrl}endorsement/endorsementList?agent_id=$id');
@ -1365,6 +1339,7 @@ class ApiService {
} }
Future<Map<String, dynamic>> fetchStaffListForEnquiryAssignDropDown( Future<Map<String, dynamic>> fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
role, role,
) async { ) async {
@ -1378,7 +1353,7 @@ class ApiService {
if (role == 'manager') { if (role == 'manager') {
url = Uri.parse( url = Uri.parse(
'${Env.apiUrl}staff/staffListForEnquiryAssignDropdown?manager_id=$id', '${Env.apiUrl}staff/staffListForEnquiryAssignDropdown?manager_id=$managerId',
); );
} else { } else {
url = Uri.parse( url = Uri.parse(

View File

@ -706,11 +706,11 @@ class _HoverableContainerState extends State<_HoverableContainer> {
color: Colors.black87, color: Colors.black87,
), ),
), ),
Icon( // Icon(
Icons.arrow_forward_ios_rounded, // Icons.arrow_forward_ios_rounded,
size: 10, // size: 10,
color: Colors.grey.shade600, // color: Colors.grey.shade600,
), // ),
], ],
), ),
), ),

View File

@ -16,3 +16,4 @@ final staffIndiviualAttendanceNameIdProvider = StateProvider<String?>(
final dashboardKeyProvider = StateProvider<int?>((ref) => null); final dashboardKeyProvider = StateProvider<int?>((ref) => null);
final dashboardStatusProvider = StateProvider<String?>((ref) => null); final dashboardStatusProvider = StateProvider<String?>((ref) => null);
final dashboardStaffIdProvider = StateProvider<String?>((ref) => null); final dashboardStaffIdProvider = StateProvider<String?>((ref) => null);
final enquiryRefreshProvider = StateProvider<bool>((ref) => false);

View File

@ -51,23 +51,23 @@ class claimListState extends ConsumerState<claimList> {
// roleId = ref.read(userRoleProvider); // roleId = ref.read(userRoleProvider);
// roleId = ref.read(userRoleProvider); // roleId = ref.read(userRoleProvider);
roleId = ref.read(userRoleProvider);
userId = ref.read(userIdProvider); userId = ref.read(userIdProvider);
print("G47 => r : $roleId | mId: $id | uId: $userId "); print("G47 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) { if (userId != null) {
getStaffList(id!, userId); getStaffList(managerId, userId, roleId);
} }
}); });
} }
Future<void> getStaffList(int managerId, role) async { Future<void> getStaffList(int managerId, int userId, role) async {
print('G54 => Fns called => $managerId | $role'); print('G54 => Fns called => $managerId | $role');
setState(() { setState(() {
isLoading = true; isLoading = true;
}); });
try { try {
final response = await apiService.fetchClaimList(managerId, role); final response = await apiService.fetchClaimList(managerId, userId, role);
if (response['status'] == 'success') { if (response['status'] == 'success') {
final data = response['data']; final data = response['data'];
@ -176,7 +176,7 @@ class claimListState extends ConsumerState<claimList> {
} }
void refresh() { void refresh() {
getStaffList(managerId, userId); getStaffList(managerId, userId, roleId);
} }
@override @override

View File

@ -49,19 +49,23 @@ class endosementState extends ConsumerState<endosement> {
userId = ref.read(userIdProvider); userId = ref.read(userIdProvider);
print("F46 => r : $roleId | mId: $id | uId: $userId "); print("F46 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) { if (userId != null) {
getStaffList(userId, roleId); getStaffList(managerId, userId, roleId);
} }
}); });
} }
Future<void> getStaffList(int managerId, role) async { Future<void> getStaffList(int managerId, userId, role) async {
print('F53 => Fns called => $managerId | $role'); print('F53 => Fns called => $managerId | $role');
setState(() { setState(() {
isLoading = true; isLoading = true;
}); });
try { try {
final response = await apiService.fetchEndorsementList(managerId, role); final response = await apiService.fetchEndorsementList(
managerId,
userId,
role,
);
if (response['status'] == 'success') { if (response['status'] == 'success') {
final data = response['data']; final data = response['data'];
@ -112,7 +116,7 @@ class endosementState extends ConsumerState<endosement> {
} }
void refresh() { void refresh() {
getStaffList(managerId, roleId); getStaffList(managerId, userId, roleId);
} }
void filterData(String query) { void filterData(String query) {
@ -175,7 +179,7 @@ class endosementState extends ConsumerState<endosement> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MainLayout( return MainLayout(
title: "Endosement", title: "Endorsement",
body: Container( body: Container(
// color: Colors.yellow.shade50, // color: Colors.yellow.shade50,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,

View File

@ -239,6 +239,8 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
), ),
), ),
const SizedBox(height: 26), const SizedBox(height: 26),
if (profileData?['mobile'] != null ||
profileData?['mobile'] != '') ...[
Row( Row(
children: [ children: [
const Icon( const Icon(
@ -254,6 +256,9 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
],
if (profileData?['email'] != null ||
profileData?['email'] != '') ...[
Row( Row(
children: [ children: [
const Icon( const Icon(
@ -269,6 +274,10 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
], ],
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
],
if (profileData?['address'] != null ||
profileData?['address'] != '') ...[
if ((roleId != 1) && if ((roleId != 1) &&
(roleId != 2) && (roleId != 2) &&
(roleId != 3)) ...[ (roleId != 3)) ...[
@ -293,8 +302,11 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
], ],
],
if ((roleId != 2) && (roleId != 3)) ...[ if ((roleId != 1) &&
(roleId != 2) &&
(roleId != 3)) ...[
// Staff, Handler doesn't have this part Only Manager and agent have // Staff, Handler doesn't have this part Only Manager and agent have
Container( Container(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),

View File

@ -93,8 +93,8 @@ class _DashboardState extends ConsumerState<PartnerDashboard> {
final prefroleId = ref.read(userRoleProvider); final prefroleId = ref.read(userRoleProvider);
print("B81 => roleId: $prefroleId | userId: $prefuserid "); print("B81 => roleId: $prefroleId | userId: $prefuserid ");
if (prefuserid != null) { if (prefmanagerid != null) {
getParnterDashBrdList(prefuserid); getParnterDashBrdList(prefmanagerid);
// getStaffList(prefmanagerid!, prefroleId, prefuserid); // getStaffList(prefmanagerid!, prefroleId, prefuserid);
} }
}); });
@ -504,7 +504,7 @@ class _PerformanceState extends State<Performance> {
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
"S.NO", "S.no.",
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: _headerStyle, style: _headerStyle,
), ),

View File

@ -369,6 +369,7 @@ class EnquiryHandlerState extends ConsumerState<EnquiryListHandler> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );

View File

@ -641,6 +641,7 @@ class CreateProposal_QuickFormState
reset(); reset();
getQuickQuotationList(managerId); getQuickQuotationList(managerId);
// Navigator.of(context).pop(); // Navigator.of(context).pop();
} else if (response.statusCode == 403) { } else if (response.statusCode == 403) {
await apiService.clearLocalStorageAndRedirect(); await apiService.clearLocalStorageAndRedirect();
@ -700,9 +701,17 @@ class CreateProposal_QuickFormState
print("tre1"); print("tre1");
selectedId = null; // just update field selectedId = null; // just update field
Navigator.of(context).pop(); Navigator.of(context).pop();
final prefs = await SharedPreferences.getInstance(); // final prefs = await SharedPreferences.getInstance();
await prefs.setString('QuoteKeyProvider', 'fromQuickQuote'); // await prefs.setString('QuoteKeyProvider', 'fromQuickQuote');
WidgetsBinding.instance.addPostFrameCallback((_) {
// Now safe to do navigation + provider updates
final container = ProviderScope.containerOf(context);
container.read(enquiryRefreshProvider.notifier).state = true;
context.go('/enquiryForStaff'); context.go('/enquiryForStaff');
});
print("tre11"); print("tre11");
getQuickQuotationList(managerId); getQuickQuotationList(managerId);
} else if (response.statusCode == 403) { } else if (response.statusCode == 403) {
@ -1561,7 +1570,8 @@ class CreateProposal_QuickFormState
bordedRad: 5, bordedRad: 5,
// backgroundColor: Color(0xFFEDF6F5), // backgroundColor: Color(0xFFEDF6F5),
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')), // FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')),
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,2}$')),
], ],
// validator: (value) => // validator: (value) =>
// Validators.doubleNumber(value, "PremiumAmount"), // Validators.doubleNumber(value, "PremiumAmount"),

View File

@ -369,6 +369,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInlineTST> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );

View File

@ -484,6 +484,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );

View File

@ -109,6 +109,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
Map<int, bool> isEditingRow = {}; Map<int, bool> isEditingRow = {};
Map<int, Map<String, TextEditingController>> rowControllers = {}; Map<int, Map<String, TextEditingController>> rowControllers = {};
late ProviderSubscription<bool> refreshSub;
//---------------------- Enquiry TAB Initializations Starts -------------------------------- // //---------------------- Enquiry TAB Initializations Starts -------------------------------- //
@ -223,6 +224,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
Timer? timer; Timer? timer;
int selectedSeconds = 30; int selectedSeconds = 30;
bool isActionable = false; bool isActionable = false;
bool _listened = false;
//---------------------- Assign Staff Ends -------------------------------- // //---------------------- Assign Staff Ends -------------------------------- //
//---------------------- Enquiry TAB Initializations Ends -------------------------------- // //---------------------- Enquiry TAB Initializations Ends -------------------------------- //
@ -255,10 +257,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('handlerIdENQ - $handlerId'); print('handlerIdENQ - $handlerId');
print("C72 => r : $roleId | uId: $userId !mID : $managerId "); print("C72 => r : $roleId | uId: $userId !mID : $managerId ");
print('quickQuotationKey'); print('quickQuotationKey');
if (quickQuotationKey == 'fromQuickQuote') {
print('quickQuotationKey - $quickQuotationKey');
callRefresh();
}
print('dashboardKey - $dashboardKey'); print('dashboardKey - $dashboardKey');
print('dashboardStatus - $dashboardStatus'); print('dashboardStatus - $dashboardStatus');
@ -293,6 +291,15 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('hansles'); print('hansles');
getStaffDetailsForEnquiryAssignment(userID); getStaffDetailsForEnquiryAssignment(userID);
} }
ref.listen(enquiryRefreshProvider, (prev, next) {
print('quickQuotationKey1');
if (next == true) {
print('quickQuotationKey2 - $next');
callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false; // reset
}
});
}); });
getVehicleType(); getVehicleType();
@ -300,6 +307,18 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
getInsuranceType(); getInsuranceType();
getBroker(); getBroker();
getPaymentMode(); getPaymentMode();
refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, (
previous,
next,
) {
if (next == true) {
print('refresh triggered Quick Creation');
callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false;
}
});
} }
Future<void> loadPreferences() async { Future<void> loadPreferences() async {
@ -375,6 +394,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
@override @override
void dispose() { void dispose() {
refreshSub.close();
_horizontalScrollController.dispose(); _horizontalScrollController.dispose();
// ... dispose other controllers ... // ... dispose other controllers ...
super.dispose(); super.dispose();
@ -571,6 +591,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );
@ -4111,7 +4132,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
border: Border.all(color: Color(0xFFE2E8F0)), border: Border.all(color: Color(0xFFE2E8F0)),
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
), ),
child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3), child: Text(
item['reg_no'] ?? '-',
textAlign: TextAlign.center,
style: _dataBoldthm3,
),
), ),
// ), // ),
// child: Text(item['reg_no'] ?? '-', style: _dataBold), // child: Text(item['reg_no'] ?? '-', style: _dataBold),

View File

@ -367,6 +367,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );

View File

@ -351,6 +351,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
roleId, roleId,
); );
@ -413,9 +414,8 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
buildAgentName(context, fromHeader: true),
if (roleId != 'staff') ...[buildSelectStaffMem(context)], if (roleId != 'staff') ...[buildSelectStaffMem(context)],
buildAgentName(context, fromHeader: true),
buildBroker(context), buildBroker(context),
buildInsurer(context, fromHeader: true), buildInsurer(context, fromHeader: true),

View File

@ -76,6 +76,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
String? selectedRegNum; String? selectedRegNum;
String? selectedStaffName; String? selectedStaffName;
dynamic managerId;
Map<String, dynamic> dataDetails() { Map<String, dynamic> dataDetails() {
final data = { final data = {
"id": widget.enquiryPrimaryId, "id": widget.enquiryPrimaryId,
@ -104,7 +106,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
getInsurers(); getInsurers();
getBroker(); getBroker();
Future.microtask(() { Future.microtask(() {
final managerId = ref.watch(managerIdProvider); managerId = ref.watch(managerIdProvider);
// final handlerId = ref.watch(handlerIdProvider); // final handlerId = ref.watch(handlerIdProvider);
role = ref.watch(userRoleProvider); role = ref.watch(userRoleProvider);
final userID = ref.watch(userIdProvider); final userID = ref.watch(userIdProvider);
@ -193,6 +195,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
role, role,
); );

View File

@ -80,6 +80,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
String? selectedStaff; String? selectedStaff;
String? selectedStaffName; String? selectedStaffName;
dynamic role; dynamic role;
dynamic managerId;
bool isLoading = false; bool isLoading = false;
@ -89,7 +90,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
apiService = ApiService(); apiService = ApiService();
Future.microtask(() { Future.microtask(() {
final managerId = ref.watch(managerIdProvider); managerId = ref.watch(managerIdProvider);
final userID = ref.watch(userIdProvider); final userID = ref.watch(userIdProvider);
// final handlerId = ref.watch(handlerIdProvider); // final handlerId = ref.watch(handlerIdProvider);
role = ref.watch(userRoleProvider); role = ref.watch(userRoleProvider);
@ -118,6 +119,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
try { try {
// final response = await apiService.fetchStaffUserList(id, role); // final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown( final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id, id,
role, role,
); );