diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 359bda01..2d01a49f 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -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']); diff --git a/ci4/app/Config/Services.php b/ci4/app/Config/Services.php index 8d209990..33330fa1 100755 --- a/ci4/app/Config/Services.php +++ b/ci4/app/Config/Services.php @@ -4,6 +4,7 @@ namespace Config; use App\Services\FTPService; use App\Services\MaquinaService; +use App\Services\MessageService; use App\Services\PapelImpresionService; use CodeIgniter\Config\BaseService; use App\Services\ProductionService; @@ -48,4 +49,8 @@ class Services extends BaseService { return new MaquinaService(); } + public static function messages() + { + return new MessageService(); + } } diff --git a/ci4/app/Controllers/Chat/ChatController.php b/ci4/app/Controllers/Chat/ChatController.php index 854f562b..0be4e8ed 100644 --- a/ci4/app/Controllers/Chat/ChatController.php +++ b/ci4/app/Controllers/Chat/ChatController.php @@ -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]); + } } diff --git a/ci4/app/Controllers/Configuracion/Papelesgenericos.php b/ci4/app/Controllers/Configuracion/Papelesgenericos.php index 82392fca..37e2ca7c 100755 --- a/ci4/app/Controllers/Configuracion/Papelesgenericos.php +++ b/ci4/app/Controllers/Configuracion/Papelesgenericos.php @@ -156,6 +156,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController if ($this->request->getPost('show_in_client') == null) { $sanitizedData['show_in_client'] = false; } + if ($this->request->getPost('activo') == null) { + $sanitizedData['activo'] = false; + } if ($this->request->getPost('show_in_client_special') == null) { $sanitizedData['show_in_client_special'] = false; } @@ -163,6 +166,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController if ($sanitizedData['show_in_client_special']) { $sanitizedData['show_in_client'] = true; } + if ($sanitizedData['activo']) { + $sanitizedData['activo'] = true; + } $noException = true; if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) : diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index e6f14ce1..1902d77d 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -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(); diff --git a/ci4/app/Controllers/Tarifas/Tarifaextra.php b/ci4/app/Controllers/Tarifas/Tarifaextra.php index 28ea2f1b..049c07d6 100755 --- a/ci4/app/Controllers/Tarifas/Tarifaextra.php +++ b/ci4/app/Controllers/Tarifas/Tarifaextra.php @@ -65,7 +65,9 @@ class Tarifaextra extends \App\Controllers\GoBaseController if ($this->request->getPost('mostrar_en_presupuesto') == null) { $sanitizedData['mostrar_en_presupuesto'] = false; } - + if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) { + $sanitizedData['mostrar_en_presupuesto_cliente'] = false; + } $noException = true; 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) { $sanitizedData['mostrar_en_presupuesto'] = false; } - + if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) { + $sanitizedData['mostrar_en_presupuesto_cliente'] = false; + } $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($this->canValidate()) : diff --git a/ci4/app/Controllers/Tarifas/Tarifapreimpresion.php b/ci4/app/Controllers/Tarifas/Tarifapreimpresion.php index 6d26178e..474d60f1 100755 --- a/ci4/app/Controllers/Tarifas/Tarifapreimpresion.php +++ b/ci4/app/Controllers/Tarifas/Tarifapreimpresion.php @@ -63,7 +63,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController if ($this->request->getPost('mostrar_en_presupuesto') == null) { $sanitizedData['mostrar_en_presupuesto'] = false; } - + if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) { + $sanitizedData['mostrar_en_presupuesto_cliente'] = false; + } $noException = true; 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) { $sanitizedData['mostrar_en_presupuesto'] = false; } - + if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) { + $sanitizedData['mostrar_en_presupuesto_cliente'] = false; + } $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : if ($this->canValidate()) : diff --git a/ci4/app/Database/Migrations/2025-02-16-194726_AlterTableTarifasCheckPresupuestoClienteMigration.php b/ci4/app/Database/Migrations/2025-02-16-194726_AlterTableTarifasCheckPresupuestoClienteMigration.php new file mode 100644 index 00000000..1d4f8510 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-02-16-194726_AlterTableTarifasCheckPresupuestoClienteMigration.php @@ -0,0 +1,29 @@ + [ + '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'); + } +} diff --git a/ci4/app/Database/Migrations/2025-02-16-224244_AlterAddColumnActivoPapelGenerico.php b/ci4/app/Database/Migrations/2025-02-16-224244_AlterAddColumnActivoPapelGenerico.php new file mode 100644 index 00000000..ae73c86b --- /dev/null +++ b/ci4/app/Database/Migrations/2025-02-16-224244_AlterAddColumnActivoPapelGenerico.php @@ -0,0 +1,26 @@ + [ + 'type' => 'BOOLEAN', + 'default' => true, + ] + ]; + $this->forge->addColumn('lg_papel_generico',$field); + + } + + public function down() + { + $this->forge->dropColumn('lg_papel_generico','activo'); + } +} + diff --git a/ci4/app/Database/Migrations/2025-02-20-080000_AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration.php b/ci4/app/Database/Migrations/2025-02-20-080000_AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration.php new file mode 100644 index 00000000..ee5e2428 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-02-20-080000_AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration.php @@ -0,0 +1,30 @@ + [ + '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'); + + + } +} diff --git a/ci4/app/Entities/Configuracion/PapelGenerico.php b/ci4/app/Entities/Configuracion/PapelGenerico.php index a6bc5faa..344d1832 100755 --- a/ci4/app/Entities/Configuracion/PapelGenerico.php +++ b/ci4/app/Entities/Configuracion/PapelGenerico.php @@ -13,11 +13,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity "show_in_client" => false, "show_in_client_special" => false, "is_deleted" => 0, + "activo" => false, "created_at" => null, "updated_at" => null, ]; protected $casts = [ "show_in_client" => "boolean", + "activo" => "boolean", "show_in_client_special" => "boolean", "is_deleted" => "int", ]; diff --git a/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php b/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php index 37554c8d..0e384c7f 100644 --- a/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php +++ b/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php @@ -13,6 +13,7 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity "precio_min" => 0, "importe_fijo" => 0, "mostrar_en_presupuesto" => 1, + "mostrar_en_presupuesto_cliente" => 0, "acabado_cubierta" => 0, "acabado_sobrecubierta" => 0, "user_created_id" => 0, diff --git a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php index 1aa85454..b8d01575 100755 --- a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php @@ -11,6 +11,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity "nombre" => null, "code" => null, "mostrar_en_presupuesto" => 1, + "mostrar_en_presupuesto_cliente" => 0, "tipo_encuadernacion" => 0, "servicio_encuadernacion" => 0, "por_horas" => 0, @@ -23,6 +24,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "mostrar_en_presupuesto" => "int", + "mostrar_en_presupuesto_cliente" => "bool", "code" => "string", "tipo_encuadernacion" => "int", "servicio_encuadernacion" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php index d9f3c2f7..d976de71 100755 --- a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php @@ -14,6 +14,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity "precio_min" => 0, "importe_fijo" => 0, "mostrar_en_presupuesto" => 1, + "mostrar_en_presupuesto_cliente" => 0, "user_created_id" => 0, "user_updated_id" => 0, "is_deleted" => 0, @@ -27,6 +28,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity "code" => "string", "comment" => "string", "mostrar_en_presupuesto" => "int", + "mostrar_en_presupuesto_cliente" => "bool", "user_created_id" => "int", "user_updated_id" => "int", "is_deleted" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaextraEntity.php b/ci4/app/Entities/Tarifas/TarifaextraEntity.php index db2b0594..7134684d 100755 --- a/ci4/app/Entities/Tarifas/TarifaextraEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaextraEntity.php @@ -13,6 +13,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity "precio" => null, "margen" => 0, "mostrar_en_presupuesto" => 1, + "mostrar_en_presupuesto_cliente" => false, "user_created_id" => 1, "user_update_id" => 1, "is_deleted" => 0, @@ -26,6 +27,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity "comment" => "string", "margen" => "float", "mostrar_en_presupuesto" => "int", + "mostrar_en_presupuesto_cliente" => "bool", "user_created_id" => "int", "user_update_id" => "int", "is_deleted" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php b/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php index b1873597..86bd7f14 100755 --- a/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php +++ b/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php @@ -13,6 +13,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity "precio" => null, "margen" => 0, "mostrar_en_presupuesto" => 1, + "mostrar_en_presupuesto_cliente" => false, "user_created_id" => 1, "user_update_id" => 1, "is_deleted" => 0, @@ -26,6 +27,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity "code" => "string", "comment" => "string", "mostrar_en_presupuesto" => "int", + "mostrar_en_presupuesto_cliente" => "bool", "user_created_id" => "int", "user_update_id" => "int", "is_deleted" => "int", diff --git a/ci4/app/Language/es/PapelGenerico.php b/ci4/app/Language/es/PapelGenerico.php index c38d8c1c..5df63224 100755 --- a/ci4/app/Language/es/PapelGenerico.php +++ b/ci4/app/Language/es/PapelGenerico.php @@ -8,6 +8,7 @@ return [ 'createdAt' => 'Creado el', 'deletedAt' => 'Deleted At', 'id' => 'ID', + 'activo' => 'Activo', 'isDeleted' => 'Is Deleted', 'moduleTitle' => 'Papel Genérico', 'nombre' => 'Nombre', diff --git a/ci4/app/Language/es/Tarifaacabado.php b/ci4/app/Language/es/Tarifaacabado.php index 5bdd61e9..1b5af0c8 100755 --- a/ci4/app/Language/es/Tarifaacabado.php +++ b/ci4/app/Language/es/Tarifaacabado.php @@ -13,6 +13,7 @@ return [ 'precioMin' => 'Precio Mínimo', 'importeFijo' => 'Importe Fijo', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)', "acabado_cubierta" => "Acabado cubierta", "acabado_sobrecubierta" => "Acabado sobrecubierta", 'tarifaacabado' => 'Tarifa Acabado', diff --git a/ci4/app/Language/es/Tarifaencuadernacion.php b/ci4/app/Language/es/Tarifaencuadernacion.php index fbc59ef5..a4e15cde 100755 --- a/ci4/app/Language/es/Tarifaencuadernacion.php +++ b/ci4/app/Language/es/Tarifaencuadernacion.php @@ -23,6 +23,7 @@ return [ 'tiradaMax' => 'Tirada Max', 'tiradaMin' => 'Tirada Min', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)', 'tipo_encuadernacion' => 'Tipo encuardernación', 'servicio_encuadernacion' => 'Servicio encuardernación', 'updatedAt' => 'Actualizado en', diff --git a/ci4/app/Language/es/Tarifaextra.php b/ci4/app/Language/es/Tarifaextra.php index ea711c63..f1263281 100755 --- a/ci4/app/Language/es/Tarifaextra.php +++ b/ci4/app/Language/es/Tarifaextra.php @@ -14,6 +14,7 @@ return [ 'precioMin' => 'Precio Mínimo', 'importeFijo' => 'Importe Fijo', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)', 'margen' => 'Margen', 'tarifaextra' => 'Tarifa Servicios Extra', 'tarifaextraList' => 'Lista Tarifas Servicios Extra', diff --git a/ci4/app/Language/es/Tarifamanipulado.php b/ci4/app/Language/es/Tarifamanipulado.php index 80afab6a..0bd0c413 100755 --- a/ci4/app/Language/es/Tarifamanipulado.php +++ b/ci4/app/Language/es/Tarifamanipulado.php @@ -18,6 +18,7 @@ return [ 'precioMin' => 'Precio T. Máx', 'importeFijo' => 'Importe Fijo', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)', 'tarifamanipulado' => 'Tarifa Manipulado', 'tarifamanipuladoList' => 'Lista Tarifas Manipulado', 'tarifasmanipulado' => 'Tarifas Manipulado', diff --git a/ci4/app/Language/es/Tarifapreimpresion.php b/ci4/app/Language/es/Tarifapreimpresion.php index f98cd490..a1c885dd 100755 --- a/ci4/app/Language/es/Tarifapreimpresion.php +++ b/ci4/app/Language/es/Tarifapreimpresion.php @@ -14,6 +14,7 @@ return [ 'precioMin' => 'Precio Mínimo', 'importeFijo' => 'Importe Fijo', 'mostrar_en_presupuesto' => 'Mostrar en presupuesto', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)', 'margen' => 'Margen', 'tarifapreimpresion' => 'Tarifa Preimpresión', 'tarifapreimpresionList' => 'Lista Tarifas Preimpresión', diff --git a/ci4/app/Models/Configuracion/PapelGenericoModel.php b/ci4/app/Models/Configuracion/PapelGenericoModel.php index 5e235d43..118dadf2 100755 --- a/ci4/app/Models/Configuracion/PapelGenericoModel.php +++ b/ci4/app/Models/Configuracion/PapelGenericoModel.php @@ -22,7 +22,7 @@ class PapelGenericoModel extends \App\Models\BaseModel 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 $useTimestamps = true; @@ -120,25 +120,28 @@ class PapelGenericoModel extends \App\Models\BaseModel { $builder = $this->db ->table($this->table . " t1") - ->select( - "t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot, - t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special" + ->select("t1.id AS id, t1.nombre AS nombre, + t1.code AS code, + 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); return empty($search) ? $builder : $builder - ->groupStart() - ->like("t1.id", $search) - ->orLike("t1.nombre", $search) - ->orLike("t1.code", $search) - ->orLike("t1.code_ot", $search) - ->orLike("t1.id", $search) - ->orLike("t1.nombre", $search) - ->orLike("t1.code", $search) - ->orLike("t1.code_ot", $search) - ->groupEnd(); + ->groupStart() + ->like("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.code", $search) + ->orLike("t1.code_ot", $search) + ->orLike("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.code", $search) + ->orLike("t1.code_ot", $search) + ->groupEnd(); } diff --git a/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php b/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php index 9c9227d0..e345a774 100644 --- a/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php +++ b/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php @@ -26,6 +26,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel "precio_min", "importe_fijo", "mostrar_en_presupuesto", + "mostrar_en_presupuesto_cliente", "acabado_cubierta", "acabado_sobrecubierta", "deleted_at", @@ -86,7 +87,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel { $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.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 diff --git a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php index 3c710108..9cf03991 100755 --- a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php +++ b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php @@ -25,6 +25,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel "code", "comment", "mostrar_en_presupuesto", + "mostrar_en_presupuesto_cliente", "tipo_encuadernacion", "servicio_encuadernacion", "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, 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.por_horas AS por_horas"); diff --git a/ci4/app/Models/Tarifas/TarifaManipuladoModel.php b/ci4/app/Models/Tarifas/TarifaManipuladoModel.php index cd228b7b..19a7ce6d 100755 --- a/ci4/app/Models/Tarifas/TarifaManipuladoModel.php +++ b/ci4/app/Models/Tarifas/TarifaManipuladoModel.php @@ -29,7 +29,8 @@ class TarifaManipuladoModel extends \App\Models\BaseModel "deleted_at", "is_deleted", "user_created_id", - "user_updated_id" + "user_updated_id", + "mostrar_en_presupuesto_cliente" ]; protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity"; @@ -83,7 +84,7 @@ class TarifaManipuladoModel extends \App\Models\BaseModel 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 - ,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 $builder->where("t1.is_deleted", 0); diff --git a/ci4/app/Models/Tarifas/TarifaextraModel.php b/ci4/app/Models/Tarifas/TarifaextraModel.php index 8b1001a1..bfe7a1f1 100755 --- a/ci4/app/Models/Tarifas/TarifaextraModel.php +++ b/ci4/app/Models/Tarifas/TarifaextraModel.php @@ -19,6 +19,7 @@ class TarifaextraModel extends \App\Models\BaseModel "precio", "margen", "mostrar_en_presupuesto", + "mostrar_en_presupuesto_cliente", "deleted_at", "is_deleted", "user_created_id", diff --git a/ci4/app/Models/Tarifas/TarifapreimpresionModel.php b/ci4/app/Models/Tarifas/TarifapreimpresionModel.php index 56ed6999..23f977ee 100755 --- a/ci4/app/Models/Tarifas/TarifapreimpresionModel.php +++ b/ci4/app/Models/Tarifas/TarifapreimpresionModel.php @@ -19,6 +19,7 @@ class TarifapreimpresionModel extends \App\Models\BaseModel "precio", "margen", "mostrar_en_presupuesto", + "mostrar_en_presupuesto_cliente", "deleted_at", "is_deleted", "user_created_id", diff --git a/ci4/app/Services/MessageService.php b/ci4/app/Services/MessageService.php new file mode 100644 index 00000000..3ad4effa --- /dev/null +++ b/ci4/app/Services/MessageService.php @@ -0,0 +1,62 @@ +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; + + } +} diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/_papelGenericoFormItems.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/_papelGenericoFormItems.php index 501b1124..797b136d 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/_papelGenericoFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/_papelGenericoFormItems.php @@ -23,7 +23,15 @@ - +
+
+ + activo == true ? 'checked' : ''; ?>> +
+
diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php index b9b1b815..d347898b 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoForm.php @@ -144,6 +144,7 @@ } }); + endSection() ?> diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoList.php b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoList.php index 8f8e0009..56b043d8 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoList.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/papel/viewPapelGenericoList.php @@ -21,6 +21,7 @@ + @@ -92,13 +93,14 @@ { 'data': 'code_ot' }, { 'data': 'show_in_client' }, { 'data': 'show_in_client_special' }, + { 'data': 'activo' }, { 'data': actionBtns } ] }); theTable.on( 'draw.dt', function () { - const boolCols = [3, 4]; + const boolCols = [3, 4, 5]; for (let coln of boolCols) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { cell.innerHTML = cell.innerHTML == '1' ? '' : ''; diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems.php b/ci4/app/Views/themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems.php index 6ff12438..778f02e4 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems.php @@ -54,7 +54,16 @@
+
+
+
+ +
+
+
+
+ +
+
diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php b/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php index 89f0f498..917cc756 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/encuadernacion/viewTarifaEncuadernacionList.php @@ -19,6 +19,7 @@ + @@ -91,6 +92,7 @@ { 'data': 'nombre' }, { 'data': 'code' }, { 'data': 'mostrar_en_presupuesto' }, + { 'data': 'mostrar_en_presupuesto_cliente' }, { 'data': 'tipo_encuadernacion' }, { 'data': 'servicio_encuadernacion' }, { 'data': actionBtns } @@ -98,7 +100,7 @@ }); theTable.on( 'draw.dt', function () { - const boolCols = [1,2,3, 4]; + const boolCols = [1,2,3,4,5]; for (let coln of boolCols) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { cell.innerHTML = cell.innerHTML == '1' ? '' : ''; diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/extra/_tarifaextraFormItems.php b/ci4/app/Views/themes/vuexy/form/tarifas/extra/_tarifaextraFormItems.php index e655dcd2..622f6cea 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/extra/_tarifaextraFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/extra/_tarifaextraFormItems.php @@ -81,7 +81,19 @@
- +
+
+ mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?> + > + +
+
\ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraForm.php b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraForm.php index 19cea842..66359035 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraForm.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraForm.php @@ -1,6 +1,6 @@ include("themes/_commonPartialsBs/select2bs5") ?> include("themes/_commonPartialsBs/sweetalert") ?> -extend('themes/vuexy/main/defaultlayout') ?> +extend('themes/vuexy/main/defaultlayout')?> section("content") ?>
diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php index 13b5d264..6127547f 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php @@ -1,6 +1,6 @@ include('themes/_commonPartialsBs/datatables') ?> extend('themes/vuexy/main/defaultlayout') ?> -section('content'); ?> +section('content')?>
@@ -20,6 +20,7 @@ + @@ -46,6 +47,9 @@ mostrar_en_presupuesto)==1?'':"" ?> + + mostrar_en_presupuesto_cliente)==1?'':"" ?> + id), "", ['class'=>'text-body', 'data-id'=>$item->id,]); ?> ", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?> diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems.php b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems.php index e048e22b..f57527fc 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems.php @@ -52,7 +52,14 @@
- +
+
+ +
+
\ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php index 8febbc74..f14d33fa 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php @@ -21,6 +21,7 @@ + @@ -91,7 +92,8 @@ { 'data': 'code' }, { 'data': 'precio_min' }, { 'data': 'importe_fijo' }, - { 'data': 'mostrar_en_presupuesto' }, + { 'data': 'mostrar_en_presupuesto',render : (d) => d == true ? '' : "" }, + { 'data': 'mostrar_en_presupuesto_cliente',render : (d) => d == true ? '' : "" }, { 'data': actionBtns } ] }); diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/_tarifapreimpresionFormItems.php b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/_tarifapreimpresionFormItems.php index 2ce1b770..8db87c2a 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/_tarifapreimpresionFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/_tarifapreimpresionFormItems.php @@ -81,6 +81,19 @@ +
+
+ mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?> + > + +
+
\ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionList.php b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionList.php index 3f14ec35..34c1c32f 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/preimpresion/viewTarifapreimpresionList.php @@ -20,6 +20,7 @@ + @@ -45,6 +46,9 @@ mostrar_en_presupuesto)==1?'':"" ?> + + mostrar_en_presupuesto_cliente)==1?'':"" ?> + id), "", ['class'=>'text-body', 'data-id'=>$item->id,]); ?> ", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?> diff --git a/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js b/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js index 97f9bd66..449f9a7c 100644 --- a/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js +++ b/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js @@ -1,37 +1,37 @@ -export const alertConfirmationDelete = (title,type="primary") => { - return Swal.fire({ - title: '¿Está seguro?', - text: "Esta acción es irreversible.", - icon: 'warning', - showCancelButton: true, - confirmButtonColor: '#3085d6', - cancelButtonColor: '#d33', - confirmButtonText: 'Sí', - cancelButtonText: 'Cancelar', - customClass: { - confirmButton: 'btn btn-danger me-1', - cancelButton: 'btn btn-label-secondary' - }, - 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 alertConfirmationDelete = (title, type = "primary") => { + return Swal.fire({ + title: '¿Está seguro?', + text: "Esta acción es irreversible.", + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: 'Sí', + cancelButtonText: 'Cancelar', + customClass: { + confirmButton: 'btn btn-danger me-1', + cancelButton: 'btn btn-label-secondary' + }, + buttonsStyling: false }) } -export const alertWarningMessage = (title,message,type="primary") => { - return Swal.fire({ +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") => { + return Swal.fire({ title: title, text: message, icon: "warning", @@ -40,4 +40,28 @@ export const alertWarningMessage = (title,message,type="primary") => { }, buttonsStyling: false }) +} + +export const toastPresupuestoSummary = (value, target = 'body') => { + return Swal.mixin({ + toast: true, + position: 'bottom-end', + html: ` +
+

Total presupuesto

+ ${value} +
`, + customClass: { + popup: 'bg-primary text-white', + }, + target: target, + height : "100px", + width : "200px", + padding : '1px', + allowEscapeKey: false, + showConfirmButton: false, + timer: 0, + timerProgressBar: false, + stopKeydownPropagation: false, + }) } \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js index e391bbef..58a2d142 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js @@ -1,3 +1,5 @@ +import { toastPresupuestoSummary } from "../../../components/alerts/sweetAlert.js"; + class Resumen { constructor() { @@ -7,7 +9,7 @@ class Resumen { init() { const self = this; - + this.toastPresupuestoTotal = null $(".update-totales").on("change", function () { self.updateTotales(true, true, true) }); @@ -16,6 +18,7 @@ class Resumen { await self.updateTotales(); $(document).trigger('update-totales-completed'); }); + $("#totalDespuesDecuento").on('change',this.updateToastSummary.bind(this)) } cargar(resumen) { @@ -44,7 +47,7 @@ class Resumen { $("#totalAntesDescuento").text(resumen.total_antes_descuento + "€" || "0€"); $("#total_descuentoPercent").val(resumen.total_descuentoPercent || "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€"); $("#factor").text(resumen.total_factor || "0"); $("#factor_ponderado").text(resumen.total_factor_ponderado || "0"); @@ -52,7 +55,7 @@ class Resumen { if (resumen.total_aceptado !== undefined) { $("#totalAceptado").val(resumen.total_aceptado + "€" || "0€"); } - + } update() { @@ -352,6 +355,25 @@ class Resumen { roundToTwoDecimals(num) { 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; \ No newline at end of file