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