feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
import { createSignal, Show } from 'solid-js';
|
|
|
|
|
|
|
|
|
|
const API = '/api/gateway';
|
|
|
|
|
|
|
|
|
|
type UserReport = {
|
|
|
|
|
total_users?: number;
|
|
|
|
|
new_users?: number;
|
|
|
|
|
active_users?: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type RevenueReport = {
|
|
|
|
|
total_revenue?: number;
|
|
|
|
|
total_orders?: number;
|
|
|
|
|
total_tracecoins_sold?: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function ReportPage() {
|
|
|
|
|
const [from, setFrom] = createSignal('');
|
|
|
|
|
const [to, setTo] = createSignal('');
|
|
|
|
|
const [loading, setLoading] = createSignal(false);
|
|
|
|
|
const [error, setError] = createSignal('');
|
|
|
|
|
const [userReport, setUserReport] = createSignal<UserReport | null>(null);
|
|
|
|
|
const [revenueReport, setRevenueReport] = createSignal<RevenueReport | null>(null);
|
|
|
|
|
|
|
|
|
|
const handleLoad = async (e: Event) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (!from() || !to()) return;
|
|
|
|
|
try {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
setError('');
|
|
|
|
|
const [usersRes, revenueRes] = await Promise.all([
|
|
|
|
|
fetch(`${API}/api/admin/reports/users?from=${from()}&to=${to()}`),
|
|
|
|
|
fetch(`${API}/api/admin/reports/revenue?from=${from()}&to=${to()}`),
|
|
|
|
|
]);
|
|
|
|
|
if (!usersRes.ok || !revenueRes.ok) throw new Error('Failed to load report data');
|
|
|
|
|
const [usersData, revenueData] = await Promise.all([usersRes.json(), revenueRes.json()]);
|
|
|
|
|
setUserReport(usersData);
|
|
|
|
|
setRevenueReport(revenueData);
|
|
|
|
|
} catch (err: any) {
|
|
|
|
|
setError(err.message || 'Failed to load reports');
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
ui(step-3): apply reference layout to 14 more management pages
- pricing, credit, coupon, discount, tax, order, invoice: white header,
data-table/table-card, navy buttons, inline styles removed
- review, leads, jobs, notifications, support, report, ledger: same
pattern + orange tab underlines where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 05:20:55 +01:00
|
|
|
<div class="flex flex-col -mx-6 -mt-6 min-h-full">
|
|
|
|
|
<div class="bg-white border-b border-gray-200 px-6 py-4">
|
|
|
|
|
<h1 class="text-xl font-semibold text-gray-900">Report Management</h1>
|
|
|
|
|
<p class="text-sm text-gray-500 mt-0.5">View platform analytics and generate reports.</p>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
</div>
|
|
|
|
|
|
ui(step-3): apply reference layout to 14 more management pages
- pricing, credit, coupon, discount, tax, order, invoice: white header,
data-table/table-card, navy buttons, inline styles removed
- review, leads, jobs, notifications, support, report, ledger: same
pattern + orange tab underlines where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 05:20:55 +01:00
|
|
|
<div class="flex-1 p-6">
|
|
|
|
|
<section class="rounded-xl border border-gray-200 bg-white shadow-sm" style="margin-bottom:16px">
|
|
|
|
|
<h2 style="margin:0 0 16px;font-size:16px;font-weight:700">Date Range</h2>
|
|
|
|
|
<form onSubmit={handleLoad} style="display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap">
|
|
|
|
|
<div>
|
|
|
|
|
<label style="display:block;font-size:13px;font-weight:600;margin-bottom:4px">From</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
value={from()}
|
|
|
|
|
onInput={(e) => setFrom(e.currentTarget.value)}
|
|
|
|
|
required
|
|
|
|
|
style="padding:8px 10px;border:1px solid #e2e8f0;border-radius:6px;font-size:14px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label style="display:block;font-size:13px;font-weight:600;margin-bottom:4px">To</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
value={to()}
|
|
|
|
|
onInput={(e) => setTo(e.currentTarget.value)}
|
|
|
|
|
required
|
|
|
|
|
style="padding:8px 10px;border:1px solid #e2e8f0;border-radius:6px;font-size:14px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-24 08:10:29 +01:00
|
|
|
<button class="btn-primary" type="submit" disabled={loading()}>
|
ui(step-3): apply reference layout to 14 more management pages
- pricing, credit, coupon, discount, tax, order, invoice: white header,
data-table/table-card, navy buttons, inline styles removed
- review, leads, jobs, notifications, support, report, ledger: same
pattern + orange tab underlines where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 05:20:55 +01:00
|
|
|
{loading() ? 'Loading...' : 'Load Report'}
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
<Show when={error()}>
|
|
|
|
|
<div class="mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700" style="margin-top:12px">{error()}</div>
|
|
|
|
|
</Show>
|
|
|
|
|
</section>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
ui(step-3): apply reference layout to 14 more management pages
- pricing, credit, coupon, discount, tax, order, invoice: white header,
data-table/table-card, navy buttons, inline styles removed
- review, leads, jobs, notifications, support, report, ledger: same
pattern + orange tab underlines where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 05:20:55 +01:00
|
|
|
<Show when={userReport() || revenueReport()}>
|
|
|
|
|
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px;margin-bottom:16px">
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">Total Users</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">{userReport()?.total_users ?? '—'}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">New Users</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">{userReport()?.new_users ?? '—'}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">Active Users</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">{userReport()?.active_users ?? '—'}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">Total Revenue</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">
|
|
|
|
|
{revenueReport()?.total_revenue != null ? `₹${(revenueReport()!.total_revenue! / 100).toFixed(2)}` : '—'}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">Total Orders</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">{revenueReport()?.total_orders ?? '—'}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white shadow-sm" style="text-align:center">
|
|
|
|
|
<p style="margin:0 0 8px;font-size:13px;color:#64748b;font-weight:600">TraceCoins Sold</p>
|
|
|
|
|
<p style="margin:0;font-size:28px;font-weight:700;color:#0f172a">{revenueReport()?.total_tracecoins_sold ?? '—'}</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Show>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
</div>
|
ui(step-3): apply reference layout to 14 more management pages
- pricing, credit, coupon, discount, tax, order, invoice: white header,
data-table/table-card, navy buttons, inline styles removed
- review, leads, jobs, notifications, support, report, ledger: same
pattern + orange tab underlines where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 05:20:55 +01:00
|
|
|
</div>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
);
|
|
|
|
|
}
|