diff --git a/ci4/app/Controllers/Configuracion/ConfigErrores.php b/ci4/app/Controllers/Configuracion/ConfigErrores.php index a47eb8b0..fcaade48 100644 --- a/ci4/app/Controllers/Configuracion/ConfigErrores.php +++ b/ci4/app/Controllers/Configuracion/ConfigErrores.php @@ -30,15 +30,24 @@ class ConfigErrores extends BaseResourceController public function index() { + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true] + ]; return view(static::$viewPath . $this->indexRoute, $this->viewData); } public function viewForm(int $error_presupuesto_id) { + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true] + ]; + $this->viewData["error_presupuesto_id"] = $error_presupuesto_id; $this->errorPresupuestoModel->update($error_presupuesto_id, [ "last_user_id" => auth()->user()->id, "visto" => true, ]); - return view(static::$viewPath . 'viewErrorPresupuestoForm', ["error_presupuesto_id" => $error_presupuesto_id]); + return view(static::$viewPath . 'viewErrorPresupuestoForm', $this->viewData); } public function store() { diff --git a/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php b/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php index 2368cb47..37554c8d 100644 --- a/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php +++ b/ci4/app/Entities/Tarifas/Acabados/TarifaAcabadoEntity.php @@ -9,6 +9,7 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity "id" => null, "nombre" => null, "code" => null, + "comment" => null, "precio_min" => 0, "importe_fijo" => 0, "mostrar_en_presupuesto" => 1, @@ -23,6 +24,8 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "precio_min" => "float", + "comment" => "string", + "code" => "string", "importe_fijo" => "float", "user_created_id" => "int", "user_updated_id" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php index 87d18ebe..03d68989 100755 --- a/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEncuadernacionEntity.php @@ -9,6 +9,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity protected $attributes = [ "id" => null, "nombre" => null, + "code" => null, "mostrar_en_presupuesto" => 1, "tipo_encuadernacion" => 0, "servicio_encuadernacion" => 0, @@ -22,6 +23,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "mostrar_en_presupuesto" => "int", + "code" => "string", "tipo_encuadernacion" => "int", "servicio_encuadernacion" => "int", "por_horas" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaEnvioEntity.php b/ci4/app/Entities/Tarifas/TarifaEnvioEntity.php index 0becbc9d..acc68f37 100755 --- a/ci4/app/Entities/Tarifas/TarifaEnvioEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaEnvioEntity.php @@ -9,6 +9,8 @@ class TarifaEnvioEntity extends \CodeIgniter\Entity\Entity "id" => null, "pais_id" => null, "nombre" => null, + "code" => null, + "comment" => null, "user_created_id" => 0, "user_updated_id" => 0, "is_deleted" => 0, @@ -17,6 +19,8 @@ class TarifaEnvioEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "pais_id" => "?int", + "code" => "string", + "comment" => "string", "user_created_id" => "int", "user_updated_id" => "int", "is_deleted" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php index aac261a4..d9f3c2f7 100755 --- a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php @@ -9,6 +9,8 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity protected $attributes = [ "id" => null, "nombre" => null, + "code" => null, + "comment" => null, "precio_min" => 0, "importe_fijo" => 0, "mostrar_en_presupuesto" => 1, @@ -22,6 +24,8 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity protected $casts = [ "precio_min" => "float", "importe_fijo" => "float", + "code" => "string", + "comment" => "string", "mostrar_en_presupuesto" => "int", "user_created_id" => "int", "user_updated_id" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifaextraEntity.php b/ci4/app/Entities/Tarifas/TarifaextraEntity.php index ac6b35eb..db2b0594 100755 --- a/ci4/app/Entities/Tarifas/TarifaextraEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaextraEntity.php @@ -8,6 +8,8 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity protected $attributes = [ "id" => null, "nombre" => null, + "code" => null, + "comment" => null, "precio" => null, "margen" => 0, "mostrar_en_presupuesto" => 1, @@ -20,6 +22,8 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "precio" => "float", + "code" => "string", + "comment" => "string", "margen" => "float", "mostrar_en_presupuesto" => "int", "user_created_id" => "int", diff --git a/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php b/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php index a6ea7177..b1873597 100755 --- a/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php +++ b/ci4/app/Entities/Tarifas/TarifapreimpresionEntity.php @@ -8,6 +8,8 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity protected $attributes = [ "id" => null, "nombre" => null, + "code" => null, + "comment" => null, "precio" => null, "margen" => 0, "mostrar_en_presupuesto" => 1, @@ -21,6 +23,8 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity protected $casts = [ "precio" => "float", "margen" => "float", + "code" => "string", + "comment" => "string", "mostrar_en_presupuesto" => "int", "user_created_id" => "int", "user_update_id" => "int", diff --git a/ci4/app/Language/en/Tarifaacabado.php b/ci4/app/Language/en/Tarifaacabado.php index e9413fab..e527a403 100755 --- a/ci4/app/Language/en/Tarifaacabado.php +++ b/ci4/app/Language/en/Tarifaacabado.php @@ -10,6 +10,9 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Finishing Rates', 'nombre' => 'Name', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'precioMax' => 'Price Max', 'precioMin' => 'Price Min', 'precioMin' => 'Min Price', diff --git a/ci4/app/Language/es/Tarifaencuadernacion.php b/ci4/app/Language/es/Tarifaencuadernacion.php index 34c01087..fbc59ef5 100755 --- a/ci4/app/Language/es/Tarifaencuadernacion.php +++ b/ci4/app/Language/es/Tarifaencuadernacion.php @@ -10,6 +10,9 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Tarifas Encuadernación', 'nombre' => 'Nombre', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'precioMax' => 'Precio T. Mín', 'precioMin' => 'Precio T. Máx', 'importeFijo' => 'Importe Fijo', diff --git a/ci4/app/Language/es/Tarifaextra.php b/ci4/app/Language/es/Tarifaextra.php index 3d640b2b..ea711c63 100755 --- a/ci4/app/Language/es/Tarifaextra.php +++ b/ci4/app/Language/es/Tarifaextra.php @@ -7,6 +7,9 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Tarifas Servicios Extra', 'nombre' => 'Nombre', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'precio' => 'Precio', 'precioMin' => 'Precio Mínimo', 'importeFijo' => 'Importe Fijo', diff --git a/ci4/app/Language/es/Tarifamanipulado.php b/ci4/app/Language/es/Tarifamanipulado.php index 20079ddb..80afab6a 100755 --- a/ci4/app/Language/es/Tarifamanipulado.php +++ b/ci4/app/Language/es/Tarifamanipulado.php @@ -10,6 +10,9 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Tarifas Manipulado', 'nombre' => 'Nombre', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'importeMinimo' => 'Importe mínimo', 'precioMax' => 'Precio T. Mín', 'precioMin' => 'Precio T. Máx', diff --git a/ci4/app/Language/es/Tarifapreimpresion.php b/ci4/app/Language/es/Tarifapreimpresion.php index 80a0562a..f98cd490 100755 --- a/ci4/app/Language/es/Tarifapreimpresion.php +++ b/ci4/app/Language/es/Tarifapreimpresion.php @@ -7,6 +7,9 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Tarifas Preimpresión', 'nombre' => 'Nombre', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'precio' => 'Precio', 'precioMin' => 'Precio Mínimo', 'importeFijo' => 'Importe Fijo', @@ -25,7 +28,16 @@ return [ 'required' => 'El campo {field} es obligatorio.', ], + 'code' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + ], + 'comment' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + + ], 'precio' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'El campo {field} es obligatorio.', diff --git a/ci4/app/Language/es/TarifasEnvios.php b/ci4/app/Language/es/TarifasEnvios.php index 5591a894..db669784 100755 --- a/ci4/app/Language/es/TarifasEnvios.php +++ b/ci4/app/Language/es/TarifasEnvios.php @@ -9,6 +9,9 @@ return [ 'isDeleted' => 'Is Deleted', 'moduleTitle' => 'Tarifas Envíos', 'nombre' => 'Nombre', + 'code' => 'Código', + 'comment' => 'Comentario', + 'comment_placeholder' => 'Inserte un comentario', 'paisId' => 'Pais', 'tarifaEnvio' => 'Tarifa Envío', 'tarifaEnvioList' => 'Lista Tarifas Envío', diff --git a/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php b/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php index eac2ae8b..9c9227d0 100644 --- a/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php +++ b/ci4/app/Models/Tarifas/Acabados/TarifaAcabadoModel.php @@ -22,6 +22,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel protected $allowedFields = [ "nombre", "code", + "comment", "precio_min", "importe_fijo", "mostrar_en_presupuesto", @@ -84,7 +85,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel public function getResource(string $search = "") { $builder = $this->db->table($this->table . " t1")->select( - "t1.id AS id, t1.nombre AS nombre, 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" ); diff --git a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php index f0c50663..b014f83d 100755 --- a/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php +++ b/ci4/app/Models/Tarifas/TarifaEncuadernacionModel.php @@ -22,6 +22,8 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel protected $allowedFields = [ "nombre", + "code", + "comment", "mostrar_en_presupuesto", "tipo_encuadernacion", "servicio_encuadernacion", @@ -65,7 +67,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel */ public function getResource(string $search = "") { - $builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, + $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.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion, t1.por_horas AS por_horas"); diff --git a/ci4/app/Models/Tarifas/TarifaEnvioModel.php b/ci4/app/Models/Tarifas/TarifaEnvioModel.php index 9583d4df..c5348c6e 100755 --- a/ci4/app/Models/Tarifas/TarifaEnvioModel.php +++ b/ci4/app/Models/Tarifas/TarifaEnvioModel.php @@ -1,4 +1,5 @@ "t2.nombre", ]; - protected $allowedFields = ["pais_id", "nombre","deleted_at","is_deleted"]; + protected $allowedFields = ["pais_id", "nombre", "code", "comment", "deleted_at", "is_deleted"]; protected $returnType = "App\Entities\Tarifas\TarifaEnvioEntity"; protected $useTimestamps = true; @@ -73,7 +74,7 @@ class TarifaEnvioModel extends \App\Models\BaseModel */ public function getResource(string $search = "") { - $builder = $this->db->table($this->table . " t1")->select("t1.id as id, t1.nombre AS nombre, t2.nombre AS pais_id"); + $builder = $this->db->table($this->table . " t1")->select("t1.id as id, t1.nombre AS nombre,t1.code AS code, t2.nombre AS pais_id"); $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left"); //JJO @@ -82,43 +83,44 @@ class TarifaEnvioModel extends \App\Models\BaseModel return empty($search) ? $builder : $builder - ->groupStart() - ->like("t1.nombre", $search) - ->orLike("t2.id", $search) - ->orLike("t1.pais_id", $search) - ->orLike("t1.nombre", $search) - ->orLike("t2.nombre", $search) - ->groupEnd(); + ->groupStart() + ->like("t1.nombre", $search) + ->orLike("t2.code", $search) + ->orLike("t2.id", $search) + ->orLike("t1.pais_id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t2.nombre", $search) + ->groupEnd(); } - public function getTarifaEnvio($paisId, string $cp, $peso, $tipo_envio){ + public function getTarifaEnvio($paisId, string $cp, $peso, $tipo_envio) + { // Si el pais es españa se tienen que tener en cuenta los postales // Se busca primero la tarifa a la que corresponde $builder = $this->db->table($this->table . " t1") - ->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo") - ->join("tarifas_envios_zonas t2", "t1.id = t2.tarifa_envio_id") - ->where("t1.pais_id", $paisId) - ->where("t1.is_deleted", 0) - ->where("t2.is_deleted", 0); - - if($paisId == 1) {// España + ->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo") + ->join("tarifas_envios_zonas t2", "t1.id = t2.tarifa_envio_id") + ->where("t1.pais_id", $paisId) + ->where("t1.is_deleted", 0) + ->where("t2.is_deleted", 0); + + if ($paisId == 1) { // España $builder->where("CAST(t2.cp_inicial AS UNSIGNED)<=", intval($cp)) - ->where("CAST(t2.cp_final AS UNSIGNED) >=", intval($cp)); + ->where("CAST(t2.cp_final AS UNSIGNED) >=", intval($cp)); } $tarifas = $builder->get()->getResultObject(); $resultado = []; - + $model = model('App\Models\Tarifas\TarifaEnvioPrecioModel'); - foreach($tarifas as $tarifa){ + foreach ($tarifas as $tarifa) { $precio_tarifas = $model->getEnvioPrecio($tarifa->tarifa_envio_id, $peso, $tipo_envio); - foreach($precio_tarifas as $precio_tarifa){ + foreach ($precio_tarifas as $precio_tarifa) { $precio_tarifa->importe_fijo = $tarifa->importe_fijo; array_push($resultado, $precio_tarifa); } } return $resultado; - } } diff --git a/ci4/app/Models/Tarifas/TarifaManipuladoModel.php b/ci4/app/Models/Tarifas/TarifaManipuladoModel.php index 9a4aefd4..7783d480 100755 --- a/ci4/app/Models/Tarifas/TarifaManipuladoModel.php +++ b/ci4/app/Models/Tarifas/TarifaManipuladoModel.php @@ -22,6 +22,8 @@ class TarifaManipuladoModel extends \App\Models\BaseModel protected $allowedFields = [ "nombre", "precio_min", + "code", + "comment", "importe_fijo", "mostrar_en_presupuesto", "deleted_at", @@ -80,7 +82,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.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"); //JJO diff --git a/ci4/app/Models/Tarifas/TarifaextraModel.php b/ci4/app/Models/Tarifas/TarifaextraModel.php index 10ec5dd8..8b1001a1 100755 --- a/ci4/app/Models/Tarifas/TarifaextraModel.php +++ b/ci4/app/Models/Tarifas/TarifaextraModel.php @@ -13,7 +13,9 @@ class TarifaextraModel extends \App\Models\BaseModel protected $useAutoIncrement = true; protected $allowedFields = [ - "nombre", + "nombre", + "code", + "comment", "precio", "margen", "mostrar_en_presupuesto", diff --git a/ci4/app/Models/Tarifas/TarifapreimpresionModel.php b/ci4/app/Models/Tarifas/TarifapreimpresionModel.php index 6bb1391f..56ed6999 100755 --- a/ci4/app/Models/Tarifas/TarifapreimpresionModel.php +++ b/ci4/app/Models/Tarifas/TarifapreimpresionModel.php @@ -13,7 +13,9 @@ class TarifapreimpresionModel extends \App\Models\BaseModel protected $useAutoIncrement = true; protected $allowedFields = [ - "nombre", + "nombre", + "code", + "comment", "precio", "margen", "mostrar_en_presupuesto", @@ -37,6 +39,14 @@ class TarifapreimpresionModel extends \App\Models\BaseModel "label" => "Tarifapreimpresion.nombre", "rules" => "trim|required|max_length[255]", ], + "code" => [ + "label" => "Tarifapreimpresion.code", + "rules" => "trim|required|max_length[5]", + ], + "comment" => [ + "label" => "Tarifapreimpresion.comment", + "rules" => "trim|max_length[255]", + ], "precio" => [ "label" => "Tarifapreimpresion.precio", "rules" => "required|decimal", @@ -52,6 +62,14 @@ class TarifapreimpresionModel extends \App\Models\BaseModel "max_length" => "Tarifapreimpresion.validation.nombre.max_length", "required" => "Tarifapreimpresion.validation.nombre.required", ], + "code" => [ + "max_length" => "Tarifapreimpresion.validation.code.max_length", + "required" => "Tarifapreimpresion.validation.code.required", + ], + "comment" => [ + "max_length" => "Tarifapreimpresion.validation.comment.max_length", + "required" => "Tarifapreimpresion.validation.comment.required", + ], "precio" => [ "decimal" => "Tarifapreimpresion.validation.precio.decimal", "required" => "Tarifapreimpresion.validation.precio.required", diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php index b0f2a90d..dfb2abfc 100644 --- a/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php +++ b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php @@ -25,7 +25,8 @@