mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add messages to ot
This commit is contained in:
@ -11,6 +11,7 @@ use App\Models\ChatNotification;
|
||||
use App\Models\ChatUser;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Facturas\FacturaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\Pedidos\PedidoModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
@ -132,6 +133,25 @@ class ChatController extends BaseController
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_orden_trabajo(int $chat_department_id, int $orden_trabajo_id)
|
||||
{
|
||||
|
||||
$data = [
|
||||
"department" => $this->chatDeparmentModel->find($chat_department_id),
|
||||
"chat" => null,
|
||||
"messages" => null,
|
||||
"count" => 0,
|
||||
];
|
||||
$chat = $this->chatModel->getChatOrdenTrabajo($chat_department_id, $orden_trabajo_id);
|
||||
if ($chat) {
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id);
|
||||
$data["count"] = count($data["messages"]);
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_direct_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
@ -295,6 +315,11 @@ class ChatController extends BaseController
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($factura_id, 'factura');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_orden_trabajo_users(int $chat_department_id, $orden_trabajo_id)
|
||||
{
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($orden_trabajo_id, 'ot');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_users_internal()
|
||||
{
|
||||
$query = $this->userModel->builder()->select(
|
||||
@ -357,6 +382,15 @@ class ChatController extends BaseController
|
||||
$clienteContactos = $cm->querySelectClienteContacto($f->cliente_id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_orden_trabajo_client_users(int $orden_trabajo_id)
|
||||
{
|
||||
$otm = model(OrdenTrabajoModel::class);
|
||||
$ot = $otm->find($orden_trabajo_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$cliente = $ot->pedido()->cliente();
|
||||
$clienteContactos = $cm->querySelectClienteContacto($cliente->id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function store_hebra(string $model)
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
|
||||
Reference in New Issue
Block a user