diff --git a/src/components/dashboard/ProfilePage.tsx b/src/components/dashboard/ProfilePage.tsx index 2a457b6..2e4e297 100644 --- a/src/components/dashboard/ProfilePage.tsx +++ b/src/components/dashboard/ProfilePage.tsx @@ -661,6 +661,17 @@ export default function ProfilePage(props: Props) { flat[k] = String(v ?? ""); } setForm(flat); + + // Documents are saved into the same profile_data blob as basic fields — + // pull out whichever doc keys this role expects so previously uploaded + // files show as already-attached instead of appearing lost on reload. + const docKeys = getDocFields(props.roleKey).map((d) => d.key); + const savedDocs: Record = {}; + for (const key of docKeys) { + const val = data.profile_data[key]; + if (typeof val === "string" && val) savedDocs[key] = val; + } + if (Object.keys(savedDocs).length > 0) setDocUrls((prev) => ({ ...savedDocs, ...prev })); } } @@ -816,7 +827,7 @@ export default function ProfilePage(props: Props) { try { const { data, status } = await request("/api/profile", { method: "PATCH", - body: { roleKey: props.roleKey, profile_data: form() }, + body: { roleKey: props.roleKey, profile_data: { ...form(), ...docUrls() } }, }); if (status === 200) setSaveMsg("Saved successfully."); else setSaveMsg((data && (data.error || data.message)) || "Failed to save. Please try again."); @@ -847,7 +858,7 @@ export default function ProfilePage(props: Props) { try { const { data, status } = await request("/api/profile/submit-for-verification", { method: "POST", - body: { roleKey: props.roleKey, document_urls: docUrls() }, + body: { roleKey: props.roleKey, profile_data: { ...form(), ...docUrls() } }, }); if (status === 200) { setVerificationStatus("PENDING"); diff --git a/src/components/dashboard/VerificationStatusPage.tsx b/src/components/dashboard/VerificationStatusPage.tsx index 6747f40..c9b881c 100644 --- a/src/components/dashboard/VerificationStatusPage.tsx +++ b/src/components/dashboard/VerificationStatusPage.tsx @@ -4,9 +4,10 @@ * REVISION_REQUESTED, APPROVED, REJECTED. * Tabs: approval status, documents, activity */ -import { For, Show, createSignal, onMount } from 'solid-js'; +import { For, Show, createMemo, createSignal, onMount } from 'solid-js'; import { ShieldCheck, FileText, Activity } from 'lucide-solid'; import { CARD, BTN_ORANGE, BTN_GHOST } from '~/components/DashboardShell'; +import { getDocFields } from '~/lib/profile-fields-config'; const API = '/api/gateway'; const NAVY = '#0D0D2A'; @@ -159,6 +160,7 @@ export default function VerificationStatusPage(props: Props) { const cfg = () => STATUS_CONFIG[status()] ?? STATUS_CONFIG.NOT_SUBMITTED; const currentStep = () => stepIndex(status()); + const docFields = createMemo(() => getDocFields(props.roleKey)); const canResubmit = () => ['DOCUMENTS_REQUESTED', 'REVISION_REQUESTED', 'REJECTED'].includes(status()); const handleResubmit = async () => { @@ -422,24 +424,16 @@ export default function VerificationStatusPage(props: Props) {
-
-

Identity Proof

-

- {status() === 'APPROVED' ? '✓ Verified' : status() === 'REJECTED' ? '✕ Rejected' : '◌ Pending review'} -

-
-
-

Address Proof

-

- {status() === 'APPROVED' ? '✓ Verified' : status() === 'REJECTED' ? '✕ Rejected' : '◌ Pending review'} -

-
-
-

Professional Certifications

-

- {status() === 'APPROVED' ? '✓ Verified' : status() === 'REJECTED' ? '✕ Rejected' : '◌ Pending review'} -

-
+ + {(doc) => ( +
+

{doc.label}

+

+ {status() === 'APPROVED' ? '✓ Verified' : status() === 'REJECTED' ? '✕ Rejected' : '◌ Pending review'} +

+
+ )} +
diff --git a/src/lib/profile-fields-config.ts b/src/lib/profile-fields-config.ts index b40f2bd..1b2ea5e 100644 --- a/src/lib/profile-fields-config.ts +++ b/src/lib/profile-fields-config.ts @@ -334,6 +334,106 @@ const DOC_FIELDS: Record = { hint: 'JPG, PNG or PDF · Max 10MB', }, ], + DEVELOPER: [ + { + key: 'aadhar_doc', + label: 'Identity Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'address_proof', + label: 'Address Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'tax_document', + label: 'Tax Document', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + ], + VIDEO_EDITOR: [ + { + key: 'aadhar_doc', + label: 'Identity Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'address_proof', + label: 'Address Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'tax_document', + label: 'Tax Document', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + ], + GRAPHIC_DESIGNER: [ + { + key: 'aadhar_doc', + label: 'Identity Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'address_proof', + label: 'Address Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'tax_document', + label: 'Tax Document', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + ], + SOCIAL_MEDIA_MANAGER: [ + { + key: 'aadhar_doc', + label: 'Identity Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'address_proof', + label: 'Address Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'tax_document', + label: 'Tax Document', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + ], + UGC_CONTENT_CREATOR: [ + { + key: 'aadhar_doc', + label: 'Identity Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'address_proof', + label: 'Address Proof', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + { + key: 'tax_document', + label: 'Tax Document', + required: true, + hint: 'JPG, PNG or PDF · Max 10MB', + }, + ], }; // ── Portfolio sections per role ───────────────────────────────────────────────