Bug 18251: SCO alerts - need a trigger for successful checkouts
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
index bfa3aec..048923b 100644 (file)
@@ -3,6 +3,7 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE AudioAlerts %]
+[% USE To %]
 [% USE Price %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
@@ -84,6 +85,7 @@
                                     <input type="hidden" name="op" value="returnbook" />
                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
+                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                     <button type="submit" name="returnbook" class="btn"><i class="return"></i> Return this item</button>
                                 </form>
                             [% END %]
@@ -92,6 +94,7 @@
                                 <input type="hidden" name="op" value="" />
                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                 <input type="hidden" name="barcode" value="[% barcode | html %]" />
+                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn back focus" />
                             </form>
                         </div> <!-- / .alert -->
                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
                                     <input type="hidden" name="confirmed" value="" />
+                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                     <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
                                 </form>
                             [% END %]
                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
                                     <input type="hidden" name="confirmed" value="1" />
+                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                     <button type="submit" name="confirm" class="btn"><i class="icon renew"></i> Renew item</button>
                                   </form>
                             [% ELSE %]
                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
                                     <input type="hidden" name="confirmed" value="1" />
+                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                     <button type="submit" class="btn"><i class="icon renew"></i> Renew item</button>
                                 </form>
                             [% END %]
                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
                                 <input type="hidden" name="op" value="" />
                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
+                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                 <button type="submit" class="btn"><i class="icon cancel"></i> Cancel</button>
                             </form>
                         </div>
                         </div>
                     [% END %]
 
+                    [% IF ( issued ) %]
+                    <span class="sco-alert-success"></span>
+                    <p>Item checked out</p>
+                    [% END %]
+
 
                     [% UNLESS ( hide_main ) %]
 
                                             <tr>
                                                 <td>[% ISSUE.issuedate | html %]</td>
                                                 <td>
-                                                    [% IF ( newissues.match(ISSUE.barcode)) %]
-                                                        <span class="label label-info">NEW</span>
-                                                    [% END %]
                                                     [% UNLESS ( noitemlinks ) %]
                                                         <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber | uri %]">[% ISSUE.title | html %]</a>
                                                     [% ELSE %]
                                                         <strong>[% ISSUE.title | html %]</strong>
                                                     [% END %]
+                                                    [% IF ( newissues.match(ISSUE.barcode)) %]
+                                                        <span class="label label-info">NEW</span>
+                                                    [% END %]
                                                     <span class="item-details">[% ISSUE.author | html %]</span>
                                                     ([% ISSUE.barcode | html %])
                                                 </td>
                                                     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
                                                         <input type="hidden" name="patronid" value="[% patronid | html %]" />
                                                         <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
+                                                        <input type="hidden" name="newissues" value="[% newissues | html %]" />
                                                         [% IF ISSUE.can_be_renewed %]
                                                             <input type="hidden" name="op" value="checkout" />
                                                             <input type="hidden" name="confirmed" value="1" />
             return true;
         }
         [% IF Koha.Preference('AudioAlerts') %]
-            var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) | html %]' );
+            var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
             $( document ).ready(function() {
                 if ( AUDIO_ALERTS ) {
                     for ( var k in AUDIO_ALERTS ) {