diff --git a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart index 2eb6500..4ce49bd 100644 --- a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart +++ b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart @@ -928,27 +928,10 @@ class endosementState extends ConsumerState { // } return MouseRegion( - cursor: SystemMouseCursors.click, - // onEnter: (_) { - // setState(() { - // hoveredRowId = id; - // }); - // }, - // onExit: (_) { - // setState(() { - // hoveredRowId = null; - // }); - // }, - child: GestureDetector( - onTap: () async { - setState(() { - selectedRow = item; - // isDrawerOpen = true; - }); - - await loadEndorsementNumbers(item['id']); - }, - child: AnimatedContainer( + cursor: SystemMouseCursors.basic, + // Row-level tap gesture blocks SelectionArea text selection on web. + // Keep this container non-gesture so users can select/copy text. + child: AnimatedContainer( duration: const Duration(milliseconds: 150), padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16), @@ -1184,7 +1167,6 @@ class endosementState extends ConsumerState { ], ), ), - ), ); } diff --git a/lib/presentation/screens/payout/payout_details_view.dart b/lib/presentation/screens/payout/payout_details_view.dart index 6c15d0a..2af7fc4 100644 --- a/lib/presentation/screens/payout/payout_details_view.dart +++ b/lib/presentation/screens/payout/payout_details_view.dart @@ -211,10 +211,17 @@ class _PayOutDetailsViewState extends ConsumerState { Color? color, FontWeight? fontWeight, }) { + final displayValue = (value == null || + value.trim().isEmpty || + value.toLowerCase() == 'undefined' || + value.toLowerCase() == 'null') + ? '-' + : value; + return Expanded( flex: flex, child: Text( - value ?? '-', + displayValue, textAlign: align, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -336,7 +343,9 @@ class _PayOutDetailsViewState extends ConsumerState { height: MediaQuery.of(context).size.height * 0.7, child: const Center(child: CircularProgressIndicator()), ) - : Container( + : SelectionArea( + child: + Container( color: Colors.white, padding: const EdgeInsets.all(8), // margin: EdgeInsets.symmetric( @@ -570,6 +579,7 @@ class _PayOutDetailsViewState extends ConsumerState { ], ), ), + ), ); } } diff --git a/lib/presentation/screens/staff/policy/policy_list.dart b/lib/presentation/screens/staff/policy/policy_list.dart index 11ada37..6e141b8 100644 --- a/lib/presentation/screens/staff/policy/policy_list.dart +++ b/lib/presentation/screens/staff/policy/policy_list.dart @@ -182,6 +182,7 @@ class policylistState extends ConsumerState { // getStaffData = List>.from(response['data']); originalData = getStaffData; filteredData = List.from(originalData); + _applySearchFilter(_searchStaffController.text); // print('originalData - $getClaimPolicies'); }); } else { @@ -241,7 +242,6 @@ class policylistState extends ConsumerState { // getStaffList(managerId, userId, roleId); // print("D61 => r : $roleId | mId: $id | uId: $userId"); - _resetSearchField(); if (userId != null && managerId != null) { print('filterDateRange 1s'); print('manager - $managerId - userID -$userId - roledId -$roleId'); @@ -273,8 +273,19 @@ class policylistState extends ConsumerState { void filterData(String query) { print("FilterDAta - $query"); + _applySearchFilter(query); + } - final lowerQuery = query.toLowerCase(); + void _applySearchFilter(String query) { + final lowerQuery = query.trim().toLowerCase(); + + if (lowerQuery.isEmpty) { + setState(() { + filteredData = List.from(getStaffData); + currentPage = 1; + }); + return; + } setState(() { filteredData = getStaffData.where((item) { @@ -283,33 +294,30 @@ class policylistState extends ConsumerState { ? 'Verified' : 'Click to Verify'; - return (item['agent_name'] ?? '-').toLowerCase().contains(lowerQuery) || - (item['agent_code'] ?? '-').toLowerCase().contains(lowerQuery) || - (item['reg_no'] ?? '-').toLowerCase().contains(lowerQuery) || - (item['insurer_name'] ?? '-').toLowerCase().contains(lowerQuery) || - (item['insurer_short_name'] ?? '-').toLowerCase().contains( - lowerQuery, - ) || - (item['assigned_to_name'] ?? '-').toLowerCase().contains( - lowerQuery, - ) || - (item['insured_name'] ?? '-').toLowerCase().contains(lowerQuery) || - (item['premium_amount'] ?? '-').toLowerCase().contains( - lowerQuery, - ) || - (item['payment_mode_value'] ?? '-').toLowerCase().contains( - lowerQuery, - ) || - (_formatDate(item['updated_on']) ?? '-').toLowerCase().contains( - lowerQuery, - ) || - (item['policy_number'] ?? '-').toLowerCase().contains(lowerQuery) || + return _matchesQuery(item['agent_name'], lowerQuery) || + _matchesQuery(item['agent_code'], lowerQuery) || + _matchesQuery(item['reg_no'], lowerQuery) || + _matchesQuery(item['insurer_name'], lowerQuery) || + _matchesQuery(item['insurer_short_name'], lowerQuery) || + _matchesQuery(item['assigned_to_name'], lowerQuery) || + _matchesQuery(item['insured_name'], lowerQuery) || + _matchesQuery(item['premium_amount'], lowerQuery) || + _matchesQuery(item['payment_mode_value'], lowerQuery) || + _matchesQuery(item['payment_mode'], lowerQuery) || + _matchesQuery(_formatDate((item['updated_on'] ?? '').toString()), lowerQuery) || + _matchesQuery(item['policy_number'], lowerQuery) || // ⭐ NEW CONDITIONS for search accuracyText.toLowerCase().contains(lowerQuery); }).toList(); + currentPage = 1; }); } + bool _matchesQuery(dynamic value, String query) { + if (value == null) return false; + return value.toString().toLowerCase().contains(query); + } + final TextEditingController _searchStaffController = TextEditingController(); void _resetSearchField() {