Merge pull request #4061 from mlutfy/4.5-crm15246
[civicrm-core.git] / templates / CRM / Case / Form / CaseView.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 {* CiviCase - view case screen*}
27
28 <div class="crm-block crm-form-block crm-case-caseview-form-block">
29
30 {* here we are showing related cases w/ jquery dialog *}
31 {if $showRelatedCases}
32 {include file="CRM/Case/Form/ViewRelatedCases.tpl"}
33
34 {* Main case view *}
35 {else}
36
37 <h3>{ts}Summary{/ts}</h3>
38 <table class="report crm-entity case-summary" data-entity="case" data-id="{$caseID}" data-cid="{$contactID}">
39 {if $multiClient}
40 <tr class="crm-case-caseview-client">
41 <td colspan="5" class="label">
42 {ts}Clients:{/ts}
43 {foreach from=$caseRoles.client item=client name=clients}
44 <a href="{crmURL p='civicrm/contact/view' q="action=view&reset=1&cid=`$client.contact_id`"}" title="{ts}view contact record{/ts}">{$client.display_name}</a>{if not $smarty.foreach.clients.last}, &nbsp; {/if}
45 {/foreach}
46 <a href="#addClientDialog" class="crm-hover-button case-miniform" title="{ts}Add Client{/ts}" data-key="{crmKey name='civicrm/case/ajax/addclient'}">
47 <span class="icon add-icon"></span>
48 </a>
49 <div id="addClientDialog" class="hiddenElement">
50 <input name="add_client_id" placeholder="{ts}- select contact -{/ts}" class="huge" />
51 </div>
52 {if $hasRelatedCases}
53 <div class="crm-block relatedCases-link"><a class="crm-hover-button crm-popup medium-popup" href="{$relatedCaseUrl}">{$relatedCaseLabel}</a></div>
54 {/if}
55 </td>
56 </tr>
57 {/if}
58 <tr>
59 {if not $multiClient}
60 <td>
61 <table class="form-layout-compressed">
62 {foreach from=$caseRoles.client item=client}
63 <tr class="crm-case-caseview-display_name">
64 <td class="label-left bold" style="padding: 0px; border: none;">{$client.display_name}</td>
65 </tr>
66 {if $client.phone}
67 <tr class="crm-case-caseview-phone">
68 <td class="label-left description" style="padding: 1px">{$client.phone}</td>
69 </tr>
70 {/if}
71 {if $client.birth_date}
72 <tr class="crm-case-caseview-birth_date">
73 <td class="label-left description" style="padding: 1px">{ts}DOB{/ts}: {$client.birth_date|crmDate}</td>
74 </tr>
75 {/if}
76 {/foreach}
77 </table>
78 {if $hasRelatedCases}
79 <div class="crm-block relatedCases-link"><a class="crm-hover-button crm-popup medium-popup" href="{$relatedCaseUrl}">{$relatedCaseLabel}</a></div>
80 {/if}
81 </td>
82 {/if}
83 <td class="crm-case-caseview-case_subject label">
84 <span class="crm-case-summary-label">{ts}Subject{/ts}:</span>&nbsp;{$caseDetails.case_subject}
85 </td>
86 <td class="crm-case-caseview-case_type label">
87 <span class="crm-case-summary-label">{ts}Type{/ts}:</span>&nbsp;{$caseDetails.case_type}&nbsp;<a class="crm-hover-button crm-popup" href="{crmURL p='civicrm/case/activity' q="action=add&reset=1&cid=`$contactId`&caseid=`$caseId`&selectedChild=activity&atype=`$changeCaseTypeId`"}" title="{ts}Change case type (creates activity record){/ts}"><span class="icon edit-icon"></span></a>
88 </td>
89 <td class="crm-case-caseview-case_status label">
90 <span class="crm-case-summary-label">{ts}Status{/ts}:</span>&nbsp;{$caseDetails.case_status}&nbsp;<a class="crm-hover-button crm-popup" href="{crmURL p='civicrm/case/activity' q="action=add&reset=1&cid=`$contactId`&caseid=`$caseId`&selectedChild=activity&atype=`$changeCaseStatusId`"}" title="{ts}Change case status (creates activity record){/ts}"><span class="icon edit-icon"></span></a>
91 </td>
92 <td class="crm-case-caseview-case_start_date label">
93 <span class="crm-case-summary-label">{ts}Open Date{/ts}:</span>&nbsp;{$caseDetails.case_start_date|crmDate}&nbsp;<a class="crm-hover-button crm-popup" href="{crmURL p='civicrm/case/activity' q="action=add&reset=1&cid=`$contactId`&caseid=`$caseId`&selectedChild=activity&atype=`$changeCaseStartDateId`"}" title="{ts}Change case start date (creates activity record){/ts}"><span class="icon edit-icon"></span></a>
94 </td>
95 <td class="crm-case-caseview-{$caseID} label">
96 <span class="crm-case-summary-label">{ts}ID{/ts}:</span>&nbsp;{$caseID}
97 </td>
98 </tr>
99 </table>
100 {if $hookCaseSummary}
101 <div id="caseSummary">
102 {foreach from=$hookCaseSummary item=val key=div_id}
103 <div id="{$div_id}"><label>{$val.label}</label><div class="value">{$val.value}</div></div>
104 {/foreach}
105 </div>
106 {/if}
107
108 <div class="case-control-panel">
109 <div>
110 <p>
111 {$form.add_activity_type_id.html}
112 {if $hasAccessToAllCases} &nbsp;
113 {$form.timeline_id.html}{$form._qf_CaseView_next.html} &nbsp;
114 {$form.report_id.html}
115 {/if}
116 </p>
117 </div>
118 <div>
119 <p>
120 {if $hasAccessToAllCases}
121 <a class="crm-hover-button action-item no-popup" href="{crmURL p='civicrm/case/report/print' q="all=1&redact=0&cid=$contactID&caseID=$caseId&asn=standard_timeline"}"><span class="icon print-icon"></span> {ts}Print Report{/ts}</a>
122 {/if}
123
124 {if $mergeCases}
125 <a href="#mergeCasesDialog" class="action-item no-popup crm-hover-button case-miniform"><span class="icon ui-icon-copy"></span>{ts}Merge Case{/ts}</a>
126 {$form._qf_CaseView_next_merge_case.html}
127 <span id="mergeCasesDialog" class="hiddenElement">
128 {$form.merge_case_id.html}
129 </span>
130 {/if}
131
132 {if call_user_func(array('CRM_Core_Permission','giveMeAllACLs'))}
133 <a class="action-item crm-hover-button medium-popup" href="{crmURL p='civicrm/contact/view/case/editClient' h=1 q="reset=1&action=update&id=$caseID&cid=$contactID"}"><span class="icon ui-icon-person"></span> {ts}Assign to Another Client{/ts}</a>
134 {/if}
135 </p>
136 </div>
137 </div>
138
139 <div class="clear"></div>
140 {include file="CRM/Case/Page/CustomDataView.tpl"}
141
142 <div class="crm-accordion-wrapper collapsed crm-case-roles-block">
143 <div class="crm-accordion-header">
144 {ts}Roles{/ts}
145 </div><!-- /.crm-accordion-header -->
146 <div class="crm-accordion-body">
147
148 {if $hasAccessToAllCases}
149 <div class="crm-submit-buttons">
150 <a class="button case-miniform" href="#addCaseRoleDialog" data-key="{crmKey name='civicrm/ajax/relation'}" rel="#caseRoles-selector-{$caseID}"><div class="icon add-icon"></div>{ts}Add new role{/ts}</a>
151 </div>
152 <div id="addCaseRoleDialog" class="hiddenElement">
153 <div>{$form.role_type.label}</div>
154 <div>{$form.role_type.html}</div><br />
155 <div><label for="add_role_contact_id">{ts}Assign To{/ts}:</label></div>
156 <div><input name="add_role_contact_id" placeholder="{ts}- select contact -{/ts}" class="huge" /></div>
157 </div>
158 {/if}
159
160 <div id="editCaseRoleDialog" class="hiddenElement">
161 <div><label for="edit_role_contact_id">{ts}Change To{/ts}:</label></div>
162 <div><input name="edit_role_contact_id" placeholder="{ts}- select contact -{/ts}" class="huge" /></div>
163 </div>
164
165 <table id="caseRoles-selector-{$caseID}" class="report-layout">
166 <thead><tr>
167 <th>{ts}Case Role{/ts}</th>
168 <th>{ts}Name{/ts}</th>
169 <th>{ts}Phone{/ts}</th>
170 <th>{ts}Email{/ts}</th>
171 {if $relId neq 'client' and $hasAccessToAllCases}
172 <th id="nosort">{ts}Actions{/ts}</th>
173 {/if}
174 </tr></thead>
175 </table>
176
177 <div id="deleteCaseRoleDialog" class="hiddenElement">
178 {ts}Are you sure you want to delete this case role?{/ts}
179 </div>
180
181 {literal}
182 <script type="text/javascript">
183 var oTable;
184
185 CRM.$(function($) {
186 buildCaseRoles(false);
187 function buildCaseRoles(filterSearch) {
188 if(filterSearch) {
189 oTable.fnDestroy();
190 }
191 var count = 0;
192 var columns = '';
193 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/caseroles' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
194 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
195 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
196
197 $('#caseRoles-selector-{/literal}{$caseID}{literal} th').each( function( ) {
198 if ( $(this).attr('id') != 'nosort' ) {
199 columns += '{"sClass": "' + $(this).attr('class') +'"},';
200 }
201 else {
202 columns += '{ "bSortable": false },';
203 }
204 count++;
205 });
206
207 columns = columns.substring(0, columns.length - 1 );
208 eval('columns =[' + columns + ']');
209
210 oTable = $('#caseRoles-selector-{/literal}{$caseID}{literal}').dataTable({
211 "bFilter" : false,
212 "bAutoWidth" : false,
213 "aaSorting" : [],
214 "aoColumns" : columns,
215 "bProcessing": true,
216 "bJQueryUI": true,
217 "asStripClasses" : [ "odd-row", "even-row" ],
218 "sPaginationType": "full_numbers",
219 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
220 "bServerSide": true,
221 "sAjaxSource": sourceUrl,
222 "iDisplayLength": 10,
223 "fnDrawCallback": function() { setCaseRolesSelectorClass(); },
224 "fnServerData": function ( sSource, aoData, fnCallback ) {
225 $.ajax({
226 "dataType": 'json',
227 "type": "POST",
228 "url": sSource,
229 "data": aoData,
230 "success": fnCallback
231 });
232 }
233 });
234 }
235
236 function setCaseRolesSelectorClass( ) {
237 $("#caseRoles-selector-{/literal}{$caseID}{literal} td:last-child").each( function( ) {
238 $(this).parent().addClass($(this).text() );
239 });
240 }
241 });
242 </script>
243 {/literal}
244 </div><!-- /.crm-accordion-body -->
245 </div><!-- /.crm-accordion-wrapper -->
246
247 {if $hasAccessToAllCases}
248 <div class="crm-accordion-wrapper collapsed crm-case-other-relationships-block">
249 <div class="crm-accordion-header">
250 {ts}Other Relationships{/ts}
251 </div><!-- /.crm-accordion-header -->
252 <div class="crm-accordion-body">
253 {capture assign=relUrl}{crmURL p='civicrm/contact/view/rel' q="action=add&reset=1&cid=`$contactId`&caseID=`$caseID`"}{/capture}
254 {if $clientRelationships}
255 <div class="crm-submit-buttons">
256 <a class="button" href="{$relUrl}">
257 <div class="icon add-icon"></div>{ts}Add client relationship{/ts}</a>
258 </div>
259 <table id="clientRelationships-selector-{$caseID}" class="report-layout">
260 <thead><tr>
261 <th>{ts}Client Relationship{/ts}</th>
262 <th>{ts}Name{/ts}</th>
263 <th>{ts}Phone{/ts}</th>
264 <th>{ts}Email{/ts}</th>
265 </tr></thead>
266 </table>
267 {else}
268 <div class="messages status no-popup">
269 <div class="icon inform-icon"></div>
270 {capture assign=link}class="action-item" href="{$relUrl}"{/capture}
271 {ts 1=$link}There are no Relationships entered for this client. You can <a %1>add one</a>.{/ts}
272 </div>
273 {/if}
274 {literal}
275 <script type="text/javascript">
276 CRM.$(function($) {
277 buildCaseClientRelationships(false);
278 function buildCaseClientRelationships(filterSearch) {
279 if (filterSearch) {
280 oTable.fnDestroy();
281 }
282 var count = 0;
283 var columns = '';
284 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/clientrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
285 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
286 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
287
288 $('#clientRelationships-selector-{/literal}{$caseID}{literal} th').each( function( ) {
289 if ( $(this).attr('id') != 'nosort' ) {
290 columns += '{"sClass": "' + $(this).attr('class') +'"},';
291 }
292 else {
293 columns += '{ "bSortable": false },';
294 }
295 count++;
296 });
297
298 columns = columns.substring(0, columns.length - 1 );
299 eval('columns =[' + columns + ']');
300
301 oTable = $('#clientRelationships-selector-{/literal}{$caseID}{literal}').dataTable({
302 "bFilter" : false,
303 "bAutoWidth" : false,
304 "aaSorting" : [],
305 "aoColumns" : columns,
306 "bProcessing": true,
307 "bJQueryUI": true,
308 "asStripClasses" : [ "odd-row", "even-row" ],
309 "sPaginationType": "full_numbers",
310 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
311 "bServerSide": true,
312 "sAjaxSource": sourceUrl,
313 "iDisplayLength": 10,
314 "fnDrawCallback": function() { setClientRelationshipsSelectorClass(); },
315 "fnServerData": function (sSource, aoData, fnCallback) {
316 $.ajax( {
317 "dataType": 'json',
318 "type": "POST",
319 "url": sSource,
320 "data": aoData,
321 "success": fnCallback
322 });
323 }
324 });
325 }
326
327 function setClientRelationshipsSelectorClass( ) {
328 $("#clientRelationships-selector-{/literal}{$caseID}{literal} td:last-child").each(function() {
329 $(this).parent().addClass($(this).text());
330 });
331 }
332 });
333 </script>
334 {/literal}
335 <br />
336 {if !empty($globalGroupInfo.id)}
337 <div class="crm-submit-buttons">
338 <a class="button case-miniform" href="#addMembersToGroupDialog" rel="#globalRelationships-selector-{$caseId}" data-group_id="{$globalGroupInfo.id}">
339 <div class="icon add-icon"></div>{ts 1=$globalGroupInfo.title}Add members to %1{/ts}
340 </a>
341 </div>
342 <div id="addMembersToGroupDialog" class="hiddenElement">
343 <input name="add_member_to_group_contact_id" placeholder="{ts}- select contacts -{/ts}" class="huge" />
344 </div>
345 <table id="globalRelationships-selector-{$caseId}" class="report-layout">
346 <thead><tr>
347 <th>{$globalGroupInfo.title}</th>
348 <th>{ts}Phone{/ts}</th>
349 <th>{ts}Email{/ts}</th>
350 </tr></thead>
351 </table>
352 {/if}
353
354 {literal}
355 <script type="text/javascript">
356 CRM.$(function($) {
357 buildCaseGlobalRelationships(false);
358 function buildCaseGlobalRelationships(filterSearch) {
359 if (filterSearch) {
360 oTable.fnDestroy();
361 }
362 var count = 0;
363 var columns = '';
364 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
365 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
366 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
367
368 $('#globalRelationships-selector-{/literal}{$caseID}{literal} th').each( function( ) {
369 if ($(this).attr('id') != 'nosort') {
370 columns += '{"sClass": "' + $(this).attr('class') +'"},';
371 }
372 else {
373 columns += '{ "bSortable": false },';
374 }
375 count++;
376 });
377
378 columns = columns.substring(0, columns.length - 1 );
379 eval('columns =[' + columns + ']');
380
381 oTable = $('#globalRelationships-selector-{/literal}{$caseID}{literal}').dataTable({
382 "bFilter" : false,
383 "bAutoWidth" : false,
384 "aaSorting" : [],
385 "aoColumns" : columns,
386 "bProcessing": true,
387 "bJQueryUI": true,
388 "asStripClasses" : [ "odd-row", "even-row" ],
389 "sPaginationType": "full_numbers",
390 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
391 "bServerSide": true,
392 "sAjaxSource": sourceUrl,
393 "iDisplayLength": 10,
394 "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
395 "oLanguage": {
396 "sEmptyTable": {/literal}'{ts escape='js' 1=$globalGroupInfo.title}The group %1 has no members.{/ts}'{literal}
397 },
398 "fnServerData": function ( sSource, aoData, fnCallback ) {
399 $.ajax( {
400 "dataType": 'json',
401 "type": "POST",
402 "url": sSource,
403 "data": aoData,
404 "success": fnCallback
405 });
406 }
407 });
408 }
409
410 function setGlobalRelationshipsSelectorClass( ) {
411 $("#globalRelationships-selector-{/literal}{$caseID}{literal} td:last-child").each( function( ) {
412 $(this).parent().addClass($(this).text() );
413 });
414 }
415 });
416 </script>
417 {/literal}
418 </div><!-- /.crm-accordion-body -->
419 </div><!-- /.crm-accordion-wrapper -->
420
421 {/if} {* other relationship section ends *}
422 {include file="CRM/Case/Form/ActivityToCase.tpl"}
423
424 {* pane to display / edit regular tags or tagsets for cases *}
425 {if $showTags OR $showTagsets}
426
427 <div id="casetags" class="crm-accordion-wrapper crm-case-tags-block">
428 <div class="crm-accordion-header">
429 {ts}Case Tags{/ts}
430 </div><!-- /.crm-accordion-header -->
431 <div class="crm-accordion-body">
432 {assign var="tagExits" value=0}
433 {if $tags}
434 <div class="crm-block crm-content-block crm-case-caseview-display-tags">&nbsp;&nbsp;{$tags}</div>
435 {assign var="tagExits" value=1}
436 {/if}
437
438 {foreach from=$tagsetInfo.case item=displayTagset}
439 {if $displayTagset.entityTagsArray}
440 <div class="crm-block crm-content-block crm-case-caseview-display-tagset">
441 &nbsp;&nbsp;{$displayTagset.parentName}:
442 {foreach from=$displayTagset.entityTagsArray item=val name="tagsetList"}
443 &nbsp;{$val.name}{if !$smarty.foreach.tagsetList.last},{/if}
444 {/foreach}
445 </div>
446 {assign var="tagExits" value=1}
447 {/if}
448 {/foreach}
449
450 {if !$tagExits }
451 <div class="status">
452 {ts}There are no tags currently assigned to this case.{/ts}
453 </div>
454 {/if}
455
456 <div class="crm-submit-buttons">
457 <a class="button case-miniform" href="#manageTagsDialog" data-key="{crmKey name='civicrm/case/ajax/processtags'}">{if $tagExits}{ts}Edit Tags{/ts}{else}{ts}Add Tags{/ts}{/if}</a>
458 </div>
459
460 </div><!-- /.crm-accordion-body -->
461 </div><!-- /.crm-accordion-wrapper -->
462
463 <div id="manageTagsDialog" class="hiddenElement">
464 <div class="label">{$form.case_tag.label}</div>
465 <div class="view-value"><div class="crm-select-container">{$form.case_tag.html}</div>
466 <br/>
467 <div style="text-align:left;">{include file="CRM/common/Tagset.tpl" tagsetType='case'}</div>
468 <br/>
469 <div class="clear"></div>
470 </div>
471 </div>
472
473 {/if} {* end of tag block*}
474
475 {include file="CRM/Case/Form/ActivityTab.tpl"}
476
477 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
478
479 {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
480 {/if} {* view related cases if end *}
481 </div>
482