WMDE
/
eva
forked from tohe/eva
7
1
Fork 0
eva/austritt/forms.py

52 lines
1.8 KiB
Python

from django.db import models
from django.forms import ModelForm, DateInput, Form, ChoiceField, RadioSelect
from django.core.exceptions import ValidationError
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 EvaForm(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(EvaForm):
# 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?')
class Meta:
model = Employee
fields = ['firstname', 'lastname', 'lastdate_employment', 'lastdate_office', 'lastdate_working']
widgets = {'lastdate_employment': DateInput(attrs={'type': 'date'}),
'lastdate_office': DateInput(attrs={'type': 'date'}),
'lastdate_working': DateInput(attrs={'type': 'date'}),}
class HRForm(EvaForm):
class Meta:
model = Employee
fields = ['overtime', 'holiday']
class ITForm(EvaForm):
class Meta:
model = Employee
fields = ['laptop_id', 'forward', 'forwardemail', 'documents', 'documentowner', 'mobile', 'sim', 'credit_card', 'transponder_id', 'special_logins']
class DummyForm(ModelForm):
class Meta:
model = Employee
fields = []