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,13 +228,18 @@
|
||||||
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>
|
||||||
<button type="submit" x-model="selectedProduct" name="product"
|
<input type="hidden" name="product" x-model="selectedProduct">
|
||||||
:disabled="product.minimum_credits > user.credits||product.doesNotFit == true"
|
</div>
|
||||||
:class="product.minimum_credits > user.credits ? 'disabled' : ''"
|
<div>
|
||||||
class="btn btn-primary btn-block mt-2" @click="setProduct(product.id)"
|
<button type="submit" x-model="selectedProduct" name="product"
|
||||||
x-text=" product.doesNotFit == true? '{{ __("Server cant fit on this Node") }}' : (product.minimum_credits > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
|
:disabled="product.minimum_credits > user.credits || product.doesNotFit == true ||
|
||||||
</button>
|
submitClicked"
|
||||||
|
: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') }}')">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -251,7 +257,6 @@
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function serverApp() {
|
function serverApp() {
|
||||||
return {
|
return {
|
||||||
//loading
|
//loading
|
||||||
|
|
Loading…
Reference in a new issue