From 78f61b6c6e0bb9d0d5e514eb3d59a5597bb8ea41 Mon Sep 17 00:00:00 2001 From: "me@jeffersonbledsoe.com" Date: Tue, 25 Apr 2023 16:37:17 +0100 Subject: [PATCH] Add option to change email format --- src/formSchema.js | 59 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/src/formSchema.js b/src/formSchema.js index e351aad..35925c2 100644 --- a/src/formSchema.js +++ b/src/formSchema.js @@ -47,30 +47,44 @@ const messages = defineMessages({ id: 'form_send_email', defaultMessage: 'Send email to recipient', }, + email_format: { + id: 'form_email_format', + defaultMessage: 'Email format', + }, }); -export default () => { +export default (formData) => { var intl = useIntl(); + const fieldsets = [ + { + id: 'default', + title: 'Default', + fields: [ + 'title', + 'description', + 'default_to', + 'default_from', + 'default_subject', + 'submit_label', + 'captcha', + 'store', + 'send', + ], + }, + ]; + + if (formData?.send) { + fieldsets.push({ + id: 'sendingOptions', + title: 'Sending options', + fields: ['email_format'], + }); + } + return { title: intl.formatMessage(messages.form), - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: [ - 'title', - 'description', - 'default_to', - 'default_from', - 'default_subject', - 'submit_label', - 'captcha', - 'store', - 'send', - ], - }, - ], + fieldsets: fieldsets, properties: { title: { title: intl.formatMessage(messages.title), @@ -107,6 +121,15 @@ export default () => { type: 'boolean', title: intl.formatMessage(messages.send), }, + email_format: { + title: intl.formatMessage(messages.email_format), + type: 'string', + choices: [ + ['list', 'List'], + ['table', 'Table'], + ], + noValueOption: false, + }, }, required: ['default_to', 'default_from', 'default_subject'], };