edit.blade.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. @extends('layouts.admin.app')
  2. @section('content')
  3. <!-- Main content -->
  4. <section class="content">
  5. @include('layouts.errors-and-messages')
  6. <!-- Default box -->
  7. <div class="box">
  8. <div class="box-header">
  9. <div class="row">
  10. <div class="col-md-6">
  11. <h2>
  12. <a href="{{ route('admin.customers.show', $customer->id) }}">{{$customer->name}}</a> <br />
  13. <small>{{$customer->email}}</small> <br />
  14. <small>reference: <strong>{{$order->reference}}</strong></small>
  15. </h2>
  16. </div>
  17. <div class="col-md-3 col-md-offset-3">
  18. <h2><a href="{{route('admin.orders.invoice.generate', $order['id'])}}" class="btn btn-primary btn-block">Download Invoice</a></h2>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="box">
  24. <div class="box-body">
  25. <h4> <i class="fa fa-shopping-bag"></i> Order Information</h4>
  26. <table class="table">
  27. <thead>
  28. <tr>
  29. <td class="col-md-3">Date</td>
  30. <td class="col-md-3">Customer</td>
  31. <td class="col-md-3">Payment</td>
  32. <td class="col-md-3">Status</td>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <tr>
  37. <td>{{ date('M d, Y h:i a', strtotime($order['created_at'])) }}</td>
  38. <td><a href="{{ route('admin.customers.show', $customer->id) }}">{{ $customer->name }}</a></td>
  39. <td><strong>{{ $order['payment'] }}</strong></td>
  40. <td>
  41. <form action="{{ route('admin.orders.update', $order->id) }}" method="post">
  42. {{ csrf_field() }}
  43. <input type="hidden" name="_method" value="put">
  44. <label for="order_status_id" class="hidden">Update status</label>
  45. <input type="text" name="total_paid" class="form-control" placeholder="Total paid" style="margin-bottom: 5px; display: none" value="{{ old('total_paid') ?? $order->total_paid }}" />
  46. <div class="input-group">
  47. <select name="order_status_id" id="order_status_id" class="form-control select2">
  48. @foreach($statuses as $status)
  49. <option @if($currentStatus->id == $status->id) selected="selected" @endif value="{{ $status->id }}">{{ $status->name }}</option>
  50. @endforeach
  51. </select>
  52. <span class="input-group-btn"><button onclick="return confirm('Are you sure?')" type="submit" class="btn btn-primary">Update</button></span>
  53. </div>
  54. </form>
  55. </td>
  56. </tr>
  57. </tbody>
  58. <tbody>
  59. <tr>
  60. <td></td>
  61. <td></td>
  62. <td class="bg-warning">Subtotal</td>
  63. <td class="bg-warning">{{ $order['total_products'] }}</td>
  64. </tr>
  65. <tr>
  66. <td></td>
  67. <td></td>
  68. <td class="bg-warning">Tax</td>
  69. <td class="bg-warning">{{ $order['tax'] }}</td>
  70. </tr>
  71. <tr>
  72. <td></td>
  73. <td></td>
  74. <td class="bg-warning">Discount</td>
  75. <td class="bg-warning">{{ $order['discounts'] }}</td>
  76. </tr>
  77. <tr>
  78. <td></td>
  79. <td></td>
  80. <td class="bg-success text-bold">Order Total</td>
  81. <td class="bg-success text-bold">{{ $order['total'] }}</td>
  82. </tr>
  83. @if($order['total_paid'] != $order['total'])
  84. <tr>
  85. <td></td>
  86. <td></td>
  87. <td class="bg-danger text-bold">Total paid</td>
  88. <td class="bg-danger text-bold">{{ $order['total_paid'] }}</td>
  89. </tr>
  90. @endif
  91. </tbody>
  92. </table>
  93. </div>
  94. <!-- /.box-body -->
  95. </div>
  96. @if($order)
  97. @if($order->total != $order->total_paid)
  98. <p class="alert alert-danger">
  99. Ooops, there is discrepancy in the total amount of the order and the amount paid. <br />
  100. Total order amount: <strong>{{ config('cart.currency') }} {{ $order->total }}</strong> <br>
  101. Total amount paid <strong>{{ config('cart.currency') }} {{ $order->total_paid }}</strong>
  102. </p>
  103. @endif
  104. <div class="box">
  105. @if(!$items->isEmpty())
  106. <div class="box-body">
  107. <h4> <i class="fa fa-gift"></i> Items</h4>
  108. <table class="table">
  109. <thead>
  110. <th class="col-md-2">SKU</th>
  111. <th class="col-md-2">Name</th>
  112. <th class="col-md-2">Description</th>
  113. <th class="col-md-2">Quantity</th>
  114. <th class="col-md-2">Price</th>
  115. </thead>
  116. <tbody>
  117. @foreach($items as $item)
  118. <tr>
  119. <td>{{ $item->sku }}</td>
  120. <td>{{ $item->name }}</td>
  121. <td>{!! $item->description !!}</td>
  122. <td>{{ $item->pivot->quantity }}</td>
  123. <td>{{ $item->price }}</td>
  124. </tr>
  125. @endforeach
  126. </tbody>
  127. </table>
  128. </div>
  129. @endif
  130. <div class="box-body">
  131. <div class="row">
  132. <div class="col-md-6">
  133. <h4> <i class="fa fa-truck"></i> Courier</h4>
  134. <table class="table">
  135. <thead>
  136. <th class="col-md-3">Name</th>
  137. <th class="col-md-4">Description</th>
  138. <th class="col-md-5">Link</th>
  139. </thead>
  140. <tbody>
  141. <tr>
  142. <td>{{ $order->courier->name }}</td>
  143. <td>{{ $order->courier->description }}</td>
  144. <td>{{ $order->courier->url }}</td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. </div>
  149. <div class="col-md-6">
  150. <h4> <i class="fa fa-map-marker"></i> Address</h4>
  151. <table class="table">
  152. <thead>
  153. <th>Address 1</th>
  154. <th>Address 2</th>
  155. <th>City</th>
  156. <th>Province</th>
  157. <th>Zip</th>
  158. </thead>
  159. <tbody>
  160. <tr>
  161. <td>{{ $order->address->address_1 }}</td>
  162. <td>{{ $order->address->address_2 }}</td>
  163. <td>
  164. @if(isset($order->address->city))
  165. {{ $order->address->city }}
  166. @endif
  167. </td>
  168. <td>
  169. @if(isset($order->address->province))
  170. {{ $order->address->province }}
  171. @endif
  172. </td>
  173. <td>{{ $order->address->zip }}</td>
  174. </tr>
  175. </tbody>
  176. </table>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. <!-- /.box -->
  182. <div class="box-footer">
  183. <div class="btn-group">
  184. <a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-default">Back</a>
  185. </div>
  186. </div>
  187. @endif
  188. </section>
  189. <!-- /.content -->
  190. @endsection
  191. @section('js')
  192. <script type="text/javascript">
  193. $(document).ready(function () {
  194. let osElement = $('#order_status_id');
  195. osElement.change(function () {
  196. if (+$(this).val() === 1) {
  197. $('input[name="total_paid"]').fadeIn();
  198. } else {
  199. $('input[name="total_paid"]').fadeOut();
  200. }
  201. });
  202. })
  203. </script>
  204. @endsection