diff --git a/app/Livewire/Subscription/Actions.php b/app/Livewire/Subscription/Actions.php index bd4dbd69a..3050e38ab 100644 --- a/app/Livewire/Subscription/Actions.php +++ b/app/Livewire/Subscription/Actions.php @@ -7,6 +7,13 @@ class Actions extends Component { + public $server_limits = 0; + public function mount() + { + $limits = currentTeam()->limits; + $this->server_limits = data_get($limits, 'serverLimit', 0); + + } public function cancel() { try { @@ -69,7 +76,8 @@ public function resume() return handleError($e, $this); } } - public function stripeCustomerPortal() { + public function stripeCustomerPortal() + { $session = getStripeCustomerPortalSession(currentTeam()); redirect($session->url); } diff --git a/app/Livewire/Subscription/Show.php b/app/Livewire/Subscription/Show.php new file mode 100644 index 000000000..8069b98a6 --- /dev/null +++ b/app/Livewire/Subscription/Show.php @@ -0,0 +1,19 @@ +route('dashboard'); + } + } + public function render() + { + return view('livewire.subscription.show'); + } +} diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index 47ea21e46..a26bed75b 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -109,7 +109,7 @@ function isPaddle() function getStripeCustomerPortalSession(Team $team) { Stripe::setApiKey(config('subscription.stripe_api_key')); - $return_url = route('team.index'); + $return_url = route('subscription.show'); $stripe_customer_id = data_get($team,'subscription.stripe_customer_id'); if (!$stripe_customer_id) { return null; @@ -123,7 +123,7 @@ function getStripeCustomerPortalSession(Team $team) function allowedPathsForUnsubscribedAccounts() { return [ - 'subscription', + 'subscription/new', 'login', 'logout', 'waitlist', diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index 598ccb2fd..93adb9126 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -130,11 +130,20 @@ class="{{ request()->is('team*') ? 'text-warning icon' : 'icon' }}" - Teams @if (isCloud()) - / Subscription - @endif + Teams + @if (isCloud()) +
  • + + + + + Subscription + +
  • + @endif @if (isInstanceAdmin())
  • diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.php index 3773e2770..32e004c4f 100644 --- a/resources/views/components/pricing-plans.blade.php +++ b/resources/views/components/pricing-plans.blade.php @@ -34,7 +34,7 @@ class="font-bold text-warning">{{ config('constants.limits.trial_period') }}
    -
    + {{--

    Unlimited Trial Get Started @@ -42,8 +42,11 @@ class="font-bold text-warning">{{ config('constants.limits.trial_period') }}

    Start self-hosting without limits with our OSS version. Same features as the paid version, but you have to manage by yourself.

    -

    +
    --}} +
    +
    For the detailed list of features, please visit our landing page: coolify.io
    @@ -70,21 +73,18 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap {{ $basic }} @endisset @endif -

    Start self-hosting in - the cloud - with a - single - server. +

    Begin hosting your own services in the + cloud.

      -
    • - + - 2 servers + Connect 2 servers
    • Scale your business or self-hosting environment. +

      Expand your business or set up your own hosting + environment.

        -
      • - + - 10 servers + Connect 10 servers
      • Deploy complex infrastructures and - manage them easily in one place.

        +

        Easily manage complex infrastructures in a + single location.

          -
        • - + - ? servers + Connect unlimited servers
        • @@ -254,7 +255,7 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap
    -
    + {{--
    Need official support for your self-hosted instance? @@ -263,9 +264,10 @@ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap Us
    -
    +
    --}} -
    Included in all plans
    + + {{--
    Included in all plans
    @@ -433,7 +435,7 @@ class="text-warning">*
    * Some features are work in progress and will be available soon. -
    +
    --}}
    @isset($other) {{ $other }} diff --git a/resources/views/emails/before-trial-conversion.blade.php b/resources/views/emails/before-trial-conversion.blade.php index 8caee2dbc..09b9a54be 100644 --- a/resources/views/emails/before-trial-conversion.blade.php +++ b/resources/views/emails/before-trial-conversion.blade.php @@ -3,5 +3,5 @@ You can try out Coolify, without payment information for free. If you like it, you can upgrade to a paid plan at any time. -[Click here](https://app.coolify.io/subscription) to start your trial. +[Click here](https://app.coolify.io/subscription/new) to start your trial. diff --git a/resources/views/livewire/subscription/actions.blade.php b/resources/views/livewire/subscription/actions.blade.php index 10c6d7acf..a3e8bb3ec 100644 --- a/resources/views/livewire/subscription/actions.blade.php +++ b/resources/views/livewire/subscription/actions.blade.php @@ -1,25 +1,34 @@
    @if (subscriptionProvider() === 'stripe') - Manage My Subscription
    -
    Current Plan: {{ data_get(currentTeam(), 'subscription')->type() }} -
    +
    Your current Plan is: {{ data_get(currentTeam(), 'subscription')->type() }}
    + @if (currentTeam()->subscription->stripe_cancel_at_period_end)
    Subscription is active but on cancel period.
    @else
    Subscription is active. Last invoice is {{ currentTeam()->subscription->stripe_invoice_paid ? 'paid' : 'not paid' }}.
    @endif +

    Limits

    +
    Server: {{ $server_limits }}
    +

    Actions

    +
    Cancel, upgrade or downgrade your subscription.
    +
    + Manage your subscription on + + - @if (currentTeam()->subscription->stripe_cancel_at_period_end) - Subscribe - again - @endif -
    To update your subscription (upgrade / downgrade), please contact us.
    +
    +
    +
    + If you have any problem, please contact us.
    @endif - @if (subscriptionProvider() === 'lemon') + {{-- @if (subscriptionProvider() === 'lemon')
    Status: {{ currentTeam()->subscription->lemon_status }}
    Type: {{ currentTeam()->subscription->lemon_variant_name }}
    @if (currentTeam()->subscription->lemon_status === 'cancelled') @@ -49,6 +58,5 @@ class="text-white underline" href="{{ config('coolify.contact') }}" target="_bla Subscription
    - @endif - + @endif --}} diff --git a/resources/views/livewire/subscription/show.blade.php b/resources/views/livewire/subscription/show.blade.php new file mode 100644 index 000000000..b4ba502bd --- /dev/null +++ b/resources/views/livewire/subscription/show.blade.php @@ -0,0 +1,16 @@ +
    +
    +

    Subscription

    +
    Here you can see and manage your subscription.
    +
    +
    + @if (data_get(currentTeam(), 'subscription')) + + @else +
    You are not subscribed to any plan. Please subscribe to a plan to continue.
    + Subscribe Now + + @endif +
    +
    diff --git a/resources/views/livewire/team/index.blade.php b/resources/views/livewire/team/index.blade.php index 64421f657..99637f17f 100644 --- a/resources/views/livewire/team/index.blade.php +++ b/resources/views/livewire/team/index.blade.php @@ -14,19 +14,6 @@ - @if (isCloud()) -
    -

    Subscription

    - @if (data_get(currentTeam(), 'subscription')) - - @else - Subscribe Now - - @endif - -
    - @endif

    Danger Zone

    Woah. I hope you know what are you doing.
    @@ -36,7 +23,7 @@ @elseif(auth()->user()->teams()->get()->count() === 1)
    You can't delete your last team.
    @elseif(currentTeam()->subscription && currentTeam()->subscription?->lemon_status !== 'cancelled') -
    Please cancel your subscription before delete this team (Manage My Subscription).
    +
    Please cancel your subscription here before delete this team.
    @else @if (currentTeam()->isEmpty())
    This will delete your team. Beware! There is no coming back!
    diff --git a/routes/web.php b/routes/web.php index a4998aaff..ae0321a67 100644 --- a/routes/web.php +++ b/routes/web.php @@ -72,6 +72,7 @@ use App\Livewire\Server\Proxy\Logs as ProxyLogs; use App\Livewire\Source\Github\Change as GitHubChange; use App\Livewire\Subscription\Index as SubscriptionIndex; +use App\Livewire\Subscription\Show as SubscriptionShow; use App\Livewire\Tags\Index as TagsIndex; use App\Livewire\Tags\Show as TagsShow; @@ -110,7 +111,8 @@ Route::get('/', Dashboard::class)->name('dashboard'); Route::get('/boarding', BoardingIndex::class)->name('boarding'); - Route::get('/subscription', SubscriptionIndex::class)->name('subscription.index'); + Route::get('/subscription/new', SubscriptionIndex::class)->name('subscription.index'); + Route::get('/subscription', SubscriptionShow::class)->name('subscription.show'); Route::get('/settings', SettingsIndex::class)->name('settings.index'); Route::get('/settings/license', SettingsLicense::class)->name('settings.license'); diff --git a/routes/webhooks.php b/routes/webhooks.php index 594e54d4a..e4e9c043b 100644 --- a/routes/webhooks.php +++ b/routes/webhooks.php @@ -816,9 +816,7 @@ Sleep::for(5)->seconds(); $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail(); } - $subscription->update([ - 'stripe_plan_id' => $planId, 'stripe_invoice_paid' => true, ]); break;