2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
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 {* here we are showing related cases w/ jquery dialog *}
29 <div class="crm-block crm-form-block crm-case-caseview-form-block">
30 {if $showRelatedCases}
31 <table class="report">
32 <tr class="columnheader">
33 <th>{ts}Client Name{/ts}</th>
34 <th>{ts}Case Type{/ts}</th>
38 {foreach from=$relatedCases item=row key=caseId}
40 <td class="crm-case-caseview-client_name label">{$row.client_name}</td>
41 <td class="crm-case-caseview-case_type label">{$row.case_type}</td>
42 <td class="label">{$row.links}</td>
49 <h3>{ts}Case Summary{/ts}</h3>
50 <table class="report">
52 <tr class="crm-case-caseview-client">
53 <td colspan="5" class="label">
55 {foreach from=$caseRoles.client item=client name=clients}
56 <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}
58 <a href="#" title="{ts}add new client to the case{/ts}" onclick="addClient( );return false;">
59 <span class="icon edit-icon"></span>
62 <div class="crm-block relatedCases-link"><a href='#' onClick='viewRelatedCases( {$caseID}, {$contactID} ); return false;'>{ts}Related Cases{/ts}</a></div>
70 <table class="form-layout-compressed">
71 {foreach from=$caseRoles.client item=client}
72 <tr class="crm-case-caseview-display_name">
73 <td class="label-left bold" style="padding: 0px; border: none;">{$client.display_name}</td>
76 <tr class="crm-case-caseview-phone">
77 <td class="label-left description" style="padding: 1px">{$client.phone}</td>
80 {if $client.birth_date}
81 <tr class="crm-case-caseview-birth_date">
82 <td class="label-left description" style="padding: 1px">{ts}DOB{/ts}: {$client.birth_date|crmDate}</td>
88 <div class="crm-block relatedCases-link"><a href='#' onClick='viewRelatedCases( {$caseID}, {$contactID} ); return false;'>{ts}Related Cases{/ts}</a></div>
92 <td class="crm-case-caseview-case_subject label">
93 <span class="crm-case-summary-label">{ts}Case Subject{/ts}:</span> {$caseDetails.case_subject}
95 <td class="crm-case-caseview-case_type label">
96 <span class="crm-case-summary-label">{ts}Case Type{/ts}:</span> {$caseDetails.case_type} <a 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>
98 <td class="crm-case-caseview-case_status label">
99 <span class="crm-case-summary-label">{ts}Status{/ts}:</span> {$caseDetails.case_status} <a 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>
101 <td class="crm-case-caseview-case_start_date label">
102 <span class="crm-case-summary-label">{ts}Start Date{/ts}:</span> {$caseDetails.case_start_date|crmDate} <a 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>
104 <td class="crm-case-caseview-{$caseID} label">
105 <span class="crm-case-summary-label">{ts}Case ID{/ts}:</span> {$caseID}
109 {if $hookCaseSummary}
110 <div id="caseSummary">
111 {foreach from=$hookCaseSummary item=val key=div_id}
112 <div id="{$div_id}"><label>{$val.label}</label><div class="value">{$val.value}</div></div>
117 <table class="form-layout">
118 <tr class="crm-case-caseview-form-block-activity_type_id">
119 <td>{$form.activity_type_id.label}<br />{$form.activity_type_id.html} <input type="button" accesskey="N" value="{ts}Go{/ts}" name="new_activity" onclick="checkSelection( this );"/></td>
120 {if $hasAccessToAllCases}
122 <span class="crm-button"><div class="icon print-icon"></div><input type="button" value="{ts}Print Case Report{/ts}" name="case_report_all" onclick="printCaseReport( );"/></span>
126 <td class="crm-case-caseview-form-block-timeline_id">{$form.timeline_id.label}<br />{$form.timeline_id.html} {$form._qf_CaseView_next.html}</td>
127 <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>
134 <tr class="crm-case-caseview-form-block-merge_case_id">
135 <td colspan='2'><a href="#" onClick='cj("#merge_cases").toggle( ); return false;'>{ts}Merge Case{/ts}</a>
136 <span id='merge_cases' class='hide-block'>
137 {$form.merge_case_id.html} {$form._qf_CaseView_next_merge_case.html}
143 {if call_user_func(array('CRM_Core_Permission','giveMeAllACLs'))}
144 <tr class="crm-case-caseview-form-block-change_client_id">
145 <td colspan='2'><a href="#" onClick='cj("#change_client").toggle( ); return false;'>{ts}Assign to Another Client{/ts}</a>
146 <span id='change_client' class='hide-block'>
147 {$form.change_client_id.html|crmAddClass:twenty} {$form._qf_CaseView_next_edit_client.html}
154 <div id="view-related-cases">
155 <div id="related-cases-content"></div>
158 <div class="clear"></div>
159 {include file="CRM/Case/Page/CustomDataView.tpl"}
161 <div class="crm-accordion-wrapper collapsed crm-case-roles-block">
162 <div class="crm-accordion-header">
164 </div><!-- /.crm-accordion-header -->
165 <div class="crm-accordion-body">
167 {if $hasAccessToAllCases}
168 <div class="crm-submit-buttons">
169 <a class="button" href="#" onclick="addRole();return false;"><span><div class="icon add-icon"></div>{ts}Add new role{/ts}</span></a>
173 <table id="caseRoles-selector" class="report-layout">
175 <th>{ts}Case Role{/ts}</th>
176 <th>{ts}Name{/ts}</th>
177 <th>{ts}Phone{/ts}</th>
178 <th>{ts}Email{/ts}</th>
179 {if $relId neq 'client' and $hasAccessToAllCases}
180 <th id="nosort">{ts}Actions{/ts}</th>
186 <script type="text/javascript">
190 cj().crmAccordions();
191 buildCaseRoles(false);
194 function deleteCaseRoles(caseselector) {
195 cj('.case-role-delete').click(function(){
196 var caseID = cj(this).attr('case_id');
197 var relType = cj(this).attr('rel_type');
199 CRM.confirm(function() {
200 var postUrl = {/literal}"{crmURL p='civicrm/ajax/delcaserole' h=0 }"{literal};
202 rel_type: relType, case_id: caseID, key: {/literal}"{crmKey name='civicrm/ajax/delcaserole'}"{literal}},
204 // reloading datatable
205 var oTable = cj('#' + caseselector).dataTable();
211 title: ts('Delete case role'),
212 message: ts('Are you sure you want to delete this case role.')
218 function buildCaseRoles(filterSearch) {
224 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/caseroles' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
225 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
226 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
228 cj('#caseRoles-selector th').each( function( ) {
229 if ( cj(this).attr('id') != 'nosort' ) {
230 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
233 columns += '{ "bSortable": false },';
238 columns = columns.substring(0, columns.length - 1 );
239 eval('columns =[' + columns + ']');
241 oTable = cj('#caseRoles-selector').dataTable({
243 "bAutoWidth" : false,
245 "aoColumns" : columns,
248 "asStripClasses" : [ "odd-row", "even-row" ],
249 "sPaginationType": "full_numbers",
250 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
252 "sAjaxSource": sourceUrl,
253 "iDisplayLength": 10,
254 "fnDrawCallback": function() { setCaseRolesSelectorClass(); },
255 "fnServerData": function ( sSource, aoData, fnCallback ) {
261 "success": fnCallback
267 function setCaseRolesSelectorClass( ) {
268 cj("#caseRoles-selector td:last-child").each( function( ) {
269 cj(this).parent().addClass(cj(this).text() );
272 // also bind delete action once rows are rendered
273 deleteCaseRoles('caseRoles-selector');
276 function printCaseReport( ) {
277 var asn = 'standard_timeline';
278 var dataUrl = {/literal}"{crmURL p='civicrm/case/report/print' q='all=1&redact=0' h='0'}"{literal};
279 dataUrl = dataUrl + '&cid={/literal}{$contactID}{literal}'
280 + '&caseID={/literal}{$caseID}{literal}'
281 + '&asn={/literal}' + asn + '{literal}';
283 window.location = dataUrl;
287 </div><!-- /.crm-accordion-body -->
288 </div><!-- /.crm-accordion-wrapper -->
290 {ts}Begin typing last name of contact.{/ts}<br/>
291 <input type="text" id="rel_contact"/>
292 <input type="hidden" id="rel_contact_id" value="">
296 <script type="text/javascript">
297 var selectedContact = '';
298 var caseID = {/literal}"{$caseID}"{literal};
299 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=newcontact' h=0 }"{literal};
300 cj( "#change_client_id").autocomplete( contactUrl, { width : 250, selectFirst : false, matchContains:true
301 }).result( function(event, data, formatted) { cj( "#contact_id" ).val( data[1] ); selectedContact = data[0];
302 }).bind( 'click', function( ) { cj( "#contact_id" ).val(''); });
304 cj("#dialog").hide( );
306 function addClient( ) {
307 cj("#dialog").show( );
309 cj("#dialog").dialog({
310 title: "Add Client to the Case",
313 close : function(event, ui) { cj("#rel_contact").unautocomplete( ); },
314 overlay: { opacity: 0.5, background: "black" },
317 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
318 cj("#rel_contact").autocomplete( contactUrl, {
324 cj("#rel_contact").focus();
325 cj("#rel_contact").result(function(event, data, formatted) {
326 cj("input[id=rel_contact_id]").val(data[1]);
332 var postUrl = {/literal}"{crmURL p='civicrm/case/ajax/addclient' h=0 }"{literal};
333 var caseID = {/literal}"{$caseID}"{literal};
334 var contactID = cj("#rel_contact_id").val( );
336 if ( !cj("#rel_contact").val( ) || !contactID ) {
337 cj("#rel_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list{/ts}{literal}.');
340 cj.post( postUrl, {contactID: contactID,caseID: caseID,
341 key: {/literal}"{crmKey name='civicrm/case/ajax/addclient'}"{literal} },
343 //due to caching issues we use redirection rather than reload
344 document.location = {/literal}'{crmURL q="action=view&reset=1&id=$caseID&cid=$contactID&context=$context" h=0 }'{literal};
350 "Cancel": function() {
351 cj(this).dialog("close");
352 cj(this).dialog("destroy");
358 function createRelationship( relType, contactID, relID, rowNumber, relTypeName ) {
359 cj("#dialog").show( );
361 cj("#dialog").dialog({
362 title: "Assign Case Role",
365 close: function(event, ui) { cj("#rel_contact").unautocomplete( ); },
372 /* set defaults if editing */
373 cj("#rel_contact").val("");
374 cj("#rel_contact_id").val(null);
376 cj("#rel_contact_id").val(contactID);
377 var contactName = cj('#caseRoles-selector').find('tr :eq('+ rowNumber +')').children(':eq(1)').text();
378 cj("#rel_contact").val(contactName);
381 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
383 cj("#rel_contact").autocomplete( contactUrl, {
389 cj("#rel_contact").focus();
390 cj("#rel_contact").result(function(event, data, formatted) {
391 cj("input[id=rel_contact_id]").val(data[1]);
398 var sourceContact = {/literal}"{$contactID}"{literal};
399 var caseID = {/literal}"{$caseID}"{literal};
401 var v1 = cj("#rel_contact_id").val( );
403 if ( !cj("#rel_contact").val( ) || !v1 ) {
404 cj("#rel_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list{/ts}{literal}.');
408 var postUrl = {/literal}"{crmURL p='civicrm/ajax/relation' h=0 }"{literal};
409 cj.post( postUrl, { rel_contact: v1, rel_type: relType, contact_id: sourceContact,
410 rel_id: relID, case_id: caseID, key: {/literal}"{crmKey name='civicrm/ajax/relation'}"{literal} },
412 if ( data.status == 'process-relationship-success' ) {
413 // reloading datatable
414 var oTable = cj('#caseRoles-selector').dataTable();
418 var relTypeAdminLink = {/literal}"{crmURL p='civicrm/admin/reltype' q='reset=1' h=0 }"{literal};
419 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}.';
421 //display error message.
422 cj().crmError(errorMsg);
427 cj(this).dialog("close");
428 cj(this).dialog("destroy");
431 "Cancel": function() {
432 cj(this).dialog("close");
433 cj(this).dialog("destroy");
439 function viewRelatedCases( mainCaseID, contactID ) {
440 cj("#view-related-cases").show( );
441 cj("#view-related-cases").dialog({
442 title: "Related Cases",
453 beforeclose: function(event, ui) {
454 cj(this).dialog("destroy");
458 var dataUrl = {/literal}"{crmURL p='civicrm/contact/view/case' h=0 q="snippet=4" }"{literal};
459 dataUrl = dataUrl + '&id=' + mainCaseID + '&cid=' +contactID + '&relatedCases=true&action=view&context=case&selectedChild=case';
464 success : function(html){
465 cj("#related-cases-content" ).html( html );
472 cj(this).dialog("close");
473 cj(this).dialog("destroy");
480 cj("#view-activity").hide( );
485 {if $hasAccessToAllCases}
486 <div class="crm-accordion-wrapper collapsed crm-case-other-relationships-block">
487 <div class="crm-accordion-header">
488 {ts}Other Relationships{/ts}
489 </div><!-- /.crm-accordion-header -->
490 <div class="crm-accordion-body">
492 {if $clientRelationships}
493 <div class="crm-submit-buttons">
494 <a class="button" href="#" onClick="window.location='{crmURL p='civicrm/contact/view/rel' q="action=add&reset=1&cid=`$contactId`&caseID=`$caseID`"}'; return false;">
495 <span><div class="icon add-icon"></div>{ts}Add client relationship{/ts}</a></span>
497 <table id="clientRelationships-selector" class="report-layout">
499 <th>{ts}Client Relationship{/ts}</th>
500 <th>{ts}Name{/ts}</th>
501 <th>{ts}Phone{/ts}</th>
502 <th>{ts}Email{/ts}</th>
506 <div class="messages status no-popup">
507 <div class="icon inform-icon"></div>
508 {capture assign=crmURL}{crmURL p='civicrm/contact/view/rel' q="action=add&reset=1&cid=`$contactId`&caseID=`$caseID`"}{/capture}
509 {ts 1=$crmURL}There are no Relationships entered for this client. You can <a accesskey="N" href='%1'>add one</a>.{/ts}
513 <script type="text/javascript">
515 buildCaseClientRelationships(false);
518 function buildCaseClientRelationships(filterSearch) {
524 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/clientrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
525 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
526 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
528 cj('#clientRelationships-selector th').each( function( ) {
529 if ( cj(this).attr('id') != 'nosort' ) {
530 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
533 columns += '{ "bSortable": false },';
538 columns = columns.substring(0, columns.length - 1 );
539 eval('columns =[' + columns + ']');
541 oTable = cj('#clientRelationships-selector').dataTable({
543 "bAutoWidth" : false,
545 "aoColumns" : columns,
548 "asStripClasses" : [ "odd-row", "even-row" ],
549 "sPaginationType": "full_numbers",
550 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
552 "sAjaxSource": sourceUrl,
553 "iDisplayLength": 10,
554 "fnDrawCallback": function() { setClientRelationshipsSelectorClass(); },
555 "fnServerData": function (sSource, aoData, fnCallback) {
561 "success": fnCallback
567 function setClientRelationshipsSelectorClass( ) {
568 cj("#clientRelationships-selector td:last-child").each(function() {
569 cj(this).parent().addClass(cj(this).text());
576 {if $globalRelationships}
577 <div class="crm-submit-buttons">
578 <a class="button" href="#" onClick="window.location='{crmURL p='civicrm/group/search' q="reset=1&context=amtg&amtgID=`$globalGroupInfo.id`"}'; return false;">
579 <span><div class="icon add-icon"></div>{ts 1=$globalGroupInfo.title}Add members to %1{/ts}</a></span>
581 <table id="globalRelationships-selector" class="report-layout">
583 <th>{$globalGroupInfo.title}</th>
584 <th>{ts}Phone{/ts}</th>
585 <th>{ts}Email{/ts}</th>
588 {elseif $globalGroupInfo.id}
589 <div class="messages status no-popup">
590 <div class="icon inform-icon"></div>
591 {capture assign=crmURL}{crmURL p='civicrm/group/search' q="reset=1&context=amtg&amtgID=`$globalGroupInfo.id`"}{/capture}
592 {ts 1=$crmURL 2=$globalGroupInfo.title}The group %2 has no members. You can <a href='%1'>add one</a>.{/ts}
597 <script type="text/javascript">
600 buildCaseGlobalRelationships(false);
603 function buildCaseGlobalRelationships(filterSearch) {
609 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
610 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
611 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
613 cj('#globalRelationships-selector th').each( function( ) {
614 if (cj(this).attr('id') != 'nosort') {
615 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
618 columns += '{ "bSortable": false },';
623 columns = columns.substring(0, columns.length - 1 );
624 eval('columns =[' + columns + ']');
626 oTable = cj('#globalRelationships-selector').dataTable({
628 "bAutoWidth" : false,
630 "aoColumns" : columns,
633 "asStripClasses" : [ "odd-row", "even-row" ],
634 "sPaginationType": "full_numbers",
635 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
637 "sAjaxSource": sourceUrl,
638 "iDisplayLength": 10,
639 "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
640 "fnServerData": function ( sSource, aoData, fnCallback ) {
646 "success": fnCallback
652 function setGlobalRelationshipsSelectorClass( ) {
653 cj("#globalRelationships-selector td:last-child").each( function( ) {
654 cj(this).parent().addClass(cj(this).text() );
659 </div><!-- /.crm-accordion-body -->
660 </div><!-- /.crm-accordion-wrapper -->
662 {/if} {* other relationship section ends *}
664 <div id="addRoleDialog">
665 {$form.role_type.label}<br />
666 {$form.role_type.html}
668 {ts}Begin typing last name of contact.{/ts}<br/>
669 <input type="text" id="role_contact"/>
670 <input type="hidden" id="role_contact_id" value="">
674 <script type="text/javascript">
676 cj("#addRoleDialog").hide( );
678 cj("#addRoleDialog").show( );
680 cj("#addRoleDialog").dialog({
684 close: function(event, ui) { cj("#role_contact").unautocomplete( ); },
691 /* set defaults if editing */
692 cj("#role_contact").val( "" );
693 cj("#role_contact_id").val( null );
695 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=caseview' h=0 }"{literal};
697 cj("#role_contact").autocomplete( contactUrl, {
703 cj("#role_contact").focus();
704 cj("#role_contact").result(function(event, data, formatted) {
705 cj("input[id=role_contact_id]").val(data[1]);
711 var sourceContact = {/literal}"{$contactID}"{literal};
712 var caseID = {/literal}"{$caseID}"{literal};
715 var v2 = cj("#role_type").val();
717 cj("#role_type").crmError('{/literal}{ts escape="js"}Select valid type from the list{/ts}{literal}.');
721 var v1 = cj("#role_contact_id").val( );
722 if (!cj("#role_contact").val( ) || !v1) {
723 cj("#role_contact").crmError('{/literal}{ts escape="js"}Select valid contact from the list{/ts}{literal}.');
727 /* send synchronous request so that disabling any actions for slow servers*/
728 var postUrl = {/literal}"{crmURL p='civicrm/ajax/relation' h=0 }"{literal};
729 var data = 'rel_contact='+ v1 + '&rel_type='+ v2 + '&contact_id='+sourceContact + '&rel_id='+ relID
730 + '&case_id=' + caseID + "&key={/literal}{crmKey name='civicrm/ajax/relation'}{literal}";
737 success : function(values) {
738 if (values.status == 'process-relationship-success') {
739 // reloading datatable
740 var oTable = cj('#caseRoles-selector').dataTable();
744 var relTypeName = cj("#role_type :selected").text();
745 var relTypeAdminLink = {/literal}"{crmURL p='civicrm/admin/reltype' q='reset=1' h=0 }"{literal};
746 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}.';
748 //display error message.
749 cj().crmError(errorMsg);
754 cj(this).dialog("close");
755 cj(this).dialog("destroy");
758 "Cancel": function() {
759 cj(this).dialog("close");
760 cj(this).dialog("destroy");
768 {include file="CRM/Case/Form/ActivityToCase.tpl"}
770 {* pane to display / edit regular tags or tagsets for cases *}
771 {if $showTags OR $showTagsets}
773 <div id="casetags" class="crm-accordion-wrapper crm-case-tags-block">
774 <div class="crm-accordion-header">
776 </div><!-- /.crm-accordion-header -->
777 <div class="crm-accordion-body">
778 {assign var="tagExits" value=0}
780 <div class="crm-block crm-content-block crm-case-caseview-display-tags">{$tags}</div>
781 {assign var="tagExits" value=1}
784 {foreach from=$tagsetInfo_case item=displayTagset}
785 {if $displayTagset.entityTagsArray}
786 <div class="crm-block crm-content-block crm-case-caseview-display-tagset">
787 {$displayTagset.parentName}:
788 {foreach from=$displayTagset.entityTagsArray item=val name="tagsetList"}
789 {$val.name}{if !$smarty.foreach.tagsetList.last},{/if}
792 {assign var="tagExits" value=1}
798 {ts}There are no tags currently assigned to this case.{/ts}
802 <div class="crm-submit-buttons"><input type="button" class="form-submit" onClick="javascript:addTags()" value={if $tagExits}"{ts}Edit Tags{/ts}"{else}"{ts}Add Tags{/ts}"{/if} /></div>
804 </div><!-- /.crm-accordion-body -->
805 </div><!-- /.crm-accordion-wrapper -->
807 <div id="manageTags">
808 <div class="label">{$form.case_tag.label}</div>
809 <div class="view-value"><div class="crm-select-container">{$form.case_tag.html}</div>
811 <div style="text-align:left;">{include file="CRM/common/Tag.tpl" tagsetType='case'}</div>
813 <div class="clear"></div>
818 <script type="text/javascript">
819 cj("#manageTags select[multiple]").crmasmSelect({
820 addItemTarget: 'bottom',
827 cj("#manageTags").hide( );
829 cj("#manageTags").show( );
831 cj("#manageTags").dialog({
832 title: "{/literal}{ts escape='js'}Change Case Tags{/ts}{literal}",
838 var tagsChecked = '';
839 var caseID = {/literal}{$caseID}{literal};
841 cj("#manageTags #tags option").each( function() {
842 if (cj(this).prop('selected')) {
844 tagsChecked = cj(this).val() + '';
847 tagsChecked = tagsChecked + ',' + cj(this).val();
853 cj("#manageTags input[name^=case_taglist]").each(function( ) {
855 tagsChecked = cj(this).val() + '';
858 tagsChecked = tagsChecked + ',' + cj(this).val();
862 var postUrl = {/literal}"{crmURL p='civicrm/case/ajax/processtags' h=0 }"{literal};
863 var data = 'case_id=' + caseID + '&tag=' + tagsChecked + '&key=' + {/literal}"{crmKey name='civicrm/case/ajax/processtags'}"{literal};
865 cj.ajax({ type: "POST", url: postUrl, data: data, async: false });
866 cj(this).dialog("close");
867 cj(this).dialog("destroy");
869 // Temporary workaround for problems with SSL connections being too
870 // slow. The relationship doesn't get created because the page reload
871 // happens before the ajax call.
872 // In general this reload needs improvement, which is already on the list for phase 2.
873 var sdate = (new Date()).getTime();
875 while(curDate-sdate < 2000) {
876 curDate = (new Date()).getTime();
879 //due to caching issues we use redirection rather than reload
880 document.location = {/literal}'{crmURL q="action=view&reset=1&id=$caseID&cid=$contactID&context=$context" h=0 }'{literal};
883 "Cancel": function() {
884 cj(this).dialog("close");
885 cj(this).dialog("destroy");
894 {/if} {* end of tag block*}
896 {*include activity view js file*}
897 {include file="CRM/common/activityView.tpl"}
899 <div class="crm-accordion-wrapper crm-case_activities-accordion crm-case-activities-block">
900 <div class="crm-accordion-header">
901 {ts}Case Activities{/ts}
903 <div id="activities" class="crm-accordion-body">
904 <div id="view-activity">
905 <div id="activity-content"></div>
907 <div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
908 <div class="crm-accordion-header">
909 {ts}Search Filters{/ts}</a>
910 </div><!-- /.crm-accordion-header -->
911 <div class="crm-accordion-body">
912 <table class="no-border form-layout-compressed" id="searchOptions">
914 <td class="crm-case-caseview-form-block-repoter_id"colspan="2"><label for="reporter_id">{ts}Reporter/Role{/ts}</label><br />
915 {$form.reporter_id.html|crmAddClass:twenty}
917 <td class="crm-case-caseview-form-block-status_id"><label for="status_id">{$form.status_id.label}</label><br />
918 {$form.status_id.html}
920 <td style="vertical-align: bottom;">
921 <span class="crm-button"><input class="form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true )"; /></span>
925 <td class="crm-case-caseview-form-block-activity_date_low">
926 {$form.activity_date_low.label}<br />
927 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_low}
929 <td class="crm-case-caseview-form-block-activity_date_high">
930 {$form.activity_date_high.label}<br />
931 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_high}
933 <td class="crm-case-caseview-form-block-activity_type_filter_id">
934 {$form.activity_type_filter_id.label}<br />
935 {$form.activity_type_filter_id.html}
938 {if $form.activity_deleted}
939 <tr class="crm-case-caseview-form-block-activity_deleted">
941 {$form.activity_deleted.html}{$form.activity_deleted.label}
946 </div><!-- /.crm-accordion-body -->
947 </div><!-- /.crm-accordion-wrapper -->
949 <table id="activities-selector" class="nestedActivitySelector">
951 <th class='crm-case-activities-date'>{ts}Date{/ts}</th>
952 <th class='crm-case-activities-subject'>{ts}Subject{/ts}</th>
953 <th class='crm-case-activities-type'>{ts}Type{/ts}</th>
954 <th class='crm-case-activities-with'>{ts}With{/ts}</th>
955 <th class='crm-case-activities-assignee'>{ts}Reporter / Assignee{/ts}</th>
956 <th class='crm-case-activities-status'>{ts}Status{/ts}</th>
957 <th class='crm-case-activities-status' id="nosort"> </th>
958 <th class='hiddenElement'> </th>
962 </div><!-- /.crm-accordion-body -->
963 </div><!-- /.crm-accordion-wrapper -->
966 <script type="text/javascript">
969 function checkSelection( field ) {
970 var validationMessage = '';
971 var validationField = '';
972 var successAction = '';
973 var forceValidation = false;
975 var clientName = new Array( );
976 clientName = selectedContact.split('::');
977 var fName = field.name;
980 case '_qf_CaseView_next' :
981 validationMessage = '{/literal}{ts escape="js"}Please select an activity set from the list.{/ts}{literal}';
982 validationField = 'timeline_id';
983 successAction = "confirm('{/literal}{ts escape='js'}Are you sure you want to add a set of scheduled activities to this case?{/ts}{literal}');";
986 case 'new_activity' :
987 validationMessage = '{/literal}{ts escape="js"}Please select an activity type from the list.{/ts}{literal}';
988 validationField = 'activity_type_id';
989 if ( document.getElementById('activity_type_id').value == 3 ) {
990 successAction = "window.location='{/literal}{$newActivityEmailUrl}{literal}' + document.getElementById('activity_type_id').value";
993 successAction = "window.location='{/literal}{$newActivityUrl}{literal}' + document.getElementById('activity_type_id').value";
998 validationMessage = '{/literal}{ts escape="js"}Please select a report from the list.{/ts}{literal}';
999 validationField = 'report_id';
1000 successAction = "window.location='{/literal}{$reportUrl}{literal}' + document.getElementById('report_id').value";
1003 case '_qf_CaseView_next_merge_case' :
1004 validationMessage = '{/literal}{ts escape="js"}Please select a case from the list to merge with.{/ts}{literal}';
1005 validationField = 'merge_case_id';
1008 case '_qf_CaseView_next_edit_client' :
1009 validationMessage = '{/literal}{ts escape="js"}Please select a client for this case.{/ts}{literal}';
1010 if ( cj('#contact_id').val( ) == '{/literal}{$contactID}{literal}' ) {
1011 forceValidation = true;
1012 validationMessage = '{/literal}{ts 1="'+clientName[0]+'"}%1 is already assigned to this case. Please select some other client for this case.{/ts}{literal}';
1014 validationField = 'change_client_id';
1015 successAction = "confirm( '{/literal}{ts 1="'+clientName[0]+'"}Are you sure you want to reassign this case and all related activities and relationships to %1?{/ts}{literal}' )";
1019 if ( forceValidation || ( document.getElementById( validationField ).value == '' ) ) {
1020 cj('#'+validationField).crmError(validationMessage);
1023 else if ( successAction ) {
1024 return eval( successAction );
1029 buildCaseActivities(false);
1032 function buildCaseActivities(filterSearch) {
1038 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
1039 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
1040 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
1042 cj('#activities-selector th').each(function( ) {
1043 if (cj(this).attr('id') != 'nosort') {
1044 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
1047 columns += '{ "bSortable": false },';
1052 columns = columns.substring(0, columns.length - 1 );
1053 eval('columns =[' + columns + ']');
1055 oTable = cj('#activities-selector').dataTable({
1057 "bAutoWidth" : false,
1059 "aoColumns" : columns,
1060 "bProcessing": true,
1062 "asStripClasses" : [ "odd-row", "even-row" ],
1063 "sPaginationType": "full_numbers",
1064 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
1065 "bServerSide": true,
1066 "sAjaxSource": sourceUrl,
1067 "iDisplayLength": 10,
1068 "fnDrawCallback": function() { setSelectorClass(); },
1069 "fnServerData": function ( sSource, aoData, fnCallback ) {
1071 if ( filterSearch ) {
1072 var activity_deleted = 0;
1073 if ( cj("#activity_deleted:checked").val() == 1 ) {
1074 activity_deleted = 1;
1077 {name:'status_id', value: cj("select#status_id").val()},
1078 {name:'activity_type_id', value: cj("select#activity_type_filter_id").val()},
1079 {name:'activity_date_low', value: cj("#activity_date_low").val()},
1080 {name:'activity_date_high', value: cj("#activity_date_high").val() },
1081 {name:'activity_deleted', value: activity_deleted }
1089 "success": fnCallback
1095 function setSelectorClass( ) {
1096 cj("#activities-selector td:last-child").each( function( ) {
1097 cj(this).parent().addClass(cj(this).text() );
1101 function printCaseReport( ) {
1102 var asn = 'standard_timeline';
1103 var dataUrl = {/literal}"{crmURL p='civicrm/case/report/print' q='all=1&redact=0' h='0'}"{literal};
1104 dataUrl = dataUrl + '&cid={/literal}{$contactID}{literal}'
1105 + '&caseID={/literal}{$caseID}{literal}'
1106 + '&asn={/literal}' + asn + '{literal}';
1108 window.location = dataUrl;
1114 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
1117 <script type="text/javascript">
1119 cj().crmAccordions();
1124 {/if} {* view related cases if end *}