Merge pull request #2567 from giant-rabbit/cart_financial_transactions
[civicrm-core.git] / templates / CRM / Admin / Form / ScheduleReminders.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
232624b1 3 | CiviCRM version 4.4 |
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}
37 {* added onload javascript for source contact*}
38 {literal}
39 <script type="text/javascript">
40 var recipient_manual = '';
41 var recipient_manual_id = null;
42 var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1&noemail=1' h=0 }{literal}"; {/literal}
43
44 {if $recipients}
45 {foreach from=$recipients key=id item=name}
46 {literal} recipient_manual += '{"name":"'+{/literal}"{$name}"{literal}+'","id":"'+{/literal}"{$id}"{literal}+'"},';{/literal}
47 {/foreach}
48 {literal} eval( 'recipient_manual = [' + recipient_manual + ']'); {/literal}
49 {/if}
50
51 {literal}
52 if ( recipient_manual_id ) {
53 eval( 'recipient_manual = ' + recipient_manual_id );
54 }
55
56 cj(document).ready( function( ) {
57 {/literal}
58 {literal}
59
60 eval( 'tokenClass = { tokenList: "token-input-list-facebook", token: "token-input-token-facebook", tokenDelete: "token-input-delete-token-facebook", selectedToken: "token-input-selected-token-facebook", highlightedToken: "token-input-highlighted-token-facebook", dropdown: "token-input-dropdown-facebook", dropdownItem: "token-input-dropdown-item-facebook", dropdownItem2: "token-input-dropdown-item2-facebook", selectedDropdownItem: "token-input-selected-dropdown-item-facebook", inputToken: "token-input-input-token-facebook" } ');
61
6a488035
TO
62 var tokenDataUrl = "{/literal}{$tokenUrl}{literal}";
63 var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing recipient.{/ts}{literal}";
64 cj( "#recipient_manual_id").tokenInput( tokenDataUrl, { prePopulate: recipient_manual, classes: tokenClass, hintText: hintText });
65 cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
6a488035
TO
66 });
67 </script>
68 {/literal}
69 <table class="form-layout-compressed">
70 <tr class="crm-scheduleReminder-form-block-title">
71 <td class="right">{$form.title.label}</td><td colspan="3">{$form.title.html}</td>
72 </tr>
73 <tr>
74 <td class="label">{$form.entity.label}</td>
75 <td>{$form.entity.html}</td>
76 </tr>
77
78 <tr class="crm-scheduleReminder-form-block-when">
79 <td class="right">{$form.start_action_offset.label}</td>
80 <td colspan="3">{include file="CRM/common/jcalendar.tpl" elementName=absolute_date} <strong>{ts}OR{/ts}</strong><br /></td>
81 </tr>
82
83 <tr id="relativeDate" class="crm-scheduleReminder-form-block-description">
84 <td class="right"></td>
85 <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>
86 </tr>
87 <tr id="recordActivity" class="crm-scheduleReminder-form-block-record_activity"><td class="label" width="20%">{$form.record_activity.label}</td>
88 <td>{$form.record_activity.html}</td>
89 </tr>
90 <tr id="relativeDateRepeat" class="crm-scheduleReminder-form-block-is_repeat"><td class="label" width="20%">{$form.is_repeat.label}</td>
91 <td>{$form.is_repeat.html}&nbsp;&nbsp;<span class="description">{ts}Enable repetition.{/ts}</span></td>
92 </tr>
93 <tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"><td></td><td>
94 <table class="form-layout-compressed">
95 <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
96 <td class="label">{$form.repetition_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.repetition_frequency_interval.html}</td>
edc51caa 97 <td>{$form.repetition_frequency_unit.html}</td>
6a488035
TO
98 </tr>
99 <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
100 <td class="label">{$form.end_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.end_frequency_interval.html}
edc51caa 101 <td>{$form.end_frequency_unit.html}&nbsp;&nbsp;&nbsp;{$form.end_action.html}&nbsp;&nbsp;&nbsp;{$form.end_date.html}</td>
6a488035
TO
102 </tr>
103 </table>
104 </td>
105 </tr>
106 <tr class="crm-scheduleReminder-form-block-recipient">
96cfe0d7 107 <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
108 </tr>
109 <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing">
110 <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td>
111 </tr>
112 <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id">
113 <td class="label">{$form.recipient_manual_id.label}</td>
114 <td>{$form.recipient_manual_id.html}{edit}<span class="description">{ts}You can manually send out the reminders to these recipients.{/ts}</span>{/edit}</td>
115 </tr>
116
117 <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id">
118 <td class="label">{$form.group_id.label}</td>
119 <td>{$form.group_id.html}</td>
120 </tr>
a3e3eea1 121 <tr id="msgMode" class="crm-scheduleReminder-form-block-mode">
122 <td class="label">{$form.mode.label}</td>
123 <td>{$form.mode.html}</td>
124 </tr>
125 <tr id="smsProvider" class="crm-scheduleReminder-form-block-sms_provider_id">
126 <td class="label">{$form.sms_provider_id.label}</td>
127 <td>{$form.sms_provider_id.html}</td>
128 </tr>
6a488035 129 </table>
eacfd039 130 <fieldset id="compose_id"><legend>{$title}</legend>
6a488035
TO
131 <table id="email-field-table" class="form-layout-compressed">
132 <tr class="crm-scheduleReminder-form-block-active">
133 <td class="label"></td>
134 <td>{$form.is_active.html}&nbsp;{$form.is_active.label}</td>
135 </tr>
136 <tr class="crm-scheduleReminder-form-block-template">
137 <td class="label">{$form.template.label}</td>
138 <td>{$form.template.html}</td>
139 </tr>
140 <tr class="crm-scheduleReminder-form-block-subject">
141 <td class="label">{$form.subject.label}</td>
142 <td>{$form.subject.html}</td>
143 </tr>
144
145 </table>
a3e3eea1 146 <div id="email">{include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}</div>
147 <div id="sms">{include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1}</div>
6a488035
TO
148 </fieldset>
149
6a488035
TO
150{include file="CRM/common/showHideByFieldValue.tpl"
151 trigger_field_id = "is_repeat"
152 trigger_value = "true"
153 target_element_id = "repeatFields"
154 target_element_type = "table-row"
155 field_type = "radio"
156 invert = "false"
157}
158
159{include file="CRM/common/showHideByFieldValue.tpl"
160 trigger_field_id ="recipient"
161 trigger_value = 'manual'
162 target_element_id ="recipientManual"
163 target_element_type ="table-row"
164 field_type ="select"
165 invert = 0
166}
167
168{include file="CRM/common/showHideByFieldValue.tpl"
169 trigger_field_id ="recipient"
170 trigger_value = 'group'
171 target_element_id ="recipientGroup"
172 target_element_type ="table-row"
173 field_type ="select"
174 invert = 0
175}
176
177{literal}
178<script type='text/javascript'>
fa202ee1 179 cj(function($) {
180 $().crmAccordions();
181 });
6a488035
TO
182 var entityMapping = eval({/literal}{$entityMapping}{literal});
183 var recipientMapping = eval({/literal}{$recipientMapping}{literal});
184
185 cj('#absolute_date_display').change( function() {
186 if(cj('#absolute_date_display').val()) {
187 cj('#relativeDate').hide();
188 cj('#relativeDateRepeat').hide();
189 cj('#repeatFields').hide();
190 } else {
191 cj('#relativeDate').show();
192 cj('#relativeDateRepeat').show();
193 }
194 });
195
6a488035
TO
196 cj(function() {
197 if (cj('#absolute_date_display').val()) {
198 cj('#relativeDate').hide();
199 cj('#relativeDateRepeat').hide();
200 cj('#repeatFields').hide();
201 }
202
203 cj('#entity_0').change( function( ) {
204 buildSelect("start_action_date");
205 buildSelect("end_date");
206 buildSelect1("recipient");
207 });
208 });
209
a3e3eea1 210 cj(function () {
211 loadMsgBox();
212 cj('#mode').change(function () {
213 loadMsgBox();
214 });
b439474a 215
216 showHideLimitTo();
217 cj('#entity_0').change(function () {
218 showHideLimitTo();
219 });
a3e3eea1 220 });
221
222 function loadMsgBox() {
223 if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){
224 cj('#sms').hide();
225 cj('#smsProvider').hide();
226 cj('#email').show();
227 }
228 else if (cj('#mode').val() == 'SMS'){
229 cj('#email').hide();
230 cj('#sms').show();
231 cj('#smsProvider').show();
232 }
233 else if (cj('#mode').val() == 'User_Preference'){
234 cj('#email').show();
235 cj('#sms').show();
236 cj('#smsProvider').show();
237 }
238 }
239
b439474a 240 function showHideLimitTo() {
241 if (cj('#entity_0').val() == 1) {
242 cj('#limit_to').hide();
243 }
244 else {
245 cj('#limit_to').show();
246 }
247 }
248
249 cj(function () {
250 if (cj('#is_recipient_listing').val()) {
251 cj('#recipientList').show();
252 }
253 else {
254 cj('#recipientList').hide();
255 }
256 cj('#recipient').change(function () {
257 populateRecipient();
258 });
259 });
6a488035
TO
260
261 function populateRecipient( ) {
262 var recipient = cj("#recipient option:selected").val();
263 var entity = cj("#entity_0 option:selected").val();
264 var postUrl = "{/literal}{crmURL p='civicrm/ajax/populateRecipient' h=0}{literal}";
265
40f2fee3 266 if(recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') {
6a488035
TO
267 var elementID = '#recipient_listing';
268 cj( elementID ).html('');
269 cj.post(postUrl, {recipient: recipientMapping[recipient]},
270 function ( response ) {
271 response = eval( response );
272 for (i = 0; i < response.length; i++) {
273 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
274 }
275 });
276 cj("#recipientList").show();
277 cj('#is_recipient_listing').val(1);
278 } else {
279 cj("#recipientList").hide();
280 cj('#is_recipient_listing').val('');
281 }
282
283 if (entityMapping[entity] == 'civicrm_activity') {
284 cj("#recipientLabel").text("Recipient(s)");
285 } else {
8635e9b0 286 cj("#recipientLabel").text("Limit Recipients");
6a488035
TO
287 }
288 }
289 function buildSelect( selectID ) {
290 var elementID = '#' + selectID;
291 cj( elementID ).html('');
292 var mappingID = cj('#entity_0').val();
293 var postUrl = "{/literal}{crmURL p='civicrm/ajax/mapping' h=0}{literal}";
294 cj.post( postUrl, { mappingID: mappingID},
295 function ( response ) {
296 response = eval( response );
297 for (i = 0; i < response.length; i++) {
298 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
299 }
300 }
301 );
302
303 }
304
305 function buildSelect1( selectID ) {
306 var elementID = '#' + selectID;
307 cj( elementID ).html('');
308 var mappingID = cj('#entity_0').val();
309 var postUrl1 = "{/literal}{crmURL p='civicrm/ajax/mapping1' h=0}{literal}";
310
311 cj('#is_recipient_listing').val('');
312 cj.post( postUrl1, { mappingID: mappingID},
313 function ( result ) {
314 var responseResult = cj.parseJSON(result);
315 var response = eval(responseResult.sel5);
316 recipientMapping = eval(responseResult.recipientMapping);
317 for (i = 0; i < response.length; i++) {
318 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
319 }
320 populateRecipient();
321 }
322 );
323 }
324
325 </script>
326 {/literal}
4b628e67
CW
327
328{/if}
329
330 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
331</div>