haciendo formulario de editar tarifa envio

This commit is contained in:
Jaime Jimenez
2023-08-30 13:12:38 +02:00
parent ddaac2f9f1
commit 9a781eb6d6
15 changed files with 705 additions and 29 deletions

View File

@ -17,7 +17,7 @@ class TarifaEnvioModel extends \App\Models\GoBaseModel
1 => "t2.nombre",
];
protected $allowedFields = ["pais_id", "nombre"];
protected $allowedFields = ["pais_id", "nombre","deleted_at","is_deleted"];
protected $returnType = "App\Entities\Tarifas\TarifaEnvioEntity";
protected $useTimestamps = true;
@ -76,6 +76,9 @@ class TarifaEnvioModel extends \App\Models\GoBaseModel
$builder = $this->db->table($this->table . " t1")->select("t1.id as id, t1.nombre AS nombre, t2.nombre AS pais_id");
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder

View File

@ -128,6 +128,9 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel
$builder->join("lg_tarifas_envios t2", "t1.tarifa_envio_id = t2.id", "left");
$builder->join("lg_proveedores t3", "t1.proveedor_id = t3.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder

View File

@ -16,11 +16,11 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel
1 => "t1.tarifa_envio_id",
2 => "t1.cp_inicial",
3 => "t1.cp_final",
4 => "t1.inporte_fijo",
4 => "t1.importe_fijo",
5 => "t2.id",
];
protected $allowedFields = ["tarifa_envio_id", "cp_inicial", "cp_final", "inporte_fijo"];
protected $allowedFields = ["tarifa_envio_id", "cp_inicial", "cp_final", "importe_fijo"];
protected $returnType = "App\Entities\Tarifas\TarifaEnvioZonaEntity";
protected $useTimestamps = true;
@ -41,8 +41,8 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel
"label" => "TarifasEnviosZonas.cpInicial",
"rules" => "trim|required|max_length[10]",
],
"inporte_fijo" => [
"label" => "TarifasEnviosZonas.inporteFijo",
"importe_fijo" => [
"label" => "TarifasEnviosZonas.importeFijo",
"rules" => "required|integer",
],
];
@ -56,9 +56,9 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel
"max_length" => "TarifasEnviosZonas.validation.cp_inicial.max_length",
"required" => "TarifasEnviosZonas.validation.cp_inicial.required",
],
"inporte_fijo" => [
"integer" => "TarifasEnviosZonas.validation.inporte_fijo.integer",
"required" => "TarifasEnviosZonas.validation.inporte_fijo.required",
"importe_fijo" => [
"integer" => "TarifasEnviosZonas.validation.importe_fijo.integer",
"required" => "TarifasEnviosZonas.validation.importe_fijo.required",
],
];
@ -95,22 +95,25 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.cp_inicial AS cp_inicial, t1.cp_final AS cp_final, t1.inporte_fijo AS inporte_fijo, t2.id AS tarifa_envio"
"t1.cp_inicial AS cp_inicial, t1.cp_final AS cp_final, t1.importe_fijo AS importe_fijo, t2.id AS tarifa_envio"
);
$builder->join("lg_tarifas_envios t2", "t1.tarifa_envio_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.cp_inicial", $search)
->orLike("t1.cp_final", $search)
->orLike("t1.inporte_fijo", $search)
->orLike("t1.importe_fijo", $search)
->orLike("t2.id", $search)
->orLike("t1.tarifa_envio_id", $search)
->orLike("t1.cp_inicial", $search)
->orLike("t1.cp_final", $search)
->orLike("t1.inporte_fijo", $search)
->orLike("t1.importe_fijo", $search)
->orLike("t2.id", $search)
->groupEnd();
}