mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
restriction text implementation for the frontend
This commit is contained in:
@@ -108,7 +108,7 @@ return [
|
||||
'want_to_delete_card_description' => 'We will no longer settle your payments automatically and you will have to fund your account for the next payments.',
|
||||
'credit_card_deleted' => 'Your credit card was deleted.',
|
||||
'billed_annually' => 'Billed Annually',
|
||||
'restricted_account_warning' => 'Your functionality is restricted. Please review your billing settings.',
|
||||
'restricted_account_warning' => 'Your functionality is restricted.',
|
||||
'subscription_type' => 'Subscription Type',
|
||||
'subscription_type_note' => 'Please do not change in production environment.',
|
||||
'select_subscription_type' => 'Select your subscription type',
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"/chunks/settings-password.js": "/chunks/settings-password.js?id=1cf499fe8326b3c4",
|
||||
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=ecfee7f7e98204f8",
|
||||
"/chunks/billing.js": "/chunks/billing.js?id=f016e8454a346fc6",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=0716f5215cdb26a8",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=ac9e1881456b1cb8",
|
||||
"/chunks/files.js": "/chunks/files.js?id=77289ebbd049d5ac",
|
||||
"/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=248310cdd67d62fb",
|
||||
"/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=15fba3b663103c88",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="$store.getters.isLimitedUser" class="bg-red-500 py-1 text-center">
|
||||
<div v-if="$store.getters.userLimitationReason" class="bg-gradient-to-r from-red-600 to-red-500 py-2.5 px-1 text-center leading-none">
|
||||
<router-link :to="{ name: 'Billing' }" class="text-xs font-bold text-white">
|
||||
{{ $t('restricted_account_warning') }}
|
||||
{{ $t('restricted_account_warning') + ' ' + $store.getters.userLimitationReason }}
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
5
resources/js/store/modules/userAuth.js
vendored
5
resources/js/store/modules/userAuth.js
vendored
@@ -201,10 +201,7 @@ const mutations = {
|
||||
}
|
||||
|
||||
const getters = {
|
||||
isLimitedUser: (state) =>
|
||||
state.user &&
|
||||
state.user.data.relationships.failedPayments &&
|
||||
state.user.data.relationships.failedPayments.data.length === 3,
|
||||
userLimitationReason: (state) => state.user && state.user.data.meta.restrictions.reason,
|
||||
permission: (state) => state.permission,
|
||||
user: (state) => state.user,
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
DragUI,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isVisibleSidebar', 'isLimitedUser', 'config', 'currentFolder']),
|
||||
...mapGetters(['isVisibleSidebar', 'config', 'currentFolder']),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace App\Users\Models;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
use Illuminate\Support\Str;
|
||||
use BadMethodCallException;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
@@ -196,10 +197,14 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (str_starts_with($method, 'can') || str_starts_with($method, 'get')) {
|
||||
return resolve(RestrictionsManager::class)
|
||||
->driver()
|
||||
->$method($this, ...$parameters);
|
||||
try {
|
||||
if (str_starts_with($method, 'can') || str_starts_with($method, 'get')) {
|
||||
return resolve(RestrictionsManager::class)
|
||||
->driver()
|
||||
->$method($this, ...$parameters);
|
||||
}
|
||||
} catch (BadMethodCallException $e) {
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
return parent::__call($method, $parameters);
|
||||
|
||||
@@ -70,13 +70,13 @@ class MeteredBillingRestrictionsEngine implements RestrictionsEngine
|
||||
{
|
||||
if ($this->getDunningSequenceCount($user) === 3) {
|
||||
return match ($user->dunning->type) {
|
||||
'limit_usage_in_new_accounts' => 'Please make your first payment.',
|
||||
'usage_bigger_than_balance' => 'Please increase your account balance.',
|
||||
'limit_usage_in_new_accounts' => 'Please make your first payment to cover your usage.',
|
||||
'usage_bigger_than_balance' => 'Please increase your account balance higher than your monthly usage.',
|
||||
};
|
||||
}
|
||||
|
||||
if (! $this->checkFailedPayments($user)) {
|
||||
return 'Please update your credit card.';
|
||||
return 'Please update your credit card to pay your usage.';
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user