<!-- Page Content -->
<dialog-close title="Edit {{ user.Username }} settings">

    <div class="form-group">
        <label class="col-sm-2 control-label">Name</label>
        <div class="col-sm-9">
            <button type="button" class="btn btn-primary dropdown-toggle btn-select btn-block" data-toggle="dropdown" href="">
                <span class="pull-left">{{ tmpSetting.Name }} {{ userSettings[tmpSetting.Name] == null ? '' : '*' }}</span>
                <span class="caret pull-right text-center"></span>
            </button>
            <ul class="dropdown-menu col-sm-12">
                <li>
                    <a href="" ng-repeat="setting in userEffectiveSettings" ng-click="setTmpSetting(setting.Name)">
                        {{ setting.Name }} {{ userSettings[setting.Name] == null ? '' : '*' }}
                    </a>
                </li>
            </ul>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">Blocked</label>
        <div class="col-sm-9">
            <button type="button" class="btn btn-primary dropdown-toggle btn-select btn-block" data-toggle="dropdown" href="">
                <span class="pull-left">{{ tmpSetting.IsBlocked ? 'Yes' : 'No' }}</span>
                <span class="caret pull-right"></span>
            </button>
            <ul class="dropdown-menu col-sm-12">
                <li><a href="" ng-click="tmpSetting.IsBlocked = false">No</a></li>
                <li><a href="" ng-click="tmpSetting.IsBlocked = true">Yes</a></li>
            </ul>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label" for="Value">Value</label>
        <div class="col-sm-9">
            <textarea id="Value" ng-model="tmpSetting.Value" ng-if="tmpSetting.Type == 'string'" class="form-control"
                      ng-disabled="userEffectiveSettings.length == 0"></textarea>

            <input id="Value" ng-model="tmpSetting.Value" ng-if="tmpSetting.Type == 'int' || tmpSetting.Type == 'float'"
                   class="form-control" type="number" required ng-disabled="userEffectiveSettings.length == 0"/>

            <div class="col-sm-9" ng-if="tmpSetting.Type == 'object'" ng-disabled="userEffectiveSettings.length == 0">{{ tmpSetting.Value }}</div>

            <div class="btn-group" ng-if="tmpSetting.Type == 'bool'">
                <button type="button" class="btn btn-primary dropdown-toggle btn-select" data-toggle="dropdown" href=""
                        ng-disabled="userEffectiveSettings.length == 0">
                    {{ tmpSetting.Value ? 'Yes' : 'No' }} <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="" ng-click="tmpSetting.Value = false">No</a></li>
                    <li><a href="" ng-click="tmpSetting.Value = true">Yes</a></li>
                </ul>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-9 col-sm-offset-2">
            <div class="col-sm-6">
                <button type="button" class="btn btn-primary btn-block" href="" ng-click="editSetting(tmpSetting)">
                    Save
                </button>
            </div>
            <div class="col-sm-6">
                <button type="button" class="btn btn-danger btn-block" href="" ng-click="resetSetting(tmpSetting)">
                    Reset
                </button>
            </div>
        </div>
    </div>

</dialog-close>
