{{define "txdetail"}}{{$cs := .CoinShortcut}}{{$addr := .AddrStr}}{{$tx := .Tx}}{{$data := .}}
<div class="alert alert-data"{{if eq $tx.EthereumSpecific.Status 0}} style="background-color: #faf2ee;"{{end}}>
    <div class="row line-bot">
        <div class="col-xs-7 col-md-8 ellipsis">
            <a href="/tx/{{$tx.Txid}}">{{$tx.Txid}}</a>
            {{if eq $tx.EthereumSpecific.Status 1}}<span class="text-success"> ✔</span>{{end}}{{if eq $tx.EthereumSpecific.Status 0}}<span class="text-danger"> ✘</span>{{end}}
        </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-4">
            <div class="row tx-in">
                <table class="table data-table">
                    <tbody>
                        {{- range $vin := $tx.Vin -}}
                        <tr{{if isOwnAddresses $data $vin.Addresses}} class="tx-own"{{end}}>
                            <td>
                                {{- range $a := $vin.Addresses -}}
                                <span class="ellipsis tx-addr">
                                    {{if and (ne $a $addr) $vin.Searchable}}<a href="/address/{{$a}}">{{$a}}</a>{{else}}{{$a}}{{end}}
                                </span>
                                {{- else -}}
                                <span class="tx-addr">Unparsed address</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-4">
            <div class="row tx-out">
                <table class="table data-table">
                    <tbody>
                        {{- range $vout := $tx.Vout -}}
                        <tr{{if isOwnAddresses $data $vout.Addresses}} class="tx-own"{{end}}>
                            <td>
                                {{- range $a := $vout.Addresses -}}
                                <span class="ellipsis tx-addr">
                                    {{- if and (ne $a $addr) $vout.Searchable}}<a href="/address/{{$a}}">{{$a}}</a>{{else}}{{$a}}{{- end -}}
                                </span>
                                {{- else -}}
                                <span class="tx-addr">Unparsed address</span>
                                {{- end -}}
                            </td>
                        </tr>
                        {{- else -}}
                        <tr>
                            <td>No Outputs</td>
                        </tr>
                        {{- end -}}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-md-3 text-right" style="padding: .4rem 0;">
            {{formatAmount $tx.ValueOutSat}} {{$cs}}
        </div>
    </div>
    {{- if $tx.TokenTransfers -}}
    <div class="row line-top" style="padding: 15px 0 6px 15px;font-weight: bold;">
        ERC20 Token Transfers
    </div>
    {{- range $erc20 := $tx.TokenTransfers -}}
    <div class="row" style="padding: 2px 15px;">
        <div class="col-md-4">
            <div class="row tx-in">
                <table class="table data-table">
                    <tbody>
                        <tr{{if isOwnAddress $data $erc20.From}} class="tx-own"{{end}}>
                            <td>
                                <span class="ellipsis tx-addr">{{if ne $erc20.From $addr}}<a href="/address/{{$erc20.From}}">{{$erc20.From}}</a>{{else}}{{$erc20.From}}{{end}}</span>
                            </td>
                        </tr>
                    </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-4">
            <div class="row tx-out">
                <table class="table data-table">
                    <tbody>
                        <tr{{if isOwnAddress $data $erc20.To}} class="tx-own"{{end}}>
                            <td>
                                <span class="ellipsis tx-addr">{{if ne $erc20.To $addr}}<a href="/address/{{$erc20.To}}">{{$erc20.To}}</a>{{else}}{{$erc20.To}}{{end}}</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-md-3 text-right" style="padding: .4rem 0;">{{formatAmountWithDecimals $erc20.Value $erc20.Decimals}} {{$erc20.Symbol}}</div>
    </div>
    {{- end -}}
    <div class="row" style="padding: 6px 15px;"></div>
    {{- end -}}
    <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}}