Browse Source

Display and update due date from ticket page

merge-requests/1/head
Mike Koch 6 years ago
parent
commit
eed4e4392a
  1. 34
      admin/admin_ticket.php
  2. 37
      internal-api/js/admin-ticket.js
  3. 1
      language/en/text.php

34
admin/admin_ticket.php

@ -33,6 +33,8 @@ define('HESK_PATH', '../');
define('WYSIWYG', 1);
define('VALIDATOR', 1);
define('EXTRA_JS', '<script src="'.HESK_PATH.'internal-api/js/admin-ticket.js"></script>');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
@ -657,15 +659,41 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
?>
</li>
<li class="list-group-item">
<strong><?php echo $hesklang['created_on']; ?></strong><br/>
<strong><?php echo $hesklang['created_on']; ?></strong><br>
<?php echo hesk_date($ticket['dt'], true); ?>
</li>
<li class="list-group-item">
<strong><?php echo $hesklang['last_update']; ?></strong><br/>
<strong><?php echo $hesklang['last_update']; ?></strong><br>
<?php echo hesk_date($ticket['lastchange'], true); ?>
</li>
<li class="list-group-item">
<strong><?php echo $hesklang['last_replier']; ?></strong><br/>
<strong><?php echo $hesklang['due_date']; ?></strong><br>
<div id="readonly-due-date">
<span id="due-date">
<?php
$due_date = hesk_date($ticket['due_date'], false);
$current_date = hesk_date();
echo substr($due_date, 0, 10);
?></span><!--<span id="overdue">
<?php
/*if ($due_date < $current_date) {
echo ' <i class="fa fa-exclamation-triangle dark-orange" data-toggle="tooltip" title="Ticket overdue!"></i>';
}*/
?>
</span>-->
<br>
<button id="due-date-button" class="btn btn-default btn-sm">Change</button>
</div>
<div id="editable-due-date" style="display: none">
<input type="text" class="form-control datepicker" name="due-date" value="<?php echo substr($due_date, 0, 10); ?>"><br>
<div class="btn-group">
<button id="submit" class="btn btn-primary">Save</button>
<button id="cancel" class="btn btn-default">Cancel</button>
</div>
</div>
</li>
<li class="list-group-item">
<strong><?php echo $hesklang['last_replier']; ?></strong><br>
<?php echo $ticket['repliername']; ?>
</li>
<?php

37
internal-api/js/admin-ticket.js

@ -0,0 +1,37 @@
$(document).ready(function() {
var $readonlyDueDateContainer = $('#readonly-due-date');
var $editableDueDateContainer = $('#editable-due-date');
var $dueDateButton = $('#due-date-button');
$dueDateButton.click(function() {
$readonlyDueDateContainer.hide();
$editableDueDateContainer.show();
});
$editableDueDateContainer.find('#cancel').click(function() {
$editableDueDateContainer.hide();
$editableDueDateContainer.find('input[name="due-date"]').val($readonlyDueDateContainer.find('span#due-date').text().trim());
$readonlyDueDateContainer.show();
});
$editableDueDateContainer.find('#submit').click(function() {
var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val();
$.ajax({
method: 'POST',
url: getHelpdeskUrl() + '/internal-api/admin/calendar',
data: {
trackingId: $('input[type="hidden"][name="track"]').val(),
action: 'update-ticket',
dueDate: newDueDate
},
success: function() {
$.jGrowl('Ticket due date successfully updated', { theme: 'alert-success', closeTemplate: '' });
$readonlyDueDateContainer.find('span#due-date').text(newDueDate);
$readonlyDueDateContainer.show();
$editableDueDateContainer.hide();
},
error: function() {
$.jGrowl('An error occurred when trying to update the ticket due date', { theme: 'alert-danger', closeTemplate: '' });
}
});
});
});

1
language/en/text.php

@ -39,6 +39,7 @@ $hesklang['attachment_too_large'] = 'This attachment is larger than the max file
$hesklang['attachment_cancel'] = 'Cancel';
$hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?';
$hesklang['attachment_remove'] = 'Remove attachment';
$hesklang['due_date'] = 'Due Date';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';

Loading…
Cancel
Save