refactor + fixes
This commit is contained in:
parent
6f00740f67
commit
5b6667c461
@ -30,7 +30,7 @@ public function subscription()
|
||||
if (!is_cloud()) {
|
||||
abort(404);
|
||||
}
|
||||
return view('subscription.show', [
|
||||
return view('subscription.index', [
|
||||
'settings' => InstanceSettings::get(),
|
||||
]);
|
||||
}
|
||||
@ -80,7 +80,7 @@ public function team()
|
||||
if (auth()->user()->isAdminFromSession()) {
|
||||
$invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
|
||||
}
|
||||
return view('team.show', [
|
||||
return view('team.index', [
|
||||
'invitations' => $invitations,
|
||||
]);
|
||||
}
|
||||
@ -129,7 +129,7 @@ public function acceptInvitation()
|
||||
if ($diff <= config('constants.invitation.link.expiration')) {
|
||||
$user->teams()->attach($invitation->team->id, ['role' => $invitation->role]);
|
||||
$invitation->delete();
|
||||
return redirect()->route('team.show');
|
||||
return redirect()->route('team.index');
|
||||
} else {
|
||||
$invitation->delete();
|
||||
abort(401);
|
||||
@ -151,7 +151,7 @@ public function revokeInvitation()
|
||||
abort(401);
|
||||
}
|
||||
$invitation->delete();
|
||||
return redirect()->route('team.show');
|
||||
return redirect()->route('team.index');
|
||||
} catch (Throwable $th) {
|
||||
throw $th;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Kernel extends HttpKernel
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\CheckForcePasswordReset::class,
|
||||
\App\Http\Middleware\SubscriptionValid::class,
|
||||
\App\Http\Middleware\IsSubscriptionValid::class,
|
||||
\App\Http\Middleware\IsBoardingFlow::class,
|
||||
|
||||
],
|
||||
|
@ -49,7 +49,7 @@ public function subscribeStripe($type)
|
||||
],
|
||||
'mode' => 'subscription',
|
||||
'success_url' => route('subscription.success'),
|
||||
'cancel_url' => route('subscription.show',['cancelled' => true]),
|
||||
'cancel_url' => route('subscription.index',['cancelled' => true]),
|
||||
];
|
||||
$customer = currentTeam()->subscription?->stripe_customer_id ?? null;
|
||||
if ($customer) {
|
||||
|
@ -30,7 +30,7 @@ public function submit()
|
||||
]);
|
||||
auth()->user()->teams()->attach($team, ['role' => 'admin']);
|
||||
refreshSession();
|
||||
return redirect()->route('team.show');
|
||||
return redirect()->route('team.index');
|
||||
} catch (\Throwable $th) {
|
||||
return general_error_handler($th, $this);
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ public function delete()
|
||||
});
|
||||
|
||||
refreshSession();
|
||||
return redirect()->route('team.show');
|
||||
return redirect()->route('team.index');
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ public function submit()
|
||||
try {
|
||||
$this->team->save();
|
||||
refreshSession();
|
||||
$this->emit('reloadWindow');
|
||||
} catch (\Throwable $th) {
|
||||
return general_error_handler($th, $this);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SubscriptionValid
|
||||
class IsSubscriptionValid
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
@ -32,6 +32,7 @@ protected static function boot()
|
||||
$team = [
|
||||
'name' => $user->name . "'s Team",
|
||||
'personal_team' => true,
|
||||
'boarding' => true
|
||||
];
|
||||
if ($user->id === 0) {
|
||||
$team['id'] = 0;
|
||||
|
@ -53,7 +53,8 @@ function showBoarding(): bool
|
||||
}
|
||||
function refreshSession(): void
|
||||
{
|
||||
session(['currentTeam' => currentTeam()]);
|
||||
$team = Team::find(currentTeam()->id);
|
||||
session(['currentTeam' => $team]);
|
||||
}
|
||||
function general_error_handler(Throwable | null $err = null, $that = null, $isJson = false, $customErrorMessage = null): mixed
|
||||
{
|
||||
|
@ -70,7 +70,6 @@ function isSubscriptionActive()
|
||||
}
|
||||
function isSubscriptionOnGracePeriod()
|
||||
{
|
||||
|
||||
$team = currentTeam();
|
||||
if (!$team) {
|
||||
return false;
|
||||
@ -96,7 +95,7 @@ function subscriptionProvider()
|
||||
function getStripeCustomerPortalSession(Team $team)
|
||||
{
|
||||
Stripe::setApiKey(config('subscription.stripe_api_key'));
|
||||
$return_url = route('team.show');
|
||||
$return_url = route('team.index');
|
||||
$stripe_customer_id = $team->subscription->stripe_customer_id;
|
||||
$session = \Stripe\BillingPortal\Session::create([
|
||||
'customer' => $stripe_customer_id,
|
||||
|
@ -12,8 +12,8 @@
|
||||
'limits' => [
|
||||
'server' => [
|
||||
'basic' => 1,
|
||||
'pro' => 3,
|
||||
'ultimate' => 9999999999999999999,
|
||||
'pro' => 10,
|
||||
'ultimate' => 25,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col items-center justify-center h-screen">
|
||||
<span class="text-xl font-bold text-white">You have reached the limit of {{ $name }} you can create.</span>
|
||||
<span>Please <a class="text-white underline "href="{{ route('team.show') }}">upgrade your
|
||||
<span>Please <a class="text-white underline "href="{{ route('team.index') }}">upgrade your
|
||||
subscription<a /> to create more
|
||||
{{ $name }}.</span>
|
||||
</div>
|
||||
|
@ -1,6 +1,15 @@
|
||||
@auth
|
||||
<nav class="fixed h-full overflow-hidden overflow-y-auto scrollbar">
|
||||
<ul class="flex flex-col h-full gap-4 menu flex-nowrap">
|
||||
<li title="Dashboard">
|
||||
<a class="hover:bg-transparent" @if (!request()->is('/')) href="/" @endif>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="{{ request()->is('/') ? 'text-warning icon' : 'icon' }}"
|
||||
fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
<li class="pb-6" title="Logout">
|
||||
<form action="/logout" method="POST" class=" hover:bg-transparent">
|
||||
@csrf
|
||||
|
@ -51,7 +51,7 @@ class="{{ request()->is('command-center') ? 'text-warning icon' : 'icon' }}" vie
|
||||
</a>
|
||||
</li>
|
||||
<li title="Teams">
|
||||
<a class="hover:bg-transparent" href="{{ route('team.show') }}">
|
||||
<a class="hover:bg-transparent" href="{{ route('team.index') }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
|
@ -3,21 +3,21 @@
|
||||
])
|
||||
<div x-data="{ selected: 'yearly' }" class="w-full pb-20">
|
||||
<div class="px-6 mx-auto lg:px-8">
|
||||
<div class="flex justify-center mt-5">
|
||||
<div class="flex justify-center">
|
||||
<fieldset
|
||||
class="grid grid-cols-2 p-1 text-xs font-semibold leading-5 text-center rounded-full gap-x-1 ">
|
||||
class="grid grid-cols-2 p-1 text-xs font-semibold leading-5 text-center text-white rounded gap-x-1 bg-white/5">
|
||||
<legend class="sr-only">Payment frequency</legend>
|
||||
<label class="cursor-pointer rounded px-2.5 py-1"
|
||||
<label class="cursor-pointer rounded px-2.5 py-1"
|
||||
:class="selected === 'monthly' ? 'bg-coollabs-100 text-white' : ''">
|
||||
<input type="radio" x-on:click="selected = 'monthly'" name="frequency" value="monthly"
|
||||
class="sr-only">
|
||||
<span>Monthly</span>
|
||||
</label>
|
||||
<label class="cursor-pointer rounded px-2.5 py-1"
|
||||
<label class="cursor-pointer rounded px-2.5 py-1"
|
||||
:class="selected === 'yearly' ? 'bg-coollabs-100 text-white' : ''">
|
||||
<input type="radio" x-on:click="selected = 'yearly'" name="frequency" value="annually"
|
||||
class="sr-only">
|
||||
<span>Annually <span class="text-xs text-warning">(save ~1 month)<span></span>
|
||||
<span>Annually</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
@ -167,9 +167,9 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
|
||||
<span>billed annually</span>
|
||||
</span>
|
||||
@if ($showSubscribeButtons)
|
||||
@isset($pro)
|
||||
{{ $pro }}
|
||||
@endisset
|
||||
@isset($pro)
|
||||
{{ $pro }}
|
||||
@endisset
|
||||
@endif
|
||||
<p class="h-20 mt-10 text-sm leading-6 text-white">Scale your business or self-hosting environment.
|
||||
</p>
|
||||
@ -181,7 +181,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
|
||||
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
5 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />
|
||||
10 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />
|
||||
</li>
|
||||
<li class="flex gap-x-3">
|
||||
<svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"
|
||||
@ -229,7 +229,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
|
||||
{{ $ultimate }}
|
||||
@endisset
|
||||
@endif
|
||||
<p class="h-20 mt-10 text-sm leading-6 text-white">Deploy complex infrastuctures and
|
||||
<p class="h-20 mt-10 text-sm leading-6 text-white">Deploy complex infrastructures and
|
||||
manage them easily in one place.</p>
|
||||
<ul role="list" class="mt-6 space-y-3 text-sm leading-6 ">
|
||||
<li class="flex gap-x-3">
|
||||
@ -239,7 +239,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
|
||||
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
15 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />
|
||||
25 servers <x-helper helper="Bring Your Own Server. All you need is n SSH connection." />
|
||||
</li>
|
||||
<li class="flex font-bold text-white gap-x-3">
|
||||
<svg class="flex-none w-5 h-6 text-warning" viewBox="0 0 20 20" fill="currentColor"
|
||||
|
@ -21,7 +21,7 @@
|
||||
</ol>
|
||||
</nav>
|
||||
<nav class="navbar-main">
|
||||
<a class="{{ request()->routeIs('team.show') ? 'text-white' : '' }}" href="{{ route('team.show') }}">
|
||||
<a class="{{ request()->routeIs('team.index') ? 'text-white' : '' }}" href="{{ route('team.index') }}">
|
||||
<button>General</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('team.members') ? 'text-white' : '' }}" href="{{ route('team.members') }}">
|
||||
|
@ -8,7 +8,7 @@
|
||||
@endif
|
||||
|
||||
@if (currentTeam()->subscription->stripe_cancel_at_period_end)
|
||||
<a class="hover:no-underline" href="{{ route('subscription.show') }}"><x-forms.button>Subscribe
|
||||
<a class="hover:no-underline" href="{{ route('subscription.index') }}"><x-forms.button>Subscribe
|
||||
again</x-forms.button></a>
|
||||
@endif
|
||||
<x-forms.button wire:click='stripeCustomerPortal'>Manage My Subscription</x-forms.button>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="subtitle ">Your user profile settings.</div>
|
||||
<livewire:profile.form :request="$request" />
|
||||
<h2 class="py-4">Subscription</h2>
|
||||
<a href="{{ route('team.show') }}">Check in Team Settings</a>
|
||||
<a href="{{ route('team.index') }}">Check in Team Settings</a>
|
||||
<h2 class="py-4">Two-factor Authentication</h2>
|
||||
@if (session('status') == 'two-factor-authentication-enabled')
|
||||
<div class="mb-4 font-medium">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="flex justify-center mx-10">
|
||||
<div x-data>
|
||||
<div class="flex gap-2">
|
||||
<h2>Subscription</h2>
|
||||
<h1>Subscription</h1>
|
||||
<livewire:switch-team />
|
||||
</div>
|
||||
<div class="flex items-center pb-8">
|
||||
@ -11,7 +11,10 @@
|
||||
class="text-warning">{{ session('currentTeam.name') }}</span></span>
|
||||
</div>
|
||||
@if(request()->query->get('cancelled'))
|
||||
<div class="text-xl text-center text-red-500">Something went wrong. Please try again.</div>
|
||||
<div class="rounded alert alert-error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
||||
<span>Something went wrong with your subscription. Please try again or contact support.</span>
|
||||
</div>
|
||||
@endif
|
||||
@if (config('subscription.provider') !== null)
|
||||
<livewire:subscription.pricing-plans />
|
@ -11,7 +11,7 @@
|
||||
<livewire:subscription.actions />
|
||||
@else
|
||||
<x-forms.button class="mt-4"><a class="text-white hover:no-underline"
|
||||
href="{{ route('subscription.show') }}">Subscribe Now</a>
|
||||
href="{{ route('subscription.index') }}">Subscribe Now</a>
|
||||
</x-forms.button>
|
||||
@endif
|
||||
|
@ -98,13 +98,13 @@
|
||||
Route::middleware(['throttle:force-password-reset'])->group(function () {
|
||||
Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset');
|
||||
});
|
||||
Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.show');
|
||||
Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.index');
|
||||
Route::get('/subscription/success', fn () => view('subscription.success'))->name('subscription.success');
|
||||
Route::get('/subscription/cancel', fn () => view('profile'))->name('subscription.cancel');
|
||||
Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration');
|
||||
Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license');
|
||||
Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile');
|
||||
Route::get('/team', [Controller::class, 'team'])->name('team.show');
|
||||
Route::get('/team', [Controller::class, 'team'])->name('team.index');
|
||||
Route::get('/team/new', fn () => view('team.create'))->name('team.create');
|
||||
Route::get('/team/notifications', fn () => view('team.notifications'))->name('team.notifications');
|
||||
Route::get('/team/storages', [Controller::class, 'storages'])->name('team.storages.all');
|
||||
|
Loading…
Reference in New Issue
Block a user