quick_proceed status_changes
This commit is contained in:
parent
485894ba98
commit
fcdc9da609
File diff suppressed because one or more lines are too long
@ -30,6 +30,7 @@ import '../../presentation/screens/splash/splash_screen.dart';
|
||||
import '../../presentation/screens/staff/Enquiry/enquiry_inline_Edit_17Nov.dart';
|
||||
import '../../presentation/screens/staff/Enquiry/enquiry_inline_list.dart';
|
||||
import '../../presentation/screens/staff/Enquiry/enquiry_list.dart';
|
||||
import '../../presentation/screens/staff/Enquiry/staff_policy.dart';
|
||||
import '../../presentation/screens/staff/policy/policy.dart';
|
||||
import '../../presentation/screens/staff/policy/policy_list.dart';
|
||||
import '../../presentation/screens/staff/quotations/quotation.dart';
|
||||
@ -176,6 +177,11 @@ final GoRouter appRouter = GoRouter(
|
||||
builder: (context, state) => const PolicyScreen(),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: AppRoutes.policyStaffEnq,
|
||||
builder: (context, state) => PolicyStaffEnqList(),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: AppRoutes.enquiryForStaff,
|
||||
builder: (context, state) => const EnquiryListStaffInline(),
|
||||
|
||||
@ -21,6 +21,7 @@ class AppRoutes {
|
||||
static const String policylist = '/policylist';
|
||||
static const String quotation = '/QuotationScreen';
|
||||
static const String policy = '/PolicyScreen';
|
||||
static const String policyStaffEnq = '/policyStaffEnq';
|
||||
|
||||
static const String payout = '/payout';
|
||||
static const String invoiceList = '/invoiceList';
|
||||
|
||||
@ -576,6 +576,8 @@ class ApiService {
|
||||
|
||||
Future<Map<String, dynamic>> fetchStaffUserList(int managerId, role) async {
|
||||
// print(_token);
|
||||
|
||||
print('rolemanagerId - $managerId');
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
}
|
||||
@ -587,6 +589,7 @@ class ApiService {
|
||||
dynamic url;
|
||||
if (role == 'manager') {
|
||||
print('manager');
|
||||
// url = Uri.parse('${Env.apiUrl}staff/staffList');
|
||||
url = Uri.parse('${Env.apiUrl}staff/staffList?manager_id=${managerId}');
|
||||
} else {
|
||||
print('handler');
|
||||
@ -770,6 +773,22 @@ class ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> updateEnquiryInProgress(id) async {
|
||||
// print(_token);
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
}
|
||||
final url = Uri.parse(
|
||||
'${Env.apiUrl}enquiry/updateEnquiryInProgress?enquiry_id=$id',
|
||||
);
|
||||
final headers = {
|
||||
'Authorization': 'Bearer $_token' ?? '',
|
||||
'app-signature': Env.App_Signature,
|
||||
};
|
||||
final response = await _makeGetRequest(url, headers);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> findEnqQuotePolicyView(id) async {
|
||||
print('findEnqQuotePolicyVie2w - $id');
|
||||
if (_token == null) {
|
||||
|
||||
@ -384,11 +384,11 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
onPressed: () {
|
||||
SideDrawerPanel.show(
|
||||
context: context,
|
||||
title: 'Proposal Creation',
|
||||
title: 'Quote Creation',
|
||||
child: CreateProposal_Quick(),
|
||||
);
|
||||
},
|
||||
tooltip: 'Create Proposal',
|
||||
tooltip: 'Quick Quote',
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
@ -135,7 +135,12 @@ class MainLayoutState extends ConsumerState<MainLayout> {
|
||||
// debugPrint("Notifications tapped");
|
||||
// },
|
||||
// ),
|
||||
appBar: AppHeader(),
|
||||
// appBar: AppHeader(),
|
||||
appBar: PreferredSize(
|
||||
preferredSize: AppHeader().preferredSize,
|
||||
child: ExcludeFocus(child: AppHeader()),
|
||||
),
|
||||
|
||||
body: Row(
|
||||
children: [
|
||||
// AnimatedContainer(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4696
lib/presentation/screens/staff/Enquiry/enquiry_inline_dec1.dart
Normal file
4696
lib/presentation/screens/staff/Enquiry/enquiry_inline_dec1.dart
Normal file
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:nhance_partner/presentation/screens/dashboard/dashboard.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';
|
||||
import 'package:nhance_partner/presentation/screens/staff/Enquiry/tabs/tab.dart';
|
||||
import 'package:nhance_partner/presentation/themes/indicators/customizd_multi_file_upload.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@ -134,6 +135,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
|
||||
String? selectedId;
|
||||
|
||||
int selectedIndex = 0;
|
||||
|
||||
final List<String> enquiryTabs = ["In Progress", "Completed"];
|
||||
|
||||
Map<String, dynamic> dataDetails() {
|
||||
final data = {
|
||||
"agent_id":
|
||||
@ -211,7 +216,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
super.initState();
|
||||
|
||||
apiService = ApiService();
|
||||
timer = Timer.periodic(Duration(seconds: 3), (Timer t) => callRefresh());
|
||||
timer = Timer.periodic(Duration(seconds: 10), (Timer t) => callRefresh());
|
||||
for (String field in tabHeader) {
|
||||
controllers[field] = TextEditingController();
|
||||
}
|
||||
@ -2420,77 +2425,77 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
buildPhNumber(context),
|
||||
buildRemarks(context),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Builder(
|
||||
builder: (buttonContext) => Material(
|
||||
// color: Color(0xFFFFFCF2),
|
||||
color: Color(0xFFF8F9FF),
|
||||
child: InkWell(
|
||||
hoverColor: Color(0xFFF8F9FF),
|
||||
// hoverColor: const Color(0xFFFFFCF2),
|
||||
// hoverColor: const Color(0xFFEAF6F4),
|
||||
onTap: () async {
|
||||
// ✅ Get overlay and button position RELATIVE to InkWell
|
||||
final RenderBox button =
|
||||
buttonContext.findRenderObject() as RenderBox;
|
||||
final RenderBox overlay =
|
||||
Overlay.of(buttonContext).context.findRenderObject()
|
||||
as RenderBox;
|
||||
|
||||
final Offset position = button.localToGlobal(
|
||||
Offset.zero,
|
||||
ancestor: overlay,
|
||||
);
|
||||
|
||||
await showMenu(
|
||||
context: buttonContext,
|
||||
position: RelativeRect.fromLTRB(
|
||||
position.dx,
|
||||
position.dy + button.size.height,
|
||||
overlay.size.width,
|
||||
0,
|
||||
),
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _buildPopupDownload(
|
||||
buttonContext,
|
||||
selectId,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
// color: Colors.white,
|
||||
// color: Color(0xFFFFFCF2),
|
||||
color: Color(0xFFF8F9FF),
|
||||
);
|
||||
},
|
||||
child: Tooltip(
|
||||
message: 'Click To Upload Documents',
|
||||
|
||||
waitDuration: const Duration(milliseconds: 500),
|
||||
showDuration: const Duration(seconds: 2),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.upload_file,
|
||||
color: Color(0XFF6366F1),
|
||||
// editing ? Icons.upload_file : Icons.download_for_offline,
|
||||
// color: editing ? Colors.b lue : Colors.green,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 8.0),
|
||||
// child: Builder(
|
||||
// builder: (buttonContext) => Material(
|
||||
// // color: Color(0xFFFFFCF2),
|
||||
// color: Color(0xFFF8F9FF),
|
||||
// child: InkWell(
|
||||
// hoverColor: Color(0xFFF8F9FF),
|
||||
// // hoverColor: const Color(0xFFFFFCF2),
|
||||
// // hoverColor: const Color(0xFFEAF6F4),
|
||||
// onTap: () async {
|
||||
// // ✅ Get overlay and button position RELATIVE to InkWell
|
||||
// final RenderBox button =
|
||||
// buttonContext.findRenderObject() as RenderBox;
|
||||
// final RenderBox overlay =
|
||||
// Overlay.of(buttonContext).context.findRenderObject()
|
||||
// as RenderBox;
|
||||
//
|
||||
// final Offset position = button.localToGlobal(
|
||||
// Offset.zero,
|
||||
// ancestor: overlay,
|
||||
// );
|
||||
//
|
||||
// await showMenu(
|
||||
// context: buttonContext,
|
||||
// position: RelativeRect.fromLTRB(
|
||||
// position.dx,
|
||||
// position.dy + button.size.height,
|
||||
// overlay.size.width,
|
||||
// 0,
|
||||
// ),
|
||||
// items: [
|
||||
// PopupMenuItem(
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: _buildPopupDownload(
|
||||
// buttonContext,
|
||||
// selectId,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// // color: Colors.white,
|
||||
// // color: Color(0xFFFFFCF2),
|
||||
// color: Color(0xFFF8F9FF),
|
||||
// );
|
||||
// },
|
||||
// child: Tooltip(
|
||||
// message: 'Click To Upload Documents',
|
||||
//
|
||||
// waitDuration: const Duration(milliseconds: 500),
|
||||
// showDuration: const Duration(seconds: 2),
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.all(8.0),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(50),
|
||||
// ),
|
||||
// child: Icon(
|
||||
// Icons.upload_file,
|
||||
// color: Color(0XFF6366F1),
|
||||
// // editing ? Icons.upload_file : Icons.download_for_offline,
|
||||
// // color: editing ? Colors.b lue : Colors.green,
|
||||
// size: 20,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: IconButton(
|
||||
@ -2863,36 +2868,40 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// ],
|
||||
// ),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.height * 0.1,
|
||||
// padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
RaiseEnqForm(
|
||||
key: raiseEnqKey,
|
||||
onSubmit: (dataSet) async {
|
||||
print('Check checking dataSet $dataSet');
|
||||
try {
|
||||
await createUserData(dataSet); // <-- API call here
|
||||
print("Enquiry saved successfully");
|
||||
// RESET FORM
|
||||
raiseEnqKey.currentState?.resetFormFields();
|
||||
} catch (e) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
Container(
|
||||
// height: MediaQuery.of(context).size.height*0.
|
||||
child: RaiseEnqForm(
|
||||
key: raiseEnqKey,
|
||||
onSubmit: (dataSet) async {
|
||||
print('Check checking dataSet $dataSet');
|
||||
try {
|
||||
await createUserData(dataSet); // <-- API call here
|
||||
print("Enquiry saved successfully");
|
||||
// RESET FORM
|
||||
raiseEnqKey.currentState?.resetFormFields();
|
||||
} catch (e) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// SizedBox(height: 5),
|
||||
@ -2920,29 +2929,29 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
),
|
||||
|
||||
// ),
|
||||
Container(
|
||||
// height: 20,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
// color: Colors.green.shade50,
|
||||
child: PaginationControls(
|
||||
currentPage: currentPage,
|
||||
itemsPerPage: itemsPerPage,
|
||||
// totalItems: dataVal.length,
|
||||
totalItems: filteredData.length,
|
||||
// activeColor: layoutColor, // your theme color
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
currentPage = page;
|
||||
});
|
||||
},
|
||||
onItemsPerPageChanged: (items) {
|
||||
setState(() {
|
||||
itemsPerPage = items;
|
||||
currentPage = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// // height: 20,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// // color: Colors.green.shade50,
|
||||
// child: PaginationControls(
|
||||
// currentPage: currentPage,
|
||||
// itemsPerPage: itemsPerPage,
|
||||
// // totalItems: dataVal.length,
|
||||
// totalItems: filteredData.length,
|
||||
// // activeColor: layoutColor, // your theme color
|
||||
// onPageChanged: (page) {
|
||||
// setState(() {
|
||||
// currentPage = page;
|
||||
// });
|
||||
// },
|
||||
// onItemsPerPageChanged: (items) {
|
||||
// setState(() {
|
||||
// itemsPerPage = items;
|
||||
// currentPage = 1;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -2971,6 +2980,37 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
refrshfilterDateRange();
|
||||
}
|
||||
|
||||
Future<void> buildPolicyCreatedStatusActions(
|
||||
BuildContext context,
|
||||
status,
|
||||
id,
|
||||
) async {
|
||||
print("Actionsstatus - $status -$id");
|
||||
dynamic val;
|
||||
if (status == 'Awaiting Proposal' || status == 'Proposal Created') {
|
||||
val = '';
|
||||
} else {
|
||||
val = 'Policy';
|
||||
}
|
||||
|
||||
final result = await showDialog(
|
||||
context: context,
|
||||
barrierDismissible:
|
||||
false, // optional - prevents closing by tapping outside
|
||||
builder: (context) => PolicyStaffEnqList(),
|
||||
);
|
||||
|
||||
// ✅ Code here runs *after* the dialog is closed
|
||||
print("Dialog closed");
|
||||
print("Dialog result: $result");
|
||||
if (result) {
|
||||
setState(() {
|
||||
isActionable = false;
|
||||
});
|
||||
refrshfilterDateRange();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context) {
|
||||
final isDesktop = !ResponsiveLayout.isMobile(context);
|
||||
return Column(
|
||||
@ -3076,8 +3116,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 5),
|
||||
|
||||
// SizedBox(height: 5),
|
||||
SizedBox(child: _buildStyledTabs()),
|
||||
ResponsiveLayout.isMobile(context)
|
||||
? _buildDataTable(context)
|
||||
:
|
||||
@ -3095,59 +3135,135 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
|
||||
// 1. Add group expansion state tracking
|
||||
Map<String, bool> groupExpanded = {
|
||||
'Awaiting Proposal': true,
|
||||
'Proposal Created': true,
|
||||
// 'Awaiting Proposal': true,
|
||||
// 'Proposal Created': true,
|
||||
// 'Proposal Accepted': true,
|
||||
// 'Proposal Rejected': true,
|
||||
'Policy Created': true,
|
||||
// 'Awaiting Payment': true,
|
||||
// 'Policy Created': true,
|
||||
'To be assigned': true,
|
||||
'Assigned': true,
|
||||
'In progress': true,
|
||||
};
|
||||
|
||||
Map<String, String> statusGroupMap = {
|
||||
'Awaiting Proposal': 'Awaiting Proposal',
|
||||
'Proposal Created': 'Proposal Created',
|
||||
'Proposal Accepted': 'Proposal Created',
|
||||
'Proposal Rejected': 'Proposal Created',
|
||||
'Policy Created': 'Policy Created',
|
||||
// 'Awaiting Proposal': 'Awaiting Proposal',
|
||||
// 'Proposal Created': 'Proposal Created',
|
||||
// 'Proposal Accepted': 'Proposal Created',
|
||||
// 'Proposal Rejected': 'Proposal Created',
|
||||
// 'Proposal Created': 'Awaiting Payment',
|
||||
// 'Proposal Accepted': 'Awaiting Payment',
|
||||
// 'Proposal Rejected': 'Awaiting Payment',
|
||||
// 'Policy Created': 'Policy Created',
|
||||
// 'Policy Created': 'Policy Created',
|
||||
'To be assigned': 'To be assigned',
|
||||
'Assigned': 'Assigned',
|
||||
'In progress': 'In progress',
|
||||
};
|
||||
|
||||
List<Map<String, dynamic>> get filteredDataByTab {
|
||||
if (selectedIndex == 0) {
|
||||
// Progress enquiries
|
||||
final sortedData = [...filteredData]
|
||||
..sort((a, b) => int.parse(b['id']) - int.parse(a['id']));
|
||||
|
||||
if (sortedData.isEmpty) return [];
|
||||
return sortedData.where((e) {
|
||||
return [
|
||||
"To be assigned",
|
||||
"Assigned",
|
||||
"In progress",
|
||||
].contains(e['enquiry_status']);
|
||||
}).toList();
|
||||
} else {
|
||||
final sortedData = [...filteredData]
|
||||
..sort((a, b) => int.parse(b['id']) - int.parse(a['id']));
|
||||
|
||||
if (sortedData.isEmpty) return [];
|
||||
// Completed enquiries
|
||||
return sortedData.where((e) {
|
||||
return e['enquiry_status'] == "Completed";
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
|
||||
// Add group enquiries by status
|
||||
Map<String, List<Map<String, dynamic>>> get _groupedEnquiries {
|
||||
final grouped = <String, List<Map<String, dynamic>>>{};
|
||||
final Map<String, List<Map<String, dynamic>>> grouped = {};
|
||||
|
||||
// Initialize all status groups
|
||||
grouped['Awaiting Proposal'] = [];
|
||||
grouped['Proposal Created'] = [];
|
||||
grouped['Proposal Accepted'] = [];
|
||||
grouped['Proposal Rejected'] = [];
|
||||
grouped['Policy Created'] = [];
|
||||
if (selectedIndex == 0) {
|
||||
grouped["To be assigned"] = [];
|
||||
grouped["Assigned"] = [];
|
||||
grouped["In progress"] = [];
|
||||
} else {
|
||||
grouped["Completed"] = [];
|
||||
}
|
||||
|
||||
// Initialize only the groups you need
|
||||
grouped['Awaiting Proposal'] = [];
|
||||
grouped['Proposal Created'] = [];
|
||||
grouped['Policy Created'] = [];
|
||||
|
||||
// Group the filtered/paginated data by status
|
||||
// for (var item in _paginatedData) {
|
||||
// final status = item['status']?.toString() ?? 'Unknown';
|
||||
// if (grouped.containsKey(status)) {
|
||||
// grouped[status]!.add(item);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (var item in _paginatedData) {
|
||||
final status = item['status']?.toString() ?? 'Unknown';
|
||||
|
||||
// Map actual status to grouped status
|
||||
final groupKey = statusGroupMap[status];
|
||||
|
||||
if (groupKey != null) {
|
||||
grouped[groupKey]!.add(item);
|
||||
for (var item in filteredDataByTab) {
|
||||
final status = (item['enquiry_status'] ?? '').toString();
|
||||
if (grouped.containsKey(status)) {
|
||||
grouped[status]!.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return grouped;
|
||||
}
|
||||
|
||||
// Map<String, List<Map<String, dynamic>>> get _groupedEnquiries {
|
||||
// final grouped = <String, List<Map<String, dynamic>>>{};
|
||||
//
|
||||
// // Initialize all status groups
|
||||
// // grouped['Awaiting Proposal'] = [];
|
||||
// // grouped['Proposal Created'] = [];
|
||||
// // grouped['Proposal Accepted'] = [];
|
||||
// // grouped['Proposal Rejected'] = [];
|
||||
// // grouped['Policy Created'] = [];
|
||||
// // grouped['Awaiting Payment'] = [];
|
||||
//
|
||||
// // Initialize only the groups you need
|
||||
// // grouped['Awaiting Proposal'] = [];
|
||||
// // grouped['Proposal Created'] = [];
|
||||
// // grouped['Policy Created'] = [];
|
||||
//
|
||||
// grouped['To be assigned'] = [];
|
||||
// grouped['Assigned'] = [];
|
||||
// grouped['In progress'] = [];
|
||||
//
|
||||
// // Group the filtered/paginated data by status
|
||||
// // for (var item in _paginatedData) {
|
||||
// // final status = item['status']?.toString() ?? 'Unknown';
|
||||
// // if (grouped.containsKey(status)) {
|
||||
// // grouped[status]!.add(item);
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// for (var item in filteredData) {
|
||||
// // final status = item['status']?.toString() ?? 'Unknown';
|
||||
// final status = item['enquiry_status']?.toString() ?? 'Unknown';
|
||||
//
|
||||
// // Map actual status to grouped status
|
||||
// final groupKey = statusGroupMap[status];
|
||||
//
|
||||
// if (groupKey != null) {
|
||||
// grouped[groupKey]!.add(item);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // for (var item in _paginatedData) {
|
||||
// // // final status = item['status']?.toString() ?? 'Unknown';
|
||||
// // final status = item['enquiry_status']?.toString() ?? 'Unknown';
|
||||
// //
|
||||
// // // Map actual status to grouped status
|
||||
// // final groupKey = statusGroupMap[status];
|
||||
// //
|
||||
// // if (groupKey != null) {
|
||||
// // grouped[groupKey]!.add(item);
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// return grouped;
|
||||
// }
|
||||
|
||||
Map<String, dynamic> _getStatusConfig(String status) {
|
||||
switch (status) {
|
||||
case 'Awaiting Proposal':
|
||||
@ -3170,7 +3286,12 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
'Proposal Created': const Color(0xFFF0F9FF), // Cyan 50
|
||||
'Proposal Accepted': const Color(0xFFF0FDF4), // Green 50
|
||||
'Proposal Rejected': const Color(0xFFFEF9C3), // Yellow 50
|
||||
'Policy Created': const Color(0xFFF3F0FF), // Purple 50 (generated)
|
||||
'Policy Created': const Color(0xFFF3F0FF),
|
||||
|
||||
'To be assigned': const Color(0xFFEFF6FF), // Blue 50
|
||||
'Assigned': const Color(0xFFFEF9C3), // Cyan 50
|
||||
'In progress': const Color(0xFFF0FDF4), // Green 50
|
||||
'Completed': const Color(0xFFF3F0FF), // Purple 50 (generated)
|
||||
};
|
||||
|
||||
final Map<String, Color> statusBorderColors = {
|
||||
@ -3179,6 +3300,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
'Proposal Accepted': const Color(0xFFDCFCE7), // Green 100
|
||||
'Proposal Rejected': const Color(0xFFFEF3C7), // Yellow 100
|
||||
'Policy Created': const Color(0xFFF0E4FF), // Purple 200
|
||||
|
||||
'To be assigned': const Color(0xFFDBEAFE), // Blue 100
|
||||
'Assigned': const Color(0xFFFEF3C7), // Cyan 100
|
||||
'In progress': const Color(0xFFDCFCE7), // Green 100
|
||||
'Completed': const Color(0xFFF0E4FF), // Purple 200
|
||||
// 'Policy Created': const Color(0xFFE5CCFF), // Purple 200
|
||||
};
|
||||
|
||||
@ -3202,7 +3328,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
@ -3348,6 +3474,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Group Header
|
||||
// if (status != 'Proposal Accepted' &&
|
||||
// status != 'Proposal Rejected') ...[
|
||||
if (status != 'Proposal Accepted' &&
|
||||
status != 'Proposal Rejected') ...[
|
||||
Container(
|
||||
@ -3487,7 +3615,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
final editing = isEditingRow[id] ?? false;
|
||||
final controllers = rowControllers[id];
|
||||
|
||||
String status = item['status'] ?? '-';
|
||||
// String status = item['status'] ?? '-';
|
||||
String status = item['enquiry_status'] ?? '-';
|
||||
|
||||
Color bgColor = statusColors[status] ?? Color(0xFFF9FAFB);
|
||||
Color borderColor = statusBorderColors[status] ?? Color(0xFFE2E8F0);
|
||||
@ -3774,6 +3903,91 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
),
|
||||
),
|
||||
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 120,
|
||||
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (item['enquiry_status'] != 'Assigned') ...[
|
||||
Material(
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
// hoverColor: Color(0xFFEAF6F4),
|
||||
onTap: null,
|
||||
// onTap: () async {
|
||||
// setState(() {
|
||||
// isActionable = true;
|
||||
// });
|
||||
// buildPolicyCreatedStatusActions(
|
||||
// context,
|
||||
// item['status'],
|
||||
// item['id'],
|
||||
// );
|
||||
// },
|
||||
child: Tooltip(
|
||||
message: 'Click to View or Process Enquiry', //
|
||||
waitDuration: const Duration(
|
||||
milliseconds: 500,
|
||||
), // optional
|
||||
showDuration: const Duration(seconds: 2), // optional
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
// color: Color(0xFFF9FAFB),
|
||||
// border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
color: bgColor,
|
||||
border: Border.all(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
item['enquiry_status'] ?? '-',
|
||||
// item['status'] ?? '-',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
color: Color(0XFF1e293b),
|
||||
// color: statusTextColors[status] ?? Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
// overflow: TextOverflow.clip, //
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// child: Text(item['status'] ?? '-', style: _dataBold),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (item['enquiry_status'] == 'Assigned') ...[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
final res = await apiService.updateEnquiryInProgress(id);
|
||||
if (res['status'] == 'success') {
|
||||
refrshfilterDateRange();
|
||||
}
|
||||
print('updateEnquiryInProgress - $res');
|
||||
},
|
||||
child: Text(
|
||||
'PROCEED',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Assigned Date (formatted)
|
||||
// DataCell(
|
||||
// SizedBox(
|
||||
@ -4285,65 +4499,65 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
),
|
||||
),
|
||||
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 120,
|
||||
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
// hoverColor: Color(0xFFEAF6F4),
|
||||
onTap: () async {
|
||||
var status = item['status'];
|
||||
var enqId = item['id'];
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
// ✅ Remove old value (if any)
|
||||
await prefs.remove('enqStaffDataId');
|
||||
|
||||
// ✅ Save the new id
|
||||
await prefs.setString('enqStaffDataId', enqId.toString());
|
||||
ref.read(quotationStaffIdProvider.notifier).state = enqId;
|
||||
buildStatusActions(context, status, enqId);
|
||||
},
|
||||
child: Tooltip(
|
||||
message: 'Click to View or Process Enquiry', //
|
||||
waitDuration: const Duration(milliseconds: 500), // optional
|
||||
showDuration: const Duration(seconds: 2), // optional
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
// color: Color(0xFFF9FAFB),
|
||||
// border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
color: bgColor,
|
||||
border: Border.all(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
item['status'] ?? '-',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
color: Color(0XFF1e293b),
|
||||
// color: statusTextColors[status] ?? Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
// overflow: TextOverflow.clip, //
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// child: Text(item['status'] ?? '-', style: _dataBold),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// DataCell(
|
||||
// SizedBox(
|
||||
// width: 120,
|
||||
//
|
||||
// child: Material(
|
||||
// color: Colors.white,
|
||||
// child: InkWell(
|
||||
// // hoverColor: Color(0xFFEAF6F4),
|
||||
// onTap: () async {
|
||||
// var status = item['status'];
|
||||
// var enqId = item['id'];
|
||||
//
|
||||
// final prefs = await SharedPreferences.getInstance();
|
||||
//
|
||||
// // ✅ Remove old value (if any)
|
||||
// await prefs.remove('enqStaffDataId');
|
||||
//
|
||||
// // ✅ Save the new id
|
||||
// await prefs.setString('enqStaffDataId', enqId.toString());
|
||||
// ref.read(quotationStaffIdProvider.notifier).state = enqId;
|
||||
// buildStatusActions(context, status, enqId);
|
||||
// },
|
||||
// child: Tooltip(
|
||||
// message: 'Click to View or Process Enquiry', //
|
||||
// waitDuration: const Duration(milliseconds: 500), // optional
|
||||
// showDuration: const Duration(seconds: 2), // optional
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.symmetric(vertical: 2.0),
|
||||
// margin: EdgeInsets.symmetric(vertical: 2),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Color(0xFFF9FAFB),
|
||||
// // border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
// color: bgColor,
|
||||
// border: Border.all(color: borderColor),
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// ),
|
||||
//
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// item['status'] ?? '-',
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 10,
|
||||
// color: Color(0XFF1e293b),
|
||||
// // color: statusTextColors[status] ?? Colors.black,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// // overflow: TextOverflow.clip, //
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// // child: Text(item['status'] ?? '-', style: _dataBold),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -4360,12 +4574,12 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
DataColumn(label: Text('Insured Name *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Vehicle No *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Action', style: _headerStyle)),
|
||||
DataColumn(label: Text('Status', style: _headerStyle)),
|
||||
// const DataColumn(label: Text('Assigned Date', style: _headerStyle)),
|
||||
// DataColumn(label: Text('Premium', style: _headerStyle)),
|
||||
DataColumn(label: Text('Payment Mode', style: _headerStyle)),
|
||||
DataColumn(label: Text('Plan Type', style: _headerStyle)),
|
||||
DataColumn(label: Text('Policy Number', style: _headerStyle)),
|
||||
DataColumn(label: Text('Status', style: _headerStyle)),
|
||||
DataColumn(label: Text('Policy', style: _headerStyle)),
|
||||
];
|
||||
}
|
||||
|
||||
@ -4383,14 +4597,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
_buildHeaderCell('Insurer *', 90),
|
||||
_buildHeaderCell('Insured Name *', 110),
|
||||
_buildHeaderCell('Vehicle No *', 90),
|
||||
_buildHeaderCell('Action', 80),
|
||||
_buildHeaderCell('Action', 110),
|
||||
_buildHeaderCell('Status', 100),
|
||||
// _buildHeaderCell('Assigned Date', 100),
|
||||
// _buildHeaderCell('Premium', 100),
|
||||
_buildHeaderCell('Payment Mode', 130),
|
||||
_buildHeaderCell('Plan Type', 130),
|
||||
|
||||
_buildHeaderCell('Policy Number', 120),
|
||||
_buildHeaderCell('Status', 100),
|
||||
_buildHeaderCell('Policy', 120),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -4452,6 +4666,76 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStyledTabs() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
// color: Colors.amber,
|
||||
// border: Border(bottom: BorderSide(color: Color(0xFFE5E5E5), width: 1)),
|
||||
),
|
||||
child: Row(
|
||||
children: List.generate(enquiryTabs.length, (index) {
|
||||
final bool isSelected = selectedIndex == index;
|
||||
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedIndex = index;
|
||||
});
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
curve: Curves.easeOut,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 20,
|
||||
),
|
||||
margin: const EdgeInsets.only(right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: isSelected
|
||||
? const Color(0xFF2E7D6E).withOpacity(0.08)
|
||||
: Colors.transparent,
|
||||
),
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
enquiryTabs[index],
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? const Color(0xFF2E7D6E)
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
|
||||
// const SizedBox(height: 3),
|
||||
|
||||
// ▬▬ Underline Indicator ▬▬
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
height: 3,
|
||||
width: isSelected ? 40 : 0,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2E7D6E),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static final _dataBold = GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
|
||||
|
||||
@ -381,28 +381,30 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
buildAgentName(context, fromHeader: true),
|
||||
if (roleId != 'staff') ...[buildSelectStaffMem(context)],
|
||||
child: FocusTraversalGroup(
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
buildAgentName(context, fromHeader: true),
|
||||
if (roleId != 'staff') ...[buildSelectStaffMem(context)],
|
||||
|
||||
buildBroker(context),
|
||||
buildInsurer(context, fromHeader: true),
|
||||
buildBroker(context),
|
||||
buildInsurer(context, fromHeader: true),
|
||||
|
||||
// buildInsuredName(context, fromHeader: true),
|
||||
buildVehicleNumber(context),
|
||||
Row(
|
||||
children: [
|
||||
buildRefresh(context),
|
||||
SizedBox(width: 5),
|
||||
buildSave(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
// buildInsuredName(context, fromHeader: true),
|
||||
buildVehicleNumber(context),
|
||||
Row(
|
||||
children: [
|
||||
buildRefresh(context),
|
||||
SizedBox(width: 5),
|
||||
buildSave(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
3039
lib/presentation/screens/staff/Enquiry/staff_policy.dart
Normal file
3039
lib/presentation/screens/staff/Enquiry/staff_policy.dart
Normal file
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ class SideDrawerPanel extends StatelessWidget {
|
||||
children: [
|
||||
if (title != null)
|
||||
Text(
|
||||
'Proposal Creation',
|
||||
title!,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
@ -31,6 +31,8 @@ class ThemedFormInlineField extends HookWidget {
|
||||
this.onChanged,
|
||||
this.isdense,
|
||||
this.padVertical,
|
||||
this.errFieldFont,
|
||||
this.errFieldHgt,
|
||||
});
|
||||
|
||||
final String? hintText;
|
||||
@ -47,6 +49,8 @@ class ThemedFormInlineField extends HookWidget {
|
||||
final Color? highlightColor;
|
||||
final Color? textColr;
|
||||
final double? txtwidth;
|
||||
final double? errFieldFont;
|
||||
final double? errFieldHgt;
|
||||
final bool readOnly;
|
||||
final bool? isdense;
|
||||
final bool? isShowCursor;
|
||||
@ -84,7 +88,16 @@ class ThemedFormInlineField extends HookWidget {
|
||||
);
|
||||
final inputDecoration = InputDecoration(
|
||||
isDense: isdense ?? false,
|
||||
errorStyle: TextStyle(color: Color(0xFFD83731)),
|
||||
// errorStyle: const TextStyle(
|
||||
// fontSize: 9,
|
||||
//
|
||||
// // height: 0.0
|
||||
// ),
|
||||
errorStyle: TextStyle(
|
||||
color: Color(0xFFD83731),
|
||||
fontSize: errFieldFont ?? 12,
|
||||
height: errFieldHgt ?? 10,
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
borderSide: BorderSide(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user