]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/parts/library/hours.tt2
LP1778972 A slew of updates
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / 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 <div class="my-3">
13 <h3>[% l('Opening hours') %]</h3>
14
15 [%-
16     open = today _ ctx.hours.dow_0_open;
17     close = today _ ctx.hours.dow_0_close;
18     IF open == close;
19 %]
20 <div class="opening-hours">[% l('Monday: closed') %]</div>
21 [%- ELSE %]
22 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
23     l('Monday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
24      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
25 </div>
26 [%- END %]
27
28 [%-
29     open = today _ ctx.hours.dow_1_open;
30     close = today _ ctx.hours.dow_1_close;
31     IF open == close;
32 %]
33 <div class="opening-hours">[% l('Tuesday: closed') %]</div>
34 [%- ELSE %]
35 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
36     l('Tuesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
37      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
38 </div>
39 [%- END %]
40
41 [%-
42     open = today _ ctx.hours.dow_2_open;
43     close = today _ ctx.hours.dow_2_close;
44     IF open == close;
45 %]
46 <div class="opening-hours">[% l('Wednesday: closed') %]</div>
47 [%- ELSE %]
48 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
49     l('Wednesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
50      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
51 </div>
52 [%- END %]
53
54 [%-
55     open = today _ ctx.hours.dow_3_open;
56     close = today _ ctx.hours.dow_3_close;
57     IF open == close;
58 %]
59 <div class="opening-hours">[% l('Thursday: closed') %]</div>
60 [%- ELSE %]
61 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
62     l('Thursday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
63      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
64 </div>
65 [%- END %]
66
67 [%-
68     open = today _ ctx.hours.dow_4_open;
69     close = today _ ctx.hours.dow_4_close;
70     IF open == close;
71 %]
72 <div class="opening-hours">[% l('Friday: closed') %]</div>
73 [%- ELSE %]
74 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
75     l('Friday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
76      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
77 </div>
78 [%- END %]
79
80 [%-
81     open = today _ ctx.hours.dow_5_open;
82     close = today _ ctx.hours.dow_5_close;
83     IF open == close;
84 %]
85 <div class="opening-hours">[% l('Saturday: closed') %]</div>
86 [%- ELSE %]
87 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
88     l('Saturday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
89      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
90 </div>
91 [%- END %]
92
93 [%-
94     open = today _ ctx.hours.dow_6_open;
95     close = today _ ctx.hours.dow_6_close;
96     IF open == close;
97 %]
98 <div class="opening-hours">[% l('Sunday: closed') %]</div>
99 [%- ELSE %]
100 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
101     l('Sunday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
102      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>') -%]
103 </div>
104 [%- END %]
105 </div>