Bug 17698: (follow-up) Fixing things in Comment 57
authorAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 12 Jun 2018 23:10:24 +0000 (23:10 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 23 Jul 2018 15:23:43 +0000 (15:23 +0000)
3. In the JS console: "ReferenceError: $ is not defined", I did not
investigate it.

Where do you see this in the console? I cannot recreate on opac-user.pl
or on circ/checkout-notes.pl.

5. The alert id=error is displayed then hide in JS, but it's then
displayed half a second. We should hide it by default (css)

Fixed in this patch

6. I would move the "mark seen" and "mark not seen" buttons at the
top of the table

Fixed in this patch

8. Cursor on "Select all" and "Clear all" links must be adjusted

Fixed in this patch

9. $(".btn-xs").click(function(event){
The selector should be $("button.seen, button.notseen"), you
do not want to apply this function to all other btn-xs on
the page (maybe there are only two for now, but who knows
later?)

Fixed in this patch

12. Important: When a note is updated, it's still marked as
seen. Is it the expected behavior?

I don't see this behaviour. When a note is updated it is
marked as not seen.
opav/svc/checkout_notes:79: $issue->set({ notedate =>
dt_from_string(), note => $clean_note, noteseen => 0
})->store;

13. What will happen when hundred of notes will be on this
table? Not blocker but we will need a "hide seen" buttons to
filters the already seen notes.

Added in this patch

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

circ/circulation-home.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt

index f101f6d..1d08a03 100755 (executable)
@@ -40,7 +40,4 @@ $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' )
 
 $template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation');
 
-my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count;
-$template->param( pending_checkout_notes => $pending_checkout_notes );
-
 output_html_with_http_headers $query, $cookie, $template->output;
index cd02e65..ae954ca 100644 (file)
@@ -23,7 +23,7 @@
 
             <h1>Checkout notes</h1>
 
-            <div class="dialog alert" id="error"></div>
+            <div class="dialog alert" id="error" style="display:none;"></div>
 
             [% IF ( selected_count ) %]
                 <div class="dialog message">
             [% END %]
 
             [% IF ( notes.count ) %]
-                <fieldset class="action">
-                    <a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
+                <fieldset class="action" style="cursor:pointer;">
+                    <a class="SelectAll"><i class="fa fa-check"></i> Select all</a>
+                    | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
+                    | <a class="HideSeen"><i class="fa fa-minus-square"></i> Hide seen</a>
+                    | <a class="ShowAll"><i class="fa fa-bars"></i> Show all</a>
                 </fieldset>
 
                 <form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
 
+                    <fieldset class="action">
+                        <button type="submit" class="btn btn-default btn-sm" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
+                        <button type="submit" class="btn btn-default btn-sm" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
+                    </fieldset>
+
                     <table id="notestable">
                         <thead>
                             <tr>
@@ -64,7 +72,7 @@
                                     <td>[% note.note | html %]</td>
                                     <td>[% note.notedate | $KohaDates %]</td>
                                     <td>[% INCLUDE 'patron-title.inc' patron => note.patron hide_patron_infos_if_needed=1 %]</td>
-                                    <td>
+                                    <td class="seen[% note.noteseen %]">
                                         [% IF ( note.noteseen == 0 ) %]
                                             <span id="status_[% note.issue_id %]">Not seen</span>
                                         [% ELSIF ( note.noteseen == 1 ) %]
                         </tbody>
                     </table>
 
-                    <fieldset class="action">
-                        <button type="submit" class="btn btn-default btn-sm" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button>
-                        <button type="submit" class="btn btn-default btn-sm" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button>
-                    </fieldset>
-
                 </form>
 
             [% ELSE %]
                 $(".btn-sm").prop("disabled", true);
             });
 
+            $(".HideSeen").on("click", function(){
+                $(".seen1").parent().hide();
+            });
+
+            $(".ShowAll").on("click", function(){
+                $("tr").show();
+            });
+
             $("#error").hide();
 
             $("input[type='checkbox']").click(function(event){
                 }
             });
 
-            $(".btn-xs").click(function(event){
+            $("button.seen, button.notseen").click(function(event){
                 event.preventDefault(); // prevent form submission
                 var $action = $(this).attr("name");
                 var $issue_id = $(this).data('issue_id');
                     if (data.status == 'success'){
                         if ( $action == 'notseen' ){
                             $("#status_" + $issue_id).text(_("Not seen"));
+                            $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0");
                             $(event.target).siblings(".seen").prop("disabled", false);
                             $(event.target).prop("disabled", true);
                         } else {
                             $("#status_" + $issue_id).text(_("Seen"));
+                            $(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1");
                             $(event.target).siblings(".notseen").prop("disabled", false);
                             $(event.target).prop("disabled", true);
                         }
index 56450bc..0ba1d43 100644 (file)
@@ -41,7 +41,7 @@
                     [% END %]
                     [% IF ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes ) %]
                         <li>
-                            <a class="circ-button" href="/cgi-bin/koha/circ/checkout-notes.pl"><i class="fa fa-sticky-note"></i> Checkout notes</a> [% IF ( pending_checkout_notes ) %]<span class="number_box"><a href="/cgi-bin/koha/circ/checkout-notes.pl">[% pending_checkout_notes %]</a></span>[% END %]
+                            <a class="circ-button" href="/cgi-bin/koha/circ/checkout-notes.pl"><i class="fa fa-sticky-note"></i> Checkout notes</a>
                         </li>
                     [% END %]
                 </ul>