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