accounts.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. @extends('layouts.front.app')
  2. @section('content')
  3. <!-- Main content -->
  4. <section class="container content">
  5. <div class="row">
  6. <div class="box-body">
  7. @include('layouts.errors-and-messages')
  8. </div>
  9. <div class="col-md-12">
  10. <h2> <i class="fa fa-home"></i> My Account</h2>
  11. <hr>
  12. </div>
  13. </div>
  14. <div class="row">
  15. <div class="col-md-12">
  16. <div>
  17. <!-- Nav tabs -->
  18. <ul class="nav nav-tabs" role="tablist">
  19. <li role="presentation" @if(request()->input('tab') == 'profile') class="active" @endif><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
  20. <li role="presentation" @if(request()->input('tab') == 'orders') class="active" @endif><a href="#orders" aria-controls="orders" role="tab" data-toggle="tab">Orders</a></li>
  21. <li role="presentation" @if(request()->input('tab') == 'address') class="active" @endif><a href="#address" aria-controls="address" role="tab" data-toggle="tab">Addresses</a></li>
  22. </ul>
  23. <!-- Tab panes -->
  24. <div class="tab-content customer-order-list">
  25. <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'profile')active @endif" id="profile">
  26. {{$customer->name}} <br /><small>{{$customer->email}}</small>
  27. </div>
  28. <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'orders')active @endif" id="orders">
  29. @if(!$orders->isEmpty())
  30. <table class="table">
  31. <tbody>
  32. <tr>
  33. <td>Date</td>
  34. <td>Total</td>
  35. <td>Status</td>
  36. </tr>
  37. </tbody>
  38. <tbody>
  39. @foreach ($orders as $order)
  40. <tr>
  41. <td>
  42. <a data-toggle="modal" data-target="#order_modal_{{$order['id']}}" title="Show order" href="javascript: void(0)">{{ date('M d, Y h:i a', strtotime($order['created_at'])) }}</a>
  43. <!-- Button trigger modal -->
  44. <!-- Modal -->
  45. <div class="modal fade" id="order_modal_{{$order['id']}}" tabindex="-1" role="dialog" aria-labelledby="MyOrders">
  46. <div class="modal-dialog" role="document">
  47. <div class="modal-content">
  48. <div class="modal-header">
  49. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  50. <h4 class="modal-title" id="myModalLabel">Reference #{{$order['reference']}}</h4>
  51. </div>
  52. <div class="modal-body">
  53. <table class="table">
  54. <thead>
  55. <th>Address</th>
  56. <th>Payment Method</th>
  57. <th>Total</th>
  58. <th>Status</th>
  59. </thead>
  60. <tbody>
  61. <tr>
  62. <td>
  63. <address>
  64. <strong>{{$order['address']->alias}}</strong><br />
  65. {{$order['address']->address_1}} {{$order['address']->address_2}}<br>
  66. </address>
  67. </td>
  68. <td>{{$order['payment']}}</td>
  69. <td>{{ config('cart.currency_symbol') }} {{$order['total']}}</td>
  70. <td><p class="text-center" style="color: #ffffff; background-color: {{ $order['status']->color }}">{{ $order['status']->name }}</p></td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. <hr>
  75. <p>Order details:</p>
  76. <table class="table">
  77. <thead>
  78. <th>Name</th>
  79. <th>Quantity</th>
  80. <th>Price</th>
  81. <th>Cover</th>
  82. </thead>
  83. <tbody>
  84. @foreach ($order['products'] as $product)
  85. <tr>
  86. <td>{{$product['name']}}</td>
  87. <td>{{$product['pivot']['quantity']}}</td>
  88. <td>{{$product['price']}}</td>
  89. <td><img src="{{ asset("storage/".$product['cover']) }}" width=50px height=50px alt="{{ $product['name'] }}" class="img-orderDetail"></td>
  90. </tr>
  91. @endforeach
  92. </tbody>
  93. </table>
  94. </div>
  95. <div class="modal-footer">
  96. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </td>
  102. <td><span class="label @if($order['total'] != $order['total_paid']) label-danger @else label-success @endif">{{ config('cart.currency') }} {{ $order['total'] }}</span></td>
  103. <td><p class="text-center" style="color: #ffffff; background-color: {{ $order['status']->color }}">{{ $order['status']->name }}</p></td>
  104. </tr>
  105. @endforeach
  106. </tbody>
  107. </table>
  108. {{ $orders->links() }}
  109. @else
  110. <p class="alert alert-warning">No orders yet. <a href="{{ route('home') }}">Shop now!</a></p>
  111. @endif
  112. </div>
  113. <div role="tabpanel" class="tab-pane @if(request()->input('tab') == 'address')active @endif" id="address">
  114. <div class="row">
  115. <div class="col-md-6">
  116. <a href="{{ route('customer.address.create', auth()->user()->id) }}" class="btn btn-primary">Create your address</a>
  117. </div>
  118. </div>
  119. @if(!$addresses->isEmpty())
  120. <table class="table">
  121. <thead>
  122. <th>Alias</th>
  123. <th>Address 1</th>
  124. <th>Address 2</th>
  125. <th>City</th>
  126. @if(isset($address->province))
  127. <th>Province</th>
  128. @endif
  129. <th>State</th>
  130. <th>Country</th>
  131. <th>Zip</th>
  132. <th>Phone</th>
  133. <th>Actions</th>
  134. </thead>
  135. <tbody>
  136. @foreach($addresses as $address)
  137. <tr>
  138. <td>{{$address->alias}}</td>
  139. <td>{{$address->address_1}}</td>
  140. <td>{{$address->address_2}}</td>
  141. <td>{{$address->city}}</td>
  142. @if(isset($address->province))
  143. <td>{{$address->province->name}}</td>
  144. @endif
  145. <td>{{$address->state_code}}</td>
  146. <td>{{$address->country->name}}</td>
  147. <td>{{$address->zip}}</td>
  148. <td>{{$address->phone}}</td>
  149. <td>
  150. <form method="post" action="{{ route('customer.address.destroy', [auth()->user()->id, $address->id]) }}" class="form-horizontal">
  151. <div class="btn-group">
  152. <input type="hidden" name="_method" value="delete">
  153. {{ csrf_field() }}
  154. <a href="{{ route('customer.address.edit', [auth()->user()->id, $address->id]) }}" class="btn btn-primary"> <i class="fa fa-pencil"></i> Edit</a>
  155. <button onclick="return confirm('Are you sure?')" type="submit" class="btn btn-danger"> <i class="fa fa-trash"></i> Delete</button>
  156. </div>
  157. </form>
  158. </td>
  159. </tr>
  160. @endforeach
  161. </tbody>
  162. </table>
  163. @else
  164. <br /> <p class="alert alert-warning">No address created yet.</p>
  165. @endif
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </section>
  172. <!-- /.content -->
  173. @endsection