Ian province abbreviation patch - issue 724
[civicrm-core.git] / templates / CRM / Admin / Form / ScheduleReminders.tpl
CommitLineData
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}&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>
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}&nbsp;&nbsp;<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}&nbsp;&nbsp;&nbsp;{$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}&nbsp;&nbsp;&nbsp;{$form.end_frequency_interval.html}
edc51caa 68 <td>{$form.end_frequency_unit.html}&nbsp;&nbsp;&nbsp;{$form.end_action.html}&nbsp;&nbsp;&nbsp;{$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}&nbsp;&nbsp;{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}&nbsp;&nbsp;</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}&nbsp;{help id="limit_to" class="limit_to" title=$form.recipient.label}{$form.recipient.html}&nbsp;{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>
1e035d58 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>
a3e3eea1 103 </tr>
6a488035 104 </table>
1e035d58 105 <fieldset id="email" class="crm-collapsible" style="display: block;">
106 <legend class="collapsible-title">{ts}Email Screen{/ts}</legend>
107 <div>
108 <table id="email-field-table" class="form-layout-compressed">
109 <tr class="crm-scheduleReminder-form-block-template">
6a488035
TO
110 <td class="label">{$form.template.label}</td>
111 <td>{$form.template.html}</td>
1e035d58 112 </tr>
113 <tr class="crm-scheduleReminder-form-block-subject">
6a488035
TO
114 <td class="label">{$form.subject.label}</td>
115 <td>{$form.subject.html}</td>
1e035d58 116 </tr>
117 </table>
118 {include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}
119 </div>
120 </fieldset>
121 {if $sms}
122 <fieldset id="sms" class="crm-collapsible"><legend class="collapsible-title">{ts}SMS Screen{/ts}</legend>
123 <div>
124 <table id="sms-field-table" class="form-layout-compressed">
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>
129 <tr class="crm-scheduleReminder-form-block-sms-template">
130 <td class="label">{$form.SMStemplate.label}</td>
131 <td>{$form.SMStemplate.html}</td>
132 </tr>
133 </table>
134 {include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1}
135 <div>
6a488035 136 </fieldset>
1e035d58 137 {/if}
6a488035 138
6a488035
TO
139{include file="CRM/common/showHideByFieldValue.tpl"
140 trigger_field_id = "is_repeat"
141 trigger_value = "true"
142 target_element_id = "repeatFields"
143 target_element_type = "table-row"
144 field_type = "radio"
145 invert = "false"
146}
147
148{include file="CRM/common/showHideByFieldValue.tpl"
149 trigger_field_id ="recipient"
150 trigger_value = 'manual'
151 target_element_id ="recipientManual"
152 target_element_type ="table-row"
153 field_type ="select"
154 invert = 0
155}
156
157{include file="CRM/common/showHideByFieldValue.tpl"
158 trigger_field_id ="recipient"
159 trigger_value = 'group'
160 target_element_id ="recipientGroup"
161 target_element_type ="table-row"
162 field_type ="select"
163 invert = 0
164}
165
166{literal}
4d3e4dbe 167 <script type='text/javascript'>
ae8f569f 168 CRM.$(function($) {
581c7be2
CW
169 var $form = $('form.{/literal}{$form.formClass}{literal}'),
170 recipientMapping = eval({/literal}{$recipientMapping}{literal});
171
172 $('#absolute_date_display', $form).change(function() {
173 if($(this).val()) {
49d61c3a 174 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
6a488035 175 } else {
49d61c3a 176 $('#relativeDate, #relativeDateRepeat, #OR', $form).show();
6a488035 177 }
ae8f569f 178 });
581c7be2 179 if ($('#absolute_date_display', $form).val()) {
1bf65b67 180 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
ae8f569f 181 }
6a488035 182
a3e3eea1 183 loadMsgBox();
581c7be2 184 $('#mode', $form).change(loadMsgBox);
b439474a 185
581c7be2
CW
186 function populateRecipient() {
187 var recipient = $("#recipient", $form).val();
84a3e359 188 if ((recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') && $('#limit_to').val() != '') {
bcec4b42
CW
189 CRM.api3('participant', 'getoptions', {field: recipientMapping[recipient] == 'participant_role' ? 'role_id' : 'status_id', sequential: 1})
190 .done(function(result) {
191 CRM.utils.setOptions($('#recipient_listing', $form), result.values);
192 });
264ebe5d 193 $("#recipientList", $form).show();
581c7be2 194 }
4d3e4dbe 195 else {
196 $("#recipientList", $form).hide();
197 }
76a8cd55 198
76a8cd55 199 showHideLimitTo();
ae8f569f 200 }
4d3e4dbe 201
fd4d98b5
CW
202 // CRM-14070 Hide limit-to when entity is activity
203 function showHideLimitTo() {
204 $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1'));
4d3e4dbe 205 if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) {
84a3e359 206 if ($('#limit_to', $form).val() == '') {
76a8cd55 207 $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide();
208 $('a.limit_to').show();
1bf65b67 209 }
210 else {
264ebe5d 211 $('a.limit_to, a.recipient').show();
76a8cd55 212 $('#recipient').css("margin-left", "12px");
84a3e359 213 }
214 $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}');
215 }
216 else {
76a8cd55 217 $('#recipient, a.recipient').show()
7abf9f18 218 $('#recipient').css("margin-left", "-2px");
1bf65b67 219 $('a.limit_to').hide();
84a3e359 220 $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}');
221 }
fd4d98b5 222 }
a3e3eea1 223
4d3e4dbe 224 $('#recipient', $form).change(populateRecipient);
225
226 {/literal}{if !$context}{literal}
227 var entity = $('#entity_0', $form).val();
228 if (!(entity === '2' || entity === '3')) {
229 $('#recipientList', $form).hide();
230 }
231
232 $('#entity_0, #limit_to', $form).change(buildSelects);
233
234 buildSelects();
235
236 function buildSelects() {
237 var mappingID = $('#entity_0', $form).val();
dc3c81b1 238 var isLimit = $('#limit_to', $form).val();
4d3e4dbe 239
dc3c81b1 240 $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit},
4d3e4dbe 241 function (result) {
242 CRM.utils.setOptions($('#start_action_date', $form), result.sel4);
243 CRM.utils.setOptions($('#end_date', $form), result.sel4);
244 CRM.utils.setOptions($('#recipient', $form), result.sel5);
245 recipientMapping = result.recipientMapping;
246 populateRecipient();
247 }
248 );
249 }
250 {/literal}{else}{literal}
251 populateRecipient();
252 $('#limit_to', $form).change(populateRecipient);
253 {/literal}{/if}{literal}
254
255 function loadMsgBox() {
256 if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){
257 cj('#sms').hide();
258 cj('#email').show();
259 }
260 else if (cj('#mode').val() == 'SMS'){
261 cj('#email').hide();
262 cj('#sms').show();
263 showSaveUpdateChkBox('SMS');
264 }
265 else if (cj('#mode').val() == 'User_Preference'){
266 cj('#email').show();
267 cj('#sms').show();
268 showSaveUpdateChkBox('SMS');
269 }
a3e3eea1 270 }
a3e3eea1 271
4d3e4dbe 272 });
273 </script>
274{/literal}
4b628e67
CW
275
276{/if}
277
278 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
279</div>