124 lines
5.2 KiB
PHP
124 lines
5.2 KiB
PHP
<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 -->
|