Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-08-21-20-13-45
[civicrm-core.git] / templates / CRM / Contact / Form / Edit / Individual.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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 {* tpl for building Individual related fields *}
27 <script type="text/javascript">
28 {literal}
29 cj(function($) {
30 {/literal}
31 var cid=parseFloat("{$contactId}");//parseInt is octal by default
32 var contactIndividual = "{crmURL p='civicrm/ajax/rest' q='entity=contact&action=get&json=1&contact_type=Individual&return=display_name,sort_name,email&rowCount=50' h=0}";
33 var viewIndividual = "{crmURL p='civicrm/contact/view' q='reset=1&cid=' h=0}";
34 var editIndividual = "{crmURL p='civicrm/contact/add' q='reset=1&action=update&cid=' h=0}";
35 var checkSimilar = {$checkSimilar};
36 var lastnameMsg;
37 {literal}
38 $(document).ready(function() {
39 if (cj('#contact_sub_type *').length == 0) {//if they aren't any subtype we don't offer the option
40 cj('#contact_sub_type').parent().hide();
41 }
42 if (!isNaN(cid) || ! checkSimilar) {
43 return;//no dupe check if this is a modif or if checkSimilar is disabled (contact_ajax_check_similar in civicrm_setting table)
44 }
45 cj('#last_name').blur(function () {
46 // Close msg if it exists
47 lastnameMsg && lastnameMsg.close && lastnameMsg.close();
48 if (this.value == '') return;
49 cj.getJSON(contactIndividual,{sort_name:cj('#last_name').val()},
50 function(data){
51 if (data.is_error == 1 || data.count == 0) {
52 return;
53 }
54 var msg = "<em>{/literal}{ts escape='js'}If the person you were trying to add is listed below, click their name to view or edit their record{/ts}{literal}:</em>";
55 if ( data.count == 1 ) {
56 var title = "{/literal}{ts escape='js'}Similar Contact Found{/ts}{literal}";
57 } else {
58 var title = "{/literal}{ts escape='js'}Similar Contacts Found{/ts}{literal}";
59 }
60 msg += '<ul class="matching-contacts-actions">';
61 cj.each(data.values, function(i,contact){
62 if ( !(contact.email) ) {
63 contact.email = '';
64 }
65 msg += '<li><a href="'+viewIndividual+contact.id+'">'+ contact.display_name +'</a> '+contact.email+'</li>';
66 });
67 msg += '</ul>';
68 lastnameMsg = CRM.alert(msg, title);
69 cj('.matching-contacts-actions a').click(function(){
70 // No confirmation dialog on click
71 global_formNavigate = true;
72 return true;
73 });
74 });
75 });
76 });
77 });
78 </script>
79 {/literal}
80
81 <table class="form-layout-compressed">
82 <tr>
83 {if $form.prefix_id}
84 <td>
85 {$form.prefix_id.label}<br/>
86 {$form.prefix_id.html}
87 </td>
88 {/if}
89 <td>
90 {$form.first_name.label}<br />
91 {$form.first_name.html}
92 </td>
93 <td>
94 {$form.middle_name.label}<br />
95 {$form.middle_name.html}
96 </td>
97 <td>
98 {$form.last_name.label}<br />
99 {$form.last_name.html}
100 </td>
101 {if $form.suffix_id}
102 <td>
103 {$form.suffix_id.label}<br/>
104 {$form.suffix_id.html}
105 </td>
106 {/if}
107 </tr>
108
109 <tr>
110 <td colspan="2">
111 {$form.current_employer.label}&nbsp;{help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}<br />
112 {$form.current_employer.html|crmAddClass:twenty}
113 <div id="employer_address" style="display:none;"></div>
114 </td>
115 <td>
116 {$form.job_title.label}<br />
117 {$form.job_title.html}
118 </td>
119 <td>
120 {$form.nick_name.label}<br />
121 {$form.nick_name.html}
122 </td>
123 <td>
124 {if $buildContactSubType}
125 {$form.contact_sub_type.label}<br />
126 {$form.contact_sub_type.html}
127 {/if}
128 </td>
129 </tr>
130 </table>
131
132 {include file="CRM/Contact/Form/CurrentEmployer.tpl"}