fixed form view for step 4
This commit is contained in:
parent
b4512a2739
commit
78539cb582
|
|
@ -50,15 +50,6 @@
|
||||||
{% translate "IT-relevante Angaben" %}
|
{% translate "IT-relevante Angaben" %}
|
||||||
{% elif wizard.steps.step1 == 4 %}
|
{% elif wizard.steps.step1 == 4 %}
|
||||||
{% translate "Sonstige Angaben" %}
|
{% translate "Sonstige Angaben" %}
|
||||||
<!-- Delete when in production!! -->
|
|
||||||
<!--{% elif wizard.steps.step1 == 5 %}
|
|
||||||
{% translate "PDF Abgabe Arbeitsmittel" %}
|
|
||||||
{% if pdf_data %}
|
|
||||||
{% include 'austritt/pdf_template.html' %}
|
|
||||||
<a href="{% url 'pdf-preview' %}" target="_blank">
|
|
||||||
<button type="button">Als PDF speichern</button>
|
|
||||||
</a>
|
|
||||||
{% endif %}-->
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ def beautify_data_pdf(data):
|
||||||
|
|
||||||
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, DummyForm]
|
form_list = [PersonalForm, HRForm, ITForm, RestForm, DummyForm, DummyForm]
|
||||||
instance = None
|
instance = None
|
||||||
choice = 'IN'
|
choice = 'IN'
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
|
||||||
|
|
||||||
# six steps for testing purposes ONLY!!
|
# six steps for testing purposes ONLY!!
|
||||||
# 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 == 6 or (self.choice != 'IN' and self.steps.step1 == 6)):
|
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': 1,})
|
'datatable': 1,})
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
|
||||||
#hardcoded imagepath => change for production!!!
|
#hardcoded imagepath => change for production!!!
|
||||||
context_pdf ={
|
context_pdf ={
|
||||||
'pdf_data': pdf_data,
|
'pdf_data': pdf_data,
|
||||||
'image_path': '/path/to/your/eva/austritt/static/evapp/logo.png'
|
'image_path': '/srv/austritt/static/evapp/logo.png'
|
||||||
}
|
}
|
||||||
html_string =render_to_string('austritt/pdf_template.html', context_pdf, request=self.request)
|
html_string =render_to_string('austritt/pdf_template.html', context_pdf, request=self.request)
|
||||||
buffer=io.BytesIO()
|
buffer=io.BytesIO()
|
||||||
|
|
@ -203,7 +203,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
|
||||||
elif department != "SUBMITTER":
|
elif department != "SUBMITTER":
|
||||||
|
|
||||||
# comment this back in if you wanna run mail attachments
|
# comment this back in if you wanna run mail attachments
|
||||||
'''if pdf and department == "OFFICE":
|
if pdf and department == "OFFICE":
|
||||||
mail= EmailMessage(
|
mail= EmailMessage(
|
||||||
subject=f'EVA: Austritt {firstname} {lastname} {lastday} (MAILTEST)',
|
subject=f'EVA: Austritt {firstname} {lastname} {lastday} (MAILTEST)',
|
||||||
body=mail_template.render(context),
|
body=mail_template.render(context),
|
||||||
|
|
@ -213,8 +213,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
|
||||||
mail.attach(f'Rueckgabe_Arbeitsmittel_{firstname}_{lastname}.pdf', pdf_bytes, 'application/pdf')
|
mail.attach(f'Rueckgabe_Arbeitsmittel_{firstname}_{lastname}.pdf', pdf_bytes, 'application/pdf')
|
||||||
mail.send(fail_silently=False)
|
mail.send(fail_silently=False)
|
||||||
else:
|
else:
|
||||||
'''
|
send_mail(
|
||||||
send_mail(
|
|
||||||
f'EVA: Austritt {firstname} {lastname} {lastday}',
|
f'EVA: Austritt {firstname} {lastname} {lastday}',
|
||||||
mail_template.render(context),
|
mail_template.render(context),
|
||||||
EVA_MAIL,
|
EVA_MAIL,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue