Add Word Document Download Option and Update Email Template Model
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

- Introduced a new option to download document templates in Word (docx) format in the NewDocumentJob component.
- Updated the EmailTemplate model to include 'docx' as a selectable format for email templates, enhancing document handling capabilities.
This commit is contained in:
Tom Butcher 2026-11-08 20:15:30 +00:00
parent 5f4f91dca5
commit ab638e398e
2 changed files with 19 additions and 1 deletions

View File

@ -218,6 +218,23 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
} }
) )
} }
},
{
label: 'Word',
key: 'docx',
onClick: () => {
setDownloading(true)
downloadTemplate(
objectData.documentTemplate._id,
objectData.documentTemplate.content,
toTemplateObjectData(objectData.objects),
fileName,
'docx',
() => {
setDownloading(false)
}
)
}
} }
] ]
} }

View File

@ -387,7 +387,8 @@ export const EmailTemplate = {
{ value: 'pdf', label: 'PDF' }, { value: 'pdf', label: 'PDF' },
{ value: 'jpeg', label: 'JPEG' }, { value: 'jpeg', label: 'JPEG' },
{ value: 'png', label: 'PNG' }, { value: 'png', label: 'PNG' },
{ value: 'svg', label: 'SVG' } { value: 'svg', label: 'SVG' },
{ value: 'docx', label: 'Word' }
], ],
value: (row) => { value: (row) => {
if (row?.type === 'documentTemplate') { if (row?.type === 'documentTemplate') {