Resend response properly working

merge-requests/58/head
Mike Koch 7 years ago
parent e086322332
commit 4deedc73b4

@ -1501,13 +1501,18 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)
$options = $reply ? '' : '<div class="pull-right">';
// Resend email notification
$replyDataAttribute = '';
if ($reply) {
$options .= '
<button class="btn btn-default" data-action="resend-email-notification" data-reply-id="' . $reply['id'] . '" data-ticket-id="' . $ticket['id'] . '">
<i class="fa fa-envelope navy-blue"></i> Resend Email Notification[!]
$replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"';
}
$options .= '
<button class="btn btn-default" data-action="resend-email-notification" ' . $replyDataAttribute . ' data-ticket-id="' . $ticket['id'] . '">
<i class="fa fa-envelope navy-blue"></i> ' . $hesklang['resend_email_notification'] . '
</button>
<span id="lang_email_notification_sent" style="display: none">' . $hesklang['email_notification_sent'] . '</span>
<span id="lang_email_notification_resend_failed" style="display: none">' . $hesklang['email_notification_resend_failed'] . '</span>
';
}
/* Edit post */
if ($can_edit) {

@ -49,42 +49,26 @@ $(document).ready(function() {
var ticketId = $this.data('ticket-id');
var replyId = $this.data('reply-id');
var heskUrl = $('span#heskUrl').text();
var apiUrl = heskUrl + '/api/v1-internal/staff/tickets/' + ticketId + '/resend-email?replyId=' + replyId;
var apiUrl = heskUrl + '/api/v1-internal/staff/tickets/' + ticketId + '/resend-email';
if (replyId !== undefined) {
apiUrl += '?replyId=' + replyId;
}
$this.attr('disabled', true);
$.ajax({
method: 'GET',
url: apiUrl,
headers: { 'X-Internal-Call': true },
success: function() {
$.jGrowl("Email notification sent!", { theme: 'alert-success', closeTemplate: '' });
$.jGrowl($('#lang_email_notification_sent').text(), { theme: 'alert-success', closeTemplate: '' });
},
error: function() {
$.jGrowl("Error occurred when trying to send notification email", { theme: 'alert-danger', closeTemplate: '' });
$.jGrowl($('#lang_email_notification_resend_failed').text(), { theme: 'alert-danger', closeTemplate: '' });
},
complete: function() {
$this.attr('disabled', false);
}
});
});
window.onbeforeunload = function (e) {
e = e || window.event;
var plaintextEditorHasContents = $('textarea[name="message"]').val() !== '';
var htmlEditorHasContents = false;
if (tinymce.get("message") !== undefined) {
plaintextEditorHasContents = false;
htmlEditorHasContents = tinymce.get("message").getContent() !== '';
}
if (plaintextEditorHasContents || htmlEditorHasContents) {
var $langText = $('#lang_ticket_message_contents_exist');
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = $langText.text();
}
// For Safari
return $langText.text();
}
};
});

@ -48,6 +48,9 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN Mods for HESK 3.1.0
$hesklang['stack_trace_header'] = 'Stack Trace';
$hesklang['ticket_message_contents_exist'] = 'The ticket message is not empty. Are you sure you want to leave this page?';
$hesklang['resend_email_notification'] = 'Re-send Email Notification';
$hesklang['email_notification_sent'] = 'Email notification sent!';
$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #

Loading…
Cancel
Save