fix: 🚑️ Create multiple servers when clicking submit multiple times
This commit is contained in:
parent
3c8261f286
commit
3b2a851f4f
|
@ -23,10 +23,11 @@
|
||||||
<!-- END CONTENT HEADER -->
|
<!-- END CONTENT HEADER -->
|
||||||
|
|
||||||
<!-- MAIN CONTENT -->
|
<!-- MAIN CONTENT -->
|
||||||
<section x-data="serverApp()" class="content">
|
<section x-data="{ ...serverApp(), submitClicked: false }" class="content">
|
||||||
<div class="container-xxl">
|
<div class="container-xxl">
|
||||||
<!-- FORM -->
|
<!-- FORM -->
|
||||||
<form action="{{ route('servers.store') }}" method="post" class="row justify-content-center">
|
<form action="{{ route('servers.store') }}" x-on:submit="submitClicked = true" method="post"
|
||||||
|
class="row justify-content-center">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="col-xl-6 col-lg-8 col-md-8 col-sm-10">
|
<div class="col-xl-6 col-lg-8 col-md-8 col-sm-10">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -227,12 +228,17 @@
|
||||||
x-text="product.price + ' {{ CREDITS_DISPLAY_NAME }}'"></span>
|
x-text="product.price + ' {{ CREDITS_DISPLAY_NAME }}'"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div x-data="{ buttonDisabled: false }">
|
<div>
|
||||||
|
<input type="hidden" name="product" x-model="selectedProduct">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<button type="submit" x-model="selectedProduct" name="product"
|
<button type="submit" x-model="selectedProduct" name="product"
|
||||||
:disabled="product.minimum_credits > user.credits||product.doesNotFit == true"
|
:disabled="product.minimum_credits > user.credits || product.doesNotFit == true ||
|
||||||
:class="product.minimum_credits > user.credits ? 'disabled' : ''"
|
submitClicked"
|
||||||
class="btn btn-primary btn-block mt-2" @click="setProduct(product.id)"
|
:class="product.minimum_credits > user.credits || product.doesNotFit == true ||
|
||||||
x-text=" product.doesNotFit == true? '{{ __("Server cant fit on this Node") }}' : (product.minimum_credits > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
|
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') }}')">
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -251,7 +257,6 @@
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function serverApp() {
|
function serverApp() {
|
||||||
return {
|
return {
|
||||||
//loading
|
//loading
|
||||||
|
|
Loading…
Reference in a new issue