diff --git a/austritt/templates/austritt/employee_form.html b/austritt/templates/austritt/employee_form.html index 6c439f2..1873750 100644 --- a/austritt/templates/austritt/employee_form.html +++ b/austritt/templates/austritt/employee_form.html @@ -50,8 +50,14 @@ {% translate "IT-relevante Angaben" %} {% elif wizard.steps.step1 == 4 %} {% translate "Sonstige Angaben" %} - + + {% elif wizard.steps.step1 == 5 %} + {% translate "PDF Abgabe Arbeitsmittel" %} + {% if pdf_data %} + {% include 'austritt/pdf_template.html' %} + {% endif %} {% endif %} + {% else %} {% if wizard.steps.step1 == 2 %} Veränderungsrelevante Angaben diff --git a/austritt/templates/austritt/pdf_template.html b/austritt/templates/austritt/pdf_template.html index fde6647..1c905e3 100644 --- a/austritt/templates/austritt/pdf_template.html +++ b/austritt/templates/austritt/pdf_template.html @@ -1,13 +1,10 @@ -{% load i18n %} -{% load static %} - - - -{% if datatable == 2 %} - - - -

Übergabedokument von Arbeitsmitteln: {{ data.firstname }} {{ data.lastname }}

+ + + + + + +

Übergabedokument von Arbeitsmitteln: {{ pdf_data.firstname }} {{ pdf_data.lastname }}

Handover sheet of work equipment:

@@ -16,15 +13,15 @@ + border-collapse: collapse;">Ausstattung/Equipment + border-collapse: collapse;">Weitergabe an/Handover to + border-collapse: collapse;">

Laptop + Ladekabel {% if pdf_data.laptop_id %} {{pdf_data.laptop_id}} {% else %} ID nicht bekannt {% endif %}

@@ -32,7 +29,7 @@ + border-collapse: collapse;">

Home-Office Geräte ({% if pdf_data.hardware %}{% for item in pdf_data.hardware %}{{ item }}{% if not forloop.last %}, {% endif %}{% endfor %}{% else %}Keine Hardware {% endif %})

@@ -40,7 +37,7 @@ + border-collapse: collapse;">{% if pdf_data.mobile == "JA" %}

Mobiltelefon (ID nicht angegeben)

{% else %}

Mobiltelefon

{% endif %} @@ -48,7 +45,7 @@ + border-collapse: collapse;">{% if pdf_data.credit_card == "JA" %}

Kreditkarte

{% else %}

Kreditkarte

{% endif %} @@ -56,7 +53,7 @@ + border-collapse: collapse;">{% if pdf_data.sim == "JA" %}

SIM Karte – bitte aushändigen lassen

{% else %}

SIM Karte

{% endif %} @@ -64,7 +61,7 @@ + border-collapse: collapse;">

Transponder Nr. {{ pdf_data.transponder_id}}

@@ -80,7 +77,7 @@ + border-collapse: collapse;">{% if pdf_data.pension == "JA" %}

MA hat BAV Unterlagen erhalten

{% else %}

MA hat BAV Unterlagen erhalten

{% endif %} @@ -88,7 +85,7 @@ + border-collapse: collapse;">

{% if pdf_data.miscellaneous %}Sonstiges: {{ pdf_data.miscellaneous }} {% else %} Sonstiges{% endif %}

@@ -114,7 +111,7 @@ + border-collapse: collapse;"> {% if pdf_data.bahncard == "JA" %}BahnCard {% else %} BahnCard{% endif %} @@ -127,7 +124,7 @@ @@ -160,5 +157,5 @@
[X] Ausstattung/Equipment Weitergabe an/Handover to

Laptop + Ladekabel {{% if data.laptop_id %}} {{data.laptop_id}} {{% else %}} ID nicht bekannt {{% endif %}}

IT

Home-Office Geräte (Monitor, Kabel, Tastatur, Maus)

IT
{{% if data.mobile=="JA" %}}

Mobiltelefon (ID nicht angegeben)

{{% else %}}

Mobiltelefon

{{% endif %}}
IT
{{% if data.credit_card=="JA" %}}

Kreditkarte

{{% else %}}

Kreditkarte

{{% endif %}}
{{% if data.sim=="JA" %}}

SIM Karte – bitte aushändigen lassen

{{% else %}}

SIM Karte

{{% endif %}}

Transponder Nr.

{{ data.transponder_id}}
Office
{{% if data.pension=="JA" %}}

MA hat BAV Unterlagen erhalten

{{% else %}}

MA hat BAV Unterlagen erhalten

{{% endif %}}
HR

Sonstiges: {{ data.miscenalleous }}

{{% if data.bahncard=="JA" %}}BahnCard {{% else %}} BahnCard{{% endif %}} falls vorhanden, kann diese behalten werden, da sie ausläuft

Rückgabe: 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.

-

Handover: 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.

+

Handover: 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/pdf_data protection declaration, as well as compliance with the confidentiality agreement from the employment contract.

- -{% endif %} \ No newline at end of file + + \ No newline at end of file diff --git a/austritt/views.py b/austritt/views.py index b0c2361..86270af 100644 --- a/austritt/views.py +++ b/austritt/views.py @@ -43,6 +43,26 @@ def change_process(wizard): # print('CHANGE PROZESS') return not long_process(wizard) +def beautify_data_pdf(data): + # Function for displaying the form items in correct order for handover pdf + hardware = data.get('hardware', []) + choices_dict = dict(ITForm.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': 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', ''), + } + class EvaFormView(LoginRequiredMixin, CookieWizardView): template_name = 'austritt/employee_form.html' @@ -88,15 +108,23 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): 'choice_string': TYPE_CHOICES[self.choice], 'TESTMODE': testmode}) + + # six steps for testing purposes ONLY!! # 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 == 6 or (self.choice != 'IN' and self.steps.step1 == 6)): context.update({'data': self.beautify_data(self.get_all_cleaned_data()), 'datatable': 1,}) + + if (self.steps.step1 == 5): + context.update({'pdf_data': beautify_data_pdf(self.get_all_cleaned_data()), + }) + 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) @@ -111,6 +139,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): 'datatable': 2,}) return context + def get_form_instance(self,step): ''' this method assures, that we use the same model instance for all steps''' @@ -232,29 +261,4 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): 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"), - }