mirror of
https://github.com/openvk/openvk
synced 2025-07-07 00:09:48 +03:00
User can close ticket (#879)
This commit is contained in:
parent
a2384cc231
commit
1e6ede7236
3 changed files with 35 additions and 0 deletions
|
@ -396,4 +396,24 @@ final class SupportPresenter extends OpenVKPresenter
|
|||
$this->flashFail("succ", "Успех", "Профиль создан. Теперь пользователи видят Ваши псевдоним и аватарку вместо стандартных аватарки и номера.");
|
||||
}
|
||||
}
|
||||
|
||||
function renderCloseTicket(int $id): void
|
||||
{
|
||||
$this->assertUserLoggedIn();
|
||||
$this->assertNoCSRF();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
$ticket = $this->tickets->get($id);
|
||||
|
||||
if($ticket->isDeleted() === 1 || $ticket->getType() === 2 || $ticket->getUserId() !== $this->user->id) {
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
header("Location: /support/view/" . $id);
|
||||
exit;
|
||||
}
|
||||
|
||||
$ticket->setType(2);
|
||||
$ticket->save();
|
||||
|
||||
$this->flashFail("succ", tr("ticket_changed"), tr("ticket_changed_comment"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
function errorHandler(id, mark) {
|
||||
document.getElementById("markText-" + id).innerHTML = {_error};
|
||||
}
|
||||
|
||||
function closeTicket() {
|
||||
let url = `/support/ticket${{$ticket->getId()}}/close?hash=${{urlencode($csrfToken)}}`;
|
||||
$.ajax(url, {
|
||||
error: () => alert("Произошла ошибка"),
|
||||
success: () => location.reload()
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{if $ticket->isDeleted() == 0}
|
||||
|
@ -34,6 +42,11 @@
|
|||
<a href="#" style="font-size:13px;"><b>{$ticket->getName()}</b></a>
|
||||
<br />{_status}: {$ticket->getStatus()}
|
||||
</div>
|
||||
{if $ticket->getType() === 1}
|
||||
<div class="post-author" style="border-top: none; padding: 14px; margin-top: 14px;">
|
||||
Если у Вас больше нет вопросов, Вы можете <a onClick="closeTicket()">закрыть этот тикет</a>.
|
||||
</div>
|
||||
{/if}
|
||||
<div class="text" style="padding-top: 10px; border-bottom: #ECECEC solid 1px;">
|
||||
{$ticket->getText()|noescape}
|
||||
<br /></br>
|
||||
|
|
|
@ -35,6 +35,8 @@ routes:
|
|||
handler: "Support->agent"
|
||||
- url: "/support/agent{num}/edit"
|
||||
handler: "Support->editAgent"
|
||||
- url: "/support/ticket{num}/close"
|
||||
handler: "Support->closeTicket"
|
||||
- url: "/language"
|
||||
handler: "About->language"
|
||||
- url: "/language/{text}.js"
|
||||
|
|
Loading…
Reference in a new issue