diff --git a/ci4/app/Models/Chat/ChatModel.php b/ci4/app/Models/Chat/ChatModel.php
index 0b14e266..0a110442 100644
--- a/ci4/app/Models/Chat/ChatModel.php
+++ b/ci4/app/Models/Chat/ChatModel.php
@@ -92,7 +92,7 @@ class ChatModel extends Model
$chatDeparmentModel = model(ChatDeparmentModel::class);
$presupuesto = $model->find($presupuesto_id);
return $this->insert([
- "title" => $presupuesto->titulo."[".$chatDeparmentModel->getDisplay($chat_department_id)."]",
+ "title" => $presupuesto->titulo . "[" . $chatDeparmentModel->getDisplay($chat_department_id) . "]",
"presupuesto_id" => $presupuesto_id,
"chat_department_id" => $chat_department_id
]);
@@ -104,7 +104,7 @@ class ChatModel extends Model
$chatDeparmentModel = model(ChatDeparmentModel::class);
$pedido = $model->getPedidoClientePresupuesto($pedido_id);
return $this->insert([
- "title" => "Pedido ".$pedido->titulo."[".$chatDeparmentModel->getDisplay($chat_department_id)."]",
+ "title" => "Pedido " . $pedido->titulo . "[" . $chatDeparmentModel->getDisplay($chat_department_id) . "]",
"pedido_id" => $pedido_id,
"chat_department_id" => $chat_department_id
]);
@@ -117,7 +117,7 @@ class ChatModel extends Model
$chatDeparmentModel = model(ChatDeparmentModel::class);
$factura = $model->find($factura_id);
return $this->insert([
- "title" => "Factura ".$factura->numero."[".$chatDeparmentModel->getDisplay($chat_department_id)."]",
+ "title" => "Factura " . $factura->numero . "[" . $chatDeparmentModel->getDisplay($chat_department_id) . "]",
"factura_id" => $factura_id,
"chat_department_id" => $chat_department_id
]);
@@ -239,7 +239,7 @@ class ChatModel extends Model
$count++;
}
}
- $row->uri = "/chat/pedido/" . $row->chatId;
+ $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;
}
@@ -334,7 +334,7 @@ class ChatModel extends Model
->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left")
->where("chat_notifications.user_id", auth()->user()->id)
->where("chat_notifications.viewed", false)
- ->where("chats.chat_department_id is NOT NULL",NULL,FALSE);
+ ->where("chats.chat_department_id is NOT NULL", NULL, FALSE);
$rows = $q->get()->getResultObject();
$auth_user = auth()->user();
@@ -343,25 +343,25 @@ class ChatModel extends Model
$row->unreadMessages = 0;
if ($row->presupuestoId) {
$row->model = $presupuestoModel->find($row->presupuestoId);
- if($auth_user->cliente_id){
- $row->uri = "/chat/presupuesto/" . $row->chatId;
- }else{
- $row->uri = "/chat/presupuesto/" . $row->chatId;
+ if ($auth_user->cliente_id) {
+ $row->uri = "/presupuestocliente/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
+ } else {
+ $row->uri = "/presupuestoadmin/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
}
$row->title = $row->presupuestoId;
- if($row->chatDepartmentId){
+ if ($row->chatDepartmentId) {
$row->chatDisplay = $row->model->titulo;
- }else{
- $row->chatDisplay .="[INTERNAL]";
+ } else {
+ $row->chatDisplay .= "[INTERNAL]";
}
$row->avatar = "PRE";
$row->unreadMessages = $this->countUnreadMessagePresupuesto($row->presupuestoId);
$rows_new[] = $row;
} elseif ($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;
- if($row->chatDepartmentId){
+ if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
}
$row->avatar = "P";
@@ -369,9 +369,9 @@ 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){
+ if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
}
$row->title = $row->facturaId;
@@ -400,7 +400,7 @@ class ChatModel extends Model
->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left")
->where("chat_notifications.user_id", auth()->user()->id)
->where("chat_notifications.viewed", false)
- ->where("chats.chat_department_id",null);
+ ->where("chats.chat_department_id", null);
$auth_user = auth()->user();
$rows = $q->get()->getResultObject();
$rows_new = [];
@@ -408,25 +408,25 @@ class ChatModel extends Model
$row->unreadMessages = 0;
if ($row->presupuestoId) {
$row->model = $presupuestoModel->find($row->presupuestoId);
- if($auth_user->cliente_id){
- $row->uri = "/chat/presupuesto/" . $row->chatId;
- }else{
- $row->uri = "/chat/presupuesto/" . $row->chatId;
+ if ($auth_user->cliente_id) {
+ $row->uri = "/presupuestocliente/edit/" . $row->presupuestoId."#accordionChatPresupuesto";
+ } else {
+ $row->uri = "/presupuestoadmin/edit/" . $row->presupuestoId . "#accordionChatPresupuesto";
}
$row->title = $row->presupuestoId;
- if($row->chatDepartmentId){
+ if ($row->chatDepartmentId) {
$row->chatDisplay = $row->model->titulo;
- }else{
- $row->chatDisplay .="[INTERNAL]";
+ } else {
+ $row->chatDisplay .= "[INTERNAL]";
}
$row->avatar = "PRE";
$row->unreadMessages = $this->countUnreadMessagePresupuesto($row->presupuestoId);
$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){
+ if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
}
$row->avatar = "P";
@@ -434,9 +434,9 @@ 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){
+ if ($row->chatDepartmentId) {
$row->chatDisplay .= "[INTERNAL]";
}
$row->title = $row->facturaId;
@@ -470,7 +470,7 @@ class ChatModel extends Model
foreach ($rows as $row) {
if ($row->chatId) {
$row->model = [];
- $row->uri = "/chat/direct/".$row->chatId;
+ $row->uri = "/chat/direct/" . $row->chatId;
$row->avatar = "MD";
$row->title = "MD";
// $row->chatDisplay = $this->getSenderIdFromChatMessage($row->chatId)?->username ?? "Unknown";
@@ -496,8 +496,8 @@ class ChatModel extends Model
->where("chats.presupuesto_id", $presupuesto_id);
$data["chatId"] = $chat_id;
$data["messages"] = $query->get()->getResultObject();
- $data["chatTitle"] = "Presupuesto"."[".$presupuesto_id."] - ";
- $data["chatTitle"].= $this->find($chat_id)->title;
+ $data["chatTitle"] = "Presupuesto" . "[" . $presupuesto_id . "] - ";
+ $data["chatTitle"] .= $this->find($chat_id)->title;
$data["users"] = $this->getChatUsers($chat_id);
return $data;
}
@@ -517,8 +517,8 @@ class ChatModel extends Model
->where("chats.pedido_id", $pedido_id);
$data["chatId"] = $chat_id;
$data["messages"] = $query->get()->getResultObject();
- $data["chatTitle"] = "Pedido"."[".$pedido_id."] - ";
- $data["chatTitle"].= $this->find($chat_id)->title;
+ $data["chatTitle"] = "Pedido" . "[" . $pedido_id . "] - ";
+ $data["chatTitle"] .= $this->find($chat_id)->title;
$data["users"] = $this->getChatUsers($chat_id);
return $data;
}
@@ -538,8 +538,8 @@ class ChatModel extends Model
->where("chats.factura_id", $factura_id);
$data["chatId"] = $chat_id;
$data["messages"] = $query->get()->getResultObject();
- $data["chatTitle"] = "Factura"."[".$factura_id."] - ";
- $data["chatTitle"].= $this->find($chat_id)->title;
+ $data["chatTitle"] = "Factura" . "[" . $factura_id . "] - ";
+ $data["chatTitle"] .= $this->find($chat_id)->title;
$data["users"] = $this->getChatUsers($chat_id);
return $data;
}
@@ -709,12 +709,12 @@ class ChatModel extends Model
"chats.updated_at",
"chats.title",
])
- ->join("chat_users","chat_users.chat_id = chats.id","left")
+ ->join("chat_users", "chat_users.chat_id = chats.id", "left")
->where("chat_department_id", null)
->where("pedido_id", null)
->where("presupuesto_id", null)
->where("factura_id", null)
- ->where("chat_users.user_id",$user_id)
+ ->where("chat_users.user_id", $user_id)
->orderBy("created_at", "DESC")
->groupBy("chats.id");
@@ -729,15 +729,15 @@ class ChatModel extends Model
"chats.updated_at",
"chats.title",
])
- ->join("chat_users","chats.id = chat_users.chat_id","left")
- ->join("presupuestos","presupuestos.id = chats.presupuesto_id",'left')
+ ->join("chat_users", "chats.id = chat_users.chat_id", "left")
+ ->join("presupuestos", "presupuestos.id = chats.presupuesto_id", 'left')
->where("presupuesto_id is NOT NULL", NULL, FALSE)
->groupBy("chats.id");
- if(auth()->user()->inGroup("admin") == false){
- $query->where('presupuestos.cliente_id',auth()->user()->cliente_id)
- ->where("chat_department_id is NOT NULL",NULL,FALSE);
- }
- $query->orderBy("created_at", "DESC");
+ if (auth()->user()->inGroup("admin") == false) {
+ $query->where('presupuestos.cliente_id', auth()->user()->cliente_id)
+ ->where("chat_department_id is NOT NULL", NULL, FALSE);
+ }
+ $query->orderBy("created_at", "DESC");
return $query;
}
public function getQueryDatatableMessagePedido(int $user_id): BaseBuilder
@@ -749,16 +749,16 @@ class ChatModel extends Model
"chats.updated_at",
"chats.title",
])
- ->join("chat_users","chat_users.chat_id = chats.id","left")
- ->join("pedidos_linea","pedidos_linea.pedido_id = chats.pedido_id",'left')
- ->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id",'left')
+ ->join("chat_users", "chat_users.chat_id = chats.id", "left")
+ ->join("pedidos_linea", "pedidos_linea.pedido_id = chats.pedido_id", 'left')
+ ->join("presupuestos", "presupuestos.id = pedidos_linea.presupuesto_id", 'left')
->where("chats.pedido_id is NOT NULL", NULL, FALSE)
->groupBy("chats.id");
- if(auth()->user()->inGroup("admin") == false){
- $query->where('presupuestos.cliente_id',auth()->user()->cliente_id)
- ->where("chat_department_id is NOT NULL",NULL,FALSE);
- }
- $query->orderBy("created_at", "DESC");
+ if (auth()->user()->inGroup("admin") == false) {
+ $query->where('presupuestos.cliente_id', auth()->user()->cliente_id)
+ ->where("chat_department_id is NOT NULL", NULL, FALSE);
+ }
+ $query->orderBy("created_at", "DESC");
return $query;
}
public function getQueryDatatableMessageFactura(int $user_id): BaseBuilder
@@ -770,17 +770,17 @@ class ChatModel extends Model
"chats.updated_at",
"chats.title",
])
- ->join("chat_users","chat_users.chat_id = chats.id","left")
- ->join("facturas","facturas.id = chats.factura_id","left")
+ ->join("chat_users", "chat_users.chat_id = chats.id", "left")
+ ->join("facturas", "facturas.id = chats.factura_id", "left")
->where("chats.factura_id is NOT NULL", NULL, FALSE)
->groupBy("chats.id");
- if(auth()->user()->inGroup("admin") == false){
- if(auth()->user()->inGroup("admin") == false){
- $query->where('facturas.cliente_id',auth()->user()->cliente_id)
- ->where("chat_department_id is NOT NULL",NULL,FALSE);
- }
+ if (auth()->user()->inGroup("admin") == false) {
+ if (auth()->user()->inGroup("admin") == false) {
+ $query->where('facturas.cliente_id', auth()->user()->cliente_id)
+ ->where("chat_department_id is NOT NULL", NULL, FALSE);
}
- $query->orderBy("created_at", "DESC");
+ }
+ $query->orderBy("created_at", "DESC");
return $query;
}
public function createNewDirectChat(string $title, string $message, array $users)
@@ -802,7 +802,7 @@ class ChatModel extends Model
$chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user_id]);
}
}
-
+
/**
* Obtain users and messages from `chat_id`
*
@@ -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,19 +897,16 @@ class ChatModel extends Model
->where('chat_id', $chat_id)
->where('sender_id !=', $user_id)
->update(["viewed" => false]);
-
}
- public function createNotificationsToNewChatUser($chat_id,$user_id)
+ public function createNotificationsToNewChatUser($chat_id, $user_id)
{
$query = $this->builder()
->select("chat_messages.id")
->join('chat_messages', 'chat_messages.chat_id = chats.id', 'left')
->where('chat_messages.chat_id', $chat_id)
->get()->getResultObject();
- $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->insertBatch($chat_notifications);
-
-
}
}
diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
index ed374a00..ae6ea39e 100644
--- a/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
+++ b/ci4/app/Views/themes/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
@@ -546,7 +546,6 @@
},
{ 'data': 'precio',render : (d) => `${d}` },
{ 'data': 'margen',render : (d) => `${d}` },
- { 'data': 'is_deleted'},
{
data: actionBtns,
className: 'row-edit dt-center'
diff --git a/httpdocs/assets/js/safekat/pages/chatFactura.js b/httpdocs/assets/js/safekat/pages/chatFactura.js
index 8465e69b..7009f2da 100644
--- a/httpdocs/assets/js/safekat/pages/chatFactura.js
+++ b/httpdocs/assets/js/safekat/pages/chatFactura.js
@@ -12,7 +12,7 @@ $(() => {
}
if ($("#modalNewDirectMessageClient").length > 0) {
- let modalDirectMessageClient = new ModalDirectMessageClient("presupuesto", $("#modalNewDirectMessageClient"))
+ let modalDirectMessageClient = new ModalDirectMessageClient("factura", $("#modalNewDirectMessageClient"))
modalDirectMessageClient.init()
$("#direct-message-cliente").on("click", () => {
modalDirectMessageClient.modal.show()
diff --git a/httpdocs/assets/js/safekat/pages/chatPedido.js b/httpdocs/assets/js/safekat/pages/chatPedido.js
index f6592a32..735417c8 100644
--- a/httpdocs/assets/js/safekat/pages/chatPedido.js
+++ b/httpdocs/assets/js/safekat/pages/chatPedido.js
@@ -12,7 +12,7 @@ $(() => {
}
if ($("#modalNewDirectMessageClient").length > 0) {
- let modalDirectMessageClient = new ModalDirectMessageClient("presupuesto", $("#modalNewDirectMessageClient"))
+ let modalDirectMessageClient = new ModalDirectMessageClient("pedido", $("#modalNewDirectMessageClient"))
modalDirectMessageClient.init()
$("#direct-message-cliente").on("click", () => {
modalDirectMessageClient.modal.show()