Browse Source

added order recieved page

missing localization
pull/56/head
Galip Tolga Erdem 5 years ago
parent
commit
9e2b2341ed
  1. 59
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml
  2. 23
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml.cs
  3. 3
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs
  4. 30
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml
  5. 8
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml.cs
  6. 19
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/orderReceived.css

59
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml

@ -0,0 +1,59 @@
@page "{orderNo:int}"
@using System.Globalization
@model EShopOnAbp.PublicWeb.Pages.OrderReceivedModel
@{
decimal orderTotal = 0;
Model.ReceivedOrder.Items.ForEach(q => orderTotal += q.Units * q.UnitPrice);
string orderTotalString = orderTotal.ToString("C", new CultureInfo("en-US")); // We work with USD any ways
string orderNoString = Model.ReceivedOrder.OrderNo.ToString("N0", new NumberFormatInfo() {NumberGroupSeparator = " "});
}
@section styles{
<abp-style src="/Pages/orderReceived.css"/>
}
@{
var paymentIcon = Model.ReceivedOrder.PaymentType == "paypal" ? "fa-cc-paypal" : "fa-credit-card";
}
<abp-row class="justify-content-center p-5">
<abp-card class="col-lg-10 col-md-10 col-sm-12 shadow">
<abp-card-body>
<abp-row class="p-5">
<abp-column size="_1">
<i class="fa fa-3x fa-check-circle" style="color: greenyellow"></i>
</abp-column>
<abp-column>
<div>
<h4>Sipariş alındı!</h4>
<p>Siparişiniz ile ilgili detaylar <strong>@Model.ReceivedOrder.Buyer.Email</strong> adresine gönderildi. <a href="/MyOrders">Siparişlerime git</a></p>
</div>
</abp-column>
</abp-row>
<abp-row>
<abp-column>
<div class="ro-title">Sipariş Numarası</div>
<div class="ro-body ro-ono">
@orderNoString
</div>
</abp-column>
<abp-column>
<div class="ro-title">Teslimat Adresi</div>
<div class="ro-body ro-large">
@Model.ReceivedOrder.Address.Description
</div>
<div>@Model.ReceivedOrder.Address.Street - @Model.ReceivedOrder.Address.ZipCode</div>
<div>@Model.ReceivedOrder.Address.City / @Model.ReceivedOrder.Address.Country</div>
</abp-column>
<abp-column>
<div class="ro-title">Ödenen Tutar</div>
<div class="ro-body ro-large">@orderTotalString</div>
<div class="pt-2">
<i class="fa fa-5x @paymentIcon" style="color:indigo"></i>
</div>
</abp-column>
</abp-row>
<abp-row class="p-5"></abp-row>
</abp-card-body>
</abp-card>
</abp-row>

23
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml.cs

@ -0,0 +1,23 @@
using System.Threading.Tasks;
using EShopOnAbp.OrderingService.Orders;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace EShopOnAbp.PublicWeb.Pages;
public class OrderReceivedModel : AbpPageModel
{
private readonly IOrderAppService _orderAppService;
[BindProperty(SupportsGet = true)] public int OrderNo { get; set; }
public OrderDto ReceivedOrder { get; set; }
public OrderReceivedModel(IOrderAppService orderAppService)
{
_orderAppService = orderAppService;
}
public async Task OnGet(int orderNo)
{
ReceivedOrder = await _orderAppService.GetByOrderNoAsync(orderNo);
}
}

3
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs

@ -58,6 +58,7 @@ public class PaymentModel : AbpPageModel
var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreationDto var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreationDto
{ {
OrderId = placedOrder.Id.ToString(), OrderId = placedOrder.Id.ToString(),
OrderNo = placedOrder.OrderNo,
BuyerId = CurrentUser.GetId().ToString(), BuyerId = CurrentUser.GetId().ToString(),
Currency = EShopOnAbpPaymentConsts.Currency, Currency = EShopOnAbpPaymentConsts.Currency,
Products = ObjectMapper.Map<List<BasketItemDto>, List<PaymentRequestProductCreationDto>>(basket.Items) Products = ObjectMapper.Map<List<BasketItemDto>, List<PaymentRequestProductCreationDto>>(basket.Items)
@ -80,7 +81,7 @@ public class PaymentModel : AbpPageModel
{ {
City = address.City, City = address.City,
Country = address.Country, Country = address.Country,
Description = address.Description, Description = address.Type,
Street = address.Street, Street = address.Street,
ZipCode = address.ZipCode ZipCode = address.ZipCode
}; };

30
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml

@ -1,24 +1,16 @@
@page @page
@model EShopOnAbp.PublicWeb.Pages.PaymentCompletedModel @model EShopOnAbp.PublicWeb.Pages.PaymentCompletedModel
@section styles{
}
<div class="container"> <div class="container">
<abp-row class="justify-content-center p-5">
@if (Model.IsSuccessful) <abp-card class="col-lg-6 col-md-6 col-sm-8 shadow" style="text-align: center; line-height: 3rem">
{ @* <img class="card-img-top" src="..." alt="Card image cap"> *@
<abp-row class="justify-content-center p-5"> <abp-card-body>
<abp-card class="col-lg-6 col-md-6 col-sm-8 shadow" style="text-align: center; line-height: 3rem"> <h4 class="card-title" style="text-align: center">Order Failed!</h4>
@* <img class="card-img-top" src="..." alt="Card image cap"> *@ <p class="card-text">It seems there is a problem with your payment </p>
<abp-card-body> <p class="card-text">Please check your payment method!</p>
<h4 class="card-title" style="text-align: center">Order Recieved!</h4> <a href="/" class="btn btn-primary">Continue Shopping</a>
<p class="card-text">Thank you for your payment. Your purchase is completed. </p> </abp-card-body>
<p class="card-text">You can check our recommended products below.</p> </abp-card>
<a href="/" class="btn btn-primary">Continue Shopping</a> </abp-row>
</abp-card-body>
</abp-card>
</abp-row>
}
</div> </div>

8
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml.cs

@ -22,10 +22,16 @@ public class PaymentCompletedModel : AbpPageModel
public bool IsSuccessful { get; private set; } public bool IsSuccessful { get; private set; }
public async Task OnGetAsync() public async Task<IActionResult> OnGetAsync()
{ {
PaymentRequest = await _paymentRequestAppService.CompleteAsync(Token); PaymentRequest = await _paymentRequestAppService.CompleteAsync(Token);
IsSuccessful = PaymentRequest.State == PaymentRequestState.Completed; IsSuccessful = PaymentRequest.State == PaymentRequestState.Completed;
if (IsSuccessful)
{
return RedirectToPage("OrderReceived", new { orderNo = PaymentRequest.OrderNo });
}
return Page();
} }
} }

19
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/orderReceived.css

@ -0,0 +1,19 @@
.ro-title {
text-transform: uppercase;
font-weight: 500;
color: crimson;
padding-bottom: .5em;
}
.ro-body {
font-weight: bold;
}
.ro-ono {
font-size: x-large;
}
.ro-large {
font-size: larger;
padding-bottom: .5rem;
}
Loading…
Cancel
Save