<div ng-if="!identity.isAuthenticated()">
    <div class="col-md-5 col-md-offset-1">
        <div class="well bs-component">
            <form name="loginForm" class="form-horizontal">
                <fieldset>
                    <legend>Login</legend>
                    <div class="form-group">
                        <label for="email-login" class="col-md-3 control-label">Name</label>

                        <div class="col-md-9">
                            <input ng-model="loginUser.email" required="required" id="email-login" class="form-control"
                                   type="text">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password-login" class="col-md-3 control-label">Password</label>

                        <div class="col-md-9">
                            <input ng-model="loginUser.password" required="required" class="form-control"
                                   id="password-login" type="password">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-9 col-md-offset-2">
                            <button type="reset" class="btn btn-default">Cancel</button>
                            <button ng-click="login(loginUser)" ng-disabled="loginForm.$invalid"
                                    class="btn btn-warning">
                                Login
                            </button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>

    <div class="col-md-5">
        <div class="well bs-component">
            <form name="registerForm" class="form-horizontal">
                <fieldset>

                    <legend>Register</legend>

                    <div class="form-group">
                        <label for="email" class="col-md-3 control-label">Email</label>

                        <div class="col-md-9">
                            <input ng-model="registerUser.email" required="required" class="form-control" id="email"
                                   type="email">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password" class="col-md-3 control-label">Password</label>

                        <div class="col-md-9">
                            <input ng-model="registerUser.password" required="required" minlength="6" maxlength="100"
                                   class="form-control" id="password" type="password">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="confirmPassword" class="col-md-3 control-label">Confirm Password</label>

                        <div class="col-md-9">
                            <input ng-model="registerUser.confirmPassword" required="required" class="form-control"
                                   id="confirmPassword"
                                   type="password">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-9 col-md-offset-2">
                            <button type="reset" class="btn btn-default">Cancel</button>
                            <button ng-class="register-form.$invalid ? 'disabled-button' : ''"
                                    ng-disabled="registerForm.$invalid || registerUser.password != registerUser.confirmPassword"
                                    ng-click="register(registerUser)" class="btn btn-warning">Register
                            </button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<div ng-if="identity.isAuthenticated()">
    <div class="bs-component col-md-3">
        <h3>My Projects</h3>
        <table class="pattern-style-a col-md-12">
            <thead>
            <tr>
                <th scope="col">Name</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="project in projects">
                <td><a href="#/projects/{{project.Id}}">{{project.Name}}</a></td>
            </tr>
            </tbody>
        </table>
    </div>

    <div class="bs-component col-md-9">
        <h3>My Issues</h3>
        <table class="pattern-style-a col-md-12">
            <thead>
            <tr>
                <th scope="col">Title</th>
                <th scope="col">Description</th>
                <th scope="col">Project</th>
                <th scope="col">Due Date</th>
                <th scope="col">Author</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="issue in issues">
                <td><a href="#/issues/{{issue.Id}}">{{issue.Title}}</a></td>
                <td>{{issue.Description}}</td>
                <td>{{issue.Project.Name}}</td>
                <td>{{issue.DueDate | date: medium}}</td>
                <td>{{issue.Author.Username}}</td>
            </tr>
            </tbody>
        </table>
        <pagination total-items="totalCount" ng-model="pagination.currentPage" items-per-page="pagination.pageSize"
                    ng-change="pageChanged()"
                    max-size="8" boundary-links="true">
        </pagination>
    </div>
</div>

