Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
2018_web_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
inutralia
2018_web_app
Commits
246daf5a
Commit
246daf5a
authored
Dec 11, 2018
by
Luis Perez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lista de la compra con borrado de datos.
parent
5388e281
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
4 deletions
+68
-4
index.php
fuel/app/classes/controller/listacompra/index.php
+28
-0
index.php
fuel/app/classes/controller/menupersonalizado/index.php
+1
-1
ingredient.php
fuel/app/classes/model/ingredient.php
+1
-1
recipe.php
fuel/app/classes/model/recipe.php
+1
-1
routes.php
fuel/app/config/routes.php
+1
-0
index.twig
fuel/app/views/listacompra/index.twig
+5
-1
modal_delete.twig
fuel/app/views/listacompra/modal_delete.twig
+0
-0
modal_delete_all.twig
fuel/app/views/listacompra/modal_delete_all.twig
+31
-0
No files found.
fuel/app/classes/controller/listacompra/index.php
View file @
246daf5a
...
@@ -67,4 +67,31 @@ class Controller_Listacompra_Index extends \Controller_App{
...
@@ -67,4 +67,31 @@ class Controller_Listacompra_Index extends \Controller_App{
return
Response
::
forge
(
$view
);
return
Response
::
forge
(
$view
);
}
}
public
function
get_delete_all
()
{
$recipes
=
Model_Recipe
::
get_recipes_current_week
();
foreach
(
$recipes
as
$recipe
)
{
Log
::
error
(
"ENTRO EN RECETAS!!!"
);
foreach
(
$recipe
->
ingredients
as
$ingrediente
)
{
Log
::
error
(
"INTENTO BORRAR INGREDIENTE!!!
$ingrediente->id
"
);
$ingrediente
->
delete
();
}
}
Session
::
set_flash
(
'success'
,
"Se han borrado los ingredientes correctamente"
);
return
Response
::
redirect_back
();
}
public
function
post_delete_ingredients
()
{
$ingredients
=
Input
::
post
(
'ingredients_ids'
);
foreach
(
$ingredients
as
$ingredient
)
{
$ingredient
->
delete
();
}
}
}
}
\ No newline at end of file
fuel/app/classes/controller/menupersonalizado/index.php
View file @
246daf5a
...
@@ -45,7 +45,7 @@ class Controller_Menupersonalizado_Index extends \Controller_App{
...
@@ -45,7 +45,7 @@ class Controller_Menupersonalizado_Index extends \Controller_App{
foreach
(
\Input
::
post
(
'input'
)
as
$item
){
foreach
(
\Input
::
post
(
'input'
)
as
$item
){
array_push
(
$ids_recipes_selected
,
$
this
[
'recipe_id'
]);
array_push
(
$ids_recipes_selected
,
$
item
[
'recipe_id'
]);
$conditions
=
array
(
$conditions
=
array
(
'user_id'
=>
\Session
::
get
(
'user_id'
),
'user_id'
=>
\Session
::
get
(
'user_id'
),
...
...
fuel/app/classes/model/ingredient.php
View file @
246daf5a
...
@@ -22,7 +22,7 @@ class Model_Ingredient extends Model{
...
@@ -22,7 +22,7 @@ class Model_Ingredient extends Model{
protected
static
$_belongs_to
=
array
(
protected
static
$_belongs_to
=
array
(
'recipe'
=>
array
(
'recipe'
=>
array
(
'key_from'
=>
'recipe_local_
o
d'
,
'key_from'
=>
'recipe_local_
i
d'
,
'key_to'
=>
'id'
,
'key_to'
=>
'id'
,
'model_to'
=>
'Model_Recipe'
,
'model_to'
=>
'Model_Recipe'
,
'cascade_delete'
=>
false
'cascade_delete'
=>
false
...
...
fuel/app/classes/model/recipe.php
View file @
246daf5a
...
@@ -27,7 +27,7 @@ class Model_Recipe extends Model{
...
@@ -27,7 +27,7 @@ class Model_Recipe extends Model{
'model_to'
=>
'Model_Ingredient'
,
'model_to'
=>
'Model_Ingredient'
,
'cascade_delete'
=>
false
,
'cascade_delete'
=>
false
,
'conditions'
=>
array
(
'conditions'
=>
array
(
'where'
=>
array
(
'used'
=>
0
),
'where'
=>
array
(
'used'
=>
'N'
),
'order_by'
=>
array
(
'used'
=>
'DESC'
),
'order_by'
=>
array
(
'used'
=>
'DESC'
),
'group_by'
=>
'ingredient_id'
'group_by'
=>
'ingredient_id'
)
)
...
...
fuel/app/config/routes.php
View file @
246daf5a
...
@@ -53,6 +53,7 @@ return array(
...
@@ -53,6 +53,7 @@ return array(
'articulo-detalle'
=>
'articulo/index'
,
'articulo-detalle'
=>
'articulo/index'
,
'lista-compra'
=>
'listacompra/index'
,
'lista-compra'
=>
'listacompra/index'
,
'lista-compra/delete_all'
=>
'listacompra/index/delete_all'
,
...
...
fuel/app/views/listacompra/index.twig
View file @
246daf5a
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
<div
class=
"container-box-border-box"
>
<div
class=
"container-box-border-box"
>
<form
class=
"ac-custom ac-checkbox"
autocomplete=
"off"
>
<form
class=
"ac-custom ac-checkbox"
autocomplete=
"off"
>
<ul
class=
"text-left ml0"
>
<ul
class=
"text-left ml0"
>
{%
if
count
(
ingredients
)
==
0
%}
<h4>
Sin Ingredientes
</h4>
{%
endif
%}
{%
for
i
in
ingredients
%}
{%
for
i
in
ingredients
%}
<li>
<input
id=
"check_
{{
i.id
}}
"
name=
"check_
{{
i.id
}}
"
type=
"checkbox"
checked=
"true"
/><label
for=
"check_
{{
i.id
}}
"
>
{{
i.desc
}}
</label></li>
<li>
<input
id=
"check_
{{
i.id
}}
"
name=
"check_
{{
i.id
}}
"
type=
"checkbox"
checked=
"true"
/><label
for=
"check_
{{
i.id
}}
"
>
{{
i.desc
}}
</label></li>
{%
endfor
%}
{%
endfor
%}
...
@@ -60,7 +63,8 @@
...
@@ -60,7 +63,8 @@
<!--modal add producto-->
<!--modal add producto-->
{%
include
'modal_add_product.twig'
%}
{%
include
'modal_add_product.twig'
%}
<!--modal delete-->
<!--modal delete-->
{%
include
'modals/modal_delete.twig'
%}
{%
include
'modal_delete_all.twig'
%}
{%
include
'modal_delete.twig'
%}
{%
endblock
%}
{%
endblock
%}
...
...
fuel/app/views/
modals
/modal_delete.twig
→
fuel/app/views/
listacompra
/modal_delete.twig
View file @
246daf5a
File moved
fuel/app/views/listacompra/modal_delete_all.twig
0 → 100644
View file @
246daf5a
<!-- 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"
>
×
</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"
>
<a
href=
"lista-compra/delete_all"
type=
"button"
class=
"btn btn-custom btn-danger"
>
Sí, borrarlos
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment