index.blade.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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>{{ __('Store') }}</h1>
  9. </div>
  10. <div class="col-sm-6">
  11. <ol class="breadcrumb float-sm-right">
  12. <li class="breadcrumb-item"><a class="" href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
  13. <li class="breadcrumb-item"><a class="text-muted"
  14. href="{{ route('store.index') }}">{{ __('Store') }}</a></li>
  15. </ol>
  16. </div>
  17. </div>
  18. </div>
  19. </section>
  20. <!-- END CONTENT HEADER -->
  21. <!-- MAIN CONTENT -->
  22. <section class="content">
  23. <div class="container-fluid">
  24. <div class="text-right mb-3">
  25. <button type="button" data-toggle="modal" data-target="#redeemVoucherModal" class="btn btn-primary">
  26. <i class="fas fa-money-check-alt mr-2"></i>{{ __('Redeem code') }}
  27. </button>
  28. </div>
  29. @if ($isStoreEnabled && $products->count() > 0)
  30. <div class="card">
  31. <div class="card-header">
  32. <h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{ $credits_display_name }}</h5>
  33. </div>
  34. <div class="card-body">
  35. <table class="table table-striped table-responsive-sm">
  36. <thead>
  37. <tr>
  38. <th>{{ __('Price') }}</th>
  39. <th>{{ __('Type') }}</th>
  40. <th>{{ __('Description') }}</th>
  41. <th></th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. @foreach ($products as $product)
  46. <tr>
  47. <td>{{ $product->formatToCurrency($product->price) }}</td>
  48. <td>{{ strtolower($product->type) == 'credits' ? $credits_display_name : $product->type }}
  49. </td>
  50. <td>
  51. @if (strtolower($product->type) == 'credits')
  52. <i class="fa fa-coins mr-2"></i>
  53. @elseif (strtolower($product->type) == 'server slots')
  54. <i class="fa fa-server mr-2"></i>
  55. @endif
  56. {{ $product->display }}
  57. </td>
  58. <td><a href="{{ route('checkout', $product->id) }}"
  59. class="btn btn-info @cannot('user.shop.buy') disabled @endcannot">{{ __('Purchase') }}</a>
  60. </td>
  61. </tr>
  62. @endforeach
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. @else
  68. <div class="alert alert-danger alert-dismissible">
  69. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
  70. <h4><i class="icon fa fa-ban"></i>
  71. @if ($products->count() == 0)
  72. {{ __('There are no store products!') }}
  73. @else
  74. {{ __('The store is not correctly configured!') }}
  75. @endif
  76. </h4>
  77. </div>
  78. @endif
  79. </div>
  80. </section>
  81. <!-- END CONTENT -->
  82. <script>
  83. const getUrlParameter = (param) => {
  84. const queryString = window.location.search;
  85. const urlParams = new URLSearchParams(queryString);
  86. return urlParams.get(param);
  87. }
  88. const voucherCode = getUrlParameter('voucher');
  89. //if voucherCode not empty, open the modal and fill the input
  90. if (voucherCode) {
  91. $(function() {
  92. $('#redeemVoucherModal').modal('show');
  93. $('#redeemVoucherCode').val(voucherCode);
  94. });
  95. }
  96. </script>
  97. @endsection