{% extends "sprout-base-email/_layouts/base" %} {% import "_includes/forms" as forms %} {% import "sprout-base-fields/_includes/forms" as sproutFields %} {% if notificationEmail.id is null %} {% set notificationId = 'new' %} {% else %} {% set notificationId = notificationEmail.id %} {% endif %} {% set currentPluginHandle = craft.app.request.getSegment(1) %} {% set crumbs = [ { label: "Notifications"|t('sprout-base'), url: url(currentPluginHandle ~ '/notifications') }, { label: "Settings"|t('sprout-base'), url: url(currentPluginHandle ~ '/settings/notifications/edit/' ~ notificationId) }, ] %} {% set title = notificationEmail is defined ? notificationEmail.title : 'Create a new Notification Email'|t('sprout-base') %} {% set fullPageForm = true %} {% set saveShortcutRedirect = url(currentPluginHandle ~ '/notifications/edit/' ~ notificationId) %} {% set mailer = notificationEmail.getMailer() %} {% block header %} {{ block('pageTitle') }} {{ block('contextMenu') }}
{% if showPreviewBtn or shareUrl is not null %} {% if showPreviewBtn %}
{{ "Live Preview"|t('app') }}
{% endif %} {% if shareUrl is defined %} {{ 'Share'|t('app') }} {% endif %}
{% endif %} {{ block('actionButton') }} {% endblock %} {% block actionButton %}
{% endblock %} {% block content %} {{ redirectInput(currentPluginHandle ~ '/notifications') }} {% if notificationEmail.id is not null %} {% endif %} {% if namespace is not defined %}{% set namespace = 'fields' %}{% endif %}
{% include "sprout-base-email/notifications/_fieldlayout" %}
{% endblock %} {% block details %}
{{ "Sender"|t('sprout-base') }}

{{ forms.textField({ label: "From Name The person or business sending the email"|t('sprout-base'), name: 'fromName', placeholder: siteName, value: notificationEmail.fromName is not empty ? notificationEmail.fromName : '', errors: notificationEmail is defined ? notificationEmail.getErrors('fromName') : null, required: true }) }} {{ forms.textField({ name: 'fromEmail', label: "From Email The email address of the person or business sending the email"|t('sprout-base'), placeholder: currentUser.email, value: notificationEmail.fromEmail is not empty ? notificationEmail.fromEmail : '', errors: notificationEmail is defined ? notificationEmail.getErrors('fromEmail') : null, required: true }) }} {{ forms.textField({ name: 'replyToEmail', label: "Reply To The email address which will be used if any recipients reply to your email. Defaults to use From Email."|t('sprout-base'), placeholder: currentUser.email, value: notificationEmail.replyToEmail is not empty ? notificationEmail.replyToEmail : '', errors: notificationEmail is defined ? notificationEmail.getErrors('replyToEmail') : null }) }}

{{ "Recipients"|t('sprout-base') }}

{% if (mailer is not null and mailer.getLists()|length) %}
Lists
{% namespace 'lists' %} {{ mailer.getListsHtml(notificationEmail.listSettings)|raw }} {% endnamespace %}
{% endif %} {{ forms.textField({ label: "Recipients A comma separated list of email addresses."|t('sprout-base'), placeholder: "user@domain.com, other@domain.com"|t('sprout-base'), name: "recipients", fieldClass: 'field-border-top', class: "code", value: notificationEmail is defined ? notificationEmail.recipients : "", errors: notificationEmail is defined ? notificationEmail.getErrors('recipients') }) }} {{ forms.lightswitchField({ first: true, label: "Single Email Send a single message to all Recipients (and Recipients on selected Lists) just like it would be sent if you used your mail client."|t('sprout-base'), id: 'singleEmail', name: 'singleEmail', on: notificationEmail.singleEmail, onLabel: "Enable"|t('sprout-base'), offLabel: "Disable"|t('sprout-base') }) }}

{{ "Event"|t('sprout-base') }}

{% if events|length %} {% set eventOptions = [{ 'label': 'Select event...'|t('sprout-base'), 'value': null }] %} {% for eventClass, event in events %} {% set eventOptions = eventOptions|merge([{ 'label': event.getName(), 'value': eventClass }]) %} {% endfor %} {{ forms.selectField({ id: "notificationEvent", name: "eventId", label: "Event The event that will trigger your notification."|t('sprout-base'), fieldClass: 'field-border-top', options: eventOptions, value: notificationEmail.eventId is defined ? notificationEmail.eventId : null, }) }} {% for type, event in events %}
Settings
{% if event.settings|length %} {% namespace 'eventSettings[' ~ type ~ ']' %} {{ event.getSettingsHtml()|raw }} {% endnamespace %} {% else %} {% endif %}
{% endfor %} {{ forms.lightswitchField({ first: true, label: "Attach Files All files submitted with your entries will be attached to the notification email"|t('sprout-base'), id: 'enableFileAttachments', name: 'enableFileAttachments', on: notificationEmail.enableFileAttachments, onLabel: "Enable"|t('sprout-base'), offLabel: "Disable"|t('sprout-base') }) }} {% endif %}

{{ "General Settings"|t('sprout-base') }}

{{ forms.textField({ label: "Title Format Update the Notification Email Title in the Control Panel to follow a pattern."|t('sprout-base'), id: 'titleFormat', name: 'titleFormat', value: notificationEmail is defined ? notificationEmail.titleFormat : null, autofocus: true, first: true, errors: notificationEmail is defined ? notificationEmail.getErrors('titleFormat') : null }) }} {{ forms.textField({ label: "Slug"|t('sprout-base'), id: 'slug', name: 'slug', value: notificationEmail.slug, errors: notificationEmail ? notificationEmail.getErrors('slug')|merge(notificationEmail.getErrors('uri')), }) }} {% set templateOptions = craft.sproutEmail.getEmailTemplateOptions(notificationEmail) %} {{ forms.field({ label: "Templates The Email Templates to display your email."|t('sprout-base'), errors: notificationEmail is defined ? notificationEmail.getErrors('emailTemplateId') : null, }, sproutFields.selectOther({ name: 'emailTemplateId', options: templateOptions, value: notificationEmail is defined ? notificationEmail.emailTemplateId : null, otherPlaceholderText: '_email/email-template-folder'|t('sprout-email') })) }} {{ forms.lightswitchField({ label: "Status"|t('sprout-base'), id: 'enabled', name: 'enabled', on: notificationEmail.enabled }) }}
{% endblock %} {% do view.registerAssetBundle("barrelstrength\\sproutbase\\web\\assets\\cp\\CpAsset") %} {% do view.registerAssetBundle("craft\\web\\assets\\fields\\FieldsAsset") %} {% do view.registerAssetBundle("barrelstrength\\sproutbase\\app\\email\\web\\assets\\base\\NotificationAsset") %} {% if not notificationEmail.slug %} {% includeJs "window.slugGenerator = new Craft.SlugGenerator('#subjectLine', '#slug');" %} {% endif %} {% js %} $(document).ready(function() { // add support for select other field if (Craft.SproutFields != null) { Craft.SproutFields.initFields($("#details")); } }); {% endjs %}