Browse Source

Merge branch 'development' into feature/extendable_payment_gateways

IceToast 2 years ago
parent
commit
c468e53fad

+ 2 - 2
README.md

@@ -4,13 +4,13 @@
 -   Stripe Integration
 -   Referral System
 -   Ticket System
--   Upgrade/Downgrade Server Ressources
+-   Upgrade/Downgrade Server Resources
 -   Store (credit system with hourly billing and invoices)
 -   Email Verification
 -   Audit Log
 -   Admin Dashboard
 -   User/Server Management
--   Customizable server plans
+-   Customisable server plans
 -   Vouchers
 -   and so much more!
 

+ 0 - 1
app/Http/Controllers/Auth/LoginController.php

@@ -3,7 +3,6 @@
 namespace App\Http\Controllers\Auth;
 
 use App\Http\Controllers\Controller;
-use App\Models\User;
 use App\Providers\RouteServiceProvider;
 use Illuminate\Foundation\Auth\AuthenticatesUsers;
 use Illuminate\Http\Request;

+ 0 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -12,7 +12,6 @@ use Illuminate\Foundation\Auth\RegistersUsers;
 use Illuminate\Support\Facades\App;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Str;
 use Illuminate\Validation\ValidationException;

+ 0 - 1
app/Http/Controllers/ServerController.php

@@ -9,7 +9,6 @@ use App\Models\Nest;
 use App\Models\Node;
 use App\Models\Product;
 use App\Models\Server;
-use App\Models\Settings;
 use App\Notifications\ServerCreationError;
 use Exception;
 use Illuminate\Database\Eloquent\Builder;

+ 0 - 1
app/Providers/EventServiceProvider.php

@@ -11,7 +11,6 @@ use App\Listeners\Verified;
 use Illuminate\Auth\Events\Registered;
 use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
 use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
-use Illuminate\Support\Facades\Event;
 use SocialiteProviders\Manager\SocialiteWasCalled;
 
 class EventServiceProvider extends ServiceProvider

+ 0 - 1
database/factories/UserFactory.php

@@ -22,7 +22,6 @@ class UserFactory extends Factory
             'email_verified_at' => $this->faker->dateTimeBetween('-30 days', now()),
             'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
             'remember_token' => Str::random(10),
-            'email_verified' => true,
         ];
     }
 }

+ 2 - 1
lang/en.json

@@ -324,7 +324,7 @@
     "System": "System",
     "Show Terms of Service": "Show Terms of Service",
     "Show the TOS link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/tos-content.blade.php\"": "Show the TOS link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/tos-content.blade.php\"",
-    "Show imprint": "Show imprint",
+    "Show Imprint": "Show Imprint",
     "Show the imprint link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/imprint-content.blade.php\"": "Show the imprint link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/imprint-content.blade.php\"",
     "Show Privacy Policy": "Show Privacy Policy",
     "Show the privacy policy link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/privacy-content.blade.php\"": "Show the privacy policy link in the footer of every page. <br> Edit the content in \"resources\/views\/information\/privacy-content.blade.php\"",
@@ -535,6 +535,7 @@
     "MB": "MB",
     "MySQL": "MySQL",
     "ports": "ports",
+    "to create this server": "to create this server",
     "Server can´t fit on this node": "Server can´t fit on this node",
     "Not enough": "Not enough",
     "Create server": "Create server",

+ 1 - 1
public/install/functions.php

