<div class="col-md-12" ng-controller="StandingInstructionsHistoryController">
    <div>
        <ul class="breadcrumb">
            <li><a href="#/organization">{{'label.anchor.organization' | translate}}</a></li>
            <li class="active">{{'label.anchor.standinginstruction.history' | translate}}</li>
        </ul>
    </div>
    <api-validate></api-validate>

    <div class="form-inline paddedtop paddedbottom10" ng-show="isCollapsed">

        <!--<div class="form-group">
            <input class="form-control width155px" type="text" ng-model="formData.sqlSearch" placeholder="{{ 'label.input.sqlSearch' | translate }}" />
        </div>-->
        <div class="form-group">
            <input class="form-control width155px" type="text" ng-model="formData.clientName" placeholder="{{'label.input.clientName' | translate }}"/>
        </div>
        <div class="form-group">
            <input class="form-control width155px" type="text" ng-model="formData.clientId" placeholder="{{'label.input.clientId' | translate }}"/>
        </div>
        <div class="form-group">
            <select id="transferType" ng-model="formData.transferType" name="transferType"
                    ng-options="transferType.id as transferType.value for transferType in template.transferTypeOptions"
                    value="{{transferType.id}}" class="form-control">
                <option value="">{{'label.input.transfertype' | translate}}</option>
            </select>
        </div>
        <div class="form-group">
            <select id="fromAccountType" ng-model="formData.fromAccountType" name="fromAccountType"
                    ng-options="fromAccountType.id as fromAccountType.value for fromAccountType in template.fromAccountTypeOptions"
                    value="{{fromAccountType.id}}" class="form-control">
                <option value="">{{'label.input.accounttype' | translate}}</option>
            </select>
        </div>
        <div class="form-group" data-ng-show="formData.fromAccountType">
            <input class="form-control width155px" type="text" ng-model="formData.fromAccountId" placeholder="{{ 'label.input.fromAccountId' | translate }}"/>
        </div>
        <div class="form-group">
            <input class="form-control width155px" type="text" datepicker-pop="dd MMMM yyyy" ng-model="date.first" is-open="opened" min="minDate" max="'2020-06-22'" placeholder="{{ 'label.input.fromdate' | translate }}"/>
        </div>
        <div class="form-group">
            <input class="form-control width155px" type="text" datepicker-pop="dd MMMM yyyy" ng-model="date.second" is-open="opened1" min="minDate" max="'2020-06-22'" placeholder="{{ 'label.input.todate' | translate }}"/>
        </div>
        <div class="form-group clear">
            <a ng-click="getTransactions()" class="btn btn-primary control" has-permission='READ_STANDINGINSTRUCTION '><i class="icon-search icon-white"></i></a></center>
        </div>
    </div>
    <div class="pull-right" ng-show="!isCollapsed">
        <button ng-click="isCollapsed = !isCollapsed" class="btn btn-primary control"><i class="icon-chevron-down icon-white"></i>{{
            'label.button.parameters' | translate }}
        </button>
    </div>
    <div ng-show="displayResults">
        <br>
        <table class="table">
            <thead>
            <tr class="graybg">
                <th>{{'label.heading.fromClient' | translate}}</th>
                <th>{{'label.heading.fromaccount' | translate}}</th>
                <th>{{'label.heading.toClient' | translate}}</th>
                <th>{{'label.heading.toaccount' | translate}}</th>
                <th>{{'label.heading.executionTime' | translate}}</th>
                <th>{{'label.heading.amount' | translate}}</th>
                <th>{{'label.heading.status' | translate}}</th>
                <th>{{'label.heading.errorlog' | translate}}</th>
            </tr>
            </thead>
            <tbody>
            <tr class="pointer-main" ng-repeat="transaction in transactions.currentPageItems">
                <td>{{transaction.fromClient.displayName}}({{transaction.fromClient.id}})</td>
                <td>{{transaction.fromAccount.productName}}({{transaction.fromAccount.id}})</td>
                <td>{{transaction.toClient.displayName}}({{transaction.toClient.id}})</td>
                <td>{{transaction.toAccount.productName}}({{transaction.toAccount.id}})</td>
                <td>{{transaction.executionTime | DateFormat}}</td>
                <td>{{transaction.amount}}</td>
                <td>{{transaction.status}}</td>
                <td>
                    <button data-ng-show="isFailed(transaction)" class="btn-warning" ng-click="errorLog(transaction)"><i class="icon-exclamation-sign icon-white"></i></button>
                </td>
            </tr>
            </tbody>
        </table>
        <ul class="pager">
            <li class="previous"><a id="prev" ng-click="transactions.previous()" href="" ng-disabled="!transactions.hasPrevious()">&larr; {{'label.button.previous' |
                translate}}</a></li>
            <li class="next"><a id="next" ng-click="transactions.next()" href="" ng-disabled="!transactions.hasNext()">{{'label.button.next'
                | translate}} &rarr; </a></li>
        </ul>
    </div>
    <script type="text/ng-template" id="errorlog.html">
        <div class="modal-header silver">
            <h3 class="bolder">{{'label.heading.errorlog' | translate}}</h3>
        </div>
        <div class="modal-body">
            <p>{{error}}</p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-warning" ng-click="cancel()">{{'label.button.close' | translate}}</button>
        </div>
    </script>
</div>