Skip to content

Commit

Permalink
Order List UI added in Admin Area
Browse files Browse the repository at this point in the history
  • Loading branch information
aliarmaganuygun committed Oct 20, 2024
1 parent 88a63ca commit 23c4b67
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
1 change: 0 additions & 1 deletion BulkyWeb/Areas/Admin/Controllers/OrderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using BookBazaar.Models;
using BookBazaar.Utility;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;

namespace BookBazaar.Areas.Admin.Controllers
Expand Down
28 changes: 28 additions & 0 deletions BulkyWeb/Areas/Admin/Views/Order/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="card shadow border-0 my-4">
<div class="card-header bg-secondary bg-gradient ml-0 py-3">
<div class="row">
<div class="col-12 text-center">
<h2 class="text-white py-2">Order List</h2>
</div>
</div>
</div>
<div class="card-body p-4">
<table id="tblData" class="table table-bordered table-striped" style="width:100%">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Phone Number</th>
<th>Email</th>
<th>Status</th>
<th>Total</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>

@section Scripts {
<script src="~/js/order.js"></script>
}
2 changes: 1 addition & 1 deletion BulkyWeb/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<a class="nav-link" asp-area="Customer" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="Customer" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link" asp-area="Admin" asp-controller="Order" asp-action="Index">Order Management</a>
</li>
@if (User.IsInRole(SD.Role_Admin))
{
Expand Down
27 changes: 27 additions & 0 deletions BulkyWeb/wwwroot/js/order.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var dataTable;
$(document).ready(function () {
loadDataTable();
});

function loadDataTable() {
dataTable = $('#tblData').DataTable({
"ajax": { url: '/admin/order/getall' },
"columns": [
{ data: 'id', width: '5%' },
{ data: 'name', width: '15%' },
{ data: 'phoneNumber', width: '20%' },
{ data: 'applicationUser.email', width: '15%' },
{ data: 'orderStatus', width: '10%' },
{ data: 'orderTotal', width: '10%' },
{
data: 'id',
"render": function (data) {
return `<div class="w-75 btn-group" role="group">
<a href="/admin/order/details?id=${data}" class="btn btn-primary mx-2"><i class="bi bi-pencil-square"></i></a>
</div>`
},
width: '25%'
}
]
});
}

0 comments on commit 23c4b67

Please sign in to comment.