<div ng-controller="ViewSavingsTransactionController">
    <div class="paddedbottom10">
        <ul class="breadcrumb">
            <li><a href="#/viewsavingaccount/{{transaction.accountId}}">{{'label.anchor.viewsavingaccount' |
                translate}}</a></li>
            <li class="active">{{ 'label.anchor.viewtransaction' | translate}}</li>
        </ul>
    </div>

    <script type="text/ng-template" id="undotransaction.html">
        <div class="modal-header silver">
            <h3 class="bolder">{{'label.button.undo' | translate}}</h3>
        </div>
        <div class="modal-body ">
            <api-validate></api-validate>
            <br>
            <button class="btn btn-warning" ng-click="cancel()">{{'label.button.cancel' | translate}}</button>
            <button class="btn btn-primary" ng-click="undoTransaction()">{{'label.button.undo' | translate}}</button>
        </div>
    </script>

    <api-validate></api-validate>
    <h3>{{ 'label.heading.transactiondetails' | translate}}</h3>

    <div ng-hide="transaction.interestedPostedAsOn==false && (transaction.transactionType.id==17 || transaction.transactionType.id==3)" class="pull-right">
        <div class="btn-group">
            <a data-ng-hide="flag" has-permission='ADJUSTTRANSACTION_SAVINGSACCOUNT'
               href="#/savingaccount/{{transaction.accountId}}/modifytransaction?transactionId={{transaction.id}}"
               class="btn btn-primary"><i class="icon-pencil icon-white"></i>{{ 'label.button.edit' | translate}}</a>
            <a ng-click="undo(transaction.accountId, transaction.id)" class="btn btn-danger" has-permission='UNDOTRANSACTION_SAVINGSACCOUNT'><i
                    class="icon-trash icon-white"></i>{{ 'label.button.undo' | translate}}</a>
        </div>
    </div>

    <div class="row">
        <table class="width100">
            <tr>
                <td class="width20">{{ 'label.heading.transactionid' | translate}}</td>
                <td class="width80">{{transaction.id}}</td>
            </tr>
            <tr>
                <td>{{ 'label.heading.type' | translate}}</td>
                <td>{{transaction.transactionType.value}}</td>
            </tr>
            <tr>
                <td>{{ 'label.heading.transactiondate' | translate}}</td>
                <td>{{transaction.date | DateFormat}}</td>
            </tr>
            <tr>
                <td>{{ 'label.heading.currency' | translate}}</td>
                <td>{{transaction.currency.name}}</td>
            </tr>
            <tr>
                <td>{{ 'label.heading.amount' | translate}}</td>
                <td>{{transaction.amount | number}}</td>
            </tr>
        </table>
        <table class="width100" ng-show="transaction.paymentDetailData">
            <tr>
                <td class="width20"><strong>{{ 'label.heading.paymentdetails' | translate}}</strong></td>
                <td class="width80"></td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.paymentType">
                <td>{{ 'label.heading.type' | translate}}</td>
                <td>{{transaction.paymentDetailData.paymentType.name}}</td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.accountNumber">
                <td>{{ 'label.heading.accnum' | translate}}</td>
                <td>{{transaction.paymentDetailData.accountNumber}}</td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.checkNumber">
                <td>{{ 'label.heading.checknumber' | translate}}</td>
                <td>{{transaction.paymentDetailData.checkNumber}}</td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.routingCode">
                <td>{{ 'label.heading.routingcode' | translate}}</td>
                <td>{{transaction.paymentDetailData.routingCode}}</td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.receiptNumber">
                <td>{{ 'label.heading.receiptnumber' | translate}}</td>
                <td>{{transaction.paymentDetailData.receiptNumber}}</td>
            </tr>
            <tr ng-show="transaction.paymentDetailData.bankNumber">
                <td>{{ 'label.heading.banknumber' | translate}}</td>
                <td>{{transaction.paymentDetailData.bankNumber}}</td>
            </tr>
        </table>
    </div>
</div>
