Skip to content

Commit

Permalink
Section 11 - Loading Order Details Header
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrugen committed Sep 26, 2021
1 parent a45fceb commit 0cf4680
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 25 deletions.
2 changes: 1 addition & 1 deletion BulkyBook.DataAccess/Repository/OrderHeaderRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void UpdateStatus(int id, string orderStatus, string? paymentStatus = nul
public void UpdateStripePaymentID(int id, string sessionId, string paymentItentId)
{
var orderFromDb = _db.OrderHeaders.FirstOrDefault(u => u.Id == id);

orderFromDb.PaymentDate = DateTime.Now;
orderFromDb.SessionId = sessionId;
orderFromDb.PaymentIntentId = paymentItentId;
}
Expand Down
123 changes: 99 additions & 24 deletions BulkyBookWeb/Areas/Admin/Views/Order/Details.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<form method="post">
@model BulkyBook.Models.ViewModels.OrderVM
@using BulkyBook.Utility

<form method="post">
<br />
<div class="container">
<div class="card">
Expand All @@ -7,7 +10,7 @@
<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>
<a asp-action="Index" class="btn btn-outline-info form-control btn-sm">Back to Orders</a>
</div>
</div>
<div class="card-body">
Expand All @@ -22,89 +25,161 @@
<div class="row my-1">
<div class="col-3">Name</div>
<div class="col-9">
<input type="text" class="form-control" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.Name" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.Name" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.Name" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.PhoneNumber" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.PhoneNumber" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.PhoneNumber" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.StreetAddress" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.StreetAddress" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.StreetAddress" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.City" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.City" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.City" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.State" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.State" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.State" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.PostalCode" type="text" class="form-control" />
<span asp-validation-for="OrderHeader.PostalCode" class="text-danger"></span>
}
else
{
<input asp-for="OrderHeader.PostalCode" readonly 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 />
<input asp-for="OrderHeader.ApplicationUser.Email" readonly type="text" class="form-control" />
</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 />

<input value="@Model.OrderHeader.OrderDate.ToShortDateString()" readonly type="text" class="form-control" />

</div>
</div>
<div class="row my-1">
<div class="col-3">Carrier</div>
<div class="col-9">
<input type="text" class="form-control" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.Carrier" id="carrier" type="text" class="form-control" />
}
else
{
<input asp-for="OrderHeader.Carrier" readonly 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" />
@if(User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee)){
<input asp-for="OrderHeader.TrackingNumber" id="trackingNumber" type="text" class="form-control" />
}
else
{
<input asp-for="OrderHeader.TrackingNumber" readonly 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" />
<input value="@Model.OrderHeader.ShippingDate.ToShortDateString()" 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" />
@if (User.IsInRole(SD.Role_Admin) || User.IsInRole(SD.Role_Employee))
{
<div class="row my-1">
<div class="col-3">Session ID</div>
<div class="col-9">
<input asp-for="OrderHeader.SessionId" type="text" readonly class="form-control" />
</div>
</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 class="row my-1">
<div class="col-3">Payment Intent ID</div>
<div class="col-9">
<input asp-for="OrderHeader.PaymentIntentId" type="text" readonly class="form-control" />
</div>
</div>
}
<div class="row my-1">
@if (Model.OrderHeader.SessionId == null)
{
<div class="col-3">Payment Due Date</div>
<div class="col-9">
<input value="@Model.OrderHeader.PaymentDueDate.ToShortDateString()"
readonly type="text" class="form-control" />
</div>
}
else{
<div class="col-3">Payment Date</div>
<div class="col-9">
<input readonly class="form-control" />
<input value="@Model.OrderHeader.PaymentDate.ToShortDateString()"
readonly id="paymentDate" type="text" 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" />
<input asp-for="OrderHeader.PaymentStatus" type="text" readonly class="form-control" />
</div>
</div>
<button type="submit" class="btn btn-warning form-control"
Expand Down

0 comments on commit 0cf4680

Please sign in to comment.