fix: 🐛 Merge issues
This commit is contained in:
parent
fda40fe8bc
commit
255671e20d
|
@ -252,10 +252,6 @@ class ServerController extends Controller
|
||||||
public function cancel(Server $server)
|
public function cancel(Server $server)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
error_log($server->update([
|
|
||||||
'cancelled' => now(),
|
|
||||||
]));
|
|
||||||
|
|
||||||
return redirect()->route('servers.index')->with('success', __('Server cancelled'));
|
return redirect()->route('servers.index')->with('success', __('Server cancelled'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"');
|
return redirect()->route('servers.index')->with('error', __('An exception has occurred while trying to cancel the server"') . $e->getMessage() . '"');
|
||||||
|
@ -267,7 +263,9 @@ class ServerController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if($server->user_id != Auth::user()->id){ return back()->with('error', __('This is not your Server!'));}
|
if ($server->user_id != Auth::user()->id) {
|
||||||
|
return back()->with('error', __('This is not your Server!'));
|
||||||
|
}
|
||||||
$serverAttributes = Pterodactyl::getServerAttributes($server->pterodactyl_id);
|
$serverAttributes = Pterodactyl::getServerAttributes($server->pterodactyl_id);
|
||||||
$serverRelationships = $serverAttributes['relationships'];
|
$serverRelationships = $serverAttributes['relationships'];
|
||||||
$serverLocationAttributes = $serverRelationships['location']['attributes'];
|
$serverLocationAttributes = $serverRelationships['location']['attributes'];
|
||||||
|
@ -309,8 +307,7 @@ class ServerController extends Controller
|
||||||
public function upgrade(Server $server, Request $request)
|
public function upgrade(Server $server, Request $request)
|
||||||
{
|
{
|
||||||
if ($server->user_id != Auth::user()->id || $server->suspended) return redirect()->route('servers.index');
|
if ($server->user_id != Auth::user()->id || $server->suspended) return redirect()->route('servers.index');
|
||||||
if(!isset($request->product_upgrade))
|
if (!isset($request->product_upgrade)) {
|
||||||
{
|
|
||||||
return redirect()->route('servers.show', ['server' => $server->id])->with('error', __('this product is the only one'));
|
return redirect()->route('servers.show', ['server' => $server->id])->with('error', __('this product is the only one'));
|
||||||
}
|
}
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
@ -353,8 +350,7 @@ class ServerController extends Controller
|
||||||
$overpayedCredits = $oldProduct->price - $oldProduct->price * ($timeDifference / $billingPeriodMultiplier);
|
$overpayedCredits = $oldProduct->price - $oldProduct->price * ($timeDifference / $billingPeriodMultiplier);
|
||||||
|
|
||||||
|
|
||||||
if ($user->credits >= $newProduct->price && $user->credits >= $newProduct->minimum_credits)
|
if ($user->credits >= $newProduct->price && $user->credits >= $newProduct->minimum_credits) {
|
||||||
{
|
|
||||||
$server->allocation = $serverAttributes['allocation'];
|
$server->allocation = $serverAttributes['allocation'];
|
||||||
// Update the server on the panel
|
// Update the server on the panel
|
||||||
$response = Pterodactyl::updateServer($server, $newProduct);
|
$response = Pterodactyl::updateServer($server, $newProduct);
|
||||||
|
|
|
@ -185,7 +185,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function suspend()
|
public function suspend()
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function unSuspend()
|
public function unSuspend()
|
||||||
{
|
{
|
||||||
|
@ -218,12 +218,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getServersWithProduct()
|
|
||||||
{
|
|
||||||
return $this->servers()
|
|
||||||
->with('product')
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -257,7 +251,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
return number_format($usage, 2, '.', '');
|
return number_format($usage, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getServersWithProduct() {
|
private function getServersWithProduct()
|
||||||
|
{
|
||||||
return $this->servers()
|
return $this->servers()
|
||||||
->whereNull('suspended')
|
->whereNull('suspended')
|
||||||
->whereNull('cancelled')
|
->whereNull('cancelled')
|
||||||
|
|
|
@ -1,295 +0,0 @@
|
||||||
@extends('layouts.main')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<!-- CONTENT HEADER -->
|
|
||||||
<section class="content-header">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<h1>{{ __('Servers') }}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<ol class="breadcrumb float-sm-right">
|
|
||||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
|
|
||||||
<li class="breadcrumb-item"><a class="text-muted"
|
|
||||||
href="{{ route('servers.index') }}">{{ __('Servers') }}</a>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- END CONTENT HEADER -->
|
|
||||||
|
|
||||||
<!-- MAIN CONTENT -->
|
|
||||||
<section class="content">
|
|
||||||
<div class="container-fluid">
|
|
||||||
|
|
||||||
<!-- CUSTOM CONTENT -->
|
|
||||||
<div class="d-flex justify-content-md-start justify-content-center mb-3 ">
|
|
||||||
<a @if (Auth::user()->Servers->count() >= Auth::user()->server_limit)
|
|
||||||
disabled="disabled" title="Server limit reached!"
|
|
||||||
@endif href="{{ route('servers.create') }}"
|
|
||||||
class="btn
|
|
||||||
@if (Auth::user()->Servers->count() >= Auth::user()->server_limit) disabled
|
|
||||||
@endif btn-primary"><i
|
|
||||||
class="fa fa-plus mr-2"></i>
|
|
||||||
{{ __('Create Server') }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row d-flex flex-row justify-content-center justify-content-md-start">
|
|
||||||
@foreach ($servers as $server)
|
|
||||||
<div class="col-xl-3 col-lg-5 col-md-6 col-sm-6 col-xs-12 card pr-0 pl-0 ml-sm-2 mr-sm-3"
|
|
||||||
style="max-width: 350px">
|
|
||||||
<div class="card-header">
|
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
|
||||||
<h5 class="card-title mt-1">{{ $server->name }}
|
|
||||||
</h5>
|
|
||||||
<div class="card-tools mt-1">
|
|
||||||
<div class="dropdown no-arrow">
|
|
||||||
<a href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
|
|
||||||
aria-haspopup="true" aria-expanded="false">
|
|
||||||
<i class="fas fa-ellipsis-v fa-sm fa-fw text-white-50"></i>
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
|
|
||||||
aria-labelledby="dropdownMenuLink">
|
|
||||||
@if (!empty(config('SETTINGS::MISC:PHPMYADMIN:URL')))
|
|
||||||
<a href="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}"
|
|
||||||
class="dropdown-item text-info" target="__blank"><i title="manage"
|
|
||||||
class="fas fa-database mr-2"></i><span>{{ __('Database') }}</span></a>
|
|
||||||
@endif
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<span class="dropdown-item"><i title="Created at"
|
|
||||||
class="fas fa-sync-alt mr-2"></i><span>{{ $server->created_at->isoFormat('LL') }}</span></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="container mt-1">
|
|
||||||
<div class="row mb-3">
|
|
||||||
<div class="col my-auto">{{ __('Status') }}:</div>
|
|
||||||
<div class="col-7 my-auto">
|
|
||||||
@if($server->suspended)
|
|
||||||
<span class="badge badge-danger">{{ __('Suspended') }}</span>
|
|
||||||
@elseif($server->cancelled)
|
|
||||||
<span class="badge badge-warning">{{ __('Cancelled') }}</span>
|
|
||||||
@else
|
|
||||||
<span class="badge badge-success">{{ __('Active') }}</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-5">
|
|
||||||
{{ __('Location') }}:
|
|
||||||
</div>
|
|
||||||
<div class="col-7 d-flex justify-content-between align-items-center">
|
|
||||||
<span class="">{{ $server->location }}</span>
|
|
||||||
<i data-toggle="popover" data-trigger="hover"
|
|
||||||
data-content="{{ __('Node') }}: {{ $server->node }}"
|
|
||||||
class="fas fa-info-circle"></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-5 ">
|
|
||||||
{{ __('Software') }}:
|
|
||||||
</div>
|
|
||||||
<div class="col-7 text-wrap">
|
|
||||||
<span>{{ $server->nest }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-5 ">
|
|
||||||
{{ __('Specification') }}:
|
|
||||||
</div>
|
|
||||||
<div class="col-7 text-wrap">
|
|
||||||
<span>{{ $server->egg }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-5 ">
|
|
||||||
{{ __('Resource plan') }}:
|
|
||||||
</div>
|
|
||||||
<div class="col-7 text-wrap d-flex justify-content-between align-items-center">
|
|
||||||
<span>{{ $server->product->name }}
|
|
||||||
</span>
|
|
||||||
<i data-toggle="popover" data-trigger="hover" data-html="true"
|
|
||||||
data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/> {{ __('Billing Period') }}: {{$server->product->billing_period}}"
|
|
||||||
class="fas fa-info-circle"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-4 ">
|
|
||||||
<div class="col-5 word-break" style="hyphens: auto">
|
|
||||||
{{ __('Next Billing Cycle') }}:
|
|
||||||
</div>
|
|
||||||
<div class="col-7 d-flex text-wrap align-items-center">
|
|
||||||
<span>
|
|
||||||
@if ($server->suspended)
|
|
||||||
-
|
|
||||||
@else
|
|
||||||
@switch($server->product->billing_period)
|
|
||||||
@case('monthly')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addMonth()->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('weekly')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addWeek()->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('daily')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addDay()->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('hourly')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('quarterly')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(3)->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('half-annually')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@case('annually')
|
|
||||||
{{ \Carbon\Carbon::parse($server->last_billed)->addYear()->toDayDateTimeString(); }}
|
|
||||||
@break
|
|
||||||
@default
|
|
||||||
{{ __('Unknown') }}
|
|
||||||
@endswitch
|
|
||||||
@endif
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-4">
|
|
||||||
{{ __('Price') }}:
|
|
||||||
<span class="text-muted">
|
|
||||||
({{ CREDITS_DISPLAY_NAME }})
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col-8 text-center">
|
|
||||||
<div class="text-muted">
|
|
||||||
@if($server->product->billing_period == 'monthly')
|
|
||||||
{{ __('per Month') }}
|
|
||||||
@elseif($server->product->billing_period == 'half-annually')
|
|
||||||
{{ __('per 6 Months') }}
|
|
||||||
@elseif($server->product->billing_period == 'quarterly')
|
|
||||||
{{ __('per 3 Months') }}
|
|
||||||
@elseif($server->product->billing_period == 'annually')
|
|
||||||
{{ __('per Year') }}
|
|
||||||
@elseif($server->product->billing_period == 'weekly')
|
|
||||||
{{ __('per Week') }}
|
|
||||||
@elseif($server->product->billing_period == 'daily')
|
|
||||||
{{ __('per Day') }}
|
|
||||||
@elseif($server->product->billing_period == 'hourly')
|
|
||||||
{{ __('per Hour') }}
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<span>
|
|
||||||
{{ $server->product->price == round($server->product->price) ? round($server->product->price) : $server->product->price }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer text-center">
|
|
||||||
<a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
|
|
||||||
target="__blank"
|
|
||||||
class="btn btn-info text-center float-left ml-2"
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ __('Manage Server') }}">
|
|
||||||
<i class="fas fa-tools mx-2"></i>
|
|
||||||
</a>
|
|
||||||
@if(config("SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN"))
|
|
||||||
<a href="{{ route('servers.show', ['server' => $server->id])}}"
|
|
||||||
class="btn btn-info text-center mr-3"
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ __('Server Settings') }}">
|
|
||||||
<i class="fas fa-cog mx-2"></i>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
<button onclick="handleServerCancel('{{ $server->id }}');" target="__blank"
|
|
||||||
class="btn btn-warning text-center"
|
|
||||||
{{ $server->suspended || $server->cancelled ? "disabled" : "" }}
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ __('Cancel Server') }}">
|
|
||||||
<i class="fas fa-ban mx-2"></i>
|
|
||||||
</button>
|
|
||||||
<button onclick="handleServerDelete('{{ $server->id }}');" target="__blank"
|
|
||||||
class="btn btn-danger text-center float-right mr-2"
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ __('Delete Server') }}">
|
|
||||||
<i class="fas fa-trash mx-2"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
<!-- END CUSTOM CONTENT -->
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- END CONTENT -->
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const handleServerCancel = (serverId) => {
|
|
||||||
// Handle server cancel with sweetalert
|
|
||||||
Swal.fire({
|
|
||||||
title: "{{ __('Cancel Server?') }}",
|
|
||||||
text: "{{ __('This will cancel your current server to the next billing period. It will get suspended when the current period runs out.') }}",
|
|
||||||
icon: 'warning',
|
|
||||||
confirmButtonColor: '#d9534f',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: "{{ __('Yes, cancel it!') }}",
|
|
||||||
cancelButtonText: "{{ __('No, abort!') }}",
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.value) {
|
|
||||||
// Delete server
|
|
||||||
fetch("{{ route('servers.cancel', '') }}" + '/' + serverId, {
|
|
||||||
method: 'PATCH',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
||||||
}
|
|
||||||
}).then(() => {
|
|
||||||
window.location.reload();
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleServerDelete = (serverId) => {
|
|
||||||
Swal.fire({
|
|
||||||
title: "{{ __('Delete Server?') }}",
|
|
||||||
html: "{{!! __('This is an irreversible action, all files of this server will be removed. <strong>No funds will get refunded</strong>. We recommend deleting the server when server is suspended.') !!}}",
|
|
||||||
icon: 'warning',
|
|
||||||
confirmButtonColor: '#d9534f',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: "{{ __('Yes, delete it!') }}",
|
|
||||||
cancelButtonText: "{{ __('No, abort!') }}",
|
|
||||||
reverseButtons: true
|
|
||||||
}).then((result) => {
|
|
||||||
if (result.value) {
|
|
||||||
// Delete server
|
|
||||||
fetch("{{ route('servers.destroy', '') }}" + '/' + serverId, {
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
||||||
}
|
|
||||||
}).then(() => {
|
|
||||||
window.location.reload();
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
$('[data-toggle="popover"]').popover();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@endsection
|
|
|
@ -213,11 +213,11 @@
|
||||||
|
|
||||||
<span class="d-inline-block" x-text="product.billing_period"></span>
|
<span class="d-inline-block" x-text="product.billing_period"></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li class="d-flex justify-content-between">
|
||||||
<span class="d-inline-block"><i class="fa fa-coins"></i>
|
<span class="d-inline-block"><i class="fa fa-coins"></i>
|
||||||
{{ __('Minimum') }} {{ CREDITS_DISPLAY_NAME }}</span>
|
{{ __('Minimum') }} {{ CREDITS_DISPLAY_NAME }}</span>
|
||||||
<span class="d-inline-block"
|
<span class="d-inline-block"
|
||||||
x-text="product.minimum_credits == -1 ? {{ config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER') }} : product.minimum_credits"></span>
|
x-text="product.minimum_credits == -1 ? {{ config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER') }} : Math.round(product.minimum_credits)"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -241,9 +241,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" x-model="selectedProduct" name="product"
|
<button type="submit" x-model="selectedProduct" name="product"
|
||||||
:disabled="product.minimum_credits > user.credits || product.price > user.credits || product.doesNotFit == true ||
|
:disabled="product.minimum_credits > user.credits || product.price > user.credits ||
|
||||||
|
product.doesNotFit == true ||
|
||||||
submitClicked"
|
submitClicked"
|
||||||
:class="product.minimum_credits > user.credits || product.price > user.credits || product.doesNotFit == true ||
|
:class="product.minimum_credits > user.credits || product.price > user.credits ||
|
||||||
|
product.doesNotFit == true ||
|
||||||
submitClicked ? 'disabled' : ''"
|
submitClicked ? 'disabled' : ''"
|
||||||
class="btn btn-primary btn-block mt-2" @click="setProduct(product.id);"
|
class="btn btn-primary btn-block mt-2" @click="setProduct(product.id);"
|
||||||
x-text="product.doesNotFit == true ? '{{ __('Server cant fit on this Node') }}' : (product.minimum_credits > user.credits || product.price > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
|
x-text="product.doesNotFit == true ? '{{ __('Server cant fit on this Node') }}' : (product.minimum_credits > user.credits || product.price > user.credits ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
|
||||||
|
|
|
@ -36,24 +36,35 @@
|
||||||
class="fa fa-plus mr-2"></i>
|
class="fa fa-plus mr-2"></i>
|
||||||
{{ __('Create Server') }}
|
{{ __('Create Server') }}
|
||||||
</a>
|
</a>
|
||||||
@if (Auth::user()->Servers->count() > 0&&!empty(config('SETTINGS::MISC:PHPMYADMIN:URL')))
|
|
||||||
<a
|
|
||||||
href="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}" target="_blank"
|
|
||||||
class="btn btn-secondary ml-2"><i title="manage"
|
|
||||||
class="fas fa-database mr-2"></i><span>{{ __('Database') }}</span>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-flex flex-row justify-content-center justify-content-md-start">
|
<div class="row d-flex flex-row justify-content-center justify-content-md-start">
|
||||||
@foreach ($servers as $server)
|
@foreach ($servers as $server)
|
||||||
@if($server->location&&$server->node&&$server->nest&&$server->egg)
|
|
||||||
<div class="col-xl-3 col-lg-5 col-md-6 col-sm-6 col-xs-12 card pr-0 pl-0 ml-sm-2 mr-sm-3"
|
<div class="col-xl-3 col-lg-5 col-md-6 col-sm-6 col-xs-12 card pr-0 pl-0 ml-sm-2 mr-sm-3"
|
||||||
style="max-width: 350px">
|
style="max-width: 350px">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<h5 class="card-title mt-1">{{ $server->name }}
|
<h5 class="card-title mt-1">{{ $server->name }}
|
||||||
</h5>
|
</h5>
|
||||||
|
<div class="card-tools mt-1">
|
||||||
|
<div class="dropdown no-arrow">
|
||||||
|
<a href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
|
||||||
|
aria-haspopup="true" aria-expanded="false">
|
||||||
|
<i class="fas fa-ellipsis-v fa-sm fa-fw text-white-50"></i>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
|
||||||
|
aria-labelledby="dropdownMenuLink">
|
||||||
|
@if (!empty(config('SETTINGS::MISC:PHPMYADMIN:URL')))
|
||||||
|
<a href="{{ config('SETTINGS::MISC:PHPMYADMIN:URL') }}"
|
||||||
|
class="dropdown-item text-info" target="__blank"><i title="manage"
|
||||||
|
class="fas fa-database mr-2"></i><span>{{ __('Database') }}</span></a>
|
||||||
|
@endif
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<span class="dropdown-item"><i title="Created at"
|
||||||
|
class="fas fa-sync-alt mr-2"></i><span>{{ $server->created_at->isoFormat('LL') }}</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
@ -61,9 +72,13 @@
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col my-auto">{{ __('Status') }}:</div>
|
<div class="col my-auto">{{ __('Status') }}:</div>
|
||||||
<div class="col-7 my-auto">
|
<div class="col-7 my-auto">
|
||||||
<i
|
@if($server->suspended)
|
||||||
class="fas {{ $server->isSuspended() ? 'text-danger' : 'text-success' }} fa-circle mr-2"></i>
|
<span class="badge badge-danger">{{ __('Suspended') }}</span>
|
||||||
{{ $server->isSuspended() ? 'Suspended' : 'Active' }}
|
@elseif($server->cancelled)
|
||||||
|
<span class="badge badge-warning">{{ __('Cancelled') }}</span>
|
||||||
|
@else
|
||||||
|
<span class="badge badge-success">{{ __('Active') }}</span>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
|
@ -95,7 +110,7 @@
|
||||||
<span>{{ $server->egg }}</span>
|
<span>{{ $server->egg }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-4">
|
<div class="row mb-2">
|
||||||
<div class="col-5 ">
|
<div class="col-5 ">
|
||||||
{{ __('Resource plan') }}:
|
{{ __('Resource plan') }}:
|
||||||
</div>
|
</div>
|
||||||
|
@ -103,11 +118,50 @@
|
||||||
<span>{{ $server->product->name }}
|
<span>{{ $server->product->name }}
|
||||||
</span>
|
</span>
|
||||||
<i data-toggle="popover" data-trigger="hover" data-html="true"
|
<i data-toggle="popover" data-trigger="hover" data-html="true"
|
||||||
data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/>"
|
data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/> {{ __('Billing Period') }}: {{$server->product->billing_period}}"
|
||||||
class="fas fa-info-circle"></i>
|
class="fas fa-info-circle"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-4 ">
|
||||||
|
<div class="col-5 word-break" style="hyphens: auto">
|
||||||
|
{{ __('Next Billing Cycle') }}:
|
||||||
|
</div>
|
||||||
|
<div class="col-7 d-flex text-wrap align-items-center">
|
||||||
|
<span>
|
||||||
|
@if ($server->suspended)
|
||||||
|
-
|
||||||
|
@else
|
||||||
|
@switch($server->product->billing_period)
|
||||||
|
@case('monthly')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addMonth()->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('weekly')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addWeek()->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('daily')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addDay()->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('hourly')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addHour()->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('quarterly')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(3)->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('half-annually')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addMonths(6)->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@case('annually')
|
||||||
|
{{ \Carbon\Carbon::parse($server->last_billed)->addYear()->toDayDateTimeString(); }}
|
||||||
|
@break
|
||||||
|
@default
|
||||||
|
{{ __('Unknown') }}
|
||||||
|
@endswitch
|
||||||
|
@endif
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ __('Price') }}:
|
{{ __('Price') }}:
|
||||||
|
@ -115,45 +169,127 @@
|
||||||
({{ CREDITS_DISPLAY_NAME }})
|
({{ CREDITS_DISPLAY_NAME }})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8 text-center">
|
||||||
<div class="row">
|
<div class="text-muted">
|
||||||
<div class="col-6 text-center">
|
@if($server->product->billing_period == 'monthly')
|
||||||
<div class="text-muted">{{ __('per Hour') }}</div>
|
{{ __('per Month') }}
|
||||||
<span>
|
@elseif($server->product->billing_period == 'half-annually')
|
||||||
{{ number_format($server->product->getHourlyPrice(), 2, '.', '') }}
|
{{ __('per 6 Months') }}
|
||||||
</span>
|
@elseif($server->product->billing_period == 'quarterly')
|
||||||
</div>
|
{{ __('per 3 Months') }}
|
||||||
<div class="col-6 text-center">
|
@elseif($server->product->billing_period == 'annually')
|
||||||
<div class="text-muted">{{ __('per Month') }}
|
{{ __('per Year') }}
|
||||||
|
@elseif($server->product->billing_period == 'weekly')
|
||||||
|
{{ __('per Week') }}
|
||||||
|
@elseif($server->product->billing_period == 'daily')
|
||||||
|
{{ __('per Day') }}
|
||||||
|
@elseif($server->product->billing_period == 'hourly')
|
||||||
|
{{ __('per Hour') }}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<span>
|
<span>
|
||||||
{{ $server->product->getHourlyPrice() * 24 * 30 }}
|
{{ $server->product->price == round($server->product->price) ? round($server->product->price) : $server->product->price }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer d-flex align-items-center justify-content-between">
|
<div class="card-footer text-center">
|
||||||
<a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
|
<a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
|
||||||
target="__blank"
|
target="__blank"
|
||||||
class="btn btn-info mx-3 w-100 align-items-center justify-content-center d-flex">
|
class="btn btn-info text-center float-left ml-2"
|
||||||
<i class="fas fa-tools mr-2"></i>
|
data-toggle="tooltip" data-placement="bottom" title="{{ __('Manage Server') }}">
|
||||||
<span>{{ __('Manage') }}</span>
|
<i class="fas fa-tools mx-2"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('servers.show', ['server' => $server->id])}}" class="btn btn-warning mx-3 w-100 align-items-center justify-content-center d-flex">
|
@if(config("SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN"))
|
||||||
<i class="fas fa-cog mr-2"></i>
|
<a href="{{ route('servers.show', ['server' => $server->id])}}"
|
||||||
<span>{{ __('Settings') }}</span>
|
class="btn btn-info text-center mr-3"
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ __('Server Settings') }}">
|
||||||
|
<i class="fas fa-cog mx-2"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
@endif
|
||||||
|
<button onclick="handleServerCancel('{{ $server->id }}');" target="__blank"
|
||||||
|
class="btn btn-warning text-center"
|
||||||
|
{{ $server->suspended || $server->cancelled ? "disabled" : "" }}
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ __('Cancel Server') }}">
|
||||||
|
<i class="fas fa-ban mx-2"></i>
|
||||||
|
</button>
|
||||||
|
<button onclick="handleServerDelete('{{ $server->id }}');" target="__blank"
|
||||||
|
class="btn btn-danger text-center float-right mr-2"
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ __('Delete Server') }}">
|
||||||
|
<i class="fas fa-trash mx-2"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
<!-- END CUSTOM CONTENT -->
|
<!-- END CUSTOM CONTENT -->
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const handleServerCancel = (serverId) => {
|
||||||
|
// Handle server cancel with sweetalert
|
||||||
|
Swal.fire({
|
||||||
|
title: "{{ __('Cancel Server?') }}",
|
||||||
|
text: "{{ __('This will cancel your current server to the next billing period. It will get suspended when the current period runs out.') }}",
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonColor: '#d9534f',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: "{{ __('Yes, cancel it!') }}",
|
||||||
|
cancelButtonText: "{{ __('No, abort!') }}",
|
||||||
|
reverseButtons: true
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
// Delete server
|
||||||
|
fetch("{{ route('servers.cancel', '') }}" + '/' + serverId, {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleServerDelete = (serverId) => {
|
||||||
|
Swal.fire({
|
||||||
|
title: "{{ __('Delete Server?') }}",
|
||||||
|
html: "{{!! __('This is an irreversible action, all files of this server will be removed. <strong>No funds will get refunded</strong>. We recommend deleting the server when server is suspended.') !!}}",
|
||||||
|
icon: 'warning',
|
||||||
|
confirmButtonColor: '#d9534f',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: "{{ __('Yes, delete it!') }}",
|
||||||
|
cancelButtonText: "{{ __('No, abort!') }}",
|
||||||
|
reverseButtons: true
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.value) {
|
||||||
|
// Delete server
|
||||||
|
fetch("{{ route('servers.destroy', '') }}" + '/' + serverId, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
$('[data-toggle="popover"]').popover();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
Loading…
Reference in a new issue