<form class="form-horizontal" role=form>
    <h2>Ledger</h2>

    <div class="form-group">
        <label for="txtStartDate" class="col-md-2 control-label">Date</label>

        <div class="col-md-5">
            <div class="input-group">
                <input class="form-control" id="txtStartDate" type="text" datepicker-popup="dd-MMM-yyyy"
                       ng-model="info.StartDate"/>
                <span class="input-group-btn">
                    <button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
            </div>
        </div>
        <div class="col-md-5">
            <div class="input-group">
                <input type="text" id="txtFinishDate" class="form-control" datepicker-popup="dd-MMM-yyyy"
                       ng-model="info.FinishDate"/>
                <span class="input-group-btn">
                    <button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="txtLedger" class="col-md-2 control-label">Ledger</label>

        <div class="col-md-10">
            <div class="input-group">
                <input type="text" id="txtLedger" class="form-control" ng-model="info.Ledger"
                       typeahead="account as account.Name for account in accounts($viewValue)"
                       typeahead-editable="false" on-return="show()"/>
                    <span class="input-group-btn">
                        <button class="btn btn-info" ng-click="show()">Show <i class="glyphicon glyphicon-eye-open"></i>
                        </button>
                    </span>
            </div>
        </div>
    </div>
    <table id="gvGrid" class="table table-condensed table-bordered table-striped">
        <thead>
        <tr>
            <th>Date</th>
            <th>Particulars</th>
            <th>Type</th>
            <th>Narration</th>
            <th>Debit</th>
            <th>Credit</th>
            <th>Running</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in info.Body" ng-class="{danger:!item.Posted, warning:$index==selected}" ng-click="setSelected($index)">
            <td class="no-wrap">{{item.Date}}</td>
            <td><a href="{{item.Url}}">{{item.Name}}</a></td>
            <td class="no-wrap">{{item.Type}}</td>
            <td>{{item.Narration}}</td>
            <td class="right no-wrap">{{item.Debit}}</td>
            <td class="right no-wrap">{{item.Credit}}</td>
            <td class="right no-wrap">{{item.Running}}</td>
        </tr>
        </tbody>
        <tfoot>
        <tr>
            <td class="no-wrap">{{info.Footer.Date}}</td>
            <td>{{info.Footer.Name}}</td>
            <td>{{info.Footer.Type}}</td>
            <td>{{info.Footer.Narration}}</td>
            <td class="right">{{info.Footer.Debit}}</td>
            <td class="right">{{info.Footer.Credit}}</td>
            <td class="right">{{info.Footer.Running}}</td>
        </tr>
        </tfoot>
    </table>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button class="btn btn-info" ng-click="downloadTable()">Download <i
                    class="glyphicon glyphicon-download-alt"></i></button>
        </div>
    </div>
</form>
