Giter VIP home page Giter VIP logo

nova-opening-hours-field's Introduction

Nova Opening Hours Field

Latest Stable Version Total Downloads License PHP Version Require

Laravel Nova custom field for Spatie Opening Hours

Index

Screenshot Index

Form

Screenshot Form

Detail

Screenshot Detail

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require sadekd/nova-opening-hours-field

Usage

Laravel Migration

$table->json('opening_hours');  // can be ->nullable()

Laravel Model

protected $casts = [
    'opening_hours' => 'array',
];

Nova Resource

NovaOpeningHoursField::make(__('Opening Hours'), 'opening_hours'),
// ->allowExceptions(FALSE)    // TRUE by default
// ->allowOverflowMidnight(TRUE)  // FALSE by default
// ->useTextInputs(TRUE)  // FALSE by default

Known issues

  • Lazy validation on time field - losing focus when live(help needed)
  • Editing date in exceptions causes row jumping - key from date(help needed)
  • Browser time input does not support 24:00
  • Browser date input does not support recurring format

TODO

  • Explode interval input => time fields
  • Validation
  • Localization
  • Exceptions
  • Tests

License

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

nova-opening-hours-field's People

Contributors

batformat avatar crynobone avatar dmason30 avatar eimantaaas avatar m-a-k-o avatar maherelgamil avatar nembie avatar noahnxt avatar sadekd avatar tschigo avatar wasdlauterbach avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

nova-opening-hours-field's Issues

General issues

Hi, thanks for a great looking plugin.

  • How do I create new operating hours if the current data entry under operating_hours is null?
  • The Spatie plugin also allows for 'exceptions', would it be easy enough to add them here?
  • If I manually input json content as per the Spatie example, I can see the fields in Nova as per your screenshot, but changing the entry does not save / persist to the database. Is this step missing from your plugin?
    Thanks!

When adding a new interval it would be helpful if it reuses the last interval

Hi. Thank you for this great package.

A small improvement idea: When I enter business hours, I often find myself entering the same interval 5 times (because the location has the same hours from monday-friday for example). It would be a huge timesaver if, instead of adding a random open/close hour every time, it would re-use the last interval I have entered before. Maybe the last one that was entered in updateInterval() ?

Thank you for your consideration. I could also try to do a PR if you're interested? Though I never did this before :)

How to add data (description) for each day or exception?

Hi, thanks for a great looking plugin.

I'm looking for a way to customise the message of each day or exception.
In spatie documentation i found that the json structure can hold a key data

My question: is there a way to add data in definitions of day or exception?

$openingHours = OpeningHours::create([ 'monday' => [ 'data' => 'Typical Monday', '09:00-12:00', '13:00-18:00', ], 'tuesday' => [ '09:00-12:00', '13:00-18:00', [ '19:00-21:00', 'data' => 'Extra on Tuesday evening', ], ], 'exceptions' => [ '2016-12-25' => [ 'data' => 'Closed for Christmas', ], ], ]);

Sample html output?

Hi there, this looks like awesome work!

I'm not using nova or laravel, but I am using Spatie's great opening-hours repository. Would you mind uploading some sample html output of the final form?

Thanks!

It looks good but doesn't work

I installed this package but it does not work with Laravel 6 and Nova 2x, when the column is null nothing is loaded into the field.

Do you plan on updating this package?

Missing exceptions functionality

Do you plan to integrate the exceptions functionality?
https://github.com/spatie/opening-hours

$openingHours = OpeningHours::create([
    'monday'     => ['09:00-12:00', '13:00-18:00'],
    'tuesday'    => ['09:00-12:00', '13:00-18:00'],
    'wednesday'  => ['09:00-12:00'],
    'thursday'   => ['09:00-12:00', '13:00-18:00'],
    'friday'     => ['09:00-12:00', '13:00-20:00'],
    'saturday'   => ['09:00-12:00', '13:00-16:00'],
    'sunday'     => [],
    'exceptions' => [
        '2016-11-11' => ['09:00-12:00'],
        '2016-12-25' => [],
        '01-01'      => [],                // Recurring on each 1st of January
        '12-25'      => ['09:00-12:00'],   // Recurring on each 25th of December
    ],
]);

Add boolean for only on appointment

Hi!
Is it possible to add a checkbox to opening hours for setting it to only on appointment?
Some businesses have specific opening hours that are only on appointment and this would be good to integrate in the package

Kind regards

FieldServiceProvider not found

After updating from dev to 1.0.0,
automatic package discovery doesn't work.

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In ProviderRepository.php line 208:

  Class 'SadekD\NovaOpeningHoursField\FieldServiceProvider' not found

Need support for hours into the next day

Currently there is no support to say that a place, like a bar, is open until 2am. A simple solution for this would be to not bound the end time of the range to 23:59, instead allowing for things like 24:30, and for the 2am slot 26:00. We would prefer to do it this way so that we don't need to write logic in our application domain that looks for two contiguous time ranges (06:30 - 23:59 and 00:00 - 02:00) on the same day and combine those for display on the front end.

If this is something that would be merged in if we open a pull request then we would be willing to do the work required for this @sadekd.

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.