Merge pull request #54 from cp6/Development

Development (2.1.2)
This commit is contained in:
corbpie 2022-07-19 15:27:16 +10:00 committed by GitHub
commit dbc54c44d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 948 additions and 449 deletions

View File

@ -7,7 +7,7 @@ Despite what the name infers this self hosted web app isn't just for storing idl
a [YABs](https://github.com/masonr/yet-another-bench-script) output you can get disk & network speed values along with
GeekBench 5 scores to do easier comparing and sorting.
[![Generic badge](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/)
[![Generic badge](https://img.shields.io/badge/version-2.1.2-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Laravel-9.0-red.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Bootstrap-5.1-pink.svg)](https://shields.io/)
<img src="https://raw.githubusercontent.com/cp6/my-idlers/main/public/My%20Idlers%20logo.jpg" width="128" height="128" />
@ -19,12 +19,17 @@ GeekBench 5 scores to do easier comparing and sorting.
[Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation.
## 2.1.1 changes (19th June 2022):
## 2.1.2 changes (19th July 2022):
* Added compatability for YABs version v2022-06-11
* Added Create, Update and Delete servers with API
* Added Update pricing with API
* Updated YABs compatible versions check
* Added YABs compare page
* Added caching for YABs
* Added LabelsAssigned model
* Updated Server model to use relationships
* Updated Shared model to use relationships
* Updated Shared model to use caching
* Updated Table model to have table name defined
* Fixed server compare initial selection
* Fixed switch in getIpForDomain()
## Requires

View File

@ -309,6 +309,7 @@ class ApiController extends Controller
if (isset($data['0']['ip'])) {
return response(array('ip' => $data['0']['ip']), 200);
}
break;
case "AAAA":
$data = dns_get_record($domainname, DNS_AAAA);
if (isset($data['0']['ipv6'])) {

View File

@ -19,9 +19,9 @@ class ServerController extends Controller
public function index()
{
$servers = Server::activeServersDataIndexPage();
$servers = Server::allActiveServers();
$non_active_servers = Server::nonActiveServersDataIndexPage();
$non_active_servers = Server::allNonActiveServers();
return view('servers.index', compact(['servers', 'non_active_servers']));
}
@ -41,7 +41,7 @@ class ServerController extends Controller
Session::save();
if ((Session::get('show_servers_public') === 1)) {
$servers = Server::publicServerData();
$servers = Server::allPublicServers();
return view('servers.public-index', compact('servers'));
}
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => ""), 404);
@ -121,24 +121,16 @@ class ServerController extends Controller
public function show(Server $server)
{
$server_extras = Server::serverDataShowPage($server->id);
$server_data = Server::server($server->id)[0];
$network_speeds = Yabs::networkSpeedsForServer($server->id);
$ip_addresses = IPs::ipsForServer($server->id);
$labels = Labels::labelsForService($server->id);
return view('servers.show', compact(['server', 'server_extras', 'network_speeds', 'labels', 'ip_addresses']));
return view('servers.show', compact(['server_data']));
}
public function edit(Server $server)
{
$ip_addresses = IPs::ipsForServer($server->id);
$server_data = Server::server($server->id)[0];
$server = Pricing::pricingForService($server->id);
return view('servers.edit', compact(['server', 'ip_addresses']));
return view('servers.edit', compact(['server_data']));
}
public function update(Request $request, Server $server)
@ -229,28 +221,24 @@ class ServerController extends Controller
}
public function chooseCompare()
{
{//NOTICE: Selecting servers is not cached yet
$all_servers = Server::where('has_yabs', 1)->get();
return view('servers.choose-compare', compact('all_servers'));
}
public function compareServers($server1, $server2)
{
$server1_data = Server::serverCompareData($server1);
$server1_data = Server::server($server1);
if (count($server1_data) === 0) {
if (!isset($server1_data[0]->yabs[0])) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server1'"), 404);
}
$server1_network = Yabs::serverCompareNetwork($server1_data[0]->yabs_id);
$server2_data = Server::server($server2);
$server2_data = Server::serverCompareData($server2);
if (count($server2_data) === 0) {
if (!isset($server2_data[0]->yabs[0])) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No server with YABs data was found for id '$server2'"), 404);
}
$server2_network = Yabs::serverCompareNetwork($server2_data[0]->yabs_id);
return view('servers.compare', compact('server1_data', 'server2_data', 'server1_network', 'server2_network'));
return view('servers.compare', compact('server1_data', 'server2_data'));
}
}

View File

@ -16,8 +16,7 @@ class SharedController extends Controller
{
public function index()
{
$shared = Shared::sharedDataIndexPage();
$shared = Shared::allSharedHosting();
return view('shared.index', compact(['shared']));
}
@ -28,7 +27,6 @@ class SharedController extends Controller
public function store(Request $request)
{
$request->validate([
'domain' => 'required|min:4',
'shared_type' => 'required',
@ -54,17 +52,13 @@ class SharedController extends Controller
$shared_id = Str::random(8);
$pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
$pricing->insertPricing(2, $shared_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Labels::deleteLabelsAssignedTo($shared_id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $shared_id);
IPs::deleteIPsAssignedTo($shared_id);
if (!is_null($request->dedicated_ip)) {
IPs::insertIP($shared_id, $request->dedicated_ip);
}
@ -88,6 +82,7 @@ class SharedController extends Controller
'db__limit' => $request->db
]);
Cache::forget('all_shared');
Home::homePageCacheForget();
return redirect()->route('shared.index')
@ -96,24 +91,14 @@ class SharedController extends Controller
public function show(Shared $shared)
{
$shared_extras = Shared::sharedDataShowPage($shared->id);
$labels = Labels::labelsForService($shared->id);
$ip_address = IPs::ipsForServer($shared->id);
return view('shared.show', compact(['shared', 'shared_extras', 'labels', 'ip_address']));
$shared = Shared::sharedHosting($shared->id)[0];
return view('shared.show', compact(['shared']));
}
public function edit(Shared $shared)
{
$labels = Labels::labelsForService($shared->id);
$ip_address = IPs::ipsForServer($shared->id);
$shared = Shared::sharedEditDataPage($shared->id);
return view('shared.edit', compact(['shared', 'labels', 'ip_address']));
$shared = Shared::sharedHosting($shared->id);
return view('shared.edit', compact(['shared']));
}
public function update(Request $request, Shared $shared)
@ -161,23 +146,20 @@ class SharedController extends Controller
]);
$pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
$pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id);
Cache::forget("labels_for_service.{$request->id}");
IPs::deleteIPsAssignedTo($request->id);
if (isset($request->dedicated_ip)) {
IPs::insertIP($request->id, $request->dedicated_ip);
}
Cache::forget("shared_hosting.{$request->id}");
Cache::forget('all_shared');
Home::homePageCacheForget();
return redirect()->route('shared.index')
@ -188,7 +170,6 @@ class SharedController extends Controller
{
$shared_id = $shared->id;
$items = Shared::find($shared_id);
$items->delete();
$p = new Pricing();
@ -198,6 +179,8 @@ class SharedController extends Controller
IPs::deleteIPsAssignedTo($shared_id);
Cache::forget("shared_hosting.$shared_id");
Cache::forget('all_shared');
Home::homePageCacheForget();
return redirect()->route('shared.index')

View File

@ -16,11 +16,7 @@ class YabsController extends Controller
{
public function index()
{
$yabs = DB::table('yabs as y')
->join('servers as s', 'y.server_id', '=', 's.id')
->Join('disk_speed as ds', 'y.id', '=', 'ds.id')
->get(['y.*', 's.hostname', 'ds.*']);
$yabs = Yabs::allYabs();
return view('yabs.index', compact(['yabs']));
}
@ -38,7 +34,6 @@ class YabsController extends Controller
if (isset($yabs['error_id'])) {
return back()->withErrors(["yabs" => 'Problem inserting YABs. Error id ' . $yabs['error_id']])->withInput();
//return redirect()->route('yabs.index')->with('error', 'Problem inserting YABs. Error id ' . $yabs['error_id']);
}
//No errors, do insert
@ -111,6 +106,7 @@ class YabsController extends Controller
Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache
Cache::forget('all_yabs');//Forget the all YABs cache
return redirect()->route('yabs.index')
->with('success', 'Success inserting YABs');
@ -118,17 +114,8 @@ class YabsController extends Controller
public function show(Yabs $yab)
{
$yab = DB::table('yabs as y')
->join('servers as s', 'y.server_id', '=', 's.id')
->join('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('y.id', '=', $yab->id)
->get(['y.*', 's.hostname', 'ds.*']);
$network = DB::table('network_speed')
->where('id', '=', $yab[0]->id)
->get();
return view('yabs.show', compact(['yab', 'network']));
$yab = Yabs::yabs($yab->id);
return view('yabs.show', compact(['yab']));
}
public function destroy(Yabs $yab)
@ -136,11 +123,40 @@ class YabsController extends Controller
$yabs = Yabs::find($yab->id);
$yabs->delete();
$update_server = DB::table('servers')
if (Server::serverYabsAmount($yab->server_id) === 0) {
DB::table('servers')
->where('id', $yab->server_id)
->update(['has_yabs' => 0]);
}
Cache::forget('all_yabs');
Cache::forget("yabs.{$yab->id}");
return redirect()->route('yabs.index')
->with('success', 'YABs was deleted Successfully.');
}
public function chooseYabsCompare()
{
$all_yabs = Yabs::allYabs();
return view('yabs.choose-compare', compact('all_yabs'));
}
public function compareYabs($yabs1, $yabs2)
{
$yabs1_data = Yabs::yabs($yabs1);
if (count($yabs1_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$yabs1'"), 404);
}
$yabs2_data = Yabs::yabs($yabs2);
if (count($yabs2_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$server2'"), 404);
}
return view('yabs.compare', compact('yabs1_data', 'yabs2_data'));
}
}

View File

@ -9,7 +9,14 @@ class DiskSpeed extends Model
{
use HasFactory;
public $incrementing = false;
protected $table = 'disk_speed';
protected $fillable = ['id', 'server_id', 'd_4k', 'd_4k_type', 'd_4k_as_mbps', 'd_64k', 'd_64k_type', 'd_64k_as_mbps', 'd_512k', 'd_512k_type', 'd_512k_as_mbps', 'd_1m', 'd_1m_type', 'd_1m_as_mbps'];
public function yabs()
{
return $this->belongsTo(Yabs::class, 'id', 'id');
}
}

View File

@ -13,6 +13,8 @@ class Labels extends Model
public $incrementing = false;
protected $table = 'labels';
protected $fillable = ['id', 'label', 'server_id', 'server_id_2', 'domain_id', 'domain_id_2', 'shared_id', 'shared_id_2'];
public static function deleteLabelsAssignedTo($service_id)

View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LabelsAssigned extends Model
{
use HasFactory;
public $incrementing = false;
public $table = 'labels_assigned';
protected $fillable = ['label_id', 'service_id'];
public function label()
{
return $this->hasOne(Labels::class, 'id', 'label_id');
}
}

View File

@ -9,7 +9,14 @@ class NetworkSpeed extends Model
{
use HasFactory;
public $incrementing = false;
protected $table = 'network_speed';
protected $fillable = ['id', 'server_id', 'location', 'send', 'send_type', 'send_as_mbps', 'receive', 'receive_type', 'receive_as_mbps', 'created_at', 'updated_at'];
public function yabs()
{
return $this->belongsTo(Yabs::class, 'id', 'id');
}
}

View File

@ -141,13 +141,4 @@ class Pricing extends Model
});
}
public static function pricingForService(string $service_id)
{
return Cache::remember("service_pricing.$service_id", now()->addWeek(1), function () use ($service_id) {
return DB::table('servers as s')
->join('pricings as p', 's.id', '=', 'p.service_id')
->where('s.id', '=', $service_id)
->get(['s.*', 'p.*']);
});
}
}

View File

@ -2,6 +2,7 @@
namespace App\Models;
use App\Process;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
@ -21,6 +22,48 @@ class Server extends Model
*/
private $id;
public static function allServers()
{//All servers and relationships (no using joins)
return Cache::remember("all_servers", now()->addMonth(1), function () {
return Server::with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->get();
});
}
public static function server(string $server_id)
{//Single server and relationships (no using joins)
return Cache::remember("server.$server_id", now()->addMonth(1), function () use ($server_id) {
return Server::where('id', $server_id)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])->get();
});
}
public static function allActiveServers()
{//All ACTIVE servers and relationships replaces activeServersDataIndexPage()
return Cache::remember("all_active_servers", now()->addMonth(1), function () {
return Server::where('active', '=', 1)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function allNonActiveServers()
{//All NON ACTIVE servers and relationships replaces nonActiveServersDataIndexPage()
return Cache::remember("non_active_servers", now()->addMonth(1), function () {
return Server::where('active', '=', 0)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function allPublicServers()
{//server data that will be publicly viewable (values in settings)
return Cache::remember("public_server_data", now()->addMonth(1), function () {
return Server::where('show_public', '=', 1)
->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'labels.label'])
->get();
});
}
public static function serviceServerType($type)
{
if ($type === 1) {
@ -158,11 +201,12 @@ class Server extends Model
public static function serverRelatedCacheForget(): void
{
Cache::forget('all_servers');//All servers
Cache::forget('services_count');//Main page services_count cache
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache
Cache::forget('all_active_servers');//all active servers cache
Cache::forget('non_active_servers');//all non active servers cache
Cache::forget('servers_summary');//servers summary cache
Cache::forget('public_server_data');//public servers
Cache::forget('all_pricing');//All pricing
@ -172,81 +216,50 @@ class Server extends Model
public static function serverSpecificCacheForget(string $server_id): void
{
Cache::forget("server_show_data.$server_id");//data for show
Cache::forget("ip_addresses.$server_id");//ips for server
Cache::forget("labels_for_service.$server_id");//labels for server
Cache::forget("server.$server_id");//Will replace one below
Cache::forget("service_pricing.$server_id");//Pricing
}
public static function activeServersDataIndexPage()
{
return Cache::remember('all_active_servers', now()->addMonth(1), function () {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.active', '=', 1)
->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'pr.next_due_date', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']);
});
public static function serverYabsAmount(string $server_id): int
{//Returns amount of YABs a server has
return DB::table('yabs')
->where('server_id', '=', $server_id)
->get()->count();
}
public static function nonActiveServersDataIndexPage()
public function yabs()
{
return Cache::remember('non_active_servers', now()->addMonth(1), function () {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.active', '=', 0)
->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']);
});
return $this->hasMany(Yabs::class, 'server_id', 'id');
}
public static function serverDataShowPage(string $server_id)
public function ips()
{
return Cache::remember("server_show_data.$server_id", now()->addDay(1), function () use ($server_id) {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->Leftjoin('yabs as y', 's.id', '=', 'y.server_id')
->Leftjoin('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.id', '=', $server_id)
->get(['s.*', 'p.name as provider', 'l.name as location', 'o.name as os_name', 'pr.*', 'y.*', 'ds.*']);
});
return $this->hasMany(IPs::class, 'service_id', 'id');
}
public static function publicServerData()
public function location()
{
return Cache::remember('public_server_data', now()->addMonth(1), function () {
return DB::table('servers as s')
->Join('pricings as pr', 's.id', '=', 'pr.service_id')
->Join('providers as p', 's.provider_id', '=', 'p.id')
->Join('locations as l', 's.location_id', '=', 'l.id')
->Join('os as o', 's.os_id', '=', 'o.id')
->LeftJoin('ips as i', 's.id', '=', 'i.service_id')
->LeftJoin('yabs as y', 's.id', '=', 'y.server_id')
->LeftJoin('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.show_public', '=', 1)
->get(['pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'pr.next_due_date', 'pr.service_id', 'p.name as provider_name', 'l.name as location', 'o.name as os_name', 'y.*', 'y.id as yabs_id', 'ds.*', 's.*', 'i.address as ip', 'i.is_ipv4']);
});
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public static function serverCompareData(string $server_id)
public function provider()
{
return Cache::remember("server_compare.$server_id", now()->addMonth(1), function () use ($server_id) {
return DB::table('servers as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->Join('yabs as y', 's.id', '=', 'y.server_id')
->Join('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('s.id', '=', $server_id)
->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*', 'y.*', 'y.id as yabs_id', 'ds.*']);
});
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function os()
{
return $this->hasOne(OS::class, 'id', 'os_id');
}
public function price()
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}
}

View File

@ -17,30 +17,44 @@ class Shared extends Model
public $incrementing = false;
public static function sharedDataIndexPage()
{
return DB::table('shared_hosting as s')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->get(['s.*', 'p.name as provider_name', 'pr.*', 'l.name as location']);
public static function allSharedHosting()
{//All shared hosting and relationships (no using joins)
return Cache::remember("all_shared", now()->addMonth(1), function () {
return Shared::with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get();
});
}
public static function sharedDataShowPage(string $shared_id)
{
return DB::table('shared_hosting as s')
->join('pricings as pr', 's.id', '=', 'pr.service_id')
->join('providers as p', 's.provider_id', '=', 'p.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->where('s.id', '=', $shared_id)
->get(['s.*', 'p.name as provider_name', 'l.name as location', 'pr.*']);
public static function sharedHosting(string $shared_id)
{//Single shared hosting and relationships (no using joins)
return Cache::remember("shared_hosting.$shared_id", now()->addMonth(1), function () use ($shared_id) {
return Shared::where('id', $shared_id)
->with(['location', 'provider', 'price', 'ips', 'labels', 'labels.label'])->get();
});
}
public static function sharedEditDataPage(string $shared_id)
public function ips()
{
return DB::table('shared_hosting as s')
->join('pricings as p', 's.id', '=', 'p.service_id')
->where('s.id', '=', $shared_id)
->get(['s.*', 'p.*']);
return $this->hasMany(IPs::class, 'service_id', 'id');
}
public function location()
{
return $this->hasOne(Locations::class, 'id', 'location_id');
}
public function provider()
{
return $this->hasOne(Providers::class, 'id', 'provider_id');
}
public function price()
{
return $this->hasOne(Pricing::class, 'service_id', 'id');
}
public function labels()
{
return $this->hasMany(LabelsAssigned::class, 'service_id', 'id');
}
}

View File

@ -35,4 +35,35 @@ class Yabs extends Model
});
}
public static function yabs(string $yabs_id)
{
return Cache::remember("yabs.$yabs_id", now()->addMonth(1), function () use ($yabs_id) {
return self::where('id', $yabs_id)->with(['server', 'disk_speed', 'network_speed'])
->get();
});
}
public static function allYabs()
{
return Cache::remember("all_yabs", now()->addMonth(1), function () {
return self::with(['server', 'disk_speed', 'network_speed'])
->get();
});
}
public function server()
{
return $this->hasOne(Server::class, 'id', 'server_id');
}
public function disk_speed()
{
return $this->hasOne(DiskSpeed::class, 'id', 'id');
}
public function network_speed()
{
return $this->hasMany(NetworkSpeed::class, 'id', 'id');
}
}

View File

@ -10,6 +10,7 @@
<div class="card shadow mt-3">
<div class="card-body">
<a href="{{ route('servers.index') }}" class="btn btn-primary mb-3">Servers home</a>
@if(count($all_servers) >= 2)
<div class="row">
<div class="col-12 col-lg-6">
<div class="input-group">
@ -28,7 +29,7 @@
<div class="input-group-prepend"><span class="input-group-text">Server2</span></div>
<select class="form-control" name="server2" @change="changeServer2($event)">
@foreach ($all_servers as $server)
<option value="{{ $server['id'] }}">
<option value="{{ $server['id'] }}" {{($loop->index === 1)?'selected':''}}>
{{ $server['hostname'] }}
</option>
@endforeach
@ -36,13 +37,10 @@
</div>
</div>
</div>
<!--
<div class="input-group mt-4">
<div class="input-group-prepend"><span class="input-group-text">URL</span></div>
<input type="text" class="form-control" id="url" v-model="url_input" disabled>
</div>
-->
<a v-bind:href="full_url" class="btn btn-success mt-4">View comparison table</a>
@else
<p class="text-danger">You need to have added a YABs to at least 2 servers to use this feature</p>
@endif
</div>
</div>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
@ -55,10 +53,10 @@
el: "#app",
data: {
"base_url": "servers-compare/",
"full_url": "",
"full_url": "{{route('servers.compare', ['server1' => $all_servers[0]->id, 'server2' => $all_servers[1]->id])}}",
"url_input": "",
"server1": "",
"server2": "",
"server1": "{{$all_servers[0]->id ?? ''}}",
"server2": "{{$all_servers[1]->id ?? ''}}",
},
methods: {
changeServer1: function changeServer1(event) {

View File

@ -1,4 +1,6 @@
@section('title') {{'Compare servers'}} @endsection
@section('title')
{{'Compare servers'}}
@endsection
@section('style')
<style>
.td-nowrap {
@ -49,185 +51,271 @@
<tbody>
<tr>
<td class="td-nowrap">CPU count</td>
<td class="td-nowrap">{{$server1_data[0]->cpu_cores}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_cores, $server2_data[0]->cpu_cores, ' cores') !!}
<td class="td-nowrap">{{$server2_data[0]->cpu_cores}}</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->cpu_cores}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_cores, $server2_data[0]->yabs[0]->cpu_cores, ' cores') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->cpu_cores}}</td>
</tr>
<tr>
<td class="td-nowrap">CPU freq</td>
<td class="td-nowrap">{{$server1_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_freq, $server2_data[0]->cpu_freq, 'Mhz') !!}
<td class="td-nowrap">{{$server2_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->cpu_freq}}<span
class="data-type">Mhz</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_freq, $server2_data[0]->yabs[0]->cpu_freq, 'Mhz') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->cpu_freq}}<span
class="data-type">Mhz</span></td>
</tr>
<tr>
<td class="td-nowrap">Ram</td>
<td class="td-nowrap">{{$server1_data[0]->ram_mb}}<span class="data-type">MB</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->ram_mb, $server2_data[0]->ram_mb, 'MB') !!}
<td class="td-nowrap">{{$server2_data[0]->ram_mb}}<span class="data-type">MB</span></td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->ram_mb}}<span class="data-type">MB</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->ram_mb, $server2_data[0]->yabs[0]->ram_mb, 'MB') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->ram_mb}}<span class="data-type">MB</span>
</td>
</tr>
<tr>
<td class="td-nowrap">Disk</td>
<td class="td-nowrap">{{$server1_data[0]->disk_gb}}<span class="data-type">GB</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->disk_gb, $server2_data[0]->disk_gb, 'GB') !!}
<td class="td-nowrap">{{$server2_data[0]->disk_gb}}<span class="data-type">GB</span></td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_gb}}<span
class="data-type">GB</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_gb, $server2_data[0]->yabs[0]->disk_gb, 'GB') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_gb}}<span
class="data-type">GB</span></td>
</tr>
<tr>
<td class="td-nowrap">GB5 single</td>
<td class="td-nowrap">{{$server1_data[0]->gb5_single}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_single, $server2_data[0]->gb5_single, '') !!}
<td class="td-nowrap">{{$server2_data[0]->gb5_single}}</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->gb5_single}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_single, $server2_data[0]->yabs[0]->gb5_single, '') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->gb5_single}}</td>
</tr>
<tr>
<td class="td-nowrap">GB5 multi</td>
<td class="td-nowrap">{{$server1_data[0]->gb5_multi}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_multi, $server2_data[0]->gb5_multi, '') !!}
<td class="td-nowrap">{{$server2_data[0]->gb5_multi}}</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->gb5_multi}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_multi, $server2_data[0]->yabs[0]->gb5_multi, '') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->gb5_multi}}</td>
</tr>
<tr>
<td class="td-nowrap">4k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_4k_as_mbps}}<span class="data-type">MB/s</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_4k_as_mbps}}<span
class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_4k_as_mbps, $server2_data[0]->d_4k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_4k_as_mbps}}<span class="data-type">MB/s</span>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_4k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_4k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_4k_as_mbps}}<span
class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">64k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_64k_as_mbps}}<span class="data-type">MB/s</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_64k_as_mbps}}<span
class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_64k_as_mbps, $server2_data[0]->d_64k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_64k_as_mbps}}<span class="data-type">MB/s</span>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_64k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_64k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_64k_as_mbps}}<span
class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">512k disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_512k_as_mbps}}<span
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_512k_as_mbps, $server2_data[0]->d_512k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_512k_as_mbps}}<span
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_512k_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_512k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
</tr>
<tr>
<td class="td-nowrap">1m disk</td>
<td class="td-nowrap">{{$server1_data[0]->d_1m_as_mbps}}<span class="data-type">MB/s</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->disk_speed->d_1m_as_mbps}}<span
class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->d_1m_as_mbps, $server2_data[0]->d_1m_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->d_1m_as_mbps}}<span class="data-type">MB/s</span>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_speed->d_1m_as_mbps, $server2_data[0]->yabs[0]->disk_speed->d_1m_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->disk_speed->d_1m_as_mbps}}<span
class="data-type">MB/s</span>
</td>
</tr>
@if($server1_data[0]->yabs[0]->network_speed[0]->location === $server2_data[0]->yabs[0]->network_speed[0]->location)
<tr>
<td class="td-nowrap">{{$server1_network[0]->location}} send</td>
<td class="td-nowrap">{{$server1_network[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[0]->send_as_mbps, $server2_network[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$server1_network[0]->location}} receive</td>
<td class="td-nowrap">{{$server1_network[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[0]->receive_as_mbps, $server2_network[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$server1_network[1]->location}} send</td>
<td class="td-nowrap">{{$server1_network[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[1]->send_as_mbps, $server2_network[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@if($server1_network[0]->location === $server2_network[0]->location)
<tr>
<td class="td-nowrap">{{$server1_network[1]->location}} receive</td>
<td class="td-nowrap">{{$server1_network[1]->receive_as_mbps}}<span class="data-type">MBps</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->location}} send
</td>
{!! \App\Models\Server::tableRowCompare($server1_network[1]->receive_as_mbps, $server2_network[1]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[1]->receive_as_mbps}}<span class="data-type">MBps</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[0]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[0]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_network[1]->location === $server2_network[1]->location)
@if($server1_data[0]->yabs[0]->network_speed[0]->location === $server2_data[0]->yabs[0]->network_speed[0]->location)
<tr>
<td class="td-nowrap">{{$server1_network[2]->location}} send</td>
<td class="td-nowrap">{{$server1_network[2]->send_as_mbps}}<span
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[0]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[0]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[0]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[1]->location === $server2_data[0]->yabs[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[1]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[1]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[1]->location === $server2_data[0]->yabs[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[1]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[1]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[1]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[1]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[2]->location === $server2_data[0]->yabs[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[2]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[2]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[2]->send_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[2]->location === $server2_data[0]->yabs[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[2]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[2]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[2]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[2]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[3]->location === $server2_data[0]->yabs[0]->network_speed[3]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_network[2]->send_as_mbps, $server2_network[2]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[2]->send_as_mbps}}<span
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[3]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[3]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@endif
@if($server1_network[2]->location === $server2_network[2]->location)
@if($server1_data[0]->yabs[0]->network_speed[3]->location === $server2_data[0]->yabs[0]->network_speed[3]->location)
<tr>
<td class="td-nowrap">{{$server1_network[2]->location}} receive</td>
<td class="td-nowrap">{{$server1_network[2]->receive_as_mbps}}<span class="data-type">MBps</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->location}} receive
</td>
{!! \App\Models\Server::tableRowCompare($server1_network[2]->receive_as_mbps, $server2_network[2]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_network[2]->receive_as_mbps}}<span class="data-type">MBps</span>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[3]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[3]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[3]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[3]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[4]->location === $server2_data[0]->yabs[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->location}} send
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[4]->send_as_mbps, $server2_data[0]->yabs[0]->network_speed[4]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@endif
@if($server1_data[0]->yabs[0]->network_speed[4]->location === $server2_data[0]->yabs[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->location}} receive
</td>
<td class="td-nowrap">{{$server1_data[0]->yabs[0]->network_speed[4]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->network_speed[4]->receive_as_mbps, $server2_data[0]->yabs[0]->network_speed[4]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$server2_data[0]->yabs[0]->network_speed[4]->receive_as_mbps}}
<span class="data-type">MBps</span>
</td>
</tr>
@endif
<tr>
<td class="td-nowrap">USD p/m</td>
<td class="td-nowrap">{{$server1_data[0]->usd_per_month}}<span class="data-type">p/m</span>
<td class="td-nowrap">{{$server1_data[0]->price->usd_per_month}}<span
class="data-type">p/m</span>
</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->usd_per_month, $server2_data[0]->usd_per_month, 'p/m') !!}
<td class="td-nowrap">{{$server2_data[0]->usd_per_month}}<span class="data-type">p/m</span>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->price->usd_per_month, $server2_data[0]->price->usd_per_month, 'p/m') !!}
<td class="td-nowrap">{{$server2_data[0]->price->usd_per_month}}<span
class="data-type">p/m</span>
</td>
</tr>
<tr>
<td class="td-nowrap">Actual price</td>
<td class="td-nowrap">{{$server1_data[0]->price}}<span
class="data-type">{{$server1_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server1_data[0]->term)}}
<td class="td-nowrap">{{$server1_data[0]->price->price}}<span
class="data-type">{{$server1_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server1_data[0]->price->term)}}
</td>
<td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->price}}<span
class="data-type">{{$server2_data[0]->currency}}</span> {{\App\Process::paymentTermIntToString($server2_data[0]->term)}}
<td class="td-nowrap">{{$server2_data[0]->price->price}}<span
class="data-type">{{$server2_data[0]->price->currency}}</span> {{\App\Process::paymentTermIntToString($server2_data[0]->price->term)}}
</td>
</tr>
<tr>
<td class="td-nowrap">CPU per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->cpu_cores / $server1_data[0]->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->cpu_cores / $server1_data[0]->usd_per_month, $server2_data[0]->cpu_cores / $server2_data[0]->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->cpu_cores / $server2_data[0]->usd_per_month,2)}}</td>
<td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->cpu_cores / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->cpu_cores / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->cpu_cores / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->cpu_cores / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr>
<tr>
<td class="td-nowrap">Disk GB per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->disk_gb / $server1_data[0]->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->disk_gb / $server1_data[0]->usd_per_month, $server2_data[0]->disk_gb / $server2_data[0]->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->disk_gb / $server2_data[0]->usd_per_month,2)}}</td>
<td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->disk_gb / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->disk_gb / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->disk_gb / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->disk_gb / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr>
<tr>
<td class="td-nowrap">Ram MB per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->ram_mb / $server1_data[0]->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->ram_mb / $server1_data[0]->usd_per_month, $server2_data[0]->ram_mb / $server2_data[0]->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->ram_mb / $server2_data[0]->usd_per_month,2)}}</td>
<td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->ram_mb / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->ram_mb / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->ram_mb / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->ram_mb / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr>
<tr>
<td class="td-nowrap">GB5 single per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->gb5_single / $server1_data[0]->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_single / $server1_data[0]->usd_per_month, $server2_data[0]->gb5_single / $server2_data[0]->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->gb5_single / $server2_data[0]->usd_per_month,2)}}</td>
<td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->gb5_single / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_single / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->gb5_single / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->gb5_single / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr>
<tr>
<td class="td-nowrap">GB5 multi per USD</td>
<td class="td-nowrap">{{number_format($server1_data[0]->gb5_multi / $server1_data[0]->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->gb5_multi / $server1_data[0]->usd_per_month, $server2_data[0]->gb5_multi / $server2_data[0]->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->gb5_multi / $server2_data[0]->usd_per_month,2)}}</td>
<td class="td-nowrap">{{number_format($server1_data[0]->yabs[0]->gb5_multi / $server1_data[0]->price->usd_per_month,2)}}</td>
{!! \App\Models\Server::tableRowCompare($server1_data[0]->yabs[0]->gb5_multi / $server1_data[0]->price->usd_per_month, $server2_data[0]->yabs[0]->gb5_multi / $server2_data[0]->price->usd_per_month, '') !!}
<td class="td-nowrap">{{number_format($server2_data[0]->yabs[0]->gb5_multi / $server2_data[0]->price->usd_per_month,2)}}</td>
</tr>
<tr>
<td class="td-nowrap">Location</td>
<td class="td-nowrap">{{$server1_data[0]->location}}</td>
<td class="td-nowrap">{{$server1_data[0]->location->name}}</td>
<td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->location}}</td>
<td class="td-nowrap">{{$server2_data[0]->location->name}}</td>
</tr>
<tr>
<td class="td-nowrap">Provider</td>
<td class="td-nowrap">{{$server1_data[0]->provider_name}}</td>
<td class="td-nowrap">{{$server1_data[0]->provider->name}}</td>
<td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$server2_data[0]->provider_name}}</td>
<td class="td-nowrap">{{$server2_data[0]->provider->name}}</td>
</tr>
<tr>
<td class="td-nowrap">Owned since</td>

