2018-10-27 15:45:05 +02:00
|
|
|
{{define "content"}}
|
|
|
|
<script type="text/javascript">
|
|
|
|
var pM = 1;
|
2018-10-27 17:22:45 +02:00
|
|
|
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);
|
2018-10-27 17:22:45 +02:00
|
|
|
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>
|
|
|
|
<div class="checkoutSummaryColumn"><input required type="text" name="fname" id="fname"></div>
|
|
|
|
</div>
|
|
|
|
<div class="checkoutSummary">
|
|
|
|
<div class="checkoutSummaryColumn">Nazwisko:</div>
|
|
|
|
<div class="checkoutSummaryColumn"><input required type="text" name="lname" id="lname"></div>
|
|
|
|
</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
|
2018-10-27 17:22:45 +02:00
|
|
|
<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">
|
2018-10-27 17:22:45 +02:00
|
|
|
<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> zł<br><br></div>
|
|
|
|
<input type="button" value="Zapłać" onclick="pay();">
|
2018-10-27 15:45:05 +02:00
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
2018-10-27 17:22:45 +02:00
|
|
|
calculatedelivery();
|
2018-10-27 15:45:05 +02:00
|
|
|
</script>
|
|
|
|
{{end}}
|