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

(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-47 / +41 lines)
Lines 554-562 $(document).ready(function() { Link Here
554
                        let content = "";
554
                        let content = "";
555
555
556
                        if ( oObj.return_claim_id ) {
556
                        if ( oObj.return_claim_id ) {
557
                          content = `<span class="badge">${oObj.return_claim_created_on_formatted}</span>`;
557
                          content = '<span class="badge">' + oObj.return_claim_created_on_formatted + '</span>';
558
                        } else {
558
                        } else {
559
                          content = `<a class="btn btn-default btn-xs claim-returned-btn" data-itemnumber="${oObj.itemnumber}"><i class="fa fa-exclamation-circle"></i> ${RETURN_CLAIMED_MAKE}</a>`;
559
                          content = '<a class="btn btn-default btn-xs claim-returned-btn" data-itemnumber="' + oObj.itemnumber + '"><i class="fa fa-exclamation-circle"></i>' + RETURN_CLAIMED_MAKE + '</a>';
560
                        }
560
                        }
561
                        return content;
561
                        return content;
562
                    }
562
                    }
Lines 845-851 $(document).ready(function() { Link Here
845
845
846
        $('#claims-returned-modal').modal('hide')
846
        $('#claims-returned-modal').modal('hide')
847
847
848
        $(`.claim-returned-btn[data-itemnumber='${itemnumber}']`).replaceWith(`<img id='return_claim_spinner_${itemnumber}' src='${interface}/${theme}/img/spinner-small.gif' />`);
848
        $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]').replaceWith('<img id="return_claim_spinner_' + itemnumber + ' src=' + interface + '/' + theme + '/img/spinner-small.gif />');
849
849
850
        params = {
850
        params = {
851
            item_id: itemnumber,
851
            item_id: itemnumber,
Lines 862-868 $(document).ready(function() { Link Here
862
862
863
            let content = "";
863
            let content = "";
864
            if ( data.claim_id ) {
864
            if ( data.claim_id ) {
865
                content = `<span class="badge">${created_on.toLocaleDateString()}</span>`;
865
                content = '<span class="badge">' + created_on.toLocaleDateString() + '</span>';
866
                $(id).parent().parent().addClass('ok');
866
                $(id).parent().parent().addClass('ok');
867
            } else {
867
            } else {
868
                content = RETURN_CLAIMED_FAILURE;
868
                content = RETURN_CLAIMED_FAILURE;
Lines 900-913 $(document).ready(function() { Link Here
900
                    },
900
                    },
901
                    {
901
                    {
902
                        "mDataProp": function ( oObj ) {
902
                        "mDataProp": function ( oObj ) {
903
                              let title = `<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=${oObj.biblionumber}">
903
                              let title = '<a class="return-claim-title strong" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + oObj.biblionumber + '">'
904
                                  ${oObj.title}
904
                                  + oObj.title
905
                                  ${oObj.enumchron || ""}
905
                                  + ( oObj.enumchron || "" )
906
                              </a>`;
906
                              + '</a>';
907
                              if ( oObj.author ) {
907
                              if ( oObj.author ) {
908
                                title += `by ${oObj.author}`;
908
                                title += 'by ' + oObj.author;
909
                              }
909
                              }
910
                              title += `<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=${oObj.biblionumber}&itemnumber=${oObj.itemnumber}">${oObj.barcode}</a>`;
910
                              title += '<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=' + oObj.biblionumber + '&itemnumber=' + oObj.itemnumber + '">' + oObj.barcode + '</a>';
911
911
912
                              return title;
912
                              return title;
913
                        }
913
                        }
Lines 915-924 $(document).ready(function() { Link Here
915
                    {
915
                    {
916
                        "sClass": "return-claim-notes-td",
916
                        "sClass": "return-claim-notes-td",
917
                        "mDataProp": function ( oObj ) {
917
                        "mDataProp": function ( oObj ) {
918
                            return `
918
                            return '<span id="return-claim-notes-static-' + oObj.id + '" class="return-claim-notes" data-return-claim-id="' + oObj.id + '">' + oObj.notes + '</span>'
919
                                <span id="return-claim-notes-static-${oObj.id}" class="return-claim-notes" data-return-claim-id="${oObj.id}">${oObj.notes}</span>
919
                                + '<i style="float:right" class="fa fa-pencil-square-o" title="Double click to edit"></i>';
920
                                <i style="float:right" class="fa fa-pencil-square-o" title="Double click to edit"></i>
921
                            `;
922
                        }
920
                        }
923
                    },
921
                    },
924
                    {
922
                    {
Lines 937-968 $(document).ready(function() { Link Here
937
                        "mDataProp": function ( oObj ) {
935
                        "mDataProp": function ( oObj ) {
938
                            if ( ! oObj.resolution ) return "";
936
                            if ( ! oObj.resolution ) return "";
939
937
940
                            let desc = `<strong>${oObj.resolution_data.lib}</strong> on <i>${oObj.resolved_on}</i>`;
938
                            let desc = '<strong>' + oObj.resolution_data.lib + '</strong> on <i>' + oObj.resolved_on + '</i>';
941
                            if (oObj.resolved_by_data) desc += ` by <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=${oObj.resolved_by_data.borrowernumber}">${oObj.resolved_by_data.firstname || ""} ${oObj.resolved_by_data.surname || ""}</a>`;
939
                            if (oObj.resolved_by_data) desc += ' by <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + oObj.resolved_by_data.borrowernumber + '">' + ( oObj.resolved_by_data.firstname || "" ) + ( oObj.resolved_by_data.surname || "" ) + '</a>';
942
                            return desc;
940
                            return desc;
943
                        }
941
                        }
944
                    },
942
                    },
945
                    {
943
                    {
946
                        "mDataProp": function ( oObj ) {
944
                        "mDataProp": function ( oObj ) {
947
                            let delete_html = oObj.resolved_on
945
                            let delete_html = oObj.resolved_on
948
                                ? `<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="${oObj.id}"><i class="fa fa-trash"></i> Delete</a></li>`
946
                                ? '<li><a href="#" class="return-claim-tools-delete" data-return-claim-id="' + oObj.id + '"><i class="fa fa-trash"></i> Delete</a></li>'
949
                                : "";
947
                                : "";
950
                            let resolve_html = ! oObj.resolution
948
                            let resolve_html = ! oObj.resolution
951
                                ? `<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="${oObj.id}"><i class="fa fa-check-square"></i> Resolve</a></li>`
949
                                ? '<li><a href="#" class="return-claim-tools-resolve" data-return-claim-id="' + oObj.id + '"><i class="fa fa-check-square"></i> Resolve</a></li>'
952
                                : "";
950
                                : "";
953
951
954
                            return `
952
                            return  '<div class="btn-group">'
955
                                <div class="btn-group">
953
                                  + ' <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
956
                                  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
954
                                  + '  Actions <span class="caret"></span>'
957
                                    Actions <span class="caret"></span>
955
                                  + ' </button>'
958
                                  </button>
956
                                  + ' <ul class="dropdown-menu">'
959
                                  <ul class="dropdown-menu">
957
                                  + '  <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="' + oObj.id + '"><i class="fa fa-edit"></i> Edit notes</a></li>'
960
                                    <li><a href="#" class="return-claim-tools-editnotes" data-return-claim-id="${oObj.id}"><i class="fa fa-edit"></i> Edit notes</a></li>
958
                                  + resolve_html
961
                                    ${resolve_html}
959
                                  + delete_html
962
                                    ${delete_html}
960
                                  + ' </ul>'
963
                                  </ul>
961
                                  + ' </div>';
964
                                </div>
965
                            `;
966
                        }
962
                        }
967
                    },
963
                    },
968
                ],
964
                ],
Lines 989-1009 $(document).ready(function() { Link Here
989
985
990
    $('body').on('click', '.return-claim-tools-editnotes', function() {
986
    $('body').on('click', '.return-claim-tools-editnotes', function() {
991
        let id = $(this).data('return-claim-id');
987
        let id = $(this).data('return-claim-id');
992
        $(`#return-claim-notes-static-${id}`).parent().dblclick();
988
        $('#return-claim-notes-static-' + id).parent().dblclick();
993
    });
989
    });
994
    $('body').on('dblclick', '.return-claim-notes-td', function() {
990
    $('body').on('dblclick', '.return-claim-notes-td', function() {
995
        let elt = $(this).children('.return-claim-notes');
991
        let elt = $(this).children('.return-claim-notes');
996
        let id = elt.data('return-claim-id');
992
        let id = elt.data('return-claim-id');
997
        if ( $(`#return-claim-notes-editor-textarea-${id}`).length == 0 ) {
993
        if ( $('#return-claim-notes-editor-textarea-' + id).length == 0 ) {
998
            let note = elt.text();
994
            let note = elt.text();
999
            let editor = `
995
            let editor =
1000
                <span id="return-claim-notes-editor-${id}">
996
                '  <span id="return-claim-notes-editor-' + id + '">'
1001
                    <textarea id="return-claim-notes-editor-textarea-${id}">${note}</textarea>
997
                + ' <textarea id="return-claim-notes-editor-textarea-' + id + '">' + note + '</textarea>'
1002
                    <br/>
998
                + ' <br/>'
1003
                    <a class="btn btn-default btn-xs claim-returned-notes-editor-submit" data-return-claim-id="${id}"><i class="fa fa-save"></i> Update</a>
999
                + ' <a class="btn btn-default btn-xs claim-returned-notes-editor-submit" data-return-claim-id="' + id + '"><i class="fa fa-save"></i> Update</a>'
1004
                    <a class="claim-returned-notes-editor-cancel" data-return-claim-id="${id}" href="#">Cancel</a>
1000
                + ' <a class="claim-returned-notes-editor-cancel" data-return-claim-id="' + id + '" href="#">Cancel</a>'
1005
                </span>
1001
                + '</span>';
1006
            `;
1007
            elt.hide();
1002
            elt.hide();
1008
            $(editor).insertAfter( elt );
1003
            $(editor).insertAfter( elt );
1009
        }
1004
        }
Lines 1011-1017 $(document).ready(function() { Link Here
1011
1006
1012
    $('body').on('click', '.claim-returned-notes-editor-submit', function(){
1007
    $('body').on('click', '.claim-returned-notes-editor-submit', function(){
1013
        let id = $(this).data('return-claim-id');
1008
        let id = $(this).data('return-claim-id');
1014
        let notes = $(`#return-claim-notes-editor-textarea-${id}`).val();
1009
        let notes = $('#return-claim-notes-editor-textarea-' + id).val();
1015
1010
1016
        let params = {
1011
        let params = {
1017
            notes: notes,
1012
            notes: notes,
Lines 1021-1031 $(document).ready(function() { Link Here
1021
        $(this).parent().remove();
1016
        $(this).parent().remove();
1022
1017
1023
        $.ajax({
1018
        $.ajax({
1024
            url: `/api/v1/return_claims/${id}/notes`,
1019
            url: '/api/v1/return_claims/' + id + '/notes',
1025
            type: 'PUT',
1020
            type: 'PUT',
1026
            data: JSON.stringify(params),
1021
            data: JSON.stringify(params),
1027
            success: function( data ) {
1022
            success: function( data ) {
1028
                let notes = $(`#return-claim-notes-static-${id}`);
1023
                let notes = $('#return-claim-notes-static-' + id);
1029
                notes.text(data.notes);
1024
                notes.text(data.notes);
1030
                notes.show();
1025
                notes.show();
1031
            },
1026
            },
Lines 1036-1042 $(document).ready(function() { Link Here
1036
    $('body').on('click', '.claim-returned-notes-editor-cancel', function(){
1031
    $('body').on('click', '.claim-returned-notes-editor-cancel', function(){
1037
        let id = $(this).data('return-claim-id');
1032
        let id = $(this).data('return-claim-id');
1038
        $(this).parent().remove();
1033
        $(this).parent().remove();
1039
        $(`#return-claim-notes-static-${id}`).show();
1034
        $('#return-claim-notes-static-' + id).show();
1040
    });
1035
    });
1041
1036
1042
    // Hanld return claim deletion
1037
    // Hanld return claim deletion
Lines 1046-1052 $(document).ready(function() { Link Here
1046
            let id = $(this).data('return-claim-id');
1041
            let id = $(this).data('return-claim-id');
1047
1042
1048
            $.ajax({
1043
            $.ajax({
1049
                url: `/api/v1/return_claims/${id}`,
1044
                url: '/api/v1/return_claims/' + id,
1050
                type: 'DELETE',
1045
                type: 'DELETE',
1051
                success: function( data ) {
1046
                success: function( data ) {
1052
                    refreshReturnClaimsTable();
1047
                    refreshReturnClaimsTable();
Lines 1076-1082 $(document).ready(function() { Link Here
1076
        };
1071
        };
1077
1072
1078
        $.ajax({
1073
        $.ajax({
1079
            url: `/api/v1/return_claims/${id}/resolve`,
1074
            url: '/api/v1/return_claims/' + id + '/resolve',
1080
            type: 'PUT',
1075
            type: 'PUT',
1081
            data: JSON.stringify(params),
1076
            data: JSON.stringify(params),
1082
            success: function( data ) {
1077
            success: function( data ) {
1083
- 

Return to bug 24725