-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSendMail.fusion
105 lines (96 loc) · 4.7 KB
/
SendMail.fusion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
prototype(Garagist.Mautic:Component.SendMail) < prototype(Neos.Fusion:Component) {
email = null
// Redirect after the action is done
redirect = null
action = 'send'
class = 'neos-button neos-button-primary'
footer = false
allSegments = ${allSegments}
canSendLater = ${Configuration.Setting('Garagist.Mautic.action.sendLater')}
@if.hasEmail = ${this.email}
renderer = Neos.Fusion:Component {
@apply.props = ${props}
_i18n = ${Translation.id('').package('Garagist.Mautic').source('Module')}
_label = ${this._i18n.id(props.resend ? 'email.resend' : 'email.send').translate()}
_confirmAttributes = Neos.Fusion:DataStructure {
:href = "action+'&moduleArguments[date]='+date"
}
_sendDateLabel = ${this._i18n.id('email.send.date').translate()}
_hasSegments = ${Carbon.Array.check(props.segments)}
// class in xlf file: 'block' Don't remove this as it is needed for tailwindcss to get the needed class name
_xData = Neos.Fusion:DataStructure {
action = Neos.Fusion:UriBuilder {
action = ${props.action}
arguments = Neos.Fusion:DataStructure {
node = ${node}
email = ${props.email}
redirect = ${props.redirect}
}
}
locale = Neos.Fusion:Match {
@if.set = ${props.canSendLater}
@subject = ${Carbon.Backend.language()}
@default = 'en'
de = 'de'
}
date = 'now'
sendLater = ${props.canSendLater ? false : null}
pickr = ${props.canSendLater ? '' : null}
formattedDate = ${props.canSendLater ? '' : null}
}
_xEffect = ${props.canSendLater ? "if(date!='now'){formattedDate=new Date(date).toLocaleDateString(locale,{weekday:'long',year:'numeric',month:'long',day:'numeric',hour:'numeric',minute:'numeric'})}" : null}
renderer = afx`
<Garagist.Mautic:Component.ActionButton
label={props._label}
icon="fa-paper-plane"
showText={props.detailView}
dialogTitle={this.label}
dialogXData={Json.stringify(props._xData)}
dialogxEffect={props._xEffect}
confirmLabel={this.label}
confirmAttributes={props._confirmAttributes}
footer={props.footer}
initalFocusOnConfirm={true}
type="success"
dialogMaxWidth={props.canSendLater ? "382px" : null}
>
<p x-dialog:description @if={!props._hasSegments}>
<span x-show="date=='now'" @if={props.canSendLater}>{props._i18n.id('email.send.now.all').translate()}</span>
<span x-show="date!='now'" @if={props.canSendLater}>{props._i18n.id('email.send.later.all').translate()}</span>
{props.canSendLater ? '' : props._i18n.id('email.send.now.all').translate()}
</p>
<p x-dialog:description @if={props._hasSegments}>
<span x-show="date=='now'" @if={props.canSendLater}>{props._i18n.id('email.send.now.segments').translate()}</span>
<span x-show="date!='now'" @if={props.canSendLater}>{props._i18n.id('email.send.later.segments').translate()}</span>
{props.canSendLater ? '' : props._i18n.id('email.send.now.segments').translate()}
<Neos.Fusion:Loop items={props.segments} @glue=", " content={props.allSegments[item].name} />
</p>
<Garagist.Mautic:Component.Checkbox
@if={props.canSendLater}
xModel="sendLater"
boolean={true}
label={props._i18n.id('email.send.later').translate()}
value={true}
/>
<div
@if={props.canSendLater}
x-show="sendLater"
x-collapse
x-effect="date=sendLater&&pickr?pickr:'now'"
>
<label for="date" class="sr-only">{props._sendDateLabel}</label>
<input
x-show="sendLater"
x-model="pickr"
x-flatpickr="{locale}"
placeholder={props._sendDateLabel}
id="date"
class="sr-only"
/>
<!-- Spacer for a smoother animation -->
<div aria-hidden="true" class="h-4"></div>
</div>
</Garagist.Mautic:Component.ActionButton>
`
}
}