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