pos-lifestyle / laravel-nova-date-range-filter Goto Github PK
View Code? Open in Web Editor NEWA Laravel Nova date range filter.
License: MIT License
A Laravel Nova date range filter.
License: MIT License
Composer 2.x won't autoload part of the package because the enums
folder is not capitalized:
Class PosLifestyle\DateRangeFilter\Enums\Config located in ./vendor/pos-lifestyle/laravel-nova-date-range-filter/src/enums/Config.php does not comply with psr-4 autoloading standard. Skipping.
This is mostly a docs issue, but it might be nice to have an automated way of handling it. If you have a set of resources generated from some custom query in Nova, it's possible that the date column that this plugin uses might be ambiguous because it is not qualified with the table name. For example if you add the filter like this:
new DateRangeFilter('Updated', Model::UPDATED_AT),
and you have more than one table with an updated_at
field in the selection, you'll get an integrity constraint exception. The workaround is simple: prefix the column name with a table qualifier when you add the filter:
new DateRangeFilter('Updated', 'posts.' . Model::UPDATED_AT),
I've not yet figured out a way to get hold of this table name automatically because we are in a static situation, but the table name for a model is dynamic, and we can't do something like self::$model->table
to get hold of it.
Hi,
There is a bug that I do not understand why, but it inserts the database field to the class of the filter when sending over the filter to Square1\NovaMetrics\Custom*.
Solved by hardcoding the filter to:
if ($filter->class === 'PosLifestyle\DateRangeFilter\DateRangeFilter_created_at') { // BUG, WHY???
$filter->class = 'PosLifestyle\DateRangeFilter\DateRangeFilter';
}
When below configuration is set the time should display on both months not a single time for both months
Config::SHOW_MONTHS => 2,
Config::ENABLE_TIME => true,
Please change laravel/framework dependency
Unlike the rest of nova fields, this filter allows configuration only from the constructor. This makes it difficult to modify the behavior of say an extended child class to add additional features that don't really fit. While it can be done, it's kind of ugly as you have to modify the internal config array.
Would you be open to changes that allow configuration via chainable methods instead of (or in addition to) the constructor config?
For example, instead of setting the default date range via the config constructor param, it could be called instead like:
(new DateRangeFilter())
->withDefaultRange('90 days ago, 'today')
That example takes it a step further and allows variable date ranging as well based on carbon parsing, but you get the idea for allowing configuration in a bit clearer way.
Maybe just remove your laravel row in the require
of your composer.json
. Its not necessary I think.
after select range date ,
make reset filters from nova ,
your filter didn't make clear of selected dates
When a user already has a range selected, and then attempts to change the range, but clicks off the datepicker before picking the "end date" for the range, the field in the filter just shows the placeholder and the originally selected date range is lost and unknowable after that point.
Ideally it would put back the old selected range so that even if the user doesn't pick a new range, it still lines up with the data in the view.
I am getting the following error, when trying to require (need to upgrade to php8):
require pos-lifestyle/laravel-nova-date-range-filter 1.3.3 -> satisfiable by pos-lifestyle/laravel-nova-date-range-filter[1.3.3] from composer repo (https://repo.packagist.org) but pos-lifestyle/laravel-nova-date-range-filter[dev-upgrade-to-laravel-8, dev-master, dev-bugfix/psr-4, 1.0.0, ..., 1.3.0] from vcs repo (github https://github.com/niekbr/laravel-nova-date-range-filter) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance
Can you please change the priority?
Hi,
nice package, only problem is, font awesome ist not loading, console gives 404
best regards
Denis
Hi, created an initial nova-4 branch, its not fully so i'm waiting with the PR. Putting this here so everyone can try.
https://github.com/sp4r74cus/laravel-nova-date-range-filter/tree/nova-4
Please change laravel/framework dependency to ">=5.8" unless not compatible with Laravel 9.
I supposed there is a typo in composer, ad php version should be >=7.1
rather then ^7.1
- it dosn't work with php8 now :)
It would be nice if laravel 7 would be supported
There is a problem when the Laravel configuration uses UTC by default and the frontend displays data in some other timezone.
As a general rule, using UTC in the backend is fine due to a whole lot of integrations in the monitoring system, but the lack of option to adjust the filter accordingly causes problems when the records being shown include dates outside the selected range.
To be clear, if we consider all date/time in UTC, there is no bug! The problem resides in the fact all data is being displayed in UTC-4 and the filter selects data outside the intended range...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.