index.blade.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. @extends('frontend.layouts.app')
  2. @section('content')
  3. <section class="py-5">
  4. <div class="container">
  5. <div class="d-flex align-items-start">
  6. @include('frontend.inc.user_side_nav')
  7. <div class="aiz-user-panel">
  8. <div class="aiz-titlebar mt-2 mb-4">
  9. <div class="row align-items-center">
  10. <div class="col-md-6">
  11. <h1 class="h3">{{ translate('Affiliate') }}</h1>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="row gutters-10">
  16. <div class="col-md-4 mx-auto mb-3" >
  17. <div class="bg-grad-1 text-white rounded-lg overflow-hidden">
  18. <span class="size-30px rounded-circle mx-auto bg-soft-primary d-flex align-items-center justify-content-center mt-3">
  19. <i class="las la-dollar-sign la-2x text-white"></i>
  20. </span>
  21. <div class="px-3 pt-3 pb-3">
  22. <div class="h4 fw-700 text-center">{{ single_price(Auth::user()->affiliate_user->balance) }}</div>
  23. <div class="opacity-50 text-center">{{ translate('Affiliate Balance') }}</div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="col-md-4 mx-auto mb-3" >
  28. <a href="{{ route('affiliate.payment_settings') }}">
  29. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  30. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  31. <i class="las la-dharmachakra la-3x text-white"></i>
  32. </span>
  33. <div class="fs-18 text-primary">{{ translate('Configure Payout') }}</div>
  34. </div>
  35. </a>
  36. </div>
  37. <div class="col-md-4 mx-auto mb-3" >
  38. <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()">
  39. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  40. <i class="las la-plus la-3x text-white"></i>
  41. </span>
  42. <div class="fs-18 text-primary">{{ translate('Affiliate Withdraw Request') }}</div>
  43. </div>
  44. </div>
  45. </div>
  46. @if (addon_is_activated('affiliate_system')
  47. && \App\Models\AffiliateOption::where('type', 'user_registration_first_purchase')->first()->status)
  48. <div class="row">
  49. @php
  50. if(Auth::user()->referral_code == null){
  51. Auth::user()->referral_code = substr(Auth::user()->id.Str::random(), 0, 10);
  52. Auth::user()->save();
  53. }
  54. $referral_code = Auth::user()->referral_code;
  55. $referral_code_url = URL::to('/users/registration')."?referral_code=$referral_code";
  56. @endphp
  57. <div class="col">
  58. <div class="card">
  59. <div class="form-box-content p-3">
  60. <div class="form-group">
  61. <textarea id="referral_code_url" class="form-control" readonly type="text" >{{$referral_code_url}}</textarea>
  62. </div>
  63. <button type=button id="ref-cpurl-btn" class="btn btn-primary float-right" data-attrcpy="{{translate('Copied')}}" onclick="copyToClipboard('url')" >{{translate('Copy Url')}}</button>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. @endif
  69. <br>
  70. <div class="card">
  71. <form class="" id="sort_blogs" action="" method="GET">
  72. <div class="card-header row">
  73. <div class="col text-center text-md-left">
  74. <h5 class="mb-md-0 h6">{{translate('Affiliate Stats')}}</h5>
  75. </div>
  76. <div class="col-md-5 col-xl-4">
  77. <div class="input-group mb-0">
  78. <select class="form-control aiz-selectpicker" name="type" data-live-search="true">
  79. <option value="">Choose</option>
  80. <option value="Today" @if($type == 'Today') selected @endif>Today</option>
  81. <option value="7" @if($type == '7') selected @endif>Last 7 Days</option>
  82. <option value="30" @if($type == '30') selected @endif>Last 30 Days</option>
  83. </select>
  84. <button class="btn btn-primary input-group-append" type="submit">{{ translate('Filter') }}</button>
  85. </div>
  86. </div>
  87. </div>
  88. </form>
  89. <div class="card-body">
  90. <div class="row gutters-10">
  91. <div class="col-md-3 mx-auto mb-3">
  92. <a href="#">
  93. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  94. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  95. <span class="la-3x text-white">
  96. @if($affliate_stats->count_click)
  97. {{ $affliate_stats->count_click }}
  98. @else
  99. 0
  100. @endif
  101. </span>
  102. </span>
  103. <div class="fs-18 text-primary">{{ translate('No of click') }}</div>
  104. </div>
  105. </a>
  106. </div>
  107. <div class="col-md-3 mx-auto mb-3" >
  108. <a href="#">
  109. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  110. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  111. <span class="la-3x text-white">
  112. @if($affliate_stats->count_item)
  113. {{ $affliate_stats->count_item }}
  114. @else
  115. 0
  116. @endif
  117. </span>
  118. </span>
  119. <div class="fs-18 text-primary">{{ translate('No of item') }}</div>
  120. </div>
  121. </a>
  122. </div>
  123. <div class="col-md-3 mx-auto mb-3" >
  124. <a href="#">
  125. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  126. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  127. <span class="la-3x text-white">
  128. @if($affliate_stats->count_delivered)
  129. {{ $affliate_stats->count_delivered }}
  130. @else
  131. 0
  132. @endif
  133. </span>
  134. </span>
  135. <div class="fs-18 text-primary">{{ translate('No of deliverd') }}</div>
  136. </div>
  137. </a>
  138. </div>
  139. <div class="col-md-3 mx-auto mb-3" >
  140. <a href="#">
  141. <div class="p-3 rounded mb-3 c-pointer text-center bg-white shadow-sm hov-shadow-lg has-transition">
  142. <span class="size-60px rounded-circle mx-auto bg-secondary d-flex align-items-center justify-content-center mb-3">
  143. <span class="la-3x text-white">
  144. @if($affliate_stats->count_cancel)
  145. {{ $affliate_stats->count_cancel }}
  146. @else
  147. 0
  148. @endif
  149. </span>
  150. </span>
  151. <div class="fs-18 text-primary">{{ translate('No of cancel') }}</div>
  152. </div>
  153. </a>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="card">
  159. <div class="card-header">
  160. <h5 class="mb-0 h6">{{translate('Affiliate Earning History')}}</h5>
  161. </div>
  162. <div class="card-body">
  163. <table class="table aiz-table mb-0">
  164. <thead>
  165. <tr>
  166. <th>#</th>
  167. <th>{{ translate('Referral User')}}</th>
  168. <th>{{ translate('Amount')}}</th>
  169. <th data-breakpoints="lg">{{ translate('Order Id')}}</th>
  170. <th data-breakpoints="lg">{{ translate('Referral Type') }}</th>
  171. <th data-breakpoints="lg">{{ translate('Product') }}</th>
  172. <th data-breakpoints="lg">{{ translate('Date') }}</th>
  173. </thead>
  174. <tbody>
  175. @foreach($affiliate_logs as $key => $affiliate_log)
  176. <tr>
  177. <td>{{ ($key+1) + ($affiliate_logs->currentPage() - 1)*$affiliate_logs->perPage() }}</td>
  178. <td>
  179. @if($affiliate_log->user_id !== null)
  180. {{ $affiliate_log->user->name }}
  181. @else
  182. {{ translate('Guest').' ('. $affiliate_log->guest_id.')' }}
  183. @endif
  184. </td>
  185. <td>{{ single_price($affiliate_log->amount) }}</td>
  186. <td>
  187. @if($affiliate_log->order_id != null)
  188. {{ $affiliate_log->order->code }}
  189. @else
  190. {{ $affiliate_log->order_detail->order->code }}
  191. @endif
  192. </td>
  193. <td> {{ ucwords(str_replace('_',' ', $affiliate_log->affiliate_type)) }}</td>
  194. <td>
  195. @if($affiliate_log->order_detail_id != null)
  196. {{ $affiliate_log->order_detail->product->name }}
  197. @endif
  198. </td>
  199. <td>{{ $affiliate_log->created_at->format('d, F Y') }} </td>
  200. </tr>
  201. @endforeach
  202. </tbody>
  203. </table>
  204. <div class="aiz-pagination">
  205. {{ $affiliate_logs->links() }}
  206. </div>
  207. </div>
  208. </div>
  209. {{-- <div class="row">
  210. <div class="col-md-6">
  211. <div class="card">
  212. <div class="card-header">
  213. <h5 class="mb-0 h6">{{ translate('Affiliate payment history')}}</h5>
  214. </div>
  215. <div class="card-body">
  216. <table class="table aiz-table mb-0">
  217. <thead>
  218. <tr>
  219. <th>#</th>
  220. <th>{{ translate('Date') }}</th>
  221. <th>{{translate('Amount')}}</th>
  222. <th>{{translate('Payment Method')}}</th>
  223. </tr>
  224. </thead>
  225. <tbody>
  226. @foreach ($affiliate_payments as $key => $affiliate_payment)
  227. <tr>
  228. <td>{{ $key+1 }}</td>
  229. <td>{{ date('d-m-Y', strtotime($affiliate_payment->created_at)) }}</td>
  230. <td>{{ single_price($affiliate_payment->amount) }}</td>
  231. <td>{{ ucfirst(str_replace('_', ' ', $affiliate_payment ->payment_method)) }}</td>
  232. </tr>
  233. @endforeach
  234. </tbody>
  235. </table>
  236. <div class="aiz-pagination">
  237. {{ $affiliate_payments->links() }}
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. <div class="col-md-6">
  243. <div class="card">
  244. <div class="card-header">
  245. <h5 class="mb-0 h6">{{ translate('Affiliate withdraw request history')}}</h5>
  246. </div>
  247. <div class="card-body">
  248. <table class="table aiz-table mb-0">
  249. <thead>
  250. <tr>
  251. <th>#</th>
  252. <th>{{ translate('Date') }}</th>
  253. <th>{{ translate('Amount')}}</th>
  254. <th>{{ translate('Status')}}</th>
  255. </tr>
  256. </thead>
  257. <tbody>
  258. @foreach ($affiliate_withdraw_requests as $key => $affiliate_withdraw_request)
  259. <tr>
  260. <td>{{ $key+1 }}</td>
  261. <td>{{ date('d-m-Y', strtotime($affiliate_withdraw_request->created_at)) }}</td>
  262. <td>{{ single_price($affiliate_withdraw_request->amount) }}</td>
  263. <td>
  264. @if($affiliate_withdraw_request->status == 1)
  265. <span class="badge badge-inline badge-success">{{translate('Approved')}}</span>
  266. @elseif($affiliate_withdraw_request->status == 2)
  267. <span class="badge badge-inline badge-danger">{{translate('Rejected')}}</span>
  268. @else
  269. <span class="badge badge-inline badge-info">{{translate('Pending')}}</span>
  270. @endif
  271. </td>
  272. </tr>
  273. @endforeach
  274. </tbody>
  275. </table>
  276. <div class="aiz-pagination">
  277. {{ $affiliate_withdraw_requests->links() }}
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. </div> --}}
  283. </div>
  284. </div>
  285. </div>
  286. </section>
  287. @endsection
  288. @section('modal')
  289. <div class="modal fade" id="affiliate_withdraw_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  290. <div class="modal-dialog modal-dialog-centered" role="document">
  291. <div class="modal-content">
  292. <div class="modal-header">
  293. <h5 class="modal-title" id="exampleModalLabel">{{ translate('Affiliate Withdraw Request') }}</h5>
  294. <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
  295. </div>
  296. <form class="" action="{{ route('affiliate.withdraw_request.store') }}" method="post">
  297. @csrf
  298. <div class="modal-body gry-bg px-3 pt-3">
  299. <div class="row">
  300. <div class="col-md-3">
  301. <label>{{ translate('Amount')}} <span class="text-danger">*</span></label>
  302. </div>
  303. <div class="col-md-9">
  304. <input type="number" class="form-control mb-3" name="amount" min="1" max="{{ Auth::user()->affiliate_user->balance }}" placeholder="{{ translate('Amount')}}" required>
  305. </div>
  306. </div>
  307. <div class="form-group text-right">
  308. <button type="submit" class="btn btn-sm btn-primary transition-3d-hover mr-1">{{translate('Confirm')}}</button>
  309. </div>
  310. </div>
  311. </form>
  312. </div>
  313. </div>
  314. </div>
  315. @endsection
  316. @section('script')
  317. <script>
  318. function copyToClipboard(btn){
  319. // var el_code = document.getElementById('referral_code');
  320. var el_url = document.getElementById('referral_code_url');
  321. // var c_b = document.getElementById('ref-cp-btn');
  322. var c_u_b = document.getElementById('ref-cpurl-btn');
  323. // if(btn == 'code'){
  324. // if(el_code != null && c_b != null){
  325. // el_code.select();
  326. // document.execCommand('copy');
  327. // c_b .innerHTML = c_b.dataset.attrcpy;
  328. // }
  329. // }
  330. if(btn == 'url'){
  331. if(el_url != null && c_u_b != null){
  332. el_url.select();
  333. document.execCommand('copy');
  334. c_u_b .innerHTML = c_u_b.dataset.attrcpy;
  335. }
  336. }
  337. }
  338. function show_affiliate_withdraw_modal(){
  339. $('#affiliate_withdraw_modal').modal('show');
  340. }
  341. </script>
  342. @endsection