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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user