add all message datatable and alertboxes instead of toast

This commit is contained in:
amazuecos
2025-03-25 20:14:07 +01:00
parent 20db840bf9
commit d15bbb42f1
10 changed files with 62 additions and 41 deletions

View File

@ -443,16 +443,17 @@ class ChatController extends BaseController
{
$auth_user_id = auth()->user()->id;
$isAdmin = auth()->user()->inGroup('admin');
$query = $this->chatModel->getQueryDatatable($auth_user_id);
$query = $this->chatModel->getQueryDatatable();
return DataTable::of($query)
->edit('created_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i"))
->edit('updated_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i"))
->add("creator", fn($q) => $this->chatModel->getChatFirstUser($q->id)->userFullName)
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
->add("action", fn($q) => [
"type" => "direct",
"modelId" => $q->id,
"isAdmin" => $isAdmin,
"chatMessageId" => $q->chatMessageId,
"lang" => [
"view_chat" => lang('Chat.view_chat'),
"view_by_alt_message" => lang('Chat.view_by_alt_message')