<div class="modal" tabindex="-1" role="dialog" aria-hidden="true">
    <form class="form-sport" name="form.groupForm" ng-submit="submit()" novalidate>
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">Edit Schedule</h3>
                </div>
                <div class="modal-body form">
                    <div class="form-group" ng-class="{ 'has-error': form.groupForm.sport.$dirty && form.groupForm.sport.$invalid }">
                        <label class="control-label" for="name">Sport </label>
                        <div class="">
                            <ui-select ng-model="fields.sport" theme="selectize" ng-required="true" on-select="queryLeagues($item)">
                                <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                <ui-select-choices repeat="sport in sports.items | filter: $select.search track by sport.id">
                                    <span ng-bind-html="sport.name | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error': form.groupForm.league.$dirty && form.groupForm.league.$invalid }">
                        <label class="control-label" for="name">League </label>
                        <span class="text-primary fa fa-question-circle" data-title="Please select the Sport first before selecting the League" data-placement="right" bs-tooltip></span>
                        <div class="">
                            <ui-select ng-model="fields.league" theme="selectize" ng-required="true" on-select="queryTeams($item);querySeasons($item)" ng-disabled="fields.sport.id == 0 || fields.sport.id == null">
                                <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                <ui-select-choices repeat="league in leagues.items | filter: $select.search track by league.id">
                                    <span ng-bind-html="league.name | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error': form.groupForm.league.$dirty && form.groupForm.league.$invalid }">
                        <label class="control-label" for="name">Season </label>
                        <span class="text-primary fa fa-question-circle" data-title="Please select the League first before selecting the Season" data-placement="right" bs-tooltip></span>
                        <div class="">
                            <ui-select ng-model="fields.league" theme="selectize" ng-required="true" on-select="queryWeeks($item)" ng-disabled="fields.sport.id == 0 || fields.sport.id == null">
                                <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                <ui-select-choices repeat="season in season.items | filter: $select.search track by season.id">
                                    <span ng-bind-html="season.name | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error': form.groupForm.week.$dirty && form.groupForm.week.$invalid }">
                        <label class="control-label" for="name">Week </label>
                        <span class="text-primary fa fa-question-circle" data-title="Please select the League first before selecting the Week" data-placement="right" bs-tooltip></span>
                        <div class="">
                            <ui-select ng-model="fields.week" theme="selectize" ng-required="true" ng-disabled="fields.league.id == 0 || fields.league.id == null">
                                <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                <ui-select-choices repeat="week in weeks.items | filter: $select.search track by week.id">
                                    <span ng-bind-html="week.name | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th class="homeaway">&nbsp;</th>
                                <th class="">Team</th>
                                <th class="score">Score</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th class="homeaway">Home</th>
                                <td class="">
                                    <ui-select ng-model="fields.teamHome" theme="selectize" ng-required="true" ng-disabled="fields.league.id == 0 || fields.league.id == null">
                                        <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                        <ui-select-choices repeat="team in teams.items | filter: $select.search track by team.id">
                                            <span ng-bind-html="team.name | highlight: $select.search"></span><br>
                                            <span class="small" ng-bind-html="team.group.name"></span>
                                        </ui-select-choices>
                                    </ui-select>
                                </td>
                                <td class="score">
                                    <input type="text" name="" ng-model="fields.scoreHome" class="form-control">
                                </td>
                            </tr>
                            <tr>
                                <th class="homeaway">Away</th>
                                <td class="">
                                    <ui-select ng-model="fields.teamAway" theme="selectize" ng-required="true" ng-disabled="fields.league.id == 0 || fields.league.id == null">
                                        <ui-select-match placeholder="Please select...">{{$select.selected.name}}</ui-select-match>
                                        <ui-select-choices repeat="team in teams.items | filter: $select.search track by team.id">
                                            <span ng-bind-html="team.name | highlight: $select.search"></span><br>
                                            <span class="small" ng-bind-html="team.group.name"></span>
                                        </ui-select-choices>
                                    </ui-select>
                                </td>
                                <td class="score">
                                    <input type="text" name="" ng-model="fields.scoreAway" class="form-control">
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="modal-footer">
                    <button id="submit" name="submit" class="btn btn-labeled btn-primary" ng-disabled="form.groupForm.$invalid || isSubmitted"><span class="btn-label"><i class="fa fa-upload"></i></span> Submit</button>
                    <button class="btn btn-default btn-labeled" type="button" ng-click="modalEditActions.hide()"><span class="btn-label"><i class="fa fa-times"></i></span> Cancel</button>
                </div>
            </div>
        </div>
    </form>
</div>