From 536e4db3309a37455465bb2b2967f106d2b99ddf Mon Sep 17 00:00:00 2001 From: arf20 Date: Wed, 20 Mar 2024 00:55:38 +0100 Subject: Update eerything on dropdown click order --- order.php | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'order.php') diff --git a/order.php b/order.php index 5384196..12984ff 100644 --- a/order.php +++ b/order.php @@ -91,35 +91,26 @@ function genoption($id, $name) { document.getElementById("description").innerHTML = service["description"]; if (service["name"] == "vps") { document.getElementById("extraform").innerHTML - = `


-

-

+ = `


+

+


`; } else document.getElementById("extraform").innerHTML = ""; - updatecomment(); - calcprice(); + update(); } - function updatecomment() { + function update() { var comment = document.getElementById("commentbox").value; if (service["name"] == "vps") { var cpus = document.getElementById("cpus").value; var mem = document.getElementById("mem").value; var ssd = document.getElementById("ssd").value; document.getElementById("comments").value = "Options:\ncpus: " + cpus + "\nmem: " + mem + "GB\nssd: " + ssd + "GB\n\nClient comment:\n" + comment; - } else document.getElementById("comments").value = "Client comment:\n" + comment; - } - - function calcprice() { - if (service["name"] == "vps") { - var cpus = Number(document.getElementById("cpus").value); - var mem = Number(document.getElementById("mem").value); - var ssd = Number(document.getElementById("ssd").value); - var price = (1*cpus**2) + (0.5*mem**2) + (0.02*ssd**2); + var price = (1*Number(cpus)**2) + (0.5*Number(mem)**2) + (0.02*Number(ssd)**2); document.getElementById("calculated").innerHTML = "Calculated price: " + price + " €/mo"; document.getElementById("billing").value = price + " €/mo"; } else { - //document.getElementById("calculated").innerHTML = "Calculated price: " + service["billing"]; + document.getElementById("comments").value = "Client comment:\n" + comment; document.getElementById("billing").value = service["billing"]; } } -- cgit v1.2.3