Files
MyClub/ICO_AUTO_FILL_TEST.md
T
Tomas Dvorak dfc079288f hot fix #1
2026-01-26 08:13:18 +01:00

58 lines
2.2 KiB
Markdown

# IČO Auto-fill Functionality Test
## Implementation Summary
The IČO auto-search functionality has been successfully implemented in the customer creation modal. Here's what was added:
### Features
1. **Automatic Search**: When a user enters an 8-digit IČO, the system automatically searches the Czech company registry (ARES)
2. **Auto-fill**: Found company information is automatically populated in the form fields:
- Company name (Název firmy)
- DIČ (if available)
- Address (Adresa)
- City (Město)
- ZIP Code (PSČ)
- Country (Stát)
3. **Visual Feedback**: Loading spinner appears during search
4. **Error Handling**: User-friendly notifications when company is not found
### How to Test
1. Navigate to the **Fakturace** page
2. Click **Nová faktura**
3. Click **Přidat odběratele** button
4. Enter a valid 8-digit Czech IČO (e.g., `24330621`)
5. The system will automatically search and fill in the company details
### Test Examples
Valid Czech IČO numbers for testing:
- `24330621` - Tomáš Dvořák (Individual)
- `25596641` - Microsoft s.r.o.
- `27791331` - Google Czech Republic s.r.o.
- `62739913` - Seznam.cz, a.s.
### Technical Implementation
- **API**: Uses ARES (Administrativní registr ekonomických subjektů) - Czech company registry
- **Endpoint**: `https://ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/{ico}`
- **Validation**: Only searches when exactly 8 digits are entered
- **Input Sanitization**: Automatically removes non-digit characters and limits to 8 digits
### User Experience
- The search triggers automatically when the 8th digit is entered
- Loading spinner provides visual feedback during the search
- Success message confirms when data is found and filled
- Warning message appears if no data is found, allowing manual entry
- All auto-filled fields can still be manually edited by the user
### Error Handling
- Network errors are handled gracefully
- Invalid IČO numbers show appropriate warnings
- CORS issues are resolved by using the public ARES API
- Form validation ensures required fields are still manually validated
The implementation provides a seamless user experience for adding new customers by reducing manual data entry and ensuring accuracy through official registry data.