2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
26 {* CiviCase - view case screen*}
28 <div class="crm-block crm-form-block crm-case-caseview-form-block">
30 {* here we are showing related cases w/ jquery dialog *}
31 {if $showRelatedCases}
32 {include file="CRM/Case/Form/ViewRelatedCases.tpl"}
37 <h3>{ts}Summary{/ts}</h3>
38 <table class="report crm-entity case-summary" data-entity="case" data-id="{$caseID}" data-cid="{$contactID}">
40 <tr class="crm-case-caseview-client">
41 <td colspan="5" class="label">
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}, {/if}
46 <a href="#" class="crm-hover-button" title="{ts}add new client to the case{/ts}" onclick="addClient( );return false;">
47 <span class="icon edit-icon"></span>
50 <div class="crm-block relatedCases-link"><a class="crm-hover-button crm-popup medium-popup" href="{$relatedCaseUrl}">{$relatedCaseLabel}</a></div>
58 <table class="form-layout-compressed">
59 {foreach from=$caseRoles.client item=client}
60 <tr class="crm-case-caseview-display_name">
61 <td class="label-left bold" style="padding: 0px; border: none;">{$client.display_name}</td>
64 <tr class="crm-case-caseview-phone">
65 <td class="label-left description" style="padding: 1px">{$client.phone}</td>
68 {if $client.birth_date}
69 <tr class="crm-case-caseview-birth_date">
70 <td class="label-left description" style="padding: 1px">{ts}DOB{/ts}: {$client.birth_date|crmDate}</td>
76 <div class="crm-block relatedCases-link"><a class="crm-hover-button crm-popup medium-popup" href="{$relatedCaseUrl}">{$relatedCaseLabel}</a></div>
80 <td class="crm-case-caseview-case_subject label">
81 <span class="crm-case-summary-label">{ts}Subject{/ts}:</span> {$caseDetails.case_subject}
83 <td class="crm-case-caseview-case_type label">
84 <span class="crm-case-summary-label">{ts}Type{/ts}:</span> {$caseDetails.case_type} <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>
86 <td class="crm-case-caseview-case_status label">
87 <span class="crm-case-summary-label">{ts}Status{/ts}:</span> {$caseDetails.case_status} <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>
89 <td class="crm-case-caseview-case_start_date label">
90 <span class="crm-case-summary-label">{ts}Open Date{/ts}:</span> {$caseDetails.case_start_date|crmDate} <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>
92 <td class="crm-case-caseview-{$caseID} label">
93 <span class="crm-case-summary-label">{ts}ID{/ts}:</span> {$caseID}
98 <div id="caseSummary">
99 {foreach from=$hookCaseSummary item=val key=div_id}
100 <div id="{$div_id}"><label>{$val.label}</label><div class="value">{$val.value}</div></div>
105 <table class="form-layout">
106 <tr class="crm-case-caseview-form-block-activity_type_id">
107 <td>{$form.add_activity_type_id.html}</td>
108 {if $hasAccessToAllCases}
110 <a class="button no-popup" href="{crmURL p='civicrm/case/report/print' q="all=1&redact=0&cid=$contactID&caseID=$caseId&asn=standard_timeline"}"><div class="icon print-icon"></div> {ts}Print Report{/ts}</a>
114 <td class="crm-case-caseview-form-block-timeline_id">{$form.timeline_id.label}<br />{$form.timeline_id.html} {$form._qf_CaseView_next.html}</td>
115 <td class="crm-case-caseview-form-block-report_id">{$form.report_id.label}<br />{$form.report_id.html} <input type="button" accesskey="R" value="Go" name="case_report" onclick="checkSelection( this );"/></td>
122 <tr class="crm-case-caseview-form-block-merge_case_id">
123 <td colspan='2'><a href="#" onClick='cj("#merge_cases").toggle( ); return false;'>{ts}Merge Case{/ts}</a>
124 <span id='merge_cases' class='hide-block'>
125 {$form.merge_case_id.html} {$form._qf_CaseView_next_merge_case.html}
131 {if call_user_func(array('CRM_Core_Permission','giveMeAllACLs'))}
132 <tr class="crm-case-caseview-form-block-change_client_id">
134 <a class="crm-popup medium-popup" href="{crmURL p='civicrm/contact/view/case/editClient' h=0 q="reset=1&action=update&id=$caseID&cid=$contactID"}"><span class="icon swap-icon"></span> {ts}Assign to Another Contact{/ts}</a>
140 <div class="clear"></div>
141 {include file="CRM/Case/Page/CustomDataView.tpl"}
143 <div class="crm-accordion-wrapper collapsed crm-case-roles-block">
144 <div class="crm-accordion-header">
146 </div><!-- /.crm-accordion-header -->
147 <div class="crm-accordion-body">
149 {if $hasAccessToAllCases}
150 <div class="crm-submit-buttons">
151 <a class="button" href="#" onclick="addRole();return false;"><span><div class="icon add-icon"></div>{ts}Add new role{/ts}</span></a>
155 <table id="caseRoles-selector" class="report-layout">
157 <th>{ts}Case Role{/ts}</th>
158 <th>{ts}Name{/ts}</th>
159 <th>{ts}Phone{/ts}</th>
160 <th>{ts}Email{/ts}</th>
161 {if $relId neq 'client' and $hasAccessToAllCases}
162 <th id="nosort">{ts}Actions{/ts}</th>
168 <script type="text/javascript">
172 cj().crmAccordions();
173 buildCaseRoles(false);
176 function deleteCaseRoles(caseselector) {
177 cj('.case-role-delete').click(function(){
178 var caseID = cj(this).attr('case_id');
179 var relType = cj(this).attr('rel_type');
181 CRM.confirm(function() {
182 var postUrl = {/literal}"{crmURL p='civicrm/ajax/delcaserole' h=0 }"{literal};
184 rel_type: relType, case_id: caseID, key: {/literal}"{crmKey name='civicrm/ajax/delcaserole'}"{literal}},
186 // reloading datatable
187 var oTable = cj('#' + caseselector).dataTable();
193 title: '{/literal}{ts escape="js"}Delete case role{/ts}{literal}',
194 message: '{/literal}{ts escape="js"}Are you sure you want to delete this case role?{/ts}{literal}'
200 function buildCaseRoles(filterSearch) {
206 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/caseroles' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
207 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
208 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
210 cj('#caseRoles-selector th').each( function( ) {
211 if ( cj(this).attr('id') != 'nosort' ) {
212 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
215 columns += '{ "bSortable": false },';
220 columns = columns.substring(0, columns.length - 1 );
221 eval('columns =[' + columns + ']');
223 oTable = cj('#caseRoles-selector').dataTable({
225 "bAutoWidth" : false,
227 "aoColumns" : columns,
230 "asStripClasses" : [ "odd-row", "even-row" ],
231 "sPaginationType": "full_numbers",
232 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
234 "sAjaxSource": sourceUrl,
235 "iDisplayLength": 10,
236 "fnDrawCallback": function() { setCaseRolesSelectorClass(); },
237 "fnServerData": function ( sSource, aoData, fnCallback ) {
243 "success": fnCallback
249 function setCaseRolesSelectorClass( ) {
250 cj("#caseRoles-selector td:last-child").each( function( ) {
251 cj(this).parent().addClass(cj(this).text() );
254 // also bind delete action once rows are rendered
255 deleteCaseRoles('caseRoles-selector');
260 </div><!-- /.crm-accordion-body -->
261 </div><!-- /.crm-accordion-wrapper -->
263 {ts}Begin typing last name of contact.{/ts}<br/>
264 <input type="text" id="rel_contact"/>
265 <input type="hidden" id="rel_contact_id" value="">
269 <script type="text/javascript">
271 cj("#dialog").hide( );
273 function addClient( ) {
274 cj("#dialog").show( );
276 cj("#dialog").dialog({
277 title: "{/literal}{ts escape="js"}Add Client to the Case{/ts}{literal}",
279 close : function(event, ui) {
280 cj("#rel_contact").unautocomplete( );
281 cj("#dialog").hide( );
283 overlay: { opacity: 0.5, background: "black" },
286 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
287 cj("#rel_contact").autocomplete( contactUrl, {
293 cj("#rel_contact").focus();
294 cj("#rel_contact").result(function(event, data, formatted) {
295 cj("input[id=rel_contact_id]").val(data[1]);
300 "{/literal}{ts escape='js'}Done{/ts}{literal}": function() {
301 var postUrl = {/literal}"{crmURL p='civicrm/case/ajax/addclient' h=0 }"{literal};
302 var caseID = {/literal}"{$caseID}"{literal};
303 var contactID = cj("#rel_contact_id").val( );
305 if ( !cj("#rel_contact").val( ) || !contactID ) {
306 cj("#rel_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list.{/ts}{literal}');
309 cj.post( postUrl, {contactID: contactID,caseID: caseID,
310 key: {/literal}"{crmKey name='civicrm/case/ajax/addclient'}"{literal} },
312 //due to caching issues we use redirection rather than reload
313 document.location = {/literal}'{crmURL q="action=view&reset=1&id=$caseID&cid=$contactID&context=$context" h=0 }'{literal};
319 "{/literal}{ts escape='js'}Cancel{/ts}{literal}": function() {
320 cj(this).dialog("close");
321 cj(this).dialog("destroy");
327 function createRelationship( relType, contactID, relID, rowNumber, relTypeName ) {
328 cj("#dialog").show( );
330 cj("#dialog").dialog({
331 title: "Assign Case Role",
333 close: function(event, ui) { cj("#rel_contact").unautocomplete( ); },
335 /* set defaults if editing */
336 cj("#rel_contact").val("");
337 cj("#rel_contact_id").val(null);
339 cj("#rel_contact_id").val(contactID);
340 var contactName = cj('#caseRoles-selector').find('tr :eq('+ rowNumber +')').children(':eq(1)').text();
341 cj("#rel_contact").val(contactName);
344 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
346 cj("#rel_contact").autocomplete( contactUrl, {
352 cj("#rel_contact").focus();
353 cj("#rel_contact").result(function(event, data, formatted) {
354 cj("input[id=rel_contact_id]").val(data[1]);
359 "{/literal}{ts escape='js'}Ok{/ts}{literal}": function() {
361 var sourceContact = {/literal}"{$contactID}"{literal};
362 var caseID = {/literal}"{$caseID}"{literal};
364 var v1 = cj("#rel_contact_id").val( );
366 if ( !cj("#rel_contact").val( ) || !v1 ) {
367 cj("#rel_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list{/ts}{literal}.');
371 var postUrl = {/literal}"{crmURL p='civicrm/ajax/relation' h=0 }"{literal};
372 cj.post( postUrl, { rel_contact: v1, rel_type: relType, contact_id: sourceContact,
373 rel_id: relID, case_id: caseID, key: {/literal}"{crmKey name='civicrm/ajax/relation'}"{literal} },
375 if ( data.status == 'process-relationship-success' ) {
376 // reloading datatable
377 var oTable = cj('#caseRoles-selector').dataTable();
381 // This is an awkward mix of smarty and javascript: the relTypeName variable is
382 // not available in smarty, could not find an i18n-correct way of doing this.
384 {capture assign=relTypeAdminLink}{crmURL p='civicrm/admin/reltype' q='reset=1' h=0 }{/capture}
386 var errorMsg = relTypeName + ': ' + '{/literal}{ts escape="js" 1="$relTypeAdminLink"}The relationship type definition for the case role is not valid for the client and / or staff contact types. You can review and edit relationship types at <a href="%1">Administer >> Option Lists >> Relationship Types</a>.{/ts}{literal}';
388 //display error message.
389 cj().crmError(errorMsg);
394 cj(this).dialog("close");
395 cj(this).dialog("destroy");
398 "{/literal}{ts escape='js'}Cancel{/ts}{literal}": function() {
399 cj(this).dialog("close");
400 cj(this).dialog("destroy");
409 {if $hasAccessToAllCases}
410 <div class="crm-accordion-wrapper collapsed crm-case-other-relationships-block">
411 <div class="crm-accordion-header">
412 {ts}Other Relationships{/ts}
413 </div><!-- /.crm-accordion-header -->
414 <div class="crm-accordion-body">
415 {capture assign=relUrl}{crmURL p='civicrm/contact/view/rel' q="action=add&reset=1&cid=`$contactId`&caseID=`$caseID`"}{/capture}
416 {if $clientRelationships}
417 <div class="crm-submit-buttons">
418 <a class="button" href="{$relUrl}">
419 <div class="icon add-icon"></div>{ts}Add client relationship{/ts}</a>
421 <table id="clientRelationships-selector" class="report-layout">
423 <th>{ts}Client Relationship{/ts}</th>
424 <th>{ts}Name{/ts}</th>
425 <th>{ts}Phone{/ts}</th>
426 <th>{ts}Email{/ts}</th>
430 <div class="messages status no-popup">
431 <div class="icon inform-icon"></div>
432 {capture assign=link}class="action-item" href="{$relUrl}"{/capture}
433 {ts 1=$link}There are no Relationships entered for this client. You can <a %1>add one</a>.{/ts}
437 <script type="text/javascript">
439 buildCaseClientRelationships(false);
442 function buildCaseClientRelationships(filterSearch) {
448 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/clientrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
449 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
450 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
452 cj('#clientRelationships-selector th').each( function( ) {
453 if ( cj(this).attr('id') != 'nosort' ) {
454 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
457 columns += '{ "bSortable": false },';
462 columns = columns.substring(0, columns.length - 1 );
463 eval('columns =[' + columns + ']');
465 oTable = cj('#clientRelationships-selector').dataTable({
467 "bAutoWidth" : false,
469 "aoColumns" : columns,
472 "asStripClasses" : [ "odd-row", "even-row" ],
473 "sPaginationType": "full_numbers",
474 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
476 "sAjaxSource": sourceUrl,
477 "iDisplayLength": 10,
478 "fnDrawCallback": function() { setClientRelationshipsSelectorClass(); },
479 "fnServerData": function (sSource, aoData, fnCallback) {
485 "success": fnCallback
491 function setClientRelationshipsSelectorClass( ) {
492 cj("#clientRelationships-selector td:last-child").each(function() {
493 cj(this).parent().addClass(cj(this).text());
500 {if $globalRelationships}
501 <div class="crm-submit-buttons">
502 <a class="button" href="#" onClick="window.location='{crmURL p='civicrm/group/search' q="reset=1&context=amtg&amtgID=`$globalGroupInfo.id`"}'; return false;">
503 <span><div class="icon add-icon"></div>{ts 1=$globalGroupInfo.title}Add members to %1{/ts}</a></span>
505 <table id="globalRelationships-selector" class="report-layout">
507 <th>{$globalGroupInfo.title}</th>
508 <th>{ts}Phone{/ts}</th>
509 <th>{ts}Email{/ts}</th>
512 {elseif $globalGroupInfo.id}
513 <div class="messages status no-popup">
514 <div class="icon inform-icon"></div>
515 {capture assign=crmURL}{crmURL p='civicrm/group/search' q="reset=1&context=amtg&amtgID=`$globalGroupInfo.id`"}{/capture}
516 {ts 1=$crmURL 2=$globalGroupInfo.title}The group %2 has no members. You can <a href='%1'>add one</a>.{/ts}
521 <script type="text/javascript">
524 buildCaseGlobalRelationships(false);
527 function buildCaseGlobalRelationships(filterSearch) {
533 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
534 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
535 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
537 cj('#globalRelationships-selector th').each( function( ) {
538 if (cj(this).attr('id') != 'nosort') {
539 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
542 columns += '{ "bSortable": false },';
547 columns = columns.substring(0, columns.length - 1 );
548 eval('columns =[' + columns + ']');
550 oTable = cj('#globalRelationships-selector').dataTable({
552 "bAutoWidth" : false,
554 "aoColumns" : columns,
557 "asStripClasses" : [ "odd-row", "even-row" ],
558 "sPaginationType": "full_numbers",
559 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
561 "sAjaxSource": sourceUrl,
562 "iDisplayLength": 10,
563 "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
564 "fnServerData": function ( sSource, aoData, fnCallback ) {
570 "success": fnCallback
576 function setGlobalRelationshipsSelectorClass( ) {
577 cj("#globalRelationships-selector td:last-child").each( function( ) {
578 cj(this).parent().addClass(cj(this).text() );
583 </div><!-- /.crm-accordion-body -->
584 </div><!-- /.crm-accordion-wrapper -->
586 {/if} {* other relationship section ends *}
588 <div id="addRoleDialog">
589 {$form.role_type.label}<br />
590 {$form.role_type.html}
592 {ts}Begin typing last name of contact.{/ts}<br/>
593 <input type="text" id="role_contact"/>
594 <input type="hidden" id="role_contact_id" value="">
598 <script type="text/javascript">
600 cj("#addRoleDialog").hide( );
602 cj("#addRoleDialog").show( );
604 cj("#addRoleDialog").dialog({
607 close: function(event, ui) { cj("#role_contact").unautocomplete( ); },
609 /* set defaults if editing */
610 cj("#role_contact").val( "" );
611 cj("#role_contact_id").val( null );
613 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
615 cj("#role_contact").autocomplete( contactUrl, {
621 cj("#role_contact").focus();
622 cj("#role_contact").result(function(event, data, formatted) {
623 cj("input[id=role_contact_id]").val(data[1]);
628 "{/literal}{ts escape='js'}Ok{/ts}{literal}": function() {
629 var sourceContact = {/literal}"{$contactID}"{literal};
630 var caseID = {/literal}"{$caseID}"{literal};
633 var v2 = cj("#role_type").val();
635 cj("#role_type").crmError('{/literal}{ts escape="js"}Select valid type from the list{/ts}{literal}.');
639 var v1 = cj("#role_contact_id").val( );
640 if (!cj("#role_contact").val( ) || !v1) {
641 cj("#role_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list{/ts}{literal}.');
645 /* send synchronous request so that disabling any actions for slow servers*/
646 var postUrl = {/literal}"{crmURL p='civicrm/ajax/relation' h=0 }"{literal};
647 var data = 'rel_contact='+ v1 + '&rel_type='+ v2 + '&contact_id='+sourceContact + '&rel_id='+ relID
648 + '&case_id=' + caseID + "&key={/literal}{crmKey name='civicrm/ajax/relation'}{literal}";
655 success : function(values) {
656 if (values.status == 'process-relationship-success') {
657 // reloading datatable
658 var oTable = cj('#caseRoles-selector').dataTable();
662 var relTypeName = cj("#role_type :selected").text();
663 var relTypeAdminLink = {/literal}"{crmURL p='civicrm/admin/reltype' q='reset=1' h=0 }"{literal};
664 var errorMsg = '{/literal}{ts escape="js" 1="' + relTypeName + '" 2="' + relTypeAdminLink + '"}The relationship type definition for the %1 case role is not valid for the client and / or staff contact types. You can review and edit relationship types at <a href="%2">Administer >> Option Lists >> Relationship Types</a>{/ts}{literal}.';
666 //display error message.
667 cj().crmError(errorMsg);
672 cj(this).dialog("close");
673 cj(this).dialog("destroy");
676 "{/literal}{ts escape='js'}Cancel{/ts}{literal}": function() {
677 cj(this).dialog("close");
678 cj(this).dialog("destroy");
686 {include file="CRM/Case/Form/ActivityToCase.tpl"}
688 {* pane to display / edit regular tags or tagsets for cases *}
689 {if $showTags OR $showTagsets}
691 <div id="casetags" class="crm-accordion-wrapper crm-case-tags-block">
692 <div class="crm-accordion-header">
694 </div><!-- /.crm-accordion-header -->
695 <div class="crm-accordion-body">
696 {assign var="tagExits" value=0}
698 <div class="crm-block crm-content-block crm-case-caseview-display-tags"> {$tags}</div>
699 {assign var="tagExits" value=1}
702 {foreach from=$tagsetInfo_case item=displayTagset}
703 {if $displayTagset.entityTagsArray}
704 <div class="crm-block crm-content-block crm-case-caseview-display-tagset">
705 {$displayTagset.parentName}:
706 {foreach from=$displayTagset.entityTagsArray item=val name="tagsetList"}
707 {$val.name}{if !$smarty.foreach.tagsetList.last},{/if}
710 {assign var="tagExits" value=1}
716 {ts}There are no tags currently assigned to this case.{/ts}
720 <div class="crm-submit-buttons">
721 <a class="button case-miniform" href="#manageTags" data-qfkey="{crmKey name='civicrm/case/ajax/processtags'}">{if $tagExits}{ts}Edit Tags{/ts}{else}{ts}Add Tags{/ts}{/if}</a>
724 </div><!-- /.crm-accordion-body -->
725 </div><!-- /.crm-accordion-wrapper -->
727 <div id="manageTags">
728 <div class="label">{$form.case_tag.label}</div>
729 <div class="view-value"><div class="crm-select-container">{$form.case_tag.html}</div>
731 <div style="text-align:left;">{include file="CRM/common/Tag.tpl" tagsetType='case'}</div>
733 <div class="clear"></div>
737 {/if} {* end of tag block*}
739 <div class="crm-accordion-wrapper crm-case_activities-accordion crm-case-activities-block">
740 <div class="crm-accordion-header">
743 <div id="activities" class="crm-accordion-body">
744 <div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
745 <div class="crm-accordion-header">
746 {ts}Search Filters{/ts}</a>
747 </div><!-- /.crm-accordion-header -->
748 <div class="crm-accordion-body">
749 <table class="no-border form-layout-compressed" id="searchOptions">
751 <td class="crm-case-caseview-form-block-repoter_id"colspan="2"><label for="reporter_id">{ts}Reporter/Role{/ts}</label><br />
752 {$form.reporter_id.html|crmAddClass:twenty}
754 <td class="crm-case-caseview-form-block-status_id"><label for="status_id">{$form.status_id.label}</label><br />
755 {$form.status_id.html}
757 <td style="vertical-align: bottom;">
758 <span class="crm-button"><input class="form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true )"; /></span>
762 <td class="crm-case-caseview-form-block-activity_date_low">
763 {$form.activity_date_low.label}<br />
764 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_low}
766 <td class="crm-case-caseview-form-block-activity_date_high">
767 {$form.activity_date_high.label}<br />
768 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_high}
770 <td class="crm-case-caseview-form-block-activity_type_filter_id">
771 {$form.activity_type_filter_id.label}<br />
772 {$form.activity_type_filter_id.html}
775 {if $form.activity_deleted}
776 <tr class="crm-case-caseview-form-block-activity_deleted">
778 {$form.activity_deleted.html}{$form.activity_deleted.label}
783 </div><!-- /.crm-accordion-body -->
784 </div><!-- /.crm-accordion-wrapper -->
786 <table id="activities-selector" class="nestedActivitySelector">
788 <th class='crm-case-activities-date'>{ts}Date{/ts}</th>
789 <th class='crm-case-activities-subject'>{ts}Subject{/ts}</th>
790 <th class='crm-case-activities-type'>{ts}Type{/ts}</th>
791 <th class='crm-case-activities-with'>{ts}With{/ts}</th>
792 <th class='crm-case-activities-assignee'>{ts}Reporter / Assignee{/ts}</th>
793 <th class='crm-case-activities-status'>{ts}Status{/ts}</th>
794 <th class='crm-case-activities-status' id="nosort"> </th>
795 <th class='hiddenElement'> </th>
799 </div><!-- /.crm-accordion-body -->
800 </div><!-- /.crm-accordion-wrapper -->
803 <script type="text/javascript">
806 function checkSelection( field ) {
807 var validationMessage = '';
808 var validationField = '';
809 var successAction = '';
810 var forceValidation = false;
812 var fName = field.name;
815 case '_qf_CaseView_next' :
816 validationMessage = '{/literal}{ts escape="js"}Please select an activity set from the list.{/ts}{literal}';
817 validationField = 'timeline_id';
818 successAction = "confirm('{/literal}{ts escape='js'}Are you sure you want to add a set of scheduled activities to this case?{/ts}{literal}');";
822 validationMessage = '{/literal}{ts escape="js"}Please select a report from the list.{/ts}{literal}';
823 validationField = 'report_id';
824 successAction = "window.location='{/literal}{$reportUrl}{literal}' + document.getElementById('report_id').value";
827 case '_qf_CaseView_next_merge_case' :
828 validationMessage = '{/literal}{ts escape="js"}Please select a case from the list to merge with.{/ts}{literal}';
829 validationField = 'merge_case_id';
832 if ( forceValidation || ( document.getElementById( validationField ).value == '' ) ) {
833 cj('#'+validationField).crmError(validationMessage);
836 else if ( successAction ) {
837 return eval( successAction );
842 buildCaseActivities(false);
845 function buildCaseActivities(filterSearch) {
851 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
852 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
853 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
855 cj('#activities-selector th').each(function( ) {
856 if (cj(this).attr('id') != 'nosort') {
857 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
860 columns += '{ "bSortable": false },';
865 columns = columns.substring(0, columns.length - 1 );
866 eval('columns =[' + columns + ']');
868 oTable = cj('#activities-selector').dataTable({
870 "bAutoWidth" : false,
872 "aoColumns" : columns,
875 "asStripClasses" : [ "odd-row", "even-row" ],
876 "sPaginationType": "full_numbers",
877 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
879 "sAjaxSource": sourceUrl,
880 "iDisplayLength": 10,
881 "fnDrawCallback": function() { setSelectorClass(); },
882 "fnServerData": function ( sSource, aoData, fnCallback ) {
884 if ( filterSearch ) {
885 var activity_deleted = 0;
886 if ( cj("#activity_deleted:checked").val() == 1 ) {
887 activity_deleted = 1;
890 {name:'status_id', value: cj("select#status_id").val()},
891 {name:'activity_type_id', value: cj("select#activity_type_filter_id").val()},
892 {name:'activity_date_low', value: cj("#activity_date_low").val()},
893 {name:'activity_date_high', value: cj("#activity_date_high").val() },
894 {name:'activity_deleted', value: activity_deleted }
902 "success": fnCallback
908 function setSelectorClass( ) {
909 cj("#activities-selector td:last-child").each( function( ) {
910 cj(this).parent().addClass(cj(this).text() );
917 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
920 <script type="text/javascript">
922 cj().crmAccordions();
927 {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
928 {/if} {* view related cases if end *}