]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac-new/parts/library/hours.tt2
LP#1778972: (follow-up) remove a NFPL-specific template
[Evergreen.git] / Open-ILS / src / templates / opac-new / parts / library / hours.tt2
1 [%
2    UNLESS TIME_FORMAT;
3        TIME_FORMAT = '%l:%M %p';
4    END;
5
6    time_format = TIME_FORMAT;
7
8    USE date (format = time_format);
9    today = date.format(format = '%Y-%m-%d ');
10    # We need to add "today" to the opening/closing hours for Date input
11 -%]
12 <h2>[% l('Opening hours') %]</h2>
13
14 [%-
15     open = today _ ctx.hours.dow_0_open;
16     close = today _ ctx.hours.dow_0_close;
17     IF open == close;
18 %]
19 <div class="opening-hours">[% l('Monday: closed') %]</div>
20 [%- ELSE %]
21 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
22     l('Monday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
23      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
24 </div>
25 [%- END %]
26
27 [%-
28     open = today _ ctx.hours.dow_1_open;
29     close = today _ ctx.hours.dow_1_close;
30     IF open == close;
31 %]
32 <div class="opening-hours">[% l('Tuesday: closed') %]</div>
33 [%- ELSE %]
34 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
35     l('Tuesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
36      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
37 </div>
38 [%- END %]
39
40 [%-
41     open = today _ ctx.hours.dow_2_open;
42     close = today _ ctx.hours.dow_2_close;
43     IF open == close;
44 %]
45 <div class="opening-hours">[% l('Wednesday: closed') %]</div>
46 [%- ELSE %]
47 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
48     l('Wednesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
49      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
50 </div>
51 [%- END %]
52
53 [%-
54     open = today _ ctx.hours.dow_3_open;
55     close = today _ ctx.hours.dow_3_close;
56     IF open == close;
57 %]
58 <div class="opening-hours">[% l('Thursday: closed') %]</div>
59 [%- ELSE %]
60 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
61     l('Thursday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
62      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
63 </div>
64 [%- END %]
65
66 [%-
67     open = today _ ctx.hours.dow_4_open;
68     close = today _ ctx.hours.dow_4_close;
69     IF open == close;
70 %]
71 <div class="opening-hours">[% l('Friday: closed') %]</div>
72 [%- ELSE %]
73 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
74     l('Friday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
75      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
76 </div>
77 [%- END %]
78
79 [%-
80     open = today _ ctx.hours.dow_5_open;
81     close = today _ ctx.hours.dow_5_close;
82     IF open == close;
83 %]
84 <div class="opening-hours">[% l('Saturday: closed') %]</div>
85 [%- ELSE %]
86 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
87     l('Saturday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
88      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
89 </div>
90 [%- END %]
91
92 [%-
93     open = today _ ctx.hours.dow_6_open;
94     close = today _ ctx.hours.dow_6_close;
95     IF open == close;
96 %]
97 <div class="opening-hours">[% l('Sunday: closed') %]</div>
98 [%- ELSE %]
99 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
100     l('Sunday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
101      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
102 </div>
103 [%- END %]