Skip to content

Commit

Permalink
Add time tracking for bulk ticket replies
Browse files Browse the repository at this point in the history
- TT for bulk replies
- Encourage the correct time format using a placeholder and pattern (client-side validation only)
  • Loading branch information
wrongecho committed Dec 4, 2024
1 parent a313877 commit 425b06e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion post/user/ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@
// POST variables
$ticket_reply = mysqli_escape_string($mysqli, $_POST['bulk_reply_details']);
$ticket_status = intval($_POST['bulk_status']);
$ticket_reply_time_worked = sanitizeInput($_POST['time']);
$private_note = intval($_POST['bulk_private_reply']);
if ($private_note == 1) {
$ticket_reply_type = 'Internal';
Expand Down Expand Up @@ -1046,7 +1047,7 @@
$client_id = intval($row['ticket_client_id']);

// Add reply
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '00:01:00', ticket_reply_type = '$ticket_reply_type', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '$ticket_reply_time_worked', ticket_reply_type = '$ticket_reply_type', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");

$ticket_reply_id = mysqli_insert_id($mysqli);

Expand Down
7 changes: 7 additions & 0 deletions ticket_bulk_reply_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
<textarea class="form-control tinymce" rows="5" name="bulk_reply_details" placeholder="Type an update here"></textarea>
</div>

<div class="col-3">
<div class="form-group">
<label>Time worked</label>
<input class="form-control timepicker" id="time_worked" name="time" type="text" placeholder="HH:MM:SS" pattern="([01]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])" value="00:00:00"/>
</div>
</div>

<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="bulkPrivateReplyCheckbox" name="bulk_private_reply" value="1">
Expand Down
3 changes: 1 addition & 2 deletions ticket_reply_edit_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
</div>

<?php if (!empty($ticket_reply_time_worked)) { ?>

<div class="col-3">
<div class="form-group">
<label>Time worked</label>
<input class="form-control timepicker" id="time_worked" name="time" type="text" value="<?php echo date_format($ticket_reply_time_worked, 'H:i:s') ?>"/>
<input class="form-control timepicker" id="time_worked" name="time" type="text" placeholder="HH:MM:SS" pattern="([01]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])" value="<?php echo date_format($ticket_reply_time_worked, 'H:i:s') ?>"/>
</div>
</div>
<?php } ?>
Expand Down

0 comments on commit 425b06e

Please sign in to comment.