From 9cbbddcc1c3993adf398e5bfaaf52ce73b128192 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Wed, 2 Apr 2025 22:24:32 +0200 Subject: [PATCH] fix chat view --- ci4/app/Controllers/Configuracion/Users.php | 2 +- ci4/app/Services/ChatService.php | 18 +++++---- .../themes/vuexy/components/chat_factura.php | 4 +- .../components/chat_internal_factura.php | 8 ++-- .../vuexy/components/chat_internal_pedido.php | 8 ++-- .../components/chat_internal_presupuesto.php | 14 +++---- .../themes/vuexy/components/chat_pedido.php | 4 +- .../vuexy/components/chat_presupuesto.php | 4 +- .../themes/vuexy/form/mensajes/mensajeria.js | 8 ++-- httpdocs/assets/js/safekat/components/chat.js | 6 ++- .../vuexy/vendor/css/pages/app-chat.css | 40 +++++++++---------- 11 files changed, 62 insertions(+), 54 deletions(-) diff --git a/ci4/app/Controllers/Configuracion/Users.php b/ci4/app/Controllers/Configuracion/Users.php index c537dd57..24e57306 100755 --- a/ci4/app/Controllers/Configuracion/Users.php +++ b/ci4/app/Controllers/Configuracion/Users.php @@ -151,7 +151,7 @@ class Users extends \App\Controllers\GoBaseController foreach ($chatDepartments as $chatDepartment) { $this->chat_department_user_model->insert([ "user_id" => $id, - "chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()["id"] + "chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()->id ]); } diff --git a/ci4/app/Services/ChatService.php b/ci4/app/Services/ChatService.php index 62331253..9b0a002d 100644 --- a/ci4/app/Services/ChatService.php +++ b/ci4/app/Services/ChatService.php @@ -72,13 +72,15 @@ class ChatService extends BaseService $cliente_contacto = $this->clienteContactoModel->find($data["client"]); if ($cliente_contacto) { $userClienteContacto = $cliente_contacto->cliente()->user(); - $cliente_in_department = $this->chatDepartmentUserModel - ->where('chat_department_id', $chatDepartmentId) - ->where('user_id', $userClienteContacto->id) - ->where($this->modelFkMap[$model], $modelId) - ->first(); - if ($cliente_in_department == null) { - $this->chatDepartmentUserModel->insert(['chat_department_id' => $chatDepartmentId, 'user_id' => $userClienteContacto->id, $this->modelFkMap[$model] => $modelId]); + if ($userClienteContacto) { + $cliente_in_department = $this->chatDepartmentUserModel + ->where('chat_department_id', $chatDepartmentId) + ->where('user_id', $userClienteContacto->id) + ->where($this->modelFkMap[$model], $modelId) + ->first(); + if ($cliente_in_department == null) { + $this->chatDepartmentUserModel->insert(['chat_department_id' => $chatDepartmentId, 'user_id' => $userClienteContacto->id, $this->modelFkMap[$model] => $modelId]); + } } } } @@ -165,7 +167,7 @@ class ChatService extends BaseService ); return true; } - + public function getHebras(string $model, int $modelId): array { $chats = $this->chatModel->where('chat_department_id', null) diff --git a/ci4/app/Views/themes/vuexy/components/chat_factura.php b/ci4/app/Views/themes/vuexy/components/chat_factura.php index 909132d9..6e0ae25a 100644 --- a/ci4/app/Views/themes/vuexy/components/chat_factura.php +++ b/ci4/app/Views/themes/vuexy/components/chat_factura.php @@ -1,6 +1,6 @@ -
+
-
+
diff --git a/ci4/app/Views/themes/vuexy/components/chat_internal_factura.php b/ci4/app/Views/themes/vuexy/components/chat_internal_factura.php index 9fe95860..ab98558e 100644 --- a/ci4/app/Views/themes/vuexy/components/chat_internal_factura.php +++ b/ci4/app/Views/themes/vuexy/components/chat_internal_factura.php @@ -13,19 +13,19 @@