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