chart fixes
This commit is contained in:
parent
2488d0f72c
commit
0054bfeb30
File diff suppressed because one or more lines are too long
@ -1308,7 +1308,7 @@ class othersPendings extends StatelessWidget {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Staff Name",
|
"Staff Name",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.left,
|
||||||
style: _headerStyle,
|
style: _headerStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -276,7 +276,7 @@ class _BussinessDashboardState extends ConsumerState<BussinessDashboard> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// mainAxisSize: MainAxisSize.min,
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text('Hide and Show Charts : ', style: _styleSmall1),
|
Text('Hide and Show Charts : ', style: _styleSmall1),
|
||||||
|
|||||||
@ -495,13 +495,23 @@ class _PerformanceState extends State<Performance> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Partner Name",
|
"S.NO",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.left,
|
||||||
style: _headerStyle,
|
style: _headerStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text(
|
||||||
|
"Partner Name",
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: _headerStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Partner Code",
|
"Partner Code",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -511,10 +521,11 @@ class _PerformanceState extends State<Performance> {
|
|||||||
|
|
||||||
(widget.title == 'Performing Partner')
|
(widget.title == 'Performing Partner')
|
||||||
? Expanded(
|
? Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.isPerfomingAgntPolicy
|
widget.isPerfomingAgntPolicy
|
||||||
? "Policy count"
|
? "Policy Count"
|
||||||
: "Premium count",
|
: "Premium Count",
|
||||||
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: _headerStyle,
|
style: _headerStyle,
|
||||||
@ -551,13 +562,23 @@ class _PerformanceState extends State<Performance> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
row['agent_name'] ?? "",
|
(index + 1).toString(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.left,
|
||||||
style: _tableDataStyle,
|
style: _tableDataStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Text(
|
||||||
|
row['agent_name'] ?? "",
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: _tableDataStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
row['agent_code'] ?? "",
|
row['agent_code'] ?? "",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -567,6 +588,7 @@ class _PerformanceState extends State<Performance> {
|
|||||||
|
|
||||||
(widget.title == 'Performing Partner')
|
(widget.title == 'Performing Partner')
|
||||||
? Expanded(
|
? Expanded(
|
||||||
|
flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
isPerfomingAgntPolicy
|
isPerfomingAgntPolicy
|
||||||
? (row['policy_count']?.toString() ?? "0")
|
? (row['policy_count']?.toString() ?? "0")
|
||||||
|
|||||||
@ -128,6 +128,7 @@ class CreateProposal_QuickFormState
|
|||||||
dynamic managerId;
|
dynamic managerId;
|
||||||
|
|
||||||
bool isSingleSave = false;
|
bool isSingleSave = false;
|
||||||
|
bool _isResetting = false;
|
||||||
|
|
||||||
List<Map<String, dynamic>> quotationList = [];
|
List<Map<String, dynamic>> quotationList = [];
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ class CreateProposal_QuickFormState
|
|||||||
getInsuranceType();
|
getInsuranceType();
|
||||||
getPaymentMode();
|
getPaymentMode();
|
||||||
getInsurers();
|
getInsurers();
|
||||||
updateData();
|
|
||||||
getBroker();
|
getBroker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +254,15 @@ class CreateProposal_QuickFormState
|
|||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
print('RESET');
|
print('RESET');
|
||||||
|
|
||||||
|
_isResetting = true;
|
||||||
|
print('_isResetting : $_isResetting');
|
||||||
|
|
||||||
|
controllers['regNo']!.clear();
|
||||||
_formKey.currentState?.reset();
|
_formKey.currentState?.reset();
|
||||||
|
|
||||||
|
fieldErrors.clear();
|
||||||
|
|
||||||
// Clear all TextEditingControllers
|
// Clear all TextEditingControllers
|
||||||
for (var controller in controllers.values) {
|
for (var controller in controllers.values) {
|
||||||
controller.clear();
|
controller.clear();
|
||||||
@ -282,6 +291,9 @@ class CreateProposal_QuickFormState
|
|||||||
|
|
||||||
// Trigger UI update
|
// Trigger UI update
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
Future.delayed(Duration(milliseconds: 100), () {
|
||||||
|
_isResetting = false; // ✅ safe to enable again
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getQuickQuotationList(int managerId) async {
|
Future<void> getQuickQuotationList(int managerId) async {
|
||||||
@ -384,7 +396,7 @@ class CreateProposal_QuickFormState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateData() {}
|
void refresh() {}
|
||||||
|
|
||||||
Future<void> getInsurers() async {
|
Future<void> getInsurers() async {
|
||||||
print('Insurers called');
|
print('Insurers called');
|
||||||
@ -1350,19 +1362,26 @@ class CreateProposal_QuickFormState
|
|||||||
FilteringTextInputFormatter.allow(RegExp(r'[A-Za-z0-9- ]')),
|
FilteringTextInputFormatter.allow(RegExp(r'[A-Za-z0-9- ]')),
|
||||||
],
|
],
|
||||||
onChanged: (val) async {
|
onChanged: (val) async {
|
||||||
|
if (_isResetting) {
|
||||||
|
print("Skipping API because _isResetting = true");
|
||||||
|
return;
|
||||||
|
}
|
||||||
print('Vehicle - $val');
|
print('Vehicle - $val');
|
||||||
final res = await apiService.CheckDuplicate(context, val);
|
|
||||||
print('Vehicle res- $res');
|
|
||||||
|
|
||||||
if (res["message"] != null && res["message"] != "") {
|
if (val != null) {
|
||||||
ToastHelper.showErrorToast(context, res['message']);
|
final res = await apiService.CheckDuplicate(context, val);
|
||||||
setState(() {
|
print('Vehicle res- $res');
|
||||||
fieldErrors['regNo'] = res['message']; // store API message
|
|
||||||
}); // 🔥 store backend message
|
if (res["message"] != null && res["message"] != "") {
|
||||||
} else {
|
ToastHelper.showErrorToast(context, res['message']);
|
||||||
setState(() {
|
setState(() {
|
||||||
fieldErrors['regNo'] = res['message']; // store API message
|
fieldErrors['regNo'] = res['message']; // store API message
|
||||||
});
|
}); // 🔥 store backend message
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
fieldErrors['regNo'] = res['message']; // store API message
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
|
|||||||
@ -140,6 +140,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
String? selectedId;
|
String? selectedId;
|
||||||
|
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
|
int autoRefreshIndex = 0;
|
||||||
|
|
||||||
final List<String> enquiryTabs = ["In Progress", "Completed"];
|
final List<String> enquiryTabs = ["In Progress", "Completed"];
|
||||||
|
|
||||||
@ -379,6 +380,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
SelectedStatus: SelectedStatus ?? '',
|
SelectedStatus: SelectedStatus ?? '',
|
||||||
SelectedStaffId: SelectedStaffId ?? '',
|
SelectedStaffId: SelectedStaffId ?? '',
|
||||||
);
|
);
|
||||||
|
autoRefreshIndex = selectedIndex;
|
||||||
|
print('autoRefreshIndex - $autoRefreshIndex');
|
||||||
_searchStaffController.clear();
|
_searchStaffController.clear();
|
||||||
print('refrshfilterDateRange 2');
|
print('refrshfilterDateRange 2');
|
||||||
}
|
}
|
||||||
@ -609,7 +612,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
|
|
||||||
final yesterday = today.subtract(Duration(days: 1));
|
final yesterday = today.subtract(Duration(days: 1));
|
||||||
|
|
||||||
fromDt = dateFormat.format(yesterday.subtract(Duration(days: 15)));
|
fromDt = dateFormat.format(yesterday.subtract(Duration(days: 5)));
|
||||||
toDt = dateFormat.format(yesterday);
|
toDt = dateFormat.format(yesterday);
|
||||||
|
|
||||||
print('PrevPending FROM TO - $fromDt - $toDt');
|
print('PrevPending FROM TO - $fromDt - $toDt');
|
||||||
@ -632,15 +635,38 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
print("ENQ LIST PAGE");
|
print("ENQ LIST PAGE");
|
||||||
|
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
fromDt = dateFormat.format(today.subtract(Duration(days: 15)));
|
fromDt = dateFormat.format(today.subtract(Duration(days: 5)));
|
||||||
// fromDt = dateFormat.format(today);
|
// fromDt = dateFormat.format(today);
|
||||||
toDt = dateFormat.format(today);
|
toDt = dateFormat.format(today);
|
||||||
|
|
||||||
print('Enq FROM TO - $fromDt - $toDt');
|
print('Enq FROM TO - $fromDt - $toDt');
|
||||||
} else {
|
} else {
|
||||||
|
print('Enq 1- $fromDt - $toDt');
|
||||||
fromDt = fromDateVal;
|
fromDt = fromDateVal;
|
||||||
toDt = toDateVal;
|
toDt = toDateVal;
|
||||||
}
|
}
|
||||||
|
print('Enq 2- $fromDt - $toDt');
|
||||||
|
String finalStatus = SelectedStatus;
|
||||||
|
print('finalStatus1 - $finalStatus');
|
||||||
|
|
||||||
|
// if ((finalStatus != '') &&
|
||||||
|
// (SelectedStatus != 'Completed') &&
|
||||||
|
// (autoRefreshIndex == 0)) {
|
||||||
|
// finalStatus = 'OtherThenCompleted';
|
||||||
|
// print('finalSt1 - $finalStatus');
|
||||||
|
// } else if (SelectedStatus == 'Completed' || autoRefreshIndex == 1) {
|
||||||
|
// finalStatus = 'Completed';
|
||||||
|
// print('finalSt2 - $finalStatus');
|
||||||
|
// } else if (SelectedStatus == 'PrevPending') {
|
||||||
|
// finalStatus = '';
|
||||||
|
// print('finalSt3 - $finalStatus');
|
||||||
|
// } else {
|
||||||
|
// finalStatus = 'OtherThenCompleted';
|
||||||
|
// print('finalSt4 - $finalStatus');
|
||||||
|
// // finalStatus = SelectedStatus; // keep original
|
||||||
|
// }
|
||||||
|
// print('finalStatus2 - $finalStatus');
|
||||||
|
// print('DAJJshA79SelectedStatus - $SelectedStatus');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await apiService.fetchEnquiryList(
|
final response = await apiService.fetchEnquiryList(
|
||||||
@ -649,6 +675,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
role,
|
role,
|
||||||
fromDate: fromDt,
|
fromDate: fromDt,
|
||||||
toDate: toDt,
|
toDate: toDt,
|
||||||
|
// selectedStatus: (finalStatus != '' && finalStatus != 'PrevPending')
|
||||||
|
// ? finalStatus
|
||||||
|
// : '',
|
||||||
selectedStatus:
|
selectedStatus:
|
||||||
(SelectedStatus != '' && SelectedStatus != 'PrevPending')
|
(SelectedStatus != '' && SelectedStatus != 'PrevPending')
|
||||||
? SelectedStatus
|
? SelectedStatus
|
||||||
@ -665,10 +694,12 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
print('ToDate : $toDate');
|
print('ToDate : $toDate');
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
if (SelectedStatus == 'Completed') {
|
if (SelectedStatus == 'Completed' || autoRefreshIndex == 1) {
|
||||||
selectedIndex = 1;
|
selectedIndex = 1;
|
||||||
|
SelectedStatus = 'Completed';
|
||||||
} else {
|
} else {
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
|
SelectedStatus = 'OtherThenCompleted';
|
||||||
}
|
}
|
||||||
controllers['startDate']?.text = fromDate;
|
controllers['startDate']?.text = fromDate;
|
||||||
controllers['endDate']?.text = toDate;
|
controllers['endDate']?.text = toDate;
|
||||||
@ -3548,61 +3579,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
return grouped;
|
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) {
|
Map<String, dynamic> _getStatusConfig(String status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'Awaiting Proposal':
|
case 'Awaiting Proposal':
|
||||||
@ -3947,8 +3923,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
int.tryParse(id.toString()) != null &&
|
int.tryParse(id.toString()) != null &&
|
||||||
int.parse(id.toString()) > 1000000000000;
|
int.parse(id.toString()) > 1000000000000;
|
||||||
|
|
||||||
print('idPrimary - $idPrimary');
|
// print('idPrimary - $idPrimary');
|
||||||
print('isNewRow - $isNewRow');
|
// print('isNewRow - $isNewRow');
|
||||||
final editing = isEditingRow[id] ?? false;
|
final editing = isEditingRow[id] ?? false;
|
||||||
final controllers = rowControllers[id];
|
final controllers = rowControllers[id];
|
||||||
|
|
||||||
@ -5277,6 +5253,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedIndex = index;
|
selectedIndex = index;
|
||||||
|
|
||||||
|
if (selectedIndex == '1') {
|
||||||
|
getStaffList(
|
||||||
|
managerId,
|
||||||
|
roleId,
|
||||||
|
SelectedStatus: 'Completed',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
getStaffList(managerId, roleId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
|
|||||||
@ -37,6 +37,8 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
|||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
Map<String, String?> fieldErrors = {};
|
Map<String, String?> fieldErrors = {};
|
||||||
|
|
||||||
|
bool _isResetting = false;
|
||||||
|
|
||||||
Map<String, TextEditingController> controllers = {};
|
Map<String, TextEditingController> controllers = {};
|
||||||
List<String> tabHeader = [
|
List<String> tabHeader = [
|
||||||
'startDate',
|
'startDate',
|
||||||
@ -180,6 +182,15 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void resetFormFields() {
|
void resetFormFields() {
|
||||||
|
_isResetting = true;
|
||||||
|
print('_isResetting : $_isResetting');
|
||||||
|
;
|
||||||
|
|
||||||
|
controllers['regNo']!.clear();
|
||||||
|
_formKey.currentState?.reset();
|
||||||
|
|
||||||
|
fieldErrors.clear();
|
||||||
|
|
||||||
// 1. Reset all text controllers
|
// 1. Reset all text controllers
|
||||||
controllers.forEach((key, controller) {
|
controllers.forEach((key, controller) {
|
||||||
controller.clear();
|
controller.clear();
|
||||||
@ -196,6 +207,10 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
|||||||
_formKey.currentState?.reset();
|
_formKey.currentState?.reset();
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
|
Future.delayed(Duration(milliseconds: 100), () {
|
||||||
|
_isResetting = false; // ✅ safe to enable again
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getVehicleType() async {
|
Future<void> getVehicleType() async {
|
||||||
@ -812,6 +827,10 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
|||||||
],
|
],
|
||||||
// validator: (value) => Validators.requiredField(value, "regNo"),
|
// validator: (value) => Validators.requiredField(value, "regNo"),
|
||||||
onChanged: (val) async {
|
onChanged: (val) async {
|
||||||
|
if (_isResetting) {
|
||||||
|
print("Skipping API because _isResetting = true");
|
||||||
|
return;
|
||||||
|
}
|
||||||
print('Vehicle - $val');
|
print('Vehicle - $val');
|
||||||
final res = await apiService.CheckDuplicate(context, val);
|
final res = await apiService.CheckDuplicate(context, val);
|
||||||
print('Vehicle res- $res');
|
print('Vehicle res- $res');
|
||||||
|
|||||||
@ -724,44 +724,6 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _readonlyField(String label, String value) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: GoogleFonts.inter(fontSize: 13, fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 60, vertical: 14),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.red,
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
border: Border.all(color: Colors.grey.shade300),
|
|
||||||
),
|
|
||||||
child: Text(value, style: GoogleFonts.inter(fontSize: 14)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _downloadButton(String label) {
|
|
||||||
return ElevatedButton.icon(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: const Color(0xFF425B5B),
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
// TODO: file download logic
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.download, size: 18),
|
|
||||||
label: Text(label, style: GoogleFonts.inter(fontSize: 13)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildDocRC(BuildContext context, bool isMobile) {
|
Widget buildDocRC(BuildContext context, bool isMobile) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@ -90,13 +90,33 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
|
dynamic fromDt;
|
||||||
|
dynamic toDt;
|
||||||
|
final dateFormat = DateFormat('dd-MM-yyyy');
|
||||||
|
final today = DateTime.now();
|
||||||
|
final fromDateVal = controllers['startDate']?.text ?? '';
|
||||||
|
final toDateVal = controllers['endDate']?.text ?? '';
|
||||||
|
|
||||||
|
if (fromDateVal == '' && toDateVal == '') {
|
||||||
|
print("ENQ LIST PAGE");
|
||||||
|
|
||||||
|
final today = DateTime.now();
|
||||||
|
fromDt = dateFormat.format(today.subtract(Duration(days: 15)));
|
||||||
|
// fromDt = dateFormat.format(today);
|
||||||
|
toDt = dateFormat.format(today);
|
||||||
|
|
||||||
|
print('Enq FROM TO - $fromDt - $toDt');
|
||||||
|
} else {
|
||||||
|
fromDt = fromDateVal;
|
||||||
|
toDt = toDateVal;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await apiService.fetchPolicyDataOnlyList(
|
final response = await apiService.fetchPolicyDataOnlyList(
|
||||||
managerId,
|
managerId,
|
||||||
role,
|
role,
|
||||||
fromDate: controllers['startDate']?.text ?? '',
|
fromDate: fromDt,
|
||||||
toDate: controllers['endDate']?.text ?? '',
|
toDate: toDt,
|
||||||
selectedStaffId: SelectedStaffId ?? '',
|
selectedStaffId: SelectedStaffId ?? '',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -211,6 +231,9 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||||
query.toLowerCase(),
|
query.toLowerCase(),
|
||||||
) ||
|
) ||
|
||||||
|
(item['insurer_short_name'] ?? '-').toLowerCase().contains(
|
||||||
|
query.toLowerCase(),
|
||||||
|
) ||
|
||||||
(item['assigned_to_name'] ?? '-').toLowerCase().contains(
|
(item['assigned_to_name'] ?? '-').toLowerCase().contains(
|
||||||
query.toLowerCase(),
|
query.toLowerCase(),
|
||||||
) ||
|
) ||
|
||||||
@ -220,7 +243,7 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
(item['premium_amount'] ?? '-').toLowerCase().contains(
|
(item['premium_amount'] ?? '-').toLowerCase().contains(
|
||||||
query.toLowerCase(),
|
query.toLowerCase(),
|
||||||
) ||
|
) ||
|
||||||
(item['payment_mode'] ?? '-').toLowerCase().contains(
|
(item['payment_mode_value'] ?? '-').toLowerCase().contains(
|
||||||
query.toLowerCase(),
|
query.toLowerCase(),
|
||||||
) ||
|
) ||
|
||||||
(_formatDate(item['updated_on']) ?? '-').toLowerCase().contains(
|
(_formatDate(item['updated_on']) ?? '-').toLowerCase().contains(
|
||||||
@ -247,125 +270,6 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildPopupMenuActions(
|
|
||||||
BuildContext context,
|
|
||||||
dynamic data,
|
|
||||||
id,
|
|
||||||
regNum,
|
|
||||||
) {
|
|
||||||
return [
|
|
||||||
// if (roleId == 'manager') ...[
|
|
||||||
// Material(
|
|
||||||
// color: Colors.transparent,
|
|
||||||
// child: InkWell(
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (ctx) => AssignStaffDialog(
|
|
||||||
// enquiryPrimaryId: id,
|
|
||||||
// regNum: regNum,
|
|
||||||
// userId: userId,
|
|
||||||
// onSubmit: (value) {
|
|
||||||
// debugPrint("New assignY: $value");
|
|
||||||
// refresh();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// hoverColor: Color(0xFFE3F1F0),
|
|
||||||
// splashColor: Color(0xFFE3F1F0),
|
|
||||||
// borderRadius: BorderRadius.circular(6),
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
||||||
// child: Row(
|
|
||||||
// // mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: [
|
|
||||||
// Image.asset(
|
|
||||||
// "assets/miscellaneous/image_3.png",
|
|
||||||
// // height: 45,
|
|
||||||
// // width: 15,
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// SizedBox(width: 10),
|
|
||||||
// Text('Assign Staff'),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(quotationStaffIdProvider.notifier).state = id;
|
|
||||||
context.go(AppRoutes.quotation);
|
|
||||||
},
|
|
||||||
hoverColor: Color(0xFFE3F1F0),
|
|
||||||
splashColor: Color(0xFFE3F1F0),
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
||||||
child: Row(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Tooltip(
|
|
||||||
message: "Close",
|
|
||||||
child: Image.asset(
|
|
||||||
"assets/miscellaneous/image_1.png",
|
|
||||||
height: 15,
|
|
||||||
width: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
((data['status'] == 'Policy Created') ||
|
|
||||||
(data['status'] == 'Quotation Accepted'))
|
|
||||||
? const Text('View Quotation')
|
|
||||||
: const Text('Create Quotation'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
if (data['status'] == 'Quotation Accepted' ||
|
|
||||||
data['status'] == 'Policy Created')
|
|
||||||
Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(quotationStaffIdProvider.notifier).state = id;
|
|
||||||
context.go(AppRoutes.policy);
|
|
||||||
},
|
|
||||||
hoverColor: Color(0xFFE3F1F0),
|
|
||||||
splashColor: Color(0xFFE3F1F0),
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
||||||
child: Row(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
"assets/miscellaneous/image_2.png",
|
|
||||||
height: 15,
|
|
||||||
width: 15,
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
data['status'] == 'Policy Created'
|
|
||||||
? Text('View Policy')
|
|
||||||
: Text('Create Policy'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MainLayout(
|
return MainLayout(
|
||||||
@ -388,24 +292,6 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Tooltip(
|
|
||||||
// message: 'Back',
|
|
||||||
// child: IconButton(
|
|
||||||
// icon: const Icon(
|
|
||||||
// Icons.arrow_left_sharp,
|
|
||||||
// size: 18,
|
|
||||||
// color: Color(0xFF425B5B),
|
|
||||||
// ),
|
|
||||||
// onPressed: () {
|
|
||||||
// context.go(AppRoutes.dashboard);
|
|
||||||
// },
|
|
||||||
// splashRadius: 18,
|
|
||||||
// hoverColor: Colors.black12,
|
|
||||||
// padding: const EdgeInsets.all(4),
|
|
||||||
// constraints: const BoxConstraints(),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(width: 5), // spacing between icon and text
|
|
||||||
Text(
|
Text(
|
||||||
"Policy",
|
"Policy",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
@ -536,42 +422,6 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
// Form(
|
|
||||||
// key: _formKey,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
// children: [
|
|
||||||
// buildStartDate(context),
|
|
||||||
// SizedBox(width: 10),
|
|
||||||
// buildEndDate(context),
|
|
||||||
// SizedBox(width: 10),
|
|
||||||
//
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// vertical: 8.0,
|
|
||||||
// ),
|
|
||||||
// child: GestureDetector(
|
|
||||||
// // onTap: filterDateRange,
|
|
||||||
// onTap: () {
|
|
||||||
// if (_formKey.currentState!.validate()) {
|
|
||||||
// filterDateRange(); // only runs if valid
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: Icon(Icons.filter_alt_outlined),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: GestureDetector(
|
|
||||||
// onTap: refrshfilterDateRange,
|
|
||||||
// child: Icon(Icons.refresh),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
],
|
],
|
||||||
ResponsiveLayout.isMobile(context)
|
ResponsiveLayout.isMobile(context)
|
||||||
@ -612,53 +462,14 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
// "updated_on",
|
// "updated_on",
|
||||||
"assigned_to_name",
|
"assigned_to_name",
|
||||||
"agent_name",
|
"agent_name",
|
||||||
"insurer_name",
|
"insurer_short_name",
|
||||||
"reg_no",
|
"reg_no",
|
||||||
"insured_name",
|
"insured_name",
|
||||||
"premium_amount",
|
"premium_amount",
|
||||||
"payment_mode",
|
"payment_mode_value",
|
||||||
"policy_number",
|
"policy_number",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
// SizedBox(width: 10),
|
|
||||||
// GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// // print('Export');
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// padding: EdgeInsets.all(8.0),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Color(0xFF425B5B),
|
|
||||||
// borderRadius: BorderRadius.circular(8.0),
|
|
||||||
// ),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: [
|
|
||||||
// Icon(Icons.add, color: Colors.white),
|
|
||||||
//
|
|
||||||
// if (!ResponsiveLayout.isMobile(context)) ...[
|
|
||||||
// SizedBox(width: 10),
|
|
||||||
//
|
|
||||||
// GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// // context.go(AppRoutes.agent / create);
|
|
||||||
// context.go('/staff/create');
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// 'Create New Staff',
|
|
||||||
// style: GoogleFonts.inter(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// fontSize: 14,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -682,20 +493,20 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
child: Text('Assigned To', style: _headerStyle),
|
child: Text('Assigned To', style: _headerStyle),
|
||||||
),
|
),
|
||||||
|
|
||||||
Expanded(flex: 2, child: Text('Partner', style: _headerStyle)),
|
Expanded(flex: 3, child: Text('Partner', style: _headerStyle)),
|
||||||
Expanded(flex: 4, child: Text('Insurer', style: _headerStyle)),
|
Expanded(flex: 2, child: Text('Insurer', style: _headerStyle)),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Text('Vehicle.No.', style: _headerStyle),
|
child: Text('Vehicle.No.', style: _headerStyle),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Text('Insured Name', style: _headerStyle),
|
child: Text('Insured Name', style: _headerStyle),
|
||||||
),
|
),
|
||||||
Expanded(flex: 3, child: Text('Premium', style: _headerStyle)),
|
Expanded(flex: 2, child: Text('Premium', style: _headerStyle)),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Text('Payment Mode', style: _headerStyle),
|
child: Text('Payment Mode', style: _headerStyle),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -703,7 +514,7 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
child: Text('Policy Number', style: _headerStyle),
|
child: Text('Policy Number', style: _headerStyle),
|
||||||
),
|
),
|
||||||
|
|
||||||
Expanded(flex: 3, child: Text('Action', style: _headerStyle)),
|
Expanded(flex: 2, child: Text('Action', style: _headerStyle)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -820,21 +631,21 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
child: Text(item['assigned_to_name'] ?? '-', style: _dataBold),
|
child: Text(item['assigned_to_name'] ?? '-', style: _dataBold),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: Text(item['agent_name'] ?? '-', style: _dataBold),
|
child: Text(item['agent_name'] ?? '-', style: _dataBold),
|
||||||
),
|
),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['insurer_name'] ?? '-',
|
item['insurer_short_name'] ?? '-',
|
||||||
style: _dataBold,
|
style: _dataBold,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Text(item['reg_no'] ?? '-', style: _dataBold),
|
child: Text(item['reg_no'] ?? '-', style: _dataBold),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -847,7 +658,7 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['premium_amount'] ?? '-',
|
item['premium_amount'] ?? '-',
|
||||||
style: _dataBold,
|
style: _dataBold,
|
||||||
@ -856,9 +667,9 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['payment_mode'] ?? '-',
|
item['payment_mode_value'] ?? '-',
|
||||||
style: _dataBold,
|
style: _dataBold,
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
@ -874,7 +685,7 @@ class policylistState extends ConsumerState<policylist> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 2,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Tooltip(
|
Tooltip(
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class _CustomBarChartState extends State<CustomBarChart> {
|
|||||||
barRods: [
|
barRods: [
|
||||||
BarChartRodData(toY: value1, color: Colors.cyan.shade300, width: 6),
|
BarChartRodData(toY: value1, color: Colors.cyan.shade300, width: 6),
|
||||||
// BarChartRodData(toY: 2, color: Colors.orange.shade300, width: 6),
|
// BarChartRodData(toY: 2, color: Colors.orange.shade300, width: 6),
|
||||||
BarChartRodData(toY: value2, color: widget.shadowColor, width: 6),
|
BarChartRodData(toY: value2, color: Colors.orange.shade300, width: 6),
|
||||||
],
|
],
|
||||||
showingTooltipIndicators: touchedGroupIndex == x ? [0] : [],
|
showingTooltipIndicators: touchedGroupIndex == x ? [0] : [],
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user