index.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. @extends('seller.layouts.app')
  2. @section('panel_content')
  3. <section class="py-5">
  4. <div class="container" style="max-width: 100%;">
  5. <div class="d-flex align-items-start">
  6. <div class="aiz-user-panel">
  7. <div class="row gutters-10">
  8. <div class="col-md-4 mx-auto mb-3" >
  9. <div class="bg-grad-1 text-white rounded-lg overflow-hidden">
  10. <span class="size-30px rounded-circle mx-auto bg-soft-primary d-flex align-items-center justify-content-center mt-3">
  11. <i class="las la-dollar-sign la-2x text-white"></i>
  12. </span>
  13. <div class="px-3 pt-3 pb-3">
  14. <div class="h4 fw-700 text-center">{{ single_price(Auth::user()->balance) }}</div>
  15. <div class="opacity-50 text-center">{{ translate('Affiliate Balance') }}</div>
  16. </div>
  17. </div>
  18. </div>
  19. {{--<div class="col-md-4 mx-auto mb-3" >
  20. <a href="{{ route('affiliate.payment_settings') }}">
  21. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  22. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  23. <i class="las la-dharmachakra la-3x text-white"></i>
  24. </span>
  25. <div class="fs-18 text-primary">{{ translate('Configure Payout') }}</div>
  26. </div>
  27. </a>
  28. </div>
  29. <div class="col-md-4 mx-auto mb-3" >
  30. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition" onclick="show_affiliate_withdraw_modal()">
  31. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  32. <i class="las la-plus la-3x text-white"></i>
  33. </span>
  34. <div class="fs-18 text-primary">{{ translate('Affiliate Withdraw Request') }}</div>
  35. </div>
  36. </div>--}}
  37. </div>
  38. <div class="row">
  39. @php
  40. $referral_code_url = $url;
  41. @endphp
  42. <div class="col">
  43. <div class="card">
  44. <div class="form-box-content p-3">
  45. <div class="form-group">
  46. <textarea id="referral_code_url" class="form-control" readonly type="text" >{{$referral_code_url}}</textarea>
  47. </div>
  48. <button type=button id="ref-cpurl-btn" class="btn btn-primary float-right" data-attrcpy="{{translate('Copied')}}" onclick="copyToClipboard('url')" >{{translate('Copy Url')}}</button>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <br>
  54. <div class="card">
  55. <form class="" id="sort_blogs" action="" method="GET">
  56. <div class="card-header row">
  57. <div class="col text-center text-md-left">
  58. <h5 class="mb-md-0 h6">{{translate('Affiliate Stats')}}</h5>
  59. </div>
  60. <div class="col-md-5 col-xl-4">
  61. <div class="input-group mb-0">
  62. <select class="form-control aiz-selectpicker" name="type" data-live-search="true">
  63. <option value="">Choose</option>
  64. <option value="Today" @if($type == 'Today') selected @endif>Today</option>
  65. <option value="7" @if($type == '7') selected @endif>Last 7 Days</option>
  66. <option value="30" @if($type == '30') selected @endif>Last 30 Days</option>
  67. </select>
  68. <button class="btn btn-primary input-group-append" type="submit">{{ translate('Filter') }}</button>
  69. </div>
  70. </div>
  71. </div>
  72. </form>
  73. <div class="card-body">
  74. <div class="row gutters-10">
  75. <div class="col-md-3 mx-auto mb-3">
  76. <a href="#">
  77. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  78. <span class="size-60px mx-auto d-flex align-items-center justify-content-center mb-3">
  79. <span class="la-3x text-white" style="color: #007bff !important;">
  80. {{ $statistics['total_seller'] }}
  81. </span>
  82. </span>
  83. <div class="fs-18 text-primary">{{ translate('total seller') }}</div>
  84. </div>
  85. </a>
  86. </div>
  87. <div class="col-md-3 mx-auto mb-3" >
  88. <a href="#">
  89. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  90. <span class="size-60px mx-auto d-flex align-items-center justify-content-center mb-3">
  91. <span class="la-3x text-white" style="color: #007bff !important;">
  92. {{ $statistics['total_orders'] }}
  93. </span>
  94. </span>
  95. <div class="fs-18 text-primary">{{ translate('total orders') }}</div>
  96. </div>
  97. </a>
  98. </div>
  99. <div class="col-md-3 mx-auto mb-3" >
  100. <a href="#">
  101. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  102. <span class="size-60px mx-auto d-flex align-items-center justify-content-center mb-3">
  103. <span class="la-3x text-white" style="color: #007bff !important;">
  104. {{ single_price($statistics['total_amount']) }}
  105. </span>
  106. </span>
  107. <div class="fs-18 text-primary">{{ translate('total amount') }}</div>
  108. </div>
  109. </a>
  110. </div>
  111. <div class="col-md-3 mx-auto mb-3" >
  112. <a href="#">
  113. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  114. <span class="size-60px mx-auto d-flex align-items-center justify-content-center mb-3">
  115. <span class="la-3x text-white" style="color: #007bff !important;">
  116. {{ single_price($statistics['total_brokerage']) }}
  117. </span>
  118. </span>
  119. <div class="fs-18 text-primary">{{ translate('total brokerage') }}</div>
  120. </div>
  121. </a>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="card">
  127. <div class="card-body">
  128. <table class="table aiz-table mb-0">
  129. <thead>
  130. <tr>
  131. <th>#</th>
  132. <th>{{ translate('shop name')}}</th>
  133. <th data-breakpoints="lg">{{ translate('Order number')}}</th>
  134. <th data-breakpoints="lg">{{ translate('brokerage amount') }}</th>
  135. <th data-breakpoints="lg">{{ translate('level') }}</th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. @foreach($shops as $key => $shop)
  140. <tr>
  141. <td>{{ ($key+1) }}</td>
  142. <td>
  143. {{ $shop['shop_name'] }}
  144. </td>
  145. <td>{{ $shop['order_number'] }}</td>
  146. <td>
  147. {{ single_price($shop['brokerage']) }}
  148. </td>
  149. <td>{{ $shop['level'] }}</td>
  150. </tr>
  151. @endforeach
  152. </tbody>
  153. </table>
  154. </div>
  155. </div>
  156. <div class="card">
  157. <div class="card-header">
  158. <h5 class="mb-0 h6">{{translate('Affiliate Earning History')}}</h5>
  159. </div>
  160. <div class="card-body">
  161. <table class="table aiz-table mb-0">
  162. <thead>
  163. <tr>
  164. <th>#</th>
  165. <th>{{ translate('Referral User')}}</th>
  166. <th>{{ translate('Amount')}}</th>
  167. <th data-breakpoints="lg">{{ translate('Order Id')}}</th>
  168. <th data-breakpoints="lg">{{ translate('Referral Type') }}</th>
  169. <th data-breakpoints="lg">{{ translate('Product') }}</th>
  170. <th data-breakpoints="lg">{{ translate('Date') }}</th>
  171. </thead>
  172. <tbody>
  173. @foreach($affiliate_logs as $key => $affiliate_log)
  174. <tr>
  175. <td>{{ ($key+1) + ($affiliate_logs->currentPage() - 1)*$affiliate_logs->perPage() }}</td>
  176. <td>
  177. @if($affiliate_log->user_id !== null)
  178. {{ $affiliate_log->user->name }}
  179. @else
  180. {{ translate('Guest').' ('. $affiliate_log->guest_id.')' }}
  181. @endif
  182. </td>
  183. <td>{{ single_price($affiliate_log->amount) }}</td>
  184. <td>
  185. @if($affiliate_log->order_id != null)
  186. {{ $affiliate_log->order->code }}
  187. @else
  188. {{ $affiliate_log->order_detail->order->code }}
  189. @endif
  190. </td>
  191. <td> {{ ucwords(str_replace('_',' ', $affiliate_log->affiliate_type)) }}</td>
  192. <td>
  193. @if($affiliate_log->order_detail_id != null)
  194. {{ $affiliate_log->order_detail->product->name }}
  195. @endif
  196. @foreach ($affiliate_log->order->details as $key => $orderDetail)
  197. <div>
  198. {{ $orderDetail->product->name }}
  199. </div>
  200. @endforeach
  201. </td>
  202. <td>{{ $affiliate_log->created_at->format('d, F Y') }} </td>
  203. </tr>
  204. @endforeach
  205. </tbody>
  206. </table>
  207. <div class="aiz-pagination">
  208. {{ $affiliate_logs->links() }}
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </section>
  216. @endsection
  217. @section('modal')
  218. <div class="modal fade" id="affiliate_withdraw_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  219. <div class="modal-dialog modal-dialog-centered" role="document">
  220. <div class="modal-content">
  221. <div class="modal-header">
  222. <h5 class="modal-title" id="exampleModalLabel">{{ translate('Affiliate Withdraw Request') }}</h5>
  223. <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
  224. </div>
  225. <form class="" action="{{ route('affiliate.withdraw_request.store') }}" method="post">
  226. @csrf
  227. <div class="modal-body gry-bg px-3 pt-3">
  228. <div class="row">
  229. <div class="col-md-3">
  230. <label>{{ translate('Amount')}} <span class="text-danger">*</span></label>
  231. </div>
  232. </div>
  233. <div class="form-group text-right">
  234. <button type="submit" class="btn btn-sm btn-primary transition-3d-hover mr-1">{{translate('Confirm')}}</button>
  235. </div>
  236. </div>
  237. </form>
  238. </div>
  239. </div>
  240. </div>
  241. @endsection
  242. @section('script')
  243. <script>
  244. function copyToClipboard(btn){
  245. // var el_code = document.getElementById('referral_code');
  246. var el_url = document.getElementById('referral_code_url');
  247. // var c_b = document.getElementById('ref-cp-btn');
  248. var c_u_b = document.getElementById('ref-cpurl-btn');
  249. // if(btn == 'code'){
  250. // if(el_code != null && c_b != null){
  251. // el_code.select();
  252. // document.execCommand('copy');
  253. // c_b .innerHTML = c_b.dataset.attrcpy;
  254. // }
  255. // }
  256. if(btn == 'url'){
  257. if(el_url != null && c_u_b != null){
  258. el_url.select();
  259. document.execCommand('copy');
  260. c_u_b .innerHTML = c_u_b.dataset.attrcpy;
  261. }
  262. }
  263. }
  264. function show_affiliate_withdraw_modal(){
  265. $('#affiliate_withdraw_modal').modal('show');
  266. }
  267. </script>
  268. @endsection