Merge pull request #3057 from agh1/counties-as-extensions
[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>
74 <tr class="crm-scheduleReminder-form-block-recipient">
96cfe0d7 75 <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
76 </tr>
77 <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing">
78 <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td>
79 </tr>
80 <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id">
81 <td class="label">{$form.recipient_manual_id.label}</td>
92f4a0b1 82 <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
83 </tr>
84
85 <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id">
86 <td class="label">{$form.group_id.label}</td>
87 <td>{$form.group_id.html}</td>
88 </tr>
a3e3eea1 89 <tr id="msgMode" class="crm-scheduleReminder-form-block-mode">
90 <td class="label">{$form.mode.label}</td>
91 <td>{$form.mode.html}</td>
92 </tr>
93 <tr id="smsProvider" class="crm-scheduleReminder-form-block-sms_provider_id">
94 <td class="label">{$form.sms_provider_id.label}</td>
95 <td>{$form.sms_provider_id.html}</td>
96 </tr>
6a488035 97 </table>
eacfd039 98 <fieldset id="compose_id"><legend>{$title}</legend>
6a488035
TO
99 <table id="email-field-table" class="form-layout-compressed">
100 <tr class="crm-scheduleReminder-form-block-active">
101 <td class="label"></td>
102 <td>{$form.is_active.html}&nbsp;{$form.is_active.label}</td>
103 </tr>
104 <tr class="crm-scheduleReminder-form-block-template">
105 <td class="label">{$form.template.label}</td>
106 <td>{$form.template.html}</td>
107 </tr>
108 <tr class="crm-scheduleReminder-form-block-subject">
109 <td class="label">{$form.subject.label}</td>
110 <td>{$form.subject.html}</td>
111 </tr>
112
113 </table>
a3e3eea1 114 <div id="email">{include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}</div>
7b007e61 115 {if $sms}<div id="sms">{include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1}</div>{/if}
6a488035
TO
116 </fieldset>
117
6a488035
TO
118{include file="CRM/common/showHideByFieldValue.tpl"
119 trigger_field_id = "is_repeat"
120 trigger_value = "true"
121 target_element_id = "repeatFields"
122 target_element_type = "table-row"
123 field_type = "radio"
124 invert = "false"
125}
126
127{include file="CRM/common/showHideByFieldValue.tpl"
128 trigger_field_id ="recipient"
129 trigger_value = 'manual'
130 target_element_id ="recipientManual"
131 target_element_type ="table-row"
132 field_type ="select"
133 invert = 0
134}
135
136{include file="CRM/common/showHideByFieldValue.tpl"
137 trigger_field_id ="recipient"
138 trigger_value = 'group'
139 target_element_id ="recipientGroup"
140 target_element_type ="table-row"
141 field_type ="select"
142 invert = 0
143}
144
145{literal}
146<script type='text/javascript'>
147 var entityMapping = eval({/literal}{$entityMapping}{literal});
148 var recipientMapping = eval({/literal}{$recipientMapping}{literal});
149
150 cj('#absolute_date_display').change( function() {
151 if(cj('#absolute_date_display').val()) {
152 cj('#relativeDate').hide();
153 cj('#relativeDateRepeat').hide();
154 cj('#repeatFields').hide();
155 } else {
156 cj('#relativeDate').show();
157 cj('#relativeDateRepeat').show();
158 }
159 });
160
3cc60a06 161 CRM.$(function($) {
6a488035
TO
162 if (cj('#absolute_date_display').val()) {
163 cj('#relativeDate').hide();
164 cj('#relativeDateRepeat').hide();
165 cj('#repeatFields').hide();
166 }
167
168 cj('#entity_0').change( function( ) {
169 buildSelect("start_action_date");
170 buildSelect("end_date");
171 buildSelect1("recipient");
172 });
173 });
174
3cc60a06 175 CRM.$(function($) {
a3e3eea1 176 loadMsgBox();
177 cj('#mode').change(function () {
178 loadMsgBox();
179 });
b439474a 180
181 showHideLimitTo();
182 cj('#entity_0').change(function () {
183 showHideLimitTo();
184 });
a3e3eea1 185 });
186
187 function loadMsgBox() {
188 if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){
189 cj('#sms').hide();
190 cj('#smsProvider').hide();
191 cj('#email').show();
192 }
193 else if (cj('#mode').val() == 'SMS'){
194 cj('#email').hide();
195 cj('#sms').show();
196 cj('#smsProvider').show();
197 }
198 else if (cj('#mode').val() == 'User_Preference'){
199 cj('#email').show();
200 cj('#sms').show();
201 cj('#smsProvider').show();
202 }
203 }
204
b439474a 205 function showHideLimitTo() {
206 if (cj('#entity_0').val() == 1) {
207 cj('#limit_to').hide();
208 }
209 else {
210 cj('#limit_to').show();
211 }
212 }
213
3cc60a06 214 CRM.$(function($) {
b439474a 215 if (cj('#is_recipient_listing').val()) {
216 cj('#recipientList').show();
217 }
218 else {
219 cj('#recipientList').hide();
220 }
221 cj('#recipient').change(function () {
222 populateRecipient();
223 });
224 });
6a488035
TO
225
226 function populateRecipient( ) {
227 var recipient = cj("#recipient option:selected").val();
228 var entity = cj("#entity_0 option:selected").val();
229 var postUrl = "{/literal}{crmURL p='civicrm/ajax/populateRecipient' h=0}{literal}";
230
40f2fee3 231 if(recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') {
6a488035
TO
232 var elementID = '#recipient_listing';
233 cj( elementID ).html('');
234 cj.post(postUrl, {recipient: recipientMapping[recipient]},
235 function ( response ) {
236 response = eval( response );
237 for (i = 0; i < response.length; i++) {
238 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
239 }
240 });
241 cj("#recipientList").show();
242 cj('#is_recipient_listing').val(1);
243 } else {
244 cj("#recipientList").hide();
245 cj('#is_recipient_listing').val('');
246 }
247
248 if (entityMapping[entity] == 'civicrm_activity') {
249 cj("#recipientLabel").text("Recipient(s)");
250 } else {
8635e9b0 251 cj("#recipientLabel").text("Limit Recipients");
6a488035
TO
252 }
253 }
254 function buildSelect( selectID ) {
255 var elementID = '#' + selectID;
256 cj( elementID ).html('');
257 var mappingID = cj('#entity_0').val();
258 var postUrl = "{/literal}{crmURL p='civicrm/ajax/mapping' h=0}{literal}";
259 cj.post( postUrl, { mappingID: mappingID},
260 function ( response ) {
261 response = eval( response );
262 for (i = 0; i < response.length; i++) {
263 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
264 }
265 }
266 );
267
268 }
269
270 function buildSelect1( selectID ) {
271 var elementID = '#' + selectID;
272 cj( elementID ).html('');
273 var mappingID = cj('#entity_0').val();
274 var postUrl1 = "{/literal}{crmURL p='civicrm/ajax/mapping1' h=0}{literal}";
275
276 cj('#is_recipient_listing').val('');
277 cj.post( postUrl1, { mappingID: mappingID},
278 function ( result ) {
279 var responseResult = cj.parseJSON(result);
280 var response = eval(responseResult.sel5);
281 recipientMapping = eval(responseResult.recipientMapping);
282 for (i = 0; i < response.length; i++) {
283 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
284 }
285 populateRecipient();
286 }
287 );
288 }
289
290 </script>
291 {/literal}
4b628e67
CW
292
293{/if}
294
295 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
296</div>