Merge pull request #13289 from mfb/pear-mail
[civicrm-core.git] / templates / CRM / Activity / Form / Activity.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
fee14197 3 | CiviCRM version 5 |
6a488035 4 +--------------------------------------------------------------------+
6b83d5bd 5 | Copyright CiviCRM LLC (c) 2004-2019 |
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/editing other (custom) activities. *}
6a488035
TO
27 {if $action eq 4}
28 <div class="crm-block crm-content-block crm-activity-view-block">
29 {else}
6a488035
TO
30 {if $activityTypeDescription }
31 <div class="help">{$activityTypeDescription}</div>
32 {/if}
33 <div class="crm-block crm-form-block crm-activity-form-block">
34 {/if}
6a488035
TO
35 {if !$action or ( $action eq 1 ) or ( $action eq 2 ) }
36 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
37 {/if}
38
39 {if $action eq 8} {* Delete action. *}
40 <table class="form-layout">
41 <tr>
42 <td colspan="2">
b25c334b 43 <div class="status">{ts}Are you sure you want to delete {/ts}{if $delName}'{$delName}'{/if}?</div>
6a488035
TO
44 </td>
45 </tr>
46 {elseif $action eq 1 or $action eq 2 or $action eq 4 or $context eq 'search' or $context eq 'smog'}
47
48 <table class="{if $action eq 4}crm-info-panel{else}form-layout{/if}">
49
50 {if $action eq 4}
6a488035
TO
51 {if $activityTypeDescription }
52 <div class="help">{$activityTypeDescription}</div>
edc51caa 53 {/if}
6a488035
TO
54 {else}
55 {if $context eq 'standalone' or $context eq 'search' or $context eq 'smog'}
56 <tr class="crm-activity-form-block-activity_type_id">
57 <td class="label">{$form.activity_type_id.label}</td><td class="view-value">{$form.activity_type_id.html}</td>
58 </tr>
59 {/if}
60 {/if}
61
62 {if $surveyActivity}
63 <tr class="crm-activity-form-block-survey">
64 <td class="label">{ts}Survey Title{/ts}</td><td class="view-value">{$surveyTitle}</td>
65 </tr>
66 {/if}
67
68 <tr class="crm-activity-form-block-source_contact_id">
69 <td class="label">{$form.source_contact_id.label}</td>
70 <td class="view-value">
f7305cbc 71 {$form.source_contact_id.html}
6a488035
TO
72 </td>
73 </tr>
74
75 <tr class="crm-activity-form-block-target_contact_id">
ab911378
PJ
76 <td class="label">{$form.target_contact_id.label}</td>
77 <td class="view-value">
78 {$form.target_contact_id.html}
ab911378 79 </td>
6a488035 80 </tr>
8ef12e64 81
598e9b75 82 {if $form.separation }
a850c3fe
SM
83 <tr class="crm-activity-form-block-separation crm-is-multi-activity-wrapper">
84 <td class="label">{$form.separation.label}</td>
85 <td>{$form.separation.html} {help id="separation"}</td>
86 </tr>
87 {/if}
88
6a488035 89 <tr class="crm-activity-form-block-assignee_contact_id">
f71cfc02
CW
90 <td class="label">
91 {$form.assignee_contact_id.label}
92 {edit}{help id="assignee_contact_id" title=$form.assignee_contact_id.label}{/edit}
93 </td>
8cc24f78 94 <td>
c27ebe4e
CW
95 {$form.assignee_contact_id.html}
96 {if $action neq 4}
33913af6
CW
97 {if !$form.target_contact_id.frozen}
98 <a href="#" class="crm-hover-button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="position:relative; bottom: 1em;">
aac8c264 99 <i class="crm-i fa-random"></i>
33913af6
CW
100 </a>
101 {/if}
6db7e202 102 {if $activityAssigneeNotification}
f71cfc02 103 <br />
e680ea41 104 <span id="notify_assignee_msg" class="description"><i class="crm-i fa-paper-plane"></i> {ts}A copy of this activity will be emailed to each Assignee.{/ts} {help id="sent_copy_email"}</span>
6a488035 105 {/if}
f71cfc02 106 {/if}
6a488035 107 </td>
6a488035
TO
108 </tr>
109
110 {if $activityTypeFile}
111 {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"}
112 {/if}
113
114 <tr class="crm-activity-form-block-subject">
46f0f1a6 115 <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html}</td>
6a488035
TO
116 </tr>
117
118 {* CRM-7362 --add campaign to activities *}
119 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
120 campaignTrClass="crm-activity-form-block-campaign_id"}
121
122 {* build engagement level CRM-7775 *}
123 {if $buildEngagementLevel}
124 <tr class="crm-activity-form-block-engagement_level">
125 <td class="label">{$form.engagement_level.label}</td>
126 <td class="view-value">{$form.engagement_level.html}</td>
127 </tr>
128 {/if}
129
130 <tr class="crm-activity-form-block-location">
131 <td class="label">{$form.location.label}</td><td class="view-value">{$form.location.html|crmAddClass:huge}</td>
132 </tr>
133 <tr class="crm-activity-form-block-activity_date_time">
134 <td class="label">{$form.activity_date_time.label}</td>
135 {if $action neq 4}
d104311a 136 <td class="view-value">{$form.activity_date_time.html}</td>
6a488035 137 {else}
d32858b8 138 <td class="view-value">{$form.activity_date_time.value|crmDate}</td>
6a488035
TO
139 {/if}
140 </tr>
141 <tr class="crm-activity-form-block-duration">
142 <td class="label">{$form.duration.label}</td>
143 <td class="view-value">
144 {$form.duration.html}
56468778 145 {if $action neq 4}<span class="description">{ts}minutes{/ts}{/if}
6a488035
TO
146 </td>
147 </tr>
148 <tr class="crm-activity-form-block-status_id">
149 <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td>
150 </tr>
151 <tr class="crm-activity-form-block-details">
152 <td class="label">{$form.details.label}</td>
153 {if $activityTypeName eq "Print PDF Letter"}
154 <td class="view-value">
13d9bc82 155 {$form.details.html}
6a488035 156 </td>
de8ce74e 157 {elseif $activityTypeName eq "Inbound Email"}
6a488035 158 <td class="view-value">
ef9fac72 159 {$form.details.html|crmStripAlternatives|nl2br}
6a488035 160 </td>
de8ce74e
ML
161 {else}
162 <td class="view-value">
163 {$form.details.html|crmStripAlternatives}
164 </td>
6a488035
TO
165 {/if}
166 </tr>
167 <tr class="crm-activity-form-block-priority_id">
168 <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td>
169 </tr>
170 {if $surveyActivity }
171 <tr class="crm-activity-form-block-result">
172 <td class="label">{$form.result.label}</td><td class="view-value">{$form.result.html}</td>
173 </tr>
174 {/if}
175 {if $form.tag.html}
176 <tr class="crm-activity-form-block-tag">
177 <td class="label">{$form.tag.label}</td>
ab345ca5
CW
178 <td class="view-value">
179 <div class="crm-select-container">{$form.tag.html}</div>
6a488035
TO
180 </td>
181 </tr>
182 {/if}
183
c087eb82
CW
184 {if $tagsetInfo.activity}
185 <tr class="crm-activity-form-block-tag_set">{include file="CRM/common/Tagset.tpl" tagsetType='activity' tableLayout=true}</tr>
6a488035
TO
186 {/if}
187
188 {if $action neq 4 OR $viewCustomData}
189 <tr class="crm-activity-form-block-custom_data">
190 <td colspan="2">
191 {if $action eq 4}
192 {include file="CRM/Custom/Page/CustomDataView.tpl"}
193 {else}
194 <div id="customData"></div>
195 {/if}
196 </td>
197 </tr>
198 {/if}
199
200 {if $action eq 4 AND $currentAttachmentInfo}
201 {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *}
202 {elseif $action eq 1 OR $action eq 2}
203 <tr class="crm-activity-form-block-attachment">
204 <td colspan="2">
205 {include file="CRM/Form/attachment.tpl"}
206 </td>
207 </tr>
208 {/if}
59d63f8b 209
b334d9ad 210 {if $action eq 2 OR $action eq 1}
78fe87e6 211 <tr class="crm-activity-form-block-recurring_activity">
212 <td colspan="2">
d2a4c29b 213 {include file="CRM/Core/Form/RecurringEntity.tpl" recurringFormIsEmbedded=true}
78fe87e6 214 </td>
215 </tr>
216 {/if}
59d63f8b 217
6a488035
TO
218 {if $action neq 4} {* Don't include "Schedule Follow-up" section in View mode. *}
219 <tr class="crm-activity-form-block-schedule_followup">
220 <td colspan="2">
cfcf9132 221 {include file="CRM/Activity/Form/FollowUp.tpl" type=""}
6a488035
TO
222 {literal}
223 <script type="text/javascript">
3cc60a06 224 CRM.$(function($) {
63c886b1
CW
225 var $form = $('form.{/literal}{$form.formClass}{literal}');
226 $('.crm-accordion-body', $form).each( function() {
6a488035 227 //open tab if form rule throws error
ae8f569f
CW
228 if ( $(this).children( ).find('span.crm-error').text( ).length > 0 ) {
229 $(this).parent('.collapsed').crmAccordionToggle();
6a488035
TO
230 }
231 });
63c886b1
CW
232 function toggleMultiActivityCheckbox() {
233 $('.crm-is-multi-activity-wrapper').toggle(!!($(this).val() && $(this).val().indexOf(',') > 0));
234 }
235 $('[name=target_contact_id]', $form).each(toggleMultiActivityCheckbox).change(toggleMultiActivityCheckbox);
236 $('#swap_target_assignee').click(function(e) {
237 e.preventDefault();
238 var assignees = $('#assignee_contact_id', $form).select2("data");
239 var targets = $('#target_contact_id', $form).select2("data");
240 $('#assignee_contact_id', $form).select2("data", targets);
241 $('#target_contact_id', $form).select2("data", assignees).change();
9285bb0f
AH
242 });
243 });
6a488035
TO
244 </script>
245 {/literal}
246 </td>
247 </tr>
248 {/if}
249 {/if} {* End Delete vs. Add / Edit action *}
250 </table>
251 <div class="crm-submit-buttons">
ee90a98c 252 {if $action eq 4 && ($activityTName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)}
6a488035
TO
253 {if !$context }
254 {assign var="context" value='activity'}
255 {/if}
256 {if $permission EQ 'edit'}
257 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context"}
258 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
259 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
260 {/if}
aac8c264 261 <a href="{crmURL p='civicrm/activity/add' q=$urlParams}" class="edit button" title="{ts}Edit{/ts}"><span><i class="crm-i fa-pencil"></i> {ts}Edit{/ts}</span></a>
6a488035
TO
262 {/if}
263
264 {if call_user_func(array('CRM_Core_Permission','check'), 'delete activities')}
265 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context"}
266 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
267 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
268 {/if}
aac8c264 269 <a href="{crmURL p='civicrm/contact/view/activity' q=$urlParams}" class="delete button" title="{ts}Delete{/ts}"><span><i class="crm-i fa-trash"></i> {ts}Delete{/ts}</span></a>
6a488035
TO
270 {/if}
271 {/if}
5ff596c0 272 {if $action eq 4 and $context != 'case' and call_user_func(array('CRM_Case_BAO_Case','checkPermission'), $activityId, 'File On Case', $atype)}
aac8c264 273 <a href="#" onclick="fileOnCase('file', {$activityId}, null, this); return false;" class="cancel button" title="{ts}File On Case{/ts}"><span><i class="crm-i fa-clipboard"></i> {ts}File on Case{/ts}</span></a>
5ff596c0 274 {include file="CRM/Case/Form/ActivityToCase.tpl"}
5b7581f1 275 {/if}
6a488035
TO
276 {include file="CRM/common/formButtons.tpl" location="bottom"}
277 </div>
278
6a488035
TO
279
280 {if $action eq 1 or $action eq 2 or $context eq 'search' or $context eq 'smog'}
6a488035
TO
281 {literal}
282 <script type="text/javascript">
269e6449
MWMC
283 CRM.$(function($) {
284 var doNotNotifyAssigneeFor = {/literal}{$doNotNotifyAssigneeFor|@json_encode}{literal};
285 $('#activity_type_id').change(function() {
286 if ($.inArray($(this).val(), doNotNotifyAssigneeFor) != -1) {
287 $('#notify_assignee_msg').hide();
288 }
289 else {
290 $('#notify_assignee_msg').show();
291 }
292 });
e680ea41 293 });
6a488035
TO
294 </script>
295 {/literal}
269e6449
MWMC
296
297 {include file="CRM/common/customDataBlock.tpl"}
6a488035 298 {/if}
6a488035 299 </div>{* end of form block*}
39082712 300
3d3d45c4 301{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityID=$activityId entityTable="civicrm_activity"}