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