69 lines
2.5 KiB
HTML
69 lines
2.5 KiB
HTML
|
{{define "content"}}
|
||
|
<script type="text/javascript">
|
||
|
var pM = 1;
|
||
|
function calculateShipment() {
|
||
|
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("shipmentDate").innerHTML = date.toLocaleDateString();
|
||
|
}
|
||
|
|
||
|
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!='')
|
||
|
location.href = 'http://127.0.0.1:8000/paymentDone?fn=' + fN + '&ln=' + lN + "&pm=" + pM;
|
||
|
}
|
||
|
</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
|
||
|
<input type="radio" name="payment" value="2" onchange="paymentMethodChanged(value)"> Raty 0% na 24 mies.<br>
|
||
|
</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="shipment">Data dostawy: <span id="shipmentDate"></span></div><br>
|
||
|
<div id="loanPayment" style="display: none;">Wysokość raty miesięcznej: <span id="loanPaymentinstallment">0</span> zł</div>
|
||
|
<br><input type="button" value="Zapłać" onclick="pay();">
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
calculateShipment();
|
||
|
</script>
|
||
|
{{end}}
|