insight-media/statamic-opening-hours 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

insight-media/statamic-opening-hours

最新稳定版本:v3.0.0

Composer 安装命令:

composer require insight-media/statamic-opening-hours

包简介

A Statamic addon to manage and display opening hours

README 文档

README


Insight Media Logo

Statamic Opening hours

Set your business' opening hours and exceptional closing times in the Statamic control panel.

Display or query the opening hours in your antler views using the provided openingHours tag.

Features

  • Adds an 'opening hours' page to the CP navigation, where you can define multiple opening hours per weekday
  • Add exceptional closing times, which override the default opening hours
  • Display the opening hours using the provided tag
  • Query for open/close status
  • Query for next/previous opening hours/closing times
  • Uses the Spatie Opening Hours package to perform queries

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require insight-media/statamic-opening-hours

Publish the optional config file.

php artisan vendor:publish --tag=statamic-google-opening-hours-config --force

How to Use

In the Statamic Control Panel

Set your business' opening hours in the Statamic control panel.

In your antlers templates

Use the openingHours tag to display or query opening hours:

Check if currently open:

{{ if {openingHours:isOpen} }}
    We are open
{{ /if }}

Check if currently closed:

{{ if {openingHours:isClosed} }}
    We are closed
{{ /if }}

Check if open on specific weekday:

{{ if {openingHours:isOpen on="tuesday"} }}
    We are open on tuesday
{{ /if }}

Check if open on specific date:

{{ if {openingHours:isOpen on="2022-12-31"} }}
    We are open on 2022-12-31
{{ /if }}

Check if open at specific time:

{{ if {openingHours:isOpen at="2022-12-31 15:00:00"} }}
    We are open on 2022-12-31 at 15:00:00
{{ /if }}

Check if closed on specific weekday:

{{ if {openingHours:isClosed on="monday"} }}
    We are closed on monday
{{ /if }}

Check if closed on specific date:

{{ if {openingHours:isClosed on="2023-01-02"} }}
    We are closed on 2023-01-02
{{ /if }}

Check if closed at specific time:

{{ if {openingHours:isClosed at="2022-12-31 22:00:00"} }}
    We are closed on 2022-12-31 at 22:00:00
{{ /if }}

Query opening times for specific weekday:

{{ openingHours:forDay day="monday" format="H:i" }} 
    <div>{{ from }}-{{ to }}</div> 
{{ /openingHours:forDay }}

Query opening times for all weekdays:

{{ openingHours:forWeek format="H:i" }}
    {{ day }}: {{ hours }} <div>{{ from }}-{{ to }}</div> {{ /hours }}<br>
{{ /openingHours:forWeek }}

Query opening times for specific date:

{{ openingHours:forDate date="2022-12-14" format="H:i" }}
    <div>{{ from }}-{{ to }}</div> 
{{ /openingHours:forDate }}

Query exceptional closing times:

{{ openingHours:exceptions format="H:i" }}
    {{ day }} {{ hours }} from {{ from }}-{{ to }} {{ /hours }} {{ if reason }}({{ reason }}){{ /if }}<br>
{{ /openingHours:exceptions }}

Get next opening times

{{ openingHours:nextOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get next closing times

{{ openingHours:nextClose date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get previous closing times

{{ openingHours:previousOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }}

Get the amount of open time (number of hours as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of open time (number of minutes as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of open time (number of seconds as a floating number) between 2 dates/times.

{{ openingHours:diffInOpenSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of closed time (number of hours as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of closed time (number of minutes as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Get the amount of minutes until opening time.

{{ openingHours:diffInClosedMinutes from="{now format='Y-m-d H:i:s'}" to="{ openingHours:nextOpen date="{now format='Y-m-d H:i:s'}" format="Y-m-d H:i:s" }" }}

Get the amount of closed time (number of seconds as a floating number) between 2 dates/times.

{{ openingHours:diffInClosedSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}

Important: We recommend using the Antlers runtime parser when working with the openingHours tag.

统计信息

  • 总下载量: 226
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-12-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固