From c7fc00095cdb548f4f12b908eaca0570061bb30c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 27 Jul 2023 16:22:13 +0200 Subject: [PATCH] feat: pricing plans ans subs --- bootstrap/helpers/subscriptions.php | 7 +- config/coolify.php | 4 +- docker-compose.prod.yml | 4 +- resources/css/app.css | 6 +- resources/views/components/layout.blade.php | 2 +- .../components/navbar-subscription.blade.php | 2 +- .../views/components/pricing-plans.blade.php | 254 ++++++++++++++++++ resources/views/subscription.blade.php | 63 +++-- 8 files changed, 308 insertions(+), 34 deletions(-) create mode 100644 resources/views/components/pricing-plans.blade.php diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index bf7847cda..1a5fc5ffe 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -2,13 +2,16 @@ use Illuminate\Support\Carbon; -function getSubscriptionLink() +function getSubscriptionLink($id) { + $checkout_id = config("coolify.lemon_squeezy_checkout_id_$id"); + if (!$checkout_id) { + return null; + } $user_id = auth()->user()->id; $team_id = auth()->user()->currentTeam()->id ?? null; $email = auth()->user()->email ?? null; $name = auth()->user()->name ?? null; - $checkout_id = config('coolify.lemon_squeezy_checkout_id'); $url = "https://store.coollabs.io/checkout/buy/$checkout_id?"; if ($user_id) { $url .= "&checkout[custom][user_id]={$user_id}"; diff --git a/config/coolify.php b/config/coolify.php index fba1087b9..aed7555ab 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -4,7 +4,9 @@ 'self_hosted' => env('SELF_HOSTED', true), 'license_url' => 'https://license.coolify.io', 'lemon_squeezy_webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET'), - 'lemon_squeezy_checkout_id' => env('LEMON_SQUEEZY_CHECKOUT_ID'), + 'lemon_squeezy_checkout_id_1' => env('LEMON_SQUEEZY_CHECKOUT_ID_1'), + 'lemon_squeezy_checkout_id_2' => env('LEMON_SQUEEZY_CHECKOUT_ID_2'), + 'lemon_squeezy_checkout_id_3' => env('LEMON_SQUEEZY_CHECKOUT_ID_3'), 'mux_enabled' => env('MUX_ENABLED', true), 'dev_webhook' => env('SERVEO_URL'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 0a257eb9d..a2d894aa4 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -32,7 +32,9 @@ services: - PHP_PM_MAX_SPARE_SERVERS=10 - SELF_HOSTED - LEMON_SQUEEZY_WEBHOOK_SECRET - - LEMON_SQUEEZY_CHECKOUT_ID + - LEMON_SQUEEZY_CHECKOUT_ID_1 + - LEMON_SQUEEZY_CHECKOUT_ID_2 + - LEMON_SQUEEZY_CHECKOUT_ID_3 ports: - "${APP_PORT:-8000}:80" expose: diff --git a/resources/css/app.css b/resources/css/app.css index 979bc99aa..e71e6b9cd 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -15,7 +15,7 @@ .scrollbar { @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-2; } .main { - @apply max-w-screen-xl pt-4 pl-24 pr-10 mx-auto; + @apply pt-4 pl-24 pr-10 mx-auto; } .label-text, label { @@ -109,3 +109,7 @@ tr td { tr td:first-child { @apply pl-4 pr-3 font-bold sm:pl-6; } + +.buyme { + @apply block px-3 py-2 mt-10 text-sm font-semibold leading-6 text-center text-white rounded-md shadow-sm bg-coolgray-200 hover:bg-coolgray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-coolgray-200; +} diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.php index b69b54fa2..5b20443b7 100644 --- a/resources/views/components/layout.blade.php +++ b/resources/views/components/layout.blade.php @@ -32,7 +32,7 @@
-
+
{{ $slot }}
diff --git a/resources/views/components/navbar-subscription.blade.php b/resources/views/components/navbar-subscription.blade.php index de98e1520..1c8f60f58 100644 --- a/resources/views/components/navbar-subscription.blade.php +++ b/resources/views/components/navbar-subscription.blade.php @@ -12,7 +12,7 @@ - Logout + diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.php new file mode 100644 index 000000000..222d41145 --- /dev/null +++ b/resources/views/components/pricing-plans.blade.php @@ -0,0 +1,254 @@ +
+
+
+
+ Payment frequency + + +
+
+
+
Save 20% with the + yearly plan +
+
+
+
Congratulations! 🎉 You are saving money with this choice! +
+
+
+
+
+

Unlimited Trial

+

+ + Free + + + Still Free + +

+ Get + Started +

Start self-hosting without limits with our OSS + version.

+
    +
  • + + Same features as the paid version +
  • +
  • + + You need to take care of everything +
  • +
  • + + If you brave enough, you can do it! +
  • +
  • + + Community Support +
  • +
+
+
+

Basic

+

+ + $15 + /monthly + + + $144 + /yearly + +

+ Subscribe +

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

+
    +
  • + + 1 server +
  • +
  • + + Unlimited Deployments +
  • +
  • + + 30 days of backups +
  • +
  • + + Basic Support +
  • +
+
+
+

Essential

+

+ + $30 + /monthly + + + $288 + /yearly + +

+ Subscribe +

Scale your business or self-hosting environment.

+
    +
  • + + 5 servers +
  • +
  • + + Unlimited Deployments +
  • +
  • + + 30 days of backups +
  • +
  • + + Basic Support +
  • +
+
+
+

Growth

+

+ + $60 + /monthly + + + $576 + /yearly + +

+ + Subscribe +

Deploy complex infrastuctures and + manage them easily in one place.

+
    +
  • + + Unlimited servers +
  • +
  • + + Unlimited deployments +
  • +
  • + + 30 days of backups +
  • +
  • + + Priority Support +
  • +
+
+
+
+
+
diff --git a/resources/views/subscription.blade.php b/resources/views/subscription.blade.php index b954c165e..1e4374ba4 100644 --- a/resources/views/subscription.blade.php +++ b/resources/views/subscription.blade.php @@ -1,33 +1,42 @@ @if ($settings->is_resale_license_active) -
-

Subscription

- +
+
+
+

Subscription

+ +
+
+ Currently active team: {{ session('currentTeam.name') }} +
+ + {{-- @if (data_get( + auth()->user()->currentTeam(), + 'subscription', + )) +
Status: {{ auth()->user()->currentTeam()->subscription->lemon_status }}
+
Type: {{ auth()->user()->currentTeam()->subscription->lemon_variant_name }}
+ @if (auth()->user()->currentTeam()->subscription->lemon_status === 'cancelled') +
Subscriptions ends at: {{ getEndDate() }}
+ Subscribe + Again + + @else +
Renews at: {{ getRenewDate() }}
+ @endif + Update Payment Details + + @else + Subscribe + Now + + @endif + Manage My + Subscription + --}} +
-
- Currently active team: {{ session('currentTeam.name') }} -
- @if (data_get(auth()->user()->currentTeam(), - 'subscription')) -
Status: {{ auth()->user()->currentTeam()->subscription->lemon_status }}
-
Type: {{ auth()->user()->currentTeam()->subscription->lemon_variant_name }}
- @if (auth()->user()->currentTeam()->subscription->lemon_status === 'cancelled') -
Subscriptions ends at: {{ getEndDate() }}
- Subscribe - Again - - @else -
Renews at: {{ getRenewDate() }}
- @endif - Update Payment Details - - @else - Subscribe Now - - @endif - Manage My - Subscription - @else
Resale license is not active. Please contact your instance admin.
@endif