Commit 75ee7094 by David Villalba

Merge branch 'master' into dev_villa

parents 979ffd27 466caa69
ALTER TABLE `ingredients`
ADD COLUMN `desc` varchar(255) NULL AFTER `id`;
...@@ -37,8 +37,7 @@ class Controller_Menussaludables_Menu_Index extends \Controller_App{ ...@@ -37,8 +37,7 @@ class Controller_Menussaludables_Menu_Index extends \Controller_App{
); );
$view->auto_filter(false); $view->auto_filter(false);
$view->name_menu =$view->items->ds;
Log::error(print_r( $view->items,true));
return Response::forge($view); return Response::forge($view);
} }
......
...@@ -13,8 +13,8 @@ use Orm\Model; ...@@ -13,8 +13,8 @@ use Orm\Model;
* @license SETI Consultyn Software License <license.txt> * @license SETI Consultyn Software License <license.txt>
* @link http://seticonsultyn.es * @link http://seticonsultyn.es
*/ */
class Model_Recipe extends Model{ class Model_Recipe extends Model{
use \Trait_InutraliaWS;
protected static $_table_name = 'recipes'; protected static $_table_name = 'recipes';
...@@ -22,12 +22,77 @@ class Model_Recipe extends Model{ ...@@ -22,12 +22,77 @@ class Model_Recipe extends Model{
protected static $_has_many = array( protected static $_has_many = array(
'ingredients' => array( 'ingredients' => array(
'key_from' => 'id', 'key_from' => 'id',
'key_to' => 'recipe_local_id', 'key_to' => 'recipe_local_id',
'model_to' => 'Model_Ingredients', 'model_to' => 'Model_Ingredient',
'cascade_delete' => false 'cascade_delete' => false,
'conditions' => array(
'where' => array('used' => 0),
'order_by' => array('used' => 'DESC'),
'group_by' => 'ingredient_id'
)
), ),
); );
public static function get_recipes_current_week()
{
//Devolvemos recetas guardadas en la base de datos que correspondan a esta vista.
return self::recipes_current_week()->get();
}
public static function recipes_current_week()
{
//Devolvemos recetas guardadas en la base de datos que correspondan a esta vista.
return self::query()->where('week_year', date('W'))->where('year', date('Y'))->where('user_id', \Fuel\Core\Session::get('user_id'));
}
public function load_ingredients()
{
if($this->loaded=='S' || count($this->ingredients)>0 )
{
return false;
}
try
{
\DB::start_transaction();
$recipe = $this->ws_recipe_get($this->recipe_id);
foreach ($recipe->ingredients as $ingredientRecipe)
{
$ingredient = Model_Ingredient::forge();
$ingredient->ingredient_id = $ingredientRecipe->id;
$ingredient->desc = $ingredientRecipe->name;
$ingredient->used = 'N';
$ingredient->created_at = date("Y-m-d H:i:s");
$this->ingredients[] = $ingredient;
}
$this->loaded = 'S';
$this->save(true);
}
catch (Exception $e)
{
Log::error($e->getMessage());
\DB::rollback_transaction();
return false;
}
\DB::commit_transaction();
return $this->ingredients;
}
} }
\ No newline at end of file
...@@ -128,8 +128,8 @@ trait Trait_InutraliaWS { ...@@ -128,8 +128,8 @@ trait Trait_InutraliaWS {
} }
public function ws_recipe_get($id = null){ public function ws_recipe_get($id = null)
{
return $this->ws_get('recipe'.(($id!=null)?"/$id":"")); return $this->ws_get('recipe'.(($id!=null)?"/$id":""));
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
<div class="container mt20" > <div class="container mt20" >
<h2 class="name-menu-saludable">Menú {{ name_menu }}</h2>
<div id="exTab2" class="container"> <div id="exTab2" class="container">
<ul class="nav nav-tabs nav-tabs-menus-saludables"> <ul class="nav nav-tabs nav-tabs-menus-saludables">
<li class="active"> <li class="active">
......
...@@ -913,6 +913,17 @@ a:focus { ...@@ -913,6 +913,17 @@ a:focus {
} }
} }
.name-menu-saludable{
padding-left:20px;
}
@media (max-width:600px){
.name-menu-saludable{
padding-left:20px;
font-size:15px;
}
}
/****************************************************************************************************/ /****************************************************************************************************/
/**********************************MODALS***********************************/ /**********************************MODALS***********************************/
......
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