{{define "txdetail"}}{{$cs := .CoinShortcut}}{{$addr := .AddrStr}}{{$tx := .Tx}}
<div class="alert alert-data">
    <div class="row line-bot">
        <div class="col-xs-7 col-md-8 ellipsis">
            <a href="/tx/{{$tx.Txid}}">{{$tx.Txid}}</a>
        </div>
        {{- if $tx.Confirmations -}}
        <div class="col-xs-5 col-md-4 text-muted text-right">mined {{formatUnixTime $tx.Blocktime}}</div>
        {{- end -}}
    </div>
    <div class="row line-mid">
        <div class="col-md-5">
            <div class="row">
                <table class="table data-table">
                    <tbody>
                        {{- range $vin := $tx.Vin -}}
                        <tr>
                            <td>
                                {{- if $vin.Txid -}}
                                <a class="float-left text-muted" href="/tx/{{$vin.Txid}}" title="Outpoint {{$vin.Txid}},{{$vin.Vout}}">➡&nbsp;</a>
                                {{- end -}}
                                {{- range $a := $vin.Addresses -}}
                                <span class="ellipsis float-left">
                                    {{if and (ne $a $addr) $vin.Searchable}}<a href="/address/{{$a}}">{{$a}}</a>{{else}}{{$a}}{{end}}
                                </span>
                                {{- else -}}
                                <span class="float-left">{{- if $vin.Hex -}}Unparsed address{{- else -}}No Inputs (Newly Generated Coins){{- end -}}</span>
                                {{- end -}}{{- if $vin.Addresses -}}
                                <span class="float-right{{if stringInSlice $addr $vin.Addresses}} text-danger{{end}}">{{formatAmount $vin.ValueSat}} {{$cs}}</span>
                                {{- end -}}
                            </td>
                        </tr>
                        {{- else -}}
                        <tr>
                            <td>No Inputs</td>
                        </tr>
                        {{- end -}}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-md-1 col-xs-12 text-center">
            <svg class="octicon" viewBox="0 0 8 16">
                <path fill-rule="evenodd" d="M7.5 8l-5 5L1 11.5 4.75 8 1 4.5 2.5 3l5 5z"></path>
            </svg>
        </div>
        <div class="col-md-6">
            <div class="row">
                <table class="table data-table">
                    <tbody>
                        {{- range $vout := $tx.Vout -}}
                        <tr>
                            <td>
                                {{- range $a := $vout.Addresses -}}
                                <span class="ellipsis float-left">
                                    {{- if and (ne $a $addr) $vout.Searchable}}<a href="/address/{{$a}}">{{$a}}</a>{{else}}{{$a}}{{- end -}}
                                </span>
                                {{- else -}}
                                <span class="float-left">Unparsed address</span>
                                {{- end -}}
                                <span class="float-right{{if stringInSlice $addr $vout.Addresses}} text-success{{end}}">
                                    {{formatAmount $vout.ValueSat}} {{$cs}} {{if $vout.Spent}}<a class="text-danger" href="{{if $vout.SpentTxID}}/tx/{{$vout.SpentTxID}}{{else}}/spending/{{$tx.Txid}}/{{$vout.N}}{{end}}" title="Spent">➡</a>{{else -}}
                                    <span class="text-success" title="Unspent"> <b>×</b></span>
                                    {{- end -}}
                                </span>
                            </td>
                        </tr>
                        {{- else -}}
                        <tr>
                            <td>No Outputs</td>
                        </tr>
                        {{- end -}}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="row line-top">
        <div class="col-xs-6 col-sm-4 col-md-4">
            {{- if $tx.FeesSat -}}
            <span class="txvalues txvalues-default">Fee: {{formatAmount $tx.FeesSat}} {{$cs}}</span>
            {{- end -}}
        </div>
        <div class="col-xs-6 col-sm-8 col-md-8 text-right">
            {{- if $tx.Confirmations -}}
            <span class="txvalues txvalues-success">{{$tx.Confirmations}} Confirmations</span>
            {{- else -}}
            <span class="txvalues txvalues-danger ng-hide">Unconfirmed Transaction!</span>
            {{- end -}}
            <span class="txvalues txvalues-primary">{{formatAmount $tx.ValueOutSat}} {{$cs}}</span>
        </div>
    </div>
</div>
{{end}}