This commit is contained in:
cereci5049 2024-04-16 20:51:57 +05:30
parent 46bbcf0d02
commit 5c8b347cbe
4 changed files with 28 additions and 25 deletions

View File

@ -59,20 +59,22 @@
<div class="col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Turnover Table</h4>
<h4 class="card-title">Orders Table</h4>
</p>
<table class="table table-striped">
<thead>
<tr>
<th> User </th>
<th> Last name </th>
<th> Email </th>
<th> Orders </th>
<th> Product </th>
<th> Quantity </th>
<th> Price </th>
<th> Order Date </th>
<th> Amount </th>
<th> Address </th>
<th> State </th>
</tr>
</thead>
<tbody>
<tr>
{# <tr>
<td class="py-1">
<img src="/a3b/admin/images/faces-clipart/pic-1.png" alt="image" />
</td>
@ -84,25 +86,21 @@
</td>
<td> $ 77.99 </td>
<td> May 15, 2015 </td>
</tr>
</tr> #}
{# {% for (id, user) in users.pairs() %}
{% for (id, order) in orders.pairs() %}
<tr>
<td class="py-1">
<img src="/a3b/admin/images/faces-clipart/pic-1.png" alt="image" />
</td>
<td>
<a href="/admin/{{user.id}}/show">
{{user.lastName}}
</a>
</td>
<td> {{user.email}} </td>
<td> {{user.totalQuantity}} </td>
<td> ₹ {{user.totalPrice}} </td>
<td> {{order.product.name}} </td>
<td> {{order.quantity}} </td>
<td> ₹ {{order.product.price}} </td>
<td> {{order.createdAt}} </td>
<td> ₹ {{toFloat(order.quantity)*order.product.price}} </td>
<td> {{order.address}} </td>
<td> {{order.state}} </td>
</tr>
{% endfor %} #}
{% endfor %}
<tr>
{# <tr>
<td class="py-1">
<img src="/a3b/admin/images/faces-clipart/pic-2.png" alt="image" />
</td>
@ -179,7 +177,7 @@
</td>
<td> $ 150.00 </td>
<td> June 16, 2015 </td>
</tr>
</tr> #}
</tbody>
</table>
</div>

View File

@ -2,8 +2,9 @@ import db_connector/db_sqlite
import
strutils,
times,
../a3pkg/models,
./users
./[users, products]
proc close*(db: DbConn) =
db.close()
@ -72,6 +73,9 @@ proc getOrders*(db: DbConn, userId: int): seq[Orders]=
order.phoneNumber = row[6]
order.productId = parseInt(row[7])
order.quantity = parseInt(row[8])
order.createdAt = row[9]
# order.orderStatus =
order.product = db.getProductById(order.productId)
orders.add(order)

View File

@ -2,7 +2,7 @@ import
mike,
nimja,
../a3pkg/mics,
../a3c/orders
../a3c/[orders, products]
proc admin*(ctx: Context): string=
var

View File

@ -47,7 +47,8 @@ type
phoneNumber*: string
productId*: int
quantity*: int
createdAt*: DateTime
createdAt*: string
updatedAt*: DateTime
orderStatus*: string
orderDate*: DateTime
product*: Products