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 @@