cleanup code

This commit is contained in:
Joerg Lehmann 2021-03-20 17:58:14 +01:00
parent fbac0c8d26
commit 3fad7f2d6d
1 changed files with 2 additions and 18 deletions

View File

@ -8,21 +8,11 @@ function validate(what, text) {
$(document).ready(function () { $(document).ready(function () {
$(".show-modal").click(function () { $(".show-modal").click(function () {
$("#alias_exclamation").hide(); $("#alias_exclamation").hide();
$("#smsnumber_exclamation").hide();
var alias = $(this).prev().html(); var alias = $(this).prev().html();
var deveui = $(this).prev().attr('id').replace("alias_", ""); var deveui = $(this).prev().attr('id').replace("alias_", "");
$('#deveui').html(deveui); $('#deveui').html(deveui);
var alarmactive = $('#alarmactive_' + deveui).html();
var smsnumber = $('#smsnumber_' + deveui).html();
$("#alias").val(alias); $("#alias").val(alias);
console.log(alarmactive);
if (alarmactive == "1") {
$('#checkbox').prop('checked', true);
} else {
$('#checkbox').prop('checked', false);
}
$("#smsnumber").val(smsnumber);
$("#modal").addClass("is-active"); $("#modal").addClass("is-active");
}); });
@ -118,11 +108,6 @@ $(document).ready(function () {
}); });
$("#modal-save").click(function () { $("#modal-save").click(function () {
var alarmactive = "0";
if ($('#checkbox').prop('checked')) {
alarmactive = "1";
}
// Validation Code // Validation Code
var is_valid = true; var is_valid = true;
if (!validate('alias', $('#alias').val())) { if (!validate('alias', $('#alias').val())) {
@ -141,7 +126,7 @@ $(document).ready(function () {
} }
$.ajax({ $.ajax({
url: "save_scale_settings", url: "save_tracker_settings",
type: "get", //send it through get method type: "get", //send it through get method
dataType: "json", dataType: "json",
data: { data: {
@ -294,7 +279,6 @@ var woBischIcon = L.icon({
var maps = []; var maps = [];
$(document).ready(function () { $(document).ready(function () {
$(".tracker").each(function (index) { $(".tracker").each(function (index) {
console.log('Draw Map (' + index + "): " + $(this).find(".alias").html());
deveui = $(this).find("div").first().attr("id"); deveui = $(this).find("div").first().attr("id");
lat = $(this).find("#lat").html(); lat = $(this).find("#lat").html();
@ -322,4 +306,4 @@ $(document).ready(function () {
}); });
}); });