Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

v.1 #1047

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

v.1 #1047

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
1 change: 1 addition & 0 deletions src/Infrastructure/Data/CatalogContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ protected override void OnModelCreating(ModelBuilder builder)
base.OnModelCreating(builder);
builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
}

}
3 changes: 3 additions & 0 deletions src/Web/ViewModels/OrderDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

public class OrderDetailViewModel : OrderViewModel
{
public int UserId { get; set; }
public List<OrderItemViewModel> OrderItems { get; set; } = new();
public bool Shipped { get; set; }
public int OrderId { get; set; }
}
27 changes: 26 additions & 1 deletion src/Web/Views/Order/Detail.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="container">
<section class="esh-orders-detail-section">
<article class="esh-orders-detail-titles row">
<section class="esh-orders-detail-title col-xs-3">Order number</section>
<section class="esh-orders-detail-title col-xs-3">User Id</section>
<section class="esh-orders-detail-title col-xs-3">Date</section>
<section class="esh-orders-detail-title col-xs-2">Total</section>
<section class="esh-orders-detail-title col-xs-3">Status</section>
Expand Down Expand Up @@ -66,12 +66,37 @@
<article class="esh-orders-detail-titles esh-basket-titles--clean row">
<section class="esh-orders-detail-title col-xs-9"></section>
<section class="esh-orders-detail-title col-xs-2">TOTAL</section>

</article>

<article class="esh-orders-detail-items row">
<section class="esh-orders-detail-item col-xs-9"></section>
<section class="esh-orders-detail-item esh-orders-detail-item--mark col-xs-2">$ @Model.Total.ToString("N2")</section>
<button class="btn btn-primary" id="approveOrderBtn">Approve Order</button>
</article>

</section>
</div>
</div>
<script>
document.getElementById("approveOrderBtn").addEventListener("click", function () {
fetch('/approveOrder', {
method: 'POST',
body: JSON.stringify({ orderId: '@Model.OrderId' }),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
if (response.ok) {
alert('Sipariş başarıyla onaylandı.');
window.location.reload();
} else {
alert('Sipariş başarıyla onaylandı');
}
})
.catch(error => {
alert('Bir ağ hatası oluştu. Lütfen tekrar deneyin.');
});
});
</script>
2 changes: 1 addition & 1 deletion src/Web/Views/Order/MyOrders.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="container">
<h1>@ViewData["Title"]</h1>
<article class="esh-orders-titles row">
<section class="esh-orders-title col-xs-2">Order number</section>
<section class="esh-orders-title col-xs-2">User Id</section>
<section class="esh-orders-title col-xs-4">Date</section>
<section class="esh-orders-title col-xs-2">Total</section>
<section class="esh-orders-title col-xs-2">Status</section>
Expand Down