Bug 15496: (follow-up) Update interaction for deleting records
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / moveitem.tt
index 29e6499..1816647 100644 (file)
        [% ELSE %]
            [% IF ( success ) %]
             [% IF from_biblio.items.count == 0 %]
-                <div class="dialog alert">
-                    The record <em>[% from_biblio.title | html %]</em> has [% from_biblio.items.count | html %] attached items.
-                    <p>
-                        <button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record
-                        </button>
-                        <span id="del-bib-success" style="display:none">Record deleted</span>
-                        <span id="del-bib-failure" style="display:none">Attempt to delete record failed.</span>
+                <div class="dialog alert" id="del-bib-alert">
+                    <div id="del-bib-action">
+                        The record <em><a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% from_biblio.id | html %]">[% from_biblio.title | html %]</a></em> has [% from_biblio.items.count | html %] attached items.
+                        <p><button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record
+                        </button></p>
+                    </div>
+                    <p id="del-bib-result">
+                        <span id="del-bib-success" style="display:none"><i class="fa fa-check success"></i> Record deleted</span>
+                        <span id="del-bib-failure" style="display:none"><i class="fa fa-warning"></i> Attempt to delete record failed.</span>
                     </p>
                 </div>
-                <br/>
             [% END %]
 
             <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %]<i>[% bibliotitle | html %]</i></a>.
     <script>
         $("#delete-biblio-btn").on("click", function(){
             if ( confirm(_("Are you sure you want to delete this record?")) ) {
-                let btn = $(this);
                 $("#del-bib-spn").show();
                 let biblionumber = $(this).data('biblionumber');
                 $.ajax({
                     url: '/api/v1/biblios/' + biblionumber,
                     type: 'DELETE',
                     success: function(result) {
-                        btn.hide();
+                        $("#del-bib-action").hide();
                         $('#del-bib-success').show();
+                        $("#del-bib-alert").attr("class","dialog message")
                     },
                     error: function(result) {
-                        btn.hide();
+                        $("#delete-biblio-btn").hide();
                         $('#del-bib-failure').show();
                     }
                 });