FIX_vechiletype in Enquiry inline list

This commit is contained in:
sanjeev.p 2026-01-07 14:35:24 +05:30
parent 6c92692fa9
commit 42323ed9f7
11 changed files with 723 additions and 184 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@ class Env {
); );
static const String apiUrl = String.fromEnvironment( static const String apiUrl = String.fromEnvironment(
'API_URL', 'API_URL',
// defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* when test build uncomment this. but below line should in comment */ // defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* Live build (enable index.html line 18) */
defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* when live build uncomment . but above line should in comment */ defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* Test build (enable index.html line 19) */
); );
// static const String baseUrl = String.fromEnvironment( // static const String baseUrl = String.fromEnvironment(
// 'BASE_URL', // 'BASE_URL',

View File

@ -67,7 +67,7 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
void initState() { void initState() {
super.initState(); super.initState();
apiService = ApiService(); apiService = ApiService();
print("PolicyTab - Called");
for (String field in tabHeader) { for (String field in tabHeader) {
controllers[field] = TextEditingController(); controllers[field] = TextEditingController();
} }
@ -509,7 +509,10 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
Widget buildMoreInfoSetClaims(BuildContext context) { Widget buildMoreInfoSetClaims(BuildContext context) {
if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) { if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) {
return const Center(child: CircularProgressIndicator()); // or placeholder // return const Center(child: CircularProgressIndicator()); // or placeholder
return const Center(
child: Text( 'No records available', textAlign: TextAlign.center,),
);
} }
return Container( return Container(
padding: ResponsiveLayout.isMobile(context) ? null : EdgeInsets.all(6.0), padding: ResponsiveLayout.isMobile(context) ? null : EdgeInsets.all(6.0),
@ -538,7 +541,10 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
Widget buildMoreInfoSetEndrosment(BuildContext context) { Widget buildMoreInfoSetEndrosment(BuildContext context) {
if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) { if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) {
return const Center(child: CircularProgressIndicator()); // or placeholder // return const Center(child: CircularProgressIndicator()); // or placeholder
return const Center(
child: Text( 'No records available', textAlign: TextAlign.center,),
);
} }
return Container( return Container(
// padding: EdgeInsets.all(8.0), // padding: EdgeInsets.all(8.0),

View File

@ -1945,14 +1945,36 @@ class Performance extends StatelessWidget {
// style: _tableDataStyle, // style: _tableDataStyle,
// ), // ),
// ), // ),
// Expanded(
// child: Text(
// row['agent_name'] ?? "",
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
Expanded( Expanded(
child: Text( child: Column(
row['agent_name'] ?? "", mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, crossAxisAlignment: CrossAxisAlignment.start, // align right
style: _tableDataStyle, children: [
// Top: Agent Name
Text(
row['agent_name'] ?? "",
textAlign: TextAlign.left,
style: _tableDataStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
// Bottom: Agent Code (light weight)
Text(
row['agent_code'] ?? "",
textAlign: TextAlign.left,
style: _tableDataTimeStyle,
),
],
), ),
), ),
Expanded( Expanded(
child: Text( child: Text(
row['total_policy_issued'] ?? "", row['total_policy_issued'] ?? "",
@ -2162,11 +2184,34 @@ class UnassignedEnq extends StatelessWidget {
], ],
), ),
), ),
// Expanded(
// child: Text(
// row['agent_name'] ?? '', // convert int to string
// // textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
Expanded( Expanded(
child: Text( child: Column(
row['agent_name'] ?? '', // convert int to string mainAxisAlignment: MainAxisAlignment.center,
// textAlign: TextAlign.center, crossAxisAlignment: CrossAxisAlignment.start, // align right
style: _tableDataStyle, children: [
// Top: Agent Name
Text(
row['agent_name'] ?? "",
textAlign: TextAlign.left,
style: _tableDataStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
// Bottom: Agent Code (light weight)
Text(
row['agent_code'] ?? "",
textAlign: TextAlign.left,
style: _tableDataTimeStyle,
),
],
), ),
), ),
Expanded( Expanded(

View File

@ -130,31 +130,31 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
} }
} }
Future<void> getExportExcel2(String status, String staffId) async { // Future<void> getExportExcel2(String status, String staffId) async {
final prefmanagerid = ref.read(managerIdProvider); // final prefmanagerid = ref.read(managerIdProvider);
//
// Use the parameters passed from the widget // // Use the parameters passed from the widget
final path = "staff_pending_summary_by_id"; // final path = "staff_pending_summary_by_id";
final id = staffId; // final id = staffId;
final month = status; // final month = status;
//
try { // try {
setState(() => isLoading = true); // setState(() => isLoading = true);
//
final response = await apiService.generateChartExcel( // final response = await apiService.generateChartExcel(
path, // path,
id, // id,
month, // month,
prefmanagerid // prefmanagerid
); // );
//
return response; // return response;
} catch (e) { // } catch (e) {
print('Export Error: $e'); // print('Export Error: $e');
} finally { // } finally {
if (mounted) setState(() => isLoading = false); // if (mounted) setState(() => isLoading = false);
} // }
} // }
Future<void> handleEdit(String id) async { Future<void> handleEdit(String id) async {
// Navigator.pop(context); // Navigator.pop(context);
@ -608,7 +608,7 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
role: role!, role: role!,
onRefresh: refresh, onRefresh: refresh,
onExportExcel: getExportExcel, onExportExcel: getExportExcel,
onCallExport: getExportExcel2, // onCallExport: getExportExcel2,
), ),
), ),
// if (role == 'handler') ...[ // if (role == 'handler') ...[
@ -1212,7 +1212,7 @@ class othersPendings extends StatelessWidget {
final List<Map<String, dynamic>> data; final List<Map<String, dynamic>> data;
final VoidCallback? onRefresh; final VoidCallback? onRefresh;
VoidCallback? onExportExcel; VoidCallback? onExportExcel;
final Future<void> Function(String status, String staffId)? onCallExport; // final Future<void> Function(String status, String staffId)? onCallExport;
othersPendings({ othersPendings({
Key? key, Key? key,
@ -1222,7 +1222,7 @@ class othersPendings extends StatelessWidget {
required this.stringFlag, required this.stringFlag,
required this.onRefresh, required this.onRefresh,
this.onExportExcel, this.onExportExcel,
this.onCallExport, // this.onCallExport,
}) : super(key: key); }) : super(key: key);
@override @override
@ -1499,12 +1499,12 @@ class othersPendings extends StatelessWidget {
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
if (onCallExport != null) { // if (onCallExport != null) {
await onCallExport!( // await onCallExport!(
"TodayAssigned", // "TodayAssigned",
row['staff_id'].toString(), // row['staff_id'].toString(),
); // );
} // }
}, },
child: Text( child: Text(
row['today_assigned'] ?? "", row['today_assigned'] ?? "",
@ -1534,12 +1534,12 @@ class othersPendings extends StatelessWidget {
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
if (onCallExport != null) { // if (onCallExport != null) {
await onCallExport!( // await onCallExport!(
"Assigned", // "Assigned",
row['staff_id'].toString(), // row['staff_id'].toString(),
); // );
} // }
}, },
child: Text( child: Text(
row['today_pending'] ?? "", row['today_pending'] ?? "",
@ -1569,12 +1569,12 @@ class othersPendings extends StatelessWidget {
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
if (onCallExport != null) { // if (onCallExport != null) {
await onCallExport!( // await onCallExport!(
'InProgress', // 'InProgress',
row['staff_id'].toString(), // row['staff_id'].toString(),
); // );
} // }
}, },
@ -1605,12 +1605,12 @@ class othersPendings extends StatelessWidget {
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
if (onCallExport != null) { // if (onCallExport != null) {
await onCallExport!( // await onCallExport!(
'Completed', // 'Completed',
row['staff_id'].toString(), // row['staff_id'].toString(),
); // );
} // }
}, },
child: Text( child: Text(
row['today_completed'] ?? "", row['today_completed'] ?? "",
@ -1642,13 +1642,12 @@ class othersPendings extends StatelessWidget {
// 2. Call the Export function // 2. Call the Export function
// We use await here so the 'isLoading' state is respected // We use await here so the 'isLoading' state is respected
// and errors are caught properly. // and errors are caught properly.
// if (onCallExport != null) {
if (onCallExport != null) { // await onCallExport!(
await onCallExport!( // 'PrevPending',
'PrevPending', // row['staff_id'].toString(),
row['staff_id'].toString(), // );
); // }
}
}, },
child: Text( child: Text(
safePending.toString() ?? "", safePending.toString() ?? "",
@ -2012,14 +2011,39 @@ class Performance extends StatelessWidget {
// style: _tableDataStyle, // style: _tableDataStyle,
// ), // ),
// ), // ),
// Expanded(
// child: Text(
// row['agent_name'] ?? "",
// textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
Expanded( Expanded(
child: Text( child: Column(
row['agent_name'] ?? "", mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, crossAxisAlignment: CrossAxisAlignment.center,
style: _tableDataStyle, children: [
// Top: Agent Name
Text(
row['agent_name'] ?? "",
textAlign: TextAlign.center,
style: _tableDataStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
// Bottom: Agent Code (light weight)
Text(
row['agent_code'] ?? "",
textAlign: TextAlign.center,
style: _tableDataTimeStyle.copyWith(
fontWeight: FontWeight.w300, // lighter
fontSize: 12,
),
),
],
), ),
), ),
Expanded( Expanded(
child: Text( child: Text(
row['total_policy_issued'] ?? "", row['total_policy_issued'] ?? "",
@ -2229,13 +2253,37 @@ class UnassignedEnq extends StatelessWidget {
], ],
), ),
), ),
// Expanded(
// child: Text(
// row['agent_name'] ?? '', // convert int to string
// // textAlign: TextAlign.center,
// style: _tableDataStyle,
// ),
// ),
Expanded( Expanded(
child: Text( child: Column(
row['agent_name'] ?? '', // convert int to string mainAxisAlignment: MainAxisAlignment.center,
// textAlign: TextAlign.center, crossAxisAlignment: CrossAxisAlignment.start, // align right
style: _tableDataStyle, children: [
// Top: Agent Name
Text(
row['agent_name'] ?? "",
textAlign: TextAlign.left,
style: _tableDataStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
// Bottom: Agent Code (light weight)
Text(
row['agent_code'] ?? "",
textAlign: TextAlign.left,
style: _tableDataTimeStyle,
),
],
), ),
), ),
Expanded( Expanded(
child: Text( child: Text(
row['reg_no'] ?? "", row['reg_no'] ?? "",

View File

@ -1024,9 +1024,7 @@ class CreateProposal_QuickFormState
columnSpacing: 10, columnSpacing: 10,
columns: [ columns: [
DataColumn(label: Text("Partner", style: _tableHeaderStyle)), DataColumn(label: Text("Partner", style: _tableHeaderStyle)),
DataColumn( DataColumn(label: Text("Vehicle Number", style: _tableHeaderStyle)),
label: Text("Vehicle Number", style: _tableHeaderStyle),
),
DataColumn(label: Text("Insurer", style: _tableHeaderStyle)), DataColumn(label: Text("Insurer", style: _tableHeaderStyle)),
DataColumn(label: Text("Plan Type", style: _tableHeaderStyle)), DataColumn(label: Text("Plan Type", style: _tableHeaderStyle)),
DataColumn(label: Text("Premium", style: _tableHeaderStyle)), DataColumn(label: Text("Premium", style: _tableHeaderStyle)),
@ -1040,10 +1038,35 @@ class CreateProposal_QuickFormState
return [ return [
DataRow( DataRow(
cells: [ cells: [
// DataCell(
// Text(
// item["agent_name"] ?? "-",
// style: _tableDataStyle,
// ),
// ),
DataCell( DataCell(
Text( Column(
item["agent_name"] ?? "-", mainAxisAlignment: MainAxisAlignment.center,
style: _tableDataStyle, crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Top: Agent Name
Text(
item['agent_name'] ?? '-',
style: _tableDataStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
// Bottom: Agent Code (light weight)
if (item['agent_code'] != null)
Text(
item['agent_code'],
style: _tableDataStyle.copyWith(
fontSize: 11,
fontWeight: FontWeight.w300,
),
),
],
), ),
), ),
DataCell( DataCell(

View File

@ -33,11 +33,13 @@ class SubRowWidget extends ConsumerStatefulWidget {
final String? selectedAgent; final String? selectedAgent;
final String? selectedInsurer; final String? selectedInsurer;
final String? selectedBroker; final String? selectedBroker;
// final String? selectedVehicleType;
final Function(String?)? onStaffChanged; final Function(String?)? onStaffChanged;
final Function(String?)? onAgentChanged; final Function(String?)? onAgentChanged;
final Function(String?)? onInsurerChanged; final Function(String?)? onInsurerChanged;
final Function(String?)? onBrokerChanged; final Function(String?)? onBrokerChanged;
// final Function(String?)? onVehicleTypeChanged;
const SubRowWidget({ const SubRowWidget({
super.key, super.key,
@ -52,10 +54,12 @@ class SubRowWidget extends ConsumerStatefulWidget {
required this.selectedAgent, required this.selectedAgent,
required this.selectedInsurer, required this.selectedInsurer,
required this.selectedBroker, required this.selectedBroker,
// required this.selectedVehicleType,
this.onStaffChanged, this.onStaffChanged,
this.onAgentChanged, this.onAgentChanged,
this.onInsurerChanged, this.onInsurerChanged,
this.onBrokerChanged, this.onBrokerChanged,
// this.onVehicleTypeChanged,
}); });
@override @override
@ -106,6 +110,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
List<Map<String, dynamic>> getVehicleTypeData = []; List<Map<String, dynamic>> getVehicleTypeData = [];
List<Map<String, dynamic>> filteredVechicleData = []; List<Map<String, dynamic>> filteredVechicleData = [];
// List<Map<String, dynamic>> filteredVehicleData = [];
List<Map<String, dynamic>> getAgentListData = []; List<Map<String, dynamic>> getAgentListData = [];
List<Map<String, dynamic>> filteredAgentData = []; List<Map<String, dynamic>> filteredAgentData = [];
@ -135,6 +140,10 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
dropDownKeyInsurerEnqAsgn = dropDownKeyInsurerEnqAsgn =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
// final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
// dropDownKeyVehicleTypeEnqAsgn =
// GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker = final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
@ -205,6 +214,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
getInsurers(); getInsurers();
getBroker(); getBroker();
// getVehicleType();
} }
Future<void> loadPreferences() async { Future<void> loadPreferences() async {
@ -300,6 +310,39 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
} }
} }
// Future<void> getVehicleType() async {
// print('EIS 1getVT-called');
// setState(() {
// isLoadingVehicleType = true;
// });
//
// try {
// final response = await apiService.fetchMasterDropDown('vehicleType');
//
// if (response['status'] == 200) {
// print('EIS 2getVT-Data - ${response['data']}');
// setState(() {
// getVehicleTypeData = List<Map<String, dynamic>>.from(
// response['data'],
// );
// // print('EIL 3getVT-B4filterData : $getVehicleTypeData');
//
// filteredVehicleData = List.from(getVehicleTypeData);
// // print('EIL 3getVT-AftfilterData : $filteredVehicleData');
// });
// } else {
// getVehicleTypeData = [];
// filteredVehicleData = [];
// }
// } catch (e) {
// print('EIS 2getVT-Exception occurred: $e');
// } finally {
// setState(() {
// isLoadingVehicleType = false;
// });
// }
// }
Future<void> getBroker() async { Future<void> getBroker() async {
print('getBroker called'); print('getBroker called');
setState(() { setState(() {
@ -387,6 +430,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
buildEmail(context), buildEmail(context),
buildPhNumber(context), buildPhNumber(context),
buildRemarks(context), buildRemarks(context),
// buildVehicleType(context),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -1121,6 +1165,174 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
); );
} }
// Widget buildVehicleType(BuildContext context, {fromHeader = true}) {
// Map<String, dynamic>? selectedVehicleTyped = filteredVehicleData.firstWhere(
// (item) => item['vehicle_type_id'].toString() == widget.selectedVehicleType,
// orElse: () => {},
// );
//
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text('Vehicle Type', style: _subLabelTimeStyle),
// SizedBox(height: 5),
// Container(
// height: 30,
// width: fromHeader
// ? MediaQuery.of(context).size.width * 0.1
// : MediaQuery.of(context).size.width * 0.08,
// child: DropdownSearch<Map<String, dynamic>>(
// key: dropDownKeyVehicleTypeEnqAsgn,
// selectedItem: selectedVehicleTyped.isNotEmpty ? selectedVehicleTyped : null,
// // items: (filter, infiniteScrollProps) {
// // return filteredInsurersData;
// // },
// items: (filter, infiniteScrollProps) async {
// if (filter.isEmpty) {
// return filteredVehicleData;
// }
// return filteredVehicleData.where((item) {
// return item['vehicle_type'].toString().toLowerCase().contains(
// filter.toLowerCase(),
// );
// }).toList();
// },
//
// itemAsString: (val) => val['vehicle_type'].toString(), // what to show
// compareFn: (item, selectedItem) =>
// item['vehicle_type'].toString() == selectedItem['vehicle_type'].toString(),
//
// // validator: (val) {
// // if (val == null) {
// // return "Required"; // error message
// // }
// // return null;
// // },
// suffixProps: DropdownSuffixProps(
// // make sure the dropdown button is visible
// dropdownButtonProps: DropdownButtonProps(
// isVisible: true,
// padding: EdgeInsets.zero, // remove default padding
// constraints: const BoxConstraints(
// // shrink icon tap area
// minWidth: 12,
// minHeight: 12,
// ),
// iconSize: 15, // smaller icon
// // icon: const Icon(Icons.arrow_drop_down),
// ),
// ),
// dropdownBuilder: (context, selectedItem) => Align(
// alignment: Alignment.centerLeft,
// child: Text(
// selectedItem != null
// ? selectedItem['vehicle_type'].toString()
// : "",
// style: GoogleFonts.poppins(
// fontSize: 11,
// color: Color(0XFF6366F1),
// ),
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
// softWrap: false,
// ),
// ),
// decoratorProps: DropDownDecoratorProps(
// decoration:
// AppInputDecorations.dropdownDecoration(
// label: "Vehicle Type",
// ).copyWith(
// filled: true,
// fillColor:
// Colors.white, // 👈 makes the dropdown input white
// isDense: true,
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(5),
// borderSide: const BorderSide(
// color: Color(0XFF6366F1),
// width: 0.5,
// ),
// ),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.circular(5),
// borderSide: const BorderSide(
// color: Color(0XFF6366F1),
// width: 0.5,
// ),
// ),
// contentPadding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 6,
// ),
// ),
// ),
//
// popupProps: PopupProps.menu(
// fit: FlexFit.loose,
// constraints: BoxConstraints(maxHeight: 200),
// menuProps: MenuProps(
// backgroundColor:
// Colors.white, // 👈 sets dropdown background to white
// ),
// showSearchBox: true,
// searchFieldProps: TextFieldProps(
// style: GoogleFonts.inter(fontSize: 11, color: Colors.black),
//
// autofocus: true,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.all(1),
// filled: true,
// fillColor: Colors.white,
// hintText: "Search Vehicle Type...",
// hintStyle: GoogleFonts.inter(
// fontSize: 12,
// color: Colors.black,
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// ), // 👈 Normal border
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// width: 1.5,
// ), // 👈 Focused border
// ),
// ),
// ),
// itemBuilder: (context, item, isDisabled, isSelected) {
// return Container(
// // color: isSelected ? Colors.blue.withOpacity(0.1) : null,
// padding: const EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 3,
// ),
// child: Text(
// item['vehicle_type'].toString(),
// style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
// ),
// );
// },
// // constraints: BoxConstraints(),
// ),
//
// onChanged: (val) {
// if (val != null) {
// print("Selected vehicle_type : ${val['vehicle_type']}");
// print("Id: ${val['id']}");
// // selectedInsurer = val['id'];
// widget.onVehicleTypeChanged?.call(val['id']);
// // controllers['agentId']?.text = val['agent_code'];
// // agentId = agent['id'];
// }
// },
// ),
// ),
// ],
// );
// }
Widget buildBroker(BuildContext context) { Widget buildBroker(BuildContext context) {
Map<String, dynamic>? selectedBrokers = filteredBrokerData.firstWhere( Map<String, dynamic>? selectedBrokers = filteredBrokerData.firstWhere(
(item) => item['id'].toString() == widget.selectedBroker, (item) => item['id'].toString() == widget.selectedBroker,

View File

@ -56,9 +56,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
bool _resetKeyEnable = false; // very first bool _resetKeyEnable = false; // very first
int currentPage = 1; int currentPage = 1;
int itemsPerPage = 10; int itemsPerPage = 10;
// int itemsPerPage = 5; // int itemsPerPage = 5;
int completedCurrentPage = 1; int completedCurrentPage = 1;
// int completedItemsPerPage = 5; // int completedItemsPerPage = 5;
int completedItemsPerPage = 50; int completedItemsPerPage = 50;
int totalCompletedPages = 1; int totalCompletedPages = 1;
@ -128,7 +130,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
//---------------------- Enquiry TAB Initializations Starts -------------------------------- // //---------------------- Enquiry TAB Initializations Starts -------------------------------- //
List<Map<String, dynamic>> getVehicleTypeData = []; List<Map<String, dynamic>> getVehicleTypeData = [];
List<Map<String, dynamic>> filteredVechicleData = []; List<Map<String, dynamic>> filteredVehicleData = [];
List<Map<String, dynamic>> getAgentListData = []; List<Map<String, dynamic>> getAgentListData = [];
List<Map<String, dynamic>> filteredAgentData = []; List<Map<String, dynamic>> filteredAgentData = [];
@ -168,6 +170,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
int autoRefreshIndex = 0; int autoRefreshIndex = 0;
final List<String> enquiryTabs = ["In Progress", "Completed"]; final List<String> enquiryTabs = ["In Progress", "Completed"];
int get fullCompletedCount => completedData.length; int get fullCompletedCount => completedData.length;
Map<String, dynamic> dataDetails() { Map<String, dynamic> dataDetails() {
@ -207,6 +210,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
dropDownSelectPaymentModeKey = dropDownSelectPaymentModeKey =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
//---------------------- Assign Staff starts -------------------------------- // //---------------------- Assign Staff starts -------------------------------- //
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
@ -228,6 +232,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
String? selectedBroker; String? selectedBroker;
final ScrollController _horizontalScrollController = ScrollController(); final ScrollController _horizontalScrollController = ScrollController();
// late Timer timer; // late Timer timer;
Timer? timer; Timer? timer;
int selectedSeconds = 30; int selectedSeconds = 30;
@ -314,26 +319,29 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
if (next == true) { if (next == true) {
print('quickQuotationKey2 - $next'); print('quickQuotationKey2 - $next');
callRefresh(); callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false; // reset ref
.read(enquiryRefreshProvider.notifier)
.state = false; // reset
} }
}); });
}); });
getPaymentMode(); getPaymentMode();
refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, ( refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, (previous,
previous, next,) {
next,
) {
if (next == true) { if (next == true) {
print('refresh triggered Quick Creation'); print('refresh triggered Quick Creation');
autoRefrshfilterDateRange(); autoRefrshfilterDateRange();
// callRefresh(); // callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false; ref
.read(enquiryRefreshProvider.notifier)
.state = false;
} }
}); });
getInsuranceType(); getInsuranceType();
getVehicleType();
} }
// Future<void> loadPreferences() async { // Future<void> loadPreferences() async {
@ -629,8 +637,40 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
} }
Future<void> getStaffList( Future<void> getVehicleType() async {
int managerId, print('EIL 1getVT-called');
setState(() {
isLoadingVehicleType = true;
});
try {
final response = await apiService.fetchMasterDropDown('vehicleType');
if (response['status'] == 200) {
print('EIL 2getVT-Data - ${response['data']}');
setState(() {
getVehicleTypeData = List<Map<String, dynamic>>.from(
response['data'],
);
// print('EIL 3getVT-B4filterData : $getVehicleTypeData');
filteredVehicleData = List.from(getVehicleTypeData);
// print('EIL 3getVT-AftfilterData : $filteredVehicleData');
});
} else {
getVehicleTypeData = [];
filteredVehicleData = [];
}
} catch (e) {
print('EIL 2getVT-Exception occurred: $e');
} finally {
setState(() {
isLoadingVehicleType = false;
});
}
}
Future<void> getStaffList(int managerId,
role, { role, {
String fromDate = '', String fromDate = '',
String toDate = '', String toDate = '',
@ -654,12 +694,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
setState(() { setState(() {
_dashboardInitHandled = true; _dashboardInitHandled = true;
}); });
// For PREV PENDING set date range until yesterday
final today = DateTime.now(); final today = DateTime.now();
print('A813 => Fns called => $managerId | $role'); final DateTime yesterday = today.subtract(const Duration(days: 1));
final DateTime fromDate = DateTime(2025, 10, 1); // hardcoded Date
controllers['startDate']?.text = dateFormat.format(fromDate);
controllers['endDate']?.text = dateFormat.format(yesterday);
print('UnA813 => Fns called => $managerId | $role');
// For PREV PENDING set date range until yesterday
// Change to dd-MM-yyyy // Change to dd-MM-yyyy
// final dateFormat = DateFormat('dd-MM-yyyy'); // final dateFormat = DateFormat('dd-MM-yyyy');
//
// final yesterday = today.subtract(Duration(days: 1)); // final yesterday = today.subtract(Duration(days: 1));
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : ''; fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
@ -703,6 +747,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('Pre Date its User Choosen Enq Inline list - $fromDt - $toDt'); print('Pre Date its User Choosen Enq Inline list - $fromDt - $toDt');
if (_resetKeyEnable) { if (_resetKeyEnable) {
print('A12131 => Fns called => $managerId | $role');
final dateFormat = DateFormat('dd-MM-yyyy'); final dateFormat = DateFormat('dd-MM-yyyy');
final today = DateTime.now(); final today = DateTime.now();
// final yesterday = today.subtract(Duration(days: 1)); // final yesterday = today.subtract(Duration(days: 1));
@ -716,11 +761,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
_resetKeyEnable = false; // ask suren Never forgot _resetKeyEnable = false; // ask suren Never forgot
}); });
} else { } else {
print('A13131 => Fns called => $managerId | $role');
fromDt = fromDateVal; fromDt = fromDateVal;
toDt = toDateVal; toDt = toDateVal;
} }
} }
print('Enq 2- $fromDt - $toDt'); print('Enq 2- $fromDt - $toDt');
String finalStatus = SelectedStatus; String finalStatus = SelectedStatus;
@ -733,7 +777,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
managerId, managerId,
userId, userId,
role, role,
fromDate: _dashboardInitHandled ? controllers['startDate']?.text : fromDt, fromDate: _dashboardInitHandled
? controllers['startDate']?.text
: fromDt,
toDate: _dashboardInitHandled ? controllers['endDate']?.text : toDt, toDate: _dashboardInitHandled ? controllers['endDate']?.text : toDt,
// selectedStatus: (finalStatus != '' && finalStatus != 'PrevPending') // selectedStatus: (finalStatus != '' && finalStatus != 'PrevPending')
// ? finalStatus // ? finalStatus
@ -761,7 +807,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
controllers['endDate']?.text = toDate; controllers['endDate']?.text = toDate;
if (data is List) { if (data is List) {
getStaffData = List<Map<String, dynamic>>.from(data); getStaffData = List<Map<String, dynamic>>.from(data);
@ -831,7 +876,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
void _applyFilter(String query) { void _applyFilter(String query) {
setState(() { setState(() {
final List<dynamic> source = (selectedIndex == 0) ? inProgressData : completedData; final List<dynamic> source = (selectedIndex == 0)
? inProgressData
: completedData;
final String q = query.trim().toLowerCase(); final String q = query.trim().toLowerCase();
completedCurrentPage = 1; completedCurrentPage = 1;
@ -1106,23 +1153,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
} }
Future<void> handleStaff( Future<void> handleStaff(BuildContext context,
BuildContext context,
dynamic data, dynamic data,
id, id,
regNum, regNum,) async {
) async {
showDialog( showDialog(
context: context, context: context,
builder: (ctx) => AssignStaffDialog( builder: (ctx) =>
enquiryPrimaryId: id, AssignStaffDialog(
regNum: regNum, enquiryPrimaryId: id,
userId: userId, regNum: regNum,
onSubmit: (value) { userId: userId,
debugPrint("New assignY: $value"); onSubmit: (value) {
refresh(); debugPrint("New assignY: $value");
}, refresh();
), },
),
); );
} }
@ -1231,6 +1277,26 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
} }
Future<void> handleVehicleType(VtId, EId) async {
print('EIL 1handleVT-called');
print('EIL 2handleVT-vtid ${VtId}');
print('EIL 3handleVT-eid ${EId}');
Map<String, dynamic> data = {
"id": EId,
"vehicle_type_id": VtId,
"updated_by": userId,
};
final path = 'enquiry/setVehicleTypeToEnquiry';
final res = await apiService.createUserData(data, path);
print('EIL 4handleVT-res $res');
if (res['status'] == 'success') {
print('EIL 5handleVT-res ${res['status']}');
refrshfilterDateRange();
}
}
void handleSave(dynamic id) { void handleSave(dynamic id) {
print('SAVE -- $id'); print('SAVE -- $id');
// final ids = int.tryParse(id.toString()) ?? 0; // final ids = int.tryParse(id.toString()) ?? 0;
@ -1315,12 +1381,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
// Validate Insured Name // Validate Insured Name
if (controllers['name']?.text.trim().isEmpty ?? true) { if (controllers['name']?.text
.trim()
.isEmpty ?? true) {
fieldErrors['name'] = 'Insured Name is required'; fieldErrors['name'] = 'Insured Name is required';
} }
// Validate Vehicle Number // Validate Vehicle Number
if (controllers['regNo']?.text.trim().isEmpty ?? true) { if (controllers['regNo']?.text
.trim()
.isEmpty ?? true) {
fieldErrors['regNo'] = 'Vehicle Number is required'; fieldErrors['regNo'] = 'Vehicle Number is required';
} }
@ -1369,16 +1439,17 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} catch (e) { } catch (e) {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) =>
title: const Text('Error'), AlertDialog(
content: Text(e.toString()), title: const Text('Error'),
actions: [ content: Text(e.toString()),
TextButton( actions: [
onPressed: () => Navigator.of(context).pop(), TextButton(
child: const Text('OK'), onPressed: () => Navigator.of(context).pop(),
child: const Text('OK'),
),
],
), ),
],
),
); );
} finally { } finally {
// setState(() => isSaving = false); // re-enable button after save // setState(() => isSaving = false); // re-enable button after save
@ -1386,11 +1457,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
Future<void> attachFiles(http.MultipartRequest request) async { Future<void> attachFiles(http.MultipartRequest request) async {
Future<void> addFileOrKeepName( Future<void> addFileOrKeepName(PlatformFile? file,
PlatformFile? file,
String? apiFileName, String? apiFileName,
String fieldName, String fieldName,) async {
) async {
if (file != null) { if (file != null) {
// User uploaded a new file send as multipart // User uploaded a new file send as multipart
if (file.bytes != null) { if (file.bytes != null) {
@ -1626,7 +1695,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
return MainLayout( return MainLayout(
title: "Enquiries", title: "Enquiries",
body: Container( body: Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
.of(context)
.size
.width,
// height: MediaQuery.of(context).size.height * 0.1, // height: MediaQuery.of(context).size.height * 0.1,
// padding: EdgeInsets.all(12.0), // padding: EdgeInsets.all(12.0),
child: Column( child: Column(
@ -1652,16 +1724,17 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} catch (e) { } catch (e) {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) =>
title: const Text('Error'), AlertDialog(
content: Text(e.toString()), title: const Text('Error'),
actions: [ content: Text(e.toString()),
TextButton( actions: [
onPressed: () => Navigator.of(context).pop(), TextButton(
child: const Text('OK'), onPressed: () => Navigator.of(context).pop(),
child: const Text('OK'),
),
],
), ),
],
),
); );
} }
}, },
@ -1671,7 +1744,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// SizedBox(height: 5), // SizedBox(height: 5),
ResponsiveLayout.isMobile(context) ResponsiveLayout.isMobile(context)
? Container( ? Container(
height: MediaQuery.of(context).size.height * 0.69, height: MediaQuery
.of(context)
.size
.height * 0.69,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: EdgeInsets.all(2), padding: EdgeInsets.all(2),
@ -1683,8 +1759,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Expanded( // Expanded(
// child: // child:
Container( Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
height: MediaQuery.of(context).size.height * 0.69, .of(context)
.size
.width,
height: MediaQuery
.of(context)
.size
.height * 0.69,
// padding: EdgeInsets.symmetric( // padding: EdgeInsets.symmetric(
// horizontal: 8.0, // horizontal: 8.0,
// vertical: 2.0, // vertical: 2.0,
@ -1719,11 +1801,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
refrshfilterDateRange(); refrshfilterDateRange();
} }
Future<void> buildPolicyCreatedStatusActions( Future<void> buildPolicyCreatedStatusActions(BuildContext context,
BuildContext context,
status, status,
id, id,) async {
) async {
print("Actionsstatus - $status -$id"); print("Actionsstatus - $status -$id");
dynamic val; dynamic val;
if (status == 'Awaiting Proposal' || status == 'Proposal Created') { if (status == 'Awaiting Proposal' || status == 'Proposal Created') {
@ -1839,7 +1919,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
bool newValue = !v; bool newValue = !v;
setState(() { setState(() {
isActionable = newValue; isActionable = newValue;
userPreference = newValue; // Save this as the new "normal" userPreference =
newValue; // Save this as the new "normal"
}); });
final prefs = final prefs =
await SharedPreferences.getInstance(); await SharedPreferences.getInstance();
@ -1916,8 +1997,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
txtHeight: 30, txtHeight: 30,
controller: _searchStaffController, controller: _searchStaffController,
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? MediaQuery.of(context).size.width * 0.7 ? MediaQuery
: MediaQuery.of(context).size.width * 0.13, .of(context)
.size
.width * 0.7
: MediaQuery
.of(context)
.size
.width * 0.13,
// Combine the logic into one function block // Combine the logic into one function block
onChanged: (value) { onChanged: (value) {
@ -1979,7 +2066,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
ResponsiveLayout.isMobile(context) ResponsiveLayout.isMobile(context)
? _buildDataTable(context) ? _buildDataTable(context)
: Container( : Container(
height: MediaQuery.of(context).size.height * 0.55, height: MediaQuery
.of(context)
.size
.height * 0.55,
// decoration: BoxDecoration( // decoration: BoxDecoration(
// color: Colors.white // color: Colors.white
// ), // ),
@ -2001,6 +2091,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
'Assigned': 'Assigned', 'Assigned': 'Assigned',
'In progress': 'In Progress', 'In progress': 'In Progress',
}; };
List<Map<String, dynamic>> get filteredDataByTab { List<Map<String, dynamic>> get filteredDataByTab {
final sortedData = [...filteredData] final sortedData = [...filteredData]
..sort((a, b) => int.parse(b['id']) - int.parse(a['id'])); ..sort((a, b) => int.parse(b['id']) - int.parse(a['id']));
@ -2124,11 +2215,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
Widget _buildDataTable(context) { Widget _buildDataTable(context) {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery
.of(context)
.size
.width;
final isMobile = ResponsiveLayout.isMobile(context); final isMobile = ResponsiveLayout.isMobile(context);
// Calculate minimum width based on screen size // Calculate minimum width based on screen size
double minTableWidth = isMobile ? screenWidth * 1.5 : 1300; double minTableWidth = isMobile ? screenWidth * 1.2 : 1200;
return return
// Expanded( // Expanded(
// child: // child:
@ -2229,7 +2323,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
if (item['type'] == 'header') { if (item['type'] == 'header') {
// Render group header // Render group header
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
.of(context)
.size
.width,
margin: EdgeInsets.fromLTRB(12, 4, 12, 4), margin: EdgeInsets.fromLTRB(12, 4, 12, 4),
child: _buildGroupHeader(item['status'], item['count']), child: _buildGroupHeader(item['status'], item['count']),
); );
@ -2241,7 +2338,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
final selectId = data['id'].toString() ?? '0'; final selectId = data['id'].toString() ?? '0';
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
.of(context)
.size
.width,
margin: EdgeInsets.fromLTRB(12, 8, 12, 8), margin: EdgeInsets.fromLTRB(12, 8, 12, 8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -2265,7 +2365,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Expanded content // Expanded content
if (rowExpanded[id] ?? false) if (rowExpanded[id] ?? false)
Container( Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Color(0xFFC7D2FE)), border: Border.all(color: Color(0xFFC7D2FE)),
color: Color(0xFFF8F9FF), color: Color(0xFFF8F9FF),
@ -2286,6 +2389,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
selectedStaff: selectedStaff, selectedStaff: selectedStaff,
selectedBroker: selectedBroker, selectedBroker: selectedBroker,
selectedInsurer: selectedInsurer, selectedInsurer: selectedInsurer,
// selectedVehicleType: selectedVehicleType,
filteredAgentData: filteredAgentData, filteredAgentData: filteredAgentData,
filteredStaffDataEnqAsgn: filteredStaffDataEnqAsgn, filteredStaffDataEnqAsgn: filteredStaffDataEnqAsgn,
onStaffChanged: (val) { onStaffChanged: (val) {
@ -2303,6 +2407,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
selectedInsurer = val; selectedInsurer = val;
}); });
}, },
// onVehicleTypeChanged: (val) {
// setState(() {
// selectedVehicleType = val;
// });
// },
onBrokerChanged: (val) { onBrokerChanged: (val) {
setState(() { setState(() {
selectedBroker = val; selectedBroker = val;
@ -2335,6 +2444,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// DataColumn(label: Text('Premium', style: _headerStyle)), // DataColumn(label: Text('Premium', style: _headerStyle)),
DataColumn(label: Text('Payment Mode', style: _headerStyle)), DataColumn(label: Text('Payment Mode', style: _headerStyle)),
DataColumn(label: Text('Plan Type', style: _headerStyle)), DataColumn(label: Text('Plan Type', style: _headerStyle)),
DataColumn(label: Text('Vehicle Type', style: _headerStyle)),
DataColumn(label: Text('Policy', style: _headerStyle)), DataColumn(label: Text('Policy', style: _headerStyle)),
]; ];
} }
@ -2345,7 +2455,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
child: Row( child: Row(
children: [ children: [
_buildHeaderCell('Received Date', 110), _buildHeaderCell('Received Date', 110),
_buildHeaderCell('Assigned To', 130), _buildHeaderCell('Assigned To', 110),
_buildHeaderCell('Partner', 100), _buildHeaderCell('Partner', 100),
// _buildHeaderCell('Broker *', 100), // _buildHeaderCell('Broker *', 100),
@ -2356,10 +2466,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
_buildHeaderCell('Status', 100), _buildHeaderCell('Status', 100),
// _buildHeaderCell('Assigned Date', 100), // _buildHeaderCell('Assigned Date', 100),
// _buildHeaderCell('Premium', 100), // _buildHeaderCell('Premium', 100),
_buildHeaderCell('Payment Mode', 130), _buildHeaderCell('Payment Mode', 100),
_buildHeaderCell('Plan Type', 130), _buildHeaderCell('Plan Type', 100),
_buildHeaderCell('Vehicle Type', 100),
_buildHeaderCell('Policy', 120), _buildHeaderCell('Policy', 100),
], ],
), ),
); );
@ -2706,6 +2817,37 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
); );
} }
// Helper: Vehicle type dropdown
Widget _buildVehicleTypeDropdown(Map<String, dynamic> item) {
if (item['enquiry_status'] == 'To be assigned' ||
(item['enquiry_status'] == 'Assigned' &&
item['quotation_id'] == null)) {
return Text('-');
}
return DropdownSearch<Map<String, dynamic>>(
key: ValueKey('vehicle_type_${item['id']}'),
selectedItem: _getSelectedVehicleType(item),
items: (filter, _) async => _filterVehicleType(filter),
itemAsString: (val) => val['vehicle_type'].toString(),
compareFn: (item, selectedItem) => item['vehicle_type_id'] == selectedItem['id'],
suffixProps: _buildDropdownSuffix(),
dropdownBuilder: (context, selectedItem) =>
_buildDropdownDisplay(selectedItem, 'vehicle_type', 'Select Vehicle Type'),
decoratorProps: _buildDropdownDecorator(),
popupProps: _buildDropdownPopup('vehicle_type'),
onChanged: (val) {
if (val != null) {
setState(() {
item['vehicle_type_id'] = val['id'].toString();
item['vehicle_type'] = val['vehicle_type'].toString();
});
handleVehicleType(val['id'].toString(), item['id']);
}
},
);
}
// Helper: Policy upload/download // Helper: Policy upload/download
Widget _buildPolicyCell(Map<String, dynamic> item) { Widget _buildPolicyCell(Map<String, dynamic> item) {
if (item['enquiry_status'] == 'To be assigned' || if (item['enquiry_status'] == 'To be assigned' ||
@ -2893,6 +3035,41 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
} }
Map<String, dynamic>? _getSelectedVehicleType(Map<String, dynamic> item) {
try {
print('EIL 1getSVT-called');
print('EIL 2getSVT-vehicle_type_id ${item['vehicle_type_id']}');
print('EIL 3getSVT-vehicle_type ${item['vehicle_type']}');
final result = filteredVehicleData.firstWhere(
(vt) {
final idMatch =
vt['id'].toString() == item['vehicle_type_id'].toString();
final nameMatch =
vt['vehicle_type'].toString().trim().toLowerCase() ==
item['vehicle_type'].toString().trim().toLowerCase();
print('EIL 3getSVT-check id O:${vt['id']} | name O:${vt['vehicle_type']} '); // o means original
print('EIL 4getSVT-check id M:$idMatch | name M:$nameMatch'); // M means match
return idMatch || nameMatch;
},
orElse: () => {},
);
print('EIL 5getSVT-result $result');
return result.isNotEmpty ? result : null;
} catch (e, s) {
print('EIL 6getSVT-ERROR $e');
print(s);
return null;
}
}
List<Map<String, dynamic>> _filterPaymentModes(String filter) { List<Map<String, dynamic>> _filterPaymentModes(String filter) {
if (filter.isEmpty) return filteredPaymentModeData; if (filter.isEmpty) return filteredPaymentModeData;
return filteredPaymentModeData.where((mode) { return filteredPaymentModeData.where((mode) {
@ -2911,6 +3088,23 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
}).toList(); }).toList();
} }
List<Map<String, dynamic>> _filterVehicleType(String filter) {
print('EIL 1filterVT-called');
print('EIL 2filterVT-text "$filter" | ${filteredVehicleData.length}');
if (filter.isEmpty) return filteredVehicleData; // 'Filter EMPTY → returning full list'
final result = filteredVehicleData.where((vt) {
final vehicleType = vt['vehicle_type']?.toString().toLowerCase() ?? '';
final match = vehicleType.contains(filter.toLowerCase());
print('EIL 3filterVT-Check - id:${vt['id']} | vehicle_type:$vehicleType | match:$match');
return match;
}).toList();
return result;
}
DropdownSuffixProps _buildDropdownSuffix() { DropdownSuffixProps _buildDropdownSuffix() {
return DropdownSuffixProps( return DropdownSuffixProps(
dropdownButtonProps: DropdownButtonProps( dropdownButtonProps: DropdownButtonProps(
@ -3098,7 +3292,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Status // Status
DataCell( DataCell(
SizedBox( SizedBox(
width: 120, width: 100,
child: _buildStatusCell(item, id, bgColor, borderColor), child: _buildStatusCell(item, id, bgColor, borderColor),
), ),
), ),
@ -3107,7 +3301,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
DataCell( DataCell(
SizedBox( SizedBox(
height: 30, height: 30,
width: 120, width: 100,
child: _buildPaymentModeDropdown(item), child: _buildPaymentModeDropdown(item),
), ),
), ),
@ -3115,12 +3309,21 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Plan Type // Plan Type
DataCell( DataCell(
SizedBox( SizedBox(
width: 120, width: 100,
height: 30, height: 30,
child: _buildInsurancePlanDropdown(item), child: _buildInsurancePlanDropdown(item),
), ),
), ),
// Vehicle Type
DataCell(
SizedBox(
width: 100,
height: 30,
child: _buildVehicleTypeDropdown(item),
),
),
// Policy // Policy
DataCell( DataCell(
SizedBox(height: 30, width: 90, child: _buildPolicyCell(item)), SizedBox(height: 30, width: 90, child: _buildPolicyCell(item)),

View File

@ -722,7 +722,13 @@ class policylistState extends ConsumerState<policylist> {
), ),
Expanded( Expanded(
flex: 3, flex: 3,
child: Text(item['agent_name'] ?? '-', style: _dataBold), // child: Text(item['agent_name'] ?? '-', style: _dataBold),
child: Text(
(item['agent_code'] != null && item['agent_name'] != null)
? '${item['agent_code']} - ${item['agent_name']}'
: (item['agent_name'] ?? '-'),
style: _dataBold,
),
), ),
Expanded( Expanded(

View File

@ -700,26 +700,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.0.2" version: "10.0.9"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.10" version: "3.0.9"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@ -1297,10 +1297,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.6" version: "0.7.4"
toastification: toastification:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1417,10 +1417,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.1.4"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:

View File

@ -15,8 +15,9 @@
the `--base-href` argument provided to `flutter build`. the `--base-href` argument provided to `flutter build`.
--> -->
<!-- <base href="$FLUTTER_BASE_HREF">--> <!-- <base href="$FLUTTER_BASE_HREF">-->
<!-- <base href="/partner/">--> <!-- <base href="/partner/"> Live build: also check env.dart (line 8)-->
<base href="/nhance/partner/app/"> <base href="/nhance/partner/app/"> <!-- Testing build: also check env.dart (line 9) -->
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta content="IE=Edge" http-equiv="X-UA-Compatible">