@@ -, +, @@ --- .../en/includes/modals/display_ticket.inc | 31 +++ .../prog/en/modules/catalogue/detail.tt | 177 ++++++++++++++++++ .../prog/en/modules/cataloguing/concerns.tt | 127 +------------ .../prog/js/modals/display_ticket.js | 94 ++++++++++ 4 files changed, 304 insertions(+), 125 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js --- a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc @@ -0,0 +1,31 @@ + + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -299,6 +299,7 @@ [% IF Koha.Preference('AcquisitionDetails') %]
  • Acquisition details
  • [% END %] [% IF suggestions.count %]
  • Suggestion details
  • [% END %] [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
  • Editions
  • [% END %][% END %] +[% IF ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) %]
  • Concerns ([% biblio.tickets.count | html %])
  • [% END %] [% IF ( LocalCoverImages ) %]
  • Images ([% localimages.count || 0 | html %]) @@ -1000,6 +1001,59 @@ Note that permanent location is a code, and location may be an authval. [% END %] [% END %] +[% IF ( Koha.Prefernce('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) %] +
    +
    + Hide resolved + | Show all +
    + + + + + + + + + + +
    ReportedDetailsStatusActions
    + + + +
    +[% END %] + [% IF ( LocalCoverImages ) %]
    [% IF localimages.count %] @@ -1301,6 +1355,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( Koha.Preference('CatalogConcerns') ) %] [% INCLUDE 'modals/add_catalog_concern.inc' %] + [% INCLUDE 'modals/display_ticket.inc' %] [% END %] [% MACRO jsinclude BLOCK %] @@ -1313,8 +1368,130 @@ Note that permanent location is a code, and location may be an authval. [% Asset.js("js/modals/add_catalog_concern.js") | $raw %] + [% Asset.js("js/modals/display_ticket.js") | $raw %] [% END %] + [% Asset.js("js/modals/display_ticket.js") | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js +++ a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js @@ -0,0 +1,94 @@ +$(document).ready(function() { + $('#ticketDetailsModal').on('show.bs.modal', function(event) { + let modal = $(this); + let button = $(event.relatedTarget); + let ticket_id = button.data('concern'); + modal.find('.modal-footer input').val(ticket_id); + + let detail = $('#detail_' + ticket_id).text(); + + let display = '
    '; + display += '
    '; + display += '' + detail + ''; + display += '
    '; + display += '
    '; + display += 'Loading updates . . .'; + display += '
    '; + display += '
    '; + + let details = modal.find('#concern-details'); + details.html(display); + + $.ajax({ + url: "/api/v1/tickets/" + ticket_id + "/updates", + method: "GET", + headers: { + "x-koha-embed": "user" + }, + }).success(function(data) { + let updates_display = $('#concern-updates'); + let updates = ''; + data.forEach(function(item, index) { + updates += '
    '; + updates += '' + item.message + ''; + updates += '' + $patron_to_html(item.user, { + display_cardnumber: false, + url: true + }) + ' (' + $datetime(item.date) + ')'; + updates += '
    '; + }); + updates_display.html(updates); + }).error(function() { + + }); + }); + + $('#ticketDetailsModal').on('click', '#updateTicket', function(e) { + let ticket_id = $('#ticket_id').val(); + let params = { + 'public': $('#public').is(":checked"), + message: $('#update_message').val(), + user_id: logged_in_user_borrowernumber + }; + + $.ajax({ + url: "/api/v1/tickets/" + ticket_id + "/updates", + method: "POST", + data: JSON.stringify(params), + ontentType: "application/json; charset=utf-8" + }).success(function() { + $("#ticketDetailsModal").modal('hide'); + tickets.DataTable().ajax.reload(function(data) { + $("#concern_action_result_dialog").hide(); + $("#concern_delete_success").html(_("Concern #%s updated successfully.").format(ticket_id)).show(); + }); + }).error(function() { + $("#concern_update_error").html(_("Error resolving concern #%s. Check the logs.").format(ticket_id)).show(); + }); + }); + + $('#ticketDetailsModal').on('click', '#resolveTicket', function(e) { + let ticket_id = $('#ticket_id').val(); + let params = { + 'public': $('#public').is(":checked"), + message: $('#update_message').val(), + user_id: logged_in_user_borrowernumber, + state: 'resolved' + }; + + $.ajax({ + url: "/api/v1/tickets/" + ticket_id + "/updates", + method: "POST", + data: JSON.stringify(params), + ontentType: "application/json; charset=utf-8" + }).success(function() { + $("#ticketDetailsModal").modal('hide'); + tickets.DataTable().ajax.reload(function(data) { + $("#concern_action_result_dialog").hide(); + $("#concern_delete_success").html(_("Concern #%s updated successfully.").format(ticket_id)).show(); + }); + }).error(function() { + $("#concern_update_error").html(_("Error resolving concern #%s. Check the logs.").format(ticket_id)).show(); + }); + }); +}); --