# Admin Panel

The Admin Panel is the SaaS management interface where you manage tenants, plans, subscriptions, and system settings.

# Accessing the Admin Panel

# Development

http://localhost:5173/admin/login

# Production

https://yourdomain.com/admin/login

# Creating the First Admin User

If you haven't created an admin user yet:

cd server
npx ts-node prisma/create-admin.ts

Default credentials:

  • Email: admin@cloudpos.com
  • Password: admin123

⚠️ Change this password immediately after first login!

# First Steps After Login

# 1. Change Your Password

  1. Click on your profile (top right)
  2. Go to "Settings" or "Change Password"
  3. Enter current password and new password
  4. Save changes

# 2. Configure System Settings

Navigate to SettingsSystem Settings

Configure:

  • System name
  • Default timezone
  • Default currency
  • Default language
  • SaaS branding (logo, favicon)

# 3. Create Subscription Plans

Navigate to PlansCreate Plan

Set up your subscription tiers:

  • Trial - Free trial plan
  • Basic - Entry-level plan
  • Pro - Advanced plan
  • Enterprise - Full features

For each plan, configure:

  • Name and description
  • Monthly and yearly prices
  • Features list
  • Plan limits (users, branches, products, etc.)
  • Stripe Price IDs (if using Stripe)

# 4. Configure Payment Gateway

See Payment Gateway for detailed setup.

Navigate to SettingsPayment Gateways

Configure Stripe:

  • Test/Live mode toggle
  • API keys
  • Webhook secret

# 5. Configure Email Settings

See Email Notifications for detailed setup.

Navigate to SettingsEmail Configuration

Configure SMTP:

  • SMTP host, port, credentials
  • From email and name
  • Test email sending

# Admin Panel Features

# Dashboard

  • Overview of tenants, subscriptions, revenue
  • Recent activity
  • System statistics

# Tenants (Clients)

  • View all tenants
  • Create new tenant
  • Edit tenant details
  • View tenant subscription
  • Impersonate tenant (if enabled)
  • Suspend/activate tenants

# Plans

  • Create and edit subscription plans
  • Set pricing (monthly/yearly)
  • Configure plan limits
  • Set Stripe Price IDs
  • Activate/deactivate plans

# Subscriptions

  • View all subscriptions
  • Manual subscription assignment
  • View subscription history
  • Cancel subscriptions
  • View payment history

# Payment Gateways

  • Configure Stripe
  • Test/Live mode toggle
  • Webhook configuration
  • Payment gateway status

# Settings

  • System Settings: Name, timezone, currency, language
  • Email Configuration: SMTP settings, templates
  • Branding: SaaS logos, favicons
  • Security: Demo mode toggle

# Users (Admins)

  • Create admin users
  • Assign admin roles
  • Manage permissions
  • View admin activity

# Admin Roles

# SUPER_ADMIN

  • Full system access
  • Can manage everything
  • Cannot be restricted

# ADMIN

  • Admin panel access
  • Can manage tenants, plans, subscriptions
  • Limited by permissions

# FINANCE

  • Financial operations only
  • View subscriptions, payments
  • Cannot modify system settings

# Branding Settings

# SaaS Branding

Configure branding for the admin panel:

  1. Navigate to SettingsBranding
  2. Upload:
    • Logo (Light): Logo for light backgrounds
    • Logo (Dark): Logo for dark backgrounds
    • Favicon: Browser tab icon
  3. Save changes

File locations:

  • Uploads stored in: server/uploads/saas/
  • Accessible via: /uploads/saas/logo-light.png

# Landing Page Branding

Configure branding for the public landing page:

  1. Navigate to SettingsBrandingLanding Page
  2. Upload:
    • Landing Logo: Main logo
    • Landing Favicon: Browser tab icon
  3. Save changes

# Creating a New Tenant

# Method 1: Via Admin Panel

  1. Navigate to TenantsCreate Tenant
  2. Fill in:
    • Name: Company name
    • Subdomain: Unique subdomain (optional)
    • Email: Contact email
    • Phone: Contact phone (optional)
    • Address: Business address (optional)
  3. Click Create

# Method 2: Tenant Self-Registration

Tenants can register themselves:

  1. Go to: http://localhost:5173/register (dev) or https://yourdomain.com/register (prod)
  2. Fill in registration form:
    • Email
    • Password
    • First name, Last name
    • Company name (tenant name)
    • Subdomain (optional)
  3. Submit registration

Note: After registration, tenant needs to subscribe to a plan to access the system.

# Assigning Plans to Tenants

# Via Admin Panel

  1. Navigate to Tenants
  2. Click on a tenant
  3. Go to Subscription tab
  4. Click Assign Plan
  5. Select plan and billing cycle
  6. Set start/end dates (optional)
  7. Click Assign

# Via Tenant Purchase

  1. Tenant logs in
  2. Navigates to SubscriptionPlans
  3. Selects a plan
  4. Completes payment (if Stripe configured)
  5. Plan is automatically assigned

# Managing Subscriptions

# View Subscription Details

  1. Navigate to Subscriptions
  2. Click on a subscription
  3. View:
    • Plan details
    • Status (ACTIVE, TRIAL, SUSPENDED, etc.)
    • Billing cycle
    • Payment history
    • Subscription logs

# Cancel Subscription

  1. Navigate to Subscriptions
  2. Click on subscription
  3. Click Cancel Subscription
  4. Choose:
    • Cancel immediately
    • Cancel at period end
  5. Confirm cancellation

# Suspend Tenant

  1. Navigate to Tenants
  2. Click on tenant
  3. Click Suspend
  4. Tenant will lose access until reactivated

# System Settings

# General Settings

  • System Name: Name displayed in admin panel
  • Default Timezone: IANA timezone (e.g., America/New_York)
  • Default Currency: ISO currency code (e.g., USD)
  • Default Language: Language code (e.g., en)

# Google/Firebase Login (Optional)

Enable Google login for tenants:

  1. Navigate to SettingsSystem Settings
  2. Enable Google Login
  3. Configure Firebase credentials:
    • API Key
    • Auth Domain
    • Project ID
    • App ID
    • Other Firebase settings
  4. Save changes

# Troubleshooting

# Can't Login to Admin Panel

Issue: Login fails or redirects

Solutions:

  1. Verify admin user exists:

    cd server
    npx ts-node prisma/create-admin.ts
    
  2. Check credentials:

    • Email: admin@cloudpos.com (default)
    • Password: admin123 (default)
  3. Reset password (if needed):

    • Use Prisma Studio or database directly
    • Hash new password with bcrypt

# Admin Panel Shows Blank Page

Issue: Page loads but shows nothing

Solutions:

  1. Check browser console for errors
  2. Verify API is running: http://localhost:3000/api
  3. Check CORS settings in .env
  4. Clear browser cache

# Can't Create Tenant

Issue: Tenant creation fails

Solutions:

  1. Check database connection
  2. Verify subdomain is unique (if using subdomains)
  3. Check admin permissions
  4. Review server logs for errors

# Plans Not Showing

Issue: Plans don't appear in admin panel

Solutions:

  1. Create plans in Admin Panel → Plans
  2. Activate plans (toggle isActive)
  3. Check plan limits are configured
  4. Refresh page

Next: See SaaS Configuration for detailed tenant and plan management.