Merge pull request #1105 from colemanw/prevNext
[civicrm-core.git] / templates / CRM / Case / Form / EditClient.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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{* template for assigning the current case to another client*}
27<div class="crm-block crm-form-block crm-case-editclient-form-block">
28<div class="messages status no-popup">
29 <div class="icon inform-icon"></div> {ts 1=$currentClientName}This is case is currently assigned to %1.{/ts}
30</div>
31<div class="crm-form-block">
32<table class="form-layout-compressed">
33 <tr class="crm-case-editclient-form-block-change_client_id">
34 <td class="label">
35 {$form.change_client_id.label}
36 </td>
37 <td id='client'>
38 {$form.change_client_id.html|crmAddClass:big}
39 </td>
40 </tr>
41 <tr>
42 <td></td>
43 <td><span class="crm-button crm-button-type-submit">&nbsp;{$form._qf_EditClient_next_edit_client.html}</span>
44 <span class="crm-button crm-button-type-submit">&nbsp;{$form._qf_EditClient_cancel_edit_client.html}</span>
45 </td>
46 </tr>
47</table>
48</div>
49</div>
50{literal}
51<script type="text/javascript">
52var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=newcontact' h=0 }"{literal};
53var selectedContact = '';
54
55cj( "#change_client_id").autocomplete( contactUrl, { width : 250, selectFirst : false, matchContains:true
56 }).result( function(event, data, formatted) { cj( "#contact_id" ).val( data[1] ); selectedContact = data[0];
57 }).bind( 'click', function( ) { cj( "#contact_id" ).val(''); });
58
59function checkSelection( field ) {
60 var validationMessage = '';
61 var selectedContactName = cj('#change_client_id').val( );
62 var clientName = new Array( );
63 clientName = selectedContact.split('::');
64
65 if ( selectedContactName == '' ) {
66 validationMessage = '{/literal}{ts escape="js"}Please select another client for this case.{/ts}{literal}';
67 cj().crmError(validationMessage, '{/literal}{ts escape="js"}Client Selection{/ts}{literal}');
68 return false;
69 } else if ( cj('#contact_id').val( ) == {/literal}{$contactId}{literal} ) {
70 validationMessage = '{/literal}{ts escape="js" 1="'+clientName[0]+'"}%1 is already assigned to this case. Please select some other client for this case.{/ts}{literal}';
71 cj().crmError(validationMessage, '{/literal}{ts escape="js"}Client Selection{/ts}{literal}');
72 return false;
73 } else {
74 validationMessage = '{/literal}{ts escape="js" 1="'+clientName[0]+'"}Are you sure you want to reassign this case and all related activities and relationships to %1?{/ts}{literal}';
75 if ( confirm( validationMessage ) ) {
76 this.href+='&amp;confirmed=1';
77 } else {
78 return false;
79 }
80 }
81
82}
83</script>
84{/literal}