More Variables..

This commit is contained in:
Ferks-FK 2023-02-06 21:01:20 +00:00 committed by IceToast
parent f00f5addfe
commit fc49c6490f
13 changed files with 36 additions and 32 deletions

View file

@ -18,6 +18,7 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Helpers\ExtensionHelper;
use App\Settings\GeneralSettings;
use App\Settings\LocaleSettings;
class PaymentController extends Controller
@ -38,7 +39,7 @@ class PaymentController extends Controller
* @param ShopProduct $shopProduct
* @return Application|Factory|View
*/
public function checkOut(ShopProduct $shopProduct)
public function checkOut(ShopProduct $shopProduct, GeneralSettings $general_settings)
{
$discount = PartnerDiscount::getDiscount();
$price = $shopProduct->price - ($shopProduct->price * $discount / 100);
@ -69,6 +70,7 @@ class PaymentController extends Controller
'total' => $shopProduct->getTotalPrice(),
'paymentGateways' => $paymentGateways,
'productIsFree' => $price <= 0,
'credits_display_name' => $general_settings->credits_display_name
]);
}

View file

@ -83,11 +83,12 @@ class ShopProductController extends Controller
* @param ShopProduct $shopProduct
* @return Application|Factory|View|Response
*/
public function edit(ShopProduct $shopProduct)
public function edit(ShopProduct $shopProduct, GeneralSettings $general_settings)
{
return view('admin.store.edit', [
'currencyCodes' => config('currency_codes'),
'shopProduct' => $shopProduct,
'credits_display_name' => $general_settings->credits_display_name
]);
}

View file

@ -125,11 +125,12 @@ class VoucherController extends Controller
return redirect()->back()->with('success', __('voucher has been removed!'));
}
public function users(Voucher $voucher, LocaleSettings $locale_settings)
public function users(Voucher $voucher, LocaleSettings $locale_settings, GeneralSettings $general_settings)
{
return view('admin.vouchers.users', [
'voucher' => $voucher,
'locale_datatables' => $locale_settings->datatables
'locale_datatables' => $locale_settings->datatables,
'credits_display_name' => $general_settings->credits_display_name
]);
}

View file

