Merge branch 'main' into 'feat/soporte'

create migration to add check_presupuesto_cliente column to tarifas tables...

See merge request jjimenez/safekat!554
This commit is contained in:
2025-02-20 08:59:47 +00:00
45 changed files with 384 additions and 63 deletions

View File

@ -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/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('department/(:num)/users', 'ChatController::get_chat_department_users/$1', ['as' => 'getChatDepartmentUsers']);
$routes->get('(:num)', 'ChatController::get_chat/$1', ['as' => 'getChat']); $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/presupuesto', 'ChatController::store_chat_message_presupuesto', ['as' => 'storeChatMessagePresupuesto']);
$routes->post('message/pedido', 'ChatController::store_chat_message_pedido', ['as' => 'storeChatMessagePedido']); $routes->post('message/pedido', 'ChatController::store_chat_message_pedido', ['as' => 'storeChatMessagePedido']);
$routes->post('message/factura', 'ChatController::store_chat_message_factura', ['as' => 'storeChatMessageFactura']); $routes->post('message/factura', 'ChatController::store_chat_message_factura', ['as' => 'storeChatMessageFactura']);

View File

@ -4,6 +4,7 @@ namespace Config;
use App\Services\FTPService; use App\Services\FTPService;
use App\Services\MaquinaService; use App\Services\MaquinaService;
use App\Services\MessageService;
use App\Services\PapelImpresionService; use App\Services\PapelImpresionService;
use CodeIgniter\Config\BaseService; use CodeIgniter\Config\BaseService;
use App\Services\ProductionService; use App\Services\ProductionService;
@ -48,4 +49,8 @@ class Services extends BaseService
{ {
return new MaquinaService(); return new MaquinaService();
} }
public static function messages()
{
return new MessageService();
}
} }

View File

@ -766,4 +766,11 @@ class ChatController extends BaseController
$this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id); $this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id);
return $this->response->setJSON(["message" => "ok", "status" => true]); 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]);
}
} }

View File

@ -156,6 +156,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
if ($this->request->getPost('show_in_client') == null) { if ($this->request->getPost('show_in_client') == null) {
$sanitizedData['show_in_client'] = false; $sanitizedData['show_in_client'] = false;
} }
if ($this->request->getPost('activo') == null) {
$sanitizedData['activo'] = false;
}
if ($this->request->getPost('show_in_client_special') == null) { if ($this->request->getPost('show_in_client_special') == null) {
$sanitizedData['show_in_client_special'] = false; $sanitizedData['show_in_client_special'] = false;
} }
@ -163,6 +166,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
if ($sanitizedData['show_in_client_special']) { if ($sanitizedData['show_in_client_special']) {
$sanitizedData['show_in_client'] = true; $sanitizedData['show_in_client'] = true;
} }
if ($sanitizedData['activo']) {
$sanitizedData['activo'] = true;
}
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :

View File

@ -18,6 +18,7 @@ use App\Models\Presupuestos\PresupuestoModel;
use App\Models\Presupuestos\PresupuestoPreimpresionesModel; use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
use App\Models\Presupuestos\PresupuestoServiciosExtraModel; use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
use App\Models\Presupuestos\ErrorPresupuesto; use App\Models\Presupuestos\ErrorPresupuesto;
use App\Services\MessageService;
use App\Services\PresupuestoClienteService; use App\Services\PresupuestoClienteService;
use App\Services\PresupuestoService; use App\Services\PresupuestoService;
use Exception; use Exception;
@ -42,7 +43,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
protected $indexRoute = 'listaPresupuestos'; protected $indexRoute = 'listaPresupuestos';
protected MessageService $messageService;
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) 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' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
['title' => "Listado", 'route' => site_url('presupuestocliente/list'), 'active' => true] ['title' => "Listado", 'route' => site_url('presupuestocliente/list'), 'active' => true]
]; ];
$this->messageService = service('messages');
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->model = new PresupuestoModel(); $this->model = new PresupuestoModel();

View File

@ -65,7 +65,9 @@ class Tarifaextra extends \App\Controllers\GoBaseController
if ($this->request->getPost('mostrar_en_presupuesto') == null) { if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false; $sanitizedData['mostrar_en_presupuesto'] = false;
} }
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
}
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -142,7 +144,9 @@ class Tarifaextra extends \App\Controllers\GoBaseController
if ($this->request->getPost('mostrar_en_presupuesto') == null) { if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false; $sanitizedData['mostrar_en_presupuesto'] = false;
} }
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
}
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :

View File

