Updated server fixed server_type & virt

Updated server fixed server_type & virt
Merged server_type & virt into just server_type
Updated serviceServerType() for paramater types and a short/long return value
This commit is contained in:
cp6 2022-10-04 11:13:57 +11:00
parent ab650efa3c
commit 41413a224f
4 changed files with 47 additions and 59 deletions

View File

@ -68,19 +68,27 @@ class Server extends Model
}); });
} }
public static function serviceServerType($type) public static function serviceServerType(int $type, bool $short = true): string
{ {
if ($type === 1) { if ($type === 1) {
return "KVM"; return "KVM";
} elseif ($type === 2) { } elseif ($type === 2) {
return "OVZ"; return "OVZ";
} elseif ($type === 3) { } elseif ($type === 3) {
if (!$short) {
return "Dedicated";
}
return "DEDI"; return "DEDI";
} elseif ($type === 4) { } elseif ($type === 4) {
return "LXC"; return "LXC";
} elseif ($type === 6) { } elseif ($type === 6) {
return "VMware"; return "VMware";
} elseif ($type === 7) {
return "NAT";
} else { } else {
if (!$short) {
return "Semi-dedicated";
}
return "SEMI-DEDI"; return "SEMI-DEDI";
} }
} }

View File

@ -35,14 +35,16 @@
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Server type</span></div>
<select class="form-control" name="server_type"> <select class="form-control" name="server_type">
<option value="1" selected>VPS</option> <option value="1" selected>KVM</option>
<option value="2">Dedicated</option> <option value="2">OVZ</option>
<option value="3">Semi Dedicated</option> <option value="3">DEDI</option>
<option value="4">NAT</option> <option value="4">LXC</option>
</select> <option value="5">SEMI-DEDI</option>
</div> <option value="6">VMware</option>
<option value="7">NAT</option>
</select></div>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-os-select> <x-os-select>
@ -84,18 +86,6 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-lg-3 mb-4">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Virt</span></div>
<select class="form-control" name="virt">
<option value="1" selected="">KVM</option>
<option value="2">OVZ</option>
<option value="3">DEDI</option>
<option value="4">LXC</option>
<option value="5">SEMI-DEDI</option>
<option value="6">VMware</option>
</select></div>
</div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-number-input> <x-number-input>
<x-slot name="title">SSH</x-slot> <x-slot name="title">SSH</x-slot>

View File

@ -31,43 +31,7 @@
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Server type</span></div>
<select class="form-control" name="server_type">
<option value="1" selected>VPS</option>
<option value="2">Dedicated</option>
<option value="3">Semi Dedicated</option>
<option value="4">NAT</option>
</select>
</div>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-os-select>
<x-slot name="current">{{$server_data->os_id}}</x-slot>
</x-os-select>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-3 mb-4">
<x-text-input>
<x-slot name="title">NS1</x-slot>
<x-slot name="name">ns1</x-slot>
<x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server_data->ns1 }}</x-slot>
</x-text-input>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-text-input>
<x-slot name="title">NS2</x-slot>
<x-slot name="name">ns2</x-slot>
<x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server_data->ns2 }}</x-slot>
</x-text-input>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-3 mb-4">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Virt</span></div>
<select class="form-control" name="server_type"> <select class="form-control" name="server_type">
<option value="1" {{ ($server_data->server_type === 1) ? 'selected' : '' }}>KVM <option value="1" {{ ($server_data->server_type === 1) ? 'selected' : '' }}>KVM
</option> </option>
@ -83,9 +47,35 @@
<option value="6" {{ ($server_data->server_type === 6) ? 'selected' : '' }}> <option value="6" {{ ($server_data->server_type === 6) ? 'selected' : '' }}>
VMware VMware
</option> </option>
<option value="7" {{ ($server_data->server_type === 7) ? 'selected' : '' }}>
NAT
</option>
</select></div> </select></div>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<x-os-select>
<x-slot name="current">{{$server_data->os_id}}</x-slot>
</x-os-select>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-2 mb-4">
<x-text-input>
<x-slot name="title">NS1</x-slot>
<x-slot name="name">ns1</x-slot>
<x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server_data->ns1 }}</x-slot>
</x-text-input>
</div>
<div class="col-12 col-lg-2 mb-4">
<x-text-input>
<x-slot name="title">NS2</x-slot>
<x-slot name="name">ns2</x-slot>
<x-slot name="max">255</x-slot>
<x-slot name="value">{{ $server_data->ns2 }}</x-slot>
</x-text-input>
</div>
<div class="col-12 col-lg-2 mb-4">
<x-number-input> <x-number-input>
<x-slot name="title">SSH</x-slot> <x-slot name="title">SSH</x-slot>
<x-slot name="name">ssh_port</x-slot> <x-slot name="name">ssh_port</x-slot>
@ -105,7 +95,7 @@
<x-slot name="value">{{ $server_data->bandwidth }}</x-slot> <x-slot name="value">{{ $server_data->bandwidth }}</x-slot>
</x-number-input> </x-number-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-2 mb-4">
<x-yes-no-select> <x-yes-no-select>
<x-slot name="title">Promo price</x-slot> <x-slot name="title">Promo price</x-slot>
<x-slot name="name">was_promo</x-slot> <x-slot name="name">was_promo</x-slot>

View File

@ -37,7 +37,7 @@
<tr> <tr>
<td class="px-2 py-2 font-bold text-muted">Type</td> <td class="px-2 py-2 font-bold text-muted">Type</td>
<td> <td>
{{ $server_data->serviceServerType($server_data->server_type) }} {{ $server_data->serviceServerType($server_data->server_type, false) }}
</td> </td>
</tr> </tr>
<tr> <tr>