382eddfc89011082423c44d8cfd5f452e318538e
[evergreen-equinox.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     note = ctx.hours.dow_0_note;
19     IF open == close;
20 %]
21 <div class="opening-hours">[% l('Monday: closed') %]</div>
22 [%- ELSE %]
23 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday" />[%
24     l('Monday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
25      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
26 -%]
27 [% IF ctx.hours.dow_0_note %]
28     <span>[%l('(' _ note _ ')')%]</span>
29 [% END -%]
30 </div>
31 [%- END %]
32
33 [%-
34     open = today _ ctx.hours.dow_1_open;
35     close = today _ ctx.hours.dow_1_close;
36     note = ctx.hours.dow_1_note;
37     IF open == close;
38 %]
39 <div class="opening-hours">[% l('Tuesday: closed') %]</div>
40 [%- ELSE %]
41 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday" />[%
42     l('Tuesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
43      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
44 -%]
45 [% IF ctx.hours.dow_1_note %]
46     <span>[%l('(' _ note _ ')')%]</span>
47 [% END -%]
48 </div>
49 [%- END %]
50
51 [%-
52     open = today _ ctx.hours.dow_2_open;
53     close = today _ ctx.hours.dow_2_close;
54     note = ctx.hours.dow_2_note;
55     IF open == close;
56 %]
57 <div class="opening-hours">[% l('Wednesday: closed') %]</div>
58 [%- ELSE %]
59 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday" />[%
60     l('Wednesday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
61      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
62 -%]
63 [% IF ctx.hours.dow_2_note %]
64     <span>[%l('(' _ note _ ')')%]</span>
65 [% END -%]
66 </div>
67 [%- END %]
68
69 [%-
70     open = today _ ctx.hours.dow_3_open;
71     close = today _ ctx.hours.dow_3_close;
72     note = ctx.hours.dow_3_note;
73     IF open == close;
74 %]
75 <div class="opening-hours">[% l('Thursday: closed') %]</div>
76 [%- ELSE %]
77 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday" />[%
78     l('Thursday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
79      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
80 -%]
81 [% IF ctx.hours.dow_3_note %]
82     <span>[%l('(' _ note _ ')')%]</span>
83 [% END -%]
84 </div>
85 [%- END %]
86
87 [%-
88     open = today _ ctx.hours.dow_4_open;
89     close = today _ ctx.hours.dow_4_close;
90     note = ctx.hours.dow_4_note;
91     IF open == close;
92 %]
93 <div class="opening-hours">[% l('Friday: closed') %]</div>
94 [%- ELSE %]
95 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday" />[%
96     l('Friday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
97      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
98 -%]
99 [% IF ctx.hours.dow_4_note %]
100     <span>[%l('(' _ note _ ')')%]</span>
101 [% END -%]
102 </div>
103 [%- END %]
104
105 [%-
106     open = today _ ctx.hours.dow_5_open;
107     close = today _ ctx.hours.dow_5_close;
108     note = ctx.hours.dow_5_note;
109     IF open == close;
110 %]
111 <div class="opening-hours">[% l('Saturday: closed') %]</div>
112 [%- ELSE %]
113 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday" />[%
114     l('Saturday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
115      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
116 -%]
117 [% IF ctx.hours.dow_5_note %]
118     <span>[%l('(' _ note _ ')')%]</span>
119 [% END -%]
120 </div>
121 [%- END %]
122
123 [%-
124     open = today _ ctx.hours.dow_6_open;
125     close = today _ ctx.hours.dow_6_close;
126     note = ctx.hours.dow_6_note;
127     IF open == close;
128 %]
129 <div class="opening-hours">[% l('Sunday: closed') %]</div>
130 [%- ELSE %]
131 <div class="opening-hours" property="openingHoursSpecification" typeof="OpeningHoursSpecification"><link property="dayOfWeek" href="http://purl.org/goodrelations/v1#Sunday" />[%
132     l('Sunday: [_1] - [_2]', '<time property="opens" content="' _ date.format(open, format => '%H:%M:%S') _ '">' _ date.format(open) _ '</time>',
133      '<time property="closes" content="' _ date.format(close, format => '%H:%M:%S') _ '">' _ date.format(close) _ '</time>')
134 -%]
135 [% IF ctx.hours.dow_6_note %]
136     <span>[%l('(' _ note _ ')')%]</span>
137 [% END -%]
138 </div>
139 [%- END %]
140 </div>