diff --git a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py
index fd37fba6..6926d0b2 100644
--- a/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py
+++ b/crm/fcrm/doctype/crm_fields_layout/crm_fields_layout.py
@@ -34,7 +34,7 @@ def get_fields_layout(doctype: str, type: str):
for field in section.get("fields") if section.get("fields") else []:
field = next((f for f in fields if f.fieldname == field), None)
if field:
- if field.fieldtype == "Select":
+ if field.fieldtype == "Select" and field.options:
field.options = field.options.split("\n")
field.options = [{"label": _(option), "value": option} for option in field.options]
field.options.insert(0, {"label": "", "value": ""})
@@ -45,6 +45,7 @@ def get_fields_layout(doctype: str, type: str):
"options": field.options,
"mandatory": field.reqd,
"placeholder": field.get("placeholder"),
+ "filters": field.get("link_filters")
}
section["fields"][section.get("fields").index(field["name"])] = field
diff --git a/frontend/src/components/Modals/EmailTemplateModal.vue b/frontend/src/components/Modals/EmailTemplateModal.vue
index 05338388..c00cdbc6 100644
--- a/frontend/src/components/Modals/EmailTemplateModal.vue
+++ b/frontend/src/components/Modals/EmailTemplateModal.vue
@@ -50,13 +50,25 @@
:placeholder="__('Payment Reminder from Frappé - (#{{ name }})')"
/>
+
+
+ {{ __('Content Type') }}
+
+
+
{{ __('Content') }}
*
@@ -78,7 +90,7 @@
@change="(val) => (_emailTemplate.response = val)"
:placeholder="
__(
- 'Dear {{ lead_name }}, \n\nThis is a reminder for the payment of {{ grand_total }}. \n\nThanks, \nFrappé'
+ 'Dear {{ lead_name }}, \n\nThis is a reminder for the payment of {{ grand_total }}. \n\nThanks, \nFrappé',
)
"
/>
@@ -86,9 +98,6 @@
-
-
-
@@ -116,7 +125,9 @@ const emit = defineEmits(['after'])
const subjectRef = ref(null)
const nameRef = ref(null)
const editMode = ref(false)
-let _emailTemplate = ref({})
+let _emailTemplate = ref({
+ content_type: 'Rich Text',
+})
async function updateEmailTemplate() {
if (!validate()) return
@@ -184,6 +195,9 @@ function handleEmailTemplateUpdate(doc) {
}
function validate() {
+ _emailTemplate.value.use_html = Boolean(
+ _emailTemplate.value.content_type == 'HTML',
+ )
if (!_emailTemplate.value.name) {
errorMessage.value = 'Name is required'
return false
@@ -193,12 +207,17 @@ function validate() {
return false
}
if (
- !_emailTemplate.value.response ||
- _emailTemplate.value.response === ''
+ !_emailTemplate.value.use_html &&
+ (!_emailTemplate.value.response ||
+ _emailTemplate.value.response === '')
) {
errorMessage.value = 'Content is required'
return false
}
+ if (_emailTemplate.value.use_html && !_emailTemplate.value.response_html) {
+ errorMessage.value = 'Content is required'
+ return false
+ }
return true
}
@@ -215,10 +234,13 @@ watch(
nameRef.value.el.focus()
}
_emailTemplate.value = { ...props.emailTemplate }
+ _emailTemplate.value.content_type = _emailTemplate.value.use_html
+ ? 'HTML'
+ : 'Rich Text'
if (_emailTemplate.value.name) {
editMode.value = true
}
})
- }
+ },
)