Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions js/locale/pl_PL.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ $_LANG['Unexpected empty reply from PESEL Reservation Registry API server!'] = '
$_LANG['Malformed reply from PESEL Reservation Registry API server!'] = 'Błędna odpowiedź serwera API Rejestru Zastrzeżeń PESEL!';
$_LANG['telecommunication service contract'] = 'umowa na usługi telekomunikacyjne';

$_LANG['Note added'] = 'Notatka dodana';
$_LANG['Adding note'] = 'Dodaję notatkę';
$_LANG['Adding note Error'] = 'Błąd dodawania notatki';

$_LANG['Show sensible data'] = 'Pokaż dane wrażliwe';
$_LANG['customer sensitive data view'] = 'podgląd danych wrażliwych klientów';

Expand Down
51 changes: 51 additions & 0 deletions js/templates/rt/rtticketfastnote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const $input = $('#quick-note-input');
const $button = $('#quick-message-send');
const $overlay = $('#quick-message-overlay');

function updateButtonState(disabled = null) {
if (disabled === null) {
disabled = !$input.val().trim();
}
$button.prop('disabled', disabled);
}

function showStatus(message, color) {
$overlay
.html(`<span style="color: ${color};">${message}</span>`)
.css('display', 'flex');

setTimeout(() => {
$overlay.fadeOut();
}, 4000);
}

function sendQuickMessage(ticketId) {
const messageText = $input.val().trim();
updateButtonState(true);

showStatus($t('Sending message'), 'orange');

$.ajax({
url: "?m=rtticketedit&id=" + ticketId + "&action=fastnote",
type: 'POST',
data: { fastnote: messageText },
success: () => {
showStatus($t('Note added'), 'green');
$input.val('');
setTimeout(() => {
const cleanUrl = window.location.origin + window.location.pathname + window.location.search;
window.location.href = cleanUrl;
}, 1500
);
},
error: (xhr, status, error) => {
showStatus(`$t('Adding note Error'): ${error}"`, 'red');
console.error(trans('AJAX Error:'), xhr.responseText);
},
complete: () => {
updateButtonState();
}
});
}

$input.on('input', () => updateButtonState());
4 changes: 4 additions & 0 deletions lib/locale/pl_PL/strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
$_LANG['Malformed reply from PESEL Reservation Registry API server!'] = 'Błędna odpowiedź serwera API Rejestru Zastrzeżeń PESEL!';
$_LANG['telecommunication service contract'] = 'umowa na usługi telekomunikacyjne';

$_LANG['Note added'] = 'Notatka dodana';
$_LANG['Adding note'] = 'Dodaję notatkę';
$_LANG['Adding note Error'] = 'Błąd dodawania notatki';

$_LANG['Show sensitive data'] = 'Pokaż dane wrażliwe';
$_LANG['customer sensitive data view'] = 'podgląd danych wrażliwych klientów';

Expand Down
8 changes: 8 additions & 0 deletions modules/rtticketedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ function ($contact) {
$SESSION->redirect('?m=rtqueueview'
. ($SESSION->is_set('backid') ? '#' . $SESSION->get('backid') : ''));
break;
case 'fastnote':
$message = array(
'ticketid' => $id,
'body' => $_POST['fastnote'],
'type' => RTMESSAGE_NOTE,
);
$LMS->TicketMessageAdd($message);
break;
case 'resolve':
$notification_options_by_division_ids = array(
0 => array(
Expand Down
51 changes: 51 additions & 0 deletions templates/default/rt/rtticketfastnote.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<style>
#quick-message-overlay {
position: absolute; top: 0;
left: 0;
right: 0;
bottom: 0;
background: #DFD5BD;
display: none;
justify-content: center;
align-items: center;
font-weight: bold;
pointer-events: none;
z-index: 10;
padding: 0.5em;
text-align: center;
}
#quick-note-input {
width:100%;
height: 5em;
padding: 0.5em;
}
#quick-message-container {
position: relative;
flex-grow: 1;
}
#quick-message-container-inner {
display: flex;
gap: 10px;
align-items: center;
}
</style>

<table class="lmsbox">
<tbody>
<tr>
<td>
<div id="quick-message-container">
<div id="quick-message-container-inner">
{speech_recognition target="#quick-note-input"}
<textarea id="quick-note-input" placeholder="{trans('Enter note')}"></textarea>
{button id="quick-message-send" label="Add" icon="note" onclick="javascript:sendQuickMessage({$ticket.ticketid});"}
</div>
<div id="quick-message-overlay"></div>
</div>
</td>
</tr>
</tbody>
</table>


{js}
1 change: 1 addition & 0 deletions templates/default/rt/rtticketview.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <H1>{$layout.pagetitle|escape}</H1>

{include file="rt/rtticketinfobox.html"}
{include file="rt/rtticketmessagesbox.html"}
{include file="rt/rtticketfastnote.html"}

<table class="lmsbox">
<TFOOT>
Expand Down