mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-22 13:04:42 +00:00
- Zero capacity storage
- Set 0 storage capacity after creating order
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Oasis;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Resources\UserResource;
|
use App\Http\Resources\UserResource;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\UserSettings;
|
||||||
use App\Notifications\Oasis\PaymentRequiredNotification;
|
use App\Notifications\Oasis\PaymentRequiredNotification;
|
||||||
use App\Services\Oasis\CzechRegisterSearchService;
|
use App\Services\Oasis\CzechRegisterSearchService;
|
||||||
use App\Services\StripeService;
|
use App\Services\StripeService;
|
||||||
@@ -52,19 +53,22 @@ class AdminController extends Controller
|
|||||||
'password' => Hash::make(Str::random()),
|
'password' => Hash::make(Str::random()),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
UserSettings::unguard();
|
||||||
|
|
||||||
// Store user settings
|
// Store user settings
|
||||||
$newbie
|
$newbie
|
||||||
->settings()
|
->settings()
|
||||||
->create([
|
->create([
|
||||||
'ico' => $request->ico,
|
'storage_capacity' => 0,
|
||||||
'name' => $request->name,
|
'ico' => $request->ico,
|
||||||
'address' => $request->address,
|
'name' => $request->name,
|
||||||
'state' => $request->state,
|
'address' => $request->address,
|
||||||
'city' => $request->city,
|
'state' => $request->state,
|
||||||
'postal_code' => $request->postal_code,
|
'city' => $request->city,
|
||||||
'country' => $request->country,
|
'postal_code' => $request->postal_code,
|
||||||
'phone_number' => $request->phone_number,
|
'country' => $request->country,
|
||||||
'timezone' => '1.0',
|
'phone_number' => $request->phone_number,
|
||||||
|
'timezone' => '1.0',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Store subscription request
|
// Store subscription request
|
||||||
|
|||||||
@@ -400,7 +400,11 @@ function get_storage_fill_percentage($used, $capacity)
|
|||||||
$total = intval(Metric::gigabytes($capacity)->numberOfBytes());
|
$total = intval(Metric::gigabytes($capacity)->numberOfBytes());
|
||||||
|
|
||||||
// Count progress
|
// Count progress
|
||||||
$progress = ($used * 100) / $total;
|
if ($total == 0) {
|
||||||
|
$progress = 100;
|
||||||
|
} else {
|
||||||
|
$progress = ($used * 100) / $total;
|
||||||
|
}
|
||||||
|
|
||||||
// Return in 2 decimal
|
// Return in 2 decimal
|
||||||
return number_format((float)$progress, 2, '.', '');
|
return number_format((float)$progress, 2, '.', '');
|
||||||
@@ -409,6 +413,8 @@ function get_storage_fill_percentage($used, $capacity)
|
|||||||
/**
|
/**
|
||||||
* Get user capacity fill by percentage
|
* Get user capacity fill by percentage
|
||||||
*
|
*
|
||||||
|
* @param $id
|
||||||
|
* @param null $additionals
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function user_storage_percentage($id, $additionals = null)
|
function user_storage_percentage($id, $additionals = null)
|
||||||
|
|||||||
@@ -49,14 +49,20 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="cell-item">
|
<span v-if="row.data.attributes.storage.capacity !== 0" class="cell-item">
|
||||||
{{ row.data.attributes.storage.used_formatted }}
|
{{ row.data.attributes.storage.used_formatted }}
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="row.data.attributes.storage.capacity == 0" class="cell-item">
|
||||||
|
-
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td v-if="config.storageLimit">
|
<td v-if="config.storageLimit">
|
||||||
<span class="cell-item">
|
<span v-if="row.data.attributes.storage.capacity !== 0" class="cell-item">
|
||||||
{{ row.data.attributes.storage.capacity_formatted }}
|
{{ row.data.attributes.storage.capacity_formatted }}
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="row.data.attributes.storage.capacity == 0" class="cell-item">
|
||||||
|
-
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="cell-item">
|
<span class="cell-item">
|
||||||
|
|||||||
@@ -44,14 +44,20 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="cell-item">
|
<span v-if="row.data.attributes.storage.capacity !== 0" class="cell-item">
|
||||||
{{ row.data.attributes.storage.used_formatted }}
|
{{ row.data.attributes.storage.used_formatted }}
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="row.data.attributes.storage.capacity == 0" class="cell-item">
|
||||||
|
-
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td v-if="config.storageLimit">
|
<td v-if="config.storageLimit">
|
||||||
<span class="cell-item">
|
<span v-if="row.data.attributes.storage.capacity !== 0" class="cell-item">
|
||||||
{{ row.data.attributes.storage.capacity_formatted }}
|
{{ row.data.attributes.storage.capacity_formatted }}
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="row.data.attributes.storage.capacity == 0" class="cell-item">
|
||||||
|
-
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="cell-item">
|
<span class="cell-item">
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ class OasisAdminTest extends TestCase
|
|||||||
$this->assertDatabaseHas('user_settings', [
|
$this->assertDatabaseHas('user_settings', [
|
||||||
'ico' => '08995281',
|
'ico' => '08995281',
|
||||||
'payment_activation' => 0,
|
'payment_activation' => 0,
|
||||||
|
'storage_capacity' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$newbie = User::whereEmail('john@doe.com')
|
$newbie = User::whereEmail('john@doe.com')
|
||||||
|
|||||||
Reference in New Issue
Block a user