Elektromarket/templates/checkout.html

71 lines
2.6 KiB
HTML
Raw Normal View History

2018-10-27 15:45:05 +02:00
{{define "content"}}
<script type="text/javascript">
var pM = 1;
var dD = 0;
function calculatedelivery() {
2018-10-27 15:45:05 +02:00
var date = new Date();
var days = 2;
var dayOfWeek = date.getDay()
if (dayOfWeek == 4 || dayOfWeek == 5)
days = 4;
else if (dayOfWeek == 6)
days = 3;
date.setDate(date.getDate() + days);
document.getElementById("deliveryDate").innerHTML = date.toLocaleDateString();
dD = date.toLocaleDateString();
2018-10-27 15:45:05 +02:00
}
function paymentMethodChanged(v) {
pM = v;
var loanPaymentEl = document.getElementById("loanPayment");
switch (v) {
case "1":
loanPaymentEl.style.display = "none";
break;
case "2":
var price = parseInt({{.cart.PriceTotal}});
document.getElementById("loanPaymentinstallment").innerHTML = Math.round(100 * price/24) / 100;
loanPaymentEl.style.display = "block";
break;
}
}
function pay() {
var fN = document.getElementById("fname").value;
var lN = document.getElementById("lname").value;
if (fN!='' && lN!='')
2018-10-27 17:30:25 +02:00
location.href = '/paymentDone?fn=' + fN + '&ln=' + lN + "&pm=" + pM + "&dd=" + dD;
2018-10-27 15:45:05 +02:00
}
</script>
<h1>Podsumowanie</h1>
<div class="checkoutSummary">
<div class="checkoutSummaryColumn">Imię:</div>
2018-11-23 10:31:47 +01:00
<div class="checkoutSummaryColumn"><input required type="text" name="fname" id="fname" autocomplete="given-name"></div>
2018-10-27 15:45:05 +02:00
</div>
<div class="checkoutSummary">
<div class="checkoutSummaryColumn">Nazwisko:</div>
2018-11-23 10:31:47 +01:00
<div class="checkoutSummaryColumn"><input required type="text" name="lname" id="lname" autocomplete="family-name"></div>
2018-10-27 15:45:05 +02:00
</div>
<div class="checkoutSummary">
<div class="checkoutSummaryColumn">Metoda płatności:</div>
<div class="checkoutSummaryColumn">
<form id="paymentMethodRadio">
<input type="radio" name="payment" value="1" checked onchange="paymentMethodChanged(value)"> Gotówka/ karta
<input type="radio" name="payment" value="2" onchange="paymentMethodChanged(value)"> Raty 0% na 24 mies.
2018-10-27 15:45:05 +02:00
</form>
</div>
</div>
<div class="checkoutSummary">
<div class="checkoutSummaryColumn">Kwota zamówienia:</div>
<div class="checkoutSummaryColumn" id="paymentTotal">{{ .cart.PriceTotal }} zł</div>
</div>
<div class="checkoutPayment">
<div id="delivery">Data dostawy: <span id="deliveryDate"></span></div><br>
<div id="loanPayment" style="display: none;">Wysokość raty miesięcznej: <span id="loanPaymentinstallment">0</span><br><br></div>
<input type="button" value="Zapłać" onclick="pay();">
2018-10-27 15:45:05 +02:00
</div>
<script type="text/javascript">
calculatedelivery();
2018-10-27 15:45:05 +02:00
</script>
{{end}}