@model Francesco.Recipes.World.Models.BackendModels.Shoppinglist.ShoppingList
@using Francesco.Recipes.World.Models.BackendModels.RecipeShoppingList
@using Francesco.Recipes.World.Models.BackendModels.RecipeIngredient
@using Francesco.Recipes.World.Models.BackendModels.Recipe

@{
	ViewData["Title"] = "Einkaufsliste Details";
}

<h2>Einkaufsliste Details</h2>

@if (TempData["SuccessMessage"] != null)
{
	<div class="alert alert-success">
		@TempData["SuccessMessage"]
	</div>
}

<div>
	<h4>Einkaufsliste</h4>
	<hr />
	<dl class="row">
		<dt class="col-sm-2">
			ID
		</dt>
		<dd class="col-sm-10">
			@Model.Id
		</dd>
	</dl>
</div>

<h4>Rezepte</h4>
<table class="table">
	<thead>
		<tr>
			<th>Rezeptname</th>
			<th>Zutaten</th>
		</tr>
	</thead>
	<tbody>
		@foreach (var recipeShoppingList in Model.RecipeShoppingList)
		{
			<tr>
				<td>@recipeShoppingList.Recipe.Name</td>
				<td>
					<ul>
						@foreach (var ingredient in recipeShoppingList.SelectedIngredients)
						{
							<li>@ingredient.RecipeIngredient.Ingredient.Name - @ingredient.RecipeIngredient.Quantity @ingredient.RecipeIngredient.Unit.Name</li>
						}
					</ul>
				</td>
			</tr>
		}
	</tbody>
</table>
