From 6bf1ca006e1801993095114054400dfe48056552 Mon Sep 17 00:00:00 2001 From: seaznCode Date: Sat, 29 Nov 2025 15:23:18 +0100 Subject: [PATCH] feat: update success messages for document uploads and contract signing to include redirect notice + remove cow --- src/app/components/TutorialModal.tsx | 6 +- .../personal/page.tsx | 58 ++++++++++++++--- .../register-sign-contract/company/page.tsx | 62 +++++++++---------- .../register-sign-contract/personal/page.tsx | 52 ++++++++-------- .../register-upload-id/company/page.tsx | 2 +- .../register-upload-id/personal/page.tsx | 2 +- 6 files changed, 113 insertions(+), 69 deletions(-) diff --git a/src/app/components/TutorialModal.tsx b/src/app/components/TutorialModal.tsx index a72dd2b..419ff66 100644 --- a/src/app/components/TutorialModal.tsx +++ b/src/app/components/TutorialModal.tsx @@ -211,11 +211,11 @@ export default function TutorialModal({ {/* Visual Section - Right Half */}
- Profit Planet Mascot + /> */}
@@ -324,7 +324,7 @@ export const createTutorialSteps = ( { id: 6, title: "You're all set! 🎉 Welcome to the family", - description: "Congratulations! You've completed all the steps perfectly. Our friendly team will now review your information - we'll have you approved and ready to go very soon!", + description: "Congratulations! Our team will now review your information and have you approved very soon!", details: [ "Our team will carefully review everything you've submitted", "This usually takes just 1-2 business days", diff --git a/src/app/quickaction-dashboard/register-additional-information/personal/page.tsx b/src/app/quickaction-dashboard/register-additional-information/personal/page.tsx index 8d4133a..299ad11 100644 --- a/src/app/quickaction-dashboard/register-additional-information/personal/page.tsx +++ b/src/app/quickaction-dashboard/register-additional-information/personal/page.tsx @@ -1,6 +1,6 @@ 'use client' -import { useState } from 'react' +import { useEffect, useState } from 'react' import { useRouter } from 'next/navigation' import PageLayout from '../../../components/PageLayout' import useAuthStore from '../../../store/authStore' @@ -64,6 +64,50 @@ export default function PersonalAdditionalInformationPage() { const [success, setSuccess] = useState(false) const [error, setError] = useState('') + // Prefill form if profile already exists + useEffect(() => { + let abort = false + async function loadProfile() { + if (!accessToken) return + try { + const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/me`, { + method: 'GET', + headers: { Authorization: `Bearer ${accessToken}` } + }) + if (!res.ok) return + const data = await res.json().catch(() => null) + const profile = data?.profile + const user = data?.user + if (!profile || abort) return + const toDateInput = (d?: string) => { + if (!d) return '' + const dt = new Date(d) + if (Number.isNaN(dt.getTime())) return '' + return dt.toISOString().split('T')[0] + } + setForm(prev => ({ + ...prev, + dob: toDateInput(profile.date_of_birth || profile.dateOfBirth), + nationality: profile.nationality || prev.nationality, + street: profile.address || prev.street, + postalCode: profile.zip_code || profile.zipCode || prev.postalCode, + city: profile.city || prev.city, + country: profile.country || prev.country, + accountHolder: profile.account_holder_name || profile.accountHolderName || prev.accountHolder, + // Prefer IBAN from users table (data.user.iban), fallback to profile if any + iban: (user?.iban ?? profile.iban ?? prev.iban) as string, + secondPhone: profile.phone_secondary || profile.phoneSecondary || prev.secondPhone, + emergencyName: profile.emergency_contact_name || profile.emergencyContactName || prev.emergencyName, + emergencyPhone: profile.emergency_contact_phone || profile.emergencyContactPhone || prev.emergencyPhone, + })) + } catch (_) { + // ignore prefill errors; user can still fill manually + } + } + loadProfile() + return () => { abort = true } + }, [accessToken]) + const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target setForm(p => ({ ...p, [name]: value })) @@ -101,20 +145,20 @@ export default function PersonalAdditionalInformationPage() { ] for (const k of requiredKeys) { if (!form[k].trim()) { - setError('Bitte alle Pflichtfelder ausfüllen.') + setError('Please fill in all required fields.') return false } } // Date of birth validation if (!validateDateOfBirth(form.dob)) { - setError('Ungültiges Geburtsdatum. Sie müssen mindestens 18 Jahre alt sein.') + setError('Invalid date of birth. You must be at least 18 years old.') return false } // very loose IBAN check if (!/^([A-Z]{2}\d{2}[A-Z0-9]{10,30})$/i.test(form.iban.replace(/\s+/g,''))) { - setError('Ungültige IBAN.') + setError('Invalid IBAN.') return false } setError('') @@ -183,7 +227,7 @@ export default function PersonalAdditionalInformationPage() { } catch (error: any) { console.error('Personal profile save error:', error) - setError(error.message || 'Speichern fehlgeschlagen. Bitte erneut versuchen.') + setError(error.message || 'Save failed. Please try again.') } finally { setLoading(false) } @@ -413,7 +457,7 @@ export default function PersonalAdditionalInformationPage() { )} {success && (
- Daten gespeichert. + Data saved. Redirecting shortly…
)} @@ -423,7 +467,7 @@ export default function PersonalAdditionalInformationPage() { disabled={loading || success} className="inline-flex items-center rounded-md bg-indigo-600 px-6 py-2.5 text-sm font-semibold text-white shadow hover:bg-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed" > - {loading ? 'Speichern…' : success ? 'Gespeichert' : 'Save & Continue'} + {loading ? 'Saving…' : success ? 'Saved' : 'Save & Continue'} diff --git a/src/app/quickaction-dashboard/register-sign-contract/company/page.tsx b/src/app/quickaction-dashboard/register-sign-contract/company/page.tsx index a7af1e5..19f01b3 100644 --- a/src/app/quickaction-dashboard/register-sign-contract/company/page.tsx +++ b/src/app/quickaction-dashboard/register-sign-contract/company/page.tsx @@ -78,15 +78,15 @@ export default function CompanySignContractPage() { if (!valid()) { // Detailed error message to help debug const issues = [] - if (companyName.trim().length < 3) issues.push('Firmenname (mindestens 3 Zeichen)') - if (repName.trim().length < 3) issues.push('Vertreter Name (mindestens 3 Zeichen)') - if (repTitle.trim().length < 2) issues.push('Vertretertitel (mindestens 2 Zeichen)') - if (location.trim().length < 2) issues.push('Ort (mindestens 2 Zeichen)') - if (!agreeContract) issues.push('Vertrag gelesen und verstanden') - if (!agreeData) issues.push('Datenschutzerklärung zugestimmt') - if (!confirmSignature) issues.push('Elektronische Signatur bestätigt') + if (companyName.trim().length < 3) issues.push('Company name (min 3 characters)') + if (repName.trim().length < 3) issues.push('Representative name (min 3 characters)') + if (repTitle.trim().length < 2) issues.push('Representative title (min 2 characters)') + if (location.trim().length < 2) issues.push('Location (min 2 characters)') + if (!agreeContract) issues.push('Contract read and understood') + if (!agreeData) issues.push('Privacy policy accepted') + if (!confirmSignature) issues.push('Electronic signature confirmed') - setError(`Bitte vervollständigen: ${issues.join(', ')}`) + setError(`Please complete: ${issues.join(', ')}`) return } @@ -156,7 +156,7 @@ export default function CompanySignContractPage() { } catch (error: any) { console.error('Contract signing error:', error) - setError(error.message || 'Signatur fehlgeschlagen. Bitte erneut versuchen.') + setError(error.message || 'Signature failed. Please try again.') } finally { setSubmitting(false) } @@ -193,7 +193,7 @@ export default function CompanySignContractPage() { Sign Company Partnership Contract

- PrĂĽfe die Vertragsdetails und unterschreibe im Namen des Unternehmens. + Please review the contract details and sign on behalf of the company.

{/* Meta + Preview */} @@ -203,22 +203,22 @@ export default function CompanySignContractPage() {

Contract Information

-

Achtung

+

Attention

- Du bestätigst rechtsverbindlich, dass du bevollmächtigt bist im Namen des Unternehmens zu unterschreiben. + You confirm that you are authorized to sign on behalf of the company.

-

Vertragsvorschau (Unternehmen)

+

Company Contract Preview

{previewLoading ? ( -
Lade Vorschau…
+
Loading preview…
) : previewError ? (
{previewError}
) : previewHtml ? (