Merge branch 'fix/sk-12' into 'main'

Fix/sk 12

See merge request jjimenez/safekat!534
This commit is contained in:
Alvaro
2025-02-10 08:35:46 +00:00
4 changed files with 67 additions and 73 deletions

View File

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

View File

@ -546,7 +546,6 @@
}, },
{ 'data': 'precio',render : (d) => `<span class="autonumeric">${d}</span>` }, { 'data': 'precio',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` }, { 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'is_deleted'},
{ {
data: actionBtns, data: actionBtns,
className: 'row-edit dt-center' className: 'row-edit dt-center'

View File

@ -12,7 +12,7 @@ $(() => {
} }
if ($("#modalNewDirectMessageClient").length > 0) { if ($("#modalNewDirectMessageClient").length > 0) {
let modalDirectMessageClient = new ModalDirectMessageClient("presupuesto", $("#modalNewDirectMessageClient")) let modalDirectMessageClient = new ModalDirectMessageClient("factura", $("#modalNewDirectMessageClient"))
modalDirectMessageClient.init() modalDirectMessageClient.init()
$("#direct-message-cliente").on("click", () => { $("#direct-message-cliente").on("click", () => {
modalDirectMessageClient.modal.show() modalDirectMessageClient.modal.show()

View File

@ -12,7 +12,7 @@ $(() => {
} }
if ($("#modalNewDirectMessageClient").length > 0) { if ($("#modalNewDirectMessageClient").length > 0) {
let modalDirectMessageClient = new ModalDirectMessageClient("presupuesto", $("#modalNewDirectMessageClient")) let modalDirectMessageClient = new ModalDirectMessageClient("pedido", $("#modalNewDirectMessageClient"))
modalDirectMessageClient.init() modalDirectMessageClient.init()
$("#direct-message-cliente").on("click", () => { $("#direct-message-cliente").on("click", () => {
modalDirectMessageClient.modal.show() modalDirectMessageClient.modal.show()