View File

@ -1,7 +1,9 @@
@section('title') {{$server[0]->hostname}} {{'edit'}} @endsection
@section('title')
{{$server_data->hostname}} {{'edit'}}
@endsection
<x-app-layout>
<x-slot name="header">
Edit {{ $server[0]->hostname }}
Edit {{ $server_data->hostname }}
</x-slot>
<div class="container">
<x-card class="shadow mt-3">
@ -11,18 +13,18 @@
Back to servers
</x-back-button>
<x-errors-alert></x-errors-alert>
<form action="{{ route('servers.update', $server[0]->service_id) }}" method="POST">
<form action="{{ route('servers.update', $server_data->id) }}" method="POST">
@csrf
@method('PUT')
<div class="row mt-3">
<div class="col-12 col-lg-6 mb-4">
<input type="hidden" value="{{$server[0]->service_id}}" name="server_id">
<input type="hidden" value="{{$server_data->id}}" name="server_id">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Hostname</span></div>
<input type="text"
class="form-control"
name="hostname"
value="{{ $server[0]->hostname }}">
value="{{ $server_data->hostname }}">
@error('name') <span class="text-red-500">{{ $message }}
</span>@enderror
</div>
@ -40,7 +42,7 @@
</div>
<div class="col-12 col-lg-3 mb-4">
<x-os-select>
<x-slot name="current">{{$server[0]->os_id}}</x-slot>
<x-slot name="current">{{$server_data->os_id}}</x-slot>
</x-os-select>
</div>
</div>
@ -50,7 +52,7 @@
<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[0]->ns1 }}</x-slot>
<x-slot name="value">{{ $server_data->ns1 }}</x-slot>
</x-text-input>
</div>
<div class="col-12 col-lg-3 mb-4">
@ -58,7 +60,7 @@
<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[0]->ns2 }}</x-slot>
<x-slot name="value">{{ $server_data->ns2 }}</x-slot>
</x-text-input>
</div>
</div>
@ -67,18 +69,18 @@
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Virt</span></div>
<select class="form-control" name="server_type">
<option value="1" {{ ($server[0]->server_type === 1) ? 'selected' : '' }}>KVM
<option value="1" {{ ($server_data->server_type === 1) ? 'selected' : '' }}>KVM
</option>
<option value="2" {{ ($server[0]->server_type === 2) ? 'selected' : '' }}>OVZ
<option value="2" {{ ($server_data->server_type === 2) ? 'selected' : '' }}>OVZ
</option>
<option value="3" {{ ($server[0]->server_type === 3) ? 'selected' : '' }}>DEDI
<option value="3" {{ ($server_data->server_type === 3) ? 'selected' : '' }}>DEDI
</option>
<option value="4" {{ ($server[0]->server_type === 4) ? 'selected' : '' }}>LXC
<option value="4" {{ ($server_data->server_type === 4) ? 'selected' : '' }}>LXC
</option>
<option value="5" {{ ($server[0]->server_type === 5) ? 'selected' : '' }}>
<option value="5" {{ ($server_data->server_type === 5) ? 'selected' : '' }}>
SEMI-DEDI
</option>
<option value="6" {{ ($server[0]->server_type === 6) ? 'selected' : '' }}>
<option value="6" {{ ($server_data->server_type === 6) ? 'selected' : '' }}>
VMware
</option>
</select></div>
@ -90,7 +92,7 @@
<x-slot name="value">22</x-slot>
<x-slot name="max">999999</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="value">{{ $server[0]->ssh }}</x-slot>
<x-slot name="value">{{ $server_data->ssh }}</x-slot>
</x-number-input>
</div>
<div class="col-12 col-lg-3 mb-4">
@ -100,28 +102,28 @@
<x-slot name="value">1000</x-slot>
<x-slot name="max">99999</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="value">{{ $server[0]->bandwidth }}</x-slot>
<x-slot name="value">{{ $server_data->bandwidth }}</x-slot>
</x-number-input>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-yes-no-select>
<x-slot name="title">Promo price</x-slot>
<x-slot name="name">was_promo</x-slot>
<x-slot name="value">{{ $server[0]->was_promo }}</x-slot>
<x-slot name="value">{{ $server_data->was_promo }}</x-slot>
</x-yes-no-select>
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<x-providers-select>
<x-slot name="current">{{$server[0]->provider_id}}</x-slot>
<x-slot name="current">{{$server_data->provider_id}}</x-slot>
</x-providers-select>
</div>
<div class="col-md-3 mb-3">
<x-number-input>
<x-slot name="title">Price</x-slot>
<x-slot name="name">price</x-slot>
<x-slot name="value">{{$server[0]->price}}</x-slot>
<x-slot name="value">{{$server_data->price->price}}</x-slot>
<x-slot name="max">9999</x-slot>
<x-slot name="step">0.01</x-slot>
<x-slot name="required"></x-slot>
@ -129,12 +131,12 @@
</div>
<div class="col-md-3 mb-3">
<x-term-select>
<x-slot name="current">{{$server[0]->term}}</x-slot>
<x-slot name="current">{{$server_data->price->term}}</x-slot>
</x-term-select>
</div>
<div class="col-md-3 mb-3">
<x-currency-select>
<x-slot name="current">{{$server[0]->currency}}</x-slot>
<x-slot name="current">{{$server_data->price->currency}}</x-slot>
</x-currency-select>
</div>
</div>
@ -144,7 +146,7 @@
<x-number-input>
<x-slot name="title">CPU</x-slot>
<x-slot name="name">cpu</x-slot>
<x-slot name="value">{{$server[0]->cpu}}</x-slot>
<x-slot name="value">{{$server_data->cpu}}</x-slot>
<x-slot name="max">64</x-slot>
<x-slot name="step">1</x-slot>
</x-number-input>
@ -153,7 +155,7 @@
<x-number-input>
<x-slot name="title">Ram</x-slot>
<x-slot name="name">ram</x-slot>
<x-slot name="value">{{$server[0]->ram}}</x-slot>
<x-slot name="value">{{$server_data->ram}}</x-slot>
<x-slot name="max">100000</x-slot>
</x-number-input>
</div>
@ -161,14 +163,14 @@
<x-ram-type-select>
<x-slot name="title">Ram type</x-slot>
<x-slot name="name">ram_type</x-slot>
<x-slot name="value">{{$server[0]->ram_type}}</x-slot>
<x-slot name="value">{{$server_data->ram_type}}</x-slot>
</x-ram-type-select>
</div>
<div class="col-md-3 mb-3">
<x-number-input>
<x-slot name="title">Disk</x-slot>
<x-slot name="name">disk</x-slot>
<x-slot name="value">{{$server[0]->disk}}</x-slot>
<x-slot name="value">{{$server_data->disk}}</x-slot>
<x-slot name="max">99999</x-slot>
<x-slot name="step">0.1</x-slot>
</x-number-input>
@ -177,28 +179,34 @@
<x-disk-type-select>
<x-slot name="title">Disk type</x-slot>
<x-slot name="name">disk_type</x-slot>
<x-slot name="value">{{$server[0]->disk_type}}</x-slot>
<x-slot name="value">{{$server_data->disk_type}}</x-slot>
</x-disk-type-select>
</div>
</div>
<div class="row">
<div class="col-12 col-md-4 mb-3">
<x-locations-select>
<x-slot name="current">{{$server[0]->location_id}}</x-slot>
<x-slot name="current">{{$server_data->location_id}}</x-slot>
</x-locations-select>
</div>
<div class="col-12 col-md-3 mb-3">
<x-date-input>
<x-slot name="title">Owned since</x-slot>
<x-slot name="name">owned_since</x-slot>
<x-slot name="value">{{$server[0]->owned_since }}</x-slot>
<x-slot name="value">{{$server_data->owned_since }}</x-slot>
</x-date-input>
</div>
<div class="col-12 col-md-3 mb-3">
<x-date-input>
<x-slot name="title">Next due date</x-slot>
<x-slot name="name">next_due_date</x-slot>
<x-slot name="value">{{$server[0]->next_due_date }}</x-slot>
<x-slot name="value">
@if(isset($server_data->price->next_due_date))
{{$server_data->price->next_due_date}}
@else
{{\Carbon\Carbon::now()->addMonth(1)->format('Y-m-d')}}
@endif
</x-slot>
</x-date-input>
</div>
</div>
@ -207,8 +215,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label1</x-slot>
@if(isset($labels[0]->id))
<x-slot name="current">{{$labels[0]->id}}</x-slot>
@if(isset($server_data->labels[0]->label->id))
<x-slot name="current">{{$server_data->labels[0]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -216,8 +224,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label2</x-slot>
@if(isset($labels[1]->id))
<x-slot name="current">{{$labels[1]->id}}</x-slot>
@if(isset($server_data->labels[1]->label->id))
<x-slot name="current">{{$server_data->labels[1]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -225,8 +233,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label3</x-slot>
@if(isset($labels[2]->id))
<x-slot name="current">{{$labels[2]->id}}</x-slot>
@if(isset($server_data->labels[2]->label->id))
<x-slot name="current">{{$server_data->labels[2]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -234,14 +242,14 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label4</x-slot>
@if(isset($labels[3]->id))
<x-slot name="current">{{$labels[3]->id}}</x-slot>
@if(isset($server_data->labels[3]->label->id))
<x-slot name="current">{{$server_data->labels[3]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
</div>
<div class="row">
@foreach($ip_addresses as $ip)
@foreach($server_data->ips as $ip)
<div class="col-12 col-lg-3 mb-4">
<x-text-input>
<x-slot name="title">IP</x-slot>
@ -256,7 +264,7 @@
<div class="col-12 col-lg-6 mb-4">
<div class="form-check">
<input class="form-check-input" name="is_active" type="checkbox"
value="1" {{ ($server[0]->active === 1) ? 'checked' : '' }}>
value="1" {{ ($server_data->active === 1) ? 'checked' : '' }}>
<label class="form-check-label">
I still have this server
</label>
@ -265,7 +273,7 @@
<div class="col-12 col-lg-6 mb-4">
<div class="form-check">
<input class="form-check-input" name="show_public" type="checkbox"
value="1" {{ ($server[0]->show_public === 1) ? 'checked' : '' }}>
value="1" {{ ($server_data->show_public === 1) ? 'checked' : '' }}>
<label class="form-check-label">
Allow this data to be public <a href="{{route('settings.index')}}">restrict values
here</a>

View File

@ -59,7 +59,7 @@
<td class="text-center">
{{ App\Models\Server::serviceServerType($server->server_type) }}
</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os->id, $server->os->name)!!}</td>
<td class="text-center">{{$server->cpu}}</td>
<td class="text-center">
@if(isset($server->ram))
@ -75,9 +75,9 @@
{{$server->disk}}<small>GB</small>
@endif
</td>
<td class="text-nowrap">{{ $server->location }}</td>
<td class="text-nowrap">{{ $server->provider_name }}</td>
<td class="text-nowrap">{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}}</td>
<td class="text-nowrap">{{ $server->location->name }}</td>
<td class="text-nowrap">{{ $server->provider->name }}</td>
<td class="text-nowrap">{{ $server->price->price }} {{$server->price->currency}} {{\App\Process::paymentTermIntToString($server->price->term)}}</td>
<td class="text-nowrap">
{{now()->diffInDays(Carbon\Carbon::parse($server->next_due_date), false)}}
<small>days</small></td>
@ -144,7 +144,7 @@
<td class="text-center">
{{ App\Models\Server::serviceServerType($server->server_type) }}
</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($server->os->id, $server->os->name)!!}</td>
<td class="text-center">{{$server->cpu}}</td>
<td class="text-center">
@if($server->ram_as_mb > 1024)
@ -160,9 +160,9 @@
{{$server->disk}}<small>GB</small>
@endif
</td>
<td class="text-nowrap">{{ $server->location }}</td>
<td class="text-nowrap">{{ $server->provider_name }}</td>
<td class="text-nowrap">{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}}</td>
<td class="text-nowrap">{{ $server->location->name }}</td>
<td class="text-nowrap">{{ $server->provider->name }}</td>
<td class="text-nowrap">{{ $server->price->price }} {{$server->price->currency}} {{\App\Process::paymentTermIntToString($server->price->term)}}</td>
<td class="text-center"> {{ $server->owned_since }}</td>
<td class="text-nowrap">
<form action="{{ route('servers.destroy', $server->id) }}" method="POST">

View File

@ -46,12 +46,12 @@
<td class="text-center">
{{ App\Models\Server::serviceServerType($s->server_type) }}
</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($s->os_id, $s->os_name)!!}</td>
<td class="text-center">{!!App\Models\Server::osIntToIcon($s->os->id, $s->os->name)!!}</td>
<td class="text-center">{{$s->cpu}}</td>
<td class="text-nowrap">{{$s->cpu_freq}}</td>
<td class="text-nowrap">{{$s->yabs[0]->cpu_freq}}</td>
<td class="text-nowrap">
@if(isset($s->ram))
{{ $s->ram}}<small>{{ $s->ram_type}}</small>
@if(isset($s->yabs[0]->ram))
{{ $s->yabs[0]->ram}}<small>{{ $s->yabs[0]->ram_type}}</small>
@else
{{$s->ram_as_mb}}<small>MB</small>
@endif
@ -65,52 +65,52 @@
</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_location') === 1)
{{ $s->location }}
{{ $s->location->name }}
@endif</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_provider') === 1)
{{ $s->provider_name }}
{{ $s->provider->name }}
@endif
</td>
<td class="text-nowrap">{{ $s->price }} {{$s->currency}} {{\App\Process::paymentTermIntToString($s->term)}}</td>
<td class="text-nowrap">{{ $s->price->price }} {{$s->currency}} {{\App\Process::paymentTermIntToString($s->price->term)}}</td>
<td class="text-nowrap"> {{ $s->owned_since }}</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->gb5_single}}
{{$s->yabs[0]->gb5_single}}
@endif
</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->gb5_multi}}
{{$s->yabs[0]->gb5_multi}}
@endif
</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->d_4k}}<small>{{$s->d_4k_type}}</small>
{{$s->yabs[0]->disk_speed->d_4k}}<small>{{$s->yabs[0]->disk_speed->d_4k_type}}</small>
@endif
</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->d_64k}}<small>{{$s->d_64k_type}}</small>
{{$s->yabs[0]->disk_speed->d_64k}}<small>{{$s->yabs[0]->disk_speed->d_64k_type}}</small>
@endif
</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->d_512k}}<small>{{$s->d_512k_type}}</small>
{{$s->yabs[0]->disk_speed->d_512k}}<small>{{$s->yabs[0]->disk_speed->d_512k_type}}</small>
@endif</td>
<td class="text-nowrap">
@if(Session::get('show_server_value_yabs') === 1)
{{$s->d_1m}}<small>{{$s->d_1m_type}}</small>
{{$s->yabs[0]->disk_speed->d_1m}}<small>{{$s->yabs[0]->disk_speed->d_1m_type}}</small>
@endif</td>
@if(Session::get('show_server_value_ip') === 1)
<td class="text-nowrap">
@if($s->is_ipv4 === 1)
{{ $s->ip }}
@if($s->ips[0]->is_ipv4 === 1)
{{ $s->ips[0]->address }}
@endif
</td>
<td class="text-nowrap">
@if($s->is_ipv4 === 0)
{{ $s->ip }}
@if($s->ips[0]->is_ipv6 === 1)
{{ $s->ips[0]->address }}
@endif
</td>
@endif

