Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / item_circulation_alerts.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Item circulation alerts &rsaquo; Administration &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% FILTER collapse %]
9     <style>
10         table.grid thead th {
11             vertical-align: bottom;
12         }
13
14         table.grid tbody th {
15             text-align: right;
16         }
17
18         table.grid tbody td {
19             font-size: xx-small;
20         }
21
22         table.grid tbody td.info {
23             background-color: #fff !important;
24         }
25
26         table.grid.active tbody td {
27             width: 10%;
28             cursor: pointer;
29         }
30
31         table.grid tbody td {
32             background-color: #cfc !important;
33             color: #111;
34         }
35
36         table.grid td.disabled {
37             background-color: #fcc !important;
38         }
39
40         table.grid td.default {
41             background-color: #f88 !important;
42         }
43     </style>
44 [% END %]
45 </head>
46
47 <body id="admin_item_circulation_alerts" class="admin">
48 [% WRAPPER 'header.inc' %]
49     [% INCLUDE 'prefs-admin-search.inc' %]
50 [% END %]
51
52 [% WRAPPER 'sub-header.inc' %]
53 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
54     <ol>
55         <li>
56             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
57         </li>
58         <li>
59             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
60         </li>
61         <li>
62             <a href="#" aria-current="page">
63                 Item circulation alerts
64             </a>
65         </li>
66     </ol>
67 </nav>
68 [% END %]
69
70 <div class="main container-fluid">
71     <div class="row">
72         <div class="col-sm-10 col-sm-push-2">
73             <main>
74                 <div class="row">
75                     <div class="col-sm-6">
76 <h1>Item circulation alerts</h1>
77 <h2>Select a library:</h2>
78 <form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
79 <select id="branch" name="branch">
80     <option value="*">Default</option>
81     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
82 </select>
83 <input type="submit" name="pick" value="Pick" />
84 </form>
85 </div>
86                     <div class="col-sm-6">
87 <table class="grid">
88 <caption>Legend</caption>
89 <thead>
90 <tr>
91   <th>Color</th>
92   <th>Meaning</th>
93 </tr>
94 </thead>
95 <tbody>
96   <tr>
97     <td width="100" class="default">&nbsp;</td>
98     <td class="info">These are disabled for ALL libraries.  To change these settings, choose the "Default" library.</td>
99   </tr>
100   <tr>
101     <td class="disabled">&nbsp;</td>
102     <td class="info">These are disabled for the current library.</td>
103   </tr>
104   <tr>
105     <td>&nbsp;</td>
106     <td class="info">These are enabled.</td>
107   </tr>
108 </tbody>
109 </table>
110                     </div> <!-- /.col-sm-6 -->
111                 </div> <!-- /.row -->
112
113                 <h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' | html %]</h2>
114                 <p>Click on the grid to toggle the settings.</p>
115
116
117                 <div id="alerttabs" class="toptabs">
118
119                     <ul class="nav nav-tabs" role="tablist">
120                         <li role="presentation" class="active"><a href="#checkout" aria-controls="checkout" role="tab" data-toggle="tab">Checkout</a></li>
121                         <li role="presentation"><a href="#checkin" aria-controls="checkin" role="tab" data-toggle="tab">Check-in</a></li>
122                     </ul>
123
124                     <div class="tab-content">
125                         <div role="tabpanel" class="tab-pane active" id="checkout">
126                             <h3>Checkout</h3>
127                             <table class="grid active" width="100%">
128                                 <thead>
129                                     <tr>
130                                         <th>&nbsp;</th>
131                                         [% FOREACH item_type IN item_types %]
132                                             <th>[% item_type.description | html %]</th>
133                                         [% END %]
134                                     </tr>
135                                 </thead>
136                                 <tbody>
137                                     [% FOREACH grid_checkou IN grid_checkout %]
138                                         <tr>
139                                             <th>[% grid_checkou.description | html %]</th>
140                                             [% FOREACH item IN grid_checkou.items %]
141                                                 <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
142                                             [% END %]
143                                         </tr>
144                                     [% END %]
145                                 </tbody>
146                             </table> <!-- /.grid.active -->
147                         </div> <!-- /#checkout -->
148
149                         <div role="tabpanel" class="tab-pane" id="checkin">
150                             <h3>Check-in</h3>
151                             <table class="grid active" width="100%">
152                                 <thead>
153                                     <tr>
154                                         <th>&nbsp;</th>
155                                         [% FOREACH item_type IN item_types %]
156                                         <th>[% item_type.description | html %]</th>
157                                         [% END %]
158                                     </tr>
159                                 </thead>
160                                 <tbody>
161                                     [% FOREACH grid_checki IN grid_checkin %]
162                                     <tr>
163                                         <th>[% grid_checki.description | html %]</th>
164                                         [% FOREACH item IN grid_checki.items %]
165                                         <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
166                                         [% END %]
167                                     </tr>
168                                     [% END %]
169                                 </tbody>
170                             </table>
171                         </div>
172                     </div> <!-- /.tab-content -->
173
174                 </div> <!-- /#alerttabs -->
175
176
177             </main>
178         </div> <!-- /.col-sm-10.col-sm-push-2 -->
179
180         <div class="col-sm-2 col-sm-pull-10">
181             <aside>
182                 [% INCLUDE 'admin-menu.inc' %]
183             </aside>
184         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
185      </div> <!-- /.row -->
186
187 [% MACRO jsinclude BLOCK %]
188     [% Asset.js("js/admin-menu.js") | $raw %]
189     <script>
190         var $branch = "[% branch | html %]";
191         $(function(){
192
193             var blocked            = _("Blocked!");
194             var saving             = _("Saving...");
195             var disabledForAll     = _("Disabled for all");
196             var disabledForCurrent = _("Disabled for %s").format($branch);
197
198             $('#branch_selector input:submit').hide();
199             $('#branch').change(function(){
200                 $('#branch_selector').submit();
201             });
202
203             $('table.grid.active tbody td').click(function(ev){
204                 var id = this.id;
205                 var td = $(this);
206                 if (td.hasClass('default') && $branch != '*') {
207                     td.html(blocked);
208                     window.setTimeout(
209                       function(){ td.html(disabledForAll) },
210                       3000
211                     );
212                 } else {
213                     td.html(saving);
214                     $.ajax({
215                         url      : '/cgi-bin/koha/admin/item_circulation_alerts.pl',
216                         type     : 'POST',
217                         dataType : 'json',
218                         data     : { action: 'toggle', id: id, branch: $branch },
219                         success  : function(response){
220                             if ($branch == '*' && response.classes.match(/default/)) {
221                                 td.html(disabledForAll);
222                             } else if (response.classes.match(/disabled/)) {
223                                 td.html(disabledForCurrent);
224                             } else {
225                                 td.html(' ');
226                             }
227                             td.attr('class', response.classes);
228                         }
229                     });
230                 }
231             });
232
233         });
234     </script>
235 [% END %]
236 [% INCLUDE 'intranet-bottom.inc' %]