refactor: update ID input fields and button text for consistency in Company ID upload flow
This commit is contained in:
parent
da7047566e
commit
fa1058381f
@ -371,7 +371,7 @@ export default function CompanyAdditionalInformationPage() {
|
||||
)}
|
||||
{success && (
|
||||
<div className="mt-6 rounded-md border border-green-300 bg-green-50 px-4 py-3 text-xs text-green-700">
|
||||
Daten gespeichert.
|
||||
Data saved. Redirecting shortly…
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@ -397,14 +397,14 @@ export default function EmailVerifyPage() {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* NEW: Back to dashboard button */}
|
||||
{/* NEW: Go to Dashboard button */}
|
||||
<div className="mt-1 text-center">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => router.push('/quickaction-dashboard')}
|
||||
className="text-sm font-medium text-gray-700 dark:text-gray-300 hover:underline"
|
||||
>
|
||||
Back to dashboard
|
||||
Go to Dashboard
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@ -10,9 +10,9 @@ export function useCompanyUploadId() {
|
||||
const { refreshStatus } = useUserStatus()
|
||||
|
||||
// Form state
|
||||
const [docNumber, setDocNumber] = useState('')
|
||||
const [docType, setDocType] = useState('')
|
||||
const [issueDate, setIssueDate] = useState('')
|
||||
const [idNumber, setIdNumber] = useState('')
|
||||
const [idType, setIdType] = useState('')
|
||||
const [expiryDate, setExpiryDate] = useState('')
|
||||
const [hasBack, setHasBack] = useState(true)
|
||||
|
||||
// Files + previews
|
||||
@ -80,7 +80,7 @@ export function useCompanyUploadId() {
|
||||
|
||||
// Validation
|
||||
const validate = () => {
|
||||
if (!docNumber.trim() || !docType || !issueDate || !frontFile) {
|
||||
if (!idNumber.trim() || !idType || !expiryDate || !frontFile) {
|
||||
setError('Please complete all required fields (marked with *).')
|
||||
return false
|
||||
}
|
||||
@ -102,11 +102,11 @@ export function useCompanyUploadId() {
|
||||
|
||||
try {
|
||||
const formData = new FormData()
|
||||
if (frontFile) formData.append('frontFile', frontFile)
|
||||
if (hasBack && extraFile) formData.append('backFile', extraFile)
|
||||
formData.append('docType', docType)
|
||||
formData.append('docNumber', docNumber.trim())
|
||||
formData.append('issueDate', issueDate)
|
||||
if (frontFile) formData.append('front', frontFile)
|
||||
if (hasBack && extraFile) formData.append('back', extraFile)
|
||||
formData.append('idType', idType)
|
||||
formData.append('idNumber', idNumber.trim())
|
||||
formData.append('expiryDate', expiryDate)
|
||||
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/upload/company-id`, {
|
||||
method: 'POST',
|
||||
@ -144,14 +144,14 @@ export function useCompanyUploadId() {
|
||||
|
||||
return {
|
||||
// values
|
||||
docNumber, docType, issueDate, hasBack,
|
||||
idNumber, idType, expiryDate, hasBack,
|
||||
frontFile, extraFile,
|
||||
frontPreview, extraPreview,
|
||||
submitting, error, success,
|
||||
frontRef, extraRef,
|
||||
inputBase,
|
||||
// setters
|
||||
setDocNumber, setDocType, setIssueDate, setHasBack, setExtraFile,
|
||||
setIdNumber, setIdType, setExpiryDate, setHasBack, setExtraFile,
|
||||
// handlers
|
||||
handleFile, onDrop, clearFile, dropHandlers, openPicker, submit,
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@ const DOC_TYPES = ['Personalausweis', 'Reisepass', 'Führerschein', 'Aufenthalts
|
||||
export default function CompanyIdUploadPage() {
|
||||
const {
|
||||
// values
|
||||
docNumber, setDocNumber,
|
||||
docType, setDocType,
|
||||
issueDate, setIssueDate,
|
||||
idNumber, setIdNumber,
|
||||
idType, setIdType,
|
||||
expiryDate, setExpiryDate,
|
||||
hasBack, setHasBack, setExtraFile,
|
||||
frontFile, extraFile,
|
||||
frontPreview, extraPreview,
|
||||
@ -92,9 +92,9 @@ export default function CompanyIdUploadPage() {
|
||||
Contact Person ID Number *
|
||||
</label>
|
||||
<input
|
||||
value={docNumber}
|
||||
onChange={e => setDocNumber(e.target.value)}
|
||||
className={`${inputBase} ${docNumber ? 'text-gray-900' : 'text-gray-700'}`}
|
||||
value={idNumber}
|
||||
onChange={e => setIdNumber(e.target.value)}
|
||||
className={`${inputBase} ${idNumber ? 'text-gray-900' : 'text-gray-700'}`}
|
||||
placeholder="Enter contact person's ID number"
|
||||
required
|
||||
/>
|
||||
@ -108,9 +108,9 @@ export default function CompanyIdUploadPage() {
|
||||
Document Type *
|
||||
</label>
|
||||
<select
|
||||
value={docType}
|
||||
onChange={e => setDocType(e.target.value)}
|
||||
className={`${inputBase} ${docType ? 'text-gray-900' : 'text-gray-700'}`}
|
||||
value={idType}
|
||||
onChange={e => setIdType(e.target.value)}
|
||||
className={`${inputBase} ${idType ? 'text-gray-900' : 'text-gray-700'}`}
|
||||
required
|
||||
>
|
||||
<option value="">Select document type</option>
|
||||
@ -124,10 +124,10 @@ export default function CompanyIdUploadPage() {
|
||||
</label>
|
||||
<input
|
||||
type="date"
|
||||
value={issueDate}
|
||||
onChange={e => setIssueDate(e.target.value)}
|
||||
value={expiryDate}
|
||||
onChange={e => setExpiryDate(e.target.value)}
|
||||
placeholder="tt.mm.jjjj"
|
||||
className={`${inputBase} ${issueDate ? 'text-gray-900' : 'text-gray-700'} appearance-none [&::-webkit-calendar-picker-indicator]:opacity-80`}
|
||||
className={`${inputBase} ${expiryDate ? 'text-gray-900' : 'text-gray-700'} appearance-none [&::-webkit-calendar-picker-indicator]:opacity-80`}
|
||||
required
|
||||
/>
|
||||
<p className="mt-1 text-xs text-gray-600">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user