2024-06-06 14:18:42 +08:00
|
|
|
from django import forms
|
2024-06-16 15:24:35 +08:00
|
|
|
|
2024-06-07 03:47:15 +08:00
|
|
|
from .models import *
|
2024-06-06 14:18:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
class EmployeeInformationForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-人员基本信息表单
|
|
|
|
"""
|
2024-06-19 02:03:59 +08:00
|
|
|
primary_department = forms.ChoiceField(
|
|
|
|
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
|
|
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
|
|
|
label="一级部门"
|
|
|
|
)
|
|
|
|
|
2024-06-19 05:31:13 +08:00
|
|
|
position = forms.ChoiceField(
|
|
|
|
choices=[('', '---------')] + [(p.position_name, p.position_name) for p in Position.objects.all()],
|
|
|
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
|
|
|
label="岗位"
|
|
|
|
)
|
2024-06-19 02:03:59 +08:00
|
|
|
|
2024-06-19 05:31:13 +08:00
|
|
|
rank = forms.ChoiceField(
|
|
|
|
choices=[('', '---------')] + [(r.rank_name, r.rank_name) for r in Rank.objects.all()],
|
|
|
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
|
|
|
label="职级"
|
|
|
|
)
|
2024-06-12 16:40:51 +08:00
|
|
|
|
2024-06-06 14:18:42 +08:00
|
|
|
class Meta:
|
|
|
|
model = EmployeeInformation
|
2024-06-19 05:31:13 +08:00
|
|
|
exclude = ['resignation_type', 'resignation_reason', 'resignation_date']
|
2024-06-06 14:18:42 +08:00
|
|
|
widgets = {
|
2024-06-19 05:31:13 +08:00
|
|
|
'name': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'id_number': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'gender': forms.Select(choices=EmployeeInformation.GENDER_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'birthday': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
|
|
|
'age': forms.NumberInput(attrs={'class': 'form-control'}),
|
|
|
|
'height': forms.NumberInput(attrs={'class': 'form-control'}),
|
|
|
|
'weight': forms.NumberInput(attrs={'class': 'form-control'}),
|
|
|
|
'blood_type': forms.Select(choices=EmployeeInformation.BLOOD_TYPE_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'ethnicity': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'domicile': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'marital_status': forms.Select(choices=EmployeeInformation.MARITAL_STATUS_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'political_affiliation': forms.Select(choices=EmployeeInformation.POLITICAL_AFFILIATION_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'entry_date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
|
|
|
'regularization_date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
|
|
|
'employment_type': forms.Select(choices=EmployeeInformation.EMPLOYMENT_TYPE_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'status': forms.Select(choices=EmployeeInformation.STATUS_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'secondary_department': forms.Select(attrs={'class': 'form-control'}),
|
|
|
|
'contract_end_date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
|
|
|
'mobile_number': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'email': forms.EmailInput(attrs={'class': 'form-control'}),
|
|
|
|
'mailing_address': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'emergency_contact': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'relation_with_contact': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'emergency_contact_phone': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'education': forms.Select(choices=EmployeeInformation.EDUCATION_CHOICES, attrs={'class': 'form-control'}),
|
|
|
|
'undergraduate_school': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'graduate_school': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'major': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'technical_title': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'base_salary': forms.NumberInput(attrs={'class': 'form-control'}),
|
|
|
|
'salary_account_number': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'bank_of_salary_account': forms.TextInput(attrs={'class': 'form-control'})
|
2024-06-06 14:18:42 +08:00
|
|
|
}
|
2024-06-07 03:47:15 +08:00
|
|
|
|
2024-06-19 05:31:13 +08:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(EmployeeInformationForm, self).__init__(*args, **kwargs)
|
|
|
|
|
2024-06-07 03:47:15 +08:00
|
|
|
|
|
|
|
class EmployeeAttendanceRecordForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-员工考勤记录表单
|
|
|
|
"""
|
2024-06-07 03:47:15 +08:00
|
|
|
class Meta:
|
|
|
|
model = EmployeeAttendanceRecord
|
|
|
|
fields = '__all__'
|
|
|
|
widgets = {
|
|
|
|
'year_month': forms.DateInput(attrs={'type': 'month'}),
|
|
|
|
'late': forms.NumberInput(),
|
|
|
|
'early_leave': forms.NumberInput(),
|
|
|
|
'absenteeism': forms.NumberInput(),
|
|
|
|
'annual_leave': forms.NumberInput(),
|
|
|
|
'personal_leave': forms.NumberInput(),
|
|
|
|
'sick_leave': forms.NumberInput(),
|
|
|
|
'other_leave_details_id': forms.NumberInput(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class AnnualLeaveRecordForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-年假使用记录表单
|
|
|
|
"""
|
2024-06-07 03:47:15 +08:00
|
|
|
class Meta:
|
|
|
|
model = AnnualLeaveRecord
|
|
|
|
fields = '__all__'
|
|
|
|
widgets = {
|
|
|
|
'year': forms.NumberInput(),
|
|
|
|
'total_annual_leave': forms.NumberInput(),
|
|
|
|
'used_annual_leave': forms.NumberInput(),
|
|
|
|
'remaining_annual_leave': forms.NumberInput(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class RankForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-职级表单
|
|
|
|
"""
|
2024-06-07 03:47:15 +08:00
|
|
|
class Meta:
|
|
|
|
model = Rank
|
|
|
|
fields = '__all__'
|
|
|
|
widgets = {
|
|
|
|
'rank_name': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'rank_description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3}),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class PositionForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-岗位表单
|
|
|
|
"""
|
2024-06-07 03:47:15 +08:00
|
|
|
class Meta:
|
|
|
|
model = Position
|
|
|
|
fields = '__all__'
|
|
|
|
widgets = {
|
|
|
|
'position_name': forms.TextInput(attrs={'class': 'form-control'}),
|
|
|
|
'position_description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3}),
|
|
|
|
}
|
2024-06-13 00:12:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
class PerformanceEvaluationForm(forms.ModelForm):
|
2024-06-19 10:39:14 +08:00
|
|
|
"""
|
|
|
|
人力资源管理-员工绩效表单
|
|
|
|
"""
|
2024-06-13 00:12:17 +08:00
|
|
|
class Meta:
|
|
|
|
model = PerformanceEvaluation
|
|
|
|
fields = '__all__'
|