-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 812b29a
Showing
27 changed files
with
802 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: TappNetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Bug Report | ||
description: Report an Issue or Bug with the Package | ||
title: "[Bug]: " | ||
labels: ["bug"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
We're sorry to hear you have a problem. Can you help us solve it by providing the following details. | ||
- type: textarea | ||
id: what-happened | ||
attributes: | ||
label: What happened? | ||
description: What did you expect to happen? | ||
placeholder: I cannot currently do X thing because when I do, it breaks X thing. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: how-to-reproduce | ||
attributes: | ||
label: How to reproduce the bug | ||
description: How did this occur, please add any config values used and provide a set of reliable steps if possible. | ||
placeholder: When I do X I see Y. | ||
validations: | ||
required: true | ||
- type: input | ||
id: package-version | ||
attributes: | ||
label: Package Version | ||
description: What version of our Package are you running? Please be as specific as possible | ||
placeholder: 2.0.0 | ||
validations: | ||
required: true | ||
- type: input | ||
id: php-version | ||
attributes: | ||
label: PHP Version | ||
description: What version of PHP are you running? Please be as specific as possible | ||
placeholder: 8.2.0 | ||
validations: | ||
required: true | ||
- type: input | ||
id: laravel-version | ||
attributes: | ||
label: Laravel Version | ||
description: What version of Laravel are you running? Please be as specific as possible | ||
placeholder: 9.0.0 | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: operating-systems | ||
attributes: | ||
label: Which operating systems does with happen with? | ||
description: You may select more than one. | ||
multiple: true | ||
options: | ||
- macOS | ||
- Windows | ||
- Linux | ||
- type: textarea | ||
id: notes | ||
attributes: | ||
label: Notes | ||
description: Use this field to provide any other notes that you feel might be relevant to the issue. | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Ask a question | ||
url: https://github.com/TappNetwork/filament-value-range-filter/discussions/new?category=q-a | ||
about: Ask the community for help | ||
- name: Request a feature | ||
url: https://github.com/TappNetwork/filament-value-range-filter/discussions/new?category=ideas | ||
about: Share ideas for new features | ||
- name: Report a security issue | ||
url: https://github.com/TappNetwork/filament-value-range-filter/security/policy | ||
about: Learn how to notify us for sensitive bugs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
labels: | ||
- "dependencies" | ||
|
||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
labels: | ||
- "dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: dependabot-auto-merge | ||
on: pull_request_target | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
|
||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Auto-merge Dependabot PRs for semver-minor updates | ||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Auto-merge Dependabot PRs for semver-patch updates | ||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: PHP Linting (Pint) | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches-ignore: | ||
- 'dependabot/npm_and_yarn/*' | ||
jobs: | ||
phplint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: "laravel-pint" | ||
uses: aglipanci/[email protected] | ||
with: | ||
preset: laravel | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: PHP Linting (Pint) | ||
skip_fetch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: run-tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.php' | ||
- '.github/workflows/run-tests.yml' | ||
- 'phpunit.xml.dist' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.3, 8.2] | ||
laravel: [10.*] | ||
stability: [prefer-lowest, prefer-stable] | ||
include: | ||
- laravel: 10.* | ||
testbench: 8.* | ||
carbon: ^2.63 | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | ||
coverage: none | ||
|
||
- name: Setup problem matchers | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update | ||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
- name: List Installed Dependencies | ||
run: composer show -D | ||
|
||
- name: Execute tests | ||
run: vendor/bin/pest --ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: 'Update Changelog' | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.target_commitish }} | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.name }} | ||
release-notes: ${{ github.event.release.body }} | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: ${{ github.event.release.target_commitish }} | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/node_modules | ||
/vendor | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
/.vscode | ||
/build | ||
/coverage | ||
.DS_Store | ||
composer.phar | ||
phpunit.xml | ||
phpstan.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
All notable changes to the "Filament Value Range Filter" will be documented in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Filament Value Range Filter | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/tapp/filament-value-range-filter.svg?style=flat-square)](https://packagist.org/packages/tapp/filament-value-range-filter) | ||
![Code Style Action Status](https://github.com/TappNetwork/filament-value-range-filter/actions/workflows/pint.yml/badge.svg) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/tapp/filament-value-range-filter.svg?style=flat-square)](https://packagist.org/packages/tapp/filament-value-range-filter) | ||
|
||
A value range filter for Laravel Filament. | ||
|
||
## Installation | ||
|
||
```bash | ||
composer require tapp/filament-value-range-filter | ||
``` | ||
|
||
Optionally, you can publish the translations files with: | ||
|
||
```bash | ||
php artisan vendor:publish --tag="filament-value-range-filter-translations" | ||
``` | ||
|
||
## Appareance | ||
|
||
![Filament Value Range Filters](https://raw.githubusercontent.com/TappNetwork/filament-value-range-filter/main/docs/filters.png) | ||
|
||
![Filament Value Range Filter Between Indicator](https://raw.githubusercontent.com/TappNetwork/filament-value-range-filter/main/docs/filter_indicator.png) | ||
|
||
![Filament Value Range Filter Options](https://raw.githubusercontent.com/TappNetwork/filament-value-range-filter/main/docs/filter_range_options.png) | ||
|
||
## Usage | ||
|
||
### Filter | ||
|
||
Add to your Filament resource: | ||
|
||
```php | ||
use Tapp\FilamentValueRangeFilter\Filters\ValueRangeFilter; | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
//... | ||
->filters([ | ||
ValueRangeFilter::make('project_value') | ||
->currency(), | ||
ValueRangeFilter::make('estimated_hours'), | ||
// ... | ||
]) | ||
} | ||
``` | ||
|
||
### Options | ||
|
||
#### Currency | ||
|
||
You may use the `->currency()` method to format the values on placeholder and filter indicator as currency. The default currency format is `USD`. | ||
|
||
```php | ||
ValueRangeFilter::make('project_value') | ||
->currency(), | ||
``` | ||
|
||
**Change the currency format** | ||
|
||
The `->currencyCode()` and `->locale()` methods can be used to change the currency format. | ||
You can pass one of the [ISO 4217 currency codes](https://www.iban.com/currency-codes) to the `->currencyCode()` method. | ||
|
||
```php | ||
ValueRangeFilter::make('project_value') | ||
->currency() | ||
->currencyCode('EUR') | ||
->locale('fr'), | ||
``` | ||
|
||
![Filament Value Range Filter Between currency in EUR](https://raw.githubusercontent.com/TappNetwork/filament-value-range-filter/main/docs/between_eur.png) | ||
|
||
![Filament Value Range Filter Between currency in EUR Indicator](https://raw.githubusercontent.com/TappNetwork/filament-value-range-filter/main/docs/filter_indicator_eur.png) | ||
|
||
**Currency value** | ||
|
||
When using currency values, the filter assumes that the value stored on database that will be compared with the provided value on filter is in the smallest unit of the currency (e.g., cents for USD). Therefore, the value provided in the filter is by default multiplied by 100 to be compared with the value stored in the database. | ||
|
||
If the values stored in your database are not in the currency's smallest unit and you do not need the value provided in the filter to be multiplied by 100, pass 'false' to the `->currencyInSmallestUnit()` method: | ||
|
||
```php | ||
ValueRangeFilter::make('project_value') | ||
->currency() | ||
->currencyInSmallestUnit(false), | ||
``` |
Oops, something went wrong.