@@ -4,7 +4,7 @@ $required_extentions = ['openssl', 'gd', 'mysql', 'PDO', 'mbstring', 'tokenizer'
 
 $requirements = [
     'minPhp' => '8.1',
-    'maxPhp' => '8.1.9', // This version is not supported
+    'maxPhp' => '8.2', // This version is not supported
     'mysql' => '5.7.22',
 ];
 

+ 1 - 1
themes/default/views/admin/overview/index.blade.php

@@ -59,7 +59,7 @@
 
                         <div class="info-box-content">
                             <span class="info-box-text">{{__('Servers')}}</span>
-                            <span class="info-box-number">{{$counters['servers']->total}}</span>
+                            <span class="info-box-number">{{$counters['servers']->active}}/{{$counters['servers']->total}}</span>
                         </div>
                         <!-- /.info-box-content -->
                     </div>

+ 2 - 2
themes/default/views/admin/partners/create.blade.php

@@ -58,7 +58,7 @@
                                 <div class="form-group">
                                     <label for="partner_discount">{{__('Partner discount')}}
                                         <i data-toggle="popover" data-trigger="hover"
-                                        data-content="{{__('The discount in percent given to the partner at checkout.')}}"
+                                        data-content="{{__('The discount in percent given to the partner when purchasing credits.')}}"
                                         class="fas fa-info-circle"></i>
                                     </label>
                                     <input value="{{old('partner_discount')}}" placeholder="{{__('Discount in percent')}}" id="partner_discount" name="partner_discount"
@@ -75,7 +75,7 @@
                                 <div class="form-group">
                                     <label for="registered_user_discount">{{__('Registered user discount')}}
                                         <i data-toggle="popover" data-trigger="hover"
-                                        data-content="{{__('The discount in percent given to all users registered using the partners referral link.')}}"
+                                        data-content="{{__('The discount in percent given to all users registered using the partners referral link when purchasing credits.')}}"
                                         class="fas fa-info-circle"></i>
                                     </label>
                                     <div class="input-group">

+ 1 - 1
themes/default/views/admin/settings/tabs/system.blade.php

@@ -33,7 +33,7 @@
                                 <input value="true" id="show-imprint" name="show-imprint"
                                     {{ config('SETTINGS::SYSTEM:SHOW_IMPRINT') == 'true' ? 'checked' : '' }}
                                     type="checkbox">
-                                <label for="show-imprint">{{ __('Show imprint') }} </label>
+                                <label for="show-imprint">{{ __('Show Imprint') }} </label>
                             </div>
                             <i data-toggle="popover" data-trigger="hover" data-html="true"
                                 data-content="{{ __('Show the imprint link in the footer of every page. <br> Edit the content in <b>'.Qirolab\Theme\Theme::path($path = "views").'/resources/views/information/imprint-content.blade.php</b>') }}"

+ 1 - 1
themes/default/views/admin/users/index.blade.php

@@ -77,7 +77,7 @@
                     url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{config("SETTINGS::LOCALE:DATATABLES")}}.json'
                 },
                 processing: true,
-                serverSide: false, //increases loading times too much? change back to "true" if it does
+                serverSide: true, //why was this set to false before? increased loadingtimes by 10 seconds
                 stateSave: true,
                 ajax: "{{route('admin.users.datatable')}}",
                 order: [[ 11, "asc" ]],

+ 34 - 18
themes/default/views/servers/create.blade.php

@@ -26,7 +26,8 @@
     <section x-data="serverApp()" class="content">
         <div class="container-xxl">
             <!-- FORM -->
-            <form action="{{ route('servers.store') }}" method="post" class="row justify-content-center">
+            <form action="{{ route('servers.store') }}" x-on:submit="submitClicked = true" method="post"
+                class="row justify-content-center">
                 @csrf
                 <div class="col-xl-6 col-lg-8 col-md-8 col-sm-10">
                     <div class="card">
@@ -34,10 +35,10 @@
                             <div class="card-title"><i class="fas fa-cogs mr-2"></i>{{ __('Server configuration') }}
                             </div>
                         </div>
-                        @if (!config("SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS"))
+                        @if (!config('SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS'))
                             <div class="alert alert-warning p-2 m-2">
                                 The creation of new servers has been disabled for regular users, enable it again
-                                <a href="{{route('admin.settings.system')}}">{{ __('here') }}</a>.
+                                <a href="{{ route('admin.settings.system') }}">{{ __('here') }}</a>.
                             </div>
                         @endif
                         @if ($productCount === 0 || $nodeCount === 0 || count($nests) === 0 || count($eggs) === 0)
@@ -47,7 +48,7 @@
                                     @if (Auth::user()->role == 'admin')
                                         {{ __('Make sure to link your products to nodes and eggs.') }} <br>
                                         {{ __('There has to be at least 1 valid product for server creation') }}
-                                        <a href="{{route('admin.overview.sync')}}">{{ __('Sync now') }}</a>
+                                        <a href="{{ route('admin.overview.sync') }}">{{ __('Sync now') }}</a>
                                     @endif
 
                                 </p>
