Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean/Toggle Filter #1830

Merged
merged 19 commits into from
Aug 8, 2024
Merged

Conversation

lrljoe
Copy link
Collaborator

@lrljoe lrljoe commented Aug 7, 2024

This PR does two things

  1. Cleans up missing tags from Docs
  2. Adds a BooleanFilter (see below)

Beta

This is currently in beta, and will only work with Tailwind.

Details

The BooleanFilter is designed so that you can toggle a more complex query/filter, as opposed to being a yes/no type of filter (which is what the SelectFilter is perfect for)

For example, your filter may look like this, toggling the filter from true to false would apply/not apply a more complex query to the query.

    BooleanFilter::make('Limit to Older Enabled Users')
    ->filter(function (Builder $builder, bool $enabled) {
        if ($enabled)
        {
            $builder->where('status',true)->where('age', '>', 60);
        }
    })

Many of the standard methods are available, for example

    BooleanFilter::make('Limit to Older Enabled Users')
    ->filter(function (Builder $builder, bool $enabled) {
        if ($enabled)
        {
            $builder->where('status',true)->where('age', '>', 60);
        }
    })
    ->setFilterPillValues([
        true => 'Active',
        false => 'Inactive',
    ])
    ->setFilterDefaultValue(true)

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests and did you add any new tests needed for your feature?
  2. Did you update all templates (if applicable)?
  3. Did you add the relevant documentation (if applicable)?
  4. Did you test locally to make sure your feature works as intended?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@lrljoe lrljoe self-assigned this Aug 7, 2024
@lrljoe lrljoe marked this pull request as draft August 7, 2024 23:15
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.60%. Comparing base (40485a0) to head (8407740).
Report is 40 commits behind head on development.

Files Patch % Lines
src/Views/Filters/BooleanFilter.php 80.00% 2 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             development    #1830      +/-   ##
=================================================
+ Coverage          87.14%   88.60%   +1.46%     
- Complexity          1495     1610     +115     
=================================================
  Files                139      150      +11     
  Lines               3484     3747     +263     
=================================================
+ Hits                3036     3320     +284     
+ Misses               448      427      -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lrljoe lrljoe marked this pull request as ready for review August 8, 2024 01:59
@lrljoe lrljoe merged commit 155743f into rappasoft:development Aug 8, 2024
7 checks passed
lrljoe added a commit that referenced this pull request Aug 8, 2024
## [v3.4.3] - 2024-08-08
### New Features
- Boolean/Toggle Filter by @lrljoe in #1830

### Bug Fixes
- View component column fixes by @lrljoe in #1825

### Docs
- Update setDelaySelectAllEnabled Docs by @lrljoe in #1829
- ViewComponentColumn - New method docs by @lrljoe in #1828
lrljoe added a commit that referenced this pull request Aug 10, 2024
## [v3.4.4] - 2024-08-10
### New Features
- Boolean/Toggle Filter by @lrljoe in #1830

### Bug Fixes
- Merge Column Attributes Back in if Sortable by @lrljoe in #1833

### Tweaks
- Moving JS to Simplified Method in datatable  by @lrljoe in #1832
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.

1 participant