mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-06 03:30:25 -06:00
Major Features: - Invoice Expenses: Allow linking billable expenses to invoices with automatic total calculations - Add expenses to invoices via "Generate from Time/Costs" workflow - Display expenses in invoice view, edit forms, and PDF exports - Track expense states (approved, invoiced, reimbursed) with automatic unlinking on invoice deletion - Update PDF generator and CSV exports to include expense line items - Enhanced PDF Invoice Editor: Complete redesign using Konva.js for visual drag-and-drop layout design - Add 40+ draggable elements (company info, invoice data, shapes, text, advanced elements) - Implement comprehensive properties panel for precise element customization (position, fonts, colors, opacity) - Add canvas toolbar with alignment tools, zoom controls, and layer management - Support keyboard shortcuts (copy/paste, duplicate, arrow key positioning) - Save designs as JSON for editing and generate clean HTML/CSS for rendering - Add real-time preview with live data - Uploads Persistence: Implement Docker volume persistence for user-uploaded files - Add app_uploads volume to all Docker Compose configurations - Ensure company logos and avatars persist across container rebuilds and restarts - Create migration script for existing installations - Update directory structure with proper permissions (755 for dirs, 644 for files) Database & Backend: - Add invoice_pdf_design_json column to settings table via Alembic migration - Extend Invoice model with expenses relationship - Update admin routes for PDF layout designer endpoints - Enhance invoice routes to handle expense linking/unlinking Frontend & UI: - Redesign PDF layout editor template with Konva.js canvas (2484 lines, major overhaul) - Update invoice edit/view templates to display and manage expenses - Add expense sections to invoice forms with unlink functionality - Enhance UI components with keyboard shortcuts support - Update multiple templates for consistency and accessibility Testing & Documentation: - Add comprehensive test suites for invoice expenses, PDF layouts, and uploads persistence - Create detailed documentation for all new features (5 new docs) - Include migration guides and troubleshooting sections Infrastructure: - Update docker-compose files (main, example, remote, remote-dev, local-test) with uploads volume - Configure pytest for new test modules - Add template filters for currency formatting and expense display This update significantly enhances TimeTracker's invoice management capabilities, improves the PDF customization experience, and ensures uploaded files persist reliably across deployments.
6.9 KiB
6.9 KiB
PDF Invoice Editor - Quick Start Guide
Getting Started in 5 Minutes
This guide will help you create your first custom invoice layout using the enhanced Konva.js-based PDF editor.
Step 1: Access the Editor
- Log in as an admin user
- Navigate to Admin Panel → PDF Layout Designer
- You'll see three main sections:
- Left: Element library
- Center: Canvas workspace
- Right: Properties panel
Step 2: Understanding the Interface
Element Library (Left Sidebar)
Elements are organized into groups:
- Basic Elements: Text, headings, shapes
- Company Info: Logo, name, address, contact details
- Invoice Data: Numbers, dates, client info, totals
- Advanced: QR codes, watermarks, page numbers
Canvas (Center)
- The white canvas represents your invoice page (A4 size)
- Elements can be clicked, dragged, and resized
- Use toolbar buttons for zoom and alignment
Properties Panel (Right)
- Shows properties of selected element
- Edit text, colors, fonts, positions
- Control layer order (z-index)
Step 3: Add Your First Element
- Click "Heading" from Basic Elements
- The element appears on the canvas
- Click it to select (you'll see resize handles)
- In the properties panel (right):
- Change text to "INVOICE"
- Set font size to 32
- Choose a color
Step 4: Build Your Layout
Add Company Header
- Click "Company Logo" (if you've uploaded one)
- Position it in the top-left (drag or use X/Y properties)
- Click "Company Name" and position below logo
- Add "Company Details" for contact info
Add Invoice Details
- Click "Invoice Number" - place top-right
- Click "Invoice Date" - place below number
- Click "Due Date" - place below date
Add Client Information
- Click "Client Info" - place left side, below company info
- Adjust position to your liking
Add Items Table
- Click "Items Table"
- Position in the middle of the page
- Resize if needed using handles
Add Totals
- Click "Subtotal" - place below items table
- Click "Tax" - place below subtotal
- Click "Total Amount" - place below tax
Step 5: Customize with Shapes
Add a Header Background
- Click "Rectangle" from Basic Elements
- Position at the very top
- In properties:
- Set Fill Color to a light color (e.g., #f3f4f6)
- Set Stroke Width to 0
- Adjust width to full page (595px)
- Set height to 100px
- Click the down arrow in Layer Order to send behind text
Add Divider Lines
- Click "Line" from Basic Elements
- Position where you want a separator
- Adjust stroke width and color in properties
- Resize by dragging endpoints
Step 6: Use Keyboard Shortcuts
Speed up your workflow:
- Arrow Keys: Move selected element (1px)
- Shift+Arrows: Move selected element (10px)
- Ctrl+D: Duplicate selected element
- Delete: Remove selected element
Step 7: Align Elements
- Select an element
- Use toolbar alignment buttons:
- Left/Center/Right for horizontal
- Top/Middle/Bottom for vertical
Step 8: Preview Your Design
- Click "Generate Preview" button (top)
- Preview appears in the right panel (below properties)
- Review how it looks with actual data
- Make adjustments as needed
Step 9: Save Your Design
- Click "Save Design" button (top)
- Your layout is saved and will be used for all invoices
- You can come back anytime to edit
Step 10: Test with Real Invoice
- Go to Invoices → Create a new invoice
- Fill in details and add items
- Click "Preview" or "Generate PDF"
- See your custom layout in action!
Common Tasks
Changing Text Content
- Select text element
- In properties panel, find "Text Content"
- Edit the text directly
- Note: Keep Jinja2 variables (e.g.,
{{ invoice.invoice_number }})
Changing Colors
- Select element
- Find color picker in properties
- Click to open color selector
- Choose your color
Resizing Elements
Method 1: Visual
- Click element to select
- Drag corner handles
Method 2: Precise
- Select element
- Use Width/Height fields in properties
Moving Elements Precisely
- Select element
- In properties panel:
- Set exact X position (horizontal)
- Set exact Y position (vertical)
Creating a Watermark
- Click "Watermark" from Advanced
- Position in center of page
- In properties:
- Set large font size (60-80)
- Set opacity to 0.1-0.2
- Choose light gray color
- Send to back using Layer Order buttons
Duplicating Sections
- Select element (e.g., a line)
- Press Ctrl+D to duplicate
- Move to new position
- Repeat as needed
Tips & Tricks
Tip 1: Use Alignment Tools
- Select multiple elements
- Use alignment buttons to line them up perfectly
Tip 2: Work in Layers
- Background elements (shapes, watermarks) go to back
- Text and important info stay on top
- Use Layer Order buttons frequently
Tip 3: Keep It Simple
- Don't overcrowd the layout
- Use whitespace effectively
- Test with real data before finalizing
Tip 4: Font Consistency
- Stick to 2-3 fonts maximum
- Use font sizes consistently:
- Heading: 24-32px
- Subheading: 16-20px
- Body: 12-14px
- Fine print: 10-11px
Tip 5: Color Harmony
- Use your brand colors
- Keep contrast high for readability
- Avoid too many colors (3-4 max)
Troubleshooting
Element Won't Move
- Make sure it's selected (should see handles)
- Try clicking it again
- Use X/Y properties for precise positioning
Can't See Element
- Check if it's hidden behind another element
- Use Layer Order to bring to front
- Check if opacity is too low
Text is Cut Off
- Increase width in properties
- Reduce font size
- Enable text wrapping
Preview Shows Wrong Data
- Preview uses last invoice in database
- Create a test invoice with realistic data
- Generate preview again
Keyboard Shortcuts Reference
| Shortcut | Action |
|---|---|
| Delete/Backspace | Remove selected element |
| Ctrl+C | Copy element |
| Ctrl+V | Paste element |
| Ctrl+D | Duplicate element |
| Arrow Keys | Move 1px |
| Shift+Arrows | Move 10px |
| Click Background | Deselect |
Next Steps
Once comfortable with the basics:
- Explore all element types
- Create multiple layout variations
- Use shapes for creative designs
- Add QR codes for payment links
- Experiment with opacity and layers
Getting Help
- See Full Feature Documentation
- Check PDF Layout Customization
- Review Invoice System Guide
Example Layout Ideas
Minimal Layout
- Simple text elements only
- Clean lines
- Lots of whitespace
Professional Layout
- Company logo in header
- Colored header background
- Clear sections with dividers
Creative Layout
- Circular logo frame
- Angled divider lines
- Watermark in background
Modern Layout
- Bold typography
- Minimal colors
- QR code for payments
Happy designing! 🎨