@ -63,7 +63,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
if ($this->request->getPost('mostrar_en_presupuesto') == null) { if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false; $sanitizedData['mostrar_en_presupuesto'] = false;
} }
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
}
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -144,7 +146,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
if ($this->request->getPost('mostrar_en_presupuesto') == null) { if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false; $sanitizedData['mostrar_en_presupuesto'] = false;
} }
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
}
$noException = true; $noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) : if ($this->canValidate()) :

View File

@ -0,0 +1,29 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterTableTarifasCheckPresupuestoClienteMigration extends Migration
{
public function up()
{
$field = [
'mostrar_en_presupuesto_cliente' => [
'type' => 'BOOLEAN',
'default' => false,
]
];
$this->forge->addColumn('lg_tarifa_acabado',$field);
$this->forge->addColumn('lg_tarifa_manipulado',$field);
$this->forge->addColumn('tarifa_encuadernacion',$field);
}
public function down()
{
$this->forge->dropColumn('lg_tarifa_acabado','mostrar_en_presupuesto_cliente');
$this->forge->dropColumn('lg_tarifa_manipulado','mostrar_en_presupuesto_cliente');
$this->forge->dropColumn('tarifa_encuadernacion','mostrar_en_presupuesto_cliente');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterAddColumnActivoPapelGenerico extends Migration
{
public function up()
{
$field = [
'activo' => [
'type' => 'BOOLEAN',
'default' => true,
]
];
$this->forge->addColumn('lg_papel_generico',$field);
}
public function down()
{
$this->forge->dropColumn('lg_papel_generico','activo');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration extends Migration
{
public function up()
{
$field = [
'mostrar_en_presupuesto_cliente' => [
'type' => 'BOOLEAN',
'default' => false,
]
];
$this->forge->addColumn('tarifa_extra',$field);
$this->forge->addColumn('lg_tarifa_preimpresion',$field);
}
public function down()
{
$this->forge->dropColumn('tarifa_extra','mostrar_en_presupuesto_cliente');
$this->forge->dropColumn('lg_tarifa_preimpresion','mostrar_en_presupuesto_cliente');
}
}

View File

@ -13,11 +13,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
"show_in_client" => false, "show_in_client" => false,
"show_in_client_special" => false, "show_in_client_special" => false,
"is_deleted" => 0, "is_deleted" => 0,
"activo" => false,
"created_at" => null, "created_at" => null,
"updated_at" => null, "updated_at" => null,
]; ];
protected $casts = [ protected $casts = [
"show_in_client" => "boolean", "show_in_client" => "boolean",
"activo" => "boolean",
"show_in_client_special" => "boolean", "show_in_client_special" => "boolean",
"is_deleted" => "int", "is_deleted" => "int",
]; ];

View File

@ -13,6 +13,7 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
"precio_min" => 0, "precio_min" => 0,
"importe_fijo" => 0, "importe_fijo" => 0,
"mostrar_en_presupuesto" => 1, "mostrar_en_presupuesto" => 1,
"mostrar_en_presupuesto_cliente" => 0,
"acabado_cubierta" => 0, "acabado_cubierta" => 0,
"acabado_sobrecubierta" => 0, "acabado_sobrecubierta" => 0,
"user_created_id" => 0, "user_created_id" => 0,

View File

@ -11,6 +11,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
"nombre" => null, "nombre" => null,
"code" => null, "code" => null,
"mostrar_en_presupuesto" => 1, "mostrar_en_presupuesto" => 1,
"mostrar_en_presupuesto_cliente" => 0,
"tipo_encuadernacion" => 0, "tipo_encuadernacion" => 0,
"servicio_encuadernacion" => 0, "servicio_encuadernacion" => 0,
"por_horas" => 0, "por_horas" => 0,
@ -23,6 +24,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
]; ];
protected $casts = [ protected $casts = [
"mostrar_en_presupuesto" => "int", "mostrar_en_presupuesto" => "int",
"mostrar_en_presupuesto_cliente" => "bool",
"code" => "string", "code" => "string",
"tipo_encuadernacion" => "int", "tipo_encuadernacion" => "int",
"servicio_encuadernacion" => "int", "servicio_encuadernacion" => "int",

View File

@ -14,6 +14,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
"precio_min" => 0, "precio_min" => 0,
"importe_fijo" => 0, "importe_fijo" => 0,
"mostrar_en_presupuesto" => 1, "mostrar_en_presupuesto" => 1,
"mostrar_en_presupuesto_cliente" => 0,
"user_created_id" => 0, "user_created_id" => 0,
"user_updated_id" => 0, "user_updated_id" => 0,
"is_deleted" => 0, "is_deleted" => 0,
@ -27,6 +28,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
"code" => "string", "code" => "string",
"comment" => "string", "comment" => "string",
"mostrar_en_presupuesto" => "int", "mostrar_en_presupuesto" => "int",
"mostrar_en_presupuesto_cliente" => "bool",
"user_created_id" => "int", "user_created_id" => "int",
"user_updated_id" => "int", "user_updated_id" => "int",
"is_deleted" => "int", "is_deleted" => "int",

View File

@ -13,6 +13,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
"precio" => null, "precio" => null,
"margen" => 0, "margen" => 0,
"mostrar_en_presupuesto" => 1, "mostrar_en_presupuesto" => 1,
"mostrar_en_presupuesto_cliente" => false,
"user_created_id" => 1, "user_created_id" => 1,
"user_update_id" => 1, "user_update_id" => 1,
"is_deleted" => 0, "is_deleted" => 0,
@ -26,6 +27,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
"comment" => "string", "comment" => "string",
"margen" => "float", "margen" => "float",
"mostrar_en_presupuesto" => "int", "mostrar_en_presupuesto" => "int",
"mostrar_en_presupuesto_cliente" => "bool",
"user_created_id" => "int", "user_created_id" => "int",
"user_update_id" => "int", "user_update_id" => "int",
"is_deleted" => "int", "is_deleted" => "int",

View File

@ -13,6 +13,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
"precio" => null, "precio" => null,
"margen" => 0, "margen" => 0,
"mostrar_en_presupuesto" => 1, "mostrar_en_presupuesto" => 1,
"mostrar_en_presupuesto_cliente" => false,
"user_created_id" => 1, "user_created_id" => 1,
"user_update_id" => 1, "user_update_id" => 1,
"is_deleted" => 0, "is_deleted" => 0,
@ -26,6 +27,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
"code" => "string", "code" => "string",
"comment" => "string", "comment" => "string",
"mostrar_en_presupuesto" => "int", "mostrar_en_presupuesto" => "int",
"mostrar_en_presupuesto_cliente" => "bool",
"user_created_id" => "int", "user_created_id" => "int",
"user_update_id" => "int", "user_update_id" => "int",
"is_deleted" => "int", "is_deleted" => "int",

View File

@ -8,6 +8,7 @@ return [
'createdAt' => 'Creado el', 'createdAt' => 'Creado el',
'deletedAt' => 'Deleted At', 'deletedAt' => 'Deleted At',
'id' => 'ID', 'id' => 'ID',
'activo' => 'Activo',
'isDeleted' => 'Is Deleted', 'isDeleted' => 'Is Deleted',
'moduleTitle' => 'Papel Genérico', 'moduleTitle' => 'Papel Genérico',
'nombre' => 'Nombre', 'nombre' => 'Nombre',

View File

@ -13,6 +13,7 @@ return [
'precioMin' => 'Precio Mínimo', 'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo', 'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
"acabado_cubierta" => "Acabado cubierta", "acabado_cubierta" => "Acabado cubierta",
"acabado_sobrecubierta" => "Acabado sobrecubierta", "acabado_sobrecubierta" => "Acabado sobrecubierta",
'tarifaacabado' => 'Tarifa Acabado', 'tarifaacabado' => 'Tarifa Acabado',

View File

@ -23,6 +23,7 @@ return [
'tiradaMax' => 'Tirada Max', 'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min', 'tiradaMin' => 'Tirada Min',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
'tipo_encuadernacion' => 'Tipo encuardernación', 'tipo_encuadernacion' => 'Tipo encuardernación',
'servicio_encuadernacion' => 'Servicio encuardernación', 'servicio_encuadernacion' => 'Servicio encuardernación',
'updatedAt' => 'Actualizado en', 'updatedAt' => 'Actualizado en',

View File

@ -14,6 +14,7 @@ return [
'precioMin' => 'Precio Mínimo', 'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo', 'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)',
'margen' => 'Margen', 'margen' => 'Margen',
'tarifaextra' => 'Tarifa Servicios Extra', 'tarifaextra' => 'Tarifa Servicios Extra',
'tarifaextraList' => 'Lista Tarifas Servicios Extra', 'tarifaextraList' => 'Lista Tarifas Servicios Extra',

View File

@ -18,6 +18,7 @@ return [
'precioMin' => 'Precio T. Máx', 'precioMin' => 'Precio T. Máx',
'importeFijo' => 'Importe Fijo', 'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
'tarifamanipulado' => 'Tarifa Manipulado', 'tarifamanipulado' => 'Tarifa Manipulado',
'tarifamanipuladoList' => 'Lista Tarifas Manipulado', 'tarifamanipuladoList' => 'Lista Tarifas Manipulado',
'tarifasmanipulado' => 'Tarifas Manipulado', 'tarifasmanipulado' => 'Tarifas Manipulado',

View File

@ -14,6 +14,7 @@ return [
'precioMin' => 'Precio Mínimo', 'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo', 'importeFijo' => 'Importe Fijo',
'mostrar_en_presupuesto' => 'Mostrar en presupuesto', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)',
'margen' => 'Margen', 'margen' => 'Margen',
'tarifapreimpresion' => 'Tarifa Preimpresión', 'tarifapreimpresion' => 'Tarifa Preimpresión',
'tarifapreimpresionList' => 'Lista Tarifas Preimpresión', 'tarifapreimpresionList' => 'Lista Tarifas Preimpresión',

View File

@ -22,7 +22,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
4 => "t1.show_in_client_special", 4 => "t1.show_in_client_special",
]; ];
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"]; protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted", "activo"];
protected $returnType = "App\Entities\Configuracion\PapelGenerico"; protected $returnType = "App\Entities\Configuracion\PapelGenerico";
protected $useTimestamps = true; protected $useTimestamps = true;
@ -120,25 +120,28 @@ class PapelGenericoModel extends \App\Models\BaseModel
{ {
$builder = $this->db $builder = $this->db
->table($this->table . " t1") ->table($this->table . " t1")
->select( ->select("t1.id AS id, t1.nombre AS nombre,
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot, t1.code AS code,
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special" t1.code_ot AS code_ot,
t1.activo AS activo,
t1.show_in_client AS show_in_client,
t1.show_in_client_special AS show_in_client_special"
) )
->where("is_deleted", 0); ->where("is_deleted", 0);
return empty($search) return empty($search)
? $builder ? $builder
: $builder : $builder
->groupStart() ->groupStart()
->like("t1.id", $search) ->like("t1.id", $search)
->orLike("t1.nombre", $search) ->orLike("t1.nombre", $search)
->orLike("t1.code", $search) ->orLike("t1.code", $search)
->orLike("t1.code_ot", $search) ->orLike("t1.code_ot", $search)
->orLike("t1.id", $search) ->orLike("t1.id", $search)
->orLike("t1.nombre", $search) ->orLike("t1.nombre", $search)
->orLike("t1.code", $search) ->orLike("t1.code", $search)
->orLike("t1.code_ot", $search) ->orLike("t1.code_ot", $search)
->groupEnd(); ->groupEnd();
} }

View File

@ -26,6 +26,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
"precio_min", "precio_min",
"importe_fijo", "importe_fijo",
"mostrar_en_presupuesto", "mostrar_en_presupuesto",
"mostrar_en_presupuesto_cliente",
"acabado_cubierta", "acabado_cubierta",
"acabado_sobrecubierta", "acabado_sobrecubierta",
"deleted_at", "deleted_at",
@ -86,7 +87,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
{ {
$builder = $this->db->table($this->table . " t1")->select( $builder = $this->db->table($this->table . " t1")->select(
"t1.id AS id, t1.nombre AS nombre,t1.code AS code, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo, "t1.id AS id, t1.nombre AS nombre,t1.code AS code, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto, t1.acabado_cubierta AS acabado_cubierta, t1.acabado_sobrecubierta AS acabado_sobrecubierta" t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente, t1.acabado_cubierta AS acabado_cubierta, t1.acabado_sobrecubierta AS acabado_sobrecubierta"
); );
//JJO //JJO

View File

@ -25,6 +25,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
"code", "code",
"comment", "comment",
"mostrar_en_presupuesto", "mostrar_en_presupuesto",
"mostrar_en_presupuesto_cliente",
"tipo_encuadernacion", "tipo_encuadernacion",
"servicio_encuadernacion", "servicio_encuadernacion",
"por_horas", "por_horas",
@ -69,6 +70,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
{ {
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.code AS code, $builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.code AS code,
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto, t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente,
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion, t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion,
t1.por_horas AS por_horas"); t1.por_horas AS por_horas");

View File

@ -29,7 +29,8 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
"deleted_at", "deleted_at",
"is_deleted", "is_deleted",
"user_created_id", "user_created_id",
"user_updated_id" "user_updated_id",
"mostrar_en_presupuesto_cliente"
]; ];
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity"; protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity";
@ -83,7 +84,7 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
public function getResource(string $search = "") public function getResource(string $search = "")
{ {
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id,t1.code AS code, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo $builder = $this->db->table($this->table . " t1")->select("t1.id AS id,t1.code AS code, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo
,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto"); ,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente");
//JJO //JJO
$builder->where("t1.is_deleted", 0); $builder->where("t1.is_deleted", 0);

View File

@ -19,6 +19,7 @@ class TarifaextraModel extends \App\Models\BaseModel
"precio", "precio",
"margen", "margen",
"mostrar_en_presupuesto", "mostrar_en_presupuesto",
"mostrar_en_presupuesto_cliente",
"deleted_at", "deleted_at",
"is_deleted", "is_deleted",
"user_created_id", "user_created_id",

View File

@ -19,6 +19,7 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
"precio", "precio",
"margen", "margen",
"mostrar_en_presupuesto", "mostrar_en_presupuesto",
"mostrar_en_presupuesto_cliente",
"deleted_at", "deleted_at",
"is_deleted", "is_deleted",
"user_created_id", "user_created_id",

View File

@ -0,0 +1,62 @@
<?php
namespace App\Services;
use App\Controllers\Configuracion\ConfigVariables;
use App\Models\Chat\ChatDeparmentModel;
use App\Models\Chat\ChatMessageModel;
use App\Models\Chat\ChatModel;
use App\Models\ChatNotification;
use App\Models\ChatUser;
use App\Models\Configuracion\ConfigVariableModel;
use App\Models\Presupuestos\PresupuestoModel;
use CodeIgniter\Config\BaseService;
class MessageService extends BaseService
{
protected ChatModel $chatModel;
protected ChatMessageModel $chatMessageModel;
protected ChatUser $chatUserModel;
protected ChatNotification $chatNotificationModel;
protected PresupuestoModel $presupuestoModel;
protected ChatDeparmentModel $chatDepartmentModel;
protected ConfigVariableModel $configVariables;
public function __construct()
{
$this->chatModel = model(ChatModel::class);
$this->chatMessageModel = model(ChatMessageModel::class);
$this->chatNotificationModel = model(ChatNotification::class);
$this->chatUserModel = model(ChatUser::class);
$this->presupuestoModel = model(PresupuestoModel::class);
$this->chatDepartmentModel = model(ChatDeparmentModel::class);
$this->configVariables = model(ConfigVariableModel::class);
}
public function createErrorMessagePresupuesto(string $error, int $presupuesto_id)
{
$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);
if ($existChat == false) {
$chatId = $this->chatModel->createChatPresupuesto($chat_department_id, $presupuesto_id);
} else {
$chat = $this->chatModel->getChatPresupuesto($chat_department_id, $presupuesto_id);
$chatId = $chat->id;
}
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $error]);
$dataResponse = $this->chatMessageModel->find($chat_message_id);
$chatDepartmentUsers = $this->chatDepartmentModel->getChatDepartmentUsers($chat_department_id);
foreach ($chatDepartmentUsers as $user) {
if ($user->id != auth()->user()->id) {
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user->id]);
}
}
}
return $dataResponse;
}
}

View File

@ -23,7 +23,15 @@
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control" <input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control"
value="<?= old('code_ot', $papelGenerico->code_ot) ?>"> value="<?= old('code_ot', $papelGenerico->code_ot) ?>">
</div><!--//.mb-3 --> </div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="activo_papel_generico" class="form-check-label">
<?= lang('PapelGenerico.activo') ?>
</label>
<input type="checkbox" id="activo_papel_generico" name="activo" value="1"
class="form-check-input" <?= $papelGenerico->activo == true ? 'checked' : ''; ?>>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3"> <div class="mb-3">
<div class="form-check"> <div class="form-check">

View File

@ -144,6 +144,7 @@
} }
}); });
<?=$this->endSection() ?> <?=$this->endSection() ?>

