ctrlpanel/resources/views/store/index.blade.php

109 lines
4.5 KiB
PHP
Raw Normal View History

2021-06-05 09:26:32 +00:00
@extends('layouts.main')
2022-05-30 09:07:10 +00:00
<?php use App\Models\ShopProduct; ?>
2021-06-05 09:26:32 +00:00
@section('content')
<!-- CONTENT HEADER -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>{{ __('Store') }}</h1>
2021-06-05 09:26:32 +00:00
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a class=""
2022-05-30 07:23:35 +00:00
href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
2022-05-30 07:23:35 +00:00
href="{{ route('store.index') }}">{{ __('Store') }}</a></li>
2021-06-05 09:26:32 +00:00
</ol>
</div>
</div>
</div>
</section>
<!-- END CONTENT HEADER -->
<!-- MAIN CONTENT -->
<section class="content">
<div class="container-fluid">
<div class="text-right mb-3">
<button type="button" data-toggle="modal" data-target="#redeemVoucherModal" class="btn btn-primary">
<i class="fas fa-money-check-alt mr-2"></i>{{ __('Redeem code') }}
</button>
</div>
@if ($isPaymentSetup && $products->count() > 0)
2021-06-05 09:26:32 +00:00
<div class="card">
<div class="card-header">
2021-12-12 23:58:47 +00:00
<h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{ CREDITS_DISPLAY_NAME }}</h5>
2021-06-05 09:26:32 +00:00
</div>
<div class="card-body">
<table class="table table-striped table-responsive-sm">
<thead>
2022-05-30 07:23:35 +00:00
<tr>
<th>{{ __('Price') }}</th>
<th>{{ __('Type') }}</th>
<th>{{ __('Description') }}</th>
<th></th>
</tr>
2021-12-12 23:58:47 +00:00
</thead>
<tbody>
2022-05-30 09:07:10 +00:00
<?php /** @var $product ShopProduct */
2022-05-30 07:23:35 +00:00
?>
@foreach ($products as $product)
<tr>
<td>{{ $product->formatToCurrency($product->price) }}</td>
<td>{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
</td>
<td>
@if(strtolower($product->type) == 'credits')
<i class="fa fa-coins mr-2"></i>
@elseif (strtolower($product->type) == 'server slots')
<i class="fa fa-server mr-2"></i>
@endif
{{ $product->display }}</td>
<td><a href="{{ route('checkout', $product->id) }}"
class="btn btn-info">{{ __('Purchase') }}</a>
</td>
</tr>
@endforeach
2021-06-05 09:26:32 +00:00
</tbody>
</table>
</div>
</div>
@else
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-ban"></i> @if ($products->count() == 0) {{ __('There are no store products!') }} @else {{ __('The store is not correctly configured!') }} @endif
2021-06-05 09:26:32 +00:00
</h4>
</div>
2021-06-05 09:26:32 +00:00
@endif
</div>
</section>
<!-- END CONTENT -->
<script>
const getUrlParameter = (param) => {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
return urlParams.get(param);
}
const voucherCode = getUrlParameter('voucher');
//if voucherCode not empty, open the modal and fill the input
if (voucherCode) {
$(function() {
$('#redeemVoucherModal').modal('show');
$('#redeemVoucherCode').val(voucherCode);
});
}
</script>
2021-06-05 09:26:32 +00:00
@endsection