Bug 31939: Add page-section to branches template
[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">Home</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     <div class="page-section">
333         <table id="libraries">
334             <thead>
335                 <tr>
336                     <th>Name</th>
337                     <th>Code</th>
338                     <th>Address</th>
339                     <th>MARC organization code</th>
340                     <th>IP</th>
341                     <th>Pickup location</th>
342                     <th>Public</th>
343                     <th>SMTP server</th>
344                     <th data-class-name="actions noExport">Actions</th>
345                 </tr>
346             </thead>
347         </table>
348     </div>
349     [% ELSE %]
350         <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>
351     [% END %]
352 [% END %]
353
354 [% IF op == 'view' && library %]
355     <h1>[% library.branchname | html %]</h1>
356     <div class="row page-section">
357         <div class="col-sm-6">
358             <div class="rows">
359                 <ol>
360                     <li>
361                         <span class="label">Library code: </span>
362                         [% library.branchcode | html %]
363                     </li>
364                     <li>
365                         <span class="label">Name: </span>
366                         [% library.branchname | html %]
367                     </li>
368                     <li>
369                         <span class="label">Category:</span>
370                         [% category.categoryname | html %]
371                     </li>
372                     <li>
373                         <span class="label">Address line 1: </span>
374                         [% library.branchaddress1 | html %]
375                     </li>
376                     <li>
377                         <span class="label">Address line 2: </span>
378                         [% library.branchaddress2 | html %]
379                     </li>
380                     <li>
381                         <span class="label">Address line 3: </span>
382                         [% library.branchaddress3 | html %]
383                     </li>
384                     <li>
385                         <span class="label">City: </span>
386                         [% library.branchcity | html %]
387                     </li>
388                     <li>
389                         <span class="label">State: </span>
390                         [% library.branchstate | html %]
391                     </li>
392                     <li>
393                         <span class="label">ZIP/Postal code: </span>
394                         [% library.branchzip | html %]
395                     </li>
396                     <li>
397                         <span class="label">Country: </span>
398                         [% library.branchcountry | html %]
399                     </li>
400                     <li>
401                         <span class="label">Phone: </span>
402                         [% library.branchphone | html %]
403                     </li>
404                     <li>
405                         <span class="label">Fax: </span>
406                         [% library.branchfax | html %]
407                     </li>
408                 </ol>
409             </div>
410         </div>
411         <div class="col-sm-6">
412             <div class="rows">
413                 <ol>
414                     <li>
415                         <span class="label">Email: </span>
416                         [% IF ( library.branchemail ) %]
417                             <a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
418                         [% END %]
419                     </li>
420                     <li>
421                         <span class="label">ILL staff email: </span>
422                         [% IF ( library.branchillemail ) %]
423                             <a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
424                         [% END %]
425                     </li>
426                     <li>
427                         <span class="label">Reply-To: </span>
428                         [% IF ( library.branchreplyto ) %]
429                             <a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
430                         [% END %]
431                     </li>
432                     <li>
433                         <span class="label">Return-Path: </span>
434                         [% library.branchreturnpath | html %]
435                     </li>
436                     <li>
437                         <span class="label">SMTP server: </span>
438                         [% smtp_server.name | html %]
439                     </li>
440                     <li>
441                         <span class="label">URL: </span>
442                         [% IF ( library.branchurl ) %]
443                             <a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
444                         [% END %]
445                     </li>
446                     <li>
447                         <span class="label">IP: </span>
448                         [% library.branchip | html %]
449                     </li>
450                     <li>
451                         <span class="label">MARC organization code</span>
452                         [% library.marcorgcode | html %]
453                     </li>
454                     <li>
455                         <span class="label">Notes: </span>
456                         [% library.branchnotes | html %]
457                     </li>
458                     <li>
459                         <span class="label">Pickup location: </span>
460                         [% IF ( library.pickup_location ) %]
461                             <span>Yes</span>
462                         [% ELSE %]
463                             <span>No</span>
464                         [% END %]
465                     </li>
466                     <li>
467                         <span class="label">Public: </span>
468                         [% IF ( library.public ) %]
469                             <span>Yes</span>
470                         [% ELSE %]
471                             <span>No</span>
472                         [% END %]
473                     </li>
474                 </ol>
475             </div> <!-- /.rows -->
476         </div> <!-- /.col-sm-6 -->
477     </div> <!-- /.row -->
478     [% IF OpacLibraryInfo %]<!-- opac_info -->
479         <div class="row page-section">
480             <div class="col-sm-12">
481                 <h2>OPAC information</h2>
482                 <div>[% OpacLibraryInfo.content | $raw %]</div>
483             </div>
484         </div>
485     [% END %]
486 [% ELSIF op == 'view' %]
487     <div>This library does not exist.</div>
488 [% END %]
489
490             </main>
491         </div> <!-- /.col-sm-10.col-sm-push-2 -->
492
493         <div class="col-sm-2 col-sm-pull-10">
494             <aside>
495                 [% INCLUDE 'admin-menu.inc' %]
496             </aside>
497         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
498      </div> <!-- /.row -->
499
500 [% MACRO jsinclude BLOCK %]
501     [% Asset.js("js/admin-menu.js") | $raw %]
502     [% INCLUDE 'datatables.inc' %]
503     [% INCLUDE 'columns_settings.inc' %]
504     [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
505     [% INCLUDE 'str/tinymce_i18n.inc' %]
506     <script>
507         var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
508         var saved_table = localStorage.getItem("DataTables_libraries_/cgi-bin/koha/admin/branches.pl");
509         var updated_settings = get_columns_saved_state(saved_table, table_settings);
510
511         $(document).ready(function() {
512
513             var libraries_url = '/api/v1/libraries';
514             var libraries = $("#libraries").kohaTable({
515                 "ajax": {
516                     "url": libraries_url
517                 },
518                 'embed': [ 'smtp_server' ],
519                 '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>',
520                 "stateSave": true,
521                 "columnDefs": [ {
522                     "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16],
523                     "render": function (data, type, row, meta) {
524                         if ( type == 'display' ) {
525                             if ( data != null ) {
526                                 return data.escapeHtml();
527                             }
528                             else {
529                                 return "";
530                             }
531                         }
532                         return data;
533                     }
534                 } ],
535                 "columns": [
536                     {
537                         "data": "name",
538                         "searchable": true,
539                         "orderable": true,
540                         "render": function( data, type, row, meta ) {
541                             return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
542                         }
543                     },
544                     {
545                         "data": "library_id",
546                         "searchable": true,
547                         "orderable": true
548                     },
549                     {
550                         "data": function( row, type, val, meta ) {
551                             const library_info = [];
552                             if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
553                             if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
554                             if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
555                             // geographical_location = city, state postal_code
556                             const locations = [];
557                             if ( row.city != null ) locations.push(row.city.escapeHtml());
558                             if ( row.state != null ) locations.push(row.state.escapeHtml());
559                             const geographical_location = locations.join(', ');
560                             if ( geographical_location != '' && row.postal_code != null) {
561                                 library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
562                             }
563                             else {
564                                 library_info.push(geographical_location);
565                             }
566                             if ( row.country != null ) library_info.push(row.country.escapeHtml());
567                             if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
568                             if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
569                             if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
570                             if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
571                             if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
572                             return library_info.join('<br/>');
573                         },
574                         "searchable": false,
575                         "orderable": false
576                     },
577                     {
578                         "data": "marc_org_code",
579                         "searchable": true,
580                         "orderable": true
581                     },
582                     {
583                         "data": "ip",
584                         "searchable": true,
585                         "orderable": true
586                     },
587                     {
588                         "data": "pickup_location",
589                         "searchable": true,
590                         "orderable": true,
591                         "render": function( data, type, row, meta ) {
592                             return (data) ? _("Yes") : _("No");
593                         }
594                     },
595                     {
596                         "data": "public",
597                         "searchable": true,
598                         "orderable": true,
599                         "render": function( data, type, row, meta ) {
600                             return (data) ? _("Yes") : _("No");
601                         }
602                     },
603                     {
604                         "data": "smtp_server",
605                         "render": function( data, type, row, meta ) {
606                             if ( data.smtp_server_id ) {
607                                 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>';
608                             }
609                             else {
610                                 return _("Default");
611                             }
612                         },
613                         "searchable": false,
614                         "visible": true,
615                         "orderable": false
616                     },
617                     {
618                         "data": function( row, type, val, meta ) {
619
620                             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>';
621                             result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
622                             result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
623                             result += '<input type="hidden" name="op" value="delete_confirm" />';
624                             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>';
625
626                             return result;
627
628                         },
629                         "searchable": false,
630                         "orderable": false
631                     },
632                     {
633                         "data": "address1",
634                         "searchable": true,
635                         "visible": false,
636                         "orderable": false
637                     },
638                     {
639                         "data": "address2",
640                         "searchable": true,
641                         "visible": false,
642                         "orderable": false
643                     },
644                     {
645                         "data": "address3",
646                         "searchable": true,
647                         "visible": false,
648                         "orderable": false
649                     },
650                     {
651                         "data": "city",
652                         "searchable": true,
653                         "visible": false,
654                         "orderable": false
655                     },
656                     {
657                         "data": "state",
658                         "searchable": true,
659                         "visible": false,
660                         "orderable": false
661                     },
662                     {
663                         "data": "postal_code",
664                         "searchable": true,
665                         "visible": false,
666                         "orderable": false
667                     },
668                     {
669                         "data": "country",
670                         "searchable": true,
671                         "visible": false,
672                         "orderable": false
673                     },
674                     {
675                         "data": function( row, type, val, meta ) {
676                             return ''; // provisional placeholder for opac_info
677                         },
678                         "searchable": false,
679                         "visible": false,
680                         "orderable": false
681                     },
682                     {
683                         "data": "notes",
684                         "searchable": true,
685                         "visible": false,
686                         "orderable": false
687                     }
688                 ]
689             }, updated_settings);
690
691             [% UNLESS library %]
692                 $("#Aform").on("submit", function( event ) {
693                     if ( $("#branchcode").val().match(/\s/) ) {
694                         event.preventDefault();
695                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
696                         return false;
697                     } else {
698                         return true;
699                     }
700                 });
701             [% END %]
702         });
703
704         tinyMCE.init({
705             branding : false,
706             relative_urls : false,
707             content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
708             menubar : "file edit view insert format tools table",
709             mode : "specific_textareas",
710             plugins : "autoresize table hr link image charmap lists code emoticons",
711             toolbar : [
712                 "formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
713                 "table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code"
714             ],
715         });
716     </script>
717 [% END %]
718
719 [% INCLUDE 'intranet-bottom.inc' %]