feat: mensajes directos cliente

This commit is contained in:
amazuecos
2024-11-12 18:26:22 +01:00
parent cc9eba99fb
commit b97e027920
9 changed files with 200 additions and 11768 deletions

View File

@ -175,9 +175,10 @@ class ChatController extends BaseController
"chat_id" => $chatId, "chat_id" => $chatId,
"sender_id" => auth()->user()->id, "sender_id" => auth()->user()->id,
"message" => $data["message"], "message" => $data["message"],
"receiver_id" => $data["receiver_id"] "receiver_id" => $data["receiver_id"],
] ]
); );
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id,"user_id" => auth()->user()->id]);
$dataResponse = $this->chatMessageModel->find($chat_message_id); $dataResponse = $this->chatMessageModel->find($chat_message_id);
return $this->response->setJSON($dataResponse); return $this->response->setJSON($dataResponse);
} }
@ -192,7 +193,7 @@ class ChatController extends BaseController
->where("deleted_at", null) ->where("deleted_at", null)
->get()->getResultObject(); ->get()->getResultObject();
foreach ($users as $user) { foreach ($users as $user) {
$user->unreadMessages = $this->chatMessageModel->get_chat_unread_messages_count($user->id); $user->unreadMessages = $this->chatMessageModel->get_chat_messages_count($user->id);
} }
usort($users, fn($a, $b) => $a->unreadMessages < $b->unreadMessages); usort($users, fn($a, $b) => $a->unreadMessages < $b->unreadMessages);
return $this->response->setJSON($users); return $this->response->setJSON($users);
@ -207,12 +208,12 @@ class ChatController extends BaseController
->where("deleted_at", null) ->where("deleted_at", null)
->where("id", $user_id) ->where("id", $user_id)
->get()->getFirstRow(); ->get()->getFirstRow();
$this->chatMessageModel->set_chat_messages_as_read($user_id);
return $this->response->setJSON($users); return $this->response->setJSON($users);
} }
public function get_chat_internal_messages(int $user_id) public function get_chat_internal_messages(int $user_id)
{ {
$conversation = $this->chatMessageModel->get_chat_contact_messages($user_id); $conversation = $this->chatMessageModel->get_chat_contact_messages($user_id);
return $this->response->setJSON($conversation); return $this->response->setJSON($conversation);
} }
public function get_chat_cliente() public function get_chat_cliente()
@ -238,9 +239,13 @@ class ChatController extends BaseController
} else { } else {
$response["internals"] = $this->chatModel->getChatDepartmentNotifications(); $response["internals"] = $this->chatModel->getChatDepartmentNotifications();
$internal_notifications = $this->chatModel->getChatInternalNotifications(); $internal_notifications = $this->chatModel->getChatInternalNotifications();
$mensajes_directos = $this->chatModel->getChatDirectMessageNotifications();
foreach ($internal_notifications as $value) { foreach ($internal_notifications as $value) {
$response["internals"][] = $value; $response["internals"][] = $value;
} }
foreach ($mensajes_directos as $value) {
$response["internals"][] = $value;
}
$response["totalMessages"] = 0; $response["totalMessages"] = 0;
foreach ($response["internals"] as $key => $value) { foreach ($response["internals"] as $key => $value) {
$response["totalMessages"] += $value->unreadMessages; $response["totalMessages"] += $value->unreadMessages;

View File

@ -4,7 +4,7 @@ return [
"chat" => "Mensajería", "chat" => "Mensajería",
"messages" => "Mensajes", "messages" => "Mensajes",
"modal" => [ "modal" => [
"new_hebra" => "Nueva hebra", "new_hebra" => "Nuevo hilo",
"title" => "Título", "title" => "Título",
"new_message" => "Nuevo mensaje", "new_message" => "Nuevo mensaje",
"new_receivers" => "Nuevos participantes", "new_receivers" => "Nuevos participantes",

View File

@ -82,9 +82,9 @@ class ChatDeparmentModel extends Model
"left" "left"
) )
->where("chat_departments.type", $type); ->where("chat_departments.type", $type);
if (auth()->user()->cliente_id == null) { // if (auth()->user()->cliente_id == null) {
$query->where("chat_department_users.user_id", auth()->user()->id); // $query->where("chat_department_users.user_id", auth()->user()->id);
} // }
$results = $query->get()->getResultArray(); $results = $query->get()->getResultArray();
// Create the desired structure // Create the desired structure

View File

@ -2,6 +2,7 @@
namespace App\Models\Chat; namespace App\Models\Chat;
use App\Models\ChatNotification;
use App\Models\Usuarios\UserModel; use App\Models\Usuarios\UserModel;
use CodeIgniter\Model; use CodeIgniter\Model;
@ -75,7 +76,9 @@ class ChatMessageModel extends Model
{ {
$conversationArray = []; $conversationArray = [];
$userModel = model(UserModel::class); $userModel = model(UserModel::class);
$chatNotificationModel = model(ChatNotification::class);
$receiverUser = $userModel->find($receiver_id); $receiverUser = $userModel->find($receiver_id);
$chat_id = null;
$messagesFromClient = $this->builder() $messagesFromClient = $this->builder()
->where("sender_id", auth()->user()->id) ->where("sender_id", auth()->user()->id)
->where("receiver_id", $receiverUser->id) ->where("receiver_id", $receiverUser->id)
@ -95,7 +98,9 @@ class ChatMessageModel extends Model
$conversationArray[] = $message; $conversationArray[] = $message;
} }
$dates = array(); $dates = array();
foreach ($conversationArray as $key => $row) { foreach ($conversationArray as $key => $row) {
$chatNotificationModel->builder()->set("viewed", true)->where("chat_message_id", $row->id)->where("user_id", auth()->user()->id)->update();
$dates[$key] = strtotime($row->created_at); $dates[$key] = strtotime($row->created_at);
} }
array_multisort($dates, SORT_ASC, $conversationArray); array_multisort($dates, SORT_ASC, $conversationArray);
@ -110,11 +115,25 @@ class ChatMessageModel extends Model
->where("receiver_id", auth()->user()->id)->countAllResults(); ->where("receiver_id", auth()->user()->id)->countAllResults();
return $messagesFromReceiver; return $messagesFromReceiver;
} }
public function get_chat_messages_count(int $sender_id): int
{
$messagesFromReceiver = $this->builder()
->groupStart()
->where("sender_id", $sender_id)
->where("receiver_id", auth()->user()->id)
->orGroupStart()
->where("receiver_id", $sender_id)
->where("sender_id", auth()->user()->id)
->groupEnd()
->groupEnd()
->countAllResults();
return $messagesFromReceiver;
}
public function set_chat_messages_as_read(int $sender_id): int public function set_chat_messages_as_read(int $sender_id): int
{ {
$messagesFromReceiver = $this->builder() $messagesFromReceiver = $this->builder()
->set("viewed", true) ->set("viewed", true)
->where("sender_id", $sender_id) ->where("user_id", $sender_id)
->where("receiver_id", auth()->user()->id)->update(); ->where("receiver_id", auth()->user()->id)->update();
return $messagesFromReceiver; return $messagesFromReceiver;
} }
@ -122,23 +141,32 @@ class ChatMessageModel extends Model
{ {
$chatDepartmentModel = model(ChatDeparmentModel::class); $chatDepartmentModel = model(ChatDeparmentModel::class);
$chatModel = model(ChatModel::class); $chatModel = model(ChatModel::class);
$messagesFromReceiver = 0;
if(auth()->user()->cliente_id){ $auth_user = auth()->user();
$chat_department_id = $chatModel->find($chat_id)->chat_department_id;
$users_in_chat = array_map(fn($x) => $x->id, $chatDepartmentModel->getChatDepartmentUsers($chat_department_id));
if (auth()->user()->cliente_id) {
// Si el usuario es cliente, marca como leídos todos los mensajes exceptos los suyos
$messagesFromReceiver = $this->builder() $messagesFromReceiver = $this->builder()
->set("viewed", true) ->set("viewed", true)
->where("chat_id", $chat_id) ->where("chat_id", $chat_id)
->whereNotIn("sender_id", [auth()->user()->id])->update(); ->whereNotIn("sender_id", [$auth_user->id])->update();
}else{ } else {
$chat_department_id = $chatModel->find($chat_id)->chat_department_id; // Si el usuario no es cliente y está dentro de los usuarios de departamento
$users_in_chat = array_map(fn($x) => $x->id, $chatDepartmentModel->getChatDepartmentUsers($chat_department_id)); // marca como leido todos los mensajes, excepto los mensajes de los usuarios
$messagesFromReceiver = $this->builder() // de dentro del departamento
->set("viewed", true) if (in_array($auth_user->id, $users_in_chat) == true) {
->where("chat_id", $chat_id) // if (($key = array_search($auth_user->id, $users_in_chat)) !== false) {
->whereNotIn("sender_id", $users_in_chat) // unset($users_in_chat[$key]);
->update(); // }
$messagesFromReceiver = $this->builder()
->set("viewed", true)
->where("chat_id", $chat_id)
->whereNotIn("sender_id", $users_in_chat)
->update();
}
} }
return $messagesFromReceiver; return $messagesFromReceiver;
} }
} }

