Git Product home page Git Product logo

filament-daterangepicker-filter's Introduction

Filament Filter using DateRangePicker Library

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package uses daterangepciker library to filter date by a range or predefined date ranges (Today , Yesterday ...etc)

Installation

You can install the package via composer:

composer require malzariey/filament-daterangepicker-filter

You can publish the config file with:

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-daterangepicker-filter-views"

Usage

As a Field

DateRangePicker::make('created_at'),

As a Filter

DateRangeFilter::make('created_at'),

Options

                ->label('My Picker')
                ->timezone('UTC')
                //Default Start Date
                ->startDate(Carbon::now())
                //Default EndDate
                ->endDate(Carbon::now())
                ->firstDayOfWeek(1)
                ->alwaysShowCalendar(false)
                ->setTimePickerOption(true)
                ->setTimePickerIncrementOption(2)
                //No need for Apply button
                ->setAutoApplyOption(true)
                //Show two Calendars
                ->setLinkedCalendarsOption(true)
                ->disabledDates(['array of Dates'])
                ->minDate(\Carbon\Carbon::now()->subMonth())
                ->maxDate(\Carbon\Carbon::now()->addMonth())
                //Filament Date Format (PHP)
                ->displayFormat('date format')
                //Picker Date Format (Javascript)
                ->format('date format')
                //Updating Query
                ->query(
                    fn(Builder $query) => $query->whereNot('name', '=','majid')
                )
                ->withIndicator()
                ->ranges([
                    'Last 3 days' => [now()->subDays(3), now()],
                ])
                ->useRangeLabels()
                ->disableCustomRange()
                ->separator(' - ')

In Admin Panal

Light mode

DateRangePicker Widget

Dark mode

DateRangePicker Widget


Styling

If you're building a custom Filament theme, you need one more step to make the calendar theme match your custom theme.

Add this line to your resources/css/filament.css file.

@import '../../vendor/malzariey/filament-daterangepicker-filter/resources/css/filament-daterangepicker.css';

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-daterangepicker-filter's People

Contributors

malzariey avatar noxoua avatar underdpt avatar datlechin avatar dependabot[bot] avatar sairiz avatar github-actions[bot] avatar husam-tariq avatar homaeee avatar kenng avatar wit3 avatar bernhardh avatar josefbehr avatar majidalzariey avatar untillnesss avatar musaberatbahadir avatar saifallak avatar buzkall avatar lepresk avatar mliell avatar mohammedjhamad avatar

Stargazers

Borja Jiménez avatar

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.