57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
from django.db import models
|
|
from django.forms import ModelForm, DateInput, Form, ChoiceField, RadioSelect
|
|
|
|
from .models import Employee
|
|
|
|
# class EmployeeForm(ModelForm):
|
|
# class Meta:
|
|
# model = Employee
|
|
# fields = '__all__'
|
|
# widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
|
|
# 'firstdate_presence': DateInput(attrs={'type': 'date'}),}
|
|
|
|
class DummyForm(ModelForm):
|
|
class Meta:
|
|
model = Employee
|
|
fields = []
|
|
|
|
class FdbForm(ModelForm):
|
|
'''this base class provides the required css class for all forms'''
|
|
required_css_class = 'required'
|
|
|
|
TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'}
|
|
|
|
class PersonalForm(FdbForm):
|
|
choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
|
|
label='Welcher Prozess soll angestoßen werden?')
|
|
|
|
class Meta:
|
|
model = Employee
|
|
fields = ['firstname', 'lastname', 'email', 'department', 'team', ]
|
|
|
|
class WorkingForm(FdbForm):
|
|
class Meta:
|
|
model = Employee
|
|
fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german',
|
|
'jobdescription_english', 'desk',]
|
|
widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
|
|
'firstdate_presence': DateInput(attrs={'type': 'date'}),}
|
|
|
|
class ITForm(FdbForm):
|
|
class Meta:
|
|
model = Employee
|
|
fields = [
|
|
'laptop', 'os', 'screen', 'mobile', 'landline', 'comment',
|
|
'language', 'accounts', 'lists', ]
|
|
|
|
class OfficeForm(FdbForm):
|
|
class Meta:
|
|
model = Employee
|
|
fields = ['transponder', 'post_office_box',]
|
|
|
|
class ChangeForm(FdbForm):
|
|
class Meta:
|
|
model = Employee
|
|
fields = ['firstdate_employment', 'jobdescription_german', 'jobdescription_english',
|
|
'desk', 'comment', 'accounts', 'lists', 'transponder']
|