This commit is contained in:
Mark Gregory
2026-06-11 10:58:34 +01:00
parent 6d081cab5b
commit 0e83986850
13 changed files with 725 additions and 426 deletions
@@ -11,6 +11,20 @@ use Modules\Platform\app\Models\PlatformPrice;
class PlatformPriceController extends Controller
{
/**
* Display the customer-facing platform pricing cards.
*/
public function publicIndex(): View
{
return view('platform::prices.public', [
'prices' => PlatformPrice::query()
->where('is_active', true)
->ordered()
->get(),
]);
}
/**
* Display platform prices in a card grid with administration actions.
*/
@@ -1,15 +1,14 @@
<x-layouts::app :title="__('Create Price')">
<div class="space-y-6">
<section class="overflow-hidden rounded-3xl bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 p-5 text-white shadow-xl sm:p-6">
<div class="flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-cyan-300">Administration</p>
<h1 class="mt-2 text-2xl font-bold tracking-tight sm:text-3xl">Create price</h1>
<p class="mt-2 max-w-2xl text-sm leading-6 text-slate-300">Add a new platform pricing card with billing values, feature bullets and status controls.</p>
</div>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-white/15 bg-white/10 px-4 py-2 text-sm font-semibold text-white backdrop-blur hover:bg-white/15">Back to prices</a>
</div>
</section>
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="text-sm font-semibold text-zinc-500 dark:text-zinc-400">
Add a new platform pricing card with billing values, feature bullets and status controls.
</p>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 bg-white px-4 py-2 text-sm font-semibold text-zinc-700 shadow-sm hover:border-cyan-400 hover:text-cyan-700 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-200">
Back to prices
</a>
</div>
<section class="rounded-3xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
<form method="POST" action="{{ route('platform.prices.store') }}" class="space-y-6">
@@ -17,8 +16,12 @@
@include('platform::prices._form')
<div class="flex flex-wrap justify-end gap-3 border-t border-zinc-100 pt-5 dark:border-zinc-800">
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 px-5 py-3 text-sm font-semibold text-zinc-700 dark:border-zinc-700 dark:text-zinc-200">Cancel</a>
<button type="submit" class="rounded-xl bg-cyan-600 px-5 py-3 text-sm font-bold text-white shadow-lg shadow-cyan-950/20 hover:bg-cyan-500">Create price</button>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 px-5 py-3 text-sm font-semibold text-zinc-700 dark:border-zinc-700 dark:text-zinc-200">
Cancel
</a>
<button type="submit" class="rounded-xl bg-cyan-600 px-5 py-3 text-sm font-bold text-white shadow-lg shadow-cyan-950/20 hover:bg-cyan-500">
Create price
</button>
</div>
</form>
</section>
@@ -1,15 +1,14 @@
<x-layouts::app :title="__('Edit Price')">
<div class="space-y-6">
<section class="overflow-hidden rounded-3xl bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 p-5 text-white shadow-xl sm:p-6">
<div class="flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-cyan-300">Administration</p>
<h1 class="mt-2 text-2xl font-bold tracking-tight sm:text-3xl">Edit {{ $price->name }}</h1>
<p class="mt-2 max-w-2xl text-sm leading-6 text-slate-300">Update the pricing card, feature list and visibility settings without changing the rest of the platform.</p>
</div>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-white/15 bg-white/10 px-4 py-2 text-sm font-semibold text-white backdrop-blur hover:bg-white/15">Back to prices</a>
</div>
</section>
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="text-sm font-semibold text-zinc-500 dark:text-zinc-400">
Update {{ $price->name }} pricing, feature list and visibility settings.
</p>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 bg-white px-4 py-2 text-sm font-semibold text-zinc-700 shadow-sm hover:border-cyan-400 hover:text-cyan-700 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-200">
Back to prices
</a>
</div>
<section class="rounded-3xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
<form method="POST" action="{{ route('platform.prices.update', $price) }}" class="space-y-6">
@@ -18,8 +17,12 @@
@include('platform::prices._form')
<div class="flex flex-wrap justify-end gap-3 border-t border-zinc-100 pt-5 dark:border-zinc-800">
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 px-5 py-3 text-sm font-semibold text-zinc-700 dark:border-zinc-700 dark:text-zinc-200">Cancel</a>
<button type="submit" class="rounded-xl bg-cyan-600 px-5 py-3 text-sm font-bold text-white shadow-lg shadow-cyan-950/20 hover:bg-cyan-500">Save changes</button>
<a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-xl border border-zinc-200 px-5 py-3 text-sm font-semibold text-zinc-700 dark:border-zinc-700 dark:text-zinc-200">
Cancel
</a>
<button type="submit" class="rounded-xl bg-cyan-600 px-5 py-3 text-sm font-bold text-white shadow-lg shadow-cyan-950/20 hover:bg-cyan-500">
Save changes
</button>
</div>
</form>
</section>
@@ -1,18 +1,21 @@
<x-layouts::app :title="__('Platform Prices')">
<x-layouts::app :title="__('Platform Pricing')">
<div class="space-y-6">
<section class="overflow-hidden rounded-3xl bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 p-5 text-white shadow-xl sm:p-6">
<div class="flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-cyan-300">Platform</p>
<h1 class="mt-2 text-2xl font-bold tracking-tight sm:text-3xl">Pricing plans</h1>
<p class="mt-2 max-w-2xl text-sm leading-6 text-slate-300">Maintain customer-facing Basic, Advanced and Pro pricing from one administration page.</p>
</div>
<div class="flex flex-wrap gap-3">
<a href="{{ route('platform.dashboard') }}" wire:navigate class="rounded-xl border border-white/15 bg-white/10 px-4 py-2 text-sm font-semibold text-white backdrop-blur hover:bg-white/15">Platform dashboard</a>
<a href="{{ route('platform.prices.create') }}" wire:navigate class="rounded-xl bg-cyan-300 px-4 py-2 text-sm font-bold text-slate-950 shadow-lg shadow-cyan-950/30 hover:bg-cyan-200">Add price</a>
</div>
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<p class="text-sm font-semibold text-zinc-500 dark:text-zinc-400">
Customer-facing plan cards managed from Platform.
</p>
</div>
</section>
<div class="flex flex-wrap gap-3">
<a href="{{ route('platform.dashboard') }}" wire:navigate class="rounded-xl border border-zinc-200 bg-white px-4 py-2 text-sm font-semibold text-zinc-700 shadow-sm hover:border-cyan-400 hover:text-cyan-700 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-200">
Platform dashboard
</a>
<a href="{{ route('platform.prices.create') }}" wire:navigate class="rounded-xl bg-cyan-500 px-4 py-2 text-sm font-bold text-slate-950 shadow-lg shadow-cyan-950/20 hover:bg-cyan-400">
Add price
</a>
</div>
</div>
@if (session('status'))
<div class="rounded-2xl border border-emerald-200 bg-emerald-50 px-5 py-4 text-sm font-semibold text-emerald-800 dark:border-emerald-900/60 dark:bg-emerald-950/40 dark:text-emerald-200">
@@ -29,31 +32,49 @@
? 'from-cyan-500 to-blue-600'
: ($isBasic ? 'from-slate-700 to-slate-900' : 'from-indigo-600 to-violet-700');
@endphp
<article class="relative overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm transition hover:-translate-y-0.5 hover:shadow-xl dark:border-zinc-800 dark:bg-zinc-900">
@if ($price->is_featured)
<div class="absolute right-4 top-4 z-10 rounded-full bg-white px-3 py-1 text-xs font-extrabold uppercase tracking-wide text-cyan-700 shadow">Featured</div>
<div class="absolute right-4 top-4 z-10 rounded-full bg-white px-3 py-1 text-xs font-extrabold uppercase tracking-wide text-cyan-700 shadow">
Featured
</div>
@endif
<div class="bg-gradient-to-br {{ $headerClass }} p-5 text-white">
<div class="flex items-start justify-between gap-4">
<div>
<p class="text-xs font-bold uppercase tracking-[0.24em] text-white/70">{{ $price->badge_label ?: 'Plan' }}</p>
<p class="text-xs font-bold uppercase tracking-[0.24em] text-white/70">
{{ $price->badge_label ?: 'Plan' }}
</p>
<h2 class="mt-2 text-2xl font-black tracking-tight">{{ $price->name }}</h2>
</div>
<span class="grid h-11 w-11 place-items-center rounded-2xl bg-white/15 text-lg backdrop-blur">
<i class="fa-solid {{ $isBasic ? 'fa-box' : ($isAdvanced ? 'fa-layer-group' : 'fa-crown') }}" aria-hidden="true"></i>
</span>
</div>
<p class="mt-3 text-sm leading-6 text-white/80">{{ $price->strapline }}</p>
</div>
<div class="p-5">
<div class="flex items-end gap-2">
<span class="text-4xl font-black tracking-tight text-zinc-950 dark:text-white">{{ $price->formatAmount($price->monthly_amount) }}</span>
<span class="text-4xl font-black tracking-tight text-zinc-950 dark:text-white">
{{ $price->formatAmount($price->monthly_amount) }}
</span>
<span class="pb-1 text-sm font-semibold text-zinc-500">/ month</span>
</div>
<p class="mt-2 text-sm text-zinc-500">Annual: <span class="font-semibold text-zinc-700 dark:text-zinc-200">{{ $price->formatAmount($price->annual_amount) }}</span></p>
<p class="mt-4 min-h-12 text-sm leading-6 text-zinc-600 dark:text-zinc-300">{{ $price->description }}</p>
<p class="mt-2 text-sm text-zinc-500">
Annual:
<span class="font-semibold text-zinc-700 dark:text-zinc-200">
{{ $price->formatAmount($price->annual_amount) }}
</span>
</p>
<p class="mt-4 min-h-12 text-sm leading-6 text-zinc-600 dark:text-zinc-300">
{{ $price->description }}
</p>
<ul class="mt-5 space-y-3 text-sm text-zinc-700 dark:text-zinc-200">
@foreach ($price->featureRows() as $feature)
@@ -68,12 +89,17 @@
<span class="rounded-full px-3 py-1 text-xs font-bold {{ $price->is_active ? 'bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200' : 'bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300' }}">
{{ $price->is_active ? 'Active' : 'Hidden' }}
</span>
<div class="flex items-center gap-2">
<a href="{{ route('platform.prices.edit', $price) }}" wire:navigate class="rounded-lg border border-zinc-200 px-3 py-2 text-sm font-semibold text-zinc-700 hover:border-cyan-400 hover:text-cyan-700 dark:border-zinc-700 dark:text-zinc-200">Edit</a>
<a href="{{ route('platform.prices.edit', $price) }}" wire:navigate class="rounded-lg border border-zinc-200 px-3 py-2 text-sm font-semibold text-zinc-700 hover:border-cyan-400 hover:text-cyan-700 dark:border-zinc-700 dark:text-zinc-200">
Edit
</a>
<form method="POST" action="{{ route('platform.prices.destroy', $price) }}" onsubmit="return confirm('Delete this price?');">
@csrf
@method('DELETE')
<button type="submit" class="rounded-lg border border-red-200 px-3 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 dark:border-red-900/70 dark:hover:bg-red-950/40">Delete</button>
<button type="submit" class="rounded-lg border border-red-200 px-3 py-2 text-sm font-semibold text-red-600 hover:bg-red-50 dark:border-red-900/70 dark:hover:bg-red-950/40">
Delete
</button>
</form>
</div>
</div>
@@ -0,0 +1,85 @@
<x-layouts::app :title="__('Pricing')">
<div class="space-y-6">
<section class="overflow-hidden rounded-3xl bg-gradient-to-br from-slate-950 via-slate-900 to-cyan-950 p-6 text-white shadow-xl sm:p-8">
<div class="flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-sm font-semibold uppercase tracking-[0.3em] text-cyan-300">Platform</p>
<h1 class="mt-3 text-3xl font-bold tracking-tight sm:text-5xl">Platform pricing</h1>
<p class="mt-3 max-w-2xl text-slate-300">Choose the right WMS plan for warehouse visibility, operational control and enterprise-grade administration.</p>
</div>
<div class="grid gap-3 sm:min-w-80 sm:grid-cols-2">
<div class="rounded-2xl bg-white/10 p-4 backdrop-blur">
<p class="text-sm text-slate-300">Plans</p>
<p class="mt-2 flex items-center gap-2 text-2xl font-bold text-emerald-300">
<i class="fa-solid fa-layer-group" aria-hidden="true"></i>
{{ $prices->count() }}
</p>
</div>
<div class="rounded-2xl bg-white/10 p-4 backdrop-blur">
<p class="text-sm text-slate-300">Billing</p>
<p class="mt-2 text-2xl font-bold">Monthly</p>
</div>
</div>
</div>
</section>
<section class="grid gap-5 lg:grid-cols-3">
@forelse ($prices as $price)
@php
$isBasic = $price->code === 'basic';
$isAdvanced = $price->code === 'advanced';
$headerClass = $isAdvanced
? 'from-cyan-500 to-blue-600'
: ($isBasic ? 'from-slate-700 to-slate-950' : 'from-indigo-600 to-violet-700');
@endphp
<article class="relative overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm transition hover:-translate-y-0.5 hover:shadow-xl dark:border-zinc-800 dark:bg-zinc-900">
@if ($price->is_featured)
<div class="absolute right-4 top-4 z-10 rounded-full bg-white px-3 py-1 text-xs font-extrabold uppercase tracking-wide text-cyan-700 shadow">{{ $price->badge_label ?: 'Popular' }}</div>
@endif
<div class="bg-gradient-to-br {{ $headerClass }} p-6 text-white">
<div class="flex items-start justify-between gap-4">
<div>
<p class="text-xs font-bold uppercase tracking-[0.24em] text-white/70">{{ $price->badge_label ?: 'Plan' }}</p>
<h2 class="mt-2 text-3xl font-black tracking-tight">{{ $price->name }}</h2>
</div>
<span class="grid h-12 w-12 place-items-center rounded-2xl bg-white/15 text-xl backdrop-blur">
<i class="fa-solid {{ $isBasic ? 'fa-box' : ($isAdvanced ? 'fa-layer-group' : 'fa-crown') }}" aria-hidden="true"></i>
</span>
</div>
<p class="mt-4 text-sm leading-6 text-white/80">{{ $price->strapline }}</p>
</div>
<div class="p-6">
<div class="flex items-end gap-2">
<span class="text-4xl font-black tracking-tight text-zinc-950 dark:text-white">{{ $price->formatAmount($price->monthly_amount) }}</span>
<span class="pb-1 text-sm font-semibold text-zinc-500">/ month</span>
</div>
@if ($price->annual_amount)
<p class="mt-2 text-sm text-zinc-500">Annual: <span class="font-semibold text-zinc-700 dark:text-zinc-200">{{ $price->formatAmount($price->annual_amount) }}</span></p>
@endif
<p class="mt-4 min-h-12 text-sm leading-6 text-zinc-600 dark:text-zinc-300">{{ $price->description }}</p>
<ul class="mt-5 space-y-3 text-sm text-zinc-700 dark:text-zinc-200">
@foreach ($price->featureRows() as $feature)
<li class="flex gap-3">
<i class="fa-solid fa-check mt-1 text-cyan-500" aria-hidden="true"></i>
<span>{{ $feature }}</span>
</li>
@endforeach
</ul>
</div>
</article>
@empty
<article class="rounded-3xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
<h2 class="text-xl font-bold">No active prices</h2>
<p class="mt-2 text-sm text-zinc-500">Add active pricing records from Administration to populate this page.</p>
</article>
@endforelse
</section>
</div>
</x-layouts::app>
+8
View File
@@ -8,6 +8,14 @@ use Modules\Platform\app\Http\Controllers\PlatformDashboardController;
use Modules\Platform\app\Http\Controllers\PlatformPriceController;
use Modules\Platform\app\Http\Controllers\StripeWebhookController;
Route::middleware(['auth', 'verified', 'tenant.assigned'])
->prefix('platform')
->name('platform.')
->group(function (): void {
Route::get('/pricing', [PlatformPriceController::class, 'publicIndex'])->name('pricing.index');
});
Route::middleware(['auth', 'verified', 'tenant.assigned', 'platform.admin'])
->prefix('admin')
->name('platform.')