View File

@ -1,4 +1,6 @@
@section('title') {{$server->hostname}} {{'server'}} @endsection
@section('title')
{{$server_data->hostname}} {{'server'}}
@endsection
<x-app-layout>
<x-slot name="header">
{{ __('Server details') }}
@ -7,18 +9,14 @@
<x-card class="shadow mt-3">
<div class="row">
<div class="col-12 col-md-6 mb-2">
<h2>{{ $server->hostname }}</h2>
<code>@foreach($labels as $label)
@if($loop->last)
{{$label->label}}
@else
{{$label->label}},
@endif
@endforeach</code>
<h2>{{ $server_data->hostname }}</h2>
@foreach($server_data->labels as $label)
<span class="badge bg-primary mx-1">{{$label->label->label}}</span>
@endforeach
</div>
<div class="col-12 col-md-6 text-md-end">
<h6 class="text-muted pe-lg-4">{{ $server->id }}</h6>
@if($server->active !== 1)
<h6 class="text-muted pe-lg-4">{{ $server_data->id }}</h6>
@if($server_data->active !== 1)
<h6 class="text-danger pe-lg-4">not active</h6>
@endif
</div>
@ -31,65 +29,65 @@
<tr>
<td class="px-2 py-2 font-bold text-muted">Type</td>
<td>
{{ $server->serviceServerType($server->server_type) }}
{{ $server_data->serviceServerType($server_data->server_type) }}
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">OS</td>
<td>{{ $server_extras[0]->os_name }}</td>
<td>{{ $server_data->os->name }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Location</td>
<td>{{$server_extras[0]->location}}</td>
<td>{{$server_data->location->name}}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Provider</td>
<td>{{$server_extras[0]->provider}}</td>
<td>{{$server_data->provider->name}}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Price</td>
<td>{{ $server_extras[0]->price }} {{ $server_extras[0]->currency }}
<small>{{\App\Process::paymentTermIntToString($server_extras[0]->term)}}</small>
<td>{{ $server_data->price->price }} {{ $server_data->price->currency }}
<small>{{\App\Process::paymentTermIntToString($server_data->price->term)}}</small>
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Next due date</td>
<td>{{Carbon\Carbon::parse($server_extras[0]->next_due_date)->diffForHumans()}}
({{Carbon\Carbon::parse($server_extras[0]->next_due_date)->format('d/m/Y')}})
<td>{{Carbon\Carbon::parse($server_data->price->next_due_date)->diffForHumans()}}
({{Carbon\Carbon::parse($server_data->price->next_due_date)->format('d/m/Y')}})
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">CPU</td>
<td>
{{ $server_extras[0]->cpu }} @if($server_extras[0]->has_yabs)
<small>@</small> {{ $server_extras[0]->cpu_freq }} Mhz
{{ $server_data->cpu }} @if($server_data->has_yabs)
<small>@</small> {{ $server_data->yabs[0]->cpu_freq }} Mhz
@endif</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">RAM</td>
<td>
@if(isset($server_extras[0]->ram))
{{ $server_extras[0]->ram }} {{ $server_extras[0]->ram_type }}
@if(isset($server_data->yabs[0]->ram))
{{ $server_data->yabs[0]->ram }} {{ $server_data->yabs[0]->ram_type }}
@else
{{ $server->ram }} {{ $server->ram_type }}
{{ $server_data->ram }} {{ $server_data->ram_type }}
@endif
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Disk</td>
<td>
@if(isset($server_extras[0]->disk))
{{ $server_extras[0]->disk }} {{ $server_extras[0]->disk_type }}
@if(isset($server_data->yabs[0]->disk))
{{ $server_data->yabs[0]->disk }} {{ $server_data->yabs[0]->disk_type }}
@else
{{ $server->disk }} {{ $server->disk_type }}
{{ $server_data->disk }} {{ $server_data->disk_type }}
@endif
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Bandwidth</td>
<td>{{ $server_extras[0]->bandwidth }} GB</td>
<td>{{ $server_data->bandwidth }} GB</td>
</tr>
@foreach($ip_addresses as $ip)
@foreach($server_data->ips as $ip)
<tr>
<td class="px-2 py-2 font-bold text-muted">@if($ip['is_ipv4'])
IPv4
@ -102,29 +100,29 @@
@endforeach
<tr>
<td class="px-2 py-2 font-bold text-muted">Was promo</td>
<td>{{ ($server_extras[0]->was_promo === 1) ? 'Yes' : 'No' }}</td>
<td>{{ ($server_data->was_promo === 1) ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Owned since</td>
<td>
@if(!is_null($server->owned_since))
{{ date_format(new DateTime($server->owned_since), 'jS F Y') }}
@if(!is_null($server_data->owned_since))
{{ date_format(new DateTime($server_data->owned_since), 'jS F Y') }}
@endif
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Inserted</td>
<td>
@if(!is_null($server->created_at))
{{ date_format(new DateTime($server->created_at), 'jS M y g:i a') }}
@if(!is_null($server_data->created_at))
{{ date_format(new DateTime($server_data->created_at), 'jS M y g:i a') }}
@endif
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Updated</td>
<td>
@if(!is_null($server->updated_at))
{{ date_format(new DateTime($server->updated_at), 'jS M y g:i a') }}
@if(!is_null($server_data->updated_at))
{{ date_format(new DateTime($server_data->updated_at), 'jS M y g:i a') }}
@endif
</td>
</tr>
@ -135,60 +133,64 @@
class="btn btn-success btn-sm mx-2">
Go back
</a>
<a href="{{ route('servers.edit', $server->id) }}"
<a href="{{ route('servers.edit', $server_data->id) }}"
class="btn btn-primary btn-sm mx-2">
Edit
</a>
</div>
<div class="col-12 col-lg-6">
@if($server_extras[0]->has_yabs)
@if($server_data->has_yabs)
<div class="table-responsive">
<table class="table table-borderless text-nowrap">
<tbody>
<tr>
<td class="px-2 py-2 font-bold text-muted">GB5 Single/Multi</td>
<td>
{{$server_extras[0]->gb5_single}} / {{$server_extras[0]->gb5_multi}}
{{$server_data->yabs[0]->gb5_single}} / {{$server_data->yabs[0]->gb5_multi}}
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">CPU</td>
<td>{{$server_extras[0]->cpu_model}}</td>
<td>{{$server_data->yabs[0]->cpu_model}}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">AES</td>
<td>{{ ($server_extras[0]->aes === 1) ? 'Yes' : 'No' }}</td>
<td>{{ ($server_data->yabs[0]->aes === 1) ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">VM</td>
<td>{{ ($server_extras[0]->vm === 1) ? 'Yes' : 'No' }}</td>
<td>{{ ($server_data->yabs[0]->vm === 1) ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Disk 4k</td>
<td>{{$server_extras[0]->d_4k}} <small>{{$server_extras[0]->d_4k_type}}</small></td>
<td>{{$server_data->yabs[0]->disk_speed->d_4k}}
<small>{{$server_data->yabs[0]->disk_speed->d_4k_type}}</small></td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Disk 64k</td>
<td>{{$server_extras[0]->d_64k}} <small>{{$server_extras[0]->d_64k_type}}</small>
<td>{{$server_data->yabs[0]->disk_speed->d_64k}}
<small>{{$server_data->yabs[0]->disk_speed->d_64k_type}}</small>
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Disk 512k</td>
<td>{{$server_extras[0]->d_512k}} <small>{{$server_extras[0]->d_512k_type}}</small>
<td>{{$server_data->yabs[0]->disk_speed->d_512k}}
<small>{{$server_data->yabs[0]->disk_speed->d_512k_type}}</small>
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Disk 1m</td>
<td>{{$server_extras[0]->d_1m}} <small>{{$server_extras[0]->d_1m_type}}</small></td>
<td>{{$server_data->yabs[0]->disk_speed->d_1m}}
<small>{{$server_data->yabs[0]->disk_speed->d_1m_type}}</small></td>
</tr>
<tr>
<td class="px-2 py-2 font-bold">Network speed (s/r)</td>
</tr>
@foreach($network_speeds as $ns)
@foreach($server_data->yabs[0]->network_speed as $ns)
<tr>
<td class="px-2 py-2 font-bold text-muted">{{$ns['location']}}</td>
<td>{{$ns['send']}} <small>{{$ns['send_type']}}</small> {{$ns['receive']}}
<small>{{$ns['receive_type']}}</small></td>
<td class="px-2 py-2 font-bold text-muted">{{$ns->location}}</td>
<td>{{$ns->send}} <small>{{$ns->send_type}}</small> {{$ns->receive}}
<small>{{$ns->receive_type}}</small></td>
</tr>
@endforeach
</tbody>

View File

@ -12,7 +12,7 @@
Back to shared hosting
</a>
<x-auth-validation-errors></x-auth-validation-errors>
<form action="{{ route('shared.update', $shared[0]->service_id) }}" method="POST">
<form action="{{ route('shared.update', $shared[0]->id) }}" method="POST">
@csrf
@method('PUT')
<div class="row mt-3">
@ -27,7 +27,7 @@
</div>
</div>
<div class="col-12 col-lg-3 mb-4">
<input type="hidden" name="id" value="{{$shared[0]->service_id}}">
<input type="hidden" name="id" value="{{$shared[0]->id}}">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" id="shared_type" name="shared_type">
@ -80,21 +80,21 @@
<x-slot name="title">Dedicated IP</x-slot>
<x-slot name="name">dedicated_ip</x-slot>
<x-slot name="max">255</x-slot>
<x-slot name="value">@if(isset($ip_address[0]['address'])) {{$ip_address[0]['address']}}@endif</x-slot>
<x-slot name="value">@if(isset($shared[0]->ips[0]->address)) {{$shared[0]->ips[0]->address}}@endif</x-slot>
</x-text-input>
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<x-providers-select>
<x-slot name="current">{{$shared[0]->provider_id}}</x-slot>
<x-slot name="current">{{$shared[0]->provider->id}}</x-slot>
</x-providers-select>
</div>
<div class="col-md-3 mb-3">
<x-number-input>
<x-slot name="title">Price</x-slot>
<x-slot name="name">price</x-slot>
<x-slot name="value">{{$shared[0]->price}}</x-slot>
<x-slot name="value">{{$shared[0]->price->price}}</x-slot>
<x-slot name="max">9999</x-slot>
<x-slot name="step">0.01</x-slot>
<x-slot name="required"></x-slot>
@ -102,19 +102,19 @@
</div>
<div class="col-md-3 mb-3">
<x-term-select>
<x-slot name="current">{{$shared[0]->term}}</x-slot>
<x-slot name="current">{{$shared[0]->price->term}}</x-slot>
</x-term-select>
</div>
<div class="col-md-3 mb-3">
<x-currency-select>
<x-slot name="current">{{$shared[0]->currency}}</x-slot>
<x-slot name="current">{{$shared[0]->price->currency}}</x-slot>
</x-currency-select>
</div>
</div>
<div class="row mb-2">
<div class="col-12 col-md-3 mb-3">
<x-locations-select>
<x-slot name="current">{{$shared[0]->location_id}}</x-slot>
<x-slot name="current">{{$shared[0]->location->id}}</x-slot>
</x-locations-select>
</div>
<div class="col-12 col-md-3 mb-3">
@ -135,7 +135,7 @@
<x-date-input>
<x-slot name="title">Next due date</x-slot>
<x-slot name="name">next_due_date</x-slot>
<x-slot name="value">{{$shared[0]->next_due_date }}</x-slot>
<x-slot name="value">{{$shared[0]->price->next_due_date }}</x-slot>
</x-date-input>
</div>
</div>
@ -219,8 +219,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label1</x-slot>
@if(isset($labels[0]->id))
<x-slot name="current">{{$labels[0]->id}}</x-slot>
@if(isset($shared[0]->labels[0]->label->id))
<x-slot name="current">{{$shared[0]->labels[0]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -228,8 +228,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label2</x-slot>
@if(isset($labels[1]->id))
<x-slot name="current">{{$labels[1]->id}}</x-slot>
@if(isset($shared[0]->labels[1]->label->id))
<x-slot name="current">{{$shared[0]->labels[1]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -237,8 +237,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label3</x-slot>
@if(isset($labels[2]->id))
<x-slot name="current">{{$labels[2]->id}}</x-slot>
@if(isset($shared[0]->labels[2]->label->id))
<x-slot name="current">{{$shared[0]->labels[2]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>
@ -246,8 +246,8 @@
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label4</x-slot>
@if(isset($labels[3]->id))
<x-slot name="current">{{$labels[3]->id}}</x-slot>
@if(isset($shared[0]->labels[3]->label->id))
<x-slot name="current">{{$shared[0]->labels[3]->label->id}}</x-slot>
@endif
</x-labels-select>
</div>

View File

@ -41,25 +41,25 @@
<tr>
<td>{{ $row->main_domain }}</td>
<td>{{ $row->shared_type }}</td>
<td class="text-nowrap">{{ $row->location }}</td>
<td class="text-nowrap">{{ $row->provider_name }}</td>
<td class="text-nowrap">{{ $row->location->name }}</td>
<td class="text-nowrap">{{ $row->provider->name }}</td>
<td>{{ $row->disk_as_gb }} <small>GB</small></td>
<td>{{ $row->price }} {{$row->currency}} {{\App\Process::paymentTermIntToString($row->term)}}</td>
<td>{{Carbon\Carbon::parse($row->next_due_date)->diffForHumans()}}</td>
<td>{{ $row->price->price }} {{$row->price->currency}} {{\App\Process::paymentTermIntToString($row->price->term)}}</td>
<td>{{Carbon\Carbon::parse($row->price->next_due_date)->diffForHumans()}}</td>
<td class="text-nowrap">{{ $row->owned_since }}</td>
<td class="text-nowrap">
<form action="{{ route('shared.destroy', $row->service_id) }}" method="POST">
<a href="{{ route('shared.show', $row->service_id) }}"
<form action="{{ route('shared.destroy', $row->id) }}" method="POST">
<a href="{{ route('shared.show', $row->id) }}"
class="text-body mx-1">
<i class="fas fa-eye" title="view"></i>
</a>
<a href="{{ route('shared.edit', $row->service_id) }}"
<a href="{{ route('shared.edit', $row->id) }}"
class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i>
</a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$row->main_domain}}" title="{{$row->service_id}}"></i>
id="btn-{{$row->main_domain}}" title="{{$row->id}}"></i>
</form>
</td>
</tr>

View File

@ -8,13 +8,9 @@
<div class="row">
<div class="col-12 col-md-6 mb-2">
<h2>{{ $shared->main_domain }}</h2>
<code>@foreach($labels as $label)
@if($loop->last)
{{$label->label}}
@else
{{$label->label}},
@endif
@endforeach</code>
@foreach($shared->labels as $label)
<span class="badge bg-primary mx-1">{{$label->label->label}}</span>
@endforeach
</div>
<div class="col-12 col-md-6 text-md-end">
<h6 class="text-muted pe-lg-4">{{ $shared->id }}</h6>
@ -34,26 +30,26 @@
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Location</td>
<td>{{ $shared_extras[0]->location }}</td>
<td>{{ $shared->location->name }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Provider</td>
<td>{{ $shared_extras[0]->provider_name }}</td>
<td>{{ $shared->provider->name }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Price</td>
<td>{{ $shared_extras[0]->price }} {{ $shared_extras[0]->currency }}
<small>{{\App\Process::paymentTermIntToString($shared_extras[0]->term)}}</small>
<td>{{ $shared->price->price }} {{ $shared->price->currency }}
<small>{{\App\Process::paymentTermIntToString($shared->price->term)}}</small>
</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Was promo</td>
<td>{{ ($shared_extras[0]->was_promo === 1) ? 'Yes' : 'No' }}</td>
<td>{{ ($shared->was_promo === 1) ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Has dedicated IP?</td>
<td>
@if(isset($ip_address[0]->address))
@if(isset($shared->ips[0]->address))
Yes
@else
No
@ -62,8 +58,8 @@
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">IP</td>
<td><code>@if(isset($ip_address[0]->address))
{{$ip_address[0]->address}}
<td><code>@if(isset($shared->ips[0]->address))
{{$shared->ips[0]->address}}
@endif
</code></td>
</tr>
@ -77,8 +73,8 @@
</tr>
<tr>
<td class="px-2 py-2 font-bold text-muted">Next due date</td>
<td>{{Carbon\Carbon::parse($shared_extras[0]->next_due_date)->diffForHumans()}}
({{Carbon\Carbon::parse($shared_extras[0]->next_due_date)->format('d/m/Y')}})
<td>{{Carbon\Carbon::parse($shared->price->next_due_date)->diffForHumans()}}
({{Carbon\Carbon::parse($shared->price->next_due_date)->format('d/m/Y')}})
</td>
</tr>
<tr>

View File

@ -0,0 +1,77 @@
@section('title')
{{'Choose YABs to compare'}}
@endsection
@section('scripts')
<script src="{{ asset('js/vue.min.js') }}"></script>
@endsection
<x-app-layout>
<x-slot name="header">
{{ __('Choose two YABs to compare') }}
</x-slot>
<div class="container" id="app">
<div class="card shadow mt-3">
<div class="card-body">
<a href="{{ route('yabs.index') }}" class="btn btn-primary mb-3">YABs home</a>
@if(count($all_yabs) >= 2)
<div class="row">
<div class="col-12 col-lg-6">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">YABs 1</span></div>
<select class="form-control" name="server1" @change="changeServer1($event)">
@foreach ($all_yabs as $yabs)
<option value="{{ $yabs['id'] }}">
{{ $yabs->server->hostname }} ({{$yabs['output_date']}})
</option>
@endforeach
</select>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">YABs 2</span></div>
<select class="form-control" name="server2" @change="changeServer2($event)">
@foreach ($all_yabs as $yabs)
<option value="{{ $yabs['id'] }}" {{($loop->index === 1)?'selected':''}}>
{{ $yabs->server->hostname }} ({{$yabs['output_date']}})
</option>
@endforeach
</select>
</div>
</div>
</div>
<a v-bind:href="full_url" class="btn btn-success mt-4">View comparison table</a>
@else
<p class="text-danger">You need to have added at least 2 YABs to use this feature</p>
@endif
</div>
</div>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small>Built on Laravel
v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p>
@endif
</div>
<script type="application/javascript">
let app = new Vue({
el: "#app",
data: {
"base_url": "yabs-compare/",
"full_url": "{{route('yabs.compare', ['yabs1' => $all_yabs[0]->id, 'yabs2' => $all_yabs[1]->id])}}",
"url_input": "",
"server1": "{{$all_yabs[0]->id ?? ''}}",
"server2": "{{$all_yabs[1]->id ?? ''}}",
},
methods: {
changeServer1: function changeServer1(event) {
this.server1 = event.target.value;
this.full_url = this.base_url + this.server1 + '/' + this.server2;
this.url_input = this.full_url;
},
changeServer2: function changeServer2(event) {
this.server2 = event.target.value;
this.full_url = this.base_url + this.server1 + '/' + this.server2;
this.url_input = this.full_url;
}
}
});
</script>
</x-app-layout>

View File

@ -0,0 +1,244 @@
@section('title') {{'Compare YABs'}} @endsection
@section('style')
<style>
.td-nowrap {
white-space: nowrap;
}
.plus-td {
background: #71ed7136 !important;
}
.neg-td {
background: #ed827136 !important;
}
.equal-td {
background: #6189ff26 !important;
}
.objects-table th:first-child, .objects-table td:first-child, .compare-table th:first-child, .compare-table td:first-child {
position: sticky;
left: 0;
background-color: #f6f6f6;
text-align: left;
}
.data-type {
color: #212529b3;
padding-left: .05rem;
font-size: 85%;
}
</style>
@endsection
<x-app-layout>
<div class="container" id="app">
<div class="card shadow mt-3">
<div class="card-body">
<a href="{{ route('yabs.compare-choose') }}" class="btn btn-primary mb-3">Choose others</a>
<div class="table-responsive">
<table class="table compare-table">
<thead>
<tr>
<th></th>
<th>{{ $yabs1_data[0]->id }}</th>
<th>DIF</th>
<th>{{ $yabs2_data[0]->id}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="td-nowrap">Date</td>
<td class="td-nowrap">{{ date_format(new DateTime($yabs1_data[0]->output_date), 'g:ia D jS F Y') }}</td>
<td class="td-nowrap equal-td">
{{\Carbon\Carbon::parse($yabs1_data[0]->output_date)->diffForHumans(\Carbon\Carbon::parse($yabs2_data[0]->output_date))}}
</td>
<td class="td-nowrap">{{ date_format(new DateTime($yabs2_data[0]->output_date), 'g:ia D jS F Y') }}</td>
</tr>
<tr>
<td class="td-nowrap">Server</td>
<td class="td-nowrap">{{$yabs1_data[0]->server->hostname}}</td>
<td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$yabs2_data[0]->server->hostname}}</td>
</tr>
<tr>
<td class="td-nowrap">CPU count</td>
<td class="td-nowrap">{{$yabs1_data[0]->cpu_cores}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_cores, $yabs2_data[0]->cpu_cores, ' cores') !!}
<td class="td-nowrap">{{$yabs2_data[0]->cpu_cores}}</td>
</tr>
<tr>
<td class="td-nowrap">CPU freq</td>
<td class="td-nowrap">{{$yabs1_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_freq, $yabs2_data[0]->cpu_freq, 'Mhz') !!}
<td class="td-nowrap">{{$yabs2_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
</tr>
<tr>
<td class="td-nowrap">Ram</td>
<td class="td-nowrap">{{$yabs1_data[0]->ram_mb}}<span class="data-type">MB</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->ram_mb, $yabs2_data[0]->ram_mb, 'MB') !!}
<td class="td-nowrap">{{$yabs2_data[0]->ram_mb}}<span class="data-type">MB</span></td>
</tr>
<tr>
<td class="td-nowrap">Disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_gb}}<span class="data-type">GB</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_gb, $yabs2_data[0]->disk_gb, 'GB') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_gb}}<span class="data-type">GB</span></td>
</tr>
<tr>
<td class="td-nowrap">GB5 single</td>
<td class="td-nowrap">{{$yabs1_data[0]->gb5_single}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_single, $yabs2_data[0]->gb5_single, '') !!}
<td class="td-nowrap">{{$yabs2_data[0]->gb5_single}}</td>
</tr>
<tr>
<td class="td-nowrap">GB5 multi</td>
<td class="td-nowrap">{{$yabs1_data[0]->gb5_multi}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_multi, $yabs2_data[0]->gb5_multi, '') !!}
<td class="td-nowrap">{{$yabs2_data[0]->gb5_multi}}</td>
</tr>
<tr>
<td class="td-nowrap">4k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_4k_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_4k_as_mbps, $yabs2_data[0]->disk_speed->d_4k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_4k_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">64k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_64k_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_64k_as_mbps, $yabs2_data[0]->disk_speed->d_64k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_64k_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">512k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_512k_as_mbps, $yabs2_data[0]->disk_speed->d_512k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
</tr>
<tr>
<td class="td-nowrap">1m disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_1m_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_1m_as_mbps, $yabs2_data[0]->disk_speed->d_1m_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_1m_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->send_as_mbps, $yabs2_data[0]->network_speed[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->receive_as_mbps, $yabs2_data[0]->network_speed[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@if($yabs1_data[0]->network_speed[1]->location === $yabs2_data[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->send_as_mbps, $yabs2_data[0]->network_speed[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->receive_as_mbps, $yabs2_data[0]->network_speed[1]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[1]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[2]->location === $yabs2_data[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->send_as_mbps, $yabs2_data[0]->network_speed[2]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[2]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->receive_as_mbps, $yabs2_data[0]->network_speed[2]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[2]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[3]->location === $yabs2_data[0]->network_speed[3]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->send_as_mbps, $yabs2_data[0]->network_speed[3]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->receive_as_mbps, $yabs2_data[0]->network_speed[3]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[3]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[4]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[4]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[5]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[5]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[5]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[5]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[5]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@ -14,6 +14,7 @@
<x-delete-confirm-modal></x-delete-confirm-modal>
<x-card class="shadow mt-3">
<a href="{{ route('yabs.create') }}" class="btn btn-primary mb-3">Add YABs</a>
<a href="{{ route('yabs.compare-choose') }}" class="btn btn-success mb-3">Compare YABs</a>
<x-errors-alert></x-errors-alert>
<x-success-alert></x-success-alert>
<div class="table-responsive">
@ -40,7 +41,7 @@
@if(!empty($yabs))
@foreach($yabs as $yab)
<tr>
<td><a href="servers/{{$yab->server_id}}" class="text-decoration-none">{{ $yab->hostname }}</a></td>
<td><a href="servers/{{$yab->server_id}}" class="text-decoration-none">{{ $yab->server->hostname }}</a></td>
<td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_cores }}</span></td>
<td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_freq }}<small>Mhz</small></span></td>
<td>{{ $yab->ram }}<small>{{ $yab->ram_type }}</small></td>
@ -53,10 +54,10 @@
No
@endif
</td>
<td>{{ $yab->d_4k }}<small>{{ $yab->d_4k_type }}</small></td>
<td>{{ $yab->d_64k }}<small>{{ $yab->d_64k_type }}</small></td>
<td>{{ $yab->d_512k }}<small>{{ $yab->d_512k_type }}</small></td>
<td>{{ $yab->d_1m }}<small>{{ $yab->d_1m_type }}</small></td>
<td>{{ $yab->disk_speed->d_4k }}<small>{{ $yab->disk_speed->d_4k_type }}</small></td>
<td>{{ $yab->disk_speed->d_64k }}<small>{{ $yab->disk_speed->d_64k_type }}</small></td>
<td>{{ $yab->disk_speed->d_512k }}<small>{{ $yab->disk_speed->d_512k_type }}</small></td>
<td>{{ $yab->disk_speed->d_1m }}<small>{{ $yab->disk_speed->d_1m_type }}</small></td>
<td>{{ date_format(new DateTime($yab->output_date), 'Y-m-d g:i a') }}</small></td>
<td class="text-nowrap">
<form action="{{ route('yabs.destroy', $yab->id) }}" method="POST">
@ -66,7 +67,7 @@
</a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$yab->hostname}}" title="{{$yab->id}}"></i>
id="btn-{{$yab->server->hostname}}" title="{{$yab->id}}"></i>
</form>
</td>
</tr>

View File

@ -16,7 +16,7 @@
<tbody>
<tr>
<td class="px-4 py-2 font-bold">Server</td>
<td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->hostname }}</a></td>
<td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->server->hostname }}</a></td>
</tr>
<tr>
<td class="px-4 py-2 font-bold">CPU</td>
@ -75,10 +75,10 @@
class="text-decoration-none">{{ $yab[0]->gb5_multi }}</a></td>
</tr>
<tr>
<td class="px-4 py-2 font-bold">Tested</td>
<td class="px-4 py-2 font-bold">Test ran</td>
<td>
@if(!is_null($yab[0]->output_date))
{{date_format(new DateTime($yab[0]->output_date), 'jS F Y')}}
{{date_format(new DateTime($yab[0]->output_date), 'g:ia D jS F Y')}}
@endif
</td>
</tr>
@ -93,25 +93,25 @@
<td class="py-2">Disk speeds:</td>
</tr>
<tr>
<td class="px-4 py-2"><b>4k</b> {{$yab[0]->d_4k}}
<small>{{$yab[0]->d_4k_type}}</small></td>
<td class="px-4 py-2"><b>4k</b> {{$yab[0]->disk_speed->d_4k}}
<small>{{$yab[0]->disk_speed->d_4k_type}}</small></td>
</tr>
<tr>
<td class="px-4 py-2"><b>64k</b> {{$yab[0]->d_64k}}
<small>{{$yab[0]->d_64k_type}}</small></td>
<td class="px-4 py-2"><b>64k</b> {{$yab[0]->disk_speed->d_64k}}
<small>{{$yab[0]->disk_speed->d_64k_type}}</small></td>
</tr>
<tr>
<td class="px-4 py-2"><b>512k</b> {{$yab[0]->d_512k}}
<td class="px-4 py-2"><b>512k</b> {{$yab[0]->disk_speed->d_512k}}
<small>{{$yab[0]->d_512k_type}}</small></td>
</tr>
<tr>
<td class="px-4 py-2"><b>1m</b> {{$yab[0]->d_1m}} <small>{{$yab[0]->d_1m_type}}</small>
<td class="px-4 py-2"><b>1m</b> {{$yab[0]->disk_speed->d_1m}} <small>{{$yab[0]->disk_speed->d_1m_type}}</small>
</td>
</tr>
<tr>
<td class="py-2">Network speed (location|send|receive):</td>
</tr>
@foreach($network as $speed_test)
@foreach($yab[0]->network_speed as $speed_test)
<tr>
<td class="px-4 py-2 text-nowrap">
<b>{{$speed_test->location}}</b> {{$speed_test->send}}

View File

@ -70,6 +70,10 @@ Route::resource('shared', SharedController::class)->middleware(['auth']);
Route::resource('yabs', YabsController::class)->middleware(['auth']);
Route::get('yabs-compare-choose', 'App\Http\Controllers\YabsController@chooseYabsCompare')->middleware(['auth'])->name('yabs.compare-choose');
Route::get('yabs-compare/{yabs1}/{yabs2}', 'App\Http\Controllers\YabsController@compareYabs')->middleware(['auth'])->name('yabs.compare');
Route::get('servers-compare-choose', 'App\Http\Controllers\ServerController@chooseCompare')->middleware(['auth'])->name('servers-compare-choose');
Route::get('servers-compare/{server1}/{server2}', 'App\Http\Controllers\ServerController@compareServers')->middleware(['auth']);
Route::get('servers-compare/{server1}/{server2}', 'App\Http\Controllers\ServerController@compareServers')->middleware(['auth'])->name('servers.compare');