min required credits per product when upgrading

This commit is contained in:
1day2die 2022-08-17 19:31:14 +02:00
parent 1c98f30740
commit 07a2ebfccc
2 changed files with 5 additions and 3 deletions

View file

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

View file

@ -227,7 +227,7 @@
<i class="fas fa-upload mr-2"></i> <i class="fas fa-upload mr-2"></i>
<span>{{ __('Upgrade / Downgrade') }}</span> <span>{{ __('Upgrade / Downgrade') }}</span>
</button> </button>
@endif
@ -255,7 +255,8 @@
<option value="">{{__("Select the product")}}</option> <option value="">{{__("Select the product")}}</option>
@foreach($products as $product) @foreach($products as $product)
@if(in_array($server->egg, $product->eggs) && $product->id != $server->product->id && $product->disabled == false) @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 @endif
@endforeach @endforeach
</select> </select>
@ -269,6 +270,7 @@
</div> </div>
</div> </div>
</div> </div>
@endif
<!-- Delete Button trigger modal --> <!-- Delete Button trigger modal -->
<button type="button" data-toggle="modal" data-target="#DeleteModal" target="__blank" <button type="button" data-toggle="modal" data-target="#DeleteModal" target="__blank"
class="btn btn-danger btn-md"> class="btn btn-danger btn-md">