Now accepting arrays for sponsoring contract generation

ref #5
This commit is contained in:
2021-02-05 21:56:33 +01:00
parent 4cd437b6af
commit f833ae222e
3 changed files with 14 additions and 9 deletions

View File

@@ -43,11 +43,11 @@ export class PdfCreator {
* @param runner The runner you want to generate the contracts for.
* @param locale The locale used for the contracts (default:en)
*/
public async generateSponsoringContract(runner: Runner, locale: string = "en"): Promise<any> {
public async generateSponsoringContract(runners: Runner[], locale: string = "en"): Promise<any> {
i18next.changeLanguage(locale);
const template_source = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8');
const template = Handlebars.compile(template_source);
const result = template({ runner: runner })
const result = template({ runners })
return await this.renderPdf(result, { format: "A5", landscape: true });
}