Bug 32146: Add page-section to course reserves
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / course_reserves / course-details.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE ItemTypes %]
5 [% USE Branches %]
6 [% USE TablesSettings %]
7 [% PROCESS 'i18n.inc' %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Course details for [% course.course_name | html %] &rsaquo; Course reserves &rsaquo; Koha</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% FILTER collapse %]
13     <style>
14         #instructors {
15             float: left;
16         }
17         .instructor_line {
18             padding: 0 .1em;
19         }
20         .biblio-level-info {
21             background-color: #f3f3f3;
22             border-radius:5px;
23             box-shadow: 0px 1px 1px 0px rgba(50, 50, 50, 0.2);
24             display:block;
25             font-style: italic;
26             margin: -3px 0 0 -3px;
27             padding:.5em;
28             position:absolute;
29         }
30     </style>
31 [% END %]
32 </head>
33
34 <body id="courses_course_details" class="course">
35
36 [% WRAPPER 'header.inc' %]
37     [% INCLUDE 'cat-search.inc' %]
38 [% END %]
39
40 [% WRAPPER 'sub-header.inc' %]
41 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
42     <ol>
43         <li>
44             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
45         </li>
46         <li>
47             <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a>
48         </li>
49         <li>
50             <a href="#" aria-current="page">
51                 Course details for <em>[% course.course_name | html %]</em>
52             </a>
53         </li>
54     </ol>
55 </nav>
56 [% END %]
57
58     <div class="main container-fluid">
59         <div class="row">
60             <div class="col-md-10 col-md-offset-1">
61
62             <h1>Reserves</h1>
63
64             [% IF CAN_user_coursereserves_add_reserves OR CAN_user_coursereserves_manage_courses OR CAN_user_coursereserves_manage_courses %]
65             <div id="toolbar">
66                 [% IF CAN_user_coursereserves_add_reserves %]
67                     <a class="btn btn-default" id="add_items" href="/cgi-bin/koha/course_reserves/add_items.pl?course_id=[% course.course_id | html %]"><i class="fa fa-plus"></i> Add reserves</a>
68                     <a class="btn btn-default" id="add_items" href="/cgi-bin/koha/course_reserves/batch_add_items.pl?course_id=[% course.course_id | html %]"><i class="fa fa-plus"></i> Batch add reserves</a>
69                 [% END %]
70                 [% IF CAN_user_coursereserves_delete_reserves && course_reserves %]
71                     <a class="btn btn-default" id="rm_items" href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | html %]&amp;action=rm_all"><i class="fa fa-minus"></i> Remove all reserves</a>
72                 [% END %]
73                 [% IF ( CAN_user_coursereserves_manage_courses ) %]
74                     <a class="btn btn-default" id="edit_course" href="/cgi-bin/koha/course_reserves/course.pl?course_id=[% course.course_id | html %]"><i class="fa fa-pencil"></i> Edit course</a>
75                 [% END %]
76                 [% IF ( CAN_user_coursereserves_manage_courses ) %]
77                     <a class="btn btn-default" id="delete_course" href="/cgi-bin/koha/course_reserves/mod_course.pl?course_id=[% course.course_id | html %]&amp;action=del"><i class="fa fa-trash"></i> Delete course</a>
78                 [% END %]
79             </div><!-- /toolbar -->
80             [% END %]
81
82             <div class="page-section">
83
84                 <div class="rows">
85                 <ol>
86                     <li><span class="label">Course name</span> [% course.course_name | html %]</li>
87                     <li><span class="label">[% tp('Semester', 'Term') | html %]</span> [% AuthorisedValues.GetByCode( 'TERM', course.term ) | html %]</li>
88                     <li><span class="label">Department</span> [% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) | html %]</li>
89                     <li><span class="label">Course number</span> [% course.course_number | html %]</li>
90                     <li><span class="label">Section</span> [% course.section | html %]</li>
91                     <li>
92                         <span class="label">Instructors</span>
93                         <div id="instructors">
94                             [% FOREACH i IN course.instructors %]
95                                 <div class="instructor_line">
96                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber | uri %]">[% i.firstname | html %] [% i.surname | html %]</a>
97                                 </div>
98                             [% END %]
99                         </div>
100                     </li>
101                     <li><span class="label">Staff note</span> [% course.staff_note | html %]</li>
102                     <li><span class="label">Public note</span> [% course.public_note | $raw %]</li>
103                     <li><span class="label">Student count</span> [% course.students_count | html %]</li>
104                     <li><span class="label">Status</span> [% IF course.enabled == 'yes' %]Active[% ELSE %]Inactive[% END %]</li>
105                 </ol>
106                 </div>
107             </div> <!-- /.page-section -->
108
109             [% IF course_reserves %]
110                 <div class="page-section">
111                     <table id="course_reserves_table">
112                         <thead>
113                             <tr>
114                                 <th class="anti-the">Title</th>
115                                 <th>Author</th>
116                                 <th>Barcode</th>
117                                 <th>Call number</th>
118                                 [% IF item_level_itypes %]<th>Item type</th>[% END %]
119                                 <th>Collection</th>
120                                 <th>Location</th>
121                                 <th>Home library</th>
122                                 <th>Holding library</th>
123                                 <th>Staff note</th>
124                                 <th>Public note</th>
125                                 <th>Link</th>
126                                 <th class="NoSort">Other course reserves</th>
127                                 <th>Status</th>
128                                 [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
129                                     <th class="NoSort noExport">Actions</th>
130                                 [% END %]
131                             </tr>
132                         </thead>
133
134                         <tbody>
135                             [% FOREACH cr IN course_reserves %]
136                                 <tr>
137                                     <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=cr.biblio %]</a></td>
138                                     <td>[% cr.biblio.author | html %]</td>
139
140                                     [% IF cr.item %]
141                                         <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber | uri %]&amp;biblionumber=[% cr.biblio.biblionumber | uri %]&amp;bi=[% cr.biblioitem.biblioitemnumber | uri %]">[% cr.item.barcode | html %]</a></td>
142
143
144
145                                         <td>[% cr.item.itemcallnumber | html %]</td>
146                                         [% IF item_level_itypes %]
147                                         <td>
148                                             [% IF cr.course_item.itype_enabled %]
149                                                 [% IF cr.course_item.enabled == 'yes' %]
150                                                     <strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype ) | html %]</strong>
151                                                     ([% ItemTypes.GetDescription( cr.course_item.itype_storage ) | html %])
152                                                 [% ELSE %]
153                                                     [% ItemTypes.GetDescription( cr.course_item.itype ) | html %]
154                                                     (<strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype) | html %]</strong>)
155                                                 [% END %]
156                                             [% ELSE %]
157                                                 <em>Unchanged</em>
158                                                 [% IF cr.item.itype %]
159                                                     ([% ItemTypes.GetDescription( cr.item.itype ) | html %])
160                                                 [% END %]
161                                             [% END %]
162                                         </td>
163                                         [% END %]
164                                         <td>
165                                             [% IF cr.course_item.ccode_enabled %]
166                                                 [% IF cr.course_item.enabled == 'yes' %]
167                                                 <strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>
168                                                     [% IF cr.item.ccode %]
169                                                         ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode_storage ) | html %])
170                                                     [% END %]
171                                                 [% ELSE %]
172                                                     [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode ) | html %]
173                                                     [% IF cr.item.ccode %]
174                                                         (<strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>)
175                                                     [% END %]
176                                                 [% END %]
177                                                 [% ELSE %]
178                                                     <em>Unchanged</em>
179                                                     [% IF cr.item.ccode %]
180                                                         ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %])
181                                                     [% END %]
182                                                 [% END %]
183                                             </td>
184                                             <td>
185                                                 [% IF cr.course_item.location_enabled %]
186                                                     [% IF cr.course_item.enabled == 'yes' %]
187                                                         <strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>
188                                                         [% IF cr.item.permanent_location %]
189                                                             ([% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location_storage ) | html %])
190                                                         [% END %]
191                                                 [% ELSE %]
192                                                     [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) | html %]
193                                                     [% IF cr.item.permanent_location %]
194                                                         (<strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>)
195                                                     [% END %]
196                                                 [% END %]
197                                             [% ELSE %]
198                                                 <em>Unchanged</em>
199                                                 [% IF cr.item.permanent_location %]
200                                                     ([% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %])
201                                                 [% END %]
202                                             [% END %]
203                                         </td>
204                                         <td>
205                                             [% IF cr.course_item.homebranch_enabled %]
206                                                 [% IF cr.course_item.enabled == 'yes' %]
207                                                     <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>
208                                                     [% IF cr.item.homebranch %]
209                                                         ([% Branches.GetName( cr.course_item.homebranch_storage ) | html %])
210                                                     [% END %]
211                                                 [% ELSE %]
212                                                     [% Branches.GetName( cr.course_item.homebranch ) | html %]
213                                                     [% IF cr.item.homebranch %]
214                                                         (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>)
215                                                     [% END %]
216                                                 [% END %]
217                                             [% ELSE %]
218                                                 <em>Unchanged</em>
219                                                 [% IF cr.item.homebranch %]
220                                                     ([% Branches.GetName( cr.item.homebranch ) | html %])
221                                                 [% END %]
222                                             [% END %]
223                                         </td>
224                                         <td>
225                                             [% IF cr.course_item.holdingbranch_enabled %]
226                                                 [% IF cr.course_item.enabled == 'yes' %]
227                                                     <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>
228                                                     [% IF cr.item.holdingbranch %]
229                                                         ([% Branches.GetName( cr.course_item.holdingbranch_storage ) | html %])
230                                                     [% END %]
231                                                 [% ELSE %]
232                                                     [% Branches.GetName( cr.course_item.holdingbranch ) | html %]
233                                                     [% IF cr.item.holdingbranch %]
234                                                         (<strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>)
235                                                     [% END %]
236                                                 [% END %]
237                                             [% ELSE %]
238                                                 <em>Unchanged</em>
239                                                 [% IF cr.item.holdingbranch %]
240                                                     ([% Branches.GetName( cr.item.holdingbranch ) | html %])
241                                                 [% END %]
242                                             [% END %]
243                                         </td>
244                                     [% ELSE # record-level course reserve %]
245                                         <td>
246                                             <div class="biblio-level-info">Item information is not available for record-level course reserve</div>
247                                         </td>
248                                         <td><!-- Call number --></td>
249                                         <td><!-- Item type --></td>
250                                         <td><!-- Collection --></td>
251                                         <td><!-- Location --></td>
252                                         <td><!-- Home library --></td>
253                                         <td><!-- Holding library --></td>
254                                     [% END %]
255
256                                     <td>[% IF (cr.staff_note) %]
257                                             [% cr.staff_note | html %]
258                                         [% ELSIF (cr.item.itemnotes_nonpublic) %]
259                                             [% cr.item.itemnotes_nonpublic | html %]
260                                         [% END %]
261                                     </td>
262                                     <td>[% IF (cr.public_note) %]
263                                             [% cr.public_note | $raw %]
264                                         [% ELSIF (cr.item.itemnotes) %]
265                                             [% cr.item.itemnotes | $raw %]
266                                         [% END %]
267                                     </td>
268
269                                     <td>
270                                         [% IF (cr.item.uri) %]
271                                             <a href="[% cr.item.uri | url %]">Item URI</a>
272                                         [% ELSIF (cr.biblioitem.url) %]
273                                             <a href="[% cr.biblioitem.url | url %]">Record URL</a>
274                                         [% END %]
275                                     </td>
276
277                                     <td>
278                                         [% FOREACH c IN cr.courses %]
279                                             [% UNLESS cr.course_id == c.course_id %]
280                                                 <p>
281                                                     <a href="course-details.pl?course_id=[% c.course_id | uri %]">
282                                                         [% c.course_name | html %]
283                                                         [% IF c.section %] [% c.section | html %] [% END %]
284                                                         [% IF c.term %] [% AuthorisedValues.GetByCode( 'TERM', c.term ) | html %] [% END %]
285                                                     </a>
286                                                 </p>
287                                             [% END %]
288                                         [% END %]
289                                     </td>
290
291                                     <td class="status">
292                                         <span>
293                                         [% IF cr.item.onloan %]
294                                             <span>Checked out</span>
295                                         [% ELSE %]
296                                             <span>Available</span>
297                                         [% END %]
298                                         </span>
299                                     </td>
300
301                                     [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
302                                         <td class="actions">
303                                             [% IF CAN_user_coursereserves_add_reserves %]
304                                                 <a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id | html %]&amp;itemnumber=[% cr.item.itemnumber | html %]&amp;biblionumber=[% cr.biblio.biblionumber | html %]&amp;action=lookup&amp;return=[% course.course_id | html %]&amp;is_edit=1"><i class="fa fa-pencil"></i> Edit</a>
305                                             [% END %]
306
307                                             [% IF CAN_user_coursereserves_delete_reserves %]
308                                                 <a class="btn btn-default btn-xs delete_item" href="course-details.pl?course_id=[% course.course_id | html %]&amp;action=del_reserve&amp;cr_id=[% cr.cr_id | html %]">
309                                                 <i class="fa fa-trash"></i> Remove</a>
310                                             [% END %]
311                                         </td>
312                                     [% END %]
313
314                                 </tr>
315                             [% END %]
316                         </tbody>
317                     </table>
318                 </div> <!-- /.page-section -->
319             [% END %]
320         </div>
321     </div>
322
323 [% MACRO jsinclude BLOCK %]
324     [% INCLUDE 'datatables.inc' %]
325     [% INCLUDE 'columns_settings.inc' %]
326     <script>
327         var table_settings = [% TablesSettings.GetTableSettings( 'coursereserves', 'reserves', 'course_reserves_table', 'json' ) | $raw %];
328         $(document).ready(function(){
329             var rtable = KohaTable("course_reserves_table", {
330                 "sPaginationType": "full",
331                 "bAutoWidth": false,
332             }, table_settings );
333
334             $(".delete_item").click(function(){
335                 return confirmDelete(_("Are you sure you want to remove this item from the course?"));
336             });
337
338             $("#rm_items").click(function(){
339                 return confirmDelete(_("Are you sure you want to remove all items from the course?"));
340             });
341
342             $("#delete_course").click(function(){
343                 [% SET count = course_reserves.size || 0 %]
344                 [% IF count == 1 %]
345                     return confirmDelete(_("Are you sure you want to delete this course? There is %s attached item.").format([% count | html %]) );
346                 [% ELSIF count > 1 %]
347                     return confirmDelete(_("Are you sure you want to delete this course? There are %s attached items.").format([% count | html %]) );
348                 [% ELSE %]
349                     return confirmDelete(_("Are you sure you want to delete this course?"));
350                 [% END %]
351             });
352             $(".disabled").tooltip().on("click", function(e){
353                 e.preventDefault();
354                 if( $(this).hasClass("checkedout") ){
355                     alert(_("This item cannot be removed. It is checked out"));
356                 }
357             });
358         });
359     </script>
360 [% END %]
361
362 [% INCLUDE 'intranet-bottom.inc' %]