Merge pull request #46 from cp6/Development

Development 2.1.1
This commit is contained in:
corbpie 2022-06-19 21:28:33 +10:00 committed by GitHub
commit 6b34dd6b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 509 additions and 146 deletions

1
.gitignore vendored
View File

@ -56,3 +56,4 @@ fabric.properties
# modules.xml
# .idea/misc.xml
# *.ipr
storage/clockwork/

120
README.md
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.0-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.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/)
<img src="https://raw.githubusercontent.com/cp6/my-idlers/main/public/My%20Idlers%20logo.jpg" width="128" height="128" />
@ -19,25 +19,16 @@ 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.0 changes:
## 2.1.1 changes (19th June 2022):
* Added Seedbox CRUD
* Added dark mode (settings option. Bootstrap-Night https://vinorodrigues.github.io/bootstrap-dark-5/)
* Added some foreign keys for certain tables
* Added functions for IP and label assignments
* Added functions to forget (clear) cache, preventing chunks of duplicate code
* Added VMware to server virt select dropdown options
* Added Kharkiv and Sao Paulo to locations seeder
* Updated Controllers with DB calls and logic moved to relevant Model
* Updated YABs inserts for version v2022-05-06
* Updated DB calls to use caching
* Updated Home blade info cards to be col-6 instead of 12 when on mobile
* Updated home page view links on recently added
* Fixed YABs insert error not displaying
* 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
## Requires
* PHP 8 (8.1 recommended)
* PHP 8.1
## Features
@ -162,6 +153,103 @@ All API requests must be appended with `api/` e.g `mydomain.com/api/servers/gYk8
`shared/{id}`
**POST requests**
Create a server
`/servers`
Body content template
```json
{
"active": 1,
"show_public": 0,
"hostname": "test.domain.com",
"ns1": "ns1",
"ns2": "ns2",
"server_type": 1,
"os_id": 2,
"provider_id": 10,
"location_id": 15,
"ssh_port": 22,
"bandwidth": 2000,
"ram": 2024,
"ram_type": "MB",
"ram_as_mb": 2024,
"disk": 30,
"disk_type": "GB",
"disk_as_gb": 30,
"cpu": 2,
"has_yabs": 0,
"was_promo": 1,
"ip1": "127.0.0.1",
"ip2": null,
"owned_since": "2022-01-01",
"currency": "USD",
"price": 4.00,
"payment_term": 1,
"as_usd": 4.00,
"usd_per_month": 4.00,
"next_due_date": "2022-02-01"
}
```
**PUT requests**
Update a server
`/servers/ID`
Body content template
```json
{
"active": 1,
"show_public": 0,
"hostname": "test.domain.com",
"ns1": "ns1",
"ns2": "ns2",
"server_type": 1,
"os_id": 2,
"provider_id": 10,
"location_id": 15,
"ssh_port": 22,
"bandwidth": 2000,
"ram": 2024,
"ram_type": "MB",
"ram_as_mb": 2024,
"disk": 30,
"disk_type": "GB",
"disk_as_gb": 30,
"cpu": 2,
"has_yabs": 0,
"was_promo": 1,
"owned_since": "2022-01-01"
}
```
Update pricing
`/pricing/ID`
Body content template
```json
{
"price": 10.50,
"currency": "USD",
"term" : 1
}
```
**DELETE requests**
Delete a server
`/servers/ID`
## Notes
**Public viewable listings**

View File

@ -12,7 +12,10 @@ use App\Models\Server;
use App\Models\Shared;
use DataTables;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
class ApiController extends Controller
{
@ -23,7 +26,7 @@ class ApiController extends Controller
->join('providers as pr', 's.provider_id', '=', 'pr.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os'])->toJson(JSON_PRETTY_PRINT);
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os'])->toJson(JSON_PRETTY_PRINT);
return response($servers, 200);
}
@ -36,7 +39,7 @@ class ApiController extends Controller
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.id', '=', $id)
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os']);
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location', 'o.name as os']);
$yabs = DB::table('yabs')
->where('yabs.server_id', '=', $id)
@ -316,4 +319,216 @@ class ApiController extends Controller
return response(array('ip' => null), 200);
}
protected function storeServer(Request $request)
{
$rules = array(
'hostname' => 'min:3',
'server_type' => 'required|integer',
'os_id' => 'required|integer',
'provider_id' => 'required|integer',
'location_id' => 'required|integer',
'ssh_port' => 'required|integer',
'ram' => 'required|integer',
'ram_as_mb' => 'required|integer',
'disk' => 'required|integer',
'disk_as_gb' => 'required|integer',
'cpu' => 'required|integer',
'bandwidth' => 'required|integer',
'was_promo' => 'required|integer',
'active' => 'required|integer',
'show_public' => 'required|integer',
'ip1' => 'ip',
'ip2' => 'ip',
'owned_since' => 'required|date',
'ram_type' => 'required|string|size:2',
'disk_type' => 'required|string|size:2',
'currency' => 'required|string|size:3',
'price' => 'required|numeric',
'payment_term' => 'required|integer',
'next_due_date' => 'date',
);
$messages = array(
'required' => ':attribute is required',
'min' => ':attribute must be longer than 3',
'integer' => ':attribute must be an integer',
'string' => ':attribute must be a string',
'size' => ':attribute must be exactly :size characters',
'numeric' => ':attribute must be a float',
'ip' => ':attribute must be a valid IP address',
'date' => ':attribute must be a date Y-m-d',
);
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
}
$server_id = Str::random(8);
$pricing = new Pricing();
$as_usd = $pricing->convertToUSD($request->price, $request->currency);
$pricing->insertPricing(1, $server_id, $request->currency, $request->price, $request->payment_term, $as_usd, $request->next_due_date);
if (!is_null($request->ip1)) {
IPs::insertIP($server_id, $request->ip1);
}
if (!is_null($request->ip2)) {
IPs::insertIP($server_id, $request->ip2);
}
$insert = Server::create([
'id' => $server_id,
'hostname' => $request->hostname,
'server_type' => $request->server_type,
'os_id' => $request->os_id,
'ssh_port' => $request->ssh_port,
'provider_id' => $request->provider_id,
'location_id' => $request->location_id,
'ram' => $request->ram,
'ram_type' => $request->ram_type,
'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
'disk' => $request->disk,
'disk_type' => $request->disk_type,
'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
'owned_since' => $request->owned_since,
'ns1' => $request->ns1,
'ns2' => $request->ns2,
'bandwidth' => $request->bandwidth,
'cpu' => $request->cpu,
'was_promo' => $request->was_promo,
'show_public' => (isset($request->show_public)) ? 1 : 0
]);
Server::serverRelatedCacheForget();
if ($insert) {
return response()->json(array('result' => 'success', 'server_id' => $server_id), 200);
}
return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
}
public function destroyServer(Request $request)
{
$items = Server::find($request->id);
(!is_null($items)) ? $result = $items->delete() : $result = false;
$p = new Pricing();
$p->deletePricing($request->id);
Labels::deleteLabelsAssignedTo($request->id);
IPs::deleteIPsAssignedTo($request->id);
Server::serverRelatedCacheForget();
if ($result) {
return response()->json(array('result' => 'success'), 200);
}
return response()->json(array('result' => 'fail'), 500);
}
public function updateServer(Request $request)
{
$rules = array(
'hostname' => 'string|min:3',
'server_type' => 'integer',
'os_id' => 'integer',
'provider_id' => 'integer',
'location_id' => 'integer',
'ssh_port' => 'integer',
'ram' => 'integer',
'ram_as_mb' => 'integer',
'disk' => 'integer',
'disk_as_gb' => 'integer',
'cpu' => 'integer',
'bandwidth' => 'integer',
'was_promo' => 'integer',
'active' => 'integer',
'show_public' => 'integer',
'owned_since' => 'date',
'ram_type' => 'string|size:2',
'disk_type' => 'string|size:2',
'currency' => 'string|size:3',
'price' => 'numeric',
'payment_term' => 'integer',
'next_due_date' => 'date',
);
$messages = array(
'required' => ':attribute is required',
'min' => ':attribute must be longer than 3',
'integer' => ':attribute must be an integer',
'string' => ':attribute must be a string',
'size' => ':attribute must be exactly :size characters',
'numeric' => ':attribute must be a float',
'date' => ':attribute must be a date Y-m-d',
);
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
}
$server_update = Server::where('id', $request->id)->update(request()->all());
Server::serverRelatedCacheForget();
Server::serverSpecificCacheForget($request->id);
if ($server_update) {
return response()->json(array('result' => 'success', 'server_id' => $request->id), 200);
}
return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
}
public function updatePricing(Request $request)
{
$rules = array(
'price' => 'required|numeric',
'currency' => 'required|string|size:3',
'term' => 'required|integer',
'active' => 'integer',
'next_due_date' => 'date',
);
$messages = array(
'required' => ':attribute is required',
'integer' => ':attribute must be an integer',
'string' => ':attribute must be a string',
'size' => ':attribute must be exactly :size characters',
'numeric' => ':attribute must be a float',
'date' => ':attribute must be a date Y-m-d',
);
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return response()->json(['result' => 'fail', 'messages' => $validator->messages()], 400);
}
$pricing = new Pricing();
$request->as_usd = $pricing->convertToUSD($request->price, $request->currency);
$request->usd_per_month = $pricing->costAsPerMonth($request->as_usd, $request->term);
$price_update = Pricing::where('id', $request->id)->update(request()->all());
Cache::forget("all_pricing");
Server::serverRelatedCacheForget();
if ($price_update) {
return response()->json(array('result' => 'success', 'server_id' => $request->id), 200);
}
return response()->json(array('result' => 'fail', 'request' => $request->post()), 500);
}
}

View File

@ -65,7 +65,8 @@ class HomeController extends Controller
'due_soon' => $due_soon,
'newest' => $recently_added,
'execution_time' => number_format($p->getTimeTaken(), 2),
'servers_summary' => $server_summary
'servers_summary' => $server_summary,
'currency' => Session::get('dashboard_currency')
);
return view('home', compact('information'));

View File

@ -33,7 +33,8 @@ class SettingsController extends Controller
'default_currency' => 'required',
'default_server_os' => 'required',
'due_soon_amount' => 'required|integer|between:0,12',
'recently_added_amount' => 'required|integer|between:0,12'
'recently_added_amount' => 'required|integer|between:0,12',
'currency' => 'required|string|size:3'
]);
DB::table('settings')
@ -51,13 +52,15 @@ class SettingsController extends Controller
'default_currency' => $request->default_currency,
'default_server_os' => $request->default_server_os,
'due_soon_amount' => $request->due_soon_amount,
'recently_added_amount' => $request->recently_added_amount
'recently_added_amount' => $request->recently_added_amount,
'dashboard_currency' => $request->currency,
]);
Settings::setSettingsToSession($settings);
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('pricing_breakdown');//Main page pricing breakdown
Cache::forget('settings');//Main page settings cache

View File

@ -19,6 +19,8 @@ class Home extends Model
Cache::forget('due_soon');//Main page due_soon cache
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_pricing');//All the pricing
Cache::forget('services_count_all');
Cache::forget('pricing_breakdown');
}
public static function servicesCount()
@ -116,74 +118,83 @@ class Home extends Model
{
$pricing = json_decode($all_pricing, true);
$total_cost_weekly = $total_cost_pm = $inactive_count = 0;
foreach ($pricing as $price) {
if ($price['active'] === 1) {
if ($price['term'] === 1) {//1 month
$total_cost_weekly += ($price['as_usd'] / 4);
$total_cost_pm += $price['as_usd'];
} elseif ($price['term'] === 2) {//3 months
$total_cost_weekly += ($price['as_usd'] / 12);
$total_cost_pm += ($price['as_usd'] / 3);
} elseif ($price['term'] === 3) {// 6 month
$total_cost_weekly += ($price['as_usd'] / 24);
$total_cost_pm += ($price['as_usd'] / 6);
} elseif ($price['term'] === 4) {// 1 year
$total_cost_weekly += ($price['as_usd'] / 48);
$total_cost_pm += ($price['as_usd'] / 12);
} elseif ($price['term'] === 5) {//2 years
$total_cost_weekly += ($price['as_usd'] / 96);
$total_cost_pm += ($price['as_usd'] / 24);
} elseif ($price['term'] === 6) {//3 years
$total_cost_weekly += ($price['as_usd'] / 144);
$total_cost_pm += ($price['as_usd'] / 36);
return Cache::remember('pricing_breakdown', now()->addWeek(1), function () use ($pricing) {
$total_cost_weekly = $total_cost_pm = $inactive_count = 0;
foreach ($pricing as $price) {
if ($price['active'] === 1) {
if (Session::get('dashboard_currency') !== 'USD') {
$the_price = Pricing::convertFromUSD($price['as_usd'], Session::get('dashboard_currency'));
} else {
$the_price = $price['as_usd'];
}
if ($price['term'] === 1) {//1 month
$total_cost_weekly += ($the_price / 4);
$total_cost_pm += $the_price;
} elseif ($price['term'] === 2) {//3 months
$total_cost_weekly += ($the_price / 12);
$total_cost_pm += ($the_price / 3);
} elseif ($price['term'] === 3) {// 6 month
$total_cost_weekly += ($the_price / 24);
$total_cost_pm += ($the_price / 6);
} elseif ($price['term'] === 4) {// 1 year
$total_cost_weekly += ($the_price / 48);
$total_cost_pm += ($the_price / 12);
} elseif ($price['term'] === 5) {//2 years
$total_cost_weekly += ($the_price / 96);
$total_cost_pm += ($the_price / 24);
} elseif ($price['term'] === 6) {//3 years
$total_cost_weekly += ($the_price / 144);
$total_cost_pm += ($the_price / 36);
}
} else {
$inactive_count++;
}
} else {
$inactive_count++;
}
}
$total_cost_yearly = ($total_cost_pm * 12);
$total_cost_yearly = ($total_cost_pm * 12);
return array(
'total_cost_weekly' => $total_cost_weekly,
'total_cost_montly' => $total_cost_pm,
'total_cost_yearly' => $total_cost_yearly,
'inactive_count' => $inactive_count,
);
return array(
'total_cost_weekly' => $total_cost_weekly,
'total_cost_montly' => $total_cost_pm,
'total_cost_yearly' => $total_cost_yearly,
'inactive_count' => $inactive_count,
);
});
}
public static function doServicesCount($services_count): array
{
$servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
$services_count = json_decode($services_count, true);
foreach ($services_count as $sc) {
$total_services += $sc['amount'];
if ($sc['service_type'] === 1) {
$servers_count = $sc['amount'];
} else if ($sc['service_type'] === 2) {
$shared_count = $sc['amount'];
} else if ($sc['service_type'] === 3) {
$reseller_count = $sc['amount'];
} else if ($sc['service_type'] === 4) {
$domains_count = $sc['amount'];
} else if ($sc['service_type'] === 5) {
$other_count = $sc['amount'];
} else if ($sc['service_type'] === 6) {
$seedbox_count = $sc['amount'];
return Cache::remember('services_count_all', now()->addWeek(1), function () use ($services_count) {
$servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
foreach ($services_count as $sc) {
$total_services += $sc['amount'];
if ($sc['service_type'] === 1) {
$servers_count = $sc['amount'];
} else if ($sc['service_type'] === 2) {
$shared_count = $sc['amount'];
} else if ($sc['service_type'] === 3) {
$reseller_count = $sc['amount'];
} else if ($sc['service_type'] === 4) {
$domains_count = $sc['amount'];
} else if ($sc['service_type'] === 5) {
$other_count = $sc['amount'];
} else if ($sc['service_type'] === 6) {
$seedbox_count = $sc['amount'];
}
}
}
return array(
'servers' => $servers_count,
'shared' => $shared_count,
'reseller' => $reseller_count,
'domains' => $domains_count,
'other' => $other_count,
'seedbox' => $seedbox_count,
'total' => $total_services
);
return array(
'servers' => $servers_count,
'shared' => $shared_count,
'reseller' => $reseller_count,
'domains' => $domains_count,
'other' => $other_count,
'seedbox' => $seedbox_count,
'total' => $total_services
);
});
}

View File

@ -14,6 +14,27 @@ class Pricing extends Model
protected $fillable = ['service_id', 'service_type', 'currency', 'price', 'term', 'as_usd', 'usd_per_month', 'next_due_date'];
public static function convertFromUSD(string $amount, string $convert_to): float
{//Code rates update from an API??
if ($convert_to === 'AUD') {
return (1.39 * $amount);
} elseif ($convert_to === "USD") {
return $amount;
} elseif ($convert_to === "GBP") {
return (0.79 * $amount);
} elseif ($convert_to === "EUR") {
return (0.93 * $amount);
} elseif ($convert_to === "NZD") {
return (1.53 * $amount);
} elseif ($convert_to === "JPY") {
return (127.12 * $amount);
} elseif ($convert_to === "CAD") {
return (1.27 * $amount);
} else {
return $amount;
}
}
public function convertToUSD(string $amount, string $convert_from): float
{
if ($convert_from === 'AUD') {

View File

@ -164,6 +164,8 @@ class Server extends Model
Cache::forget('servers_summary');//servers summary cache
Cache::forget('public_server_data');//public servers
Cache::forget('all_pricing');//All pricing
Cache::forget('services_count_all');
Cache::forget('pricing_breakdown');
}
public static function serverSpecificCacheForget(string $server_id): void

View File

@ -18,7 +18,7 @@ class Settings extends Model
public static function getSettings()
{
return Cache::remember('settings', now()->addMinute(1), function () {
return Cache::remember('settings', now()->addWeek(1), function () {
return DB::table('settings')
->where('id', '=', 1)
->get();
@ -40,6 +40,7 @@ class Settings extends Model
Session::put('default_server_os', $settings[0]->default_server_os ?? 1);
Session::put('due_soon_amount', $settings[0]->due_soon_amount ?? 6);
Session::put('recently_added_amount', $settings[0]->recently_added_amount ?? 6);
Session::put('dashboard_currency', $settings[0]->dashboard_currency ?? 'USD');
Session::save();
}

View File

@ -171,6 +171,8 @@ class Process
{
$file_name = 'tempYabs.txt';
$allowed_versions = ['v2021-12-28', 'v2022-02-18', 'v2022-04-30', 'v2022-05-06', 'v2022-06-11'];
Storage::disk('local')->put($file_name, $data_from_form);
$file = Storage::disk('local')->get($file_name);
@ -192,8 +194,8 @@ class Process
}
$version_array = explode(' ', preg_replace('!\s+!', ' ', $this->trimRemoveR($array[2])));
if ($version_array[1] === 'v2021-12-28' || $version_array[1] === 'v2022-02-18' || $version_array[1] === 'v2022-04-30' || $version_array[1] === 'v2022-05-06') {//YABs version
if ($version_array[1] === 'v2022-05-06') {
if (in_array($version_array[1], $allowed_versions, true)) {//YABs version is allowed
if ($version_array[1] === 'v2022-05-06' || $version_array[1] === 'v2022-06-11') {//These versions added in more responses
$cpu = $this->trimRemoveR(str_replace(':', '', strstr($array[11], ': ')));
$cpu_spec = explode(' ', strstr($array[12], ': '));//: 2 @ 3792.872 MHz
$ram_line = $this->trimRemoveR(str_replace(':', '', strstr($array[15], ': ')));
@ -250,7 +252,7 @@ class Process
);
if (isset($array[40])) {
if ($version_array[1] === 'v2022-05-06') {
if ($version_array[1] === 'v2022-05-06' || $version_array[1] === 'v2022-06-11') {
if ($array[43] === "Geekbench 5 Benchmark Test:\r") {
//No ipv6
//Has short ipv4 network speed testing (-r)

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDashCurrencySetting extends Migration
{
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->char('dashboard_currency', 3)->default('USD');
});
}
public function down()
{
}
}

View File

@ -71,7 +71,7 @@
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['total_cost_weekly']}} <small class="text-muted">USD</small></h4>
<h4>{{$information['total_cost_weekly']}} <small class="text-muted">{{$information['currency']}}</small></h4>
<p>Weekly cost</p>
</div>
</div>
@ -81,7 +81,7 @@
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['total_cost_monthly']}} <small class="text-muted">USD</small>
<h4>{{$information['total_cost_monthly']}} <small class="text-muted">{{$information['currency']}}</small>
</h4>
<p>Monthly cost</p>
</div>
@ -92,7 +92,7 @@
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['total_cost_yearly']}} <small class="text-muted">USD</small></h4>
<h4>{{$information['total_cost_yearly']}} <small class="text-muted">{{$information['currency']}}</small></h4>
<p>Yearly cost</p>
</div>
</div>
@ -102,7 +102,7 @@
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['total_cost_2_yearly']}} <small class="text-muted">USD</small>
<h4>{{$information['total_cost_2_yearly']}} <small class="text-muted">{{$information['currency']}}</small>
</h4>
<p>2 yearly cost</p>
</div>

View File

@ -18,7 +18,7 @@
@csrf
@method('PUT')
<div class="row mt-2">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Use dark mode</span></div>
@ -32,9 +32,7 @@
</select>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show versions footer</span></div>
@ -50,7 +48,45 @@
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<x-os-select>
<x-slot name="title">Default server OS</x-slot>
<x-slot name="name">default_server_os</x-slot>
<x-slot name="current">{{$setting[0]->default_server_os}}</x-slot>
</x-os-select>
</div>
<div class="col-12 col-md-6 mb-3">
<x-currency-select>
<x-slot name="title">Default currency</x-slot>
<x-slot name="name">default_currency</x-slot>
<x-slot name="current">{{$setting[0]->default_currency}}</x-slot>
</x-currency-select>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-6 mb-3">
<x-number-input>
<x-slot name="title">Due soon amount to show</x-slot>
<x-slot name="name">due_soon_amount</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="min">0</x-slot>
<x-slot name="max">12</x-slot>
<x-slot name="value">{{$setting[0]->due_soon_amount}}</x-slot>
</x-number-input>
</div>
<div class="col-12 col-md-6 mb-3">
<x-number-input>
<x-slot name="title">Recently added amount to show</x-slot>
<x-slot name="name">recently_added_amount</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="min">0</x-slot>
<x-slot name="max">12</x-slot>
<x-slot name="value">{{$setting[0]->recently_added_amount}}</x-slot>
</x-number-input>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers to public</span></div>
@ -64,10 +100,16 @@
</select>
</div>
</div>
<div class="col-12 col-md-6 mb-3">
<x-currency-select>
<x-slot name="title">Home page currency</x-slot>
<x-slot name="current">{{$setting[0]->dashboard_currency}}</x-slot>
</x-currency-select>
</div>
</div>
<p>Only if <i>show_servers_public</i> is <b>YES</b> do these apply:</p>
<p>Only if <i>Show servers to public</i> is <b>YES</b> do these apply:</p>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers IP's</span></div>
@ -81,9 +123,7 @@
</select>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers hostname</span></div>
@ -101,7 +141,7 @@
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers provider</span></div>
@ -117,9 +157,7 @@
</select>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers location</span></div>
@ -137,7 +175,7 @@
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers price</span></div>
@ -153,9 +191,7 @@
</select>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<div class="col-12 col-md-6 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span
class="input-group-text">Show servers YABs</span></div>
@ -172,48 +208,6 @@
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<x-os-select>
<x-slot name="title">Default server OS</x-slot>
<x-slot name="name">default_server_os</x-slot>
<x-slot name="current">{{$setting[0]->default_server_os}}</x-slot>
</x-os-select>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<x-currency-select>
<x-slot name="title">Default currency</x-slot>
<x-slot name="name">default_currency</x-slot>
<x-slot name="current">{{$setting[0]->default_currency}}</x-slot>
</x-currency-select>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<x-number-input>
<x-slot name="title">Due soon amount to show</x-slot>
<x-slot name="name">due_soon_amount</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="min">0</x-slot>
<x-slot name="max">12</x-slot>
<x-slot name="value">{{$setting[0]->due_soon_amount}}</x-slot>
</x-number-input>
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-md-4 mb-3">
<x-number-input>
<x-slot name="title">Recently added amount to show</x-slot>
<x-slot name="name">recently_added_amount</x-slot>
<x-slot name="step">1</x-slot>
<x-slot name="min">0</x-slot>
<x-slot name="max">12</x-slot>
<x-slot name="value">{{$setting[0]->recently_added_amount}}</x-slot>
</x-number-input>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-4">
<x-submit-button>Update settings</x-submit-button>

View File

@ -28,6 +28,10 @@ Route::middleware('auth:api')->get('domains/{id}', 'App\Http\Controllers\ApiCont
Route::middleware('auth:api')->get('servers', 'App\Http\Controllers\ApiController@getAllServers');
Route::middleware('auth:api')->get('servers/{id}', 'App\Http\Controllers\ApiController@getServer');
Route::middleware('auth:api')->post('servers', 'App\Http\Controllers\ApiController@storeServer');
Route::middleware('auth:api')->put('servers/{id}', 'App\Http\Controllers\ApiController@updateServer');
Route::middleware('auth:api')->delete('servers/{id}', 'App\Http\Controllers\ApiController@destroyServer');
Route::middleware('auth:api')->get('IPs/', 'App\Http\Controllers\ApiController@getAllIPs');
Route::middleware('auth:api')->get('IPs/{id}', 'App\Http\Controllers\ApiController@getIP');
@ -48,6 +52,7 @@ Route::middleware('auth:api')->get('os/{id}', 'App\Http\Controllers\ApiControlle
Route::middleware('auth:api')->get('pricing/', 'App\Http\Controllers\ApiController@getAllPricing');
Route::middleware('auth:api')->get('pricing/{id}', 'App\Http\Controllers\ApiController@getPricing');
Route::middleware('auth:api')->put('pricing/{id}', 'App\Http\Controllers\ApiController@updatePricing');
Route::middleware('auth:api')->get('providers/', 'App\Http\Controllers\ApiController@getAllProviders');
Route::middleware('auth:api')->get('providers/{id}', 'App\Http\Controllers\ApiController@getProvider');