trabajando en editar plantillas

This commit is contained in:
2024-12-04 12:34:10 +01:00
parent 3fb37af0f8
commit a7cda851f0
15 changed files with 1024 additions and 520 deletions

View File

@ -7,7 +7,8 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
protected $table = "cliente_plantilla_precios";
const SORTABLE = [
0 => "t1.nombre",
0 => "t1.id",
1 => "t1.nombre",
];
/**
@ -48,11 +49,11 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
/**
* Get resource data.
*
* @param string $search
* @param array $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "", $cliente_id = -1)
public function getResource($search = [])
{
$builder = $this->db
->table($this->table . " t1")
@ -61,14 +62,17 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
);
$builder->where('t1.is_deleted', 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->groupEnd();
if (empty($search))
return $builder;
else {
$builder->groupStart();
foreach ($search as $col_search) {
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
}
$builder->groupEnd();
return $builder;
}
}
}