<div class="row page-titles">
    <div class="col-md-6 col-8 align-self-center">
        <h3 class="text-themecolor m-b-0 m-t-0">{{phrase.academicyears}}</h3>
    </div>
    <div class="col-md-6 col-4 align-self-center">

    </div>
</div>

<div class="row" ng-show="views.list">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-show="$root.can('academicyears.addAcademicyear')" ng-click="changeView('add')" class="btn pull-right btn-success card-block-input-item">{{phrase.addAcademicyear}}</button>
                <div class="pull-right card-block-input-group card-block-input-item">
                    <div class="input-group input-group-sm">
                        <input type="text" name="table_search" ng-model="searchText" placeholder="{{phrase.Search}}" class="form-control">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
                <h4 class="card-title">{{phrase.listAcademicyear}}</h4>
                <div class="table-responsive">

                    <table class="table table-bordered table-hover">
                        <tbody>
                            <tr>
                                <th>{{phrase.yearTitle}}</th>
                                <th>{{phrase.yearStatus}}</th>
                                <th ng-show="$root.can('academicyears.editAcademicYears') || $root.can('academicyears.delAcademicYears')">{{phrase.Operations}}</th>
                            </tr>
                            <tr ng-repeat="year in academicYears | filter:searchText">
                                <td>{{year.yearTitle}}</td>
                                <td><span ng-show="year.isDefault == '1'">{{phrase.defAcademicYears}}</span><span ng-show="year.isDefault == '0'">{{phrase.Inactive}}</span></td>
                                <td ng-show="$root.can('academicyears.editAcademicYears') || $root.can('academicyears.delAcademicYears')">
                                    <button ng-show="$root.can('academicyears.editAcademicYears') && year.isDefault == '0'" ng-click="makeActive(year.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Active}}" tooltip><i class="fa  fa-check-square-o"></i></button>
                                    <button ng-show="$root.can('academicyears.editAcademicYears')" ng-click="edit(year.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></button>
                                    <button ng-show="$root.can('academicyears.delAcademicYears')" ng-click="remove(year,$index)" type="button" class="btn btn-danger btn-circle" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></button>
                                </td>
                            </tr>
                            <tr ng-show="!academicYears.length"><td class="noTableData" colspan="4">{{phrase.noAcademicYears}}</td></tr>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>

<div class="row" ng-show="views.add">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-click="changeView('list')" class="btn btn-danger btn-flat pull-right card-block-input-item">{{phrase.cancelAdd}}</button>
                <h4 class="card-title">{{phrase.addAcademicyear}}</h4>
                <div class="table-responsive">

                    <form class="form-horizontal" name="addyear" role="form" ng-submit="saveAdd()" novalidate>
                        <div class="form-group row" ng-class="{'has-error': addyear.yearTitle.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.yearTitle}} * </label>
                            <div class="col-sm-10">
                                <input type="text" name="yearTitle" ng-model="form.yearTitle" class="form-control" required placeholder="{{phrase.yearTitle}}">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.defAcademicYears}}</label>
                            <div class="col-sm-10">
                                <label><input type="checkbox" name="isDefault" ng-model="form.isDefault"> {{phrase.markAsDefAcademicYears}}</label>
                            </div>
                        </div>
                        <div class="form-group m-b-0">
                            <div class="offset-sm-2 col-sm-10">
                                <button type="submit" class="btn btn-info waves-effect waves-light" ng-disabled="addyear.$invalid">{{phrase.addAcademicyear}}</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

<div class="row" ng-show="views.edit">
    <div class="col-12">
        <div class="card">
            <div class="card-block">
                <button ng-click="changeView('list')" class="btn btn-danger btn-flat pull-right card-block-input-item">{{phrase.cancelEdit}}</button>
                <h4 class="card-title">{{phrase.editAcademicYears}}</h4>
                <div class="table-responsive">

                    <form class="form-horizontal" name="edityear" role="form" ng-submit="saveEdit()" novalidate>
                        <div class="form-group row" ng-class="{'has-error': edityear.yearTitle.$invalid}">
                            <label class="col-sm-2 text-right control-label col-form-label">{{phrase.yearTitle}} * </label>
                            <div class="col-sm-10">
                                <input type="text" name="yearTitle" ng-model="form.yearTitle" class="form-control" required placeholder="{{phrase.yearTitle}}">
                            </div>
                        </div>
                        <div class="form-group m-b-0">
                            <div class="offset-sm-2 col-sm-10">
                                <button type="submit" class="btn btn-info waves-effect waves-light" ng-disabled="edityear.$invalid">{{phrase.editAcademicYears}}</button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>
