Rank: Administration
Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered Joined: 10/5/2018(UTC) Posts: 175
Thanks: 8 times Was thanked: 17 time(s) in 15 post(s)
|
It was discussed for gold in this threadIn order to make similar updates in AC9, you will have to update the /Area/Admin/Views/Orders/_ListOrder.cshtml file. Please take a backup of this file before making any updates. Then edit the file and replace all its content with the following content. NOTE This code shared below is taken from 9.0.1, if you are using a different version please compare the code with your file and then manually copy the updates needed. Code:
@model StaticPagedList<OrderListItemModel>
@using CommerceBuilder.Extensions
@using CommerceBuilder.Common
@{
var routeValues = new {
modelData = ViewBag.OrderFilter,
SortExpression = ViewBag.SortExpression,
};
var gridActions = new List<IGridAction>();
gridActions.Add(new GridAction("PAY", "Process Payments"));
gridActions.Add(new GridAction("SHIP", "Mark Shipped"));
gridActions.Add(new GridAction("SHIPOPT", "Mark Shipped with Options"));
gridActions.Add(new GridAction("CANCEL", "Cancel", true));
gridActions.Add(new GridAction("INVOICE", "Print Invoices"));
gridActions.Add(new GridAction("PACKSLIP", "Print Packing Slips"));
gridActions.Add(new GridAction("PULLSHEET", "Print Pull Sheets", true));
var statuses = ViewBag.OrderStatuses as List<KeyValuePair<string, string>>;
for (int i = 0; i < statuses.Count; i++)
{
var status = statuses[i];
if (i == statuses.Count - 1)
{
gridActions.Add(new GridAction("OS_" + status.Key, "Change status to " + status.Value, true));
}
else
{
gridActions.Add(new GridAction("OS_" + status.Key, "Change status to " + status.Value));
}
}
gridActions.Add(new GridAction("EXPORT", "Export selected"));
gridActions.Add(new GridAction("DELETE", "Delete selected"));
GridRenderOptions options = new GridRenderOptions("ListOrdersPaged", "Orders", routeValues, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "list-order-container",
InsertionMode = InsertionMode.Replace,
});
options.Commands = gridActions.ToArray();
options.ShowCountLabel = true;
}
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@Model.TotalItemCount Orders</h5>
</div>
<div class="ibox-content">
@if (!Model.Any())
{
<h4 class="no-results">
There are no orders matching the search criteria.
</h4>
}
else
{
using (Ajax.BeginForm("UpdateSelectedOrders", null, new AjaxOptions() { UpdateTargetId = "list-order-container", OnSuccess = "UpdateSuccess" }, new { id = "update-selected-form" }))
{
@Html.AntiForgeryToken()
@Html.Hidden("page", Model.PageNumber)
@Html.Hidden("AllSelected", false)
@Html.Hidden("Command", string.Empty)
@Html.Hidden("ModalData", (string)ViewBag.OrderFilter)
using (var grid = Html.BeginGrid(Model, options))
{
<table class="table table-stripped">
<thead>
<tr>
<th><input type="checkbox" class="select-all-items check-box" name="input[]"></th>
<th>@grid.SortLink("Order", "OrderNumber")</th>
<th data-hide="phone,tablet">@grid.SortLink("Date", "OrderDate")</th>
<th class="text-center" data-hide="phone">@grid.SortLink("Order Status", "OrderStatusId")</th>
<th data-hide="phone">@grid.SortLink("Customer", "BillToLastName")</th>
<th class="text-right">@grid.SortLink("Amount", "TotalCharges")</th>
<th class="text-center" data-hide="phone">Payment</th>
<th class="text-center" data-hide="phone">Shipment</th>
<th class="text-left">Shipping</th>
<th class="text-right">Notes</th>
<th class="text-right">Action</th>
<th class="text-center">Quickview</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
var order = AbleContext.Container.Resolve<CommerceBuilder.Orders.IOrderRepository>().Load(item.Id);
List<string> shipmethods = order.Shipments.Select(shipment => shipment.ShipMethodName).ToList();
string style = string.Empty;
if (item.OrderStatus.Contains("Problem"))
{
style = "background-color:#FF6961;";
}
if (string.IsNullOrEmpty(style) && shipmethods.Any(m => m.ToLower().Contains("next day") || m.ToLower().Contains("2nd day")))
{
style = "background-color:yellow;";
}
bool hasNotes = order.Notes.Any(note => note.NoteType == CommerceBuilder.Orders.NoteType.Public);
string RowId = "row_" + item.Id;
<tr id="@RowId" style="@(style)">
<td>@Html.CheckBox("ORDER_CHK_" + item.Id, new { @class = "check-box" })</td>
<td><a href="@Url.Action("ViewOrder", new { orderNumber = item.OrderNumber })">@(item.OrderNumber)</a></td>
<td>
<small>@(string.Format("{0:G}", item.OrderDate))</small>
</td>
<td class="text-center"><span class="label label-fixed label-plain">@(item.OrderStatus)</span></td>
<td>
@(string.Format("{1}, {0}", item.BillToFirstName, item.BillToLastName))
@if (!string.IsNullOrEmpty(item.BillToCompany))
{ <br />@(item.BillToCompany) }
</td>
<td class="text-right">@Html.DisplayFor(m => item.TotalCharges)</td>
<td class="text-center">
<span class="label label-fixed @(item.PaymentStatusStyle)">@(item.PaymentStatus)</span>
</td>
<td class="text-center">
<span class="label label-fixed @(item.ShipmentStatusStyle)">@(item.ShipmentStatus)</span>
</td>
<td>
@{
@(string.Join(",", shipmethods.ToArray()))
}
</td>
<td class="text-center">
@{
if (hasNotes)
{
<a href="@Url.Content(string.Format("~/Admin/Orders/ViewOrder/{0}?currentTab=OrderNotes", item.Id))"><i style='color:#1c84c6;' class="fa fa-2x fa-exclamation-circle"></i></a>
}
}
</td>
<td class="text-right">
<div class="btn-group">
<a href="@Url.Action("ViewOrder", new { orderNumber = item.OrderNumber})" class="btn-white btn btn-sm">View Order</a>
</div>
</td>
<td class="text-center">
<a id="btn-order-summary" data-row-id="@RowId" data-action="@Url.Action("ViewOrderSummary", "Orders", new { orderId = item.Id })" data-toggle="modal" data-target="view-order-summary"><i class="fa fa-search fa-2x"></i></a>
</td>
</tr>
}
</tbody>
</table>
}
}
}
</div>
</div>
Any order with problem status will be highlighted in red, any order having ship method next day or 2nd day will be highlighted in yellow. Shipment columns will show the ship methods associated with the order. Lastly, notes column will have an exclamation sign if there is at least one public note and if you click the exclamation sign it will take you to the order notes for that order. Edited by user Thursday, March 5, 2020 4:22:25 AM(UTC)
| Reason: Not specified
|