Code Monkey home page Code Monkey logo

laravel-nova-date-range-filter's People

Contributors

cyruscollier avatar jcsoriano avatar jhae-de avatar niekbr avatar schroedan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laravel-nova-date-range-filter's Issues

PSR-4 compliance

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.

Date column name is unqualified by default

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.

Bug inserting database field name to filter class in request

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';
            }

Display time on both months

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,

Unable to chain methods for configuration options

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.

Support of Laravel 8

Maybe just remove your laravel row in the require of your composer.json. Its not necessary I think.

Bad UX when user selects only 1 date after previous range selected

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.

Can't upgrade to 1.3.3 because of package priority

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?

font awesome is not loaded

Hi,

nice package, only problem is, font awesome ist not loading, console gives 404

best regards
Denis

Nova 4 support

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

  • Nova 4 requires PHP 8 and Laravel 8 so this could not replace the Nova 3 filter.
  • Nova 4 filters automatically focus the first filter, which cause the calendar to open (annoying and out of position) so i added a hidden input to steal the focus.
  • 2 months options breaks the responsive layout on smaller screens.

Screen Shot 2022-04-06 at 18 07 03

[BUG] Filter reset behaviour

  1. Resetting all Nova filters doesn't clear the display value.
  2. Pressing the clear button in the input doesn't trigger Nova filter reset so filter icon remains blue as if still selected
  3. Font awesome not working

Laravel 9 Compatibility

Please change laravel/framework dependency to ">=5.8" unless not compatible with Laravel 9.

Is that works with php8?

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 :)

Select which timezone to use

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.