CRM-17686 change database column name
[civicrm-core.git] / templates / CRM / Admin / Form / ScheduleReminders.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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}
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>
47 <td colspan="3">{include file="CRM/common/jcalendar.tpl" elementName=absolute_date} <strong id='OR'>OR</strong><br /></td>
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>
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>
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>
64 <td>{$form.repetition_frequency_unit.html}</td>
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}
68 <td>{$form.end_frequency_unit.html}&nbsp;&nbsp;&nbsp;{$form.end_action.html}&nbsp;&nbsp;&nbsp;{$form.end_date.html}</td>
69 </tr>
70 </table>
71 </td>
72 </tr>
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>
81 <tr class="crm-scheduleReminder-form-block-recipient">
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>
83 </tr>
84 <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing recipient">
85 <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td>
86 </tr>
87 <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id recipient">
88 <td class="label">{$form.recipient_manual_id.label}</td>
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>
90 </tr>
91
92 <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id recipient">
93 <td class="label">{$form.group_id.label}</td>
94 <td>{$form.group_id.html}</td>
95 </tr>
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>
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}
110 <tr class="crm-scheduleReminder-form-block-active">
111 <td class="label"></td>
112 <td>{$form.is_active.html}&nbsp;{$form.is_active.label}</td>
113 </tr>
114 </table>
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">
120 <td class="label">{$form.template.label}</td>
121 <td>{$form.template.html}</td>
122 </tr>
123 <tr class="crm-scheduleReminder-form-block-subject">
124 <td class="label">{$form.subject.label}</td>
125 <td>{$form.subject.html}</td>
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>
146 </fieldset>
147 {/if}
148
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}
177 <script type='text/javascript'>
178 CRM.$(function($) {
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()) {
184 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
185 } else {
186 $('#relativeDate, #relativeDateRepeat, #OR', $form).show();
187 }
188 });
189 if ($('#absolute_date_display', $form).val()) {
190 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
191 }
192
193 loadMsgBox();
194 $('#mode', $form).change(loadMsgBox);
195
196 function populateRecipient() {
197 var mappingID = $('#entity_0', $form).val();
198 var recipient = $("#recipient", $form).val();
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 );
209 }
210
211 showHideLimitTo();
212 }
213
214 // CRM-14070 Hide limit-to when entity is activity
215 function showHideLimitTo() {
216 $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1'));
217 if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) {
218 if ($('#limit_to', $form).val() == '') {
219 $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide();
220 $('a.limit_to').show();
221 }
222 else {
223 $('a.limit_to, a.recipient').show();
224 $('#recipient').css("margin-left", "12px");
225 }
226 $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}');
227 }
228 else {
229 $('#recipient, a.recipient').show()
230 $('#recipient').css("margin-left", "-2px");
231 $('a.limit_to').hide();
232 $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}');
233 }
234 }
235
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();
250 var isLimit = $('#limit_to', $form).val();
251
252 $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit},
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 }
282 }
283
284 });
285 </script>
286 {/literal}
287
288 {/if}
289
290 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
291 </div>