Merge pull request #565 from 1day2die/development

min required credits per product when upgrading
This commit is contained in:
Dennis 2022-08-17 19:32:20 +02:00 committed by GitHub
commit c8099e9eab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -284,7 +284,7 @@ class ServerController extends Controller
if ($priceupgrade < $oldProduct->getHourlyPrice()) {
$priceupgrade = 0;
}
if ($user->credits >= $priceupgrade)
if ($user->credits >= $priceupgrade && $user->credits >= $newProduct->minimum_credits)
{
$server->product_id = $request->product_upgrade;

View file

@ -227,7 +227,7 @@
<i class="fas fa-upload mr-2"></i>
<span>{{ __('Upgrade / Downgrade') }}</span>
</button>
@endif
@ -255,7 +255,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 }}">{{ $product->name }} [ {{ CREDITS_DISPLAY_NAME }} {{ $product->price }} ]</option>
<option value="{{ $product->id }}">{{ $product->name }} [ {{ CREDITS_DISPLAY_NAME }} {{ $product->price }} @if($product->minimum_credits!=-1) /
{{__("Required")}}: {{$product->minimum_credits}} {{ CREDITS_DISPLAY_NAME }}@endif ]</option>
@endif
@endforeach
</select>
@ -269,6 +270,7 @@
</div>
</div>
</div>
@endif
<!-- Delete Button trigger modal -->
<button type="button" data-toggle="modal" data-target="#DeleteModal" target="__blank"
class="btn btn-danger btn-md">