116 lines
4.1 KiB
Twig
116 lines
4.1 KiB
Twig
|
{% extends 'layout.twig' %}
|
||
|
{% block title "Ğ1-Marché - Produits" %}
|
||
|
|
||
|
{% block body %}
|
||
|
<style>
|
||
|
.fond_paris {
|
||
|
background-image: url("../images/background_contacts.jpg");
|
||
|
background-repeat: no-repeat;
|
||
|
background-attachment:fixed;
|
||
|
background-position: center;
|
||
|
background-size: 100% auto;
|
||
|
font-family: Bree serif,"Helvetica Neue", Helvetica, Arial, sans-serif;
|
||
|
}
|
||
|
.tableau {
|
||
|
width:100%;
|
||
|
background-color: white;
|
||
|
table-layout: fixed;
|
||
|
border-collapse: collapse;
|
||
|
/* border-spacing: 1px; // pour contrer les style de base */
|
||
|
}
|
||
|
/* Entête */
|
||
|
.tableau th {
|
||
|
border-spacing: 0;
|
||
|
border-collapse: collapse;
|
||
|
padding: 0rem;
|
||
|
text-align: center;
|
||
|
border-left: lightgray 1px solid;
|
||
|
background-color:#999690;
|
||
|
color:#fff;
|
||
|
}
|
||
|
.tableau .colonne_image {
|
||
|
padding: 0; !important;
|
||
|
}
|
||
|
.tableau td {
|
||
|
border-bottom: solid 1px black;
|
||
|
border-left: lightgray 1px solid;
|
||
|
padding-left: 0.7rem;
|
||
|
}
|
||
|
.align_droite {
|
||
|
|
||
|
text-align: right;
|
||
|
padding-right: 2rem;
|
||
|
}
|
||
|
</style>
|
||
|
<div id="la_page">
|
||
|
<div class="label" style="background-color: white;">
|
||
|
<h4>G-Marché de : {{ antenne_name }}</h4>
|
||
|
</div>
|
||
|
{% if antenne_name == 'Paris' %}
|
||
|
<script type="text/javascript">
|
||
|
$('.fond').css('background-image', "url('/images/toureiffel.jpeg')");
|
||
|
</script>
|
||
|
{% endif %}
|
||
|
|
||
|
<p class="text-right">
|
||
|
<a href="{{ path(routePrefix ~ '.create',{region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]} )}}" class="btn btn-primary">
|
||
|
Ajouter un produit
|
||
|
</a>
|
||
|
{{ items[name] }}
|
||
|
</p>
|
||
|
<table style="padding:0.15rem;" class="table-striped tableau">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th style="width:8rem;">Produit</th>
|
||
|
<th style="width:8rem;">Photo</th>
|
||
|
<th style="width:7rem;">Vendeur</th>
|
||
|
<th style="width:5rem;">Quantité</th>
|
||
|
<th style="width:6rem;">Prix</th>
|
||
|
<th style="width:6rem;">Màj le</th>
|
||
|
<th style="width:12rem;" colspan="2">Actions</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
{% set token_input = csrf_input %}
|
||
|
|
||
|
{% for item in items %}
|
||
|
<tr>
|
||
|
<td>{{ item.name }}</td>
|
||
|
<td class="colonne_image" style="width:80px;"> {% if item.image %}
|
||
|
<img src="{{ item.thumb }}" alt="" style="width:100%; height:auto;">
|
||
|
{% endif %}
|
||
|
</td>
|
||
|
<td> {{ item.username }}</td>
|
||
|
<td class="align_droite"> {{ item.quantite }} </td>
|
||
|
<td class="align_droite"> {{ item.prix }} </td>
|
||
|
<td> {{ item.strUpdatedAt }} </td>
|
||
|
<td>
|
||
|
{% if current_user().id == item.userId %}
|
||
|
<a href="{{ path('product.admin.edit', {id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }}" class="btn btn-primary">Editer</a>
|
||
|
{% else %}
|
||
|
<button class="btn btn-disabled">Acheter</button>
|
||
|
{% endif %}
|
||
|
</td>
|
||
|
<td>
|
||
|
{% if current_user().id == item.userId %}
|
||
|
<form style="display: inline;height:50px;" action="{{ path(routePrefix ~ '.delete', {id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }}" method="POST" onsubmit="return confirm('Êtes-vous sûr ?')">
|
||
|
<input type="hidden" name="_method" value="DELETE">
|
||
|
<button class="btn btn-danger" style="position:relative;top:43px;">Supprimer</button>
|
||
|
{{ field('antenne_id', explodeUrl()[4], "", {type: 'hidden'}) }}
|
||
|
{{ field('produit_name', item.name, "", {type: 'hidden'}) }}
|
||
|
{{ token_input | raw }}
|
||
|
</form>
|
||
|
{% else %}
|
||
|
<button class="btn btn-disabled">Supprimer</button><!-- On ne peut supprimer les produits des autres -->
|
||
|
{% endif %}
|
||
|
</td>
|
||
|
</tr>
|
||
|
{% endfor %}
|
||
|
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
{{ paginate(items, routePrefix ~ '.index', {id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }}
|
||
|
</div>
|
||
|
{% endblock %}
|