beautify: adjust personal register upload id
This commit is contained in:
parent
e0a18f42ea
commit
97231ee7b6
@ -37,7 +37,7 @@ export function useCompanyUploadId() {
|
||||
// File handlers
|
||||
const handleFile = (file: File, which: 'front' | 'extra') => {
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
setError('Datei größer als 10 MB.')
|
||||
setError('File size exceeds 10 MB.')
|
||||
return
|
||||
}
|
||||
setError('')
|
||||
@ -81,7 +81,7 @@ export function useCompanyUploadId() {
|
||||
// Validation
|
||||
const validate = () => {
|
||||
if (!docNumber.trim() || !docType || !issueDate || !frontFile) {
|
||||
setError('Bitte alle Pflichtfelder (mit *) ausfüllen.')
|
||||
setError('Please complete all required fields (marked with *).')
|
||||
return false
|
||||
}
|
||||
setError('')
|
||||
@ -128,7 +128,7 @@ export function useCompanyUploadId() {
|
||||
}, 1500)
|
||||
} catch (err: any) {
|
||||
console.error('Company ID upload error:', err)
|
||||
setError(err?.message || 'Upload fehlgeschlagen.')
|
||||
setError(err?.message || 'Upload failed.')
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ export default function CompanyIdUploadPage() {
|
||||
)}
|
||||
{success && (
|
||||
<div className="mt-6 rounded-md border border-green-300 bg-green-50 px-4 py-3 text-sm text-green-700">
|
||||
Dokumente erfolgreich hochgeladen.
|
||||
Documents uploaded successfully.
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ export function usePersonalUploadId() {
|
||||
// File handlers
|
||||
const handleFile = (f: File, side: 'front' | 'back') => {
|
||||
if (f.size > 10 * 1024 * 1024) {
|
||||
setError('Datei größer als 10 MB.')
|
||||
setError('File size exceeds 10 MB.')
|
||||
return
|
||||
}
|
||||
setError('')
|
||||
@ -81,15 +81,15 @@ export function usePersonalUploadId() {
|
||||
// Validation
|
||||
const validate = () => {
|
||||
if (!idNumber.trim() || !idType || !expiry) {
|
||||
setError('Bitte alle Pflichtfelder ausfüllen.')
|
||||
setError('Please fill out all required fields.')
|
||||
return false
|
||||
}
|
||||
if (!frontFile) {
|
||||
setError('Vorderseite hochladen.')
|
||||
return false
|
||||
setError('Please upload the front side.')
|
||||
return false
|
||||
}
|
||||
if (hasBack && !backFile) {
|
||||
setError('Rückseite hochladen oder Schalter deaktivieren.')
|
||||
setError('Please upload the back side or disable the switch.')
|
||||
return false
|
||||
}
|
||||
setError('')
|
||||
@ -101,7 +101,7 @@ export function usePersonalUploadId() {
|
||||
e.preventDefault()
|
||||
if (!validate()) return
|
||||
if (!token) {
|
||||
setError('Nicht authentifiziert. Bitte erneut einloggen.')
|
||||
setError('Not authenticated. Please log in again.')
|
||||
return
|
||||
}
|
||||
|
||||
@ -131,11 +131,11 @@ export function usePersonalUploadId() {
|
||||
window.location.href = '/quickaction-dashboard'
|
||||
}, 2000)
|
||||
} else {
|
||||
setError(data.message || 'Upload fehlgeschlagen. Bitte erneut versuchen.')
|
||||
setError(data.message || 'Upload failed. Please try again.')
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Upload error:', err)
|
||||
setError('Netzwerkfehler. Bitte erneut versuchen.')
|
||||
setError('Network error. Please try again.')
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
}
|
||||
|
||||
@ -7,6 +7,14 @@ import { useRouter } from 'next/navigation'
|
||||
import useAuthStore from '../../../store/authStore'
|
||||
import { DocumentArrowUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
|
||||
|
||||
// Add back ID types for the dropdown
|
||||
const ID_TYPES = [
|
||||
{ value: 'national_id', label: 'National ID Card' },
|
||||
{ value: 'passport', label: 'Passport' },
|
||||
{ value: 'driver_license', label: "Driver's License" },
|
||||
{ value: 'other', label: 'Other' },
|
||||
]
|
||||
|
||||
export default function PersonalIdUploadPage() {
|
||||
// NEW: guard company users from accessing personal page
|
||||
const user = useAuthStore(s => s.user)
|
||||
@ -110,7 +118,11 @@ export default function PersonalIdUploadPage() {
|
||||
required
|
||||
>
|
||||
<option value="">Select ID type</option>
|
||||
{/* ...existing options... */}
|
||||
{ID_TYPES.map(t => (
|
||||
<option key={t.value} value={t.value}>
|
||||
{t.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -273,7 +285,7 @@ export default function PersonalIdUploadPage() {
|
||||
)}
|
||||
{success && (
|
||||
<div className="mt-6 rounded-md border border-green-300 bg-green-50 px-4 py-3 text-sm text-green-700">
|
||||
Upload erfolgreich gespeichert.
|
||||
Upload saved successfully.
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user