Commit 0e66a247 authored by endk-mirror-svc's avatar endk-mirror-svc

Got the site ready for this year

parent f54d19dc
......@@ -101,13 +101,13 @@
<p class="lead">Udfyld venligst nedenstående formular for at bestille Issers pakkekalender</p>
<form id="order">
<div class="form-group" id="name_group">
<input type="text" class="form-control" id="name" placeholder="Ejer's Navn" onchange="validateInput('name_group', 'name')">
<input type="text" class="form-control" id="name" placeholder="Ejers Navn" onchange="validateInput('name_group', 'name')">
</div>
<div class="form-group" id="dog_name_group">
<input type="text" class="form-control" id="dog_name" placeholder="Hund(es) Navn" onchange="validateInput('dog_name_group', 'dog_name')">
<input type="text" class="form-control" id="dog_name" placeholder="Hund(es) Navn(e)" onchange="validateInput('dog_name_group', 'dog_name')">
</div>
<div class="form-group" id="address_group">
<input type="text" class="form-control" id="address" placeholder="Vejnavn & husnummer" onchange="validateInput('address_group', 'address')">
<input type="text" class="form-control" id="address" placeholder="Adresse" onchange="validateInput('address_group', 'address')">
</div>
<div class="form-group" id="zip_group">
<input type="text" class="form-control" id="zip" placeholder="Postnummer" onchange="validateInput('zip_group', 'zip')">
......@@ -118,9 +118,6 @@
<div class="form-group" id="amount_group">
<input type="number" class="form-control" id="amount" placeholder="Antal alm." onchange="getPrice();validateInput('amount_group', 'amount')">
</div>
<div class="form-group" id="amount_allergy_group">
<input type="number" class="form-control" id="amount_allergy" placeholder="Antal allergi" onchange="getPrice();validateInput('amount_allergy_group', 'amount_allergy')">
</div>
</form>
<p class="text-right hidden" id="total_wrapper">Total: <strong id="total"></strong> kr.</p>
<button type="submit" class="btn btn-lg btn-success" onclick="orderUp();">Bestil</button>
......@@ -128,7 +125,7 @@
</div>
<footer class="footer">
<p>&copy; v42 2017</p>
<p>&copy; IsserBadisser (CVR 39574837) 2018</p>
</footer>
</div> <!-- /container -->
......@@ -152,7 +149,6 @@ function orderUp() {
var zip_valid = false;
var number_valid = false;
var amount_valid = false;
var amount_allergy_valid = false;
var classList = document.getElementById('name_group').className.split(/\s+/);
for (var i = 0; i < classList.length; i++) {
......@@ -190,13 +186,7 @@ function orderUp() {
amount_valid = true
}
}
var classList = document.getElementById('amount_allergy_group').className.split(/\s+/);
for (var i = 0; i < classList.length; i++) {
if (classList[i] === 'has-success') {
amount_allergy_valid = true
}
}
if ( name_valid && dog_name_valid && address_valid && zip_valid && number_valid && amount_valid && amount_allergy_valid ) {
if ( name_valid && dog_name_valid && address_valid && zip_valid && number_valid && amount_valid ) {
var doc = {
time: new Date().getTime(),
name: $('#name').val(),
......@@ -204,8 +194,7 @@ function orderUp() {
address: $('#address').val(),
zip: $('#zip').val(),
number: $('#number').val(),
amount: $('#amount').val(),
amount_allergy: $('#amount_allergy').val()
amount: $('#amount').val()
};
$.post('http://127.0.0.1:8080/orders', JSON.stringify(doc), function(data, statusText, xhr) {
if (xhr.status == 200) {
......@@ -249,9 +238,6 @@ function clear() {
$('#amount').val("");
$('#amount_group').removeClass("has-success");
$('#amount_group').removeClass("has-error")
$('#amount_allergy').val("");
$('#amount_allergy_group').removeClass("has-success");
$('#amount_allergy_group').removeClass("has-error")
$("#total_wrapper").addClass('hidden');
}
......@@ -271,15 +257,11 @@ function getPrice()
{
var theForm = document.forms["order"];
var quantity1 = theForm.elements["amount"].value;
var quantity2 = theForm.elements["amount_allergy"].value;
var howmany = 0;
if (isNaN(quantity1) === false) {
howmany = howmany+parseInt(quantity1)
}
if (isNaN(quantity2) === false) {
howmany = howmany+parseInt(quantity2)
}
document.getElementById("total").innerHTML = howmany*230;
document.getElementById("total").innerHTML = howmany*250;
if (howmany == 0) {
$("#total_wrapper").addClass('hidden');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment