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