@extends('layouts.app') @section('title', $plan->exists ? __('Edit plan') : __('New plan')) @section('content') @php $catalog = config('subscriptions'); $isNew = ! $plan->exists; $action = $isNew ? route('super-admin.plans.store') : route('super-admin.plans.update', $plan); // Group quotas by their 'group' meta key (usage / seats / files / integrations). $quotaGroups = []; foreach ($catalog['quotas'] as $key => $meta) { $quotaGroups[$meta['group'] ?? 'usage'][$key] = $meta; } $groupMeta = [ 'usage' => ['label' => __('Usage'), 'icon' => 'chart', 'classes' => 'bg-sky-100 dark:bg-sky-900/30 text-sky-600 dark:text-sky-300'], 'seats' => ['label' => __('Seats'), 'icon' => 'users', 'classes' => 'bg-violet-100 dark:bg-violet-900/30 text-violet-600 dark:text-violet-300'], 'files' => ['label' => __('Files & storage'), 'icon' => 'archive', 'classes' => 'bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-300'], 'integrations' => ['label' => __('Integrations'), 'icon' => 'globe', 'classes' => 'bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-300'], ]; // Quick-set chip presets per unit type. $quotaPresets = [ 'count' => [10, 100, 1000, 10000], 'MB' => [5, 25, 100, 500], 'GB' => [1, 10, 100, 1000], 'days' => [30, 90, 365, 1095], ]; // Pricing preview values $monthly = old('price_monthly', $version->price_monthly); $yearly = old('price_yearly', $version->price_yearly); // Build the grouped feature list for the Features tab. The flat // `features` map stays authoritative; `feature_groups` only governs // presentation. Any feature missing from the groups falls into 'other' // so nothing silently disappears when the catalog grows. $featureGroupsCfg = $catalog['feature_groups'] ?? []; $assignedFeatures = []; $featureGroups = []; foreach ($featureGroupsCfg as $gKey => $gMeta) { $items = []; foreach (($gMeta['features'] ?? []) as $fKey) { if (! array_key_exists($fKey, $catalog['features'])) continue; $items[$fKey] = $catalog['features'][$fKey]; $assignedFeatures[$fKey] = true; } if (! empty($items)) { $featureGroups[$gKey] = [ 'label' => $gMeta['label'] ?? ucfirst($gKey), 'icon' => $gMeta['icon'] ?? 'check', 'classes' => $gMeta['classes'] ?? 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300', 'features' => $items, ]; } } $unassigned = array_diff_key($catalog['features'], $assignedFeatures); if (! empty($unassigned)) { $featureGroups['other'] = [ 'label' => 'Other', 'icon' => 'cog', 'classes' => 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300', 'features' => $unassigned, ]; } @endphp
{{ __('Version') }}: v{{ $version->version ?? 1 }} ·
{{ __('Code') }}: {{ $plan->code }} ·
{{ __(ucfirst($plan->status)) }}