Skip to content

Commit

Permalink
Merge pull request #112 from WildCodeSchool/titles
Browse files Browse the repository at this point in the history
Titles
  • Loading branch information
typhained authored May 15, 2020
2 parents 574e479 + 53d4287 commit e3f8476
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 9 deletions.
29 changes: 29 additions & 0 deletions src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,35 @@ public function show(int $id)
}
}

public function showAd($id)
{
if ($_SESSION["role"] == "admin") {
$userManager = new UserManager();
$cartManager = new CartManager();

$user = $userManager->selectOneById($id);
$cartid = $cartManager->historiqueID($id);
if ($cartid) {
$cartid = $cartid['id'];
$cart = $cartManager->showCartContent($cartid);
$concepts = $cartManager->conceptInCart($cartid);
$recap = $cartManager->showPriceCart($cartid);
return $this->twig->render('User/showAdmin.html.twig', [
'user' => $user,
"cart" => $cart,
"concepts"=>$concepts,
"recap"=>$recap,
]);
} else {
return $this->twig->render('User/showAdmin.html.twig', [
'user' => $user,
]);
}
} else {
header('location:/Account/login/');
}
}

/**
* @param int $id
*/
Expand Down
4 changes: 4 additions & 0 deletions src/View/Account/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% extends 'layoutp.html.twig' %}

{% block title %}
{{ parent() }} Connexion
{% endblock %}

{% block content %}
<section class="uk-container uk-padding-large" id="login">
<form action="" class="uk-margin uk-width-large uk-margin-auto uk-card uk-card-default uk-card-body uk-box-shadow-large" method="post">
Expand Down
2 changes: 1 addition & 1 deletion src/View/Bouquet/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'layout.html.twig' %}
{% block title %}
{{ parent() }} Bouquet
{{ parent() }} Bouquets
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/View/Bouquet/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div>
<div class="uk-card-body">
<h3 class="uk-card-title">Fiche produit bouquet</h3>
<h3 class="uk-card-title">Fiche produit du bouquet</h3>
<ul>
<li class="uk-margin">Nom : {{ bouquet.nom }}</li>
<li class="uk-margin">Prix : {{ bouquet.prix }} €</li>
Expand Down
2 changes: 1 addition & 1 deletion src/View/Front/bouquets.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'layoutp.html.twig' %}
{% block title %}
{{ parent()}} Accueil
{{ parent()}} Bouquets
{% endblock %}
{% block content %}
{% if bouquets == null %}
Expand Down
2 changes: 1 addition & 1 deletion src/View/Galerie/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'layout.html.twig' %}
{% block title %}
{{ parent() }} Bouquet
{{ parent() }} Galerie
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/View/Layout/navbarAdmin.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nav id="navbar">
<ul id="admin">
<li><a href="/Home/index/"><span uk-icon="home"></span> Accueil</a></li>
<li><a href="/Bouquet/index"><span uk-icon="lifesaver"></span> Bouquet</a></li>
<li><a href="/Bouquet/index"><span uk-icon="lifesaver"></span> Bouquets</a></li>
<li><a href="/CatalogueU/index"><span uk-icon="thumbnails"></span> Catalogue Unitaire</a></li>
<li><a href="/User/index"><span uk-icon="users"></span> Utilisateurs</a></li>
<li><a href="/Galerie/index"><span uk-icon="image"></span> Galerie</a></li>
Expand Down
8 changes: 4 additions & 4 deletions src/View/User/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<th>Prénom</th>
<th>Mail</th>
<th>Téléphone</th>
<th>Dernière commande</th>
<th class="uk-table-expand"></th>
<th class="uk-table-expand">Actions</th>
</thead>
<tbody>

Expand All @@ -42,8 +41,9 @@
<td>{{ user.firstname }}</td>
<td>{{ user.mail }}</td>
<td>{{ user.num_Tel }}
<td class="uk-table-expand">{{ user.historique }}</td>
<td><a href="/User/update/{{ user.id }}"><span uk-icon="pencil"></span></a>
<td>
<a href="/User/showAd/{{user.id}}"><span uk-icon="info"></span></a>
<a href="/User/update/{{ user.id }}"><span uk-icon="pencil"></span></a>
<a href="#modal-example-{{ user.id }}" uk-toggle><span uk-icon="trash"></span></a>
</td>
</tr>
Expand Down
68 changes: 68 additions & 0 deletions src/View/User/showAdmin.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% extends 'layout.html.twig' %}
{% block title %}
{{ parent()}} Profil
{% endblock %}
{% block content %}
<div class="uk-container uk-margin-top">
<h3 class="uk-text-center">Profil de {{ user.firstname }} {{ user.lastname }}</h3>
<div class="uk-card uk-card-default uk-width-1-1@m">
<div class="uk-card-header uk-background-muted">
<div class="uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-width-expand">
<p class="uk-text-meta uk-margin-remove-top">Adresse mail: {{ user.mail }}</p>
<p class="uk-text-meta uk-margin-remove-top">Numéro de téléphone: {{ user.num_Tel }}</p>

</div>
</div>
</div>
<div class="uk-card-body">
<h3>Commande la plus récente </h3>
<table class="uk-table ">
{% if recap == null %}
<tr> Aucune commande récente </tr>
{% else %}

<thead class="uk-background-muted">
<tr>
<th>DATE</th>
<th>PRIX</th>
</tr>
</thead>
<tr>
<td>{{ recap.date }}</td>
<td>{{ recap.prix_total }}</td>
</tr>
<tr>
<th colspan="2" class="uk-background-muted">CONTENU</th>
</tr>
{% for item in cart %}
<tr>
<td>{{ item.quantite }} * {{ item.nom }}</td>
</tr>
{% endfor %}
{% if concepts != null %}
<tr>
<th colspan="2" class="uk-text-center">Bouquet personnalisé</th>
</tr>
{% for concept in concepts %}

<tr>
<td class="uk-text-center">1</td>
<td class="uk-text-center">
{{ concept.produit }}
</td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
</table>
</div>
<div class="uk-card-footer uk-text-center">
<a class="uk-button uk-button-secondary" href="/User/index">Retour</a>
</div>
</div>
</div>



{% endblock %}

0 comments on commit e3f8476

Please sign in to comment.