WMDE
/
eva
forked from tohe/eva
7
1
Fork 0

Setup PDF Template, changed views and employeeform to cater to it

This commit is contained in:
Marike Voßbeck 2026-03-06 13:31:50 +01:00
parent fd0ae4ea50
commit f8dcb40072
3 changed files with 213 additions and 5 deletions

View File

@ -57,13 +57,13 @@
Veränderungsrelevante Angaben Veränderungsrelevante Angaben
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if datatable == True %} {% if datatable == 1 %}
{% translate "Bestätigungsschritt" %} {% translate "Bestätigungsschritt" %}
{% endif %} {% endif %}
</p> </p>
</h2> </h2>
{% if datatable == True %} {% if datatable == 1 %}
<table id="toggle-heading"> <table id="toggle-heading">
{% for key, value in data.items %} {% for key, value in data.items %}
<tr><th>{{ key }}</th><th>{{ value }}</th></tr> <tr><th>{{ key }}</th><th>{{ value }}</th></tr>
@ -96,7 +96,7 @@
{% if wizard.steps.prev %} {% if wizard.steps.prev %}
<button formnovalidate="formnovalidate" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% translate "Zurück" %}</button> <button formnovalidate="formnovalidate" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">{% translate "Zurück" %}</button>
{% endif %} {% endif %}
{% if datatable == True %} {% if datatable == 1 %}
<button type="submit" value="{% trans "Weiter" %}">{% translate "Abschicken" %}</button> <button type="submit" value="{% trans "Weiter" %}">{% translate "Abschicken" %}</button>
{% else %} {% else %}
<button type="submit" value="{% trans "Weiter" %}">{% translate "Weiter" %}</button> <button type="submit" value="{% trans "Weiter" %}">{% translate "Weiter" %}</button>

View File

@ -0,0 +1,164 @@
{% load i18n %}
{% load static %}
{% if datatable == 2 %}
<h2>Übergabedokument von Arbeitsmitteln: {{ data.firstname }} {{ data.lastname }}</h2>
<h2 style="color:blue;">Handover sheet of work equipment: </h2>
<table class="center", style="border: 1px solid black;
border-collapse: collapse; width:90%">
<tbody>
<tr style="background-color: #d1cfcfb5;">
<th style="border: 1px solid black;
border-collapse: collapse;">[X]</th>
<th style="border: 1px solid black;
border-collapse: collapse;">Ausstattung/<strong style="color:blue;">Equipment</strong></th>
<th style="border: 1px solid black;
border-collapse: collapse;">Weitergabe an/<strong style="color:blue;">Handover to</strong></th>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;"><p>Laptop + Ladekabel <strong> {{% if data.laptop_id %}} {{data.laptop_id}} {{% else %}} ID nicht bekannt {{% endif %}} </strong></p> </td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">IT</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;"><p>Home-Office Geräte (Monitor, Kabel, Tastatur, Maus)</p></td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">IT</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;">{{% if data.mobile=="JA" %}}<p> Mobiltelefon (ID nicht angegeben)</p> {{% else %}} <p><s>Mobiltelefon</s></p>{{% endif %}}</td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">IT</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;">{{% if data.credit_card=="JA" %}}<p> Kreditkarte</p> {{% else %}} <p><s>Kreditkarte</s></p>{{% endif %}}</td>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;">{{% if data.sim=="JA" %}}<p> SIM Karte bitte aushändigen lassen</p> {{% else %}} <p><s>SIM Karte</s></p>{{% endif %}}</td>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;"><p>Transponder Nr.</p> <strong> {{ data.transponder_id}}</strong></td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">Office</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;"><p>Rollcontainer-Schlüssel: Abgabe oder im Rollcontainer gelassen</p> </td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">Office</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;">{{% if data.pension=="JA" %}}<p> MA hat BAV Unterlagen erhalten</p> {{% else %}} <p><s>MA hat BAV Unterlagen erhalten</s></p>{{% endif %}}</td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;">HR</td>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
<td style="border: 1px solid black;
border-collapse: collapse;"><p>Sonstiges: {{ data.miscenalleous }}</p></td>
<td style="border: 1px solid black;
border-collapse: collapse;"></td>
</tr>
<tr>
<td colspan="2"><p><strong>BVG-Firmenticket</strong> ist bei Austritt bis 23:59 Uhr des Monatsletzten gültig.
Es kann dann entsorgt werden.</p>
<p style="color:blue;"><strong>BVG company ticket</strong> BVG company ticket is valid until 23:59 on the last day of the month.
It can then be discarded.
</p></td>
<td style="text-align: center;border: 1px solid black;
border-collapse: collapse;"></td>
</tr>
</tbody>
</table>
<br /><br />
<table class="center", style="border: 1px solid black;
border-collapse: collapse; width:90%">
<tbody>
<tr>
<th colspan="2", style="border: 1px solid black;
border-collapse: collapse; background-color: #d1cfcfb5; "><strong>Sonstige Vereinbarungen/</strong><strong style="color:blue;">Other agreements</strong>
</th>
</tr>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"> {{% if data.bahncard=="JA" %}}<i style="color:grey;">BahnCard</i> {{% else %}} <i style="color:grey;"><s>BahnCard</s></i>{{% endif %}}</td>
<td style="border: 1px solid black;
border-collapse: collapse;text-align: center;"> <i style="color:grey;">falls vorhanden, kann diese behalten werden, da sie ausläuft</i></td>
</tr>
</tbody>
</table>
<br /><br />
<table class="center", style="border: 1px solid black;
border-collapse: collapse; width:90%">
<tbody>
<tr>
<td style="border: 1px solid black;
border-collapse: collapse;"> <p><strong>Rückgabe:</strong> Hiermit bestätige ich die vollständige Übergabe aller mir zur Verfügung gestellten Arbeitsmittel im gepflegten und funktionstüchtigen Zustand. Ich habe die Benutzung durch Dritte - sofern es sich nicht um betriebseigene Mitarbeitende handelt - nicht gestattet. Außerdem bestätige ich hiermit die vollumfängliche Zusicherung der Einhaltung der allgemeinen Vertraulichkeitserklärung/Datenschutzerklärung, sowie die Einhaltung der Verschwiegenheitsvereinbarung aus dem Arbeitsvertrag. </p>
<p style="color:blue;"><strong>Handover:</strong> I hereby confirm the complete handover of all work equipment provided to me in a well-maintained and functional condition. I have not permitted the use by third parties - unless they are employees of Wikimedia. Furthermore, I hereby confirm the full assurance of compliance with the general confidentiality declaration/data protection declaration, as well as compliance with the confidentiality agreement from the employment contract. </p>
</td>
</tr>
</tbody>
</table>
<br /><br />
<table class="center", style="border: 1px solid white;
border-collapse: collapse; width:90%;">
<tbody>
<tr >
<td style="border: 1px solid white;
border-collapse: collapse;"> <strong>Berlin</strong>, ________________</td>
<td style="border: 1px solid white;
border-collapse: collapse;">____________________</td>
<td style="border: 1px solid white;
border-collapse: collapse;">____________________________________</td>
</tr>
<tr>
<td style="border: 1px solid white;
border-collapse: collapse;"> </td>
<td style="border: 1px solid white;
border-collapse: collapse;">entgegengenommen von</td>
<td style="border: 1px solid white;
border-collapse: collapse;">Unterschrift ehem. Mitarbeitenden</td>
</tr>
<tr>
<td style="border: 1px solid white;
border-collapse: collapse;"> </td>
<td style="color:blue;">received by</td>
<td style="color:blue;">Signature of leaving employee</td>
</tr>
</tbody>
</table>
{% endif %}

