mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
arraglado fallo en buscador cuando se limpia, orden precios y replace de , a .
This commit is contained in:
@ -8,6 +8,7 @@ use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
||||
use App\Models\Compras\ProveedorModel;
|
||||
use App\Models\Compras\ProveedorTipoModel;
|
||||
|
||||
|
||||
class TarifaAcabados extends BaseResourceController
|
||||
{
|
||||
|
||||
@ -220,9 +221,9 @@ class TarifaAcabados extends BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['tarifaacabadoEntity'] = $tarifaacabadoEntity;
|
||||
$this->viewData['proveedores'] = $this->getProveedores();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateTarifaAcabado', $id);
|
||||
$this->viewData['proveedores'] = $this->getProveedores();
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tarifaacabado.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ class TarifaAcabadosLineas extends \App\Controllers\BaseResourceController
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues, $id_TA)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
$query = $this->model->db->getLastQuery();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
|
||||
@ -6,7 +6,7 @@ return [
|
||||
'id' => 'ID',
|
||||
'moduleTitle' => 'Tarifa Acabado Líneas',
|
||||
'deleteLine' => 'el registro seleccionado',
|
||||
'proveedor' => 'Proveedor',
|
||||
'proveedor' => 'Proveedor',
|
||||
'precioMax' => 'Precio T. Mín',
|
||||
'precioMin' => 'Precio T. Máx',
|
||||
'precioUnidad' => 'Precio Unidad',
|
||||
|
||||
@ -18,9 +18,9 @@ class TarifaAcabadoLineaModel extends \App\Models\BaseModel
|
||||
const SORTABLE = [
|
||||
0 => "t3.nombre",
|
||||
1 => "t1.tirada_min",
|
||||
2 => "t1.precio_min",
|
||||
2 => "t1.precio_max",
|
||||
3 => "t1.tirada_max",
|
||||
4 => "t1.precio_max",
|
||||
4 => "t1.precio_min",
|
||||
5 => "t1.margen",
|
||||
];
|
||||
|
||||
@ -150,33 +150,57 @@ class TarifaAcabadoLineaModel extends \App\Models\BaseModel
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
$filterEnabled = 0;
|
||||
|
||||
foreach ($search as $col_search) {
|
||||
if($col_search[0] != 0){
|
||||
$values = explode(",",$col_search[2]);
|
||||
$min_val = floatval($values[0]);
|
||||
$max_val = floatval($values[1]);
|
||||
if(!is_nan($min_val) && !is_null($min_val) && strlen($values[0]) > 0){
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . " >=", $min_val);
|
||||
}
|
||||
if(!is_nan($max_val) && !is_null($max_val) && strlen($values[1]) > 0){
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . " <", $max_val);
|
||||
if(strlen($col_search[2]) > 1){
|
||||
$values = explode(",",$col_search[2]);
|
||||
$min_val = floatval($values[0]);
|
||||
$max_val = floatval($values[1]);
|
||||
if(!is_nan($min_val) && !is_null($min_val) && strlen($values[0]) > 0){
|
||||
if($filterEnabled == 0){
|
||||
$builder->groupStart();
|
||||
$filterEnabled = 1;
|
||||
}
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . " >=", $min_val);
|
||||
}
|
||||
if(!is_nan($max_val) && !is_null($max_val) && strlen($values[1]) > 0){
|
||||
if($filterEnabled == 0){
|
||||
$builder->groupStart();
|
||||
$filterEnabled = 1;
|
||||
}
|
||||
$builder->where(self::SORTABLE[$col_search[0]] . " <", $max_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$values = explode(",",$col_search[2]);
|
||||
if(count($values) > 1){
|
||||
foreach ($values as $value) {
|
||||
$builder->orWhere("t1.proveedor_id", $value);
|
||||
if(strlen($col_search[2]) > 1){
|
||||
$values = explode(",",$col_search[2]);
|
||||
if(count($values) > 1){
|
||||
foreach ($values as $value) {
|
||||
if($filterEnabled == 0){
|
||||
$builder->groupStart();
|
||||
$filterEnabled = 1;
|
||||
}
|
||||
$builder->orWhere("t1.proveedor_id", $value);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($filterEnabled == 0){
|
||||
$builder->groupStart();
|
||||
$filterEnabled = 1;
|
||||
}
|
||||
$builder->where("t1.proveedor_id", $col_search[2]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$builder->where("t1.proveedor_id", $col_search[2]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$builder->groupEnd();
|
||||
if($filterEnabled == 1){
|
||||
$builder->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
@ -208,8 +208,8 @@
|
||||
|
||||
|
||||
$('input', this).on('change clear', function () {
|
||||
var minInputValue = parseFloat($(`#min_${title}`).val()) || "";
|
||||
var maxInputValue = parseFloat($(`#max_${title}`).val()) || "";
|
||||
var minInputValue = parseFloat($(`#min_${title}`).val().replace(',','.')) || "";
|
||||
var maxInputValue = parseFloat($(`#max_${title}`).val().replace(',','.')) || "";
|
||||
|
||||
|
||||
if (theTable.column(i).search() !== [minInputValue,maxInputValue]) {
|
||||
|
||||
Reference in New Issue
Block a user