feat: load invoice templates from JSON files via backend

Templates are now loaded dynamically from data/templates/*.json
via the get_invoice_templates Tauri command instead of being
hardcoded in TypeScript. Preview and PDF renderer switch on
template.layout instead of template.id, allowing custom templates
to reuse built-in layouts with different colors.
This commit is contained in:
Your Name
2026-02-18 15:17:54 +02:00
parent 5680194ef4
commit edccc12c34
4 changed files with 51 additions and 327 deletions

View File

@@ -506,7 +506,7 @@ import AppNumberInput from '../components/AppNumberInput.vue'
import AppSelect from '../components/AppSelect.vue'
import AppDatePicker from '../components/AppDatePicker.vue'
import InvoicePreview from '../components/InvoicePreview.vue'
import { getTemplateById, getTemplatesByCategory, TEMPLATE_CATEGORIES } from '../utils/invoiceTemplates'
import { getTemplateById, getTemplatesByCategory, loadTemplates, TEMPLATE_CATEGORIES } from '../utils/invoiceTemplates'
import type { BusinessInfo } from '../utils/invoicePdfRenderer'
import { useInvoicesStore, type Invoice, type InvoiceItem } from '../stores/invoices'
import { useClientsStore, type Client } from '../stores/clients'
@@ -794,6 +794,7 @@ onMounted(async () => {
clientsStore.fetchClients(),
projectsStore.fetchProjects(),
settingsStore.fetchSettings(),
loadTemplates(),
])
})
</script>