Recettes : on affiche toujours...

This commit is contained in:
2021-05-04 16:43:31 +02:00
parent a3dcbe7739
commit 2402e699fa
6 changed files with 60 additions and 15 deletions

View File

@@ -7,5 +7,8 @@
<route id="recipe.save" path="/admin/module/Recettes/save" methods="post"> <route id="recipe.save" path="/admin/module/Recettes/save" methods="post">
<default key="_controller">Recettes\Controller\MainController::saveRecipe</default> <default key="_controller">Recettes\Controller\MainController::saveRecipe</default>
</route> </route>
<route id="recipe.addtocart" path="/admin/module/Recettes/addtocart" methods="post">
<default key="_controller">Recettes\Controller\MainController::addToCart</default>
</route>
</routes> </routes>

View File

@@ -10,10 +10,12 @@ return array(
'Quantity' => 'Quantité', 'Quantity' => 'Quantité',
'Summary' => 'Description de la recette', 'Summary' => 'Description de la recette',
'Other ingredients' => 'Ingrédients supplémentaires', 'Other ingredients' => 'Ingrédients supplémentaires',
'Ingredient' => 'Ingrédient',
'Ingredients' => 'Ingrédients', 'Ingredients' => 'Ingrédients',
'Ingredient' => 'Nos produits',
'Ingredients from us' => 'Ce que vous pouvez trouver chez nous :', 'Ingredients from us' => 'Ce que vous pouvez trouver chez nous :',
'Additional ingredients' => 'Vous aurez également besoin de :', 'Additional ingredients' => 'Vous aurez également besoin de :',
'Quantity needed' => 'Quantité nécessaire', 'Quantity needed' => 'Quantité nécessaire',
'Add to cart' => 'Ajouter à mon panier', 'Quantity proposed' => 'Quantité proposée',
'Select' => 'Sélectionner',
'Add to cart' => 'Ajouter ces produits au panier',
); );

View File

@@ -39,7 +39,8 @@ class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
->set("RECIPE_ID", $product->getRecipeId()) ->set("RECIPE_ID", $product->getRecipeId())
->set("PSE_ID", $product->getPseId()) ->set("PSE_ID", $product->getPseId())
->set("PRODUCT_LABEL", $productLabel) ->set("PRODUCT_LABEL", $productLabel)
->set("QUANTITY", $product->getQuantity()) ->set("QUANTITY_NEEDED", $product->getQuantity())
->set("QUANTITY_PROPOSED", $product->getNbOfProducts())
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }

View File

@@ -31,9 +31,9 @@ class StepsLoop extends BaseLoop implements PropelSearchLoopInterface
$loopResultRow = new LoopResultRow($step); $loopResultRow = new LoopResultRow($step);
$loopResultRow $loopResultRow
->set("RECIPE_ID", $step->getId()) ->set("RECIPE_ID", $step->getRecipeId())
->set("STEP", $step->getContentId()) ->set("STEP", $step->getStep())
->set("DESCRIPTION", $step->getTitle()) ->set("DESCRIPTION", $step->getDescription())
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }
@@ -58,8 +58,9 @@ class StepsLoop extends BaseLoop implements PropelSearchLoopInterface
$steps = RecipeStepsQuery::create(); $steps = RecipeStepsQuery::create();
if (null != $id = $this->getRecipeId()) { if (null != $id = $this->getRecipeId()) {
$steps->filterById($id); $steps->filterByRecipeId($id);
} }
$steps->orderByStep();
return $steps; return $steps;
} }

View File

@@ -1,5 +1,5 @@
article#recette { article#recette {
width: 90% !important; width: 95% !important;
text-align: center; text-align: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -35,6 +35,7 @@ div.entete span b {
width: 250px; width: 250px;
box-shadow: 10px 10px 15px gray; box-shadow: 10px 10px 15px gray;
border-radius: 5px; border-radius: 5px;
transform: rotate(-2deg);
} }
.recette-titre { .recette-titre {
@@ -54,8 +55,28 @@ div.entete span b {
.table-ingredients { .table-ingredients {
width: 90%; width: 90%;
margin: auto;
} }
.table-ingredients th, .table-ingredients th,
.table-ingredients td { .table-ingredients td {
vertical-align: center !important;
text-align: center; text-align: center;
white-space: nowrap;
} }
.cellule-large {
width: 40%;
}
.cellule-etroite {
width: 1%;
}
.table-steps {
width: 80%;
margin: auto;
}
.table-steps td.number{
background-color: #95c11e;
border-radius: 30px;
color: white;
font-weight: bold;
}

View File

@@ -45,6 +45,7 @@
<span class="difficulte"><b>{intl l='Difficulty' d='recettes'}</b><img src="{image file='assets/img/cellular.svg' source='Recettes'}" alt="Difficulty">{$label_difficulty}</span> <span class="difficulte"><b>{intl l='Difficulty' d='recettes'}</b><img src="{image file='assets/img/cellular.svg' source='Recettes'}" alt="Difficulty">{$label_difficulty}</span>
</div> </div>
<br> <br>
<form action="/admin/module/Recettes/addtocart" method="post">
<div class="row"> <div class="row">
<div class="photo-principale col-md-4"> <div class="photo-principale col-md-4">
{loop type="image" name="image-loop" content=$content_id visible=true} {loop type="image" name="image-loop" content=$content_id visible=true}
@@ -58,16 +59,22 @@
<thead> <thead>
<th>{intl l="Ingredient" d="recettes"}</th> <th>{intl l="Ingredient" d="recettes"}</th>
<th>{intl l="Quantity needed" d="recettes"}</th> <th>{intl l="Quantity needed" d="recettes"}</th>
<th>{intl l="Add to cart" d="recettes"}</th> <th>{intl l="Quantity proposed" d="recettes"}</th>
<th>{intl l="Select" d="recettes"}</th>
</thead> </thead>
<tbody> <tbody>
{loop type="recipe_products" name="products-loop" recipe_id=$ID} {loop type="recipe_products" name="products-loop" recipe_id=$ID}
<tr> <tr>
<td class="cellule-produit">{$PRODUCT_LABEL}</td> <td class="cellule-large">{$PRODUCT_LABEL}</td>
<td class="cellule-quantite">{$QUANTITY}</td> <td class="cellule-etroite">{$QUANTITY_NEEDED}</td>
<td><input type="checkbox" id="product-{$PSE_ID}" class="cellule-checkbox"></td> <td class="cellule-etroite">{$QUANTITY_PROPOSED}</td>
<td class="cellule-etroite"><input type="checkbox" id="product-{$PSE_ID}" class="cellule-checkbox"></td>
</tr> </tr>
{/loop} {/loop}
<tr>
<td colspan="3"></td>
<td><input type="submit" class="button recette-bouton" value="{intl l='Add to cart' d='recettes'}"></td>
</tr>
</tbody> </tbody>
</table> </table>
<br> <br>
@@ -75,12 +82,22 @@
<label class="autres-ingredients">{$OTHER_INGREDIENTS|unescape:"html" nofilter}</label> <label class="autres-ingredients">{$OTHER_INGREDIENTS|unescape:"html" nofilter}</label>
</div> </div>
</div> </div>
</form>
<br> <br>
<br>
<div class="row">
<table class="table table-striped table-steps">
{loop type="recipe_steps" name="steps-loop" recipe_id=$ID}
<tr>
<td class="number">{$STEP}</td>
<td class="description">{$DESCRIPTION}</td>
</tr>
{/loop}
</table>
</div>
{/loop} {/loop}
</article> </article>
<br>
</div> </div>
{/if} {/if}
{/block} {/block}