Skip to content

Repository files navigation

Atlas Copco Intervention Report

A modern, installable web app for Atlas Copco service technicians to generate, sign, and print intervention reports on any device β€” phone, tablet, or desktop. Works fully offline once installed.

Form screenshot

Branded throughout β€” the official Atlas Copco colour palette (#0092BC / RGB 0,146,188), the horizontal AtlasCopco wordmark in the header, and a coloured teal bar on every printed PDF page.


✨ Features

πŸ“‹ Smart form

  • Auto-formatted dates β€” DD/MM/YYYY across every device, with a built-in calendar picker
  • 24-hour time inputs β€” HH:MM, auto-inserted colon as you type
  • 6-character unique report IDs β€” base36, collision-checked against the local database
  • 46 inline tooltips β€” hover any label for guidance on what to fill in

⏱ Work & travel time tracking

  • Dynamic rows with auto-calculated durations (handles overnight crossings)
  • Live totals at the bottom of each table
  • Pre-validated time format, no AM/PM ambiguity ever

✍️ Signatures

  • Draw with mouse, finger, or stylus
  • Names auto-fill from Contact / Technician fields
  • Signatures persist with the report β€” visible on the saved card and on the printed PDF
  • Date stamps match the report date in DD/MM/YYYY format
  • Date stamps preserved on re-print

πŸ–Ό Images & torque graphs

  • Optional attachments block between Notes and Work Time β€” toggleable when needed, hidden by default
  • Drag-and-drop or click-to-browse for image files (PNG, JPG, GIF, SVG, WebP β€” up to 5 MB each)
  • Per-image caption β€” printed in italics below the image on the PDF
  • Multiple images β€” grid layout, each with thumbnail, caption input, file name, Remove button
  • Round-trips through JSON β€” images stored as base64 data URLs so the saved-to-JSON β†’ load-from-JSON flow preserves them exactly
  • Prints to PDF β€” each image renders full-width between Notes and Work Time with its caption
  • Carries over on Clone β€” unlike signatures (which are session-only), attachments are persisted data so they DO clone with the report

Attachments section

πŸ“¦ Reports & data

  • Save Report β€” persists to the local SQLite database when run with ./serve.sh, or to browser localStorage on static hosting/GitHub Pages
  • Save to JSON β€” download a portable backup with a descriptive filename (<customer>_<date>_<id>.json) β€” includes base64-encoded images
  • Load from JSON β€” round-trip restore of every field including attachments
  • Clone β€” copy a saved report into a fresh form (images carry over)
  • Delete individual or all reports

πŸ“„ Print to PDF

  • Branded teal colour header on the first page β€” matches the web page header
  • Official AtlasCopco wordmark in the upper-right of the printed header
  • Images & Graphs section between Notes and Work Time when attachments are enabled
  • PDF file gets the same filename pattern as JSON exports (<customer>_<date>_<id>.pdf) so every saved PDF has a unique, descriptive name
  • 2–3 page A4 layout: form fields + Psets/notes + work/travel/signatures
  • Saved Reports section is hidden in print β€” the PDF only contains the current report, never data from other customers or interventions
  • Compact print styles, hides buttons and decorative chrome

Printed PDF β€” page 1 with header + first form fields

Printed PDF β€” page 2 with attached torque graph + Work Time

πŸ“± Installable PWA

  • Add to Home Screen on Android / iOS
  • Install as standalone app on desktop Chrome/Edge
  • Service worker pre-caches the app shell β€” full offline use after first load
  • Branded teal theme with the new AtlasCopco wordmark, 192/512/maskable icons

πŸ“± Mobile-friendly

  • Custom date/time inputs scale gracefully on 390 px-wide screens
  • Action buttons stack vertically on mobile (full-width)
  • Work Time / Travel Time tables scroll horizontally instead of being truncated
  • The calendar picker is touch-friendly and stays on-screen

Mobile view

πŸ§ͺ Built-in demo

  • Fill Demo button loads a complete Stellantis NV scenario
  • Safety confirm before overwriting real data
  • One click to see every feature in action

πŸš€ Quick start

Local server with SQLite

Run this from the project root:

./serve.sh

The launcher starts the local Python server, creates ./data/intervention_reports.sqlite3, and opens http://127.0.0.1:8000/ when possible. Use a custom port or suppress browser launch like this:

./serve.sh 8765
./serve.sh --no-browser

For a fully portable/offline stick, keep the whole folder together and either:

  • use a machine that already has Python 3 + sqlite3, or
  • drop a portable interpreter under runtime/python/bin/python3, or
  • point INTERVENTION_PYTHON to a local interpreter path.

The database lives in ./data/ so the app and data travel together.

Double-click launchers

  • macOS: launch-macos.command
  • Linux: launch-linux.sh or launch-linux.desktop
  • Windows: launch-windows.bat (standalone; launch-windows.cmd is also provided)

Both launchers start the same local server/database path and are meant for USB-stick use.

Windows EXE build

If you want a distributable .exe, run build-windows-exe.ps1 on Windows with PyInstaller installed. It produces a frozen app folder with an InterventionReport.exe that serves the same local files and writes its database to ./data/intervention_reports.sqlite3 next to the EXE.

Safe updates without losing data

  • Your saved reports live in ./data/intervention_reports.sqlite3.
  • Before updating, keep the data/ folder or copy it somewhere safe.
  • Update only the app files (index.html, server.py, launchers, docs, assets).
  • If you use Git, run git pull.
  • If you use a USB copy, overwrite the app files but do not delete data/.

Static fallback

The repo still works as a static app on GitHub Pages or from index.html. When /api/health is not available, the frontend falls back to the original browser localStorage behavior.

Install as an app

  • Android Chrome / Edge β†’ menu β†’ Install app
  • iOS Safari β†’ Share β†’ Add to Home Screen
  • Desktop Chrome / Edge β†’ install icon in the address bar

Once installed it opens full-screen, runs offline, and behaves like a native app.


πŸ“– How to use

  1. Fill the report β€” type or paste your data. Every label has a tooltip explaining what to enter.
  2. Sign β€” toggle the signature section, draw on both pads with your finger, mouse, or stylus.
  3. Track time β€” add rows for each work block and travel trip (e.g. outbound to site, return to office). Durations and totals are calculated automatically.
  4. Attach images (optional) β€” toggle the Add images / torque graphs block to drop in photos, screenshots, or torque traces. Each image can carry a caption that prints under it on the PDF.
  5. Save Report β€” the entry appears in the Saved Reports list with full details, time tables, signature thumbnails, and attachment thumbnails.
  6. Print to PDF β€” open the browser print dialog and choose Save as PDF. The saved file gets the same descriptive name as the JSON export (e.g. stellantis-nv-aartselaar-plant_2025-12-04_VCXMFB.pdf) and shows the branded teal header with the AtlasCopco wordmark on the first page. Attached images appear between Notes and Work Time. Hand the file to the customer.
  7. Back up β€” Save to JSON downloads a portable file with a descriptive name like stellantis-nv-aartselaar-plant_2025-12-04_VCXMFB.json (customer name sanitized, ISO date, report ID). Images are embedded as base64 data URLs so they round-trip exactly. Load from JSON restores it on any device.
  8. Fill Demo β€” explore the app with one click (asks for confirmation before overwriting real data).

Tips

  • The form is a single page β€” scroll to find any section.
  • After saving, the form resets its id and date but keeps your data so you can keep working. Click Clear to start truly fresh.
  • Signatures survive Save Report β€” they only wipe on Clear, Clone, or Load from JSON.
  • Attachments survive Save Report AND Clone β€” they're persisted data so they carry over with the report.

πŸ–Ό Screenshots

The filled form

Form

Images & Graphs attachments section

Attachments

Printed PDF β€” page 1 (teal header + AtlasCopco wordmark + form fields)

PDF page 1

Printed PDF β€” page 2 (attached image with caption + Work Time / Travel Time + signatures)

PDF page 2

Saved report card (in the form view)

Saved card

Mobile view (390 px)

Mobile


πŸ›  Tech stack

App Single-file index.html β€” vanilla HTML/CSS/JS, no build step
PWA manifest.json + sw.js (cache-first strategy)
Icons SVG sources in icons/, exported to PNG at 32/180/192/512 px
Storage SQLite via the local Python API when available; browser localStorage fallback; FileReader + Blob for JSON I/O
Dependencies None

Architecture notes

  • Storage source of truth β€” when launched with ./serve.sh, reports are stored as JSON records in intervention_reports.sqlite3 through /api/reports. On static hosting, every report lives in localStorage under the key reports as before.
  • API fallback β€” the frontend probes /api/health on startup. If the API is absent or later fails, it keeps working with browser storage and visible warnings for write failures.
  • Custom date & time inputs β€” the native <input type="date"> and <input type="time"> were replaced because too many browsers ignore the lang attribute and fall back to the OS locale (MM/DD/YYYY or AM/PM). The custom inputs always show DD/MM/YYYY and HH:MM (24h), independent of platform.
  • Signature persistence β€” the canvas pixel data is captured with toDataURL('image/png') and stored as a base64 string on the report. Restoring is just drawImage back onto a fresh canvas.
  • Service worker β€” pre-caches the app shell on install, falls back to index.html for navigation when offline, and serves cached files before the network on every subsequent load.

πŸ“ Project layout

intervention-report/
β”œβ”€β”€ index.html                ← the whole app (HTML + CSS + JS)
β”œβ”€β”€ server.py                 ← stdlib-only local static/API server
β”œβ”€β”€ serve.sh                  ← startup script for server + browser launch
β”œβ”€β”€ manifest.json             ← PWA manifest
β”œβ”€β”€ sw.js                     ← service worker (pre-caches the app shell)
β”œβ”€β”€ icons/
β”‚   β”œβ”€β”€ icon.svg              ← source vector for the PWA/app icon
β”‚   β”œβ”€β”€ icon-maskable.svg     ← maskable variant
β”‚   β”œβ”€β”€ icon-192.png          ← Android home screen
β”‚   β”œβ”€β”€ icon-512.png          ← Android splash
β”‚   β”œβ”€β”€ icon-maskable-512.png ← adaptive launcher
β”‚   β”œβ”€β”€ apple-touch-icon.png  ← iOS home screen (180Γ—180)
β”‚   β”œβ”€β”€ favicon-32.png        ← browser tab
β”‚   └── atlas-copco-logo.png  ← official AtlasCopco wordmark used in the
β”‚                              header (screen + print). Replaceable.
β”œβ”€β”€ docs/                     ← screenshots used by this README
β”‚   β”œβ”€β”€ screenshot-form.png         ← filled form (web view)
β”‚   β”œβ”€β”€ screenshot-attachments.png  ← Images & Graphs section
β”‚   β”œβ”€β”€ screenshot-pdf.png          ← printed PDF page 1
β”‚   β”œβ”€β”€ screenshot-pdf-page2.png    ← printed PDF page 2 (attachments)
β”‚   β”œβ”€β”€ screenshot-mobile.png       ← mobile view (390 px)
β”‚   β”œβ”€β”€ screenshot-mobile-calendar.png
β”‚   └── screenshot-saved-card.png   ← saved report card
└── .gitignore

🀝 Contributing

This is an internal tool for Atlas Copco service engineers. If you have suggestions or bug reports, open an issue on this repo.

When working on the form:

  1. Use lang="en-GB" (already set) so any future native inputs respect the right format.
  2. New time-table rows must call addTimeRow(tbodyId, data) β€” it wires up the auto-calculation.
  3. New persistent fields must be added to fieldMap (for collectFormData / fillForm) and the JSON save handler.
  4. Signatures should always round-trip through collectSignatures() / restoreSignatures().
  5. Attachments should always round-trip through collectAttachments() / restoreAttachments() β€” both are paired and called together in the save/load flow.
  6. When updating the brand colour, derive all CSS variables from one source (the :root block) and re-derive the dark/light/tint shades so every component stays in sync.
  7. Test offline: open DevTools β†’ Application β†’ Service Workers β†’ check Offline, then reload. Bump CACHE_VERSION in sw.js when you change the app shell so installed PWAs pick up new assets.

πŸ“„ License

Internal use, Atlas Copco. All rights reserved.


Built for service technicians who need a fast, offline-capable report tool that just works on any device.

About

An Atlas Copco service intervention page.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages