<div class="col-md-12" ng-controller="AuditController">
    <ul class="breadcrumb">
        <li><a href="#/system">{{'label.anchor.system' | translate}}</a></li>
        <li class="active">{{'label.anchor.audit' | translate}}</li>
    </ul>

    <div class="form-inline" data-ng-show="isCollapsed">
        <div class="form-group">
			<span class="input-append grpinputicons">
				<input ng-autofocus="true" autocomplete="off" typeahead-on-select="viewUser($item)" placeholder="{{'label.input.searchbyuser' | translate}}" type="text" ng-model="formData.user" class="form-control" typeahead="users.username as users.username for users in template.appUsers | filter:$viewValue | limitTo:8"/>
				<span><button ng-click="isCollapsed = !isCollapsed" class="btn btn-default"><i class="icon-chevron-down"></i></button></span>
				<span><button ng-click="searchAudit()" class="btn btn-primary control" has-permission='READ_AUDIT'><i class="icon-search icon-white"></i></button></span>
			</span>
        </div>
    </div>

    <div data-ng-hide="isCollapsed">
        <div class="form-inline">
            <input ng-autofocus="true" autocomplete="off" typeahead-on-select="viewUser($item)" placeholder="{{'label.input.searchbyuser' | translate}}" type="text" ng-model="formData.user" class="form-control" typeahead="users.username as users.username for users in template.appUsers | filter:$viewValue | limitTo:8"/>
            <input type="text" sort placeholder="{{'label.input.fromdate' | translate}}" datepicker-pop="dd MMMM yyyy" ng-model="date.first" is-open="opened" min="minDate" max="'2020-06-22'" class="form-control"/>
            <input type="text" sort placeholder="{{'label.input.checkedfrom' | translate}}" datepicker-pop="dd MMMM yyyy" ng-model="date.third" is-open="opened2" min="minDate" max="'2020-06-22'" class="form-control"/>
            <select value="{{status.id}}" ng-model="formData.status" class="form-control width170px" data-ng-options="status.id as status.processingResult | translate for status in template.processingResults">
                <option value="">--{{'label.selectstatus' | translate}}--</option>
            </select>
            <select ng-model="formData.action" class="form-control width170px">
                <option value="">--{{'label.selectaction' | translate}}--</option>
                <option selected="selected" value="">{{'label.all' | translate}}</option>
                <option ng-repeat="action in template.actionNames" value="{{action}}">{{action}}</option>
            </select>
            <a ng-click="clearFilters()" class="btn btn-primary control pull-right"><i class="icon-remove-sign">{{'label.button.reset' | translate}}</i></a>
        </div>

        <div class="form-inline">
            <input type="text" placeholder="{{'label.input.resourceid' | translate}}" ng-model="formData.resourceId" class="form-control">
            <input type="text" sort placeholder="{{'label.input.todate' | translate}}" datepicker-pop="dd MMMM yyyy" ng-model="date.second" is-open="opened1" min="minDate" max="'2020-06-22'" class="form-control"/>
            <input type="text" sort placeholder="{{'label.input.checkedto' | translate}}" datepicker-pop="dd MMMM yyyy" ng-model="date.fourth" is-open="opened3" min="minDate" max="'2020-06-22'" class="form-control"/>
            <select ng-model="formData.entity" class="form-control width170px">
                <option value="">--{{'label.selectentity' | translate}}--</option>
                <option selected="selected" value="">{{'label.all' | translate}}</option>
                <option ng-repeat="entity in template.entityNames" value="{{entity}}">{{entity}}</option>
            </select>
            <select ng-model="formData.checkedBy" class="form-control width170px">
                <option value="">--{{'label.selectchecker' | translate}}--</option>
                <option selected="selected" value="">{{'label.all' | translate}}</option>
                <option ng-repeat="user in template.appUsers" value="{{user.id}}">{{user.username}}</option>
            </select>
            <span><a ng-click="searchAudit()" class="btn btn-primary control pull-right" has-permission='READ_AUDIT'><i class="icon-search icon-white"></i>{{'label.button.advancesearch' | translate}}</a></span>
        </div>
    </div>

    <div ng-show="displayResults">
        <div data-ng-show="flag" class="pull-right">
            <button type="button" class="btn btn-primary" ng-csv="csvData"><i class="icon-file icon-white"></i>{{'label.button.exportcsv' | translate }}</button>
        </div>
        <div scroll data-ng-show="flag">
            <table class="table table-bordered width1200px" data-anchor>
                <thead>
                <tr class="graybg">
                    <th>{{'label.heading.id' | translate}}</th>
                    <th>{{'label.heading.resourceid' | translate}}</th>
                    <th>{{'label.heading.status' | translate}}</th>
                    <th>{{'label.heading.madeby' | translate}}</th>
                    <th>{{'label.heading.action' | translate}}</th>
                    <th>{{'label.heading.entity' | translate}}</th>
                    <th>{{'label.heading.office' | translate}}</th>
                    <th>{{'label.heading.madedate' | translate}}</th>
                    <th>{{'label.heading.checker' | translate}}</th>
                    <th>{{'label.heading.checkeddate' | translate}}</th>
                </tr>
                </thead>
                <tbody>
                <tr class="highlight-row pointer" data-ng-click="routeTo(data.id)" ng-repeat="data in searchData.pageItems">
                    <td>{{data.id}}</td>
                    <td>{{data.resourceId}}</td>
                    <td>{{data.processingResult | translate}}</td>
                    <td>{{data.maker}}</td>
                    <td>{{data.actionName}}</td>
                    <td>{{data.entityName}}</td>
                    <td>{{data.officeName}}</td>
                    <td>{{data.madeOnDate | date:'d MMM y h:mm:ss'}}</td>
                    <td>{{data.checker}}</td>
                    <td>{{data.checkedOnDate | date:'d MMM y h:mm:ss'}}</td>
                </tr>
                </tbody>
            </table>
        </div>

        <ul class="pager">
            <li class="previous">
                <a id="prev" ng-click="audit.previous()" href="" ng-disabled="!audit.hasPrevious()">&larr; {{'label.button.previous' | translate}}</a>
            </li>
            <li class="next">
                <a id="next" ng-click="audit.next()" href="" ng-disabled="!audit.hasNext()">{{'label.button.next' | translate}} &rarr;</a>
            </li>
        </ul>

        <h3 data-ng-show="!flag" class="auditnodata"><strong>{{ 'label.nodata' | translate }}</strong></h3>
    </div>
</div>