@model dynamic
@{
    ViewBag.Title = $"Transaction {Model.TransactionId}";
    Layout = "_Layout";
    ViewBag.Query = Model.TransactionId;
}
@section Style
{
    <style>
        #crafted {
            position: relative;
            color: #111111;
        }
    </style>
}
<partial name="SearchBlock" model="@(new SearchBlockExplorer())" />
<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">Transaction Details</h2>
                </div>
            </div>
            @*<div class="offset-lg-3 col-lg-6">
                <div class="center-text">
                    <p>Fusce placerat pretium mauris, vel sollicitudin elit lacinia vitae. Quisque sit amet nisi erat.</p>
                </div>
            </div>*@
        </div>			
        <div class="row m-bottom-70">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="table-responsive">
                    <table class="table table-striped table-latests table-detail">
                        <tbody>
                            <tr>
                                <td><strong>Transaction ID</strong></td>
                                <td>
                                    <a asp-controller="BlockExplorer" asp-action="Transaction" asp-route-transactionId="@Model.TransactionId">@Model.TransactionId</a>
                                    <a href="#" class="copy-me"><i class="fa fa-copy"></i></a>
                                </td>
                            </tr>
                            <tr>
                                <td><strong>Block Hash</strong></td>
                                <td>
                                    <a asp-controller="BlockExplorer" asp-action="BlockHash" asp-route-hash="@Model.BlockHash">@Model.BlockHash</a>
                                </td>
                            </tr>
                            <tr>
                                <td><strong>Block Height</strong></td>
                                <td>
                                    <a asp-controller="BlockExplorer" asp-action="Block" asp-route-block="@Model.BlockIndex">@Model.BlockIndex</a>
                                </td>
                            </tr>
                            <tr>
                                <td><strong>Confirmations</strong></td>
                                <td>
                                    @Model.Confirmations
                                </td>
                            </tr>
                            
                            <tr>
                                <td><strong>Block Date/Time</strong></td>
                                <td>@Model.Timestamp.ToString("F")</td>
                            </tr>
                            @if (Model.Outputs != null)
                            {
                                <tr>
                                    <td><strong>Total Output</strong></td>
                                    <td>
                                        @{
                                            double totalOutpus = 0;
                                        }
                                        @foreach (var t in Model.Outputs)
                                        {
                                            totalOutpus += (double)t.Balance;
                                        }
                                        @totalOutpus.ToString("N8") @Model.CoinTag
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="center-heading">
                    <h2 class="section-title">Inputs</h2>
                </div>
            </div>
        </div>
        <div class="row m-bottom-70">
            <div class="col-lg-12">
                <div class="table-responsive">
                    <table class="table table-striped table-latests">
                        <thead>
                        <tr>
                            <th>Index</th>
                            <th>Input Transaction ID</th>
                        </tr>
                        </thead>
                        <tbody>
                            @foreach (var input in Model.Inputs)
                            {
                                <tr>
                                    <td>@input.InputIndex</td>
                                    <td><a asp-controller="BlockExplorer" asp-action="Transaction" asp-route-transactionId="@input.InputTransactionId">@input.InputTransactionId</a></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="center-heading">
                    <h2 class="section-title">Outputs</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>
                            <th>Index</th>
                            <th>Output Address</th>
                            <th>Output Type</th>
                            <th>Amount</th>
                        </tr>
                        </thead>
                        <tbody>
                            @foreach (var output in Model.Outputs)
                            {
                                <tr>
                                    <td>@output.Index</td>
                                    <td><a asp-controller="BlockExplorer" asp-action="Address" asp-route-address="@output.Address">@output.Address</a></td>
                                    <td>@output.OutputType</td>
                                    <td>@output.Balance.ToString("N8") @Model.CoinTag</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>