@ -79,7 +79,7 @@ class ServerController extends Controller
}
/** Show the form for creating a new resource. */
public function create(UserSettings $user_settings, ServerSettings $server_settings)
public function create(UserSettings $user_settings, ServerSettings $server_settings, GeneralSettings $general_settings)
{
$validate_configuration = $this->validateConfigurationRules($user_settings, $server_settings);
@ -115,7 +115,8 @@ class ServerController extends Controller
'eggs' => $eggs,
'user' => Auth::user(),
'server_creation_enabled' => $server_settings->creation_enabled,
'min_credits_to_make_server' => $user_settings->min_credits_to_make_server
'min_credits_to_make_server' => $user_settings->min_credits_to_make_server,
'credits_display_name' => $general_settings->credits_display_name
]);
}
@ -268,7 +269,7 @@ class ServerController extends Controller
}
/** Show Server Settings */
public function show(Server $server, ServerSettings $server_settings)
public function show(Server $server, ServerSettings $server_settings, GeneralSettings $general_settings)
{
if ($server->user_id != Auth::user()->id) {
return back()->with('error', __('This is not your Server!'));
@ -308,7 +309,8 @@ class ServerController extends Controller
return view('servers.settings')->with([
'server' => $server,
'products' => $products,
'server_enable_upgrade' => $server_settings->enable_upgrade
'server_enable_upgrade' => $server_settings->enable_upgrade,
'credits_display_name' => $general_settings->credits_display_name
]);
}

View file

@ -3,13 +3,14 @@
namespace App\Http\Controllers;
use App\Models\ShopProduct;
use App\Settings\GeneralSettings;
use App\Settings\UserSettings;
use Illuminate\Support\Facades\Auth;
class StoreController extends Controller
{
/** Display a listing of the resource. */
public function index(UserSettings $user_settings)
public function index(UserSettings $user_settings, GeneralSettings $general_settings)
{
$isPaymentSetup = false;
@ -33,7 +34,8 @@ class StoreController extends Controller
return view('store.index')->with([
'products' => ShopProduct::where('disabled', '=', false)->orderBy('type', 'asc')->orderBy('price', 'asc')->get(),
'isPaymentSetup' => $isPaymentSetup,
'isPaymentSetup' => true,
'credits_display_name' => $general_settings->credits_display_name
]);
}
}

View file

@ -75,7 +75,7 @@
</div>
<div class="form-group">
<label for="price">{{__('Price in')}} {{ CREDITS_DISPLAY_NAME }}</label>
<label for="price">{{__('Price in')}} {{ $credits_display_name }}</label>
<input value="{{ $product->price }}" id="price" name="price" type="number" step=".01"
class="form-control @error('price') is-invalid @enderror"
required="required">

View file

@ -37,14 +37,14 @@
<table id="datatable" class="table table-striped">
<thead>
<tr>
<th width="20"></th>
<th width="20">{{ __('Status') }}</th>
<th>{{__('Name')}}</th>
<th>{{__('User')}}</th>
<th>{{__('Server id')}}</th>
<th>{{__('Config')}}</th>
<th>{{__('Suspended at')}}</th>
<th>{{__('Created at')}}</th>
<th></th>
<th>{{ __('Actions') }}</th>
</tr>
</thead>
<tbody>

View file

@ -48,7 +48,7 @@
<label for="type">{{ __('Type') }}</label>
<select required name="type" id="type"
class="custom-select @error('name') is-invalid @enderror">
<option @if ($shopProduct->type == 'credits') selected @endif value="Credits">{{ CREDITS_DISPLAY_NAME }}</option>
<option @if ($shopProduct->type == 'credits') selected @endif value="Credits">{{ $credits_display_name }}</option>
<option @if ($shopProduct->type == 'Server slots') selected @endif value="Server slots">{{__("Server Slots")}}</option>
</select>
@error('name')
@ -75,12 +75,12 @@
<div class="text-muted">
{{ __('Checkout the paypal docs to select the appropriate code') }} <a
target="_blank"
href="https://developer.paypal.com/docs/api/reference/currency-codes/">link</a>
href="https://developer.paypal.com/docs/api/reference/currency-codes/">{{ __('Link') }}</a>
</div>
</div>
<div class="form-group">
<label for="price">Price</label>
<label for="price">{{ __('Price') }}</label>
<input value="{{ $shopProduct->price }}" id="price" name="price" type="number"
placeholder="10.00" step="any"
class="form-control @error('price') is-invalid @enderror" required="required">
@ -92,7 +92,7 @@
</div>
<div class="form-group">
<label for="quantity">Quantity</label>
<label for="quantity">{{ __('Quantity') }}</label>
<input value="{{ $shopProduct->quantity }}" id="quantity" name="quantity"
type="number" placeholder="1000"
class="form-control @error('quantity') is-invalid @enderror" required="required">
@ -107,7 +107,7 @@
</div>
<div class="form-group">
<label for="display">Display</label>
<label for="display">{{ __('Display') }}</label>
<input value="{{ $shopProduct->display }}" id="display" name="display" type="text"
placeholder="750 + 250" class="form-control @error('display') is-invalid @enderror"
required="required">
@ -122,7 +122,7 @@
</div>
<div class="form-group">
<label for="description">Description</label>
<label for="description">{{ __('Description') }}</label>
<input value="{{ $shopProduct->description }}" id="description" name="description"
type="text" placeholder="{{ __('Adds 1000 credits to your account') }}"
class="form-control @error('description') is-invalid @enderror" required="required">

View file

@ -41,7 +41,7 @@
<th>{{__('ID')}}</th>
<th>{{__('Name')}}</th>
<th>{{__('Email')}}</th>
<th>{{ CREDITS_DISPLAY_NAME }}</th>
<th>{{ $credits_display_name }}</th>
<th>{{__('Last seen')}}</th>
</tr>
</thead>

View file

@ -209,7 +209,7 @@
</li>
<li class="d-flex justify-content-between">
<span class="d-inline-block"><i class="fa fa-coins"></i>
{{ __('Required') }} {{ CREDITS_DISPLAY_NAME }}
{{ __('Required') }} {{ $credits_display_name }}
{{ __('to create this server') }}</span>
<span class="d-inline-block"
x-text="product.minimum_credits == -1 ? {{ $min_credits_to_make_server }} : product.minimum_credits"></span>
@ -228,7 +228,7 @@
{{ __('Price') }}:
</span>
<span class="d-inline-block"
x-text="product.price + ' {{ CREDITS_DISPLAY_NAME }}'"></span>
x-text="product.price + ' {{ $credits_display_name }}'"></span>
</div>
</div>
<div>
@ -241,7 +241,7 @@
:class="product.minimum_credits > user.credits || product.doesNotFit == true ||
submitClicked ? 'disabled' : ''"
class="btn btn-primary btn-block mt-2" @click="setProduct(product.id);"
x-text=" product.doesNotFit == true ? '{{ __('Server cant fit on this Node') }}' : (product.minimum_credits > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
x-text=" product.doesNotFit == true ? '{{ __('Server cant fit on this Node') }}' : (product.minimum_credits > user.credits ? '{{ __('Not enough') }} {{ $credits_display_name }}!' : '{{ __('Create server') }}')">
</button>
</div>
</div>

View file

@ -252,8 +252,8 @@
<option value="">{{__("Select the product")}}</option>
@foreach($products as $product)
@if(in_array($server->egg, $product->eggs) && $product->id != $server->product->id && $product->disabled == false)
<option value="{{ $product->id }}" @if($product->doesNotFit)disabled @endif>{{ $product->name }} [ {{ CREDITS_DISPLAY_NAME }} {{ $product->price }} @if($product->doesNotFit)] {{__('Server can´t fit on this node')}} @else @if($product->minimum_credits!=-1) /
{{__("Required")}}: {{$product->minimum_credits}} {{ CREDITS_DISPLAY_NAME }}@endif ] @endif</option>
<option value="{{ $product->id }}" @if($product->doesNotFit)disabled @endif>{{ $product->name }} [ {{ $credits_display_name }} {{ $product->price }} @if($product->doesNotFit)] {{__('Server can´t fit on this node')}} @else @if($product->minimum_credits!=-1) /
{{__("Required")}}: {{$product->minimum_credits}} {{ $credits_display_name }}@endif ] @endif</option>
@endif
@endforeach
</select>

View file

@ -61,7 +61,7 @@
<tr>
<td>1</td>
<td><i class="fa fa-coins mr-2"></i>{{ $product->quantity }}
{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
{{ strtolower($product->type) == 'credits' ? $credits_display_name : $product->type }}
</td>
<td>{{ $product->description }}</td>
<td>{{ $product->formatToCurrency($product->price) }}</td>

View file

@ -1,5 +1,4 @@
@extends('layouts.main')
<?php use App\Models\ShopProduct; ?>
@section('content')
<!-- CONTENT HEADER -->
@ -36,7 +35,7 @@
<div class="card">
<div class="card-header">
<h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{ CREDITS_DISPLAY_NAME }}</h5>
<h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{ $credits_display_name }}</h5>
</div>
<div class="card-body">
<table class="table table-striped table-responsive-sm">
@ -49,13 +48,10 @@
</tr>
</thead>
<tbody>
<?php /** @var $product ShopProduct */
?>
@foreach ($products as $product)
<tr>
<td>{{ $product->formatToCurrency($product->price) }}</td>
<td>{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
</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>