From 3336bf98bbc394de048b509157fe40859cd01799 Mon Sep 17 00:00:00 2001 From: JasonFraser Date: Thu, 27 Aug 2026 17:41:52 -0400 Subject: [PATCH] Add Payslip Generator tool A self-contained, entirely client-side tool (fill in details, live preview, download PDF) - no server-side business logic, so unlike the other tools there's no logic.py, just a route serving the page. - Wired into the platform: Blueprint at /payslip/, registered in main.py, landing-page card added. - Header logo linked back to / (every other tool's header does this; the original standalone page didn't). - SRI-pinned the PDF-generation script tags so a compromised/MITM'd CDN response can't silently run in a page handling employee/contractor pay data. - Earnings/deductions columns padded with blank filler rows so "Gross earnings" and "Total deductions" always land on the same line, regardless of how many rows either side has. - Rewrote PDF generation to call html2canvas + jsPDF directly instead of through html2pdf.js: its bundled html2canvas mis-rendered (blank or truncated) shorter payslips, reproducible and confirmed via a controlled A/B test against the current standalone html2canvas. Direct usage also fixes page-fit (custom page size, hotfixes for correct px scaling, orientation/rounding handled explicitly) so the PDF matches the on-screen preview on a single page. Co-Authored-By: Claude Sonnet 5 --- app/main.py | 13 + app/tools/payslip/__init__.py | 3 + app/tools/payslip/routes.py | 12 + templates/payslip/index.html | 849 ++++++++++++++++++++++++++++++++++ 4 files changed, 877 insertions(+) create mode 100644 app/tools/payslip/__init__.py create mode 100644 app/tools/payslip/routes.py create mode 100644 templates/payslip/index.html diff --git a/app/main.py b/app/main.py index 514e142..16f497b 100644 --- a/app/main.py +++ b/app/main.py @@ -4,6 +4,7 @@ from flask import Flask, render_template from tools.eib import eib_bp from tools.donor_report import donor_report_bp from tools.financial_reports import financial_reports_bp +from tools.payslip import payslip_bp # ── Tool registry ──────────────────────────────────────────────────────────── # Each entry drives one card on the landing page. Add a new tool by @@ -42,6 +43,17 @@ TOOLS = [ "url": "/financial-reports/", "status": "online", }, + { + "name": "Payslip Generator", + "tagline": "Fill in, preview, download PDF", + "description": ( + "Generates a formatted payslip from company/employee details and " + "earnings/deductions lines, entirely in the browser - nothing is " + "uploaded to a server." + ), + "url": "/payslip/", + "status": "online", + }, ] @@ -54,6 +66,7 @@ def create_app(): app.register_blueprint(eib_bp) app.register_blueprint(donor_report_bp) app.register_blueprint(financial_reports_bp) + app.register_blueprint(payslip_bp) @app.route("/") def home(): diff --git a/app/tools/payslip/__init__.py b/app/tools/payslip/__init__.py new file mode 100644 index 0000000..fbfdaf2 --- /dev/null +++ b/app/tools/payslip/__init__.py @@ -0,0 +1,3 @@ +from .routes import payslip_bp + +__all__ = ["payslip_bp"] diff --git a/app/tools/payslip/routes.py b/app/tools/payslip/routes.py new file mode 100644 index 0000000..88a6d94 --- /dev/null +++ b/app/tools/payslip/routes.py @@ -0,0 +1,12 @@ +from flask import Blueprint, render_template + +# Payslip Generator is entirely client-side (form -> live preview -> PDF, all +# in the browser, nothing uploaded) - there's no server-side business logic, +# so unlike this repo's other tools there's no logic.py here, just the one +# page route. +payslip_bp = Blueprint("payslip", __name__, url_prefix="/payslip") + + +@payslip_bp.route("/") +def index(): + return render_template("payslip/index.html") diff --git a/templates/payslip/index.html b/templates/payslip/index.html new file mode 100644 index 0000000..0328c08 --- /dev/null +++ b/templates/payslip/index.html @@ -0,0 +1,849 @@ + + + + + +Payslip Generator — Undo Designs + + + + + + + + +
+ +
+ + + +
+ Payslip Generator +
+
+ + + + Runs entirely in your browser — nothing is uploaded +
+
+ +
+
+
Undo Designs
+

Payslip Generator

+

Fill in the details on the left — the payslip updates live on the right. Your company logo, employee data, and figures never leave this page: there's no server, no upload, no tracking.

+
+ + +
+
+
1Company
+
+ +
+ +
Click to upload or drag & drop — stays on this page only
+
+ Logo preview + +
+
+
+
+ + +
+
+ + +
+
+ +
+
2Contractor
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ +
+
3Earnings
+
+ +
+ +
+
4Deductions
+
+ +
+ +
+ + +
+
+ + +
+
+
Live preview
+
+ + +
+
+ +
+
+
+ +
+
Undo Designs
+
19 Charlotte Street +Toronto, ON M5V 2H5
+
+
+
+

Payslip

+
August 2026
+
+
+ +
+
Contractor nameJordan Rivers
+
Contractor IDEMP-0142
+
DesignationSoftware Engineer
+
DepartmentEngineering
+
Pay date—
+
Bank account—
+
+ +
+
+
Earnings
+
+
Gross earnings0.00
+
+
+
Deductions
+
+
Total deductions0.00
+
+
+ +
+
Gross earnings0.00
+
Total deductions0.00
+
Net pay0.00
+
Zero only
+
+ + +
+
+
+ +
+ Built by Undo Designs · Payslip Generator v1 · 100% client-side +
+ + + + \ No newline at end of file