Merge pull request #6842 from coollabsio/hetzner-buy-pricing
feat: add pricing display to Hetzner server creation button
This commit is contained in:
commit
2cf4058b4b
2 changed files with 18 additions and 1 deletions
|
|
@ -333,6 +333,23 @@ public function getAvailableImagesProperty()
|
||||||
return $filtered;
|
return $filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSelectedServerPriceProperty(): ?string
|
||||||
|
{
|
||||||
|
if (! $this->selected_server_type) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$serverType = collect($this->serverTypes)->firstWhere('name', $this->selected_server_type);
|
||||||
|
|
||||||
|
if (! $serverType || ! isset($serverType['prices'][0]['price_monthly']['gross'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$price = $serverType['prices'][0]['price_monthly']['gross'];
|
||||||
|
|
||||||
|
return '€'.number_format($price, 2);
|
||||||
|
}
|
||||||
|
|
||||||
public function updatedSelectedLocation($value)
|
public function updatedSelectedLocation($value)
|
||||||
{
|
{
|
||||||
ray('Location selected', $value);
|
ray('Location selected', $value);
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ class="p-4 border border-yellow-500 dark:border-yellow-600 rounded bg-yellow-50
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
<x-forms.button isHighlighted canGate="create" :canResource="App\Models\Server::class" type="submit"
|
<x-forms.button isHighlighted canGate="create" :canResource="App\Models\Server::class" type="submit"
|
||||||
:disabled="!$private_key_id">
|
:disabled="!$private_key_id">
|
||||||
Buy & Create Server
|
Buy & Create Server{{ $this->selectedServerPrice ? ' (' . $this->selectedServerPrice . '/mo)' : '' }}
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue