Bug 16735: Migrate library search groups into the new hierarchical groups
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / branches.tt
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Administration &rsaquo; Libraries
4 [% IF op == 'add_form' %]
5     &rsaquo;[% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
6 [% ELSIF op == 'delete_confirm' %]
7     &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
8 [% END %]
9 </title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
12 </head>
13
14 <body id="admin_branches" class="admin">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'prefs-admin-search.inc' %]
17
18 <div id="breadcrumbs">
19     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
21 &rsaquo; <a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
22 [% IF op == 'add_form'  %]
23 &rsaquo; [% IF library %]Modify library[% ELSE %]New library [% library.branchcode | html %][% END %]
24 [% ELSIF op == 'delete_confirm' %]
25 &rsaquo; Confirm deletion of library '[% library.branchcode | html %]'
26 [% END %]
27 </div>
28
29 <div id="doc3" class="yui-t2">
30
31    <div id="bd">
32     <div id="yui-main">
33     <div class="yui-b">
34
35 [% FOREACH m IN messages %]
36     <div class="dialog [% m.type %]">
37         [% SWITCH m.code %]
38         [% CASE 'error_on_update' %]
39             An error occurred when updating this library. Perhaps it already exists.
40         [% CASE 'error_on_insert' %]
41             An error occurred when adding this library. The branchcode might already exist.
42         [% CASE 'error_on_delete' %]
43             An error occurred when deleting this library. Check the logs.
44         [% CASE 'success_on_update' %]
45             Library updated successfully.
46         [% CASE 'success_on_insert' %]
47             Library added successfully.
48         [% CASE 'success_on_delete' %]
49             Library deleted successfully.
50         [% CASE 'cannot_delete_library' %]
51             This library cannot be deleted. Patrons or items are still using it
52             [% IF m.data.patrons_count and m.data.items_count %]
53                 ([% m.data.patrons_count %] patrons and [% m.data.items_count %] items).
54             [% ELSIF m.data.patrons_count %]
55                 ([% m.data.patrons_count %] patrons).
56             [% ELSIF m.data.items_count %]
57                 ([% m.data.items_count %] items).
58             [% END %]
59         [% CASE 'error_on_update_category' %]
60             An error occurred when updating this library category. Perhaps it already exists.
61         [% CASE 'error_on_insert_category' %]
62             An error occurred when adding this library category. The categorycode might already exist.
63         [% CASE 'error_on_delete_category' %]
64             An error occurred when deleting this library category. Check the logs.
65         [% CASE 'success_on_update_category' %]
66             Library category updated successfully.
67         [% CASE 'success_on_insert_category' %]
68             Library category added successfully.
69         [% CASE 'success_on_delete_category' %]
70             Library category deleted successfully.
71         [% CASE 'cannot_delete_category' %]
72             This library category cannot be deleted. [% m.data.libraries_count %] libraries are still using it.
73         [% CASE %]
74             [% m.code %]
75         [% END %]
76     </div>
77 [% END %]
78
79 [% IF op == 'list' %]
80     <div id="toolbar" class="btn-toolbar">
81         <a class="btn btn-default btn-sm" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
82     </div>
83 [% END %]
84
85 [% IF op == 'add_form' %]
86     <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
87     <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
88         <fieldset class="rows">
89             <input type="hidden" name="op" value="add_validate" />
90             [% IF library %]
91                 <input type="hidden" name="is_a_modif" value="1" />
92             [% END %]
93             <ol>
94                 <li>
95                     [% IF library %]
96                         <span class="label">Library code: </span>
97                         <input type="hidden" name="branchcode" value="[% library.branchcode |html %]" />
98                         [% library.branchcode | html %]
99                     [% ELSE %]
100                         <label for="branchcode" class="required">Library code: </label>
101                         <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
102                         <span class="required">Required</span>
103                     [% END %]
104                 </li>
105                 <li>
106                     <label for="branchname" class="required">Name: </label>
107                     <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname |html %]" class="required" required="required" />
108                     <span class="required">Required</span>
109                 </li>
110             </ol>
111         </fieldset>
112         [% IF categories %]
113             <fieldset class="rows"><legend>Group(s):</legend>
114                 <ol>
115                     [% FOREACH category IN categories %]
116                         <li>
117                             <label for="[% category.categorycode %]">[% category.categoryname |html %]: </label>
118                             [% IF category and selected_categorycodes.grep(category.categorycode).size %]
119                                 <input type="checkbox" id="[% category.categorycode %]" name="selected_categorycode_[% category.categorycode %]" checked="checked" />
120                             [% ELSE %]
121                                 <input type="checkbox" id="[% category.categorycode %]" name="selected_categorycode_[% category.categorycode %]" />
122                             [% END %]
123                             <span class="hint">[% category.codedescription |html %]</span>
124                         </li>
125                     [% END %]
126                 </ol>
127             </fieldset>
128         [% END %]
129         <fieldset class="rows">
130             <ol>
131                 <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 |html %]" /></li>
132                 <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 |html %]" /></li>
133                 <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 |html %]" /></li>
134                 <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity |html %]" /></li>
135                 <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate |html %]" /></li>
136                 <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip"  size="25" maxlength="25" value="[% library.branchzip |html %]" /></li>
137                 <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry |html %]" /></li>
138                 <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone |html %]" /></li>
139                 <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax |html %]" /></li>
140                 <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email"  size="80" value="[% library.branchemail |html %]" /></li>
141                 <li><label for="branchreplyto">Reply-To: </label> <input type="text" name="branchreplyto" id="branchreplyto" class="email"  size="80" value="[% library.branchreplyto |html %]" /><br /><span class="hint">Default: ReplyToDefault system preference</span></li>
142                 <li><label for="branchreturnpath">Return-Path: </label> <input type="text" name="branchreturnpath" id="branchreturnpath" class="email"  size="80" value="[% library.branchreturnpath |html %]" /><br /><span class="hint">Default: ReturnpathDefault system preference</span></li>
143                 <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl"  size="80" value="[% library.branchurl |html %]" class="url" /></li>
144                 <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info |html %]</textarea></li>
145                 <li><label for="branchip">IP: </label><input type="text" name="branchip" id="branchip"  size="15" maxlength="15" value="[% library.branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
146                 <li><label for="marcorgccode">MARC organization code</label> <input type="text" name="marcorgcode" id="marcorgcode" size="16" value="[% library.marcorgcode |html %]" /> <span class="hint">If not filled in defaults to system preference MARCOrgCode. You can obtain your code from <a href="http://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.</span>
147                 <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes |html %]" /></li>
148             </ol>
149         </fieldset>
150         <fieldset class="action">
151             <input type="submit" value="Submit" />
152             <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
153         </fieldset>
154     </form>
155 [% END %]
156
157 [% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
158     <div class="dialog alert">
159         <form action="/cgi-bin/koha/admin/branches.pl" method="post">
160             <h3>Are you sure you want to delete [% library.branchname |html %] ([% library.branchcode | html %])?</h3>
161             <input type="hidden" name="op" value="delete_confirmed" />
162             <input type="hidden" name="branchcode" value="[% library.branchcode |html %]" />
163             <input type="hidden" name="branchname" value="[% library.branchname |html %]">
164             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
165         </form>
166         <form action="/cgi-bin/koha/admin/branches.pl" method="get">
167             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
168         </form>
169     </div>
170 [% END %]
171
172 [% IF op == 'list' %]
173     <h3>Libraries</h3>
174     [% IF libraries.count %]
175         <table id="branchest">
176             <thead>
177                 <tr>
178                     <th>Name</th>
179                     <th>Code</th>
180                     <th>Address</th>
181                     <th>Properties</th>
182                     <th>MARC organization code</th>
183                     <th>IP</th>
184                     <th>Actions</th>
185                 </tr>
186             </thead>
187             <tbody>
188                 [% FOREACH library IN libraries %]
189                     <tr>
190                         <td>[% library.branchname |html %]</td>
191                         <td>[% library.branchcode |html %]</td>
192                         <td>
193                             [% IF library.branchaddress1 %]
194                                 [% library.branchaddress1 |html %][% END %]
195                             [% IF library.branchaddress2 %]
196                                 <br />[% library.branchaddress2 |html %][% END %]
197                             [% IF library.branchaddress3 %]
198                                 <br />[% library.branchaddress3 |html %][% END %]
199                             [% IF library.branchcity %]
200                                 <br />[% library.branchcity |html %][% END %][% IF ( library.branchstate ) %],
201                                 [% library.branchstate |html %][% END %]
202                             [% IF library.branchzip %]
203                                 [% library.branchzip |html %][% END %]
204                             [% IF library.branchcountry %]
205                                 <br />[% library.branchcountry |html %][% END %]
206                             [% IF library.branchphone %]
207                                 <br />Ph: [% library.branchphone |html %][% END %]
208                             [% IF library.branchfax %]
209                                 <br />Fax: [% library.branchfax |html %][% END %]
210                             [% IF library.branchemail %]
211                                 <br /><a href="mailto:[% library.branchemail %]">[% library.branchemail |html %]</a>[% END %]
212                             [% IF library.branchurl %]
213                                 <br /><a href="[% library.branchurl %]">[% library.branchurl |html %]</a>[% END %]
214                             [% IF library.opac_info %]
215                                 <br />OPAC Info: <div>[% library.opac_info %]</div>[% END %]
216                             [% IF library.branchnotes %]
217                                 <br />Notes: [% library.branchnotes |html %][% END %]
218                         </td>
219                         <td>
220                             [% FOREACH category IN library.get_categories %]
221                                 [% category.categoryname |html %]<br />
222                             [% END %]
223                         </td>
224                         <td>[% library.marcorgcode %]</td>
225                         <td>[% library.branchip %]</td>
226                         <td class="actions">
227                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode=[% library.branchcode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
228                             <form action="/cgi-bin/koha/admin/branches.pl" method="post">
229                                 <input type="hidden" name="branchcode" value="[% library.branchcode |html %]" />
230                                 <input type="hidden" name="op" value="delete_confirm" />
231                                 <button type="submit" id="delete_library_[% library.branchcode | html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
232                             </form>
233                         </td>
234                     </tr>
235                 [% END %]
236             </tbody>
237         </table>
238     [% ELSE %]
239         <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>
240     [% END %]
241 [% END %]
242
243 </div>
244 </div>
245 <div class="yui-b">
246 [% INCLUDE 'admin-menu.inc' %]
247 </div>
248 </div>
249
250 [% MACRO jsinclude BLOCK %]
251     <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu_[% KOHA_VERSION %].js"></script>
252     [% INCLUDE 'datatables.inc' %]
253     <script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce_[% KOHA_VERSION %].js"></script>
254     <script type="text/javascript">
255         $(document).ready(function() {
256             $("#branchest").dataTable($.extend(true, {}, dataTablesDefaults, {
257                 "aoColumnDefs": [
258                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
259                 ],
260                 "iDisplayLength": 10,
261                 "sPaginationType": "four_button"
262             }));
263
264             [% UNLESS library %]
265                 $("#Aform").on("submit", function( event ) {
266                     if ( $("#branchcode").val().match(/\s/) ) {
267                         event.preventDefault();
268                         alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
269                         return false;
270                     } else {
271                         return true;
272                     }
273                 });
274             [% END %]
275         });
276         tinyMCE.init({
277             mode : "textareas",
278             theme : "advanced",
279             content_css : "[% interface %]/[% theme %]/css/tinymce.css",
280             plugins : "table,save,advhr,advlink,contextmenu",
281             theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,",
282             theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap",
283             // theme_advanced_buttons3 : "",
284             theme_advanced_toolbar_location : "top",
285             theme_advanced_toolbar_align : "left",
286             theme_advanced_path_location : "bottom",
287             theme_advanced_resizing : true,
288             apply_source_formatting : true
289         });
290     </script>
291 [% END %]
292
293 [% INCLUDE 'intranet-bottom.inc' %]