1.1.41 show/hide unanswered_msgs_count

This commit is contained in:
2024-07-23 13:41:41 +03:00
parent 87b21c5f55
commit 92e9b1ce63

View File

@@ -15,18 +15,23 @@ function update_count_unread_messages(data) {
list_unrd_parent[i].classList.toggle("showed");
}
}
} else if(data.unanswered_msgs_count){
} else if(data.unanswered_msgs_count || data.unanswered_msgs_count === 0){
for (let i = 0; i < list_unrd.length; i++){
list_unrd[i].innerHTML = data.unanswered_msgs_count.toString()
}
} else {
for (let i = 0; i < list_unrd.length; i++) {
let current_count = parseInt(list_unrd[i].innerHTML);
if (current_count === 0) {
list_unrd_parent[i].classList.toggle("showed");
if(data.unanswered_msgs_count === 0){
list_unrd_parent[i].classList.remove("showed");
}
}
}
// else {
// for (let i = 0; i < list_unrd.length; i++) {
// let current_count = parseInt(list_unrd[i].innerHTML);
// if (current_count === 0 || selected_btn.dataset['ajaxUrl'] !== 'chats') {
// list_unrd_parent[i].classList.toggle("showed");
// }
// }
// }
}
function play_required_beep (data,beep) {