mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-18 10:44:08 +00:00
Fix send modals: from email and preview rendering
fetchBasicMailConfig() was calling the wrong endpoint (company-config instead of default config). Also, the response has no .data wrapper so from_mail was never extracted. Fixed in all three send modals. Estimate and payment preview blob construction now falls back to the raw response when .data is undefined, matching the invoice modal.
This commit is contained in:
@@ -241,8 +241,8 @@ async function setInitialData() {
|
||||
|
||||
estimateMailForm.id = modalStore.id as number
|
||||
|
||||
if (admin.data) {
|
||||
estimateMailForm.from = (admin.data as Record<string, string>).from_mail
|
||||
if (admin.from_mail) {
|
||||
estimateMailForm.from = admin.from_mail as string
|
||||
}
|
||||
|
||||
if (modalData.value) {
|
||||
@@ -274,9 +274,10 @@ async function submitForm() {
|
||||
isLoading.value = false
|
||||
|
||||
isPreview.value = true
|
||||
const blob = new Blob([(previewResponse as { data: string }).data], {
|
||||
type: 'text/html',
|
||||
})
|
||||
const blob = new Blob(
|
||||
[(previewResponse as { data: string }).data ?? previewResponse],
|
||||
{ type: 'text/html' },
|
||||
)
|
||||
templateUrl.value = URL.createObjectURL(blob)
|
||||
|
||||
return
|
||||
|
||||
@@ -290,8 +290,8 @@ async function setInitialData(): Promise<void> {
|
||||
|
||||
form.id = modalStore.id
|
||||
|
||||
if (admin?.data) {
|
||||
form.from = (admin.data as Record<string, unknown>).from_mail as string
|
||||
if (admin?.from_mail) {
|
||||
form.from = admin.from_mail as string
|
||||
}
|
||||
|
||||
if (modalData.value?.customer) {
|
||||
|
||||
@@ -244,8 +244,8 @@ async function setInitialData() {
|
||||
const admin = await companyStore.fetchBasicMailConfig()
|
||||
paymentMailForm.id = modalStore.id as number
|
||||
|
||||
if (admin.data) {
|
||||
paymentMailForm.from = (admin.data as Record<string, string>).from_mail
|
||||
if (admin.from_mail) {
|
||||
paymentMailForm.from = admin.from_mail as string
|
||||
}
|
||||
|
||||
if (modalData.value) {
|
||||
@@ -275,9 +275,10 @@ async function sendPaymentData() {
|
||||
isLoading.value = false
|
||||
|
||||
isPreview.value = true
|
||||
const blob = new Blob([(previewResponse as { data: string }).data], {
|
||||
type: 'text/html',
|
||||
})
|
||||
const blob = new Blob(
|
||||
[(previewResponse as { data: string }).data ?? previewResponse],
|
||||
{ type: 'text/html' },
|
||||
)
|
||||
templateUrl.value = URL.createObjectURL(blob)
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user