@model dynamic
@{
    ViewBag.Title = ViewBag.Setup.Chain + " Block Explorer";
    Layout = "_Layout";
}
@section Style
{
    <style>
        #crafted {
            position: relative;
            color: #111111;
        }
    </style>
}
<partial name="SearchBlock" />
<section class="block-explorer-section section bg-bottom">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="center-heading">
                    <h2 class="section-title">Latest Blocks</h2>
                </div>
            </div>
        </div>			
        <div class="row">
            <div class="col-lg-12">
                <div class="table-responsive">
                    <table class="table table-striped table-latests">
                        <thead>
                            <tr>
                                <td>Block Height</td>
                                <td>Age</td>
                                <td>No. Transactions</td>
                                <td>Block Size</td>
                                <td>Block Hash</td>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach(var block in ViewBag.Blocks)
                            {
                                <tr>
                                    <td><a asp-controller="BlockExplorer" asp-action="Block" asp-route-block="@block.BlockIndex">@block.BlockIndex</a></td>
                                    <td>@((DateTime.Now - DateTimeOffset.FromUnixTimeSeconds((long)block.BlockTime)).TotalMinutes.ToString("N0")) Minutes</td>
                                    <td class="text-center">@block.TransactionCount</td>
                                    <td>@block.BlockSize bytes</td>
                                    <td><a asp-controller="BlockExplorer" asp-action="BlockHash" asp-route-hash="@block.BlockHash">@block.BlockHash</a></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>