View File

@ -16,7 +16,7 @@ class ChatModel extends Model
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $useAutoIncrement = true; protected $useAutoIncrement = true;
protected $returnType = 'object'; protected $returnType = 'object';
protected $useSoftDeletes = false; protected $useSoftDeletes = true;
protected $protectFields = true; protected $protectFields = true;
protected $allowedFields = [ protected $allowedFields = [
"pedido_id", "pedido_id",
@ -33,7 +33,7 @@ class ChatModel extends Model
protected array $castHandlers = []; protected array $castHandlers = [];
// Dates // Dates
protected $useTimestamps = false; protected $useTimestamps = true;
protected $dateFormat = 'datetime'; protected $dateFormat = 'datetime';
protected $createdField = 'created_at'; protected $createdField = 'created_at';
protected $updatedField = 'updated_at'; protected $updatedField = 'updated_at';
@ -313,7 +313,6 @@ class ChatModel extends Model
"chats.pedido_id as pedidoId", "chats.pedido_id as pedidoId",
"chats.presupuesto_id as presupuestoId", "chats.presupuesto_id as presupuestoId",
"chats.factura_id as facturaId", "chats.factura_id as facturaId",
"chats.presupuesto_id as presupuestoId",
"chats.chat_department_id as chatDepartmentId", "chats.chat_department_id as chatDepartmentId",
"chat_departments.display as chatDisplay", "chat_departments.display as chatDisplay",
]) ])
@ -372,22 +371,23 @@ class ChatModel extends Model
"chats.pedido_id as pedidoId", "chats.pedido_id as pedidoId",
"chats.presupuesto_id as presupuestoId", "chats.presupuesto_id as presupuestoId",
"chats.factura_id as facturaId", "chats.factura_id as facturaId",
"chats.presupuesto_id as presupuestoId", "chats.title as chatDisplay",
"chats.title as chatDisplay"
]) ])
->join("chat_messages","chat_messages.chat_id = chats.id","left") ->join("chat_messages","chat_messages.chat_id = chats.id","left")
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left") ->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
->where("chat_notifications.user_id",auth()->user()->id) ->where("chat_notifications.user_id",auth()->user()->id)
->where("chat_notifications.viewed",false); ->where("chat_notifications.viewed",false);
$rows = $q->get()->getResultObject(); $rows = $q->get()->getResultObject();
$rows_new = [];
foreach ($rows as $row) { foreach ($rows as $row) {
$row->unreadMessages = 0;
if($row->presupuestoId){ if($row->presupuestoId){
$row->model = $presupuestoModel->find($row->presupuestoId); $row->model = $presupuestoModel->find($row->presupuestoId);
$row->uri = "/presupuestos/cosidotapablanda/edit/".$row->presupuestoId; $row->uri = "/presupuestos/cosidotapablanda/edit/".$row->presupuestoId;
$row->title = $row->presupuestoId; $row->title = $row->presupuestoId;
$row->avatar = "PRE"; $row->avatar = "PRE";
$row->unreadMessages = $this->countUnreadMessagePresupuesto($row->presupuestoId); $row->unreadMessages = $this->countUnreadMessagePresupuesto($row->presupuestoId);
$rows_new[] = $row;
} }
elseif($row->pedidoId){ elseif($row->pedidoId){
$row->model = $pedidoModel->find($row->pedidoId); $row->model = $pedidoModel->find($row->pedidoId);
@ -395,6 +395,7 @@ class ChatModel extends Model
$row->title = $row->pedidoId; $row->title = $row->pedidoId;
$row->avatar = "P"; $row->avatar = "P";
$row->unreadMessages = $this->countUnreadMessagePedido($row->pedidoId); $row->unreadMessages = $this->countUnreadMessagePedido($row->pedidoId);
$rows_new[] = $row;
} }
@ -404,10 +405,42 @@ class ChatModel extends Model
$row->avatar = "F"; $row->avatar = "F";
$row->title = $row->facturaId; $row->title = $row->facturaId;
$row->unreadMessages = $this->countUnreadMessageFactura($row->facturaId); $row->unreadMessages = $this->countUnreadMessageFactura($row->facturaId);
$rows_new[] = $row;
} }
} }
return $rows; return $rows_new;
}
public function getChatDirectMessageNotifications(){
$chatMessageModel = model(ChatMessageModel::class);
$chatNotificationModel = model(ChatNotification::class);
$q = $this->db->table("chats")
->select([
"chats.id as chatId",
"chats.title as chatDisplay",
"COUNT(chat_notifications.user_id) as unreadMessages"
])
->join("chat_messages","chat_messages.chat_id = chats.id","left")
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
->where("chats.presupuesto_id",null)
->where("chats.chat_department_id",null)
->where("chats.pedido_id",null)
->where("chats.factura_id",null)
->where("chat_notifications.viewed",false)
->where("chat_notifications.user_id",auth()->user()->id);
$rows = $q->get()->getResultObject();
$rows_new = [];
foreach ($rows as $row) {
if($row->chatId){
$row->model = [];
$row->uri = "/mensajes/internos";
$row->avatar = "MD";
$row->title = "MD";
$row->chatDisplay = $this->getSenderIdFromChatMessage($row->chatId)?->username ?? "Unknown";
$rows_new[] = $row;
}
}
return $rows_new;
} }
public function getChatInternalHebraPresupuesto(int $chat_id,int $presupuesto_id) : array public function getChatInternalHebraPresupuesto(int $chat_id,int $presupuesto_id) : array
{ {
@ -541,4 +574,31 @@ class ChatModel extends Model
->where("chat_notifications.viewed",false) ->where("chat_notifications.viewed",false)
->where("chat_notifications.user_id",auth()->user()->id)->countAllResults(); ->where("chat_notifications.user_id",auth()->user()->id)->countAllResults();
} }
public function countUnreadMessageDirectos(int $chat_id) : int|string
{
return $this->builder()->select()
->join("chat_messages","chat_messages.chat_id = chats.id","left")
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
->where("chats.presupuesto_id",null)
->where("chats.pedido_id",null)
->where("chats.factura_id",null)
->where("chats.chat_department_id",null)
->where("chat_messages.chat_id",$chat_id)
->where("chat_notifications.viewed",false)
->where("chat_notifications.user_id",auth()->user()->id)->countAllResults();
}
public function getSenderIdFromChatMessage(int $chat_id)
{
$first_message = $this->builder()->select()
->join("chat_messages","chat_messages.chat_id = chats.id","left")
->where("chats.presupuesto_id",null)
->where("chats.pedido_id",null)
->where("chats.factura_id",null)
->where("chats.id",$chat_id)
->where("chat_messages.receiver_id",auth()->user()->id)->get()->getFirstRow();
$userModel = model(UserModel::class);
return $userModel->find($first_message->sender_id);
}
} }

