Skip to content

Commit

Permalink
Section 11 - Order Details Get Action
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrugen committed Sep 26, 2021
1 parent fca7a30 commit a45fceb
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 0 deletions.
13 changes: 13 additions & 0 deletions BulkyBookWeb/Areas/Admin/Controllers/OrderController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using BulkyBook.DataAccess.Repository.IRepository;
using BulkyBook.Models;
using BulkyBook.Models.ViewModels;
using BulkyBook.Utility;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,6 +15,8 @@ namespace BulkyBookWeb.Areas.Admin.Controllers
public class OrderController : Controller
{
private readonly IUnitOfWork _unitOfWork;
[BindProperty]
public OrderVM OrderVM { get; set; }
public OrderController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
Expand All @@ -24,6 +27,16 @@ public IActionResult Index()
return View();
}

public IActionResult Details(int orderId)
{
OrderVM = new OrderVM()
{
OrderHeader = _unitOfWork.OrderHeader.GetFirstOrDefault(u => u.Id == orderId, includeProperties: "ApplicationUser"),
OrderDetail = _unitOfWork.OrderDetail.GetAll(u => u.OrderId == orderId, includeProperties: "Product"),
};
return View(OrderVM);
}

#region API CALLS
[HttpGet]
public IActionResult GetAll(string status)
Expand Down
162 changes: 162 additions & 0 deletions BulkyBookWeb/Areas/Admin/Views/Order/Details.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<form method="post">
<br />
<div class="container">
<div class="card">
<div class="card-header bg-dark text-light ml-0 row container">
<div class="col-12 d-none d-md-block col-md-6 pb-1">
<i class="fas fa-shopping-cart"></i> &nbsp; Order Summary
</div>
<div class="col-12 col-md-4 offset-md-2 text-right">
<a class="btn btn-outline-info form-control btn-sm">Back to Orders</a>
</div>
</div>
<div class="card-body">
<div class="container rounded p-2">
<div class="row">
<div class="col-12 col-lg-6 pb-4">
<div class="row">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-primary">PickUp Details:</span>
</h4>
</div>
<div class="row my-1">
<div class="col-3">Name</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Phone</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Address</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">City</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">State</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Zip Code</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Email</div>
<div class="col-9">
<input type="text" class="form-control" readonly />
</div>
</div>
<div class="row my-1">
<div class="col-3">Order Date</div>
<div class="col-9">
<input type="text" class="form-control" readonly />
</div>
</div>
<div class="row my-1">
<div class="col-3">Carrier</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Tracking</div>
<div class="col-9">
<input type="text" class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Shipping Date</div>
<div class="col-9">
<input id="shippingDate" type="text" readonly class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Transaction ID</div>
<div class="col-9">
<input type="text" readonly class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Payment Due Date</div>
<div class="col-9">
<input readonly class="form-control" />
</div>
<div class="col-3">Payment Date</div>
<div class="col-9">
<input readonly class="form-control" />
</div>
</div>
<div class="row my-1">
<div class="col-3">Payment Status</div>
<div class="col-9">
<input type="text" readonly class="form-control" />
</div>
</div>
<button type="submit" class="btn btn-warning form-control"
formmethod="post">
Update Order Details
</button>


</div>
<div class="col-12 col-lg-5 offset-lg-1">
<h4 class="d-flex justify-content-between align-items-center mb-3">
<span class="text-primary">Order Summary</span>
</h4>
<label class="btn btn-outline-primary form-control my-2">Order Status - OrderStatus</label>

<ul class="list-group mb-3">
<li class="list-group-item d-flex justify-content-between p-2">
<div class="row container">
<div class="col-8">

<h6 class="my-0 text-primary">Product.Title</h6>
<small class="text-muted">Price : Price</small><br />
<small class="text-muted">Quantity : Count</small>
</div>
<div class="col-4">
<p class="text-success">count * price</p>
</div>
</div>
</li>

<li class="list-group-item bg-info">
<div class="row container">
<div class="col-6">
<h5 class="text-white">TOTAL </h5>
</div>
<div class="col-6 text-right">
<h5 class="text-white">$$$</h5>
</div>
</div>
</li>
</ul>

<input type="submit" class="btn btn-primary form-control my-1" value="Start Processing" />
<input type="submit" class="btn btn-primary form-control my-1" value="Ship Order" />
<input type="submit" class="btn btn-success form-control my-1" value="Pay Now" />
<input type="submit" class="btn btn-danger form-control my-1" value="Cancel Order" />
</div>
</div>
</div>
</div>
</div>
</div>
</form>


0 comments on commit a45fceb

Please sign in to comment.