View | Details | Raw Unified | Return to bug 25288
Collapse All | Expand All

(-)a/admin/branches.pl (-5 lines)
Lines 147-157 if ( $op eq 'add_form' ) { Link Here
147
    $op = 'list';
147
    $op = 'list';
148
}
148
}
149
149
150
if ( $op eq 'list' ) {
151
    my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
152
    $template->param( libraries => $libraries, );
153
}
154
155
$template->param(
150
$template->param(
156
    messages => \@messages,
151
    messages => \@messages,
157
    op       => $op,
152
    op       => $op,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-70 / +149 lines)
Lines 183-251 Link Here
183
183
184
[% IF op == 'list' %]
184
[% IF op == 'list' %]
185
    <h3>Libraries</h3>
185
    <h3>Libraries</h3>
186
    [% IF libraries.count %]
186
    <table id="libraries">
187
        <table id="libraries">
187
        <thead>
188
            <thead>
188
            <tr>
189
                <tr>
189
                <th>Name</th>
190
                    <th>Name</th>
190
                <th>Code</th>
191
                    <th>Code</th>
191
                <th>Address</th>
192
                    <th>Address</th>
192
                <th>MARC organization code</th>
193
                    <th>MARC organization code</th>
193
                <th>IP</th>
194
                    <th>IP</th>
194
                <th>Pickup location</th>
195
                    <th>Pickup location</th>
195
                <th>Actions</th>
196
                    <th>Actions</th>
196
            </tr>
197
                </tr>
197
        </thead>
198
            </thead>
198
    </table>
199
            <tbody>
200
                [% FOREACH library IN libraries %]
201
                    <tr>
202
                        <td>[% library.branchname | html %]</td>
203
                        <td>[% library.branchcode | html %]</td>
204
                        <td>
205
                            [% IF library.branchaddress1 %]
206
                                [% library.branchaddress1 | html %][% END %]
207
                            [% IF library.branchaddress2 %]
208
                                <br />[% library.branchaddress2 | html %][% END %]
209
                            [% IF library.branchaddress3 %]
210
                                <br />[% library.branchaddress3 | html %][% END %]
211
                            [% IF library.branchcity %]
212
                                <br />[% library.branchcity | html %][% END %][% IF ( library.branchstate ) %],
213
                                [% library.branchstate | html %][% END %]
214
                            [% IF library.branchzip %]
215
                                [% library.branchzip | html %][% END %]
216
                            [% IF library.branchcountry %]
217
                                <br />[% library.branchcountry | html %][% END %]
218
                            [% IF library.branchphone %]
219
                                <br />Ph: [% library.branchphone | html %][% END %]
220
                            [% IF library.branchfax %]
221
                                <br />Fax: [% library.branchfax | html %][% END %]
222
                            [% IF library.branchemail %]
223
                                <br /><a href="mailto:[% library.branchemail | uri %]">[% library.branchemail | html %]</a>[% END %]
224
                            [% IF library.branchurl %]
225
                                <br /><a href="[% library.branchurl | url %]">[% library.branchurl | html %]</a>[% END %]
226
                            [% IF library.opac_info %]
227
                                <br />OPAC Info: <div>[% library.opac_info | $raw %]</div>[% END %]
228
                            [% IF library.branchnotes %]
229
                                <br />Notes: [% library.branchnotes | html %][% END %]
230
                        </td>
231
                        <td>[% library.marcorgcode | html %]</td>
232
                        <td>[% library.branchip | html %]</td>
233
                        <td>[% IF library.pickup_location %]Yes[% ELSE %]No[% END %]</td>
234
                        <td class="actions">
235
                            <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>
236
                            <form action="/cgi-bin/koha/admin/branches.pl" method="post">
237
                                <input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
238
                                <input type="hidden" name="op" value="delete_confirm" />
239
                                <button type="submit" id="delete_library_[% library.branchcode | html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
240
                            </form>
241
                        </td>
242
                    </tr>
243
                [% END %]
244
            </tbody>
245
        </table>
246
    [% ELSE %]
247
        <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>
248
    [% END %]
249
[% END %]
199
[% END %]
250
200
251
            </main>
201
            </main>
Lines 267-278 Link Here
267
    <script>
217
    <script>
268
        var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
218
        var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
269
        $(document).ready(function() {
219
        $(document).ready(function() {
270
            KohaTable("libraries", {
220
271
                "aoColumnDefs": [
221
            var libraries_url = '/api/v1/libraries';
272
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
222
            var libraries = $("#libraries").api({
273
                ],
223
                "ajax": {
274
                "sPaginationType": "full",
224
                    "url": libraries_url
275
                "exportColumns": [0,1,2,3,4,5]
225
                },
226
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
227
                '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>',
228
                "columns": [
229
                    {
230
                        "data": "name",
231
                        "searchable": true,
232
                        "orderable": true
233
                    },
234
                    {
235
                        "data": "library_id",
236
                        "searchable": true,
237
                        "orderable": true
238
                    },
239
                    {
240
                        "data": function( row, type, val, meta ) {
241
                            const library_info = [];
242
                            if ( row.address1 != null ) library_info.push(row.address1);
243
                            if ( row.address2 != null ) library_info.push(row.address2);
244
                            if ( row.address3 != null ) library_info.push(row.address3);
245
                            // geographical_location = city, state postal_code
246
                            const locations = [];
247
                            if ( row.city != null ) locations.push(row.city);
248
                            if ( row.state != null ) locations.push(row.state);
249
                            const geographical_location = locations.join(', ');
250
                            if ( geographical_location != '' && row.postal_code != null) {
251
                                library_info.push(geographical_location+' '+row.postal_code);
252
                            }
253
                            else {
254
                                library_info.push(geographical_location);
255
                            }
256
                            if ( row.country != null ) library_info.push(row.country);
257
                            if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone);
258
                            if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax);
259
                            if ( row.email != null ) library_info.push('<a href="mailto:'+row.email+'">'+row.email+'</a>');
260
                            if ( row.url != null ) library_info.push('<a href="'+row.url+'">'+row.url+'</a>');
261
                            if ( row.opac_info != null ) library_info.push(_("OPAC Info") + ': <div>'+row.opac_info+'</div>');
262
                            if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes);
263
                            return library_info.join('<br/>');
264
                        },
265
                        "searchable": false,
266
                        "orderable": false
267
                    },
268
                    {
269
                        "data": "marc_org_code",
270
                        "searchable": true,
271
                        "orderable": true
272
                    },
273
                    {
274
                        "data": "ip",
275
                        "searchable": true,
276
                        "orderable": true
277
                    },
278
                    {
279
                        "data": "pickup_location",
280
                        "searchable": true,
281
                        "orderable": true,
282
                        "render": function( data, type, row, meta ) {
283
                            return (data) ? _("Yes") : _("No");
284
                        }
285
                    },
286
                    {
287
                        "data": function( row, type, val, meta ) {
288
289
                            var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode='+row.library_id+'"><i class="fa fa-pencil"></i> '+_("Edit")+'</a>';
290
                            result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
291
                            result += '<input type="hidden" name="branchcode" value="'+row.library_id+'" />';
292
                            result += '<input type="hidden" name="op" value="delete_confirm" />';
293
                            result += '<button type="submit" id="delete_library_'+row.library_id+'" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> '+_("Delete")+'</button></form>';
294
295
                            return result;
296
297
                        },
298
                        "searchable": false,
299
                        "orderable": false
300
                    },
301
                    {
302
                        "data": "address1",
303
                        "searchable": true,
304
                        "visible": false,
305
                        "orderable": false
306
                    },
307
                    {
308
                        "data": "address2",
309
                        "searchable": true,
310
                        "visible": false,
311
                        "orderable": false
312
                    },
313
                    {
314
                        "data": "address3",
315
                        "searchable": true,
316
                        "visible": false,
317
                        "orderable": false
318
                    },
319
                    {
320
                        "data": "city",
321
                        "searchable": true,
322
                        "visible": false,
323
                        "orderable": false
324
                    },
325
                    {
326
                        "data": "state",
327
                        "searchable": true,
328
                        "visible": false,
329
                        "orderable": false
330
                    },
331
                    {
332
                        "data": "postal_code",
333
                        "searchable": true,
334
                        "visible": false,
335
                        "orderable": false
336
                    },
337
                    {
338
                        "data": "country",
339
                        "searchable": true,
340
                        "visible": false,
341
                        "orderable": false
342
                    },
343
                    {
344
                        "data": "opac_info",
345
                        "searchable": true,
346
                        "visible": false,
347
                        "orderable": false
348
                    },
349
                    {
350
                        "data": "notes",
351
                        "searchable": true,
352
                        "visible": false,
353
                        "orderable": false
354
                    },
355
                ]
276
            }, columns_settings);
356
            }, columns_settings);
277
357
278
            [% UNLESS library %]
358
            [% UNLESS library %]
279
- 

Return to bug 25288