Platform Email Settings (Admin): - Add GET/PUT/DELETE /admin/settings/email/* endpoints - Settings stored in admin_settings table override .env values - Support all providers: SMTP, SendGrid, Mailgun, Amazon SES - Edit mode UI with provider-specific configuration forms - Reset to .env defaults functionality - Test email to verify configuration Vendor Email Settings: - Add VendorEmailSettings model with one-to-one vendor relationship - Migration: v0a1b2c3d4e5_add_vendor_email_settings.py - Service: vendor_email_settings_service.py with tier validation - API endpoints: /vendor/email-settings/* (CRUD, status, verify) - Email tab in vendor settings page with full configuration - Warning banner until email is configured (like billing warnings) - Premium providers (SendGrid, Mailgun, SES) tier-gated to Business+ Email Service Updates: - get_platform_email_config(db) checks DB first, then .env - Configurable provider classes accept config dict - EmailService uses database-aware providers - Vendor emails use vendor's own SMTP (Wizamart doesn't pay) - "Powered by Wizamart" footer for Essential/Professional tiers - White-label (no footer) for Business/Enterprise tiers Other: - Add scripts/install.py for first-time platform setup - Add make install target - Update init-prod to include email template seeding 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
181 lines
7.7 KiB
HTML
181 lines
7.7 KiB
HTML
{# app/templates/vendor/dashboard.html #}
|
|
{% extends "vendor/base.html" %}
|
|
{% from "shared/macros/feature_gate.html" import limit_warning, usage_bar, upgrade_card, tier_badge %}
|
|
{% from "shared/macros/alerts.html" import loading_state, error_state %}
|
|
{% from "shared/macros/tables.html" import table_wrapper, table_header %}
|
|
|
|
{% block title %}Dashboard{% endblock %}
|
|
|
|
{% block alpine_data %}vendorDashboard(){% endblock %}
|
|
|
|
{% from "shared/macros/feature_gate.html" import email_settings_warning %}
|
|
|
|
{% block content %}
|
|
<!-- Email Settings Warning -->
|
|
{{ email_settings_warning() }}
|
|
|
|
<!-- Limit Warnings -->
|
|
{{ limit_warning("orders") }}
|
|
{{ limit_warning("products") }}
|
|
|
|
<!-- Page Header with Refresh Button -->
|
|
{# noqa: FE-007 - Custom header with tier_badge alongside title #}
|
|
<div class="flex items-center justify-between my-6">
|
|
<div class="flex items-center gap-3">
|
|
<h2 class="text-2xl font-semibold text-gray-700 dark:text-gray-200">
|
|
Dashboard
|
|
</h2>
|
|
{{ tier_badge() }}
|
|
</div>
|
|
<button
|
|
@click="refresh()"
|
|
:disabled="loading"
|
|
class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple disabled:opacity-50 disabled:cursor-not-allowed"
|
|
>
|
|
<span x-show="!loading" x-html="$icon('refresh', 'w-4 h-4 mr-2')"></span>
|
|
<span x-show="loading" x-html="$icon('spinner', 'w-4 h-4 mr-2')"></span>
|
|
<span x-text="loading ? 'Loading...' : 'Refresh'"></span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Loading State -->
|
|
{{ loading_state('Loading dashboard...') }}
|
|
|
|
<!-- Error State -->
|
|
{{ error_state('Error loading dashboard') }}
|
|
|
|
<!-- Vendor Info Card -->
|
|
{% include 'vendor/partials/vendor_info.html' %}
|
|
|
|
<!-- Upgrade Recommendation Card (shows when approaching/at limits) -->
|
|
{{ upgrade_card(class='mb-6') }}
|
|
|
|
<!-- Stats Cards -->
|
|
<div x-show="!loading" class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4">
|
|
<!-- Card: Total Products -->
|
|
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
<div class="p-3 mr-4 text-blue-500 bg-blue-100 rounded-full dark:text-blue-100 dark:bg-blue-500">
|
|
<span x-html="$icon('shopping-bag', 'w-5 h-5')"></span>
|
|
</div>
|
|
<div>
|
|
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
|
|
Total Products
|
|
</p>
|
|
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="stats.products_count">
|
|
0
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Card: Total Orders -->
|
|
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
<div class="p-3 mr-4 text-green-500 bg-green-100 rounded-full dark:text-green-100 dark:bg-green-500">
|
|
<span x-html="$icon('shopping-cart', 'w-5 h-5')"></span>
|
|
</div>
|
|
<div>
|
|
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
|
|
Total Orders
|
|
</p>
|
|
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="stats.orders_count">
|
|
0
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Card: Total Customers -->
|
|
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
<div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500">
|
|
<span x-html="$icon('users', 'w-5 h-5')"></span>
|
|
</div>
|
|
<div>
|
|
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
|
|
Total Customers
|
|
</p>
|
|
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="stats.customers_count">
|
|
0
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Card: Revenue -->
|
|
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
<div class="p-3 mr-4 text-teal-500 bg-teal-100 rounded-full dark:text-teal-100 dark:bg-teal-500">
|
|
<span x-html="$icon('currency-euro', 'w-5 h-5')"></span>
|
|
</div>
|
|
<div>
|
|
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">
|
|
Total Revenue
|
|
</p>
|
|
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200" x-text="formatCurrency(stats.revenue)">
|
|
€0
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Usage Overview -->
|
|
<div x-show="!loading" class="grid gap-6 mb-8 md:grid-cols-3">
|
|
<div class="p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
{{ usage_bar("orders", "Monthly Orders") }}
|
|
</div>
|
|
<div class="p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
{{ usage_bar("products", "Products") }}
|
|
</div>
|
|
<div class="p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800">
|
|
{{ usage_bar("team_members", "Team Members") }}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recent Orders Table -->
|
|
<div x-show="!loading && recentOrders.length > 0" class="mb-8">
|
|
{% call table_wrapper() %}
|
|
{{ table_header(['Order ID', 'Customer', 'Amount', 'Status', 'Date']) }}
|
|
<tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
|
|
<template x-for="order in recentOrders" :key="order.id">
|
|
<tr class="text-gray-700 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">
|
|
<td class="px-4 py-3">
|
|
<span class="text-xs" x-text="'#' + order.id"></span>
|
|
</td>
|
|
<td class="px-4 py-3 text-sm" x-text="order.customer_name">
|
|
</td>
|
|
<td class="px-4 py-3 text-sm font-semibold" x-text="formatCurrency(order.total_amount)">
|
|
</td>
|
|
<td class="px-4 py-3 text-xs">
|
|
<span class="px-2 py-1 font-semibold leading-tight rounded-full"
|
|
:class="{
|
|
'text-green-700 bg-green-100 dark:bg-green-700 dark:text-green-100': order.status === 'completed',
|
|
'text-orange-700 bg-orange-100 dark:text-white dark:bg-orange-600': order.status === 'pending',
|
|
'text-blue-700 bg-blue-100 dark:bg-blue-700 dark:text-blue-100': order.status === 'processing'
|
|
}"
|
|
x-text="order.status"></span>
|
|
</td>
|
|
<td class="px-4 py-3 text-sm" x-text="formatDate(order.created_at)">
|
|
</td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
{% endcall %}
|
|
</div>
|
|
|
|
<!-- Getting Started Section -->
|
|
<div x-show="!loading && recentOrders.length === 0" class="w-full mb-8 overflow-hidden rounded-lg shadow-xs">
|
|
<div class="w-full p-8 bg-white dark:bg-gray-800 text-center">
|
|
<div class="text-6xl mb-4">🚀</div>
|
|
<h3 class="text-xl font-semibold text-gray-700 dark:text-gray-200 mb-2">
|
|
Welcome to Your Vendor Dashboard!
|
|
</h3>
|
|
<p class="text-gray-600 dark:text-gray-400 mb-6">
|
|
Start by importing products from the marketplace to build your catalog.
|
|
</p>
|
|
<a href="/vendor/{{ vendor_code }}/marketplace"
|
|
class="inline-flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
|
|
<span x-html="$icon('download', 'w-4 h-4 mr-2')"></span>
|
|
Go to Marketplace Import
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_scripts %}
|
|
<script src="{{ url_for('static', path='vendor/js/dashboard.js') }}"></script>
|
|
{% endblock %} |