diff --git a/src/components/AdminShell.tsx b/src/components/AdminShell.tsx index e69f188..3d2ea04 100644 --- a/src/components/AdminShell.tsx +++ b/src/components/AdminShell.tsx @@ -12,6 +12,7 @@ const TAB_SETS: Array<{ prefixes: string[]; tabs: Tab[] }> = [ tabs: [ { href: '/admin/roles', label: 'Internal Roles', exact: true }, { href: '/admin/roles/create', label: 'Create Role' }, + { href: '/admin/roles/templates', label: 'Role Templates' }, ], }, { @@ -50,6 +51,14 @@ const TAB_SETS: Array<{ prefixes: string[]; tabs: Tab[] }> = [ ]; const PAGE_TITLES: Array<{ prefix: string; title: string }> = [ + { prefix: '/admin/workspace', title: 'Dashboard Workspace' }, + { prefix: '/admin/settings', title: 'Settings' }, + { prefix: '/admin/role-modules', title: 'Role Modules' }, + { prefix: '/admin/modules', title: 'Module Management' }, + { prefix: '/admin/responses', title: 'Lead Responses' }, + { prefix: '/admin/applications', title: 'Applications' }, + { prefix: '/admin/financial', title: 'Financial Management' }, + { prefix: '/admin/help', title: 'Support Management' }, { prefix: '/admin/verification-status', title: 'Verification Status' }, { prefix: '/admin/verification', title: 'Verification Review' }, { prefix: '/admin/approval', title: 'Approval Management' }, @@ -69,7 +78,10 @@ const PAGE_TITLES: Array<{ prefix: string; title: string }> = [ { prefix: '/admin/ledger', title: 'Ledger Management' }, { prefix: '/admin/report', title: 'Report Management' }, { prefix: '/admin/roles', title: 'Internal Role Management' }, + { prefix: '/admin/external-role-management', title: 'External Role Management' }, + { prefix: '/admin/internal-role-management', title: 'Internal Role Management' }, { prefix: '/admin/runtime-roles', title: 'External Role Management' }, + { prefix: '/admin/onboarding-management', title: 'Onboarding Management' }, { prefix: '/admin/onboarding-schemas', title: 'Onboarding Management' }, { prefix: '/admin', title: 'Dashboard' }, ]; diff --git a/src/routes/admin/applications.tsx b/src/routes/admin/applications.tsx new file mode 100644 index 0000000..d756c2a --- /dev/null +++ b/src/routes/admin/applications.tsx @@ -0,0 +1,9 @@ +import { onMount } from 'solid-js'; +import { useNavigate } from '@solidjs/router'; +import AdminShell from '~/components/AdminShell'; + +export default function ApplicationsAliasPage() { + const navigate = useNavigate(); + onMount(() => navigate('/admin/jobs', { replace: true })); + return

Redirecting to jobs management...

; +} diff --git a/src/routes/admin/company.tsx b/src/routes/admin/company.tsx index 2ffcc94..bb1b926 100644 --- a/src/routes/admin/company.tsx +++ b/src/routes/admin/company.tsx @@ -77,6 +77,7 @@ export default function CompanyPage() {

Company Management

Manage all company accounts on the platform.

+ Create Company diff --git a/src/routes/admin/company/[id].tsx b/src/routes/admin/company/[id].tsx new file mode 100644 index 0000000..f5fd66d --- /dev/null +++ b/src/routes/admin/company/[id].tsx @@ -0,0 +1,101 @@ +import { A, useParams } from '@solidjs/router'; +import { createMemo, createResource, Show } from 'solid-js'; +import AdminShell from '~/components/AdminShell'; + +const API = '/api/gateway'; + +type CompanyDetail = { + id: string; + company_name?: string; + companyName?: string; + company_id?: string; + companyId?: string; + industry?: string; + email?: string; + phone?: string; + website_url?: string; + websiteUrl?: string; + city?: string; + state?: string; + address?: string; + status?: string; + is_verified?: boolean; + isVerified?: boolean; + description?: string; + pan?: string; + gst?: string; + tan?: string; +}; + +async function fetchCompany(id: string): Promise { + try { + const res = await fetch(`${API}/api/admin/companies/${id}`); + if (!res.ok) return null; + const data = await res.json(); + return data.company || data; + } catch { + return null; + } +} + +export default function CompanyDetailPage() { + const params = useParams(); + const [company] = createResource(() => params.id, fetchCompany); + + const name = createMemo(() => company()?.company_name || company()?.companyName || 'Company'); + const cid = createMemo(() => company()?.company_id || company()?.companyId || company()?.id || '—'); + const website = createMemo(() => company()?.website_url || company()?.websiteUrl || ''); + const isVerified = createMemo(() => Boolean(company()?.is_verified ?? company()?.isVerified)); + + return ( + +
+
+

Company Detail

+

Review company profile, contact details, and verification readiness.

+
+ +
+ + +

Loading company...

+
+ +

Company not found.

+
+ + +
+
+

Company

+

Name: {name()}

+

Company ID: {cid()}

+

Industry: {company()!.industry || '—'}

+

Status: {company()!.status || '—'}

+

Verification: {isVerified() ? 'Verified' : 'Not Verified'}

+
+
+

Contact

+

Email: {company()!.email || '—'}

+

Phone: {company()!.phone || '—'}

+

City/State: {[company()!.city, company()!.state].filter(Boolean).join(', ') || '—'}

+

Address: {company()!.address || '—'}

+

Website: {website() ? {website()} : '—'}

+
+
+ +
+

Compliance

+
+

PAN: {company()!.pan || '—'}

+

GST: {company()!.gst || '—'}

+

TAN: {company()!.tan || '—'}

+
+
+
+
+ ); +} diff --git a/src/routes/admin/company/create.tsx b/src/routes/admin/company/create.tsx new file mode 100644 index 0000000..f92546a --- /dev/null +++ b/src/routes/admin/company/create.tsx @@ -0,0 +1,111 @@ +import { A, useNavigate } from '@solidjs/router'; +import { createSignal, Show } from 'solid-js'; +import AdminShell from '~/components/AdminShell'; + +const API = '/api/gateway'; + +export default function CreateCompanyPage() { + const navigate = useNavigate(); + const [saving, setSaving] = createSignal(false); + const [error, setError] = createSignal(''); + const [form, setForm] = createSignal({ + companyName: '', + companyId: '', + address: '', + email: '', + phone: '', + industry: 'TECHNOLOGY', + description: '', + websiteUrl: '', + }); + + const setField = (k: keyof ReturnType, v: string) => { + setForm((prev) => ({ ...prev, [k]: v })); + }; + + const submit = async (e: Event) => { + e.preventDefault(); + const f = form(); + if (!f.companyName.trim() || !f.companyId.trim() || !f.address.trim() || !f.email.trim() || !f.phone.trim()) { + setError('Please fill all required fields.'); + return; + } + try { + setSaving(true); + setError(''); + const res = await fetch(`${API}/api/admin/companies`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(f), + }); + if (!res.ok) { + const payload = await res.json().catch(() => ({})); + throw new Error(payload.message || 'Failed to create company'); + } + navigate('/admin/company'); + } catch (err: any) { + setError(err.message || 'Failed to create company'); + } finally { + setSaving(false); + } + }; + + return ( + +
+
+

Create Company

+

Add a new organization profile to the admin company catalog.

+
+ Back to Companies +
+ + +
{error()}
+
+ +
+
+
+ + setField('companyName', e.currentTarget.value)} /> +
+
+ + setField('companyId', e.currentTarget.value)} /> +
+
+ + setField('industry', e.currentTarget.value)} /> +
+
+ + setField('websiteUrl', e.currentTarget.value)} /> +
+
+ + setField('email', e.currentTarget.value)} /> +
+
+ + setField('phone', e.currentTarget.value)} /> +
+
+ + setField('address', e.currentTarget.value)} /> +
+
+ +