Bugzilla – Attachment 75518 Details for
Bug 20810
Add filters and links in basketgroups page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20810: Add filters and links in basketgroups page
Bug-20810-Add-filters-and-links-in-basketgroups-pa.patch (text/plain), 8.85 KB, created by
Julian Maurice
on 2018-05-24 07:13:57 UTC
(
hide
)
Description:
Bug 20810: Add filters and links in basketgroups page
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-05-24 07:13:57 UTC
Size:
8.85 KB
patch
obsolete
>From e271e6292b2b1b7c9103dbe7fce9997a7dc3996a Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 23 May 2018 15:40:23 +0200 >Subject: [PATCH] Bug 20810: Add filters and links in basketgroups page > >- Open/Closed filtering >- Per-column filtering >- Add links to basketgroups and booksellers >- Display basketgroup id next to basketgroup name > >Test plan: >1. Go to basketgroups page (/acqui/basketgroups.pl) >2. Verify that the "Open/Closed/All" buttons work correctly by showing > respectively only open basketgroups, only closed basketgroups, and > all basketgroups. The "date closed" column should be hidden when only > open basketgroups are shown. > A hidden "Closed" column containing only "1" or "0" was added for > these buttons to work correctly. Verify that you do not see it. >3. Verify that the column filters are displayed under the column headers > and that they filter using only the data in their respective column. > Verify that there is no filter for "Action" column. >4. Verify that the bookseller names are now links to the bookseller > pages >5. Verify that basketgroup names are now links to the basketgroup pages >6. Verify that basketgroup id is displayed in the 'Name' column, next to > the basketgroup name >--- > .../prog/en/modules/acqui/basketgroups.tt | 93 +++++++++++++++++++--- > 1 file changed, 84 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >index e9258a9f23..fee34d7267 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroups.tt >@@ -12,16 +12,16 @@ > [% Asset.css('css/datatables.css') %] > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'datatables.inc' %] >- [% Asset.js('lib/jquery/plugins/jquery.dataTables.columnFilter.js') %] > <script type="text/javascript"> > $(document).ready(function() { > var options = { > "paging": false, > "autoWidth": false, > "columnDefs": [ >- { "visible": false, "targets": 1 }, >+ { "visible": false, "targets": [1, 8] }, > { "orderable": false, "targets": -1 } > ], >+ "orderCellsTop": true, > "orderFixed": [[ 1, 'asc' ]] > }; > [% UNLESS bookseller %] >@@ -40,7 +40,64 @@ > }); > }; > [% END %] >- $("#basketgroups-table").kohaDataTable(options); >+ >+ var thead = $('#basketgroups-table thead'); >+ var filterRow = thead.find('tr').clone(); >+ thead.append(filterRow); >+ >+ var dt = $("#basketgroups-table").kohaDataTable(options); >+ >+ // Enable per-column filtering >+ filterRow.find('th').each(function() { >+ if ($(this).is(':last-child')) { >+ $(this).html(''); >+ return; >+ } >+ >+ var input = $('<input>') >+ .attr('type', 'text') >+ .attr('placeholder', $(this).text()) >+ .on('keyup change', function () { >+ var idx = $(this).parents('th').index(); >+ dt.column(idx + ':visIdx').search($(this).val()).draw(); >+ }); >+ var span = $('<span>') >+ .addClass('filter_column') >+ .append(input); >+ $(this).html(span); >+ }); >+ >+ // Open/Closed filter >+ $('#status-filter input[name="status"]').on('change', function() { >+ if ($(this).is(':checked')) { >+ var value = $(this).val(); >+ switch (value) { >+ case 'open': >+ var visIdx = dt.column(7).index('visible'); >+ $(dt.table().header()) >+ .find('th:nth-child(' + (visIdx + 1) + ') input') >+ .val('') >+ .change(); >+ dt.column(7).visible(false); >+ dt.column(8).search('0'); >+ break; >+ >+ case 'closed': >+ dt.column(7).visible(true); >+ dt.column(8).search('1'); >+ break; >+ >+ case 'all': >+ dt.column(7).visible(true); >+ dt.column(8).search(''); >+ break; >+ >+ default: >+ console.warn('Wrong value for status'); >+ } >+ dt.draw(); >+ } >+ }).change(); > > $('#basketgroups-table').on('click', '.closeandprint', function(e) { > e.preventDefault(); >@@ -88,6 +145,20 @@ > <h1>Basket groups for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% bookseller.id %]">[% bookseller.name %]</a></h1> > [% END %] > >+ <form id="status-filter"> >+ <div class="btn-group" data-toggle="buttons"> >+ <label class="btn btn-default btn-sm active"> >+ <input type="radio" name="status" value="open" autocomplete="off" checked> Open >+ </label> >+ <label class="btn btn-default btn-sm"> >+ <input type="radio" name="status" value="closed" autocomplete="off"> Closed >+ </label> >+ <label class="btn btn-default btn-sm"> >+ <input type="radio" name="status" value="all" autocomplete="off"> All >+ </label> >+ </div> >+ </form> >+ > [% IF basketgroups.size > 0 %] > <table id="basketgroups-table" class="group"> > <thead> >@@ -100,6 +171,7 @@ > <th>No. of ordered titles</th> > <th>No. of received titles</th> > <th>Date closed</th> >+ <th>Closed</th> > <th>Action</th> > </tr> > </thead> >@@ -107,13 +179,15 @@ > [% FOREACH basketgroup IN basketgroups %] > <tr> > <td> >- [% IF ( basketgroup.name ) %] >- [% basketgroup.name %] >- [% ELSE %] >- Basket group no. [% basketgroup.id %] >- [% END %] >+ <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% basketgroup.bookseller.id %]&basketgroupid=[% basketgroup.id %]"> >+ [% IF ( basketgroup.name ) %] >+ [% basketgroup.name %] (#[% basketgroup.id %]) >+ [% ELSE %] >+ <em>Unnamed basket group</em> (#[% basketgroup.id %]) >+ [% END %] >+ </a> > </td> >- <td>[% basketgroup.bookseller.name %]</td> >+ <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basketgroup.bookseller.id %]">[% basketgroup.bookseller.name %]</a></td> > <td>[% Branches.GetName(basketgroup.billingplace) %]</td> > <td> > [% IF (basketgroup.freedeliveryplace) %] >@@ -126,6 +200,7 @@ > <td>[% basketgroup.ordered_titles_count %]</td> > <td>[% basketgroup.received_titles_count %]</td> > <td>[% basketgroup.closeddate | $KohaDates %]</td> >+ <td>[% basketgroup.closeddate ? '1' : '0' %]</td> > <td> > <div class="dropdown"> > <a class="btn btn-default btn-xs dropdown-toggle" id="actions-[% basketgroup.id %]" role="button" data-toggle="dropdown">Actions <b class="caret"></b></a> >-- >2.14.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20810
: 75518