View File

@ -42,9 +42,6 @@
<li class="chat-contact-list-item chat-contact-list-item-title"> <li class="chat-contact-list-item chat-contact-list-item-title">
<h5 class="text-primary mb-0">Contactos</h5> <h5 class="text-primary mb-0">Contactos</h5>
</li> </li>
<li class="chat-contact-list-item contact-list-item-0 ">
<h6 class="text-muted mb-0">No Contacts Found</h6>
</li>
<!-- <li class="chat-contact-list-item"> <!-- <li class="chat-contact-list-item">
<a class="d-flex align-items-center"> <a class="d-flex align-items-center">
<div class="avatar d-block flex-shrink-0"> <div class="avatar d-block flex-shrink-0">
@ -75,9 +72,8 @@
class="avatar-initial rounded-circle bg-label-primary">P</span> class="avatar-initial rounded-circle bg-label-primary">P</span>
</div> </div>
<div class="chat-contact-info flex-grow-1 ms-2"> <div class="chat-contact-info flex-grow-1 ms-2">
<h6 class="m-0">Departamento Producción</h6> <h6 class="m-0"></h6>
<small class="user-status text-muted">Consulta sobre el presupuesto <small class="user-status text-muted"></small>
P001</small>
</div> </div>
</div> </div>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">

