Summary of completed work: - Complete buyer portal (browse, cart, checkout, orders, invoices) - Complete seller portal (orders, manifests, fleet, picking) - Business onboarding wizards (buyer 4-step, seller 5-step) - Email verification and registration flows - Notification system for buyers and sellers - Payment term surcharges and pickup/delivery workflows - Filament admin resources (Business, Brand, Product, Order, Invoice, User) - 51 migrations executed successfully Renamed Company -> Business throughout codebase for consistency. Unified authentication flows with password reset. Added audit trail and telescope for debugging. Next: Week 4 Data Migration (Days 22-28) - Product migration (883 products from cannabrands_crm) - Company migration (81 buyer companies) - User migration (preserve password hashes) - Order history migration
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Company;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
/**
|
|
* Main dashboard for cannabis businesses
|
|
* Shows sales metrics, orders, and business performance
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
$user = $request->user();
|
|
|
|
// Get user's primary business
|
|
$business = $user->primaryBusiness();
|
|
|
|
// Check onboarding status
|
|
$needsOnboarding = !$user->business_onboarding_completed
|
|
|| ($business && in_array($business->status, ['not_started', 'in_progress', 'rejected']));
|
|
|
|
$isPending = $business && $business->status === 'submitted';
|
|
$isRejected = $business && $business->status === 'rejected';
|
|
|
|
// TODO: Replace with real data from models
|
|
$dashboardData = [
|
|
'revenue' => [
|
|
'current' => 12847,
|
|
'previous' => 10887,
|
|
'change' => 18.2
|
|
],
|
|
'orders' => [
|
|
'current' => 347,
|
|
'previous' => 309,
|
|
'change' => 12.5
|
|
],
|
|
'products' => [
|
|
'current' => 89,
|
|
'previous' => 91,
|
|
'change' => -2.3
|
|
],
|
|
'avg_order_value' => [
|
|
'current' => 37.05,
|
|
'previous' => 35.23,
|
|
'change' => 5.1
|
|
]
|
|
];
|
|
|
|
// Mock progress data for now (TODO: implement proper business setup tracking)
|
|
$progressData = [];
|
|
$progressSummary = ['completion_percentage' => 100];
|
|
|
|
return view('dashboard.nexus', [
|
|
'user' => $user,
|
|
'business' => $business,
|
|
'needsOnboarding' => $needsOnboarding,
|
|
'isPending' => $isPending,
|
|
'isRejected' => $isRejected,
|
|
'dashboardData' => $dashboardData,
|
|
'progressData' => $progressData,
|
|
'progressSummary' => $progressSummary,
|
|
]);
|
|
}
|
|
}
|