Skip to content

filtro por ubicación en cargas#205

Merged
vide merged 2 commits intomainfrom
feat/filter-charges-by-geofence
Mar 21, 2026
Merged

filtro por ubicación en cargas#205
vide merged 2 commits intomainfrom
feat/filter-charges-by-geofence

Conversation

@MARMdeveloper
Copy link
Collaborator

Summary

Implements location-based filtering in the Charges screen, as requested in #203.

Charges can now be filtered by location (address/geofence) using a dropdown placed
to the right of the AC/DC type filter chips. The filter supports multi-selection and
free-text search, and correctly updates the Summary card and bar charts alongside the
charge list.

Changes

ChargesViewModel.kt

  • Added availableLocations: List<String> and selectedLocations: Set<String> to ChargesUiState
  • Added setLocationFilter(location: String) — toggles a location in/out of the active selection
  • Added clearLocationFilter() — resets the location selection
  • applyFiltersAndUpdateState() now applies the location filter to the charge list, summary
    calculation and chart data so all three stay in sync

ChargesScreen.kt

  • Added LocationFilterDropdown composable — a FilterChip that opens a DropdownMenu with:
    • Free-text search field to narrow down the list
    • Per-item checkmark indicating current selection
    • Menu stays open after each selection to allow multi-select
    • Clear button on the chip when one or more locations are active
    • Chip label shows the location name (1 selected), count ("N ubicaciones"), or a generic
      label when nothing is selected
  • ChargesContent updated to accept selectedLocations, onLocationFilterToggled and
    onLocationFilterCleared parameters
  • ChargeTypeFilterChips updated to accept an optional modifier parameter so it can
    participate in the Row layout alongside the new dropdown

res/values/strings.xml

  • Added filter_location
  • Added search

closes #203

@MARMdeveloper MARMdeveloper linked an issue Mar 19, 2026 that may be closed by this pull request
@vide vide force-pushed the feat/filter-charges-by-geofence branch from 65fdb07 to 86e1023 Compare March 20, 2026 11:31
@vide vide force-pushed the feat/filter-charges-by-geofence branch from 86e1023 to 9ede7d1 Compare March 21, 2026 09:46
DropdownMenu uses surfaceContainer for its background. Without it
explicitly defined, Material3 auto-generates a color that clashes
with the app's neutral grey palette.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Owner

@vide vide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@vide vide merged commit 25e9d37 into main Mar 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtrar por geofence en el panel de cargas

2 participants