View File

@ -226,7 +226,7 @@ class Chat {
`/chat/department/${this.chatType}/${this.chatDeparmentId}/${this.modelId}`, `/chat/department/${this.chatType}/${this.chatDeparmentId}/${this.modelId}`,
null, null,
null, null,
(data)=> { (data) => {
this.chatList.find(`#chat_${row_name} .messages-unread-contact`).text(data.count) this.chatList.find(`#chat_${row_name} .messages-unread-contact`).text(data.count)
}, },
null null
@ -290,8 +290,8 @@ class Chat {
this.chatHistory.append(chatItem) this.chatHistory.append(chatItem)
return chatItem return chatItem
} }
_sendMessagePressKey(e){ _sendMessagePressKey(e) {
if ( e.which == 13 ) { if (e.which == 13) {
e.preventDefault(); e.preventDefault();
this._sendMessage() this._sendMessage()
} }
@ -341,26 +341,36 @@ class Chat {
} }
_handleListContactsSuccess(contacts) { _handleListContactsSuccess(contacts) {
if (contacts.length) { try {
console.log(contacts)
contacts.map((c) => { if (contacts.length) {
this._addContactToList(c) console.log(contacts)
});
} else { contacts.map((c, index) => {
this.sideBar.find("#contact-list").addClass("d-none") this._addContactToList(c)
});
} else {
this.sideBar.find("#contact-list").addClass("d-none")
}
this.sideBar.find(".contact-chat").on("click", (e) => {
// $(e.currentTarget).find(".messages-unread-contact").empty()
$(".contact-chat").parent().removeClass("active")
$(".chat-contact-list-item").removeClass("active")
this.chatHistory.empty()
this.domItem.find("#chat-header-dropdown-users").addClass("d-none")
let userId = $(e.currentTarget).data("id")
$(e.currentTarget).parent().addClass('active')
this.receiverId = userId
this._handleGetSingleContact(userId)
this._setBtnInternal()
})
} catch (error) {
} finally {
this.domItem.find(`#chat-contact-list-item-${contacts[0].id}`).click()
} }
this.sideBar.find(".contact-chat").on("click", (e) => {
$(e.currentTarget).find(".messages-unread-contact").empty()
$(".contact-chat").parent().removeClass("active")
$(".chat-contact-list-item").removeClass("active")
this.chatHistory.empty()
this.domItem.find("#chat-header-dropdown-users").addClass("d-none")
let userId = $(e.currentTarget).data("id")
$(e.currentTarget).parent().addClass('active')
this.receiverId = userId
this._handleGetSingleContact(userId)
this._setBtnInternal()
})
} }
_handleListContactsError(err) { _handleListContactsError(err) {
console.error(err) console.error(err)
@ -389,10 +399,20 @@ class Chat {
ajax.get() ajax.get()
} }
_handleGetSingleContactMessagesSuccess(data) { _handleGetSingleContactMessagesSuccess(data) {
if (data) { try {
data.map((m) => {
this._addChatMessage(m)
}) if (data) {
data.map((m) => {
this._addChatMessage(m)
})
}
} catch (error) {
} finally {
// console.log(this.chatHistoryBody[0].scrollTop)
this.scrollbarChatHistory.update()
this.chatHistoryBody[0].scrollTop = this.scrollbarChatHistory.containerHeight
} }
} }
_handleGetSingleContactMessagesError(err) { } _handleGetSingleContactMessagesError(err) { }
@ -400,8 +420,8 @@ class Chat {
_handleGetSingleContactError(err) { _handleGetSingleContactError(err) {
} }
_sendMessageInternalPressKey(e){ _sendMessageInternalPressKey(e) {
if ( e.which == 13 ) { if (e.which == 13) {
e.preventDefault(); e.preventDefault();
this._sendMessageInternal() this._sendMessageInternal()
} }
@ -453,7 +473,7 @@ class Chat {
</p> </p>
</div> </div>
${contact.unreadMessages ? `<span ${contact.unreadMessages ? `<span
class="badge badge-center rounded-pill bg-primary messages-unread-contact">${contact.unreadMessages}</span>` : ""} class="badge badge-center rounded-pill bg-danger messages-unread-contact">${contact.unreadMessages}</span>` : ""}
</a> </a>
</li> </li>
` `
@ -479,18 +499,18 @@ export const showNotificationMessages = (dom) => {
(data) => { (data) => {
dom.empty() dom.empty()
$("#chat-notification-number") $("#chat-notification-number")
if(data.totalMessages > 0){ if (data.totalMessages > 0) {
$("#chat-notification-number").removeClass("d-none") $("#chat-notification-number").removeClass("d-none")
$("#chat-notification-number").text(data.totalMessages ?? 0) $("#chat-notification-number").text(data.totalMessages ?? 0)
}else{ } else {
$("#chat-notification-number").addClass("d-none") $("#chat-notification-number").addClass("d-none")
$("#chat-notification-number").text(0) $("#chat-notification-number").text(0)
} }
data?.internals?.map((e) => { data?.internals?.map((e) => {
let numberOfMessages = e.unreadMessages let numberOfMessages = e.unreadMessages
if(numberOfMessages > 0){ if (numberOfMessages > 0) {
dom.append( dom.append(
` `
<li class="mb-2"> <li class="mb-2">
<a href="${e.uri}" class="d-flex align-items-center flex-grow"> <a href="${e.uri}" class="d-flex align-items-center flex-grow">
<div class="avatar d-block flex-shrink-0"> <div class="avatar d-block flex-shrink-0">
@ -503,14 +523,14 @@ export const showNotificationMessages = (dom) => {
</a> </a>
</li> </li>
` `
) )
} }
}) })
data?.chatPresupuestos?.map((e) => { data?.chatPresupuestos?.map((e) => {
let numberOfMessages = e.unreadMessages let numberOfMessages = e.unreadMessages
if(numberOfMessages > 0){ if (numberOfMessages > 0) {
dom.append( dom.append(
` `
<li class=""> <li class="">
<a href="${e.uri}" class="d-flex align-items-center flex-grow"> <a href="${e.uri}" class="d-flex align-items-center flex-grow">
<div class="avatar d-block flex-shrink-0"> <div class="avatar d-block flex-shrink-0">
@ -523,14 +543,14 @@ export const showNotificationMessages = (dom) => {
</a> </a>
</li> </li>
` `
) )
} }
}) })
data?.chatFacturas?.map((e) => { data?.chatFacturas?.map((e) => {
let numberOfMessages = e.unreadMessages let numberOfMessages = e.unreadMessages
if(numberOfMessages > 0){ if (numberOfMessages > 0) {
dom.append( dom.append(
` `
<li class=""> <li class="">
<a href="${e.uri}" class="d-flex align-items-center flex-grow"> <a href="${e.uri}" class="d-flex align-items-center flex-grow">
<div class="avatar d-block flex-shrink-0"> <div class="avatar d-block flex-shrink-0">
@ -543,14 +563,14 @@ export const showNotificationMessages = (dom) => {
</a> </a>
</li> </li>
` `
) )
} }
}) })
data?.chatPedidos?.map((e) => { data?.chatPedidos?.map((e) => {
let numberOfMessages = e.unreadMessages let numberOfMessages = e.unreadMessages
if(numberOfMessages > 0){ if (numberOfMessages > 0) {
dom.append( dom.append(
` `
<li class=""> <li class="">
<a href="${e.uri}" class="d-flex align-items-center flex-grow"> <a href="${e.uri}" class="d-flex align-items-center flex-grow">
<div class="avatar d-block flex-shrink-0"> <div class="avatar d-block flex-shrink-0">
@ -563,8 +583,8 @@ export const showNotificationMessages = (dom) => {
</a> </a>
</li> </li>
` `
) )
} }
}) })
}, },

View File

@ -111,7 +111,7 @@ class InternalMessages {
handleBtnNewHebra(e) { handleBtnNewHebra(e) {
e.preventDefault() e.preventDefault()
this.chatId = null this.chatId = null
this.modalNewMessage.item.find(".modal-title").text("Nueva hebra") this.modalNewMessage.item.find(".modal-title").text("Nuevo hilo")
this.selectMessageUsers.reset() this.selectMessageUsers.reset()
this.textAreaMessage.val("") this.textAreaMessage.val("")
this.hebraTitle.val("") this.hebraTitle.val("")
@ -163,7 +163,7 @@ class InternalMessages {
const contentHeaderHebra = $("<h4></h4>").text(`${chatTitle}`) const contentHeaderHebra = $("<h4></h4>").text(`${chatTitle}`)
const btnNewHebra = $("<button></button>").attr("type", "button").addClass("btn btn-danger btn-sm btn-new-hebra") const btnNewHebra = $("<button></button>").attr("type", "button").addClass("btn btn-danger btn-sm btn-new-hebra")
btnNewHebra.append('<span class="ti-xs ti ti-git-branch"></span>') btnNewHebra.append('<span class="ti-xs ti ti-git-branch"></span>')
btnNewHebra.append("Nueva hebra") btnNewHebra.append("Nuevo hilo")
headerHebra.append(contentHeaderHebra,btnNewHebra) headerHebra.append(contentHeaderHebra,btnNewHebra)
itemHebra.append(headerHebra) itemHebra.append(headerHebra)
let itemMessagesHebraRow = $("<div></div>").addClass("row") let itemMessagesHebraRow = $("<div></div>").addClass("row")

File diff suppressed because one or more lines are too long