public static function filter_node($array, $node, $model, $items, $type = 'admin', $parent_field_join = 'parent_id') { if ($type == 'custom' || $type == 'indicator') { $filters = \Solunes\Master\App\Filter::checkCategory($type)->checkDisplay()->where('category_id', $array['filter_category_id']); } else { $filters = $node->filters()->checkCategory($type)->checkDisplay(); } $filters = $filters->orderBy('order', 'ASC')->get(); $custom_check = \CustomFunc::check_custom_filter($type, $node); if (count($filters) > 0) { $appends = NULL; $array['additional_queries'] = []; /*foreach(request()->all() as $input_key => $input_val){ if(stripos($input_key, 'f_') === false){ $array['additional_queries'][$input_key] = $input_val; } }*/ if (request()->input('search')) { $array['search'] = 1; } $array['filters'] = []; $array['filter_string_options'] = ['none' => trans('master::fields.none'), 'is' => trans('master::fields.is'), 'is_not' => trans('master::fields.is_not'), 'is_greater' => trans('master::fields.is_greater'), 'is_less' => trans('master::fields.is_less'), 'where_in' => trans('master::fields.where_in')]; foreach ($filters as $filter) { $field_name = $filter->parameter; $array['filters'][$field_name] = ['subtype' => $filter->subtype, 'id' => $filter->id]; if ($type == 'custom' || $type == 'indicator') { $node = $filter->node; if ($type == 'custom') { $array['filters'][$field_name]['node_name'] = $node->name; } } if ($custom_check != 'false') { $custom_array = \CustomFunc::custom_filter($custom_check, $array, $items, $appends, $node, $model, $filter, $type, $field_name, $parent_field_join); $array = $custom_array['array']; $appends = $custom_array['appends']; $items = $custom_array['items']; } else { if ($filter->type == 'custom') { $custom_array = \CustomFunc::custom_filter_field($array, $items, $appends, $field_name, $custom_data); $array = $custom_array['array']; $appends = $custom_array['appends']; $items = $custom_array['items']; } else { // Calcular Custom Value $custom_array = \AdminList::filter_custom_value($array, $appends, $node, $filter, $type, $field_name); $array = $custom_array['array']; $appends = $custom_array['appends']; $custom_value = $custom_array['custom_value']; $field = $custom_array['field']; // Obtener items segun tipo $custom_array = \AdminList::filter_items_get($items, $node, $model, $filter, $field, $field_name, $custom_value); $items = $custom_array['items']; $date_model = $custom_array['date_model']; // Corregir campos de fecha $array = \AdminList::filter_date_field($array, $date_model, $filter, $field_name); } } } $array['filter_values'] = $appends; if ($appends) { $appends = 'parameters=' . htmlentities(json_encode($appends)); } $array['appends'] = $appends; } else { $array['appends'] = NULL; $array['filters'] = false; } $array['items'] = $items; return $array; }