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
290718c3
Commit
290718c3
authored
Dec 11, 2018
by
Luis Perez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actualizaciones listra de la compra
parent
6eea228d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
4 deletions
+69
-4
index.php
fuel/app/classes/controller/listacompra/index.php
+6
-1
routes.php
fuel/app/config/routes.php
+1
-0
index.twig
fuel/app/views/listacompra/index.twig
+2
-2
modal_delete.twig
fuel/app/views/listacompra/modal_delete.twig
+1
-1
index.js
public/assets/js/listacompra/index.js
+59
-0
No files found.
fuel/app/classes/controller/listacompra/index.php
View file @
290718c3
...
...
@@ -22,7 +22,12 @@ class Controller_Listacompra_Index extends \Controller_App{
public
function
before
()
{
$recipes
=
Model_Recipe
::
get_recipes_current_week
();
//Se cargan funciones de javascript especificas de esta funcionalidad
Casset
::
js
(
'listacompra/index.js'
);
$recipes
=
Model_Recipe
::
get_recipes_current_week
();
//PEDIR INGREDIENTES
//Recorremos las recetas para obtener los ingredientes.
...
...
fuel/app/config/routes.php
View file @
290718c3
...
...
@@ -54,6 +54,7 @@ return array(
'lista-compra'
=>
'listacompra/index'
,
'lista-compra/delete_all'
=>
'listacompra/index/delete_all'
,
'lista-compra/delete'
=>
'listacompra/index/delete_ingredients'
,
...
...
fuel/app/views/listacompra/index.twig
View file @
290718c3
...
...
@@ -25,13 +25,13 @@
</div>
<div
class=
"container-box-border-box"
>
<form
class=
"ac-custom ac-check
box
"
autocomplete=
"off"
>
<form
class=
"ac-custom ac-check
mark
"
autocomplete=
"off"
>
<ul
class=
"text-left ml0"
>
{%
if
count
(
ingredients
)
==
0
%}
<h4>
Sin Ingredientes
</h4>
{%
endif
%}
{%
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"
rel=
"
{{
i.id
}}
"
/><label
for=
"check_
{{
i.id
}}
"
>
{{
i.desc
}}
</label></li>
{%
endfor
%}
</ul>
</form>
...
...
fuel/app/views/listacompra/modal_delete.twig
View file @
290718c3
...
...
@@ -20,7 +20,7 @@
<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>
<button
type=
"button"
class=
"btn btn-custom btn-danger
btn-delete-checked
"
>
Sí, borrarlos
</button>
</div>
</div>
</div>
...
...
public/assets/js/listacompra/index.js
0 → 100644
View file @
290718c3
var
ids
=
[];
$
(
document
).
ready
(
function
()
{
$
(
':input:checked'
).
each
(
function
()
{
ids
+=
$
(
this
).
attr
(
'rel'
);
})
$
(
'.btn-lista-compra'
).
on
(
'click'
,
function
(
e
)
{
get_checkeds
();
window
.
location
.
href
=
'http://www.delsuper.es/inutralia?ids='
+
ids
.
toString
()
})
$
(
'.btn-delete-checked'
).
on
(
'click'
,
function
(
e
)
{
get_checkeds
();
$
.
ajax
({
url
:
"listacompra/delete"
,
type
:
"POST"
,
method
:
"post"
,
data
:
{
id
:
$
(
'#profile_id'
).
val
(),
inputs
:
inputs
},
success
:
function
(
data
)
{
if
(
data
!=
""
&&
data
!=
0
){
// Modal success
$
(
'#modalSuccess'
).
modal
(
'show'
);
}
else
{
// Modal error
}
setTimeout
(
function
(){
location
.
reload
();
},
2000
);
}
})
})
});
function
get_checkeds
()
{
$
(
':input:checked'
).
each
(
function
()
{
let
id_val
=
$
(
this
).
attr
(
'rel'
);
if
(
jQuery
.
inArray
(
id_val
,
ids
)
<
0
)
{
ids
.
push
(
id_val
);
}
});
}
\ 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