2021-01-04 14:48:32 +00:00
|
|
|
from django.db import models
|
2021-01-20 10:02:22 +00:00
|
|
|
from django.forms import ModelForm, DateInput, Form, ChoiceField, RadioSelect
|
2021-02-09 11:45:33 +00:00
|
|
|
from django.core.exceptions import ValidationError
|
2021-01-04 14:48:32 +00:00
|
|
|
|
|
|
|
from .models import Employee
|
|
|
|
|
2021-01-13 12:12:40 +00:00
|
|
|
# class EmployeeForm(ModelForm):
|
|
|
|
# class Meta:
|
|
|
|
# model = Employee
|
|
|
|
# fields = '__all__'
|
|
|
|
# widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
|
|
|
|
# 'firstdate_presence': DateInput(attrs={'type': 'date'}),}
|
2021-01-11 15:12:20 +00:00
|
|
|
|
2021-01-13 14:29:56 +00:00
|
|
|
class DummyForm(ModelForm):
|
2021-01-13 14:21:22 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
2021-01-13 14:29:56 +00:00
|
|
|
fields = []
|
2021-01-13 14:21:22 +00:00
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class EvaForm(ModelForm):
|
2021-01-13 13:17:21 +00:00
|
|
|
'''this base class provides the required css class for all forms'''
|
|
|
|
required_css_class = 'required'
|
|
|
|
|
2021-01-20 10:02:22 +00:00
|
|
|
TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'}
|
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class PersonalForm(EvaForm):
|
2021-03-02 09:54:35 +00:00
|
|
|
# TODO: comment this back in to use implementation of change or exit process
|
|
|
|
# choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
|
|
|
|
# label='Welcher Prozess soll angestoßen werden?')
|
2021-01-20 10:02:22 +00:00
|
|
|
|
2021-01-11 15:12:20 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
2023-10-24 14:25:48 +00:00
|
|
|
fields = ['firstname', 'lastname', 'department', 'team', 'add_to_wikimediade',]
|
2021-01-11 15:12:20 +00:00
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class WorkingForm(EvaForm):
|
2021-02-09 11:45:33 +00:00
|
|
|
|
|
|
|
def clean(self):
|
|
|
|
data = self.cleaned_data
|
2021-09-14 10:59:18 +00:00
|
|
|
if data['works_in_gs'] and data['desk'] is None:
|
2021-02-09 11:45:33 +00:00
|
|
|
raise ValidationError('Wer nicht remote arbeitet braucht einen Schreibtisch!')
|
|
|
|
return data
|
|
|
|
|
2021-01-11 15:12:20 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
2021-01-13 12:12:40 +00:00
|
|
|
fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german',
|
2021-09-14 10:59:18 +00:00
|
|
|
'jobdescription_english', 'works_in_gs', 'desk',]
|
2021-01-11 15:12:20 +00:00
|
|
|
widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
|
|
|
|
'firstdate_presence': DateInput(attrs={'type': 'date'}),}
|
2021-01-13 12:12:40 +00:00
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class ITForm(EvaForm):
|
2021-09-14 10:59:18 +00:00
|
|
|
|
2021-01-13 12:12:40 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
|
|
|
fields = [
|
2024-12-04 14:06:33 +00:00
|
|
|
'framework', 'os', 'keyboard', 'mobile', 'landline',
|
2023-10-24 14:25:48 +00:00
|
|
|
'comment', 'language', 'accounts', 'lists', 'rebu2go' ]
|
2021-01-13 12:12:40 +00:00
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class OfficeForm(EvaForm):
|
2021-01-13 12:12:40 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
2021-03-02 12:41:59 +00:00
|
|
|
fields = ['transponder', 'special', 'post_office_box',]
|
2021-02-02 09:30:00 +00:00
|
|
|
|
2021-02-04 09:41:52 +00:00
|
|
|
class ChangeForm(EvaForm):
|
2021-02-02 09:30:00 +00:00
|
|
|
class Meta:
|
|
|
|
model = Employee
|
|
|
|
fields = ['firstdate_employment', 'jobdescription_german', 'jobdescription_english',
|
|
|
|
'desk', 'comment', 'accounts', 'lists', 'transponder']
|
2021-02-02 09:33:51 +00:00
|
|
|
widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),}
|