String pageSettings() {

  String ptr = "<!DOCTYPE html> <html>\n";
  ptr += "<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n";
  ptr += "<link href=\"https://fonts.googleapis.com/css?family=Open+Sans:300,400,600\" rel=\"stylesheet\">\n";
  ptr += "<meta charset=\"utf-8\" />";

  ptr += "<title>Terarium - nastavení</title>\n";
  ptr += "<link media=\"all\" rel=\"stylesheet\" href=\"/style.css\" />\n";

  ptr += "</head>\n";
  ptr += "<body>\n";

  ptr += "<div id=\"webpage\">\n";

  ptr += "<h1>Terarium - nastavení</h1>\n";

  ptr += "<div class=\"center\">Verze: " + String(version) + "</div>";
  ptr += "<div class=\"center\">Aktuální čas: " + time_getFormattedTime() + "</div>\n";

  ptr += "<div class=\"center\"><a href=\"/\">Zpět na přehled</a></div>";

  ptr += "<form action=\"/settings_save\" method=\"post\">\n";

// rele 1
  ptr += "<div class=\"setting_row\">\n";
  ptr += "<fieldset>";
  ptr += "<legend>Relé 1:</legend>";
  ptr += "<table class=\"center\">\n";
  ptr += "<tr><td>povoleno</td><td><input type=\"checkbox\" name=\"relay1_enable\" value=\"1\""; 
  if(pref.getBool("r1_enable", true)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>název</td><td><input type=\"text\" id=\"r1_on\" name=\"relay1_name\" value=\"" + pref.getString("r1_name", "Relay 1") + "\"></td></tr>\n";
    ptr += "<tr><td>negovat</td><td><input type=\"checkbox\" name=\"relay1_negation\""; 
  if(pref.getBool("r1_neg", false)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>zapnout</td><td><input type=\"time\" id=\"r1_on\" name=\"relay1_on\" value=\"" + pref.getString("r1_on_h", "00") + ":" + pref.getString("r1_on_m", "00") + "\"></td></tr>\n";
  ptr += "<tr><td>vypnout</td><td><input type=\"time\" id=\"r1_off\" name=\"relay1_off\" value=\"" + pref.getString("r1_off_h", "01") + ":" + pref.getString("r1_off_m", "00") + "\"></td></tr>\n";
  ptr += "</table>\n";
  ptr += "</fieldset>";
  ptr += "</div>\n";

// rele 2
  ptr += "<div class=\"setting_row\">\n";
   ptr += "<fieldset>";
  ptr += "<legend>Relé 2:</legend>";
  ptr += "<table class=\"center\">\n";
  ptr += "<tr><td>povoleno</td><td><input type=\"checkbox\" name=\"relay2_enable\" value=\"1\""; 
  if(pref.getBool("r2_enable", true)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>název</td><td><input type=\"text\" id=\"r1_on\" name=\"relay2_name\" value=\"" + pref.getString("r2_name", "Relay 2") + "\"></td></tr>\n";
    ptr += "<tr><td>negovat</td><td><input type=\"checkbox\" name=\"relay2_negation\""; 
  if(pref.getBool("r2_neg", false)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>zapnout</td><td><input type=\"time\" id=\"r2_on\" name=\"relay2_on\" value=\"" + pref.getString("r2_on_h", "01") + ":" + pref.getString("r2_on_m", "00") + "\"></td></tr>\n";
  ptr += "<tr><td>vypnout</td><td><input type=\"time\" id=\"r2_off\" name=\"relay2_off\" value=\"" + pref.getString("r2_off_h", "02") + ":" + pref.getString("r2_off_m", "00") + "\"></td></tr>\n";
  ptr += "</table>\n";
  ptr += "</fieldset>";
  ptr += "</div>\n";

// rele 3
  ptr += "<div class=\"setting_row\">\n";
   ptr += "<fieldset>";
  ptr += "<legend>Relé 3:</legend>";
  ptr += "<table class=\"center\">\n";
  ptr += "<tr><td>povoleno</td><td><input type=\"checkbox\" name=\"relay3_enable\""; 
  if(pref.getBool("r3_enable", true)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>název</td><td><input type=\"text\" id=\"r1_on\" name=\"relay3_name\" value=\"" + pref.getString("r3_name", "Relay 3") + "\"></td></tr>\n";
    ptr += "<tr><td>negovat</td><td><input type=\"checkbox\" name=\"relay3_negation\""; 
  if(pref.getBool("r3_neg", false)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>zapnout</td><td><input type=\"time\" id=\"r3_on\" name=\"relay3_on\" value=\"" + pref.getString("r3_on_h", "02") + ":" + pref.getString("r3_on_m", "00") + "\"></td></tr>\n";
  ptr += "<tr><td>vypnout</td><td><input type=\"time\" id=\"r3_off\" name=\"relay3_off\" value=\"" + pref.getString("r3_off_h", "03") + ":" + pref.getString("r3_off_m", "00") + "\"></td></tr>\n";
  ptr += "</table>\n";
  ptr += "</fieldset>";
  ptr += "</div>\n";

// rele 4
  ptr += "<div class=\"setting_row\">\n";
   ptr += "<fieldset>";
  ptr += "<legend>Relé 4:</legend>";
  ptr += "<table class=\"center\">\n";
  ptr += "<tr><td>zapnuto</td><td><input type=\"checkbox\" name=\"relay4_enable\""; 
  if(pref.getBool("r4_enable", true)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>název</td><td><input type=\"text\" id=\"r1_on\" name=\"relay4_name\" value=\"" + pref.getString("r4_name", "Relay 4") + "\"></td></tr>\n";
    ptr += "<tr><td>negovat</td><td><input type=\"checkbox\" name=\"relay4_negation\""; 
  if(pref.getBool("r4_neg", false)) {
    ptr += " checked=\"checked\" ";
  }
  ptr += "/></td></tr>\n";
  ptr += "<tr><td>zapnout</td><td><input type=\"time\" id=\"r4_on\" name=\"relay4_on\" value=\"" + pref.getString("r4_on_h", "03") + ":" + pref.getString("r4_on_m", "00") + "\"></td></tr>\n";
  ptr += "<tr><td>vypnout</td><td><input type=\"time\" id=\"r4_off\" name=\"relay4_off\" value=\"" + pref.getString("r4_off_h", "04") + ":" + pref.getString("r4_off_m", "00") + "\"></td></tr>\n";
  ptr += "</table>\n";
  ptr += "</fieldset>";
  ptr += "</div>\n";

// ntp a cas
  ptr += "<div class=\"setting_row\">\n";
  ptr += "<label class=\"setting\" for=\"ntp\">NTP server:</label><br>\n";
  ptr += "<input type=\"text\" id=\"ntp\" name=\"ntp\" value=\"" + pref.getString("ntp", "europe.pool.ntp.org") + "\"/>\n";
  ptr += "</div>\n";

  ptr += "<div class=\"setting_row\">\n";
  ptr += "<input type=\"submit\" value=\"Uložit\"/>\n";
  ptr += "</div>\n";

  ptr += "</form>\n";

  ptr += "<div class=\"setting_row\">\n";
  ptr += "<form method='POST' action='/update' enctype='multipart/form-data'>";
  ptr += "<label class=\"setting\" for=\"update\">Update:</label><br>";
  ptr += "<input type= \"file\" name=\"update\" id=\"update\" accept=\".bin\"><input type=\"submit\" value=\"Update\">";
  ptr += "</form>";
  ptr += "</div>\n";
  

  ptr += "</div>\n";
  ptr += "</body>\n";
  ptr += "</html>\n";
  return ptr;
}