@@ -102,8 +103,8 @@
                                 <div class="col-md-6">
                                     <div class="form-group">
                                         <label for="nest">{{ __('Software / Games') }}</label>
-                                        <select class="custom-select" required name="nest" id="nest" x-model="selectedNest"
-                                            @change="setEggs();">
+                                        <select class="custom-select" required name="nest" id="nest"
+                                            x-model="selectedNest" @change="setEggs();">
                                             <option selected disabled hidden value="null">
                                                 {{ count($nests) > 0 ? __('Please select software ...') : __('---') }}
                                             </option>
@@ -134,8 +135,8 @@
 
                             <div class="form-group">
                                 <label for="node">{{ __('Node') }}</label>
-                                <select name="node" required id="node" x-model="selectedNode" :disabled="!fetchedLocations"
-                                    @change="fetchProducts();" class="custom-select">
+                                <select name="node" required id="node" x-model="selectedNode"
+                                    :disabled="!fetchedLocations" @change="fetchProducts();" class="custom-select">
                                     <option x-text="getNodeInputText()" disabled selected hidden value="null">
                                     </option>
 
@@ -206,11 +207,19 @@
                                                         ({{ __('ports') }})</span>
                                                     <span class="d-inline-block" x-text="product.allocations"></span>
                                                 </li>
+                                                <li class="d-flex justify-content-between">
+                                                    <span class="d-inline-block"><i class="fa fa-coins"></i>
+                                                        {{ __('Required') }} {{ CREDITS_DISPLAY_NAME }}
+                                                        {{ __('to create this server') }}</span>
+                                                    <span class="d-inline-block"
+                                                        x-text="product.minimum_credits === -1 ? {{ config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER') }} : product.minimum_credit"></span>
+                                                </li>
                                             </ul>
                                         </div>
                                         <div class="mt-2 mb-2">
                                             <span class="card-text text-muted">{{ __('Description') }}</span>
-                                            <p class="card-text" style="white-space:pre-wrap" x-text="product.description"></p>
+                                            <p class="card-text" style="white-space:pre-wrap"
+                                                x-text="product.description"></p>
                                         </div>
                                     </div>
                                     <div class="mt-auto border rounded border-secondary">
@@ -222,13 +231,18 @@
                                                 x-text="product.price + ' {{ CREDITS_DISPLAY_NAME }}'"></span>
                                         </div>
                                     </div>
-                                    <div x-data="{ buttonDisabled: false }">
-                                    <button type="submit" x-model="selectedProduct" name="product"
-                                        :disabled="product.minimum_credits > user.credits||product.doesNotFit == true"
-                                        :class="product.minimum_credits > user.credits ? 'disabled' : ''"
-                                        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 ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
-                                    </button>
+                                    <div>
+                                        <input type="hidden" name="product" x-model="selectedProduct">
+                                    </div>
+                                    <div>
+                                        <button type="submit" x-model="selectedProduct" name="product"
+                                            :disabled="product.minimum_credits > user.credits || product.doesNotFit == true ||
+                                                submitClicked"
+                                            :class="product.minimum_credits > user.credits || product.doesNotFit == true ||
+                                                submitClicked ? 'disabled' : ''"
+                                            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 ? '{{ __('Not enough') }} {{ CREDITS_DISPLAY_NAME }}!' : '{{ __('Create server') }}')">
+                                        </button>
                                     </div>
                                 </div>
                             </div>
@@ -246,7 +260,6 @@
 
 
     <script>
-
         function serverApp() {
             return {
                 //loading
@@ -275,6 +288,8 @@
                 locations: [],
                 products: [],
 
+                submitClicked: false,
+
 
                 /**
                  * @description set available eggs based on the selected nest
@@ -358,7 +373,8 @@
 
                     this.fetchedProducts = true;
                     // TODO: Sortable by user chosen property (cpu, ram, disk...)
-                    this.products = response.data.sort((p1, p2) => parseInt(p1.price,10) > parseInt(p2.price,10) && 1 || -1)
+                    this.products = response.data.sort((p1, p2) => parseInt(p1.price, 10) > parseInt(p2.price, 10) &&
+                        1 || -1)
 
                     //divide cpu by 100 for each product
                     this.products.forEach(product => {