View File

@ -21,6 +21,7 @@
<th><?= lang('PapelGenerico.codeOt') ?></th> <th><?= lang('PapelGenerico.codeOt') ?></th>
<th><?= lang('PapelGenerico.showInClient') ?></th> <th><?= lang('PapelGenerico.showInClient') ?></th>
<th><?= lang('PapelGenerico.showInClientSpecial') ?></th> <th><?= lang('PapelGenerico.showInClientSpecial') ?></th>
<th><?= lang('PapelGenerico.activo') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr> </tr>
</thead> </thead>
@ -92,13 +93,14 @@
{ 'data': 'code_ot' }, { 'data': 'code_ot' },
{ 'data': 'show_in_client' }, { 'data': 'show_in_client' },
{ 'data': 'show_in_client_special' }, { 'data': 'show_in_client_special' },
{ 'data': 'activo' },
{ 'data': actionBtns } { 'data': actionBtns }
] ]
}); });
theTable.on( 'draw.dt', function () { theTable.on( 'draw.dt', function () {
const boolCols = [3, 4]; const boolCols = [3, 4, 5];
for (let coln of boolCols) { for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : ''; cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';

View File

@ -54,7 +54,16 @@
<?= lang('Tarifaacabado.mostrar_en_presupuesto') ?> <?= lang('Tarifaacabado.mostrar_en_presupuesto') ?>
</label> </label>
</div><!--//.form-check --> </div><!--//.form-check -->
</div><!--//.mb-3 --> </div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaacabadoEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3"> <div class="mb-3">
<div class="form-check"> <div class="form-check">
<label for="acabado_cubierta" class="form-check-label"> <label for="acabado_cubierta" class="form-check-label">

View File

@ -21,6 +21,7 @@
<th><?= lang('Tarifaacabado.precioMin') ?></th> <th><?= lang('Tarifaacabado.precioMin') ?></th>
<th><?= lang('Tarifaacabado.importeFijo') ?></th> <th><?= lang('Tarifaacabado.importeFijo') ?></th>
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th> <th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto_cliente') ?></th>
<th><?= lang('Tarifaacabado.acabado_cubierta') ?></th> <th><?= lang('Tarifaacabado.acabado_cubierta') ?></th>
<th><?= lang('Tarifaacabado.acabado_sobrecubierta') ?></th> <th><?= lang('Tarifaacabado.acabado_sobrecubierta') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
@ -95,6 +96,7 @@
{ 'data': 'precio_min' }, { 'data': 'precio_min' },
{ 'data': 'importe_fijo' }, { 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' }, { 'data': 'mostrar_en_presupuesto' },
{ 'data': 'mostrar_en_presupuesto_cliente' },
{ 'data': 'acabado_cubierta' }, { 'data': 'acabado_cubierta' },
{ 'data': 'acabado_sobrecubierta' }, { 'data': 'acabado_sobrecubierta' },
{ 'data': actionBtns } { 'data': actionBtns }
@ -102,7 +104,7 @@
}); });
theTable.on( 'draw.dt', function () { theTable.on( 'draw.dt', function () {
const boolCols = [3, 4, 5]; const boolCols = [3, 4, 5,6,7];
for (let coln of boolCols) { for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : ''; cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';

View File

@ -46,6 +46,14 @@
</label> </label>
</div><!--//.form-check --> </div><!--//.form-check -->
</div><!--//.mb-3 --> </div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaEncuadernacionEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!-- //.col --> </div><!-- //.col -->
<div class="col-md-12 col-lg-4 px-4"> <div class="col-md-12 col-lg-4 px-4">

View File

@ -19,6 +19,7 @@
<th><?= lang('Tarifaencuadernacion.nombre') ?></th> <th><?= lang('Tarifaencuadernacion.nombre') ?></th>
<th><?= lang('Tarifaencuadernacion.code') ?></th> <th><?= lang('Tarifaencuadernacion.code') ?></th>
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th> <th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?></th>
<th><?= lang('Tarifaencuadernacion.tipo_encuadernacion') ?></th> <th><?= lang('Tarifaencuadernacion.tipo_encuadernacion') ?></th>
<th><?= lang('Tarifaencuadernacion.servicio_encuadernacion') ?></th> <th><?= lang('Tarifaencuadernacion.servicio_encuadernacion') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
@ -91,6 +92,7 @@
{ 'data': 'nombre' }, { 'data': 'nombre' },
{ 'data': 'code' }, { 'data': 'code' },
{ 'data': 'mostrar_en_presupuesto' }, { 'data': 'mostrar_en_presupuesto' },
{ 'data': 'mostrar_en_presupuesto_cliente' },
{ 'data': 'tipo_encuadernacion' }, { 'data': 'tipo_encuadernacion' },
{ 'data': 'servicio_encuadernacion' }, { 'data': 'servicio_encuadernacion' },
{ 'data': actionBtns } { 'data': actionBtns }
@ -98,7 +100,7 @@
}); });
theTable.on( 'draw.dt', function () { theTable.on( 'draw.dt', function () {
const boolCols = [1,2,3, 4]; const boolCols = [1,2,3,4,5];
for (let coln of boolCols) { for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : ''; cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';

View File

@ -81,7 +81,19 @@
</label> </label>
</div> </div>
</div> </div>
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"
id="mostrar_en_presupuesto_cliente"
name="mostrar_en_presupuesto_cliente"
value="1"
class="form-check-input"<?= $tarifaextraEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>
>
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
<?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?>
</label>
</div>
</div>
</div><!--//.col --> </div><!--//.col -->
</div><!-- //.row --> </div><!-- //.row -->

View File

@ -1,6 +1,6 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?> <?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?> <?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?> <?= $this->extend('themes/vuexy/main/defaultlayout')?>
<?= $this->section("content") ?> <?= $this->section("content") ?>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">

View File

@ -1,6 +1,6 @@
<?=$this->include('themes/_commonPartialsBs/datatables') ?> <?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?=$this->extend('themes/vuexy/main/defaultlayout') ?> <?=$this->extend('themes/vuexy/main/defaultlayout') ?>
<?=$this->section('content'); ?> <?=$this->section('content')?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -20,6 +20,7 @@
<th><?= lang('Tarifaextra.precio') ?></th> <th><?= lang('Tarifaextra.precio') ?></th>
<th><?= lang('Tarifaextra.margen') ?></th> <th><?= lang('Tarifaextra.margen') ?></th>
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th> <th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr> </tr>
</thead> </thead>
@ -46,6 +47,9 @@
<td class="align-middle"> <td class="align-middle">
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?> <?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
</td> </td>
<td class="align-middle">
<?= esc($item->mostrar_en_presupuesto_cliente)==1?'<i class="ti ti-check"></i>':"" ?>
</td>
<td class="align-middle text-center text-nowrap"> <td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifaextra', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?> <?=anchor(route_to('editTarifaextra', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?> <?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>

View File

@ -52,7 +52,14 @@
</label> </label>
</div><!--//.form-check --> </div><!--//.form-check -->
</div><!--//.mb-3 --> </div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col --> </div><!--//.col -->
</div><!-- //.row --> </div><!-- //.row -->

View File

@ -21,6 +21,7 @@
<th><?= lang('Tarifamanipulado.importeMinimo') ?></th> <th><?= lang('Tarifamanipulado.importeMinimo') ?></th>
<th><?= lang('Tarifamanipulado.importeFijo') ?></th> <th><?= lang('Tarifamanipulado.importeFijo') ?></th>
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th> <th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto_cliente') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr> </tr>
</thead> </thead>
@ -91,7 +92,8 @@
{ 'data': 'code' }, { 'data': 'code' },
{ 'data': 'precio_min' }, { 'data': 'precio_min' },
{ 'data': 'importe_fijo' }, { 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' }, { 'data': 'mostrar_en_presupuesto',render : (d) => d == true ? '<i class="ti ti-check"></i>' : "" },
{ 'data': 'mostrar_en_presupuesto_cliente',render : (d) => d == true ? '<i class="ti ti-check"></i>' : "" },
{ 'data': actionBtns } { 'data': actionBtns }
] ]
}); });

View File

@ -81,6 +81,19 @@
</label> </label>
</div> </div>
</div> </div>
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"
id="mostrar_en_presupuesto_cliente"
name="mostrar_en_presupuesto_cliente"
value="1"
class="form-check-input"<?= $tarifapreimpresionEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>
>
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
<?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?>
</label>
</div>
</div>
</div><!--//.col --> </div><!--//.col -->
</div><!-- //.row --> </div><!-- //.row -->

View File

@ -20,6 +20,7 @@
<th><?= lang('Tarifapreimpresion.precio') ?></th> <th><?= lang('Tarifapreimpresion.precio') ?></th>
<th><?= lang('Tarifapreimpresion.margen') ?></th> <th><?= lang('Tarifapreimpresion.margen') ?></th>
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th> <th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto_cliente') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th> <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr> </tr>
</thead> </thead>
@ -45,6 +46,9 @@
<td class="align-middle"> <td class="align-middle">
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?> <?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
</td> </td>
<td class="align-middle">
<?= esc($item->mostrar_en_presupuesto_cliente)==1?'<i class="ti ti-check"></i>':"" ?>
</td>
<td class="align-middle text-center text-nowrap"> <td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifapreimpresion', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?> <?=anchor(route_to('editTarifapreimpresion', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?> <?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>

View File

@ -1,37 +1,37 @@
export const alertConfirmationDelete = (title,type="primary") => { export const alertConfirmationDelete = (title, type = "primary") => {
return Swal.fire({ return Swal.fire({
title: '¿Está seguro?', title: '¿Está seguro?',
text: "Esta acción es irreversible.", text: "Esta acción es irreversible.",
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonColor: '#3085d6', confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33', cancelButtonColor: '#d33',
confirmButtonText: 'Sí', confirmButtonText: 'Sí',
cancelButtonText: 'Cancelar', cancelButtonText: 'Cancelar',
customClass: { customClass: {
confirmButton: 'btn btn-danger me-1', confirmButton: 'btn btn-danger me-1',
cancelButton: 'btn btn-label-secondary' cancelButton: 'btn btn-label-secondary'
}, },
buttonsStyling: false buttonsStyling: false
})
}
export const alertSuccessMessage = (title,type="primary") => {
return Swal.fire({
showCancelButton: false,
showConfirmButton : false,
title: title,
text: title,
icon: "success",
timer : 2000
}) })
} }
export const alertWarningMessage = (title,message,type="primary") => { export const alertSuccessMessage = (title, type = "primary") => {
return Swal.fire({ return Swal.fire({
showCancelButton: false,
showConfirmButton: false,
title: title,
text: title,
icon: "success",
timer: 2000
})
}
export const alertWarningMessage = (title, message, type = "primary") => {
return Swal.fire({
title: title, title: title,
text: message, text: message,
icon: "warning", icon: "warning",
@ -40,4 +40,28 @@ export const alertWarningMessage = (title,message,type="primary") => {
}, },
buttonsStyling: false buttonsStyling: false
}) })
}
export const toastPresupuestoSummary = (value, target = 'body') => {
return Swal.mixin({
toast: true,
position: 'bottom-end',
html: `
<div class="d-flex flex-column p-0 m-0">
<p class="m-0">Total presupuesto</p>
<span class="badge badge-label-primary fs-small">${value}</span>
</div>`,
customClass: {
popup: 'bg-primary text-white',
},
target: target,
height : "100px",
width : "200px",
padding : '1px',
allowEscapeKey: false,
showConfirmButton: false,
timer: 0,
timerProgressBar: false,
stopKeydownPropagation: false,
})
} }

View File

@ -1,3 +1,5 @@
import { toastPresupuestoSummary } from "../../../components/alerts/sweetAlert.js";
class Resumen { class Resumen {
constructor() { constructor() {
@ -7,7 +9,7 @@ class Resumen {
init() { init() {
const self = this; const self = this;
this.toastPresupuestoTotal = null
$(".update-totales").on("change", function () { $(".update-totales").on("change", function () {
self.updateTotales(true, true, true) self.updateTotales(true, true, true)
}); });
@ -16,6 +18,7 @@ class Resumen {
await self.updateTotales(); await self.updateTotales();
$(document).trigger('update-totales-completed'); $(document).trigger('update-totales-completed');
}); });
$("#totalDespuesDecuento").on('change',this.updateToastSummary.bind(this))
} }
cargar(resumen) { cargar(resumen) {
@ -44,7 +47,7 @@ class Resumen {
$("#totalAntesDescuento").text(resumen.total_antes_descuento + "€" || "0€"); $("#totalAntesDescuento").text(resumen.total_antes_descuento + "€" || "0€");
$("#total_descuentoPercent").val(resumen.total_descuentoPercent || "0"); $("#total_descuentoPercent").val(resumen.total_descuentoPercent || "0");
$("#descuentoTotal").text(resumen.total_descuento + "€" || "0€"); $("#descuentoTotal").text(resumen.total_descuento + "€" || "0€");
$("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€"); $("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€").trigger("change")
$("#precioUnidadPresupuesto").text(resumen.total_precio_unidad + "€" || "0€"); $("#precioUnidadPresupuesto").text(resumen.total_precio_unidad + "€" || "0€");
$("#factor").text(resumen.total_factor || "0"); $("#factor").text(resumen.total_factor || "0");
$("#factor_ponderado").text(resumen.total_factor_ponderado || "0"); $("#factor_ponderado").text(resumen.total_factor_ponderado || "0");
@ -52,7 +55,7 @@ class Resumen {
if (resumen.total_aceptado !== undefined) { if (resumen.total_aceptado !== undefined) {
$("#totalAceptado").val(resumen.total_aceptado + "€" || "0€"); $("#totalAceptado").val(resumen.total_aceptado + "€" || "0€");
} }
} }
update() { update() {
@ -352,6 +355,25 @@ class Resumen {
roundToTwoDecimals(num) { roundToTwoDecimals(num) {
return parseFloat(num.toFixed(2)); return parseFloat(num.toFixed(2));
} }
updateToastSummary()
{
if(this.toastPresupuestoTotal){
this.toastPresupuestoTotal.close()
}
this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text() ?? 0)
this.toastPresupuestoTotal.fire().then((result) => {
if(result.isDismissed){
this.updateToastSummary()
$('html, body').animate(
{
scrollTop: $("#totalDespuesDecuento").offset().top
},
1000)
}
})
}
} }
export default Resumen; export default Resumen;