Order History View and Track Orders

This commit is contained in:
UronShrestha
2024-07-09 11:44:05 +05:45
parent a1835247d6
commit f4aab0bed3
6 changed files with 214 additions and 23 deletions

View File

@ -88,7 +88,20 @@
<script src={{ URL::asset('js/mixitup.min.js') }}></script>
<script src={{ URL::asset('js/owl.carousel.min.js') }}></script>
<script src={{ URL::asset('js/main.js') }}></script>
</body>
<script src="https://code.jquery.com/jquery-3.6.3.min.js"
integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
{{-- Datatables script --}}
<script src="//cdn.datatables.net/2.0.8/js/dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#myTable').DataTable();
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function() {
@ -107,6 +120,8 @@
}, 2000); // 2000 milliseconds = 3 seconds
});
</script>
</body>
</html>

View File

@ -22,8 +22,24 @@
<link rel="stylesheet" href="{{ URL::asset('css/owl.carousel.min.css') }}"type="text/css">
<link rel="stylesheet" href="{{ URL::asset('css/slicknav.min.css') }}" type="text/css">
<link rel="stylesheet" href="{{ URL::asset('css/style.css') }}" type="text/css">
<!-- Include the Stripe.js library -->
<script src="https://js.stripe.com/v3/"></script>
{{-- bootstrap --}}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<!-- Include the Stripe.js library -->
<script src="https://js.stripe.com/v3/"></script>
<!-- datatables-->
<link rel="stylesheet" href="//cdn.datatables.net/2.0.8/css/dataTables.dataTables.min.css">
{{-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css"> --}}
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.8/css/dataTables.bootstrap5.css">
</head>
<body>
@ -78,10 +94,10 @@
<div class="header__top__links">
@if (session()->has('id'))
<a href="{{ URL::to('/logout') }}">Logout</a>
<a href="{{ route('logout') }}">Logout</a>
@else
<a href="{{ URL::to('/login') }}">Login</a>
<a href="{{ URL::to('/register') }}">Register</a>
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endif
{{-- <a href="{{ URL::to('/register') }}">Sign in</a>
<a href="{{ URL::to('/login') }}">Login</a> --}}
@ -103,21 +119,22 @@
<div class="row">
<div class="col-lg-3 col-md-3">
<div class="header__logo">
<a href="{{ URL::to('/') }}"><img src="{{ URL::asset('img/logo.png') }}" alt=""></a>
<a href="{{ route('/') }}"><img src="{{ URL::asset('img/logo.png') }}" alt=""></a>
</div>
</div>
<div class="col-lg-6 col-md-6">
<nav class="header__menu mobile-menu">
<ul>
<li class="active"><a href="{{ URL::to('/') }}">Home</a></li>
<li><a href="{{ URL::to('shop') }}">Shop</a></li>
<li><a href="{{ route('/') }}">Home</a></li>
<li><a href="{{ route('shop') }}">Shop</a></li>
<li><a href="#">Pages</a>
<ul class="dropdown">
<li><a href="{{ URL::to('about') }}">About Us</a></li>
<li><a href="{{ route('about') }}">About Us</a></li>
{{-- <li><a href="{{ URL::to('singleProduct') }}">Single Product</a></li> --}}
<li><a href="{{ URL::to('cart') }}">Shopping Cart</a></li>
<li><a href="{{ URL::to('checkout') }}">Check Out</a></li>
<li><a href="{{ URL::to('profile') }}">Profile</a></li>
<li><a href="{{ route('cart') }}">Shopping Cart</a></li>
<li><a href="{{ route('checkout') }}">Check Out</a></li>
<li><a href="{{ route('myOrders') }}">My Orders</a></li>
<li><a href="{{ route('profile') }}">Profile</a></li>
</ul>
</li>
@ -130,7 +147,7 @@
<a href="#" class="search-switch"><img src="{{ URL::asset('img/icon/search.png') }}"
alt=""></a>
<a href="#"><img src="{{ URL::asset('img/icon/heart.png') }}" alt=""></a>
<a href="{{ URL::to('cart') }}"><img src="{{ URL::asset('img/icon/cart.png') }}"
<a href="{{ route('cart') }}"><img src="{{ URL::asset('img/icon/cart.png') }}"
alt="">
<span>0</span></a>
<div class="price">Rs 0.00</div>

View File

@ -0,0 +1,123 @@
<x-header />
<!-- Contact Section Begin -->
<section class="contact spad">
<div class="container">
<div class="row">
<div class="col-lg-10 col-md-6 mx-auto">
<div class="section-title">
<h2>My Orders</h2>
</div>
<div class="contact__form">
@if (session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
@if (session('error'))
<div class="alert alert-danger">
{{ session('error') }}
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<table id="myTable" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>S.No.</th>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Status</th>
<th>Order Date</th>
<th>Total Bill</th>
<th>View Products</th>
</tr>
</thead>
<tbody>
@foreach ($orders as $order)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $order->name }}</td>
<td>{{ $order->address }}</td>
<td>{{ $order->phone }}</td>
<td>{{ $order->status }}</td>
<td>{{ $order->created_at }}</td>
<td>{{ $order->bill }}</td>
<td>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal"
data-bs-target="#viewProductsModal{{ $order->id }}">
View
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section End -->
<!-- Modal Begin -->
@foreach ($orders as $order)
<div class="modal fade" id="viewProductsModal{{ $order->id }}" tabindex="-1"
aria-labelledby="exampleModalLabel{{ $order->id }}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel{{ $order->id }}">All Products</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach ($items as $product)
@if ($product->order_id == $order->id)
<tr>
<td><img src="{{ url::to('uploads/products/' . $product->picture) }}"
width="100px" alt="">{{ $product->name }}</td>
<td>{{ $product->quantity }}</td>
<td>{{ $product->price }}</td>
<td>{{ $product->price * $product->quantity }}</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
{{-- <button type="button" class="btn btn-primary">Save changes</button> --}}
</div>
</div>
</div>
</div>
@endforeach
<!-- Modal End -->
<!-- Footer Section Begin -->
<x-footer />
<!-- Footer Section End -->