laravelEcomm/resources/views/Dashboard/orders.blade.php

389 lines
24 KiB
PHP

{{-- new --}}
<x-adminheader title="Orders" />
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-md-12 grid-margin">
<div class="row">
<div class="col-12 col-xl-8 mb-4 mb-xl-0">
<h3 class="font-weight-bold">Welcome Aamir</h3>
<h6 class="font-weight-normal mb-0">All systems are running smoothly!</h6>
</div>
<div class="col-12 col-xl-4">
<div class="justify-content-end d-flex">
<div class="dropdown flex-md-grow-1 flex-xl-grow-0">
<button class="btn btn-sm btn-light bg-white dropdown-toggle" type="button"
id="dropdownMenuDate2" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
<i class="mdi mdi-calendar"></i> Today (10 Jan 2021)
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuDate2">
<a class="dropdown-item" href="#">January - March</a>
<a class="dropdown-item" href="#">March - June</a>
<a class="dropdown-item" href="#">June - August</a>
<a class="dropdown-item" href="#">August - November</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<p class="card-title mb-0">Our Orders</p>
<div class="table-responsive">
<table class="table table-striped table-bordered" id="product-table">
<thead>
<tr>
<th>ID</th>
<th>Customer Name</th>
<th> Customer Status</th>
<th>Phone</th>
<th>Address</th>
<th>Email</th>
<th>Bill</th>
<th> Status</th>
<th>View</th>
<th>Order Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($orders as $order)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $order->name }}</td>
<td>
@if ($order->userStatus == 'Active')
<span
class="badge badge-success d-flex justify-content-center">Active</span>
@else
<span
class="badge badge-danger d-flex justify-content-center">Blocked</span>
@endif
</td>
<td>{{ $order->phone }}</td>
<td>{{ $order->address }}</td>
<td>{{ $order->email }}</td>
<td>NRs {{ $order->bill }}</td>
<td>
<div class="badge badge-light d-flex justify-content-center">
{{ $order->status }}
</div>
</td>
<td>
<!-- Button to Open the Modal -->
<button type="button" class="btn btn-light" data-toggle="modal"
data-target="#orderModal{{ $order->id }}">
<i class="fas fa-eye"></i>
</button>
</td>
<td>{{ $order->created_at }}</td>
<td>
@if ($order->status == 'Paid')
<a href="{{ route('changeOrderStatus', ['status' => 'Accepted', 'id' => $order->id]) }}"
class="btn btn-info">Accept</a>
<a href="{{ route('changeOrderStatus', ['status' => 'Rejected', 'id' => $order->id]) }}"
class="btn btn-danger">Reject</a>
@elseif ($order->status == 'Accepted')
<a href="{{ route('changeOrderStatus', ['status' => 'Delivered', 'id' => $order->id]) }}"
class="btn btn-success">Completed</a>
@elseif ($order->status == 'Delivered')
Deliver Complete
@else
<a href="{{ route('changeOrderStatus', ['status' => 'Accepted', 'id' => $order->id]) }}"
class="btn btn-info">Accept</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- Modals -->
@foreach ($orders as $order)
<div class="modal fade" id="orderModal{{ $order->id }}" tabindex="-1" role="dialog"
aria-labelledby="orderModalLabel{{ $order->id }}" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Ordered Products</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div style="overflow-x: auto;">
<table class="table table-striped table-bordered modal-table">
<thead>
<tr>
<th>Name</th>
<th>Picture</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach ($orderItems as $orderDetail)
@if ($order->id == $orderDetail->orderId)
<tr>
<td>{{ $orderDetail->name }}</td>
<td><img src="{{ asset('uploads/products/' . $orderDetail->picture) }}"
class="img-fluid rounded-circle"
alt="" width= "100px"
height="100px">
<td>{{ $orderDetail->quantity }}</td>
<td>{{ $orderDetail->price }}</td>
<td>{{ $orderDetail->quantity * $orderDetail->price }}
</td>
</tr>
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="4" style="text-align: center;">
<strong>Sub Total</strong>
</td>
<td><strong>{{ $order->bill }}</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger"
data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<x-adminfooter />
{{-- <x-adminheader />
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-md-12 grid-margin">
<div class="row">
<div class="col-12 col-xl-8 mb-4 mb-xl-0">
<h3 class="font-weight-bold">Welcome Aamir</h3>
<h6 class="font-weight-normal mb-0">All systems are running smoothly!
</h6>
</div>
<div class="col-12 col-xl-4">
<div class="justify-content-end d-flex">
<div class="dropdown flex-md-grow-1 flex-xl-grow-0">
<button class="btn btn-sm btn-light bg-white dropdown-toggle" type="button"
id="dropdownMenuDate2" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
<i class="mdi mdi-calendar"></i> Today (10 Jan 2021)
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuDate2">
<a class="dropdown-item" href="#">January - March</a>
<a class="dropdown-item" href="#">March - June</a>
<a class="dropdown-item" href="#">June - August</a>
<a class="dropdown-item" href="#">August - November</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<p class="card-title mb-0">Our Orders</p>
<div class="table-responsive">
<table class="table table-striped table-bordered" id="product-table">
<thead>
<tr>
<th>ID</th>
<th>Customer Name</th>
<th> Customer Status</th>
<th>Phone</th>
<th>Address</th>
<th>Email</th>
<th>Bill</th>
<th> Status</th>
<th>View</th>
<th>Order Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@php
$i = 0;
@endphp
@foreach ($orders as $order)
@php
$i++;
@endphp
<tr>
<td>{{ $i }}</td>
<td>{{ $order->name }}</td>
<td>
@if ($order->userStatus == 'Active')
<span
class="badge badge-success d-flex justify-content-center">Active</span>
@else
<span
class="badge badge-danger d-flex justify-content-center">Blocked</span>
@endif
</td>
<td>{{ $order->phone }}</td>
<td>{{ $order->address }}</td>
<td>{{ $order->email }}</td>
<td>NRs {{ $order->bill }}</td>
<td>
<div class="badge badge-light d-flex justify-content-center">
{{ $order->status }}
</div>
<td>
<!-- Button to Open the Modal -->
<button type="button" class="btn btn-light" data-toggle="modal"
data-target="#orderModal">
<i class="fas fa-eye"></i>
</button>
<!-- The Modal -->
@foreach ($orders as $order)
<div class="modal" id="orderModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Ordered Products</h4>
<button type="button" class="close"
data-dismiss="modal">&times;</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<div style="overflow-x: auto;">
<table>
<thead>
<tr>
<th>Name</th>
<th>Picture</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach ($orderItems as $orderDetail)
@if ($orderDetail->orderId == $order->id)
<tr>
<td>{{ $orderDetail->name }}
</td>
<td><img src="{{ asset('uploads/products/' . $orderDetail->picture) }}"
class="img-fluid rounded-circle"
alt=""
width= "100px"
height="100px">
</td>
<td>{{ $orderDetail->quantity }}
</td>
<td>{{ $orderDetail->price }}
</td>
<td>{{ $orderDetail->quantity * $orderDetail->price }}
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger"
data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endforeach
</td>
<td>{{ $order->created_at }}</td>
<td>
@if ($order->status == 'Paid')
<a href="{{ route('changeOrderStatus', ['status' => 'Accepted', 'id' => $order->id]) }}"
class="btn btn-info">Accept</a>
<a href="{{ route('changeOrderStatus', ['status' => 'Rejected', 'id' => $order->id]) }}"
class="btn btn-danger">Reject</a>
@elseif ($order->status == 'Accepted')
<a href="{{ route('changeOrderStatus', ['status' => 'Delivered', 'id' => $order->id]) }}"
class="btn btn-success">Completed</a>
@elseif ($order->status == 'Delivered')
Deliver Complete
@else
<a href="{{ route('changeOrderStatus', ['status' => 'Accepted', 'id' => $order->id]) }}"
class="btn btn-info">Accept</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<x-adminfooter /> --}}