home.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. @extends('layouts.main')
  2. @section('content')
  3. <!-- CONTENT HEADER -->
  4. <section class="content-header">
  5. <div class="container-fluid">
  6. <div class="row mb-2">
  7. <div class="col-sm-6">
  8. <h1>{{ __('Dashboard') }}</h1>
  9. </div>
  10. <div class="col-sm-6">
  11. <ol class="breadcrumb float-sm-right">
  12. <li class="breadcrumb-item"><a class="text-muted" href="">{{ __('Dashboard') }}</a></li>
  13. </ol>
  14. </div>
  15. </div>
  16. </div>
  17. </section>
  18. <!-- END CONTENT HEADER -->
  19. @if (!file_exists(base_path() . '/install.lock') && Auth::User()->hasRole("Admin"))
  20. <div class="callout callout-danger">
  21. <h4>{{ __('The installer is not locked!') }}</h4>
  22. <p>{{ __('please create a file called "install.lock" in your dashboard Root directory. Otherwise no settings will be loaded!') }}
  23. </p>
  24. <a href="/install?step=7"><button class="btn btn-outline-danger">{{ __('or click here') }}</button></a>
  25. </div>
  26. @endif
  27. @if ($general_settings->alert_enabled && !empty($general_settings->alert_message))
  28. <div class="alert mt-4 alert-{{ $general_settings->alert_type }}" role="alert">
  29. {!! $general_settings->alert_message !!}
  30. </div>
  31. @endif
  32. <!-- MAIN CONTENT -->
  33. <section class="content">
  34. <div class="container-fluid">
  35. <div class="row">
  36. <div class="col-12 col-sm-6 col-md-3">
  37. <div class="info-box">
  38. <span class="info-box-icon bg-info elevation-1"><i class="fas fa-server"></i></span>
  39. <div class="info-box-content">
  40. <span class="info-box-text">{{ __('Servers') }}</span>
  41. <span class="info-box-number">{{ Auth::user()->servers()->count() }}</span>
  42. </div>
  43. <!-- /.info-box-content -->
  44. </div>
  45. <!-- /.info-box -->
  46. </div>
  47. <!-- /.col -->
  48. <div class="col-12 col-sm-6 col-md-3">
  49. <div class="info-box mb-3">
  50. <span class="info-box-icon bg-secondary elevation-1"><i class="fas fa-coins"></i></span>
  51. <div class="info-box-content">
  52. <span class="info-box-text">{{ $general_settings->credits_display_name }}</span>
  53. <span class="info-box-number">{{ Auth::user()->Credits() }}</span>
  54. </div>
  55. <!-- /.info-box-content -->
  56. </div>
  57. <!-- /.info-box -->
  58. </div>
  59. <!-- /.col -->
  60. <!-- fix for small devices only -->
  61. <div class="clearfix hidden-md-up"></div>
  62. <div class="col-12 col-sm-6 col-md-3">
  63. <div class="info-box mb-3">
  64. <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-chart-line"></i></span>
  65. <div class="info-box-content">
  66. <span class="info-box-text">{{ $general_settings->credits_display_name }}
  67. {{ __('Usage') }}</span>
  68. <span class="info-box-number">{{ number_format($usage, 2, '.', '') }}
  69. <sup>{{ __('per month') }}</sup></span>
  70. </div>
  71. <!-- /.info-box-content -->
  72. </div>
  73. <!-- /.info-box -->
  74. </div>
  75. <!-- /.col -->
  76. @if ($credits > 0.01 && $usage > 0)
  77. <div class="col-12 col-sm-6 col-md-3">
  78. <div class="info-box mb-3">
  79. <span class="info-box-icon {{ $bg }} elevation-1">
  80. <i class="fas fa-hourglass-half"></i></span>
  81. <div class="info-box-content">
  82. <span
  83. class="info-box-text">{{ __('Out of Credits in', ['credits' => $general_settings->credits_display_name]) }}
  84. </span>
  85. <span class="info-box-number">{{ $boxText }}<sup>{{ $unit }}</sup></span>
  86. </div>
  87. </div>
  88. <!-- /.info-box -->
  89. @endif
  90. </div>
  91. <!-- /.col -->
  92. </div>
  93. <div class="row">
  94. <div class="col-md-6">
  95. @if ($website_settings->motd_enabled)
  96. <div class="card card-default">
  97. <div class="card-header">
  98. <h3 class="card-title">
  99. <i class="fas fa-home mr-2"></i>
  100. {{ config('app.name', 'MOTD') }} - MOTD
  101. </h3>
  102. </div>
  103. <!-- /.card-header -->
  104. <div class="card-body">
  105. {!! $website_settings->motd_message !!}
  106. </div>
  107. <!-- /.card-body -->
  108. </div>
  109. @endif
  110. <!-- /.card -->
  111. @if ($website_settings->useful_links_enabled)
  112. <div class="card card-default">
  113. <div class="card-header">
  114. <h3 class="card-title">
  115. <i class="fas fa-link mr-2"></i>
  116. {{ __('Useful Links') }}
  117. </h3>
  118. </div>
  119. <!-- /.card-header -->
  120. <div class="card-body">
  121. @foreach ($useful_links_dashboard as $useful_link)
  122. <div class="alert alert-dismissible">
  123. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
  124. <h5>
  125. <a class="alert-link text-decoration-none" target="__blank"
  126. href="{{ $useful_link->link }}">
  127. <i class="{{ $useful_link->icon }} mr-2"></i>{{ $useful_link->title }}
  128. </a>
  129. </h5>
  130. {!! $useful_link->description !!}
  131. </div>
  132. @endforeach
  133. </div>
  134. <!-- /.card-body -->
  135. </div>
  136. @endif
  137. </div>
  138. <div class="col-md-6">
  139. <div class="card card-default">
  140. <div class="card-header">
  141. <h3 class="card-title">
  142. <i class="fas fa-history mr-2"></i>
  143. {{ __('Activity Logs') }}
  144. </h3>
  145. </div>
  146. <!-- /.card-header -->
  147. <div class="card-body py-0 pb-2">
  148. <ul class="list-group list-group-flush">
  149. @foreach (Auth::user()->actions()->take(8)->orderBy('created_at', 'desc')->get() as $log)
  150. <li class="list-group-item d-flex justify-content-between text-muted">
  151. <span>
  152. @if (str_starts_with($log->description, 'created'))
  153. <small><i class="fas text-success fa-plus mr-2"></i></small>
  154. @elseif(str_starts_with($log->description, 'redeemed'))
  155. <small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
  156. @elseif(str_starts_with($log->description, 'deleted'))
  157. <small><i class="fas text-danger fa-times mr-2"></i></small>
  158. @elseif(str_starts_with($log->description, 'gained'))
  159. <small><i class="fas text-success fa-money-bill mr-2"></i></small>
  160. @elseif(str_starts_with($log->description, 'updated'))
  161. <small><i class="fas text-info fa-pen mr-2"></i></small>
  162. @endif
  163. {{ explode('\\', $log->subject_type)[2] }}
  164. {{ ucfirst($log->description) }}
  165. </span>
  166. <small>
  167. {{ $log->created_at->diffForHumans() }}
  168. </small>
  169. </li>
  170. @endforeach
  171. </ul>
  172. </div>
  173. <!-- /.card-body -->
  174. </div>
  175. <!-- /.card -->
  176. @if ($referral_settings->enabled)
  177. <!--PartnerDiscount::getDiscount()--->
  178. <div class="card card-default">
  179. <div class="card-header">
  180. <h3 class="card-title">
  181. <i class="fas fa-handshake mr-2"></i>
  182. {{ __('Partner program') }}
  183. </h3>
  184. </div>
  185. <!-- /.card-header -->
  186. <div class="card-body py-0 pb-2">
  187. @if (Auth::user()->can("user.referral"))
  188. <div class="row">
  189. <div class="mt-3 col-md-8">
  190. <span class="badge badge-success" style="font-size: 14px">
  191. <i class="fa fa-user-check mr-2"></i>
  192. {{ __('Your referral URL') }}:
  193. <span onmouseover="hoverIn()" onmouseout="hoverOut()" onclick="onClickCopy()"
  194. id="RefLink" style="cursor: pointer;">
  195. {{ __('Click to copy') }}
  196. </span>
  197. </span>
  198. </div>
  199. <div class="mt-3 col-md-4">
  200. <span class="badge badge-info"
  201. style="font-size: 14px">{{ __('Number of referred users:') }}
  202. {{ $numberOfReferrals }}</span>
  203. </div>
  204. </div>
  205. @if ($partnerDiscount)
  206. <hr
  207. style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-bottom: 0px">
  208. <table class="table">
  209. <thead>
  210. <tr>
  211. <th>{{ __('Your discount') }}</th>
  212. <th>{{ __('Discount for your new users') }}</th>
  213. <th>{{ __('Reward per registered user') }}</th>
  214. <th>{{ __('New user payment commision') }}</th>
  215. </tr>
  216. </thead>
  217. <tbody>
  218. <tr>
  219. <td>{{ $partnerDiscount->partner_discount }}%</td>
  220. <td>{{ $partnerDiscount->registered_user_discount }}%</td>
  221. <td>{{ $referral_settings->reward }}
  222. {{ $general_settings->credits_display_name }}</td>
  223. <td>{{ $partnerDiscount->referral_system_commission == -1 ? $referral_settings->percentage : $partnerDiscount->referral_system_commission }}%
  224. </td>
  225. </tr>
  226. </tbody>
  227. </table>
  228. <hr
  229. style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-top: 0px">
  230. @else
  231. <hr
  232. style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-bottom: 0px">
  233. <table class="table">
  234. <thead>
  235. <tr>
  236. @if(in_array($referral_settings->mode, ["sign-up","both"]))<th>{{ __('Reward per registered user') }}</th> @endif
  237. @if(in_array($referral_settings->mode, ["commission","both"]))<th>{{ __('New user payment commision') }}</th> @endif
  238. </tr>
  239. </thead>
  240. <tbody>
  241. <tr>
  242. @if(in_array($referral_settings->mode, ["sign-up","both"]))<td>{{ $referral_settings->reward }} {{ $general_settings->credits_display_name }}</td> @endif
  243. @if(in_array($referral_settings->mode, ["commission","both"]))<td>{{ $referral_settings->percentage }}%</td> @endif
  244. </tr>
  245. </tbody>
  246. </table>
  247. <hr
  248. style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-top: 0px">
  249. @endif
  250. @else
  251. <span class="badge badge-warning"><i class="fa fa-user-check mr-2"></i>
  252. {{ __('Make a purchase to reveal your referral-URL') }}</span>
  253. @endif
  254. </div>
  255. <!-- /.card-body -->
  256. </div>
  257. @endif
  258. <!-- /.card -->
  259. </div>
  260. </div>
  261. </section>
  262. <!-- END CONTENT -->
  263. <script>
  264. var originalText = document.getElementById('RefLink').innerText;
  265. var link = "<?php echo route('register') . '?ref=' . Auth::user()->referral_code; ?>";
  266. var timeoutID;
  267. function hoverIn() {
  268. document.getElementById('RefLink').innerText = link;
  269. timeoutID = setTimeout(function() {
  270. document.getElementById('RefLink').innerText = originalText;
  271. }, 2000);
  272. }
  273. function hoverOut() {
  274. document.getElementById('RefLink').innerText = originalText;
  275. clearTimeout(timeoutID);
  276. }
  277. function onClickCopy() {
  278. if (navigator.clipboard) {
  279. navigator.clipboard.writeText(link).then(() => {
  280. Swal.fire({
  281. icon: 'success',
  282. title: '{{ __('URL copied to clipboard') }}',
  283. position: 'top-middle',
  284. showConfirmButton: false,
  285. background: '#343a40',
  286. toast: false,
  287. timer: 1000,
  288. timerProgressBar: true,
  289. didOpen: (toast) => {
  290. toast.addEventListener('mouseenter', Swal.stopTimer)
  291. toast.addEventListener('mouseleave', Swal.resumeTimer)
  292. }
  293. })
  294. })
  295. } else {
  296. console.log('Browser Not compatible')
  297. }
  298. }
  299. </script>
  300. @endsection