@model ResoursesManager.Models.ReservationViewModel
@{
    ViewBag.Title = "Day";
}

<h2>Day</h2>
@Html.Partial("ViewChange", Model.Actual)
<a href="" class="toggle">Show all hours</a>
<h3 class="text-center">
    @Html.ActionLink("< Előző nap", "Day", "Reservations", new { day = Model.Actual.AddDays(-1) }, new { @class = "btn btn-primary btn-sm pull-left" })
    @Model.Actual.ToString("yyyy.MM.dd dddd")
    @(Model.Actual == DateTime.Today ? "(Ma)" : string.Empty)
    @Html.ActionLink("Következő nap >", "Day", "Reservations", new { day = Model.Actual.AddDays(1) }, new { @class = "btn btn-primary btn-sm pull-right" })
</h3>

<div class="row day">
    <div class="col-md-1">
        <ul class="list-group reservartion-day">
            @for (DateTime i = Model.Actual; i < Model.Actual.AddDays(1); i = i.AddHours(1))
            {
                <li class="list-group-item @(i.Hour < 7 || i.Hour > 20 ? "hidden" : string.Empty)">
                    @i.Hour:00
                </li>
            }
        </ul>
    </div>
    <div class="col-md-11">
        <ul class="list-group reservartion-day">
            @for (DateTime i = Model.Actual; i < Model.Actual.AddDays(1); i = i.AddHours(1))
            {
                <li class="list-group-item @(i.Hour < 7 || i.Hour > 20 ? "hidden" : string.Empty)">
                    @foreach (var item in Model.Reservations)
                    {
                        if (item.Begining.Hour == i.Hour)
                        {
                            <a href="@Url.Action("Details", new { id = item.Id })" class="resource-link">
                                <span>@item.Begining.ToString("HH:mm") - @item.End.ToString("HH:mm") @item.Resource.Name @item.Resource.AssetTag </span><br />
                            </a>
                        }
                    }
                    @Html.ActionLink("Foglalás", "Create", "Reservations", new { time = i }, new { @class = "create-reservation-link" })
                </li>
            }
        </ul>
    </div>
</div>
@section Scripts{
    <script src="~/Scripts/reservation.js"></script>
}