fix focus dropdown notifications unviewed

This commit is contained in:
amazuecos
2025-04-03 20:20:49 +02:00
parent e593f3000b
commit 41bdae0623
2 changed files with 8 additions and 15 deletions

View File

@ -7,6 +7,7 @@ class MessagesDatatable {
this.datatablePresupuestoMessageItem = this.item.find("#tablePresupuestoMessages") this.datatablePresupuestoMessageItem = this.item.find("#tablePresupuestoMessages")
this.datatablePedidoMessageItem = this.item.find("#tablePedidoMessages") this.datatablePedidoMessageItem = this.item.find("#tablePedidoMessages")
this.datatableFacturaMessageItem = this.item.find("#tableFacturaMessages") this.datatableFacturaMessageItem = this.item.find("#tableFacturaMessages")
this.focusTable = this.datatableItem
this.columnDefs = [ this.columnDefs = [
] ]
this.datatableColumns = [ this.datatableColumns = [
@ -49,7 +50,7 @@ class MessagesDatatable {
init() { init() {
this.item.on('click', '.btn-notification-viewed', (event) => { this.item.on('click', '.btn-notification-viewed', (event) => {
const chatMessageId = $(event.currentTarget).data('id') const chatMessageId = $(event.currentTarget).data('id')
$(`#dropdown-viewed-${chatMessageId}`).empty() this.focusTable.find(`#dropdown-viewed-${chatMessageId}`).empty()
this.handleDropUp(chatMessageId) this.handleDropUp(chatMessageId)
}) })
@ -160,27 +161,15 @@ class MessagesDatatable {
const notifications = response.data.notifications const notifications = response.data.notifications
if (notifications.length > 0) { if (notifications.length > 0) {
notifications.forEach(user => { notifications.forEach(user => {
if (user.userFullName || user.userName) { if (user.userFullName || user.userName) {
console.log(user.userFullName)
$(`#dropdown-viewed-${chat_message_id}`) this.focusTable.find(`#dropdown-viewed-${chat_message_id}`)
.append(this.addDropUpItem(user)) .append(this.addDropUpItem(user))
} }
}); });
} }
// if (viewedNotifications.length > 0) {
// viewedNotifications.forEach(user => {
// if (user.userFullName || user.userName) {
// $(`#dropdown-viewed-${chat_message_id}`)
// .append(this.addDropUpItem(user))
// }
// });
// }
} }
handleDropUpError() { } handleDropUpError() { }
addDropUpItem(user) addDropUpItem(user)

View File

@ -40,15 +40,19 @@ class MessagePage {
$("#navs-top-align-all-tab").on("click",()=>{ $("#navs-top-align-all-tab").on("click",()=>{
this.messageDatatable.datatable.ajax.reload() this.messageDatatable.datatable.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableItem
}) })
$("#navs-top-align-presupuestos-tab").on("click",()=>{ $("#navs-top-align-presupuestos-tab").on("click",()=>{
this.messageDatatable.datatablePresupuestoMessage.ajax.reload() this.messageDatatable.datatablePresupuestoMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatablePresupuestoMessageItem
}) })
$("#navs-top-align-pedidos-tab").on("click",()=>{ $("#navs-top-align-pedidos-tab").on("click",()=>{
this.messageDatatable.datatablePedidoMessage.ajax.reload() this.messageDatatable.datatablePedidoMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatablePedidoMessageItem
}) })
$("#navs-top-align-facturas-tab").on("click",()=>{ $("#navs-top-align-facturas-tab").on("click",()=>{
this.messageDatatable.datatableFacturaMessage.ajax.reload() this.messageDatatable.datatableFacturaMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableFacturaMessageItem
}) })
} }