This repository has been archived on 2020-07-12. You can view files and clone it, but cannot push or open issues/pull-requests.
mitgliedsantrag/src/js/script.js

47 lines
1.2 KiB
JavaScript

'use strict'
const numSteps = 1
_.forEach(_.range(numSteps), function (value) {
$('#step-' + (value + 1) + ' form').submit(function (event) {
$('#step-' + (value + 2)).collapse('show')
$('#step-' + (value + 1) + '-heading .step-number').addClass('done')
event.preventDefault()
})
})
$('#generate').click(function () {
var model = {}
_.forEach(_.range(numSteps), function (value) {
_.each($('#step-' + (value + 1) + ' form').serializeArray(), function (value) {
model[value.name] = value.value
})
})
var docDefinition = {
content: [
{ text: 'Mitgliedsantrag FabLab Neustadt Aisch/Bad Windsheim', fontSize: 20, margin: [0, 0, 0, 20] },
{
text: [
'Name: ',
{ text: model.givenname + ' ' + model.surname, bold: true }
]
},
{
text: [
'Adresse: ',
{ text: model.address, bold: true }
]
},
{
text: [
'PLZ + Ort: ',
{ text: model.zip + ' ' + model.place, bold: true }
]
}
],
pageSize: 'A4',
pageMargins: [ 62.3622, 60, 62.3622, 60 ]
}
pdfMake.createPdf(docDefinition).download('Mitgliedsantrag FabLab NEA.pdf')
})