diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php index e34eecab..a94fe855 100644 --- a/Web/Presenters/SupportPresenter.php +++ b/Web/Presenters/SupportPresenter.php @@ -164,9 +164,10 @@ final class SupportPresenter extends OpenVKPresenter $this->notFound(); $ticketComments = $this->comments->getCommentsById($id); - $this->template->ticket = $ticket; - $this->template->comments = $ticketComments; - $this->template->id = $id; + $this->template->ticket = $ticket; + $this->template->comments = $ticketComments; + $this->template->id = $id; + $this->template->fastAnswers = OPENVK_ROOT_CONF["openvk"]["preferences"]["support"]["fastAnswers"]; } function renderAnswerTicketReply(int $id): void diff --git a/Web/Presenters/templates/Support/AnswerTicket.xml b/Web/Presenters/templates/Support/AnswerTicket.xml index 7ca11217..043c8ecc 100644 --- a/Web/Presenters/templates/Support/AnswerTicket.xml +++ b/Web/Presenters/templates/Support/AnswerTicket.xml @@ -24,18 +24,24 @@
- +
-
- - +
+
+ + +
+
+ {_fast_answers} +
+

@@ -93,17 +99,17 @@ {tr("support_greeting_hi", $ticket->getUser()->getFullName())}

- + {$comment->getText()|noescape}

- + {tr("support_greeting_regards", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"])|noescape} {else} {$comment->getText()|noescape} {/if} - + {if $comment->getUType() === 0}
{_delete} @@ -126,4 +132,12 @@ + + {/block} diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 01c0648e..d26fb93f 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -1776,3 +1776,16 @@ body.scrolled .toTop:hover { margin: -20px; padding: 10px; } + +.hover-box { + background-color: white; + padding: 10px; + margin: 5px; + border: 1px solid #C0CAD5; + cursor: pointer; + user-select: none; +} + +.hover-box:hover { + background-color: #C0CAD5; +} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 9d819d6b..9c5a4c50 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -265,3 +265,27 @@ function autoTab(original, next, previous) { else if(original.value.length == 0 && previous !== undefined) previous.focus(); } + +function showSupportFastAnswerDialog(answers) { + let html = ""; + for(const [index, answer] of Object.entries(answers)) { + html += ` +
+ ${answer.replace(/\n/g, "
")} +
+ `; + } + + MessageBox(tr("fast_answers"), html, [tr("close")], [ + Function.noop + ]); +} + +function supportFastAnswerDialogOnClick(answer) { + u("body").removeClass("dimmed"); + u(".ovk-diag-cont").remove(); + + const answerInput = document.querySelector("#answer_text"); + answerInput.value = answer; + answerInput.focus(); +} diff --git a/locales/en.strings b/locales/en.strings index 8410abf7..0d2431a5 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -610,6 +610,8 @@ "support_rated_bad" = "You left a negative feedback about the answer."; "wrong_parameters" = "Invalid request parameters."; +"fast_answers" = "Fast answers"; + "comment" = "Comment"; "sender" = "Sender"; @@ -764,6 +766,7 @@ "cancel" = "Cancel"; "edit_action" = "Change"; "transfer" = "Transfer"; +"close" = "Close"; "warning" = "Warning"; "question_confirm" = "This action can't be undone. Do you really wanna do it?"; diff --git a/locales/ru.strings b/locales/ru.strings index 3e90c5c5..6ed93397 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -639,6 +639,8 @@ "support_rated_bad" = "Вы оставили негативный отзыв об ответе."; "wrong_parameters" = "Неверные параметры запроса."; +"fast_answers" = "Быстрые ответы"; + "comment" = "Комментарий"; "sender" = "Отправитель"; @@ -799,6 +801,7 @@ "cancel" = "Отмена"; "edit_action" = "Изменить"; "transfer" = "Передать"; +"close" = "Закрыть"; "warning" = "Внимание"; "question_confirm" = "Это действие нельзя отменить. Вы действительно уверены в том что хотите сделать?"; diff --git a/openvk-example.yml b/openvk-example.yml index 441afd19..0f8a9b55 100644 --- a/openvk-example.yml +++ b/openvk-example.yml @@ -31,6 +31,10 @@ openvk: support: supportName: "Moderator" adminAccount: 1 # Change this ok + fastAnswers: + - "This is a list of quick answers to common questions for support. Post your responses here and agents can send it quickly with just 3 clicks" + - "There can be as many answers as you want, but it is best to have a maximum of 10.\n\nYou can also remove all answers from the list to disable this feature" + - "Good luck filling! If you are a regular support agent, inform the administrator that he forgot to fill the config" messages: strict: false wall: