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