Bug 26633: Add advanced editor for transfer limits
[koha.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>Koha &rsaquo; Administration &rsaquo; Library checkin and transfer policy</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 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'prefs-admin-search.inc' %]
14
15 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Set library checkin and transfer policy</div>
16
17 <div class="main container-fluid">
18     <div class="row">
19         <div class="col-sm-10 col-sm-push-2">
20             <main>
21
22 <h1>Library [% branchcode | html %] - [% Branches.GetName( branchcode ) | html %] Checkin and transfer policy</h1>
23     <form method="get" action="/cgi-bin/koha/admin/branch_transfer_limits.pl" id="selectlibrary">
24         <label for="branchselect">Select a library :</label>
25         <select name="branchcode" id="branchselect">
26             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1 ) %]
27         </select>
28     </form>
29
30 <p class="help">Check the boxes for the libraries you allow your items to be transferred to.</p>
31 <fieldset>
32     [% IF ( limitType == 'ccode' ) %]<strong>For all collection codes: </strong>[% ELSE %]<strong>For all item types: </strong>[% END %]
33     <a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a>
34     |
35     <a id="UncheckAll" href="#"><i class="fa fa-remove"></i> Clear all</a>
36     |
37     <a href="/cgi-bin/koha/admin/transfer_limits.pl">Switch to advanced editor</a>
38 </fieldset>
39
40
41   <div id="transferlimit_tabs" class="toptabs">
42     <ul class="ui-tabs-nav">
43       [% FOREACH codes_loo IN codes_loop %]<li><a href="#[% codes_loo.code | uri %]set">[% codes_loo.code | html %]</a></li>[% END %]
44     </ul>
45
46         <form method="post" action="branch_transfer_limits.pl">
47
48     [% FOREACH codes_loo IN codes_loop %]
49     <div id="[% codes_loo.code | html %]set">
50     <h4>Policy for [% codes_loo.limit_phrase | html %]: [% codes_loo.code | html %]</h4>
51
52     <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>
53
54         <table id="[% codes_loo.code | html %]table" class="sorted">
55             <thead>
56                 <tr>
57                     <th>Library</th>
58                     <th>Allow transfer?</th>
59                 </tr>
60             </thead>
61
62             <tbody>
63                     [% FOREACH to_branch_loo IN codes_loo.to_branch_loop %]
64                         <tr>
65                             <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>
66                             <td>
67                             [% IF ( to_branch_loo.isChecked ) %]
68                                 <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" />
69                             [% ELSE %]
70                                 <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 %]" />
71                             [% END %]
72                             </td>
73                         </tr>
74                     [% END %]
75             </tbody>
76         </table>
77         </div>
78                 [% END %]
79
80         <fieldset class="action">
81             <input type="hidden" name="updateLimits" value="1" />
82             <input type="hidden" name="branchcode" value="[% branchcode | html %]" />
83             <input type="submit" value="Save" />
84             <a class="cancel" href="/cgi-bin/koha/admin/admin-home.pl">Cancel</a>
85         </fieldset>
86         </form>
87         </div>
88
89             </main>
90         </div> <!-- /.col-sm-10.col-sm-push-2 -->
91
92         <div class="col-sm-2 col-sm-pull-10">
93             <aside>
94                 [% INCLUDE 'admin-menu.inc' %]
95             </aside>
96         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
97      </div> <!-- /.row -->
98
99 [% MACRO jsinclude BLOCK %]
100     [% Asset.js("js/admin-menu.js") | $raw %]
101     [% INCLUDE 'datatables.inc' %]
102     <script>
103         $(document).ready(function(){
104             $("#CheckAll").on("click", function(e){
105                 e.preventDefault();
106                 $(".cb").each(function(){
107                     $(this).prop("checked", true);
108                 });
109             });
110
111             $("#UncheckAll").on("click", function(e){
112                 e.preventDefault();
113                 $(".cb").each(function(){
114                     $(this).prop("checked", false);
115                 });
116             });
117             $('#transferlimit_tabs').tabs();
118
119              $('#branchselect').change(function() {
120                 $('#selectlibrary').submit();
121              });
122
123             var checkall = $(".checkall");
124             var uncheckall = $(".uncheckall");
125
126             $(checkall).on("click", function(e){
127                 e.preventDefault();
128                 var tid = $(this).data("cb");
129                 $(".cb" + tid ).each(function(){
130                     $(this).prop("checked", true);
131                 })
132             });
133
134             $(uncheckall).on("click", function(e){
135                 e.preventDefault();
136                 var tid = $(this).data("cb");
137                 $(".cb" + tid ).each(function(){
138                     $(this).prop("checked", false);
139                 })
140             });
141
142             $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
143                 "aoColumnDefs": [
144                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
145                 ],
146                 'bPaginate': false
147             }));
148         });
149     </script>
150 [% END %]
151 [% INCLUDE 'intranet-bottom.inc' %]