|
|
|
@@ -154,19 +154,34 @@ function onChangeDinAsset() { |
|
|
|
|
|
|
|
function onFormSubmit() { |
|
|
|
$("#submit").on("click", function(e) { |
|
|
|
console.log($('#form-risk').serializeArray()); |
|
|
|
$.ajax({ |
|
|
|
url: "/calculate-risk", |
|
|
|
method: "post", |
|
|
|
data: $('#form-risk').serializeArray(), |
|
|
|
success: function (data) { |
|
|
|
console.log(data); |
|
|
|
}, |
|
|
|
error: function (xhr, msg, three) { |
|
|
|
messageBox(false, "Fehler bei der Anfrage."); |
|
|
|
}, |
|
|
|
dataType: "json" |
|
|
|
}); |
|
|
|
e.preventDefault(); |
|
|
|
let cycleVal = $("#cycle").val(); |
|
|
|
if (cycleVal === '') { |
|
|
|
messageBox(false, "Bitte geben Sie Ihren aktuellen Zyklus ein."); |
|
|
|
} else { |
|
|
|
let cycleMin = parseInt($("#cycle").attr("min")); |
|
|
|
if (cycleVal < cycleMin) { |
|
|
|
$("#cycle").val(cycleMin); |
|
|
|
messageBox(false, "Zyklus an Minimal-Wert '" + cycleMin + "' angepasst."); |
|
|
|
} |
|
|
|
let cycleMax = parseInt($("#cycle").attr("max")); |
|
|
|
if (cycleVal > cycleMax) { |
|
|
|
$("#cycle").val(cycleMax); |
|
|
|
messageBox(false, "Zyklus an Maximal-Wert '" + cycleMax + "' angepasst."); |
|
|
|
} |
|
|
|
$.ajax({ |
|
|
|
url: "/calculate-risk", |
|
|
|
method: "post", |
|
|
|
data: $('#form-risk').serializeArray(), |
|
|
|
success: function (data) { |
|
|
|
console.log(data); |
|
|
|
}, |
|
|
|
error: function (xhr, msg, three) { |
|
|
|
messageBox(false, "Fehler bei der Anfrage."); |
|
|
|
}, |
|
|
|
dataType: "json" |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|