Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
a0eeaf43
Commit
a0eeaf43
authored
Sep 18, 2018
by
Mat
Browse files
Page qui résume les commandes de l'utilisateur
parent
6c6e9051
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Controller/MembreController.php
View file @
a0eeaf43
...
...
@@ -285,10 +285,20 @@ class MembreController extends MasterController
*/
public
function
resumeAction
()
{
return
$this
->
render
(
'PotageBundle:Membre:resume.html.twig'
,
array
(
));
$user
=
$this
->
getUser
();
if
(
$user
!==
null
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$commandes
=
$em
->
getRepository
(
'PotageBundle:Commande'
)
->
findAllCurrentByUser
(
$user
->
getId
());
return
$this
->
render
(
'PotageBundle:Membre:resume.html.twig'
,
array
(
'commandes'
=>
$commandes
));
}
}
}
src/PotageBundle/Repository/CommandeRepository.php
View file @
a0eeaf43
...
...
@@ -10,4 +10,20 @@ namespace PotageBundle\Repository;
*/
class
CommandeRepository
extends
\
Doctrine\ORM\EntityRepository
{
/**
* Toutes les commandes d'un utilisateur
* TODO introduire un status sur les commandes
*
* @param $id
* @return array
*/
public
function
findAllCurrentByUser
(
$id
)
{
$qb
=
$this
->
createQueryBuilder
(
'c'
)
->
where
(
'c.user = :id'
)
->
setParameter
(
':id'
,
$id
)
->
orderBy
(
'c.createdAt'
,
'DESC'
);
return
$qb
->
getQuery
()
->
getResult
();
}
}
src/PotageBundle/Resources/views/Default/navbar.html.twig
View file @
a0eeaf43
...
...
@@ -96,6 +96,10 @@
<a
href=
"
{{
path
(
'fos_user_profile_show'
)
}}
"
class=
"dropdown-item"
>
Mon profil
</a>
<a
href=
"
{{
path
(
'potage_resume'
)
}}
"
class=
"dropdown-item"
>
Mes commandes
</a>
<div
class=
"dropdown-divider"
></div>
<a
href=
"
{{
path
(
'fos_user_security_logout'
)
}}
"
class=
"dropdown-item"
>
{{
'layout.logout'
|
trans
(
{}
,
'FOSUserBundle'
)
}}
...
...
src/PotageBundle/Resources/views/Membre/resume.html.twig
View file @
a0eeaf43
...
...
@@ -11,18 +11,31 @@
<div
class=
"col-md-10 offset-md-1 bloc"
>
<div
class=
"row"
>
{%
for
label
,
messages
in
app.flashes
()
%}
{%
for
message
in
messages
%}
<div
class=
"alert alert-
{{
label
}}
"
role=
"alert"
>
{{
message
}}
</div>
{%
endfor
%}
{%
for
label
,
messages
in
app.flashes
()
%}
{%
for
message
in
messages
%}
<div
class=
"alert alert-
{{
label
}}
"
role=
"alert"
>
{{
message
}}
</div>
{%
endfor
%}
{%
endfor
%}
<h1>
Commandes en cours
</h1>
<ul>
<li>
<a
href=
"
{{
path
(
'potage_today'
)
}}
"
>
Passer une nouvelle commande
</a>
</li>
{%
for
commande
in
commandes
%}
<li>
<a
href=
"#"
>
Commande n°
{{
commande.id
}}
</a>
,
<small>
enregistrée le
{{
commande.createdAt
|
date
(
'd/m/Y, à H:i:s'
)
}}
(→ offre
{{
commande.offre.reference
}}
)
</small>
</li>
{%
endfor
%}
</ul>
<
/div
>
<
h1>
Historique des commandes
</h1
>
{#
<div class="row ">
...
...
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