2013-04-16 21:58:32 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
|
|
|
|
$(document).on('pageshow', "#clientSettingsPage", function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
ApiClient.getServerConfiguration().done(function (config) {
|
|
|
|
|
|
2013-06-24 07:06:25 -07:00
|
|
|
|
$('#txtWeatherLocation', page).val(config.WeatherLocation);
|
2013-04-16 21:58:32 -07:00
|
|
|
|
$('#txtMinResumePct', page).val(config.MinResumePct);
|
|
|
|
|
$('#txtMaxResumePct', page).val(config.MaxResumePct);
|
|
|
|
|
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
|
2013-06-24 07:06:25 -07:00
|
|
|
|
$('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");
|
2013-04-16 21:58:32 -07:00
|
|
|
|
|
|
|
|
|
$('input:first', page).focus();
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function clientSettingsPage() {
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
self.onSubmit = function () {
|
|
|
|
|
var form = this;
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.getServerConfiguration().done(function (config) {
|
|
|
|
|
|
2013-06-24 07:06:25 -07:00
|
|
|
|
config.WeatherLocation = $('#txtWeatherLocation', form).val();
|
|
|
|
|
config.WeatherUnit = $('#selectWeatherUnit', form).val();
|
2013-04-16 21:58:32 -07:00
|
|
|
|
config.MinResumePct = $('#txtMinResumePct', form).val();
|
|
|
|
|
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
|
|
|
|
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
|
|
|
|
|
|
|
|
|
|
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.ClientSettingsPage = new clientSettingsPage();
|
|
|
|
|
|
2013-06-24 07:06:25 -07:00
|
|
|
|
})($, document, window);
|