From 1af261eff9be6db8408cf17f6dd9a526e3dd112d Mon Sep 17 00:00:00 2001 From: amazuecos Date: Thu, 20 Feb 2025 08:24:01 +0100 Subject: [PATCH] add mostrar_presupuesto_cliente field in tarifas extra y preimpresion --- ci4/app/Controllers/Tarifas/Tarifaextra.php | 8 +++-- .../Tarifas/Tarifapreimpresion.php | 8 +++-- ...resionCheckPresupuestoClienteMigration.php | 30 +++++++++++++++++++ .../Entities/Tarifas/TarifaextraEntity.php | 2 ++ .../Tarifas/TarifapreimpresionEntity.php | 2 ++ ci4/app/Language/es/Tarifaextra.php | 1 + ci4/app/Language/es/Tarifapreimpresion.php | 1 + ci4/app/Models/Tarifas/TarifaextraModel.php | 1 + .../Tarifas/TarifapreimpresionModel.php | 1 + .../tarifas/extra/_tarifaextraFormItems.php | 14 ++++++++- .../tarifas/extra/viewTarifaextraList.php | 4 +++ .../manipulado/viewTarifaManipuladoList.php | 4 +-- .../_tarifapreimpresionFormItems.php | 13 ++++++++ .../viewTarifapreimpresionList.php | 4 +++ 14 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 ci4/app/Database/Migrations/2025-02-20-080000_AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration.php 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-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/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/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/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/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/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/viewTarifaextraList.php b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php index 2f9a4c7c..6127547f 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/extra/viewTarifaextraList.php @@ -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/viewTarifaManipuladoList.php b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php index a99b9925..f14d33fa 100644 --- a/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php +++ b/ci4/app/Views/themes/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php @@ -92,8 +92,8 @@ { 'data': 'code' }, { 'data': 'precio_min' }, { 'data': 'importe_fijo' }, - { 'data': 'mostrar_en_presupuesto' }, - { 'data': 'mostrar_en_presupuesto_cliente' }, + { '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']); ?>