Commit 9fc79982 by Luis Perez

Merge branch 'master' of http://git.setisl.com/inutraliaapp/2018_web_app

# Conflicts:
#	fuel/app/classes/trait/inutraliaWS.php
parents ec58f02d 05f4c43e
......@@ -48,7 +48,8 @@ class Controller_Listacompra_Index extends \Controller_App{
//Pasar la leyenda para la info funcionamiento de la página
$view->leyenda = "En esta pantalla se han cargado todos los ingredientes necesarios para realizar el menú personalizado que has elegido. Puedes añadir ingredientes nuevos, eliminar algunos o eliminarlos todos. Ten siempre tu lista de la compra a mano. Te damos la posibilidad de hacer la compra a través de la web DelSuper en el supermercado que prefieras en un solo click. Si pulsas en el botón hacer compra en Del Super te redireccionamos a su web con todos estos ingredientes seleccionados.";
//Pasar texto de confirmacion de accion
$view->action = "¿Estás seguro de que quieres borrar los productos de la lista de la compra?";
return Response::forge($view);
}
......
......@@ -68,7 +68,36 @@ class Controller_Recetario_Index extends \Controller_App{
$view->groups_filters = $this->ws_options_get();
$view->recipes = $this->ws_recipe_get();
$inputs = array();
$criterio_options = array();
// Preparamos el array para que lo acepte la API
if(\Input::post('desc') != ""){
$inputs['desc'] = \Input::post('desc');
}
if(!is_null(\Input::post('flags_or'))){
$inputs['flags_or'] = implode(",",\Input::post('flags_or'));
$criterio_options = array_merge($criterio_options,\Input::post('flags_or'));
}
if(!is_null(\Input::post('flags'))){
$inputs['flags'] = implode(",",\Input::post('flags'));
$criterio_options = array_merge($criterio_options,\Input::post('flags'));
}
$view->recipes = $this->ws_recipes_post($inputs);
$view->criterio_desc = \Input::post('desc');
$view->criterio_options = $criterio_options;
return Response::forge($view);
......
......@@ -9,10 +9,23 @@
trait Trait_InutraliaWS {
/**
*
* Guarda el token de usuario en Session necesario para mantenerse logeado.
*
* @param $token_auth
*/
public function save_token_credentials ($token_auth){
\Session::set('token_auth',$token_auth);
}
/**
* Construye la cabecera base para realizar las peticiones al WS de inutralia.
*
* @return array
*/
public function get_header(){
......@@ -124,9 +137,15 @@ trait Trait_InutraliaWS {
return $this->ws_get('options');
}
public function ws_options_post(){
public function ws_recipes_post($data)
{
$data_json = json_encode($data);
$extra_options = array(
CURLOPT_POSTFIELDS => $data_json
);
return json_decode($this->request_generic('options'));
return json_decode($this->request_generic('recipes',"post",1,$extra_options,array('Content-Length: ' . strlen($data_json))));
}
public function ws_get($url)
......
......@@ -40,10 +40,10 @@
<!--botones-->
<div class="row ">
<div class="col-md-6">
<button class="btn btn-custom btn-delete mt20" ><i class="fa fa-trash"></i> Todos</button>
<button class="btn btn-custom btn-delete mt20" data-toggle="modal" data-target="#modalDelete" ><i class="fa fa-trash"></i> Todos</button>
</div>
<div class="col-md-6">
<button class="btn btn-custom btn-delete mt20" ><i class="fa fa-trash"></i> Marcados</button>
<button class="btn btn-custom btn-delete mt20" data-toggle="modal" data-target="#modalDelete"><i class="fa fa-trash"></i> Marcados</button>
</div>
</div>
<a class="btn btn-custom btn-other mt20" data-toggle="modal" data-target="#modalProducto"><i class="fa fa-plus"></i> Productos</a>
......@@ -59,6 +59,8 @@
</div>
<!--modal add producto-->
{% include 'modal_add_product.twig' %}
<!--modal delete-->
{% include 'modals/modal_delete.twig' %}
{% endblock %}
......
<!-- Modal DELETE PRODUCTOS -->
<div class="modal fade" id="modalDelete" tabindex="-1" role="dialog" aria-labelledby="modalDelete">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<div class="text-center">
<img src="assets/img/listacompra/delete.png" class="img-responsive-custom"/>
</div>
<h2 class="text-center">¿BORRAR?</h2>
<div class="content text-center pb40">
{{ action }}
</div>
<div class="modal-footer">
<div class="row">
<div class="col-md-6">
<button type="button" class="btn btn-custom btn-other" data-dismiss="modal">Cancelar</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-custom btn-danger">Sí, borrarlos</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -11,21 +11,31 @@
</div>
<!--contenido desplegable filtros-->
<div class="hidden" id="content-filter-recetario">
<form>
<form action="{{ url('recetario') }}" method="post">
<labe> Nombre de receta </labe>
<input class="form-control" name="desc" value="{{ criterio_desc }}">
<br>
{% for group in groups_filters %}
{# ETIQUETA DEL GRUPO #}
<label style="background-color: gainsboro; width: 100%"> {{ group.name }} </label>
<div class="bg-color-other p10">
<span class="whitecolor"> {{ group.name }} </span>
</div>
<div class="row mt20">
{% for option in group.options %}
<div class="col-md-3">
<div class="col-xs-4 col-sm-2">
<div class="form-group text-center">
<label class="switch" for="switch_filter_{{ group.id~'_'~option.id }}">
<input type="checkbox" id="switch_filter_{{ group.id~'_'~option.id }}" />
<div class="slider round"></div>
<label class="switch-small" for="switch_filter_{{ option.id }}">
<input type="checkbox"
{% if group.id == 1 %} name="flags_or[]" {% else %} name="flags[]"{% endif %}
id="switch_filter_{{ option.id }}"
value="{{ option.id }}"
{% if option.id in criterio_options %} checked {% endif %}
/>
<div class="slider slider-small round"></div>
</label>
<p>{{ option.name }}</p>
<p class="small-text">{{ option.name }}</p>
</div>
</div>
{% endfor %}
......@@ -34,7 +44,7 @@
<div class="row">
<div class="col-md-6 col-md-offset-6">
<button class="btn btn-custom btn-other mt20" > aplicar <i class="fa fa-angle-double-right"></i></button>
<button type="submit" class="btn btn-custom btn-other mt20" > aplicar <i class="fa fa-angle-double-right"></i></button>
</div>
</div>
</form>
......
......@@ -181,6 +181,28 @@ input:checked + .slider:before {
margin-top:10px;
}
/*switches small para filters recetario*/
.switch-small {
display: inline-block;
height: 20px;
position: relative;
width: 50px;
}
.switch-small input {
display:none;
}
.slider-small:before {
background-color: #fff;
bottom: 3px;
content: "";
height: 16px;
left: 4px;
position: absolute;
transition: .4s;
width: 16px;
}
/*END TOGGLE SWITCHES STYLE
*/
......@@ -418,7 +440,10 @@ a:focus {
.pointer:hover{
opacity:0.7;
}
.small-text{
font-size:0.7em;
text-transform: lowercase;
}
/*****************************************************************************/
/**********************************CHECKBOX Y RADIOBUTTON CUSTOM*****************/
/***************************************************************************************/
......@@ -700,6 +725,7 @@ a:focus {
background-size:cover;
height:200px;
width:100%;
background-position:50% 50%;
}
.text-receta-and-articulo-item-list{
......
......@@ -4,11 +4,13 @@ $( document ).ready(function() {
$( "#btn-show-filter-recetario" ).click(function() {
//cerrar filtros
if(show_filter==true){
$("#content-filter-recetario").addClass("hidden");
$("#content-filter-recetario").fadeOut("slow");
// $("#content-filter-recetario").addClass("hidden");
$("#arrow-filters").css('transform', 'rotate(0deg)');
show_filter=false
// abrir filtros
}else{
$("#content-filter-recetario").fadeIn("slow");
$("#content-filter-recetario").removeClass("hidden");
$("#arrow-filters").css('transform', 'rotate(180deg)');
show_filter=true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment