Bug 29263: (bug 24387 follow-up) Fix 'Cancel' link when editing a html custom
[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 [% INCLUDE 'header.inc' %]
49 [% INCLUDE 'prefs-admin-search.inc' %]
50
51 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
52     <ol>
53         <li>
54             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
55         </li>
56         <li>
57             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
58         </li>
59         <li>
60             <a href="#" aria-current="page">
61                 Item circulation alerts
62             </a>
63         </li>
64     </ol>
65 </nav>
66
67 <div class="main container-fluid">
68     <div class="row">
69         <div class="col-sm-10 col-sm-push-2">
70             <main>
71                 <div class="row">
72                     <div class="col-sm-6">
73 <h1>Item circulation alerts</h1>
74 <h2>Select a library:</h2>
75 <form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
76 <select id="branch" name="branch">
77     <option value="*">Default</option>
78     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
79 </select>
80 <input type="submit" name="pick" value="Pick" />
81 </form>
82 </div>
83                     <div class="col-sm-6">
84 <table class="grid">
85 <caption>Legend</caption>
86 <thead>
87 <tr>
88   <th>Color</th>
89   <th>Meaning</th>
90 </tr>
91 </thead>
92 <tbody>
93   <tr>
94     <td width="100" class="default">&nbsp;</td>
95     <td class="info">These are disabled for ALL libraries.  To change these settings, choose the "Default" library.</td>
96   </tr>
97   <tr>
98     <td class="disabled">&nbsp;</td>
99     <td class="info">These are disabled for the current library.</td>
100   </tr>
101   <tr>
102     <td>&nbsp;</td>
103     <td class="info">These are enabled.</td>
104   </tr>
105 </tbody>
106 </table>
107                     </div> <!-- /.col-sm-6 -->
108                 </div> <!-- /.row -->
109
110 <h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' | html %]</h2>
111 <p>Click on the grid to toggle the settings.</p>
112
113 <div id="alerttabs" class="toptabs">
114 <ul>
115 <li><a href="#checkout">Checkout</a></li>
116 <li><a href="#checkin">Check-in</a></li>
117 </ul>
118
119 <div id="checkout">
120 <h3>Checkout</h3>
121 <table class="grid active" width="100%">
122 <thead>
123 <tr>
124   <th>&nbsp;</th>
125   [% FOREACH item_type IN item_types %]
126   <th>[% item_type.description | html %]</th>
127   [% END %]
128 </tr>
129 </thead>
130 <tbody>
131 [% FOREACH grid_checkou IN grid_checkout %]
132 <tr>
133   <th>[% grid_checkou.description | html %]</th>
134   [% FOREACH item IN grid_checkou.items %]
135   <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
136   [% END %]
137 </tr>
138 [% END %]
139 </tbody>
140 </table>
141 </div>
142
143 <div id="checkin">
144 <h3>Check-in</h3>
145 <table class="grid active" width="100%">
146 <thead>
147 <tr>
148   <th>&nbsp;</th>
149   [% FOREACH item_type IN item_types %]
150   <th>[% item_type.description | html %]</th>
151   [% END %]
152 </tr>
153 </thead>
154 <tbody>
155 [% FOREACH grid_checki IN grid_checkin %]
156 <tr>
157   <th>[% grid_checki.description | html %]</th>
158   [% FOREACH item IN grid_checki.items %]
159   <td class="[% item.class | html %]" id="[% item.id | html %]">[% item.text | html %]</td>
160   [% END %]
161 </tr>
162 [% END %]
163 </tbody>
164 </table>
165 </div>
166 </div>
167
168             </main>
169         </div> <!-- /.col-sm-10.col-sm-push-2 -->
170
171         <div class="col-sm-2 col-sm-pull-10">
172             <aside>
173                 [% INCLUDE 'admin-menu.inc' %]
174             </aside>
175         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
176      </div> <!-- /.row -->
177
178 [% MACRO jsinclude BLOCK %]
179     [% Asset.js("js/admin-menu.js") | $raw %]
180     <script>
181         var $branch = "[% branch | html %]";
182         $(function(){
183             $('#alerttabs').tabs();
184
185             var blocked            = _("Blocked!");
186             var saving             = _("Saving...");
187             var disabledForAll     = _("Disabled for all");
188             var disabledForCurrent = _("Disabled for %s").format($branch);
189
190             $('#branch_selector input:submit').hide();
191             $('#branch').change(function(){
192                 $('#branch_selector').submit();
193             });
194
195             $('table.grid.active tbody td').click(function(ev){
196                 var id = this.id;
197                 var td = $(this);
198                 if (td.hasClass('default') && $branch != '*') {
199                     td.html(blocked);
200                     window.setTimeout(
201                       function(){ td.html(disabledForAll) },
202                       3000
203                     );
204                 } else {
205                     td.html(saving);
206                     $.ajax({
207                         url      : '/cgi-bin/koha/admin/item_circulation_alerts.pl',
208                         type     : 'POST',
209                         dataType : 'json',
210                         data     : { action: 'toggle', id: id, branch: $branch },
211                         success  : function(response){
212                             if ($branch == '*' && response.classes.match(/default/)) {
213                                 td.html(disabledForAll);
214                             } else if (response.classes.match(/disabled/)) {
215                                 td.html(disabledForCurrent);
216                             } else {
217                                 td.html(' ');
218                             }
219                             td.attr('class', response.classes);
220                         }
221                     });
222                 }
223             });
224
225         });
226     </script>
227 [% END %]
228 [% INCLUDE 'intranet-bottom.inc' %]