Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
jringeisen committed Feb 11, 2024
2 parents 216eced + 58e4e02 commit abb3da4
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/StripeCheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __invoke(Request $request)
->quantity($request->student_count)
->allowPromotionCodes()
->checkout([
'success_url' => route('parent.dashboard'),
'success_url' => route('subscription.checkout.success'),
'cancel_url' => route('subscription.checkout.options'),
]);
}
Expand Down
14 changes: 14 additions & 0 deletions app/Http/Controllers/StripeCheckoutSuccessController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers;

use Inertia\Inertia;
use Inertia\Response;

class StripeCheckoutSuccessController extends Controller
{
public function __invoke(): Response
{
return Inertia::render('StripeCheckout/StripeCheckoutSuccess');
}
}
14 changes: 14 additions & 0 deletions resources/js/Layouts/AuthenticatedLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@
<MotivationalMessage v-if="$page.props.auth.motivationalMessage"
:message="$page.props.auth.motivationalMessage"/>
<div class="px-4 sm:px-6 lg:px-8">
<div v-if="showUpgradeBanner()" class="max-w-7xl mx-auto sm:px-8">
<div class="bg-primary-yellow rounded-lg text-center p-4">
<p class="text-yellow-900">
You are currently on the free plan. <Link :href="route('subscription.checkout.options')" class="font-bold underline">Upgrade</Link> to the premium plan to unlock all features.
</p>
</div>
</div>
<slot></slot>
</div>
</main>
Expand Down Expand Up @@ -287,6 +294,13 @@ const getIconComponent = (iconName) => {
return iconMap[iconName] || null;
};
const showUpgradeBanner = () => {
return !page.props.auth.isSubscribed
&& !route().current('subscription.checkout.options')
&& !route().current('subscription.checkout.success')
&& page.props.auth.type === 'teacher';
};
const isServer = typeof window === 'undefined'
const timeoutDuration = 600000;
const pollDuration = 45000;
Expand Down
2 changes: 0 additions & 2 deletions resources/js/Pages/StripeCheckout/StripeCheckoutOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
>
Get started today
</button>
<p class="text-center text-sm mt-2 uppercase">Use <strong>BETA2024</strong> to save 20%</p>
</div>
<div class="rounded-3xl p-8 ring-1 ring-gray-900/10 sm:p-10 relative bg-primary-dark-gray shadow-2xl">
<h3 id="tier-enterprise" class="text-base font-semibold leading-7 text-primary-yellow">Annual</h3>
Expand Down Expand Up @@ -234,7 +233,6 @@
>
Get started today
</button>
<p class="text-center text-sm mt-2 uppercase text-neutral-300">Use <strong>BETA2024</strong> to save 20%</p>
</div>
</div>
</div>
Expand Down
26 changes: 26 additions & 0 deletions resources/js/Pages/StripeCheckout/StripeCheckoutSuccess.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<Head title="Checkout Success" />

<div class="relative isolate px-6 lg:px-8">
<div class="mx-auto max-w-2xl text-center lg:max-w-4xl">
<p class="mt-2 text-4xl font-bold tracking-tight text-primary-gray dark:text-neutral-300 sm:text-5xl">
Checkout was Successful!
</p>
</div>
<p class="mx-auto mt-6 max-w-2xl text-center text-lg leading-8 text-neutral-500 dark:text-neutral-300">
You now have full access and can ask an unlimited amount of questions. Enjoy!
</p>
<div class="max-w-2xl mx-auto text-center mt-6">
<Link :href="route('parent.dashboard')" class="inline-flex items-center px-4 py-2 bg-primary-yellow border border-transparent rounded-md font-semibold text-xs text-primary-dark-gray dark:text-gray-800 uppercase tracking-widest hover:bg-yellow-500 dark:hover:bg-yellow-500 focus:bg-yellow-500 dark:focus:bg-yellow-500 active:bg-yellow-500 dark:active:bg-bg-yellow-500 focus:outline-none focus:ring-2 focus:ring-primary-yellow focus:ring-offset-2 dark:focus:ring-offset-neutral-800 transition ease-in-out duration-150">Back to Dashboard</Link>
</div>
</div>
</template>

<script setup>
import { Head, Link } from '@inertiajs/vue3';
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
defineOptions({
layout: AuthenticatedLayout,
});
</script>
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\StripeCheckoutController;
use App\Http\Controllers\StripeCheckoutOptionsController;
use App\Http\Controllers\StripeCheckoutSuccessController;
use App\Http\Controllers\Student\PromptController;
use App\Http\Controllers\Student\Prompts\GetContentController;
use App\Http\Controllers\Student\Prompts\GetQuestionsController;
Expand Down Expand Up @@ -87,6 +88,7 @@

Route::get('/subscription-checkout', StripeCheckoutController::class)->name('subscription.checkout');
Route::get('/subscription-checkout-options', StripeCheckoutOptionsController::class)->name('subscription.checkout.options');
Route::get('/subscription-checkout-success', StripeCheckoutSuccessController::class)->name('subscription.checkout.success');
});

Route::prefix('profile')->group(function () {
Expand Down

0 comments on commit abb3da4

Please sign in to comment.