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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-14 / +60 lines)
Lines 762-771 Link Here
762
                                            [% END # / IF SuspendHoldsOpac %]
762
                                            [% END # / IF SuspendHoldsOpac %]
763
                                            <td class="modify">
763
                                            <td class="modify">
764
                                                [% IF ( RESERVE.is_cancelable_from_opac ) %]
764
                                                [% IF ( RESERVE.is_cancelable_from_opac ) %]
765
                                                    <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
765
                                                    <form id="delete_hold_[% RESERVE.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
766
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber | html %]" />
766
                                                    <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber | html %]" />
767
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id | html %]" />
767
                                                    <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id | html %]" />
768
                                                    <button type="submit" name="submit" class="btn btn-xs btn-danger" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="fa fa-remove"></i> Cancel</button></form>
768
                                                    <button data-title="[% RESERVE.biblio.title | html %] [% FOREACH s IN RESERVE.biblio.subtitles %] [% s | html %] [% END %] [% RESERVE.item.enumchron | html %]" data-reserve_id="[% RESERVE.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-hold"><i class="fa fa-remove"></i> Cancel</button></form>
769
                                                [% END %]
769
                                                [% END %]
770
                                            </td>
770
                                            </td>
771
                                        </tr>
771
                                        </tr>
Lines 775-782 Link Here
775
775
776
                            [% IF SuspendHoldsOpac %]
776
                            [% IF SuspendHoldsOpac %]
777
                                <div>
777
                                <div>
778
                                    <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
778
                                    <form class="form-inline" id="suspend_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
779
                                        <button type="submit" name="submit" class="btn" onclick="return confirmDelete(MSG_CONFIRM_SUSPEND_HOLDS);"><i class="fa fa-pause"></i> Suspend all holds</button>
779
                                        <button type="submit" id="suspend_all_submit" class="btn"><i class="fa fa-pause"></i> Suspend all holds</button>
780
                                        <input type="hidden" name="suspend" value="1" />
780
                                        <input type="hidden" name="suspend" value="1" />
781
781
782
                                        [% IF AutoResumeSuspendedHolds %]
782
                                        [% IF AutoResumeSuspendedHolds %]
Lines 788-795 Link Here
788
                                </div>
788
                                </div>
789
                                <br/>
789
                                <br/>
790
                                <div>
790
                                <div>
791
                                    <form action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
791
                                    <form id="resume_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
792
                                        <button type="submit" name="submit" class="btn" onclick="return confirmDelete(MSG_CONFIRM_RESUME_HOLDS);"><i class="fa fa-play"></i> Resume all suspended holds</button>
792
                                        <button type="submit" id="resume_all_submit" class="btn"><i class="fa fa-play"></i> Resume all suspended holds</button>
793
                                        <input type="hidden" name="suspend" value="0" />
793
                                        <input type="hidden" name="suspend" value="0" />
794
                                    </form>
794
                                    </form>
795
                                </div>
795
                                </div>
Lines 885-891 Link Here
885
885
886
                                                <td class="article-request-cancel">
886
                                                <td class="article-request-cancel">
887
                                                    <span class="tdlabel">Cancel:</span>
887
                                                    <span class="tdlabel">Cancel:</span>
888
                                                    <a class="btn btn-xs btn-danger" href="opac-article-request-cancel.pl?id=[% ar.id | html %]" onclick="return confirmDelete(MSG_CONFIRM_DELETE_ARTREQ);"><i class="fa fa-remove"></i> Cancel</a>
888
                                                    <form action="/cgi-bin/koha/opac-article-request-cancel.pl" id="delete_article_request_[% ar.id | html %]">
889
                                                        <input type="hidden" name="id" value="[% ar.id | html %]" />
890
                                                        <button data-title="[% ar.biblio.title | html %] [% ar.item.enumchron | html %]" data-article-request_id="[% ar.id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-article-request"><i class="fa fa-remove"></i> Cancel</button>
891
                                                    </form>
889
                                                </td>
892
                                                </td>
890
                                            </tr>
893
                                            </tr>
891
                                        [% END %]
894
                                        [% END %]
Lines 917-933 Link Here
917
[% END %]
920
[% END %]
918
921
919
[% INCLUDE 'opac-bottom.inc' %]
922
[% INCLUDE 'opac-bottom.inc' %]
920
921
922
[% BLOCK jsinclude %]
923
[% BLOCK jsinclude %]
923
    [% INCLUDE 'calendar.inc' %]
924
    [% INCLUDE 'calendar.inc' %]
924
    [% INCLUDE 'datatables.inc' %]
925
    [% INCLUDE 'datatables.inc' %]
925
    <script>
926
    <script>
926
        //<![CDATA[
927
        var MSG_CONFIRM_DELETE_ARTREQ   = _("Are you sure you want to cancel this article request?");
