Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work is published under the GNU AGPLv3 license with some | |
6 | | permitted exceptions and without any warranty. For full license | | |
7 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | {* This template is used for adding/scheduling reminders. *} | |
11 | <div class="crm-block crm-form-block crm-scheduleReminder-form-block"> | |
12 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
13 | ||
14 | {if $action eq 8} | |
15 | <div class="messages status no-popup"> | |
16 | <div class="icon inform-icon"></div> | |
17 | {ts 1=$reminderName}WARNING: You are about to delete the Reminder titled <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts} | |
18 | </div> | |
19 | {else} | |
6a488035 TO |
20 | <table class="form-layout-compressed"> |
21 | <tr class="crm-scheduleReminder-form-block-title"> | |
22 | <td class="right">{$form.title.label}</td><td colspan="3">{$form.title.html}</td> | |
23 | </tr> | |
24 | <tr> | |
25 | <td class="label">{$form.entity.label}</td> | |
26 | <td>{$form.entity.html}</td> | |
27 | </tr> | |
28 | ||
29 | <tr class="crm-scheduleReminder-form-block-when"> | |
30 | <td class="right">{$form.start_action_offset.label}</td> | |
b219e49f | 31 | <td colspan="3">{$form.absolute_date.html} <strong id='OR'>OR</strong><br /></td> |
6a488035 TO |
32 | </tr> |
33 | ||
34 | <tr id="relativeDate" class="crm-scheduleReminder-form-block-description"> | |
35 | <td class="right"></td> | |
36 | <td colspan="3">{$form.start_action_offset.html} {$form.start_action_unit.html} {$form.start_action_condition.html} {$form.start_action_date.html}</td> | |
37 | </tr> | |
1e035d58 | 38 | <tr id="recordActivity" class="crm-scheduleReminder-form-block-record_activity"><td class="label" width="20%">{$form.record_activity.label}</td> |
39 | <td>{$form.record_activity.html}</td> | |
40 | </tr> | |
6a488035 TO |
41 | <tr id="relativeDateRepeat" class="crm-scheduleReminder-form-block-is_repeat"><td class="label" width="20%">{$form.is_repeat.label}</td> |
42 | <td>{$form.is_repeat.html} <span class="description">{ts}Enable repetition.{/ts}</span></td> | |
43 | </tr> | |
44 | <tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"><td></td><td> | |
45 | <table class="form-layout-compressed"> | |
46 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
d1095f4a | 47 | <td class="label">{$form.repetition_frequency_interval.label} <span class="crm-marker">*</span> {$form.repetition_frequency_interval.html}</td> |
edc51caa | 48 | <td>{$form.repetition_frequency_unit.html}</td> |
6a488035 TO |
49 | </tr> |
50 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
d1095f4a | 51 | <td class="label">{$form.end_frequency_interval.label} <span class="crm-marker">*</span> {$form.end_frequency_interval.html} |
edc51caa | 52 | <td>{$form.end_frequency_unit.html} {$form.end_action.html} {$form.end_date.html}</td> |
6a488035 TO |
53 | </tr> |
54 | </table> | |
55 | </td> | |
56 | </tr> | |
1991bba1 DG |
57 | <tr> |
58 | <td class="label" width="20%">{$form.from_name.label}</td> | |
59 | <td>{$form.from_name.html} {help id="id-from_name_email"}</td> | |
60 | </tr> | |
61 | <tr> | |
62 | <td class="label" width="20%">{$form.from_email.label}</td> | |
63 | <td>{$form.from_email.html} </td> | |
64 | </tr> | |
6a488035 | 65 | <tr class="crm-scheduleReminder-form-block-recipient"> |
1bf65b67 | 66 | <td id="recipientLabel" class="right">{$form.recipient.label}</td><td colspan="3">{$form.limit_to.html} {help id="limit_to" class="limit_to" title=$form.recipient.label}{$form.recipient.html} {help id="recipient" class="recipient" title=$recipientLabels.activity}</td> |
6a488035 | 67 | </tr> |
84a3e359 | 68 | <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing recipient"> |
6a488035 TO |
69 | <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td> |
70 | </tr> | |
84a3e359 | 71 | <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id recipient"> |
6a488035 | 72 | <td class="label">{$form.recipient_manual_id.label}</td> |
92f4a0b1 | 73 | <td>{$form.recipient_manual_id.html}{edit}<div class="description">{ts}You can manually send out the reminders to these recipients.{/ts}</div>{/edit}</td> |
6a488035 TO |
74 | </tr> |
75 | ||
84a3e359 | 76 | <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id recipient"> |
6a488035 TO |
77 | <td class="label">{$form.group_id.label}</td> |
78 | <td>{$form.group_id.html}</td> | |
79 | </tr> | |
a3e3eea1 | 80 | <tr id="msgMode" class="crm-scheduleReminder-form-block-mode"> |
81 | <td class="label">{$form.mode.label}</td> | |
82 | <td>{$form.mode.html}</td> | |
83 | </tr> | |
776a4216 SV |
84 | {if $multilingual} |
85 | <tr class="crm-scheduleReminder-form-block-filter-contact-language"> | |
86 | <td class="label">{$form.filter_contact_language.label}</td> | |
87 | <td>{$form.filter_contact_language.html} {help id="filter_contact_language"}</td> | |
88 | </tr> | |
89 | <tr class="crm-scheduleReminder-form-block-communication-language"> | |
90 | <td class="label">{$form.communication_language.label}</td> | |
91 | <td>{$form.communication_language.html} {help id="communication_language"}</td> | |
92 | </tr> | |
93 | {/if} | |
1e035d58 | 94 | <tr class="crm-scheduleReminder-form-block-active"> |
95 | <td class="label"></td> | |
96 | <td>{$form.is_active.html} {$form.is_active.label}</td> | |
a3e3eea1 | 97 | </tr> |
6a488035 | 98 | </table> |
1e035d58 | 99 | <fieldset id="email" class="crm-collapsible" style="display: block;"> |
100 | <legend class="collapsible-title">{ts}Email Screen{/ts}</legend> | |
101 | <div> | |
102 | <table id="email-field-table" class="form-layout-compressed"> | |
103 | <tr class="crm-scheduleReminder-form-block-template"> | |
6a488035 TO |
104 | <td class="label">{$form.template.label}</td> |
105 | <td>{$form.template.html}</td> | |
1e035d58 | 106 | </tr> |
107 | <tr class="crm-scheduleReminder-form-block-subject"> | |
6a488035 TO |
108 | <td class="label">{$form.subject.label}</td> |
109 | <td>{$form.subject.html}</td> | |
1e035d58 | 110 | </tr> |
111 | </table> | |
112 | {include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1} | |
113 | </div> | |
114 | </fieldset> | |
115 | {if $sms} | |
116 | <fieldset id="sms" class="crm-collapsible"><legend class="collapsible-title">{ts}SMS Screen{/ts}</legend> | |
117 | <div> | |
118 | <table id="sms-field-table" class="form-layout-compressed"> | |
119 | <tr id="smsProvider" class="crm-scheduleReminder-form-block-sms_provider_id"> | |
120 | <td class="label">{$form.sms_provider_id.label}</td> | |
121 | <td>{$form.sms_provider_id.html}</td> | |
122 | </tr> | |
123 | <tr class="crm-scheduleReminder-form-block-sms-template"> | |
124 | <td class="label">{$form.SMStemplate.label}</td> | |
125 | <td>{$form.SMStemplate.html}</td> | |
126 | </tr> | |
127 | </table> | |
128 | {include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1} | |
129 | <div> | |
6a488035 | 130 | </fieldset> |
1e035d58 | 131 | {/if} |
6a488035 | 132 | |
6a488035 TO |
133 | {include file="CRM/common/showHideByFieldValue.tpl" |
134 | trigger_field_id = "is_repeat" | |
135 | trigger_value = "true" | |
136 | target_element_id = "repeatFields" | |
137 | target_element_type = "table-row" | |
138 | field_type = "radio" | |
139 | invert = "false" | |
140 | } | |
141 | ||
142 | {include file="CRM/common/showHideByFieldValue.tpl" | |
143 | trigger_field_id ="recipient" | |
144 | trigger_value = 'manual' | |
145 | target_element_id ="recipientManual" | |
146 | target_element_type ="table-row" | |
147 | field_type ="select" | |
148 | invert = 0 | |
149 | } | |
150 | ||
151 | {include file="CRM/common/showHideByFieldValue.tpl" | |
152 | trigger_field_id ="recipient" | |
153 | trigger_value = 'group' | |
154 | target_element_id ="recipientGroup" | |
155 | target_element_type ="table-row" | |
156 | field_type ="select" | |
157 | invert = 0 | |
158 | } | |
159 | ||
160 | {literal} | |
4d3e4dbe | 161 | <script type='text/javascript'> |
ae8f569f | 162 | CRM.$(function($) { |
581c7be2 CW |
163 | var $form = $('form.{/literal}{$form.formClass}{literal}'), |
164 | recipientMapping = eval({/literal}{$recipientMapping}{literal}); | |
165 | ||
166 | $('#absolute_date_display', $form).change(function() { | |
167 | if($(this).val()) { | |
49d61c3a | 168 | $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide(); |
6a488035 | 169 | } else { |
49d61c3a | 170 | $('#relativeDate, #relativeDateRepeat, #OR', $form).show(); |
6a488035 | 171 | } |
ae8f569f | 172 | }); |
581c7be2 | 173 | if ($('#absolute_date_display', $form).val()) { |
1bf65b67 | 174 | $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide(); |
ae8f569f | 175 | } |
6a488035 | 176 | |
a3e3eea1 | 177 | loadMsgBox(); |
581c7be2 | 178 | $('#mode', $form).change(loadMsgBox); |
b439474a | 179 | |
581c7be2 | 180 | function populateRecipient() { |
93fdcf55 | 181 | var mappingID = $('#entity_0', $form).val() || $('[name^=mappingID]', $form).val(); |
581c7be2 | 182 | var recipient = $("#recipient", $form).val(); |
bf2ce887 TO |
183 | $("#recipientList", $form).hide(); |
184 | if ($('#limit_to').val() != '' ) { | |
185 | $.getJSON(CRM.url('civicrm/ajax/recipientListing'), {mappingID: mappingID, recipientType: recipient}, | |
186 | function (result) { | |
187 | if (!CRM._.isEmpty(result.recipients)) { | |
188 | CRM.utils.setOptions($('#recipient_listing', $form), result.recipients); | |
189 | $("#recipientList", $form).show(); | |
190 | } | |
191 | } | |
192 | ); | |
581c7be2 | 193 | } |
76a8cd55 | 194 | |
76a8cd55 | 195 | showHideLimitTo(); |
ae8f569f | 196 | } |
4d3e4dbe | 197 | |
fd4d98b5 CW |
198 | // CRM-14070 Hide limit-to when entity is activity |
199 | function showHideLimitTo() { | |
200 | $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1')); | |
4d3e4dbe | 201 | if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) { |
84a3e359 | 202 | if ($('#limit_to', $form).val() == '') { |
76a8cd55 | 203 | $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide(); |
204 | $('a.limit_to').show(); | |
1bf65b67 | 205 | } |
206 | else { | |
264ebe5d | 207 | $('a.limit_to, a.recipient').show(); |
76a8cd55 | 208 | $('#recipient').css("margin-left", "12px"); |
84a3e359 | 209 | } |
210 | $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}'); | |
211 | } | |
212 | else { | |
76a8cd55 | 213 | $('#recipient, a.recipient').show() |
7abf9f18 | 214 | $('#recipient').css("margin-left", "-2px"); |
1bf65b67 | 215 | $('a.limit_to').hide(); |
84a3e359 | 216 | $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}'); |
217 | } | |
fd4d98b5 | 218 | } |
a3e3eea1 | 219 | |
4d3e4dbe | 220 | $('#recipient', $form).change(populateRecipient); |
221 | ||
222 | {/literal}{if !$context}{literal} | |
223 | var entity = $('#entity_0', $form).val(); | |
224 | if (!(entity === '2' || entity === '3')) { | |
225 | $('#recipientList', $form).hide(); | |
226 | } | |
227 | ||
228 | $('#entity_0, #limit_to', $form).change(buildSelects); | |
229 | ||
230 | buildSelects(); | |
231 | ||
232 | function buildSelects() { | |
233 | var mappingID = $('#entity_0', $form).val(); | |
dc3c81b1 | 234 | var isLimit = $('#limit_to', $form).val(); |
4d3e4dbe | 235 | |
dc3c81b1 | 236 | $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit}, |
4d3e4dbe | 237 | function (result) { |
238 | CRM.utils.setOptions($('#start_action_date', $form), result.sel4); | |
239 | CRM.utils.setOptions($('#end_date', $form), result.sel4); | |
240 | CRM.utils.setOptions($('#recipient', $form), result.sel5); | |
241 | recipientMapping = result.recipientMapping; | |
242 | populateRecipient(); | |
243 | } | |
244 | ); | |
245 | } | |
246 | {/literal}{else}{literal} | |
247 | populateRecipient(); | |
248 | $('#limit_to', $form).change(populateRecipient); | |
249 | {/literal}{/if}{literal} | |
250 | ||
251 | function loadMsgBox() { | |
252 | if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){ | |
253 | cj('#sms').hide(); | |
254 | cj('#email').show(); | |
255 | } | |
256 | else if (cj('#mode').val() == 'SMS'){ | |
257 | cj('#email').hide(); | |
258 | cj('#sms').show(); | |
259 | showSaveUpdateChkBox('SMS'); | |
260 | } | |
261 | else if (cj('#mode').val() == 'User_Preference'){ | |
262 | cj('#email').show(); | |
263 | cj('#sms').show(); | |
264 | showSaveUpdateChkBox('SMS'); | |
265 | } | |
a3e3eea1 | 266 | } |
a3e3eea1 | 267 | |
4d3e4dbe | 268 | }); |
269 | </script> | |
270 | {/literal} | |
4b628e67 CW |
271 | |
272 | {/if} | |
273 | ||
274 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
275 | </div> |