home.blade.php 16 KB

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