928
        var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
929
        var MSG_CONFIRM_SUSPEND_HOLDS = _("Are you sure you want to suspend all holds?");
930
        var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended holds?");
931
927
932
        $(document).ready(function(){
928
        $(document).ready(function(){
933
            $('#opac-user-views').tabs();
929
            $('#opac-user-views').tabs();
Lines 936-941 Link Here
936
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
932
            $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
937
            $(".suspend-until").prop("readonly",1);
933
            $(".suspend-until").prop("readonly",1);
938
934
935
            $(".btn-delete-hold").on("click", function(e){
936
                e.preventDefault();
937
                var hold_title = $(this).data("title");
938
                var reserve_id = $(this).data("reserve_id");
939
                var body = "<p><strong>" + hold_title + "</strong></p>";
940
                confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
941
                        if( result ){
942
                            $("#delete_hold_" + reserve_id ).submit();
943
                        }
944
                    }
945
                );
946
            });
947
948
            $(".btn-delete-article-request").on("click", function(e){
949
                e.preventDefault();
950
                var hold_title = $(this).data("title");
951
                var article_request_id = $(this).data("article-request_id");
952
                var body = "<p><strong>" + hold_title + "</strong></p>";
953
                confirmModal( hold_title, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), function( result ){
954
                        if( result ){
955
                            $("#delete_article_request_" + article_request_id ).submit();
956
                        }
957
                    }
958
                );
959
            });
960
961
            $("#suspend_all_submit").on("click", function(e){
962
                e.preventDefault();
963
                var title = _("Are you sure you want to suspend all holds?");
964
                var body = _("All holds will be suspended.");
965
                confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
966
                        if( result ){
967
                            $("#suspend_all_holds").submit();
968
                        }
969
                    }
970
                );
971
            });
972
973
            $("#resume_all_submit").on("click", function(e){
974
                e.preventDefault();
975
                var title = _("Are you sure you want to resume all suspended holds?");
976
                var body = _("All holds will resume.");
977
                confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
978
                        if( result ){
979
                            $("#resume_all_holds").submit();
980
                        }
981
                    }
982
                );
983
            });
984
939
            var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
985
            var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
940
            dTables.each(function(){
986
            dTables.each(function(){
941
                var thIndex = $(this).find("th.psort").index();
987
                var thIndex = $(this).find("th.psort").index();
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/global.js (-1 / +36 lines)
Lines 51-53 function suffixOf (s, tok) { Link Here
51
    var index = s.indexOf(tok);
51
    var index = s.indexOf(tok);
52
    return s.substring(index + 1);
52
    return s.substring(index + 1);
53
}
53
}
54
- 
54
55
// Adapted from https://gist.github.com/jnormore/7418776
56
function confirmModal(message, title, yes_label, no_label, callback) {
57
    $("#bootstrap-confirm-box-modal").data('confirm-yes', false);
58
    if($("#bootstrap-confirm-box-modal").length == 0) {
59
        $("body").append('<div id="bootstrap-confirm-box-modal" class="modal">\
60
            <div class="modal-dialog">\
61
                <div class="modal-content">\
62
                    <div class="modal-header" style="min-height:40px;">\
63
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">&times;</button>\
64
                        <h4 class="modal-title"></h4>\
65
                    </div>\
66
                    <div class="modal-body"><p></p></div>\
67
                    <div class="modal-footer">\
68
                        <a href="#" id="bootstrap-confirm-box-modal-submit" class="btn btn-danger"><i class="fa fa-check"></i></a>\
69
                        <a href="#" id="bootstrap-confirm-box-modal-cancel" data-dismiss="modal" class="btn btn-default"><i class="fa fa-remove"></i></a>\
70
                    </div>\
71
                </div>\
72
            </div>\
73
        </div>');
74
        $("#bootstrap-confirm-box-modal-submit").on('click', function () {
75
            $("#bootstrap-confirm-box-modal").data('confirm-yes', true);
76
            $("#bootstrap-confirm-box-modal").modal('hide');
77
            return false;
78
        });
79
        $("#bootstrap-confirm-box-modal").on('hide.bs.modal', function () {
80
            if(callback) callback($("#bootstrap-confirm-box-modal").data('confirm-yes'));
81
        });
82
    }
83
84
    $("#bootstrap-confirm-box-modal .modal-header h4").text( title || "" );
85
    $("#bootstrap-confirm-box-modal .modal-body p").text( message || "" );
86
    $("#bootstrap-confirm-box-modal-submit").text( yes_label || 'Confirm' );
87
    $("#bootstrap-confirm-box-modal-cancel").text( no_label || 'Cancel' );
88
    $("#bootstrap-confirm-box-modal").modal('show');
89
}

Return to bug 21870