Bug 30937: Add a 'does not exist' hint if branchcode is invalid
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branches.tt
1 [% USE Koha %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% USE TablesSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>
8 [% IF op == 'add_form' %]
9     [% IF library %]
10         Modify library
11     [% ELSE %]
12         New library [% library.branchcode | html %]
13     [% END %] &rsaquo; [% ELSIF op == 'delete_confirm' %]
14     Confirm deletion of library '[% library.branchcode | html %]' &rsaquo; [% END %]
15 Libraries &rsaquo; Administration &rsaquo; Koha
16 </title>
17 [% INCLUDE 'doc-head-close.inc' %]
18 </head>
19
20 <body id="admin_branches" class="admin">
21 [% INCLUDE 'header.inc' %]
22 [% INCLUDE 'prefs-admin-search.inc' %]
23
24 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
25     <ol>
26         <li>
27             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
28         </li>
29         <li>
30             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
31         </li>
32
33         [% IF op == 'add_form'  %]
34             <li>
35                 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
36             </li>
37             [% IF library %]
38                 <li>
39                     <a href="#" aria-current="page">
40                         Modify library
41                     </a>
42                 </li>
43             [% ELSE %]
44                 <li>
45                     <a href="#" aria-current="page">
46                         New library [% library.branchcode | html %]
47                     </a>
48                 </li>
49             [% END %]
50
51         [% ELSIF op == 'delete_confirm' %]
52             <li>
53                 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
54             </li>
55             <li>
56                 <a href="#" aria-current="page">
57                     Confirm deletion of library '[% library.branchcode | html %]'
58                 </a>
59             </li>
60
61         [% ELSIF op == 'view' %]
62             <li>
63                 <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
64             </li>
65             <li>
66                 <a href="#" aria-current="page">
67                     [% library.branchname | html %]
68                 </a>
69             </li>
70
71         [% ELSE %]
72             <li>
73                 <a href="#" aria-current="page">
74                     Libraries
75                 </a>
76             </li>
77         [% END %]
78     </ol>
79 </nav>
80
81 <div class="main container-fluid">
82     <div class="row">
83         <div class="col-sm-10 col-sm-push-2">
84             <main>
85
86 [% FOREACH m IN messages %]
87     <div class="dialog [% m.type | html %]">
88         [% SWITCH m.code %]
89         [% CASE 'error_on_update' %]
90             <span>An error occurred when updating this library. Perhaps it already exists.</span>
91         [% CASE 'error_on_insert' %]
92             <span>An error occurred when adding this library. The branchcode might already exist.</span>
93         [% CASE 'error_on_delete' %]
94             <span>An error occurred when deleting this library. Check the logs.</span>
95         [% CASE 'success_on_update' %]
96             <span>Library updated successfully.</span>
97         [% CASE 'success_on_insert' %]
98             <span>Library added successfully.</span>
99         [% CASE 'success_on_delete' %]
100             <span>Library deleted successfully.</span>
101         [% CASE 'cannot_delete_library' %]
102             <span>This library cannot be deleted. Patrons or items are still using it</span>
103             [% IF m.data.patrons_count and m.data.items_count %]
104                 <span>([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).</span>
105             [% ELSIF m.data.patrons_count %]
106                 <span>([% m.data.patrons_count | html %] patrons).</span>
107             [% ELSIF m.data.items_count %]
108                 <span>([% m.data.items_count | html %] items).</span>
109             [% END %]
110         [% CASE 'error_on_update_category' %]
111             <span>An error occurred when updating this library category. Perhaps it already exists.</span>
112         [% CASE 'error_on_insert_category' %]
113             <span>An error occurred when adding this library category. The categorycode might already exist.</span>
114         [% CASE 'error_on_delete_category' %]
115             <span>An error occurred when deleting this library category. Check the logs.</span>
116         [% CASE 'success_on_update_category' %]
117             <span>Library category updated successfully.</span>
118         [% CASE 'success_on_insert_category' %]
119             <span>Library category added successfully.</span>
120         [% CASE 'success_on_delete_category' %]
121             <span>Library category deleted successfully.</span>
122         [% CASE 'cannot_delete_category' %]
123             <span>This library category cannot be deleted. [% m.data.libraries_count | html %] libraries are still using it.</span>
124         [% CASE %]
125             <span>[% m.code | html %]</span>
126         [% END %]
127     </div>
128 [% END %]
129
130 [% IF op == 'list' || op == 'view' %]
131     <div id="toolbar" class="btn-toolbar">
132         <a class="btn btn-default" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
133         [% IF op == 'view' && library %]
134             <a class="btn btn-default" id="editbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=[% library.branchcode | uri %]"><i class="fa fa-pencil"></i> Edit library</a>
135         [% END %]
136     </div>
137 [% END %]
138
139 [% IF op == 'add_form' %]
140     <h1>[% IF library %]Modify library[% ELSE %]New library[% END %]</h1>
141     <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
142         <fieldset class="rows">
143             <input type="hidden" name="op" value="add_validate" />
144             [% IF library %]
145                 <input type="hidden" name="is_a_modif" value="1" />
146             [% END %]
147             <ol>
148                 <li>
149                     [% IF library %]
150                         <span class="label">Library code: </span>
151                         <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
152                         [% library.branchcode | html %]
153                     [% ELSE %]
154                         <label for="branchcode" class="required">Library code: </label>
155                         <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required focus" required="required" />
156                         <span class="required">Required</span>
157                     [% END %]
158                 </li>
159                 <li>
160                     <label for="branchname" class="required">Name: </label>
161                     [% IF library %]
162                         <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required focus" required="required" />
163                     [% ELSE %]
164                         <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
165                     [% END %]
166                     <span class="required">Required</span>
167                 </li>
168             </ol>
169         </fieldset>
170         [% IF categories %]
171             <fieldset class="rows"><legend>Group(s):</legend>
172                 <ol>
173                     [% FOREACH category IN categories %]
174                         <li>
175                             <label for="[% category.categorycode | html %]">[% category.categoryname | html %]: </label>
176                             [% IF category and selected_categorycodes.grep(category.categorycode).size %]
177                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" checked="checked" />
178                             [% ELSE %]
179                                 <input type="checkbox" id="[% category.categorycode | html %]" name="selected_categorycode_[% category.categorycode | html %]" />
180                             [% END %]
181                             <div class="hint">[% category.codedescription | html %]</div>
182                         </li>
183                     [% END %]
184                 </ol>
185             </fieldset>
186         [% END %]
187         <fieldset class="rows">
188             <ol>
189                 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" /></li>
190                 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" /></li>
191                 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" /></li>
192                 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" /></li>
193                 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" /></li>
194                 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip"  size="25" maxlength="25" value="[% library.branchzip | html %]" /></li>
195                 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" /></li>
196                 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
197                 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
198                 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email"  size="80" value="[% library.branchemail | html %]" /></li>
199                 [% IF (Koha.Preference('ILLModule')) %]
200                 <li>
201                     <label for="branchillemail">ILL staff email: </label>
202                     <input type="text" name="branchillemail" id="branchillemail" class="email"  size="80" value="[% library.branchillemail | html %]" />
203                     <div class="hint">
204                         [% IF ( CAN_user_parameters_manage_sysprefs ) %]
205                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLDefaultStaffEmail">ILLDefaultStaffEmail</a> system preference
206                         [% ELSE %]
207                             Default: ILLDefaultStaffEmail system preference
208                         [% END %]
209                     </div>
210                 </li>
211                 [% END %]
212                 <li>
213                     <label for="branchreplyto">Reply-To: </label>
214                     <input type="text" name="branchreplyto" id="branchreplyto" class="email"  size="80" value="[% library.branchreplyto | html %]" />
215                     <div class="hint">
216                          [% IF ( CAN_user_parameters_manage_sysprefs ) %]
217                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReplyToDefault">ReplyToDefault</a> system preference
218                         [% ELSE %]
219                             Default: ReplyToDefault system preference
220                         [% END %]
221                     </div>
222                 </li>
223                 <li>
224                     <label for="branchreturnpath">Return-Path: </label>
225                     <input type="text" name="branchreturnpath" id="branchreturnpath" class="email"  size="80" value="[% library.branchreturnpath | html %]" />
226                     <div class="hint">
227                          [% IF ( CAN_user_parameters_manage_sysprefs ) %]
228                             Default: <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ReturnpathDefault">ReturnpathDefault</a> system preference
229                         [% ELSE %]
230                             Default: ReturnpathDefault system preference
231                         [% END %]
232                     </div>
233                 </li>
234                 <li><label for="smtp_server">SMTP server: </label>
235                     <select name="smtp_server" id="smtp_server">
236                     [% IF library AND library.smtp_server.is_system_default %]
237                         <option value="*" selected="selected">Default</option>
238                     [% ELSE %]
239                         <option value="*">Default</option>
240                     [% END %]
241                     [% FOREACH smtp_server IN smtp_servers %]
242                         [% IF library AND smtp_server.id == library.smtp_server.id %]
243                             <option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
244                         [% ELSE %]
245                             <option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
246                         [% END %]
247                     [% END %]
248                     </select>
249                 </li>
250                 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl"  size="80" value="[% library.branchurl | html %]" class="url" /></li>
251                 <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info | $raw %]</textarea></li>
252                 <li>
253                     <label for="branchip">IP: </label>
254                     <input type="text" name="branchip" id="branchip"  size="15" maxlength="15" value="[% library.branchip | html %]" />
255                     <div class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</div>
256                 </li>
257                 <li>
258                     <label for="marcorgcode">MARC organization code</label>
259                     <input type="text" name="marcorgcode" id="marcorgcode" size="16" maxlength="16" value="[% library.marcorgcode | html %]" />
260                     <div class="hint">
261                         [% IF ( CAN_user_parameters_manage_sysprefs ) %]
262                             If not filled in defaults to system preference <a target="_blank" href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=MARCOrgCode">MARCOrgCode</a>.
263                         [% ELSE %]
264                             If not filled in defaults to system preference MARCOrgCode.
265                         [% END %]
266                         You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.
267                     </div>
268                 </li>
269                 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" /></li>
270                 <li><label for="pickup_location">Pickup location: </label>
271                     <select name="pickup_location" id="pickup_location">
272                         [% IF !library || library.pickup_location == 1 %]
273                         <option value="1" selected="selected">Yes</option>
274                         <option value="0">No</option>
275                         [% ELSE %]
276                         <option value="1">Yes</option>
277                         <option value="0" selected="selected">No</option>
278                         [% END %]
279                     </select>
280                 </li>
281                 <li><label for="public">Public: </label>
282                     <select name="public" id="public">
283                         [% IF !library || library.public == 1 %]
284                         <option value="1" selected="selected">Yes</option>
285                         <option value="0">No</option>
286                         [% ELSE %]
287                         <option value="1">Yes</option>
288                         <option value="0" selected="selected">No</option>
289                         [% END %]
290                     </select>
291                     <div class="hint">Set to 'yes' to show this library on the Libraries page in the OPAC.</div>
292                 </li>
293             </ol>
294         </fieldset>
295         <fieldset class="action">
296             <input type="submit" value="Submit" />
297             <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
298         </fieldset>
299     </form>
300 [% END %]
301
302 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
303     <div class="dialog alert">
304         <form action="/cgi-bin/koha/admin/branches.pl" method="post">
305             <h1>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h1>
306             <input type="hidden" name="op" value="delete_confirmed" />
307             <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
308             <input type="hidden" name="branchname" value="[% library.branchname | html %]">
309             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
310         </form>
311         <form action="/cgi-bin/koha/admin/branches.pl" method="get">
312             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
313         </form>
314     </div>
315 [% END %]
316
317 [% IF op == 'list' %]
318     <h1>Libraries</h1>
319     [% IF libraries_count > 0 %]
320         <table id="libraries">
321             <thead>
322                 <tr>
323                     <th>Name</th>
324                     <th>Code</th>
325                     <th>Address</th>
326                     <th>MARC organization code</th>
327                     <th>IP</th>
328                     <th>Pickup location</th>
329                     <th>Public</th>
330                     <th>SMTP server</th>
331                     <th data-class-name="actions noExport">Actions</th>
332                 </tr>
333             </thead>
334         </table>
335     [% ELSE %]
336         <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">Start defining libraries</a>.</div>
337     [% END %]
338 [% END %]
339
340 [% IF op == 'view' && library %]
341     <h1>[% library.branchname | html %]</h1>
342     <div class="row">
343         <div class="col-sm-6">
344             <div class="rows">
345                 <ol>
346                     <li>
347                         <span class="label">Library code: </span>
348                         [% library.branchcode | html %]
349                     </li>
350                     <li>
351                         <span class="label">Name: </span>
352                         [% library.branchname | html %]
353                     </li>
354                     <li>
355                         <span class="label">Category:</span>
356                         [% category.categoryname | html %]
357                     </li>
358                     <li>
359                         <span class="label">Address line 1: </span>
360                         [% library.branchaddress1 | html %]
361                     </li>
362                     <li>
363                         <span class="label">Address line 2: </span>
364                         [% library.branchaddress2 | html %]
365                     </li>
366                     <li>
367                         <span class="label">Address line 3: </span>
368                         [% library.branchaddress3 | html %]
369                     </li>
370                     <li>
371                         <span class="label">City: </span>
372                         [% library.branchcity | html %]
373                     </li>
374                     <li>
375                         <span class="label">State: </span>
376                         [% library.branchstate | html %]
377                     </li>
378                     <li>
379                         <span class="label">ZIP/Postal code: </span>
380                         [% library.branchzip | html %]
381                     </li>
382                     <li>
383                         <span class="label">Country: </span>
384                         [% library.branchcountry | html %]
385                     </li>
386                     <li>
387                         <span class="label">Phone: </span>
388                         [% library.branchphone | html %]
389                     </li>
390                     <li>
391                         <span class="label">Fax: </span>
392                         [% library.branchfax | html %]
393                     </li>
394                 </ol>
395             </div>
396         </div>
397         <div class="col-sm-6">
398             <div class="rows">
399                 <ol>
400                     <li>
401                         <span class="label">Email: </span>
402                         [% IF ( library.branchemail ) %]
403                             <a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
404                         [% END %]
405                     </li>
406                     <li>
407                         <span class="label">ILL staff email: </span>
408                         [% IF ( library.branchillemail ) %]
409                             <a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
410                         [% END %]
411                     </li>
412                     <li>
413                         <span class="label">Reply-To: </span>
414                         [% IF ( library.branchreplyto ) %]
415                             <a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
416                         [% END %]
417                     </li>
418                     <li>
419                         <span class="label">Return-Path: </span>
420                         [% library.branchreturnpath | html %]
421                     </li>
422                     <li>
423                         <span class="label">SMTP server: </span>
424                         [% smtp_server.name | html %]
425                     </li>
426                     <li>
427                         <span class="label">URL: </span>
428                         [% IF ( library.branchurl ) %]
429                             <a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
430                         [% END %]
431                     </li>
432                     <li>
433                         <span class="label">IP: </span>
434                         [% library.branchip | html %]
435                     </li>
436                     <li>
437                         <span class="label">MARC organization code</span>
438                         [% library.marcorgcode | html %]
439                     </li>
440                     <li>
441                         <span class="label">Notes: </span>
442                         [% library.branchnotes | html %]
443                     </li>
444                     <li>
445                         <span class="label">Pickup location: </span>
446                         [% IF ( library.pickup_location ) %]
447                             Yes
448                         [% ELSE %]
449                             No
450                         [% END %]
451                     </li>
452                     <li>
453                         <span class="label">Public: </span>
454                         [% IF ( library.public ) %]
455                             Yes
456                         [% ELSE %]
457                             No
458                         [% END %]
459                     </li>
460                 </ol>
461             </div> <!-- /.rows -->
462         </div> <!-- /.col-sm-6 -->
463     </div> <!-- /.row -->
464     [% IF ( library.opac_info ) %]
465         <hr />
466         <div class="row">
467             <div class="col-sm-12">
468                 <h2>OPAC information</h2>
469                 [% library.opac_info | $raw %]
470             </div>
471         </div>
472     [% END %]
473 [% ELSIF op == 'view' %]
474     <div>This library does not exist.</div>
475 [% END %]
476
477             </main>
478         </div> <!-- /.col-sm-10.col-sm-push-2 -->
479
480         <div class="col-sm-2 col-sm-pull-10">
481             <aside>
482                 [% INCLUDE 'admin-menu.inc' %]
483             </aside>
484         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
485      </div> <!-- /.row -->
486
487 [% MACRO jsinclude BLOCK %]
488     [% Asset.js("js/admin-menu.js") | $raw %]
489     [% INCLUDE 'datatables.inc' %]
490     [% INCLUDE 'columns_settings.inc' %]
491     [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
492     [% INCLUDE 'str/tinymce_i18n.inc' %]
493     <script>
494         var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
495         $(document).ready(function() {
496
497             var libraries_url = '/api/v1/libraries';
498             var libraries = $("#libraries").kohaTable({
499                 "ajax": {
500                     "url": libraries_url
501                 },
502                 'embed': [ 'smtp_server' ],
503                 'emptyTable': '<div class="dialog message">'+_("There are no libraries defined.")+' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">'+_("Start defining libraries")+'</a>.</div>',
504                 "columnDefs": [ {
505                     "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16],
506                     "render": function (data, type, row, meta) {
507                         if ( type == 'display' ) {
508                             if ( data != null ) {
509                                 return data.escapeHtml();
510                             }
511                             else {
512                                 return "";
513                             }
514                         }
515                         return data;
516                     }
517                 } ],
518                 "columns": [
519                     {
520                         "data": "name",
521                         "searchable": true,
522                         "orderable": true,
523                         "render": function( data, type, row, meta ) {
524                             return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
525                         }
526                     },
527                     {
528                         "data": "library_id",
529                         "searchable": true,
530                         "orderable": true
531                     },
532                     {
533                         "data": function( row, type, val, meta ) {
534                             const library_info = [];
535                             if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
536                             if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
537                             if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
538                             // geographical_location = city, state postal_code
539                             const locations = [];
540                             if ( row.city != null ) locations.push(row.city.escapeHtml());
541                             if ( row.state != null ) locations.push(row.state.escapeHtml());
542                             const geographical_location = locations.join(', ');
543                             if ( geographical_location != '' && row.postal_code != null) {
544                                 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
545                             }
546                             else {
547                                 library_info.push(geographical_location);
548                             }
549                             if ( row.country != null ) library_info.push(row.country.escapeHtml());
550                             if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
551                             if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
552                             if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
553                             if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
554                             if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
555                             return library_info.join('<br/>');
556                         },
557                         "searchable": false,
558                         "orderable": false
559                     },
560                     {
561                         "data": "marc_org_code",
562                         "searchable": true,
563                         "orderable": true
564                     },
565                     {
566                         "data": "ip",
567                         "searchable": true,
568                         "orderable": true
569                     },
570                     {
571                         "data": "pickup_location",
572                         "searchable": true,
573                         "orderable": true,
574                         "render": function( data, type, row, meta ) {
575                             return (data) ? _("Yes") : _("No");
576                         }
577                     },
578                     {
579                         "data": "public",
580                         "searchable": true,
581                         "orderable": true,
582                         "render": function( data, type, row, meta ) {
583                             return (data) ? _("Yes") : _("No");
584                         }
585                     },
586                     {
587                         "data": "smtp_server",
588                         "render": function( data, type, row, meta ) {
589                             if ( data.smtp_server_id ) {
590                                 return '<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+encodeURIComponent(data.smtp_server_id)+'">'+data.name.escapeHtml()+'</a>';
591                             }
592                             else {
593                                 return _("Default");
594                             }
595                         },
596                         "searchable": false,
597                         "visible": true,
598                         "orderable": false
599                     },
600                     {
601                         "data": function( row, type, val, meta ) {
602
603                             var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
604                             result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
605                             result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
606                             result += '<input type="hidden" name="op" value="delete_confirm" />';
607                             result += '<button type="submit" id="delete_library_'+row.library_id.escapeHtml()+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</button></form>';
608
609                             return result;
610
611                         },
612                         "searchable": false,
613                         "orderable": false
614                     },
615                     {
616                         "data": "address1",
617                         "searchable": true,
618                         "visible": false,
619                         "orderable": false
620                     },
621                     {
622                         "data": "address2",
623                         "searchable": true,
624                         "visible": false,
625                         "orderable": false
626                     },
627                     {
628                         "data": "address3",
629                         "searchable": true,
630                         "visible": false,
631                         "orderable": false
632                     },
633                     {
634                         "data": "city",
635                         "searchable": true,
636                         "visible": false,
637                         "orderable": false
638                     },
639                     {
640                         "data": "state",
641                         "searchable": true,
642                         "visible": false,
643                         "orderable": false
644                     },
645                     {
646                         "data": "postal_code",
647                         "searchable": true,
648                         "visible": false,
649                         "orderable": false
650                     },
651                     {
652                         "data": "country",
653                         "searchable": true,
654                         "visible": false,
655                         "orderable": false
656                     },
657                     {
658                         "data": "opac_info",
659                         "searchable": true,
660                         "visible": false,
661                         "orderable": false
662                     },
663                     {
664                         "data": "notes",
665                         "searchable": true,
666                         "visible": false,
667                         "orderable": false
668                     }
669                 ]
670             }, table_settings);
671
672             [% UNLESS library %]
673                 $("#Aform").on("submit", function( event ) {
674                     if ( $("#branchcode").val().match(/\s/) ) {
675                         event.preventDefault();
676                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
677                         return false;
678                     } else {
679                         return true;
680                     }
681                 });
682             [% END %]
683         });
684
685         tinyMCE.init({
686             branding : false,
687             relative_urls : false,
688             content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
689             menubar : "file edit view insert format tools table",
690             mode : "specific_textareas",
691             plugins : "autoresize table hr link image charmap lists code emoticons",
692             toolbar : [
693                 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
694                 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
695             ],
696         });
697     </script>
698 [% END %]
699
700 [% INCLUDE 'intranet-bottom.inc' %]