|
@@ -239,14 +239,14 @@
|
|
|
<input type="hidden" name="product" x-model="selectedProduct">
|
|
|
</div>
|
|
|
<div>
|
|
|
- <button type="submit" x-model="selectedProduct" name="product"
|
|
|
- :disabled="product.minimum_credits > user.credits || product.doesNotFit == true ||
|
|
|
- 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>
|
|
|
+ <button type="submit" x-model="selectedProduct" name="product"
|
|
|
+ :disabled="product.minimum_credits > user.credits || product.price > user.credits || product.doesNotFit == true ||
|
|
|
+ submitClicked"
|
|
|
+ :class="product.minimum_credits > user.credits || product.price > 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 || product.price > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
|
|
|
+ </button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -376,6 +376,7 @@
|
|
|
.catch(console.error)
|
|
|
|
|
|
this.fetchedProducts = true;
|
|
|
+
|
|
|
// TODO: Sortable by user chosen property (cpu, ram, disk...)
|
|
|
this.products = response.data.sort((p1, p2) => parseInt(p1.price, 10) > parseInt(p2.price, 10) &&
|
|
|
1 || -1)
|
|
@@ -385,11 +386,19 @@
|
|
|
product.cpu = product.cpu / 100;
|
|
|
})
|
|
|
|
|
|
+ //format price to have no decimals if it is a whole number
|
|
|
+ this.products.forEach(product => {
|
|
|
+ if (product.price % 1 === 0) {
|
|
|
+ product.price = Math.round(product.price);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
this.loading = false;
|
|
|
this.updateSelectedObjects()
|
|
|
},
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @description map selected id's to selected objects
|
|
|
* @note being used in the server info box
|