Add optional signature upload to invoice PDF
Adds a drag-and-drop/click upload field on the invoice editor for an optional 420x210 JPG/PNG signature image. The signature is stored as part of invoice_data and rendered on the generated PDF directly above the QR code, right-aligned with sensible margins. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -30,4 +30,23 @@ describe('normalizeInvoiceData', () => {
|
||||
{ mnozstvi: 'not-a-number', cenaZaMj: 10 }
|
||||
] })).toBeNull();
|
||||
});
|
||||
|
||||
test('accepts a valid signature data URL and rejects invalid ones', () => {
|
||||
const withValidSignature = normalizeInvoiceData({
|
||||
items: [{ mnozstvi: 1, cenaZaMj: 10 }],
|
||||
signature: 'data:image/png;base64,aGVsbG8='
|
||||
});
|
||||
expect(withValidSignature.signature).toBe('data:image/png;base64,aGVsbG8=');
|
||||
|
||||
const withInvalidSignature = normalizeInvoiceData({
|
||||
items: [{ mnozstvi: 1, cenaZaMj: 10 }],
|
||||
signature: 'not-a-data-url'
|
||||
});
|
||||
expect(withInvalidSignature.signature).toBeNull();
|
||||
|
||||
const withoutSignature = normalizeInvoiceData({
|
||||
items: [{ mnozstvi: 1, cenaZaMj: 10 }]
|
||||
});
|
||||
expect(withoutSignature.signature).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user