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