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