mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
message Service added
This commit is contained in:
@ -886,8 +886,8 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
$routes->get('department/factura/(:num)/(:num)', 'ChatController::get_chat_factura/$1/$2', ['as' => 'getChatFactura']);
|
||||
$routes->get('department/(:num)/users', 'ChatController::get_chat_department_users/$1', ['as' => 'getChatDepartmentUsers']);
|
||||
|
||||
|
||||
$routes->get('(:num)', 'ChatController::get_chat/$1', ['as' => 'getChat']);
|
||||
$routes->post('message/error/presupuesto', 'ChatController::store_chat_error_message', ['as' => 'storeChatErrorMessage']);
|
||||
$routes->post('message/presupuesto', 'ChatController::store_chat_message_presupuesto', ['as' => 'storeChatMessagePresupuesto']);
|
||||
$routes->post('message/pedido', 'ChatController::store_chat_message_pedido', ['as' => 'storeChatMessagePedido']);
|
||||
$routes->post('message/factura', 'ChatController::store_chat_message_factura', ['as' => 'storeChatMessageFactura']);
|
||||
|
||||
@ -766,4 +766,11 @@ class ChatController extends BaseController
|
||||
$this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
public function store_chat_error_message()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$messageService = service('messages');
|
||||
$r = $messageService->createErrorMessagePresupuesto("Error",$bodyData['presupuesto_id']);
|
||||
return $this->response->setJSON(["message" => "ok","data" => $r]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||
use App\Models\Presupuestos\ErrorPresupuesto;
|
||||
use App\Services\MessageService;
|
||||
use App\Services\PresupuestoClienteService;
|
||||
use App\Services\PresupuestoService;
|
||||
use Exception;
|
||||
@ -42,7 +43,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'listaPresupuestos';
|
||||
|
||||
|
||||
protected MessageService $messageService;
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -61,6 +62,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => "Listado", 'route' => site_url('presupuestocliente/list'), 'active' => true]
|
||||
];
|
||||
$this->messageService = service('messages');
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->model = new PresupuestoModel();
|
||||
|
||||
@ -36,7 +36,8 @@ class MessageService extends BaseService
|
||||
}
|
||||
public function createErrorMessagePresupuesto(string $error, int $presupuesto_id)
|
||||
{
|
||||
$chat_department_name = $this->configVariables->getVariable('send_error_to_chat_department_name');
|
||||
$dataResponse = null;
|
||||
$chat_department_name = $this->configVariables->getVariable('send_error_to_chat_department_name')?->value;
|
||||
$chat_department_id = $this->chatDepartmentModel->where('name', $chat_department_name)->first()?->id;
|
||||
if ($chat_department_id) {
|
||||
$existChat = $this->chatModel->existChatPresupuesto($chat_department_id, $presupuesto_id);
|
||||
@ -55,5 +56,7 @@ class MessageService extends BaseService
|
||||
}
|
||||
}
|
||||
}
|
||||
return $dataResponse;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user