index.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @extends('seller.layouts.app')
  2. @section('panel_content')
  3. <div class="row gutters-10 justify-content-center">
  4. @php
  5. $count = DB::table('orders')->where('seller_id', Auth::user()->id)
  6. ->count();
  7. $grand_total = DB::table('orders')->where('seller_id', Auth::user()->id)
  8. ->sum('orders.grand_total');
  9. $product_storehouse_total = DB::table('orders')->where('seller_id', Auth::user()->id)
  10. ->sum('orders.product_storehouse_total');
  11. $total_turnover = "$".sprintf('%.2f',$grand_total);
  12. $total_profit = "$".sprintf('%.2f',($grand_total - $product_storehouse_total));
  13. @endphp
  14. <div class="col-md-4 mx-auto mb-3">
  15. <div class="bg-grad-1 text-white rounded-lg overflow-hidden">
  16. <span class="size-30px rounded-circle mx-auto bg-soft-primary d-flex align-items-center justify-content-center mt-3">
  17. <i class="las la-upload la-2x" style="color: #007bff"></i>
  18. </span>
  19. <div class="px-3 pt-3 pb-3">
  20. <div class="h4 fw-700 text-center">{{ $count }}</div>
  21. <div class="opacity-50 text-center">{{ translate('Total Orders') }}</div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="col-md-4 mx-auto mb-3">
  26. <div class="bg-grad-1 text-white rounded-lg overflow-hidden">
  27. <span class="size-30px rounded-circle mx-auto bg-soft-primary d-flex align-items-center justify-content-center mt-3">
  28. <i class="las la-upload la-2x" style="color: #007bff"></i>
  29. </span>
  30. <div class="px-3 pt-3 pb-3">
  31. <div class="h4 fw-700 text-center">{{ $total_turnover }}</div>
  32. <div class="opacity-50 text-center">{{ translate('Total Turnover') }}</div>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="col-md-4 mx-auto mb-3">
  37. <div class="bg-grad-1 text-white rounded-lg overflow-hidden">
  38. <span class="size-30px rounded-circle mx-auto bg-soft-primary d-flex align-items-center justify-content-center mt-3">
  39. <i class="las la-upload la-2x" style="color: #007bff"></i>
  40. </span>
  41. <div class="px-3 pt-3 pb-3">
  42. <div class="h4 fw-700 text-center">{{ $total_profit }}</div>
  43. <div class="opacity-50 text-center">{{ translate('Total Profit') }}</div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="card">
  49. <form id="sort_orders" action="" method="GET">
  50. <div class="card-header row gutters-5">
  51. <div class="col text-center text-md-left">
  52. <h5 class="mb-md-0 h6">{{ translate('Orders') }}</h5>
  53. </div>
  54. <div class="col-md-3 ml-auto">
  55. <select class="form-control aiz-selectpicker" data-placeholder="{{ translate('Filter by Payment Status')}}" name="payment_status" onchange="sort_orders()">
  56. <option value="">{{ translate('Filter by Payment Status')}}</option>
  57. <option value="paid" @isset($payment_status) @if($payment_status == 'paid') selected @endif @endisset>{{ translate('Paid')}}</option>
  58. <option value="unpaid" @isset($payment_status) @if($payment_status == 'unpaid') selected @endif @endisset>{{ translate('Un-Paid')}}</option>
  59. </select>
  60. </div>
  61. <div class="col-md-3 ml-auto">
  62. <select class="form-control aiz-selectpicker" data-placeholder="{{ translate('Filter by Payment Status')}}" name="delivery_status" onchange="sort_orders()">
  63. <option value="">{{ translate('Filter by Deliver Status')}}</option>
  64. <option value="pending" @isset($delivery_status) @if($delivery_status == 'pending') selected @endif @endisset>{{ translate('Pending')}}</option>
  65. <option value="confirmed" @isset($delivery_status) @if($delivery_status == 'confirmed') selected @endif @endisset>{{ translate('Confirmed')}}</option>
  66. <option value="on_delivery" @isset($delivery_status) @if($delivery_status == 'on_delivery') selected @endif @endisset>{{ translate('On delivery')}}</option>
  67. <option value="delivered" @isset($delivery_status) @if($delivery_status == 'delivered') selected @endif @endisset>{{ translate('Delivered')}}</option>
  68. </select>
  69. </div>
  70. <div class="col-md-3">
  71. <div class="from-group mb-0">
  72. <input type="text" class="form-control" id="search" name="search" @isset($sort_search) value="{{ $sort_search }}" @endisset placeholder="{{ translate('Order Code') }} {{ translate('Or') }} {{ translate('Email') }}">
  73. </div>
  74. </div>
  75. </div>
  76. </form>
  77. @if (count($orders) > 0)
  78. <div class="card-body p-3">
  79. <table class="table aiz-table mb-0">
  80. <thead>
  81. <tr>
  82. <th>#</th>
  83. <th>{{ translate('Order Code')}}</th>
  84. <th data-breakpoints="lg">{{ translate('Num. of Products')}}</th>
  85. <!--<th data-breakpoints="lg">{{ translate('Customer')}}</th>-->
  86. <th data-breakpoints="md">{{ translate('Amount')}}</th>
  87. <th data-breakpoints="md">{{ translate('Profit')}}</th>
  88. <th data-breakpoints="md">{{ translate('Pick Up Status') }}</th>
  89. <th data-breakpoints="lg">{{ translate('Delivery Status')}}</th>
  90. <th>{{ translate('Payment Status')}}</th>
  91. <th class="text-right">{{ translate('Options')}}</th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. @foreach ($orders as $key => $order_id)
  96. @php
  97. $order = \App\Models\Order::find($order_id->id);
  98. @endphp
  99. @if($order != null)
  100. <tr>
  101. <td>
  102. {{ $key+1 }}
  103. </td>
  104. <td>
  105. <a href="#{{ $order->code }}" onclick="show_order_details({{ $order->id }})">{{ $order->code }}</a>
  106. </td>
  107. <td>
  108. {{ count($order->orderDetails->where('seller_id', Auth::user()->id)) }}
  109. </td>
  110. <!--<td>-->
  111. <!-- @if ($order->user_id != null)-->
  112. <!-- {{ optional($order->user)->name }}-->
  113. <!-- @else-->
  114. <!-- {{ translate('Guest') }} ({{ $order->guest_id }})-->
  115. <!-- @endif-->
  116. <!--</td>-->
  117. <td>
  118. {{ single_price($order->grand_total) }}
  119. </td>
  120. <td>
  121. @if ($order->product_storehouse_total > 0)
  122. {{ single_price($order->grand_total - $order->product_storehouse_total) }}
  123. @else
  124. {{ translate('None') }}
  125. @endif
  126. </td>
  127. <td>
  128. @if ($order->product_storehouse_status)
  129. <span class="badge badge-inline badge-success">{{translate('Picked Up')}}</span>
  130. @else
  131. @if ($order->product_storehouse_total)
  132. <span class="badge badge-inline badge-danger">{{translate('Unpicked Up')}}</span>
  133. @endif
  134. @endif
  135. </td>
  136. <td>
  137. @php
  138. $status = $order->delivery_status;
  139. @endphp
  140. {{ translate(ucfirst(str_replace('_', ' ', $status))) }}
  141. </td>
  142. <td>
  143. @if ($order->payment_status == 'paid')
  144. <span class="badge badge-inline badge-success">{{ translate('Paid')}}</span>
  145. @else
  146. <span class="badge badge-inline badge-danger">{{ translate('Unpaid')}}</span>
  147. @endif
  148. </td>
  149. <td class="text-right">
  150. <a href="{{ route('seller.orders.show', encrypt($order->id)) }}" class="btn btn-soft-info btn-icon btn-circle btn-sm" title="{{ translate('Order Details') }}">
  151. <i class="las la-eye"></i>
  152. </a>
  153. <a href="{{ route('seller.invoice.download', $order->id) }}" class="btn btn-soft-warning btn-icon btn-circle btn-sm" title="{{ translate('Download Invoice') }}">
  154. <i class="las la-download"></i>
  155. </a>
  156. </td>
  157. </tr>
  158. @endif
  159. @endforeach
  160. </tbody>
  161. </table>
  162. <div class="aiz-pagination">
  163. {{ $orders->links() }}
  164. </div>
  165. </div>
  166. @endif
  167. </div>
  168. @endsection
  169. @section('script')
  170. <script type="text/javascript">
  171. function sort_orders(el){
  172. $('#sort_orders').submit();
  173. }
  174. </script>
  175. @endsection