|
| 1 | +# ISSUE-066: Make Employee Creation Fields Optional |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Currently, when creating a new employee, too many fields are mandatory. Users want to be able to create an employee quickly with minimal information and complete the rest later. Only essential fields should be required: first name, last name, workspace, and role. |
| 6 | + |
| 7 | +## Current State |
| 8 | + |
| 9 | +**Employee form requires 7 fields:** |
| 10 | +- First name (required) |
| 11 | +- Last name (required) |
| 12 | +- Status (required - defaults to "Active") |
| 13 | +- Workspace (required) |
| 14 | +- Role (required) |
| 15 | +- Contract type (required) |
| 16 | +- Entry date (required) |
| 17 | + |
| 18 | +**Email and phone are already optional.** |
| 19 | + |
| 20 | +## Problem |
| 21 | + |
| 22 | +When creating a new employee, users must fill in all fields including contract type and entry date, which may not be immediately available. This slows down employee onboarding and creates friction in the workflow. |
| 23 | + |
| 24 | +## Expected Behavior |
| 25 | + |
| 26 | +### Minimum Required Fields |
| 27 | + |
| 28 | +Only these 4 fields should be mandatory: |
| 29 | +- **First name** - required |
| 30 | +- **Last name** - required |
| 31 | +- **Workspace** - required (e.g., Quai, Zone A, Zone B, Bureau) |
| 32 | +- **Role** - required (e.g., Cariste, Préparateur, Magasinier) |
| 33 | + |
| 34 | +### Optional Fields with Defaults |
| 35 | + |
| 36 | +These fields should be optional: |
| 37 | +- **Status** - optional, defaults to "Actif" if not provided |
| 38 | +- **Contract type** - optional, can be null/empty |
| 39 | +- **Entry date** - optional, can be null/empty |
| 40 | +- **Email** - optional (already implemented) |
| 41 | +- **Phone** - optional (already implemented) |
| 42 | + |
| 43 | +## Affected Files |
| 44 | + |
| 45 | +- `src/ui_ctk/forms/employee_form.py` - Remove required indicators, update validation |
| 46 | +- `src/employee/validators.py` - Allow null values for optional fields |
| 47 | +- `src/controllers/employee_controller.py` - Handle optional fields in create/update |
| 48 | + |
| 49 | +## Implementation Plan |
| 50 | + |
| 51 | +1. Update form UI to remove `*` from optional field labels |
| 52 | +2. Update `validate()` method to only check required fields |
| 53 | +3. Update `save()` method to handle None values for optional fields |
| 54 | +4. Update validator/controller to accept null values |
| 55 | +5. Test employee creation with minimum fields |
| 56 | +6. Test employee creation with all fields |
| 57 | +7. Test employee edit mode to ensure optional fields remain optional |
| 58 | + |
| 59 | +## Acceptance Criteria |
| 60 | + |
| 61 | +- [ ] Can create employee with only: first name, last name, workspace, role |
| 62 | +- [ ] Status defaults to "Actif" when not specified |
| 63 | +- [ ] Contract type can be left empty |
| 64 | +- [ ] Entry date can be left empty |
| 65 | +- [ ] Form validation only checks required fields |
| 66 | +- [ ] No errors when saving employee without optional fields |
| 67 | +- [ ] Edit mode works the same way (optional fields are optional) |
| 68 | +- [ ] All tests pass |
| 69 | + |
| 70 | +## Estimated Effort |
| 71 | + |
| 72 | +**Total:** 2-3 hours |
| 73 | +- Form UI updates: 30 minutes |
| 74 | +- Validation logic updates: 30 minutes |
| 75 | +- Controller/validator updates: 30 minutes |
| 76 | +- Testing: 1 hour |
| 77 | + |
| 78 | +## Related Issues |
| 79 | + |
| 80 | +None |
| 81 | + |
| 82 | +## Example Use Cases |
| 83 | + |
| 84 | +### Use Case 1: Quick Employee Creation |
| 85 | + |
| 86 | +1. New temp worker arrives |
| 87 | +2. HR opens "Add Employee" form |
| 88 | +3. Enters: First name "Jean", Last name "Dupont", Workspace "Zone A", Role "Préparateur" |
| 89 | +4. Leaves: Contract type and Entry date empty |
| 90 | +5. Clicks "Save" |
| 91 | +6. Employee created successfully with defaults applied |
| 92 | + |
| 93 | +### Use Case 2: Complete Employee Creation |
| 94 | + |
| 95 | +1. New permanent hire |
| 96 | +2. HR opens "Add Employee" form |
| 97 | +3. Enters all fields including contract type "CDI" and entry date "01/03/2026" |
| 98 | +4. Clicks "Save" |
| 99 | +5. Employee created with all information |
| 100 | + |
| 101 | +### Use Case 3: Progressive Data Entry |
| 102 | + |
| 103 | +1. Create employee with minimal info |
| 104 | +2. Employee appears in list |
| 105 | +3. Later, edit employee to add contract type and entry date |
| 106 | +4. Information is progressively completed |
| 107 | + |
| 108 | +## Notes |
| 109 | + |
| 110 | +This improvement makes the employee creation process more flexible and user-friendly. It aligns with real-world HR workflows where not all information is available at the time of initial employee record creation. |
0 commit comments