View File

@ -46,7 +46,7 @@ def change_process(wizard):
class EvaFormView(LoginRequiredMixin, CookieWizardView): class EvaFormView(LoginRequiredMixin, CookieWizardView):
template_name = 'austritt/employee_form.html' template_name = 'austritt/employee_form.html'
form_list = [PersonalForm, HRForm, ITForm, RestForm, DummyForm, DummyForm] form_list = [PersonalForm, HRForm, ITForm, RestForm, DummyForm, DummyForm, DummyForm]
instance = None instance = None
choice = 'IN' choice = 'IN'
@ -91,7 +91,24 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
# deliver context for forms if we are in the last step # deliver context for forms if we are in the last step
if (self.steps.step1 == 5 or (self.choice != 'IN' and self.steps.step1 == 5)): if (self.steps.step1 == 5 or (self.choice != 'IN' and self.steps.step1 == 5)):
context.update({'data': self.beautify_data(self.get_all_cleaned_data()), context.update({'data': self.beautify_data(self.get_all_cleaned_data()),
'datatable': True,}) 'datatable': 1,})
return context
def get_pdf_data(self, form, **kwargs):
'''this method is called to give context data to the template'''
#print('GETCONTEXT')
context = super().get_pdf_data(form=form, **kwargs)
testmode = settings.DEBUG or settings.MAILTEST
context.update({'choice': self.choice,
'choice_string': TYPE_CHOICES[self.choice],
'TESTMODE': testmode})
# deliver context for forms if we are in the last step
if (self.steps.step1 == 6 or (self.choice != 'IN' and self.steps.step1 == 6)):
context.update({'data': self.beautify_data_pdf(self.get_all_cleaned_data()),
'datatable': 2,})
return context return context
def get_form_instance(self,step): def get_form_instance(self,step):
@ -214,3 +231,30 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
newdata.update({k:'' for k,v in newdata.items() if v == []}) newdata.update({k:'' for k,v in newdata.items() if v == []})
return newdata return newdata
def beautify_data_pdf(self, data):
''' # use long form for contextdata instead of short form if available
#
# ATTENTION!
# This implementation works only for unique keys over all of these dicts from model.py
#
'''
# handling multiselect field for hardware beforehand
hardware = data.get("hardware", [])
choices_dict = dict(self.form_class.base_fields["hardware"].choices)
selected_hardware = [choices_dict[val] for val in hardware]
return {
"firstname": data.get("firstname"),
"lastname": data.get("lastname"),
"laptop_id": data.get("laptop_id"),
"hardware": ", ".join(selected_hardware),
"mobile": data.get("mobile"),
"credit_card": data.get("credit_card"),
"sim": data.get("sim"),
"transponder_id": data.get("transponder_id"),
"pension": data.get("pension"),
"miscellaneous": data.get("miscellaneous"),
"bahncard": data.get("bahncard"),
}