47 lines
1.4 KiB
Plaintext
47 lines
1.4 KiB
Plaintext
|
@page "/myorders"
|
||
|
@attribute [Authorize]
|
||
|
@inject OrdersClient OrdersClient
|
||
|
|
||
|
<div class="main">
|
||
|
<TemplatedList Loader="@LoadOrders" ListGroupClass="orders-list">
|
||
|
<Loading>Lade...</Loading>
|
||
|
<Empty>
|
||
|
<h2>Noch keine Bestellungen</h2>
|
||
|
<a class="btn btn-success" href="">Bestell eine Pizza</a>
|
||
|
</Empty>
|
||
|
<Item Context="item">
|
||
|
<div class="col">
|
||
|
<h5>@item.Order.CreatedTime.ToLongDateString()</h5>
|
||
|
Produkte:
|
||
|
<strong>@item.Order.Pizzas.Count()</strong>;
|
||
|
Gesamtpreis:
|
||
|
<strong>€@item.Order.GetFormattedTotalPrice()</strong>
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
Status: <strong>@item.StatusText</strong>
|
||
|
</div>
|
||
|
<div class="col flex-grow-0">
|
||
|
<a href="myorders/@item.Order.OrderId" class="btn btn-success">
|
||
|
Verfolgen >
|
||
|
</a>
|
||
|
</div>
|
||
|
</Item>
|
||
|
</TemplatedList>
|
||
|
</div>
|
||
|
|
||
|
@code {
|
||
|
async Task<IEnumerable<OrderWithStatus>> LoadOrders()
|
||
|
{
|
||
|
var ordersWithStatus = Enumerable.Empty<OrderWithStatus>();
|
||
|
try
|
||
|
{
|
||
|
ordersWithStatus = await OrdersClient.GetOrders();
|
||
|
}
|
||
|
catch (AccessTokenNotAvailableException ex)
|
||
|
{
|
||
|
ex.Redirect();
|
||
|
}
|
||
|
return ordersWithStatus;
|
||
|
}
|
||
|
}
|