Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue405 #455

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Tests/Grand.Web.Common.Tests/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"Grand.Web.Common.Tests": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:51564;http://localhost:51565"
}
}
}
15 changes: 15 additions & 0 deletions src/Web/Grand.Web/Controllers/OrderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Microsoft.AspNetCore.Mvc;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Customers;
using MongoDB.Driver;

namespace Grand.Web.Controllers
{
Expand Down Expand Up @@ -80,6 +81,19 @@ protected virtual bool IsPostBeingDone {
#endregion

#region Methods


[HttpPost]
public virtual async Task<IActionResult> Search( int orderNumber)
{
var order = await _orderService.GetOrderByNumber(orderNumber);
if (!await order.Access(_workContext.CurrentCustomer, _groupService))
return Challenge();

var model = await _mediator.Send(new GetOrderDetails { Order = order, Language = _workContext.WorkingLanguage });

return View("Details",model);
}

//My account / Orders
[HttpGet]
Expand All @@ -92,6 +106,7 @@ public virtual async Task<IActionResult> CustomerOrders(OrderPagingModel command
Store = _workContext.CurrentStore,
Command = command
});

return View(model);
}

Expand Down
23 changes: 21 additions & 2 deletions src/Web/Grand.Web/Views/Order/CustomerOrders.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,27 @@
@await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = AccountNavigationEnum.Orders })
}
<div class="page account-page order-list-page pl-lg-3 pt-lg-0 pt-3">
<h1 class="generalTitle h2">@Loc["Account.CustomerOrders"]</h1>
@if (Model.Orders.Any())
<h1 class="generalTitle h2">@Loc["Account.CustomerOrders"]</h1>

<!-- Search Bar
<div class="order-search-bar mb-3">
<form method="get" action="@Url.Action("CustomerOrders")">
<div class="input-group">
<input type="text" class="form-control" name="searchOrderNumber" placeholder="@Loc["Account.CustomerOrders.SearchOrderNumber"]" />
<div class="input-group-append">
<button type="submit" class="btn btn-primary">@Loc["Account.CustomerOrders.Search"]</button>
</div>
</div>
</form>
</div> -->
@using (Html.BeginForm("Search", "Order", FormMethod.Post))
{
<label for="orderNumber">Order Number:</label>
<input type="text" name="orderNumber" required />
<button type="submit">Search</button>
}

@if (Model.Orders.Any())
{
<div class="account-order table-responsive">
<table class="table hover-table">
Expand Down