Bug 27936: Clarify AllowItemsOnHoldCheckoutSIP syspref help text
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / library_groups.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaSpan %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; Library groups</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
9 </head>
10
11 <body id="admin_library_groups" class="admin">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
14
15 <div id="breadcrumbs">
16     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17     &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
18     &rsaquo; <a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a>
19 </div>
20
21 [% FOR m IN messages %]
22     <div class="dialog [% m.type | html %]">
23         [% SWITCH m.code %]
24         [% CASE 'error_on_insert' %]
25             An error occurred when adding this library. The library id might already exist in this group.
26         [% CASE %]
27             [% m.code | html %]
28         [% END %]
29     </div>
30 [% END %]
31
32 [% IF added %]
33     <div class="dialog message group-added">
34         [% IF added.branchcode %]
35             [% added.library.branchname | $KohaSpan class = 'name' | $raw %] added to group.
36         [% ELSE %]
37             Group [% added.title | $KohaSpan class = 'name' | $raw %] created.
38         [% END %]
39     </div>
40 [% ELSIF deleted %]
41     <div class="dialog message group-deleted">
42         [% IF deleted.title %]
43             Group [% deleted.title | $KohaSpan class = 'name' | $raw %] has been deleted.
44         [% ELSE %]
45             [% deleted.library | $KohaSpan class = 'name' | $raw %] has been removed from group.
46         [% END %]
47     </div>
48 [% ELSIF error_duplicate_title %]
49     <div class="dialog alert error-duplicate-group-title">
50             A group with the title [% error_duplicate_title | $KohaSpan class = 'name' | $raw %] already exists.
51     </div>
52 [% END %]
53
54 <div class="main container-fluid">
55     <div class="row">
56         <div class="col-sm-10 col-sm-push-2">
57             <main>
58
59                     <div id="toolbar" class="btn-toolbar">
60                         <div class="btn-group">
61                             <a id="add-group-root" class="btn btn-default add-group" href="#">
62                                 <i class="fa fa-plus"></i> Add group
63                             </a>
64                         </div>
65                     </div>
66
67                 <h2>Library groups</h2>
68
69                 [% FOREACH root_group IN root_groups %]
70                     <table class="library-groups">
71                         <tr>
72                             <th>&nbsp;</th>
73                             <th>Description</th>
74                             <th>Features enabled</th>
75                             <th>&nbsp;</th>
76                         </tr>
77                         [% PROCESS tree group=root_group %]
78                     </table>
79                 [% END %]
80
81             </main>
82         </div> <!-- /.col-sm-10.col-sm-push-2 -->
83
84         <div class="col-sm-2 col-sm-pull-10">
85             <aside>
86                 [% INCLUDE 'admin-menu.inc' %]
87             </aside>
88         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
89     </div> <!-- /.row -->
90
91     <div id="add-group-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="add-group-modal-label" aria-hidden="true">
92         <form id="add-group-form" action="/cgi-bin/koha/admin/library_groups.pl" class="form-horizontal">
93             <div class="modal-dialog">
94                 <div class="modal-content">
95                     <div class="modal-header">
96                         <h3 id="add-group-modal-label">Add group</h3>
97                     </div>
98                     <div class="modal-body">
99                         <fieldset class="rows">
100                             <input type="hidden" id="add-group-modal-parent-id" name="parent_id" value="" />
101                             <input type="hidden" id="add-group-modal-action" name="action" value="add">
102                             <ol>
103                                 <li>
104                                     <label for="add-group-modal-title">Title: </label>
105                                     <input type="text" size="40" maxlength="100" name="title" id="add-group-modal-title" required="required" />
106                                     <span class="required">Required</span>
107                                     <div class="hint">Displayed in the library group search dropdowns.</div>
108                                 </li>
109                                 <li>
110                                     <label for="add-group-modal-description">Description: </label>
111                                     <input type="text" size="40" name="description" id="add-group-modal-description" />
112                                 </li>
113                             </ol>
114                         </fieldset>
115                         <div id="root-group-features-add">
116                             <h3>Features</h3>
117                             <div class="checkbox">
118                                 <p>
119                                     <label>
120                                         <input type="checkbox" name="ft_hide_patron_info" id="add-group-modal-ft_hide_patron_info" value="1" />
121                                         Limit patron data access by group
122                                     </label>
123                                 </p>
124                                 <p>
125                                     <label>
126                                         <input type="checkbox" name="ft_search_groups_opac" id="add-group-modal-ft_search_groups_opac" value="1" />
127                                         Use for OPAC search groups
128                                     </label>
129                                 </p>
130                                 <p>
131                                     <label>
132                                         <input type="checkbox" name="ft_search_groups_staff" id="add-group-modal-ft_search_groups_staff" value="1" />
133                                         Use for staff search groups
134                                     </label>
135                                 </p>
136                                 <p>
137                                     <label>
138                                         <input type="checkbox" name="ft_local_hold_group" id="add-group-modal-ft_local_hold_group" value="1" />
139                                         Is local hold group
140                                     </label>
141                                 </p>
142                             </div>
143                         </div>
144                     </div>
145                     <div class="modal-footer">
146                         <button type="submit" class="btn btn-default">Save</button>
147                         <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
148                     </div>
149                 </div>
150             </div>
151         </form>
152     </div>
153
154     <div id="edit-group-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="edit-group-modal-label" aria-hidden="true">
155         <form id="edit-group-form" action="/cgi-bin/koha/admin/library_groups.pl" class="form-horizontal">
156             <div class="modal-dialog">
157                 <div class="modal-content">
158                     <div class="modal-header">
159                         <h3 id="edit-group-modal-label">Edit group</h3>
160                     </div>
161                     <div class="modal-body">
162                         <input type="hidden" id="edit-group-modal-id" name="id" value="" />
163                         <input type="hidden" id="edit-group-modal-action" name="action" value="edit" />
164                         <fieldset class="rows">
165                             <ol>
166                                 <li>
167                                     <label for="edit-group-modal-title">Title: </label>
168                                     <input type="text" size="40" maxlength="100" id="edit-group-modal-title" name="title" value="" required="required" />
169                                     <span class="required">Required</span>
170                                     <div class="hint">Displayed in the library group search dropdowns.</div>
171                                 </li>
172
173                                 <li>
174                                     <label for="edit-group-modal-description">Description: </label>
175                                     <input type="text" size="40" id="edit-group-modal-description" name="description" value="" />
176                                 </li>
177                             </ol>
178                         </fieldset>
179                         <div id="root-group-features-edit">
180                             <h3>Features</h3>
181                             <div class="checkbox">
182                                 <p>
183                                     <label>
184                                         <input type="checkbox" id="edit-group-modal-ft_hide_patron_info" name="ft_hide_patron_info" value="1" />
185                                         Limit patron data access by group
186                                     </label>
187                                 </p>
188                                 <p>
189                                     <label>
190                                         <input type="checkbox" id="edit-group-modal-ft_search_groups_opac" name="ft_search_groups_opac" value="1" />
191                                         Use for OPAC search groups
192                                     </label>
193                                 </p>
194                                 <p>
195                                     <label>
196                                         <input type="checkbox" id="edit-group-modal-ft_search_groups_staff" name="ft_search_groups_staff" value="1" />
197                                         Use for staff search groups
198                                     </label>
199                                 </p>
200                                 <p>
201                                     <label>
202                                         <input type="checkbox" id="edit-group-modal-ft_local_hold_group" name="ft_local_hold_group" value="1" />
203                                         Is local hold group
204                                     </label>
205                                 </p>
206                             </div>
207                         </div>
208                     </div>
209                     <div class="modal-footer">
210                         <button type="submit" class="btn btn-default">Update</button>
211                         <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
212                     </div>
213                 </div>
214             </div>
215         </form>
216     </div>
217
218     <div id="delete-group-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete-group-modal-label" aria-hidden="true">
219         <form action="/cgi-bin/koha/admin/library_groups.pl">
220             <div class="modal-dialog">
221                 <div class="modal-content">
222                     <input id="delete-group-modal-action" type="hidden" name="action" value="delete" />
223                     <input id="delete-group-modal-id" type="hidden" name="id" value="" />
224                     <div class="modal-header">
225                         <h3 id="delete-group-modal-label">Delete group</h3>
226                     </div>
227                     <div class="modal-body">
228                         Are you sure you want to delete <span id="delete-group-modal-title" class="name"></span>?
229                     </div>
230                     <div class="modal-footer">
231                         <button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i> Delete</button>
232                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
233                     </div>
234                 </div>
235             </div>
236         </form>
237     </div>
238
239     <div id="remove-library-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="remove-library-modal-label" aria-hidden="true">
240         <form action="/cgi-bin/koha/admin/library_groups.pl">
241             <div class="modal-dialog">
242                 <div class="modal-content">
243                     <input id="remove-library-modal-action" type="hidden" name="action" value="delete" />
244                     <input id="remove-library-modal-id" type="hidden" name="id" value="" />
245                     <div class="modal-header">
246                         <h3 id="remove-library-modal-label">Remove library from group</h3>
247                     </div>
248                     <div class="modal-body">
249                         Are you sure you want to remove <span id="remove-library-modal-library" class="name"></span> from <span id="remove-library-modal-group" class="name"></span>?
250                     </div>
251                     <div class="modal-footer">
252                         <button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i> Remove</button>
253                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
254                     </div>
255                 </div>
256             </div>
257         </form>
258     </div>
259
260 [% MACRO jsinclude BLOCK %]
261     [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
262     <script>
263         $(document).ready(function() {
264             $('.library-groups').treetable({
265                 expandable: true,
266                 initialState: 'expanded',
267                 clickableNodeNames: true,
268             });
269
270             $('.add-group').on('click', function(e) {
271                 e.preventDefault();
272                 var id = $(this).data('groupId');
273                 add_group( id );
274             });
275
276             $('.edit-group').on('click', function(e) {
277                 e.preventDefault();
278                 var id = $(this).data('groupId');
279                 var parent_id = $(this).data('groupParentId');
280                 var title = $(this).data('groupTitle');
281                 var description = $(this).data('groupDescription');
282                 var ft_hide_patron_info = $(this).data('groupFt_hide_patron_info');
283                 var ft_search_groups_opac = $(this).data('groupFt_search_groups_opac');
284                 var ft_search_groups_staff = $(this).data('groupFt_search_groups_staff');
285                 var ft_local_hold_group = $(this).data('groupFt_local_hold_group');
286                 edit_group( id, parent_id, title, description, ft_hide_patron_info, ft_search_groups_opac, ft_search_groups_staff, ft_local_hold_group );
287             });
288
289             $('.delete-group').on('click', function(e) {
290                 e.preventDefault();
291                 var id = $(this).data('groupId');
292                 var title = $(this).data('groupTitle');
293                 delete_group( id, title );
294             });
295
296             $('.remove-library').on('click', function(e) {
297                 e.preventDefault();
298                 var id = $(this).data('groupId');
299                 var library = $(this).data('groupLibrary');
300                 var parent_title = $(this).data('groupParentTitle');
301                 remove_library( id, library, parent_title );
302             });
303             $('#add-group-modal').on('shown.bs.modal', function() {
304                 $('#add-group-modal-title').focus();
305             });
306             $('#edit-group-modal').on('shown.bs.modal', function() {
307                 $('#edit-group-modal-title').focus();
308             });
309         });
310
311         function add_group( parent_id ) {
312             $('#add-group-modal-parent-id').val( parent_id );
313
314             $('#add-group-modal-description').val("");
315             $('#add-group-modal-title').val("");
316
317
318             $('#add-group-modal-ft_hide_patron_info').prop('checked', false);
319             $('#add-group-modal-ft_search_groups_opac').prop('checked', false);
320             $('#add-group-modal-ft_search_groups_staff').prop('checked', false);
321             $('#add-group-modal-ft_local_hold_group').prop('checked', false);
322             if ( parent_id ) {
323                 $('#root-group-features-add').hide();
324             } else {
325                 $('#root-group-features-add').show();
326             }
327             $('#add-group-modal').modal('show');
328
329         }
330
331         function edit_group( id, parent_id, title, description, ft_hide_patron_info, ft_search_groups_opac, ft_search_groups_staff, ft_local_hold_group ) {
332             $('#edit-group-modal-id').val( id );
333             $('#edit-group-modal-title').val( title );
334             $('#edit-group-modal-description').val( description );
335
336             if ( parent_id ) {
337                 $('#edit-group-modal-ft_hide_patron_info').prop('checked', false);
338                 $('#edit-group-modal-ft_search_groups_opac').prop('checked', false);
339                 $('#edit-group-modal-ft_search_groups_staff').prop('checked', false);
340                 $('#edit-group-modal-ft_local_hold_group').prop('checked', false);
341                 $('#root-group-features-edit').hide();
342             } else {
343                 $('#edit-group-modal-ft_hide_patron_info').prop('checked', ft_hide_patron_info ? true : false );
344                 $('#edit-group-modal-ft_search_groups_opac').prop('checked', ft_search_groups_opac ? true : false );
345                 $('#edit-group-modal-ft_search_groups_staff').prop('checked', ft_search_groups_staff ? true : false );
346                 $('#edit-group-modal-ft_local_hold_group').prop('checked', ft_local_hold_group ? true : false );
347                 $('#root-group-features-edit').show();
348             }
349
350             $('#edit-group-modal').modal('show');
351         }
352
353         function delete_group( id, title ) {
354             $('#delete-group-modal-title').html(title);
355             $('#delete-group-modal-id').val( id );
356             $('#delete-group-modal').modal('show');
357         }
358
359         function remove_library( id, library, parent_title ) {
360             $('#remove-library-modal-library').html( library );
361             $('#remove-library-modal-group').html(parent_title);
362             $('#remove-library-modal-id').val( id );
363             $('#remove-library-modal').modal('show');
364         }
365
366     </script>
367 [% END %]
368
369 [% INCLUDE 'intranet-bottom.inc' %]
370
371 [% BLOCK tree %]
372     <tr data-tt-id="[% group.id | html %]" data-tt-parent-id="[% group.parent_id | html %]">
373         <td>
374             [% IF group.branchcode %]
375                 [% group.branchcode | html %]
376             [% ELSE %]
377                 [% group.title | html %]
378             [% END %]
379         </td>
380         <td>
381             [% IF group.branchcode %]
382                 [% group.library.branchname | html %]
383             [% ELSE %]
384                 [% group.description | html %]
385             [% END %]
386         </td>
387         <td>
388             [% UNLESS group.branchcode %]
389               <ul>
390                 [% IF group.ft_hide_patron_info %]
391                     <li>Hide patron's info for librarians outside of this group.</li>
392                 [% END %]
393                 [% IF group.ft_search_groups_opac %]
394                     <li>Use for OPAC search groups</li>
395                 [% END %]
396                 [% IF group.ft_search_groups_staff %]
397                     <li>Use for staff search groups</li>
398                 [% END %]
399                 [% IF group.ft_local_hold_group %]
400                     <li>Is local hold group</li>
401                 [% END %]
402               </ul>
403             [% END %]
404         </td>
405         <td>
406             [% IF group.branchcode %]
407                 <button class="btn btn-default btn-xs remove-library" data-group-id="[% group.id | html %]" data-group-library="[% group.library.branchname | html %]" data-group-parent-title="[% group.parent.title | html %]" ><i class="fa fa-trash"></i> Remove from group</button>
408             [% ELSE %]
409                 <div class="btn-group">
410                     <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><i class="fa fa-wrench"></i> Actions <span class="caret"></span></button>
411                     <ul class="dropdown-menu">
412                         <li>
413                             <a id="add-group-[% group.id | html %]" href="#" class="add-group" data-group-id="[% group.id | html %]">
414                                 <i class="fa fa-plus"></i> Add sub-group
415                             </a>
416                        </li>
417
418                         <li>
419                             <a class="edit-group" id="edit-group-[% group.id | html %]" href="#" data-group-id="[% group.id | html %]" data-group-parent-id="[% group.parent_id | html %]" data-group-title="[% group.title | html %]" data-group-description="[% group.description | html %]" data-group-ft_hide_patron_info="[% group.ft_hide_patron_info | html %]" data-group-ft_search_groups_opac="[% group.ft_search_groups_opac | html %]" data-group-ft_search_groups_staff="[% group.ft_search_groups_staff | html %]" data-group-ft_local_hold_group="[% group.ft_local_hold_group | html %]" >
420                                 <i class="fa fa-pencil"></i> Edit
421                             </a>
422                        </li>
423
424                         <li>
425                             <a class="delete-group" id="delete-group-[% group.id | html %]" href="#" data-group-id="[% group.id | html %]" data-group-title="[% group.title | html %]">
426                                 <i class="fa fa-trash"></i> Delete
427                             </a>
428                        </li>
429                     </ul>
430                 </div>
431
432                 <div class="btn-group">
433                     <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> Add library <span class="caret"></span></button>
434                     <ul class="dropdown-menu">
435                         [% FOREACH library IN group.libraries_not_direct_children %]
436                             <li>
437                                 <a class="add-library" id="add-library[% library.id | html %]-[% group.id | html %]" href="/cgi-bin/koha/admin/library_groups.pl?action=add&parent_id=[% group.id | html %]&branchcode=[% library.id | html %]">
438                                     [% library.branchname | html %]
439                                 </a>
440                            </li>
441                         [% END %]
442                     </ul>
443                 </div>
444             [% END %]
445         </td>
446     </tr>
447
448     [% FOREACH g IN group.children %]
449         [% PROCESS tree group=g %]
450     [% END %]
451 [% END %]