mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix chat department message total count
This commit is contained in:
@ -142,7 +142,8 @@ class Chat {
|
||||
_handleGetChatListSuccess(data) {
|
||||
Object.values(data).map(row => {
|
||||
this.chatList.append(this._getContact(row))
|
||||
|
||||
this.chatDeparmentId = row.id
|
||||
this._getChatTotalMessages(row.name)
|
||||
this.chatList.find(`#chat_${row.name}`).on("click", (event) => {
|
||||
$(".chat-contact-list-item").removeClass("active")
|
||||
$(event.currentTarget).parent().addClass("active")
|
||||
@ -215,7 +216,7 @@ class Chat {
|
||||
${row.display}
|
||||
</p>
|
||||
</div>
|
||||
<span class="badge badge-center rounded-pill bg-danger messages-unread-contact">${row.totalMessages}</span>
|
||||
<span class="badge badge-center rounded-pill bg-danger messages-unread-contact">${row.totalMessages ?? 0}</span>
|
||||
</a>
|
||||
</li>
|
||||
`
|
||||
@ -235,6 +236,24 @@ class Chat {
|
||||
);
|
||||
ajax.get();
|
||||
}
|
||||
_getChatDepartmentMessageCount()
|
||||
{
|
||||
let ajax = new Ajax(
|
||||
`/chat/department/count/${this.chatType}/${this.chatDeparmentId}/${this.modelId}`,
|
||||
null,
|
||||
null,
|
||||
this._getChatDepartmentMessageCountSuccess.bind(this),
|
||||
this._getChatDepartmentMessageCountError.bind(this),
|
||||
|
||||
|
||||
);
|
||||
ajax.get();
|
||||
}
|
||||
_getChatDepartmentMessageCountSuccess(data){
|
||||
this.domItem.find(`chat_${data.name}`).find(".messages-unread-contact").text(data.count)
|
||||
}
|
||||
_getChatDepartmentMessageCountError(){}
|
||||
|
||||
_getChatMessage() {
|
||||
let ajax = new Ajax(
|
||||
`/chat/department/${this.chatType}/${this.chatDeparmentId}/${this.modelId}`,
|
||||
|
||||
Reference in New Issue
Block a user