-
Notifications
You must be signed in to change notification settings - Fork 4
/
_checkout.html
106 lines (106 loc) · 5.56 KB
/
_checkout.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!-- Wappler include head-page="index.html" appconnect="local" is="dmx-app" bootstrap4="local" fontawesome_5="cdn" jquery_slim_33="local" components="{"dmxFormatter":{},"dmxValidator":{},"dmxBootstrap4Alert":{}}" id="checkout" -->
<section id="checkout">
<div dmx-repeat:rptcheckoutitems="dsCart.data">
<div dmx-repeat:rptdatabaseitems="scProducts.data.rptProducts.where(`ProductID`, productid, "==")">
<input type="hidden" id="checkoutcheckname" dmx-bind:value="productname == ProductName ? varCheckoutCheck.value : varCheckoutCheck.setValue(0)">
<input type="hidden" id="checkoutcheckprice" dmx-bind:value="productprice == ProductPrice ? varCheckoutCheck.value : varCheckoutCheck.setValue(0)">
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="mt-3">Checkout</h1>
</div>
</div>
<div class="row" dmx-hide="dsCart.data.hasItems()">
<div class="col">
<h5 class="text-danger">Your cart is empty!</h5>
</div>
<div class="col text-right">
<button class="btn btn-primary" dmx-on:click="browser.goto('./products/all')"><i class="fas fa-arrow-alt-circle-left fa-lg"></i> Continue Shopping</button>
</div>
</div>
<div class="row" dmx-show="varCheckoutCheck.value == 0">
<div class="col">
<div class="alert alert-danger" role="alert">
<h3>Oops, something has gone wrong!</h3>
<p>We apologise for the inconvenience, please contact us to explain the actions leading up to this error message.</p>
</div>
</div>
</div>
<div class="row" dmx-show="(dsCart.data.hasItems() && varCheckoutCheck.value == 1)">
<div class="col-12 col-md-6 order-md-2">
<div class="row">
<div class="col-12">
<h5>Order Summary</h5>
<div class="table-responsive">
<table id="tblCheckout" class="table" dmx-show="dsCart.data.hasItems()">
<thead>
<tr>
<th>Product </th>
<th class="text-center">Price</th>
<th class="text-center">Quantity</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="dsCart.data" id="rptCheckoutCartItems" dmx-show="dsCart.data.hasItems()">
<tr>
<td dmx-text="productname"></td>
<td class="text-center" dmx-text="productprice.formatCurrency("$", ".", ",", "2")"></td>
<td class="text-center">{{quantity}}</td>
<td class="text-right">
{{(productprice * quantity * varCheckoutCheck.value).formatCurrency("$", ".", ",", "2")}}
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="3" class="text-right">Total Amount </th>
<td class="text-right">{{(dsCart.data.sum(`productprice * quantity * varCheckoutCheck.value`)).formatCurrency("$", ".", ",", "2")}} </td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col" dmx-show="(varLoggedin.value >= 1)">
<h5>Shipping Details</h5>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td dmx-text="scLoggedinCustomer.data.qryCustomer.CustomerFirstName + ' ' + scLoggedinCustomer.data.qryCustomer.CustomerLastName"></td>
</tr>
<tr>
<td dmx-text="scLoggedinCustomer.data.qryCustomer.CustomerAddress"></td>
</tr>
<tr>
<td dmx-text="scLoggedinCustomer.data.qryCustomer.CustomerZip + ' ' + scLoggedinCustomer.data.qryCustomer.CustomerCity"></td>
</tr>
<tr>
<td dmx-text="scLoggedinCustomer.data.qryCustomer.CustomerCountry"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<button class="btn btn-primary btn-block" dmx-on:click="mdlRegisterCustomer.show()" dmx-hide="(varLoggedin.value >= 1)">Add User Detail</button>
<form id="frmPay" method="post" is="dmx-serverconnect-form" action="dmxConnect/api/orders/checkout.php" dmx-on:success="dsCart.clear();browser.goto('invoice/' + frmPay.data.lastinvoice)">
<input id="inp_customerid" name="customerid" type="hidden" dmx-bind:value="scLoggedinCustomer.data.qryCustomer.CustomerID">
<input id="inp_customername" name="customername" type="hidden" dmx-bind:value="scLoggedinCustomer.data.qryCustomer.CustomerFirstName + ' ' + scLoggedinCustomer.data.qryCustomer.CustomerLastName">
<input id="inp_customeremail" name="customeremail" type="hidden" dmx-bind:value="scLoggedinCustomer.data.qryCustomer.CustomerEmail">
<input id="inp_subtotal" name="subtotal" type="hidden" dmx-bind:value="dsCart.data.sum(`productprice * quantity * varCheckoutCheck.value`))">
<div id="record" is="dmx-repeat" dmx-bind:repeat="dsCart.data">
<input id="inp_productname" name="productname" type="hidden" dmx-bind:value="productname" dmx-bind:name="record[{{$index}}][productname]">
<input id="inp_price" name="price" type="hidden" dmx-bind:value="productprice" dmx-bind:name="record[{{$index}}][price]">
<input id="inp_qty" name="qty" type="hidden" dmx-bind:value="quantity" dmx-bind:name="record[{{$index}}][qty]">
</div>
<button class="btn btn-primary btn-block" dmx-show="(varLoggedin.value >= 1)" type="submit">Pay
{{(dsCart.data.sum(`productprice * quantity * varCheckoutCheck.value`)).formatCurrency("$", ".", ",", "2")}}</button>
</form>
</div>
</div>
</div>
</section>