<div class="modal" tabindex="-1" role="dialog" aria-hidden="true">
    <form class="form-sport" name="form.weekForm" ng-submit="submit()" novalidate>
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">Add Week</h3>
                </div>
                <div class="modal-body form">
                    <div class="form-group" ng-class="{ 'has-error': form.weekForm.number.$dirty && form.weekForm.number.$invalid }">
                        <label class="control-label" for="name">Week Number</label>
                        <div class="">
                            <input id="number" name="number" ng-model="fields.number" type="text" class="form-control" required>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error': form.weekForm.name.$dirty && form.weekForm.name.$invalid }">
                        <label class="control-label" for="name">Week Name</label>
                        <div class="">
                            <input id="name" name="name" ng-model="fields.name" ng-change="slugify()" type="text" class="form-control" required>
                        </div>
                    </div>
                    <!-- Text input-->
                    <div class="form-group" ng-class="{ 'has-error': form.weekForm.slug.$dirty && form.weekForm.slug.$invalid }">
                        <label class="control-label" for="slug">Week Slug</label>
                        <div class="">
                            <input id="slug" name="slug" ng-model="fields.slug" type="text" class="form-control" required fsa-slugify>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error': form.weekForm.sport.$dirty && form.weekForm.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.weekForm.league.$dirty && form.weekForm.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" 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>
                    <!-- Text input-->
                </div>
                <div class="modal-footer">
                    <button id="submit" name="submit" class="btn btn-labeled btn-primary" ng-disabled="form.weekForm.$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="modalAddActions.hide()"><span class="btn-label"><i class="fa fa-times"></i></span> Cancel</button>
                </div>
            </div>
        </div>
    </form>
</div>