Bug 31028: Only show pending concerns if there are some
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branch_transfer_limits.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Library checkin and transfer policy &rsaquo; Administration &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>td { text-align: center; } .sorted { min-width: 50%; }</style>
9 </head>
10
11 <body id="admin_branch_transfer_limits" class="admin">
12 [% WRAPPER 'header.inc' %]
13     [% INCLUDE 'prefs-admin-search.inc' %]
14 [% END %]
15
16 [% WRAPPER 'sub-header.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
18     <ol>
19         <li>
20             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21         </li>
22         <li>
23             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
24         </li>
25         <li>
26             <a href="#" aria-current="page">
27                 Set library checkin and transfer policy
28             </a>
29         </li>
30     </ol>
31 </nav>
32 [% END %]
33
34 <div class="main container-fluid">
35     <div class="row">
36         <div class="col-sm-10 col-sm-push-2">
37             <main>
38
39 <h1>Library [% branchcode | html %] - [% Branches.GetName( branchcode ) | html %] Checkin and transfer policy</h1>
40     <form method="get" action="/cgi-bin/koha/admin/branch_transfer_limits.pl" id="selectlibrary">
41         <label for="branchselect">Select a library :</label>
42         <select name="branchcode" id="branchselect">
43             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1 ) %]
44         </select>
45     </form>
46
47 <p class="help">Check the boxes for the libraries you allow your items to be transferred to.</p>
48 <fieldset>
49     [% IF ( limitType == 'ccode' ) %]<strong>For all collection codes: </strong>[% ELSE %]<strong>For all item types: </strong>[% END %]
50     <a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a>
51     |
52     <a id="UncheckAll" href="#"><i class="fa fa-remove"></i> Clear all</a>
53     |
54     <a href="/cgi-bin/koha/admin/transfer_limits.pl">Switch to advanced editor</a>
55 </fieldset>
56
57 [% WRAPPER tabs id = "transferlimit_tabs" %]
58     [% WRAPPER tabs_nav %]
59         [% FOREACH codes_loo IN codes_loop %]
60             [% WRAPPER tab_item tabname=codes_loo.code %]
61                 [% codes_loo.code | html %]
62             [% END %]
63         [% END %]
64     [% END %]
65
66     <form method="post" action="branch_transfer_limits.pl">
67         [% WRAPPER tab_panels %]
68             [% FOREACH codes_loo IN codes_loop %]
69                 [% WRAPPER tab_panel tabname=codes_loo.code %]
70                     <h4>Policy for [% codes_loo.limit_phrase | html %]: [% codes_loo.code | html %]</h4>
71
72                     <p><a id="CheckAll[% codes_loo.code | html %]table" data-cb="[% codes_loo.code | html %]" class="checkall" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="UncheckAll[% codes_loo.code | html %]table" data-cb="[% codes_loo.code | html %]" class="uncheckall" href="#"><i class="fa fa-remove"></i> Clear all</a></p>
73
74                     <table id="[% codes_loo.code | html %]table" class="sorted">
75                         <thead>
76                             <tr>
77                                 <th>Library</th>
78                                 <th>Allow transfer?</th>
79                             </tr>
80                         </thead>
81
82                         <tbody>
83                                 [% FOREACH to_branch_loo IN codes_loo.to_branch_loop %]
84                                     <tr>
85                                         <td><label style="min-width:400px;" for="[% to_branch_loo.code | html %][% to_branch_loo.toBranch | html %]row">[% to_branch_loo.toBranch | html %] - [% Branches.GetName( to_branch_loo.toBranch ) | html %]</label></td>
86                                         <td>
87                                         [% IF ( to_branch_loo.isChecked ) %]
88                                             <input type="checkbox" class="cb cb[% codes_loo.code | html %]" id="[% to_branch_loo.code | html %][% to_branch_loo.toBranch | html %]row" name="[% to_branch_loo.code | html %]_[% to_branch_loo.toBranch | html %]" checked="checked" />
89                                         [% ELSE %]
90                                             <input type="checkbox" class="cb cb[% codes_loo.code | html %]" id="[% to_branch_loo.code | html %][% to_branch_loo.toBranch | html %]row" name="[% to_branch_loo.code | html %]_[% to_branch_loo.toBranch | html %]" />
91                                         [% END %]
92                                         </td>
93                                     </tr>
94                                 [% END %]
95                         </tbody>
96                     </table>
97                 [% END #/WRAPPER tab_panel %]
98             [% END # /FOREACH codes_loo %]
99         [% END # /WRAPPER tab_panels %]
100
101         <fieldset class="action">
102             <input type="hidden" name="updateLimits" value="1" />
103             <input type="hidden" name="branchcode" value="[% branchcode | html %]" />
104             <input type="submit" class="btn btn-primary" value="Save" />
105             <a class="cancel" href="/cgi-bin/koha/admin/admin-home.pl">Cancel</a>
106         </fieldset>
107     </form>
108 [% END # /WRAPPER tabs %]
109
110             </main>
111         </div> <!-- /.col-sm-10.col-sm-push-2 -->
112
113         <div class="col-sm-2 col-sm-pull-10">
114             <aside>
115                 [% INCLUDE 'admin-menu.inc' %]
116             </aside>
117         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
118      </div> <!-- /.row -->
119
120 [% MACRO jsinclude BLOCK %]
121     [% Asset.js("js/admin-menu.js") | $raw %]
122     [% INCLUDE 'datatables.inc' %]
123     <script>
124         $(document).ready(function(){
125             $("#CheckAll").on("click", function(e){
126                 e.preventDefault();
127                 $(".cb").each(function(){
128                     $(this).prop("checked", true);
129                 });
130             });
131
132             $("#UncheckAll").on("click", function(e){
133                 e.preventDefault();
134                 $(".cb").each(function(){
135                     $(this).prop("checked", false);
136                 });
137             });
138
139             if( $(".tab-pane.active").length < 1 ){
140                   $("#transferlimit_tabs a:first").tab("show");
141             }
142
143              $('#branchselect').change(function() {
144                 $('#selectlibrary').submit();
145              });
146
147             var checkall = $(".checkall");
148             var uncheckall = $(".uncheckall");
149
150             $(checkall).on("click", function(e){
151                 e.preventDefault();
152                 var tid = $(this).data("cb");
153                 $(".cb" + tid ).each(function(){
154                     $(this).prop("checked", true);
155                 })
156             });
157
158             $(uncheckall).on("click", function(e){
159                 e.preventDefault();
160                 var tid = $(this).data("cb");
161                 $(".cb" + tid ).each(function(){
162                     $(this).prop("checked", false);
163                 })
164             });
165
166             $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
167                 "aoColumnDefs": [
168                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
169                 ],
170                 'bPaginate': false
171             }));
172         });
173     </script>
174 [% END %]
175 [% INCLUDE 'intranet-bottom.inc' %]