diff --git a/small_small_hr/forms.py b/small_small_hr/forms.py index 44d5200..21916ab 100644 --- a/small_small_hr/forms.py +++ b/small_small_hr/forms.py @@ -417,6 +417,8 @@ class StaffProfileAdminForm(forms.ModelForm): pin_number = forms.CharField(label=_('PIN Number'), required=False) emergency_contact_name = forms.CharField( label=_('Emergecy Contact Name'), required=False) + emergency_contact_relationship = forms.CharField( + label=_('Emergecy Contact Relationship'), required=False) emergency_contact_number = PhoneNumberField( label=_('Emergency Contact Phone Number'), required=False) @@ -444,6 +446,7 @@ class Meta: # pylint: disable=too-few-public-methods 'end_date', 'emergency_contact_name', 'emergency_contact_number', + 'emergency_contact_relationship' ] def __init__(self, *args, **kwargs): @@ -475,6 +478,7 @@ def __init__(self, *args, **kwargs): Field('end_date',), Field('emergency_contact_name',), Field('emergency_contact_number',), + Field('emergency_contact_relationship',), FormActions( Submit('submitBtn', _('Submit'), css_class='btn-primary'), ) @@ -544,6 +548,8 @@ def save(self, commit=True): # pylint: disable=unused-argument 'pin_number': self.cleaned_data.get('pin_number'), 'emergency_contact_name': self.cleaned_data.get( 'emergency_contact_name'), + 'emergency_contact_relationship': self.cleaned_data.get( + 'emergency_contact_relationship'), 'emergency_contact_number': emergency_phone, } staffprofile.data = json_data @@ -588,6 +594,7 @@ class Meta: # pylint: disable=too-few-public-methods 'end_date', 'emergency_contact_name', 'emergency_contact_number', + 'emergency_contact_relationship' ] def __init__(self, *args, **kwargs): @@ -620,6 +627,7 @@ def __init__(self, *args, **kwargs): Field('end_date',), Field('emergency_contact_name',), Field('emergency_contact_number',), + Field('emergency_contact_relationship',), FormActions( Submit('submitBtn', _('Submit'), css_class='btn-primary'), ) @@ -650,6 +658,7 @@ class Meta: # pylint: disable=too-few-public-methods 'birthday', 'emergency_contact_name', 'emergency_contact_number', + 'emergency_contact_relationship' ] def __init__(self, *args, **kwargs): @@ -676,6 +685,7 @@ def __init__(self, *args, **kwargs): Field('birthday',), Field('emergency_contact_name',), Field('emergency_contact_number',), + Field('emergency_contact_relationship',), FormActions( Submit('submitBtn', _('Submit'), css_class='btn-primary'), ) diff --git a/tests/test_forms.py b/tests/test_forms.py index f23659e..d79c31e 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -742,6 +742,7 @@ def test_staff_profile_user_form(self): 'nssf': '222222', 'pin_number': 'A0000000Y', 'emergency_contact_name': 'Bob Father', + 'emergency_contact_relationship': 'Father', 'emergency_contact_number': '+254722111111', 'phone': '+254722111111', 'address': 'This is the address.', @@ -772,6 +773,8 @@ def test_staff_profile_user_form(self): staffprofile.data['pin_number']) self.assertEqual('Bob Father', staffprofile.data['emergency_contact_name']) + self.assertEqual('Father', + staffprofile.data['emergency_contact_relationship']) self.assertEqual('+254722111111', staffprofile.data['emergency_contact_number'])