redirect notification message to model edit form

This commit is contained in:
amazuecos
2025-02-10 09:32:48 +01:00
parent 41783f5b25
commit 071d386d36

View File

@ -239,7 +239,7 @@ class ChatModel extends Model
$count++;
}
}
$row->uri = "/pedidos/edit/" . $row->pedidoId;
$row->uri = "/pedidos/edit/" . $row->pedidoId . "#accordionChatPedido";
$row->unreadMessages = $count;
}
return $results;
@ -273,7 +273,7 @@ class ChatModel extends Model
$count++;
}
}
$row->uri = "/chat/factura/" . $row->chatId;
$row->uri = "/factura/edit/" . $row->facturaId . "#accordionChatFactura";
$row->unreadMessages = $count;
}
return $results;
@ -307,7 +307,7 @@ class ChatModel extends Model
$count++;
}
}
$row->uri = "/chat/presupuesto/" . $row->chatId;
$row->uri = "/presupuestocliente/edit/" . $row->presupuestoId . "#accordionChatPresupuesto";
$row->unreadMessages = $count;
}
@ -344,9 +344,9 @@ class ChatModel extends Model
if ($row->presupuestoId) {
$row->model = $presupuestoModel->find($row->presupuestoId);
if ($auth_user->cliente_id) {
$row->uri = "/chat/presupuesto/" . $row->chatId;
$row->uri = "/presupuestocliente/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
} else {
$row->uri = "/chat/presupuesto/" . $row->chatId;
$row->uri = "/presupuestoadmin/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
}
$row->title = $row->presupuestoId;
if ($row->chatDepartmentId) {
@ -359,7 +359,7 @@ class ChatModel extends Model
$rows_new[] = $row;
} elseif ($row->pedidoId) {
$row->model = $pedidoModel->find($row->pedidoId);
$row->uri = "/pedidos/edit/" . $row->chatId . "#accordionChatPedido";
$row->uri = "/pedidos/edit/" . $row->pedidoId . "#accordionChatPedido";
$row->title = $row->pedidoId;
if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
@ -369,7 +369,7 @@ class ChatModel extends Model
$rows_new[] = $row;
} elseif ($row->facturaId) {
$row->model = $facturaModel->find($row->facturaId);
$row->uri = "/chat/factura/" . $row->chatId;
$row->uri = "/chat/factura/" . $row->facturaId."#accordionChatFactura";
$row->avatar = "F";
if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
@ -409,9 +409,9 @@ class ChatModel extends Model
if ($row->presupuestoId) {
$row->model = $presupuestoModel->find($row->presupuestoId);
if ($auth_user->cliente_id) {
$row->uri = "/chat/presupuesto/" . $row->chatId;
$row->uri = "/presupuestocliente/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
} else {
$row->uri = "/chat/presupuesto/" . $row->chatId;
$row->uri = "/presupuestoadmin/edit/" . $row->presupuestoId . "#accordionChatPresupuesto";
}
$row->title = $row->presupuestoId;
if ($row->chatDepartmentId) {
@ -424,7 +424,7 @@ class ChatModel extends Model
$rows_new[] = $row;
} elseif ($row->pedidoId) {
$row->model = $pedidoModel->find($row->pedidoId);
$row->uri = "/chat/pedido/" . $row->chatId;
$row->uri = "/pedidos/edit/" . $row->pedidoId . "#accordionChatFactura";
$row->title = $row->pedidoId;
if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
@ -434,7 +434,7 @@ class ChatModel extends Model
$rows_new[] = $row;
} elseif ($row->facturaId) {
$row->model = $facturaModel->find($row->facturaId);
$row->uri = "/chat/factura/" . $row->chatId;
$row->uri = "/factura/edit/" . $row->facturaId . "#accordionChatFactura";
$row->avatar = "F";
if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
@ -868,7 +868,6 @@ class ChatModel extends Model
->where("user_id", $user_id)
->whereIn("chat_message_id", $chat_messages_ids)
->update(["viewed" => true]);
}
public function setAsViewedChatUserMessages(int $chat_id, int $user_id)
{
@ -876,7 +875,6 @@ class ChatModel extends Model
->where('chat_id', $chat_id)
->where('sender_id !=', $user_id)
->update(["viewed" => true]);
}
public function setAsUnviewedChatUserNotifications(int $chat_id, int $user_id)
{
@ -899,7 +897,6 @@ class ChatModel extends Model
->where('chat_id', $chat_id)
->where('sender_id !=', $user_id)
->update(["viewed" => false]);
}
public function createNotificationsToNewChatUser($chat_id, $user_id)
{
@ -911,7 +908,5 @@ class ChatModel extends Model
$chat_notifications = array_map(fn($q) => ["chat_message_id" => $q->id, "user_id" => $user_id], $query);
$chatNotificationModel = model(ChatNotification::class);
$chatNotificationModel->insertBatch($chat_notifications);
}
}