new gui layout for pricing

This commit is contained in:
Mark Gregory
2026-06-11 10:47:48 +01:00
parent 071a11bf13
commit 6d081cab5b
19 changed files with 1133 additions and 346 deletions
@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use Modules\Platform\app\Models\Company;
use Modules\Platform\app\Models\LicenseKey;
use Modules\Platform\app\Models\Payment;
use Modules\Platform\app\Models\PlatformPrice;
use Modules\Warehouse\app\Models\Warehouse;
class PlatformDashboardController extends Controller
@@ -21,6 +22,7 @@ class PlatformDashboardController extends Controller
'licensesCount' => LicenseKey::count(),
'paymentsTotal' => Payment::where('status', 'paid')->sum('amount'),
'warehousesCount' => Warehouse::count(),
'pricesCount' => PlatformPrice::count(),
'companies' => Company::withCount(['users', 'warehouses', 'licenseKeys'])->latest()->limit(8)->get(),
]);
}
@@ -0,0 +1,117 @@
<?php
namespace Modules\Platform\app\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\View\View;
use Modules\Platform\app\Models\PlatformPrice;
class PlatformPriceController extends Controller
{
/**
* Display platform prices in a card grid with administration actions.
*/
public function index(): View
{
return view('platform::prices.index', [
'prices' => PlatformPrice::ordered()->get(),
]);
}
/**
* Show the create price form.
*/
public function create(): View
{
return view('platform::prices.create', [
'price' => new PlatformPrice([
'currency' => 'gbp',
'sort_order' => 40,
'is_active' => true,
'features' => [],
]),
]);
}
/**
* Store a new platform price.
*/
public function store(Request $request): RedirectResponse
{
PlatformPrice::create($this->validatedPriceData($request));
return redirect()->route('platform.prices.index')->with('status', 'Price created.');
}
/**
* Show the edit price form.
*/
public function edit(PlatformPrice $price): View
{
return view('platform::prices.edit', [
'price' => $price,
]);
}
/**
* Update an existing platform price.
*/
public function update(Request $request, PlatformPrice $price): RedirectResponse
{
$price->update($this->validatedPriceData($request, $price));
return redirect()->route('platform.prices.index')->with('status', 'Price updated.');
}
/**
* Delete a platform price.
*/
public function destroy(PlatformPrice $price): RedirectResponse
{
$price->delete();
return redirect()->route('platform.prices.index')->with('status', 'Price deleted.');
}
/**
* Validate and normalise price request data.
*
* @return array<string, mixed>
*/
private function validatedPriceData(Request $request, ?PlatformPrice $price = null): array
{
$data = $request->validate([
'code' => ['nullable', 'string', 'max:40', 'unique:platform_prices,code,' . ($price?->id ?? 'NULL')],
'name' => ['required', 'string', 'max:255'],
'strapline' => ['nullable', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:2000'],
'monthly_amount' => ['required', 'numeric', 'min:0', 'max:999999.99'],
'annual_amount' => ['nullable', 'numeric', 'min:0', 'max:999999.99'],
'currency' => ['required', 'string', 'size:3'],
'badge_label' => ['nullable', 'string', 'max:60'],
'features' => ['nullable', 'string', 'max:4000'],
'sort_order' => ['required', 'integer', 'min:0', 'max:65535'],
'is_featured' => ['nullable', 'boolean'],
'is_active' => ['nullable', 'boolean'],
]);
$data['code'] = Str::slug($data['code'] ?: $data['name']);
$data['monthly_amount'] = (int) round(((float) $data['monthly_amount']) * 100);
$data['annual_amount'] = $data['annual_amount'] === null || $data['annual_amount'] === ''
? null
: (int) round(((float) $data['annual_amount']) * 100);
$data['currency'] = strtolower($data['currency']);
$data['features'] = collect(preg_split('/\r\n|\r|\n/', (string) ($data['features'] ?? '')))
->map(fn (string $feature): string => trim($feature))
->filter()
->values()
->all();
$data['is_featured'] = $request->boolean('is_featured');
$data['is_active'] = $request->boolean('is_active');
return $data;
}
}
@@ -0,0 +1,80 @@
<?php
namespace Modules\Platform\app\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class PlatformPrice extends Model
{
protected $fillable = [
'code',
'name',
'strapline',
'description',
'monthly_amount',
'annual_amount',
'currency',
'badge_label',
'features',
'sort_order',
'is_featured',
'is_active',
];
protected $casts = [
'features' => 'array',
'monthly_amount' => 'integer',
'annual_amount' => 'integer',
'sort_order' => 'integer',
'is_featured' => 'boolean',
'is_active' => 'boolean',
];
/**
* Scope prices into display order.
*/
public function scopeOrdered(Builder $query): Builder
{
return $query->orderBy('sort_order')->orderBy('name');
}
/**
* Return the display currency symbol.
*/
public function currencySymbol(): string
{
return match (strtolower($this->currency)) {
'gbp' => '£',
'eur' => '€',
'usd' => '$',
default => strtoupper($this->currency) . ' ',
};
}
/**
* Format a stored minor-unit amount for display.
*/
public function formatAmount(?int $amount): string
{
if ($amount === null) {
return '—';
}
return $this->currencySymbol() . number_format($amount / 100, 2);
}
/**
* Return normalised feature rows.
*
* @return array<int, string>
*/
public function featureRows(): array
{
return collect($this->features ?? [])
->filter(fn ($feature): bool => is_string($feature) && trim($feature) !== '')
->map(fn (string $feature): string => trim($feature))
->values()
->all();
}
}
@@ -0,0 +1,91 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('platform_prices', function (Blueprint $table): void {
$table->id();
$table->string('code', 40)->unique();
$table->string('name');
$table->string('strapline')->nullable();
$table->text('description')->nullable();
$table->unsignedInteger('monthly_amount')->default(0);
$table->unsignedInteger('annual_amount')->nullable();
$table->string('currency', 3)->default('gbp');
$table->string('badge_label')->nullable();
$table->json('features')->nullable();
$table->unsignedSmallInteger('sort_order')->default(0)->index();
$table->boolean('is_featured')->default(false)->index();
$table->boolean('is_active')->default(true)->index();
$table->timestamps();
});
DB::table('platform_prices')->insert([
[
'code' => 'basic',
'name' => 'Basic',
'strapline' => 'Core warehouse visibility',
'description' => 'Essential WMS tools for small warehouse operations and controlled stock visibility.',
'monthly_amount' => 4900,
'annual_amount' => 49000,
'currency' => 'gbp',
'badge_label' => 'Starter',
'features' => json_encode(['Warehouse dashboard', 'Inventory overview', 'Basic audit trail', 'Email support']),
'sort_order' => 10,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'advanced',
'name' => 'Advanced',
'strapline' => 'Operational control suite',
'description' => 'Expanded controls for teams that need replenishment, reporting and integration monitoring.',
'monthly_amount' => 9900,
'annual_amount' => 99000,
'currency' => 'gbp',
'badge_label' => 'Popular',
'features' => json_encode(['Everything in Basic', 'Replenishment workflows', 'Reporting workspace', 'M3 integration status', 'Priority support']),
'sort_order' => 20,
'is_featured' => true,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
[
'code' => 'pro',
'name' => 'Pro',
'strapline' => 'Enterprise-grade administration',
'description' => 'Full platform administration for regulated warehouse, carrier and document operations.',
'monthly_amount' => 19900,
'annual_amount' => 199000,
'currency' => 'gbp',
'badge_label' => 'Enterprise',
'features' => json_encode(['Everything in Advanced', 'Multi-company administration', 'Security and audit controls', 'Document archive', 'Carrier management', 'Dedicated support']),
'sort_order' => 30,
'is_featured' => false,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
],
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('platform_prices');
}
};
@@ -1,7 +1,30 @@
<x-layouts::app :title="__('Platform')">
<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">MPBA WMS</p>
<h1 class="mt-3 text-3xl font-bold tracking-tight sm:text-5xl">Platform administration</h1>
<p class="mt-3 max-w-2xl text-slate-300">Manage tenant companies, licences, payments, warehouses and internal API operations from one resilient control plane.</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">System status</p>
<p class="mt-2 flex items-center gap-2 text-2xl font-bold text-emerald-300">
<i class="fa-solid fa-heart-pulse" aria-hidden="true"></i>
OK
</p>
</div>
<div class="rounded-2xl bg-white/10 p-4 backdrop-blur">
<p class="text-sm text-slate-300">Paid £</p>
<p class="mt-2 text-2xl font-bold">{{ number_format($paymentsTotal / 100, 2) }}</p>
</div>
</div>
</div>
</section>
<section class="grid gap-4 sm:grid-cols-2 xl:grid-cols-4">
@foreach ([['Companies', $companiesCount], ['Active', $activeCompaniesCount], ['Warehouses', $warehousesCount], ['Licences', $licensesCount]] as [$label, $value])
@foreach ([['Companies', $companiesCount], ['Active', $activeCompaniesCount], ['Warehouses', $warehousesCount], ['Prices', $pricesCount], ['Licences', $licensesCount]] as [$label, $value])
<article class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
<p class="text-sm text-zinc-500 dark:text-zinc-400">{{ $label }}</p>
<p class="mt-2 text-3xl font-bold text-zinc-900 dark:text-white">{{ $value }}</p>
@@ -15,7 +38,7 @@
<h2 class="text-lg font-semibold text-zinc-900 dark:text-white">Recent companies</h2>
<p class="text-sm text-zinc-500">Tenant isolation is enforced by company ownership on every warehouse record.</p>
</div>
<a href="{{ route('platform.companies.index') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white dark:bg-white dark:text-zinc-900">Manage companies</a>
<div class="flex flex-wrap gap-2"><a href="{{ route('platform.prices.index') }}" wire:navigate class="rounded-lg border border-zinc-200 px-4 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">Manage prices</a><a href="{{ route('platform.companies.index') }}" wire:navigate class="rounded-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white dark:bg-white dark:text-zinc-900">Manage companies</a></div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-zinc-200 text-sm dark:divide-zinc-800">
@@ -0,0 +1,77 @@
@php
$featuresText = old('features', implode("\n", $price->featureRows()));
@endphp
<div class="grid gap-5 lg:grid-cols-2">
<div>
<label for="name" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Name</label>
<input id="name" name="name" value="{{ old('name', $price->name) }}" required class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="Basic">
@error('name')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="code" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Code</label>
<input id="code" name="code" value="{{ old('code', $price->code) }}" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="basic">
@error('code')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="strapline" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Strapline</label>
<input id="strapline" name="strapline" value="{{ old('strapline', $price->strapline) }}" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="Core warehouse visibility">
@error('strapline')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="badge_label" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Badge label</label>
<input id="badge_label" name="badge_label" value="{{ old('badge_label', $price->badge_label) }}" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="Popular">
@error('badge_label')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="monthly_amount" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Monthly price</label>
<input id="monthly_amount" name="monthly_amount" type="number" step="0.01" min="0" value="{{ old('monthly_amount', $price->exists ? number_format($price->monthly_amount / 100, 2, '.', '') : '0.00') }}" required class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="99.00">
@error('monthly_amount')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="annual_amount" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Annual price</label>
<input id="annual_amount" name="annual_amount" type="number" step="0.01" min="0" value="{{ old('annual_amount', $price->annual_amount !== null ? number_format($price->annual_amount / 100, 2, '.', '') : '') }}" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="990.00">
@error('annual_amount')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="currency" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Currency</label>
<input id="currency" name="currency" value="{{ old('currency', $price->currency ?: 'gbp') }}" maxlength="3" required class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm uppercase dark:border-zinc-700 dark:bg-zinc-950" placeholder="gbp">
@error('currency')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div>
<label for="sort_order" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Sort order</label>
<input id="sort_order" name="sort_order" type="number" min="0" value="{{ old('sort_order', $price->sort_order ?? 0) }}" required class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950">
@error('sort_order')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div class="lg:col-span-2">
<label for="description" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Description</label>
<textarea id="description" name="description" rows="3" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="Short customer-facing description">{{ old('description', $price->description) }}</textarea>
@error('description')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div class="lg:col-span-2">
<label for="features" class="text-sm font-semibold text-zinc-700 dark:text-zinc-200">Features</label>
<textarea id="features" name="features" rows="6" class="mt-2 w-full rounded-xl border-zinc-300 bg-white px-4 py-3 text-sm dark:border-zinc-700 dark:bg-zinc-950" placeholder="One feature per line">{{ $featuresText }}</textarea>
@error('features')<p class="mt-1 text-sm text-red-500">{{ $message }}</p>@enderror
</div>
<div class="flex flex-wrap gap-4 lg:col-span-2">
<label class="inline-flex items-center gap-2 rounded-xl border border-zinc-200 bg-zinc-50 px-4 py-3 text-sm font-semibold dark:border-zinc-800 dark:bg-zinc-950">
<input type="checkbox" name="is_featured" value="1" @checked(old('is_featured', $price->is_featured)) class="rounded border-zinc-300">
Featured price
</label>
<label class="inline-flex items-center gap-2 rounded-xl border border-zinc-200 bg-zinc-50 px-4 py-3 text-sm font-semibold dark:border-zinc-800 dark:bg-zinc-950">
<input type="checkbox" name="is_active" value="1" @checked(old('is_active', $price->is_active ?? true)) class="rounded border-zinc-300">
Active
</label>
</div>
</div>
@@ -0,0 +1,26 @@
<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>
<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">
@csrf
@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>
</div>
</form>
</section>
</div>
</x-layouts::app>
@@ -0,0 +1,27 @@
<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>
<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">
@csrf
@method('PUT')
@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>
</div>
</form>
</section>
</div>
</x-layouts::app>
@@ -0,0 +1,85 @@
<x-layouts::app :title="__('Platform Prices')">
<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>
</section>
@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">
{{ session('status') }}
</div>
@endif
<section class="grid gap-5 lg:grid-cols-3">
@foreach ($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-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>
@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>
<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="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>
<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 class="mt-6 flex items-center justify-between gap-3 border-t border-zinc-100 pt-4 dark:border-zinc-800">
<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>
<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>
</form>
</div>
</div>
</div>
</article>
@endforeach
</section>
</div>
</x-layouts::app>
+2
View File
@@ -5,6 +5,7 @@ use Modules\Platform\app\Http\Controllers\CompanyController;
use Modules\Platform\app\Http\Controllers\LicenseKeyController;
use Modules\Platform\app\Http\Controllers\PaymentController;
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', 'platform.admin'])
@@ -18,6 +19,7 @@ Route::middleware(['auth', 'verified', 'tenant.assigned', 'platform.admin'])
Route::post('/licenses', [LicenseKeyController::class, 'store'])->name('licenses.store');
Route::get('/payments', [PaymentController::class, 'index'])->name('payments.index');
Route::post('/payments', [PaymentController::class, 'store'])->name('payments.store');
Route::resource('/prices', PlatformPriceController::class)->except(['show']);
});
Route::post('/stripe/webhook', StripeWebhookController::class)->name('stripe.webhook');