@using ElectronicsShopContracts.ViewModels
@using ElectronicsShopDataModels.Models

@model (double, int, Dictionary<int, (IProductModel, int)>)

@{
	ViewData["Title"] = "Payment";
}

<div class="text-center">
	<h1 class="display-4">Оплата корзины</h1>
</div>

<form method="post">
	<div class="row">
		<div class="col-4"></div>
		<div class="col-8">
			<input id="id" type="hidden" name="id" readonly value="@Model.Item2" />
		</div>
	</div>
	<div class=" text-center">
		<div class="row">
			<div class="col-4">Сумма платежа:</div>
			<div class="col-8">
				<input type="text" name="paysum" id="paysum" />
			</div>
			
		</div>
		<div class="row">
			<div class="col-4">Сумма к оплате:</div>
			<div class="col-8">
				<input type="text" name="sum" id="sum" readonly  value="@Model.Item1"/>
			</div>
			<input type="submit" value="Оплатить!" class="btn btn-primary" />
		</div>
		<table class="table">
			<thead>
				<tr>
					<th>
						Номер
					</th>
					<th>
						Продукт
					</th>
					<th>
						Количество
					</th>
					<th>
						Сумма
					</th>
				</tr>
			</thead>
			<tbody>
				@foreach (var item in Model.Item3)
				{
					<tr class="element">
						<th>
							@Html.DisplayFor(modelItem => item.Key)
						</th>
						<th>
							@Html.DisplayFor(modelItem => item.Value.Item1.ProductName)
						</th>

						<th class="count">
							@Html.DisplayFor(modelItem => item.Value.Item2)
						</th>

						<th class="countsum">
							@Html.DisplayFor(modelItem => item.Value.Item1.Price)
						</th>
					</tr>
				}
			</tbody>
		</table>
		
		<div class="row">
			<div class="col-4"></div>
			<div class="col-8">
					<a class="btn btn-primary btn-sm" style="background-color:red;" asp-action="Index">Отменить - вернуться на главную страницу</a>
			</div>
		</div>
	</div>
</form>