2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2018 |
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 {* This form is for Contact Add/Edit interface *}
28 {include file="CRM/Contact/Form/Edit/$blockName.tpl"}
31 {include file="CRM/Contact/Form/Edit/Lock.tpl"}
33 <div class="crm-form-block crm-search-form-block">
34 {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
35 <a href='{crmURL p="civicrm/admin/setting/preferences/display" q="reset=1"}' title="{ts}Click here to configure the panes.{/ts}"><i class="crm-i fa-wrench"></i></a>
37 <span style="float:right;"><a href="#expand" id="expand">{ts}Expand all tabs{/ts}</a></span>
38 <div class="crm-submit-buttons">
39 {include file="CRM/common/formButtons.tpl" location="top"}
42 <div class="crm-accordion-wrapper crm-contactDetails-accordion">
43 <div class="crm-accordion-header">
44 {ts}Contact Details{/ts}
45 </div><!-- /.crm-accordion-header -->
46 <div class="crm-accordion-body" id="contactDetails">
47 <div id="contactDetails">
48 <div class="crm-section contact_basic_information-section">
49 {include file="CRM/Contact/Form/Edit/$contactType.tpl"}
51 <table class="crm-section contact_information-section form-layout-compressed">
52 {foreach from=$blocks item="label" key="block"}
53 {include file="CRM/Contact/Form/Edit/$block.tpl"}
56 <table class="crm-section contact_source-section form-layout-compressed">
58 <td>{$form.contact_source.label} {help id="id-source"}<br />
59 {$form.contact_source.html|crmAddClass:twenty}
61 <td>{$form.external_identifier.label} {help id="id-external-id"}<br />
62 {$form.external_identifier.html}
66 <label for="internal_identifier_display">{ts}Contact ID{/ts} {help id="id-internal-id"}</label><br />
67 <input id="internal_identifier_display" type="text" class="crm-form-text six" size="6" readonly="readonly" value="{$contactId}">
72 <table class="image_URL-section form-layout-compressed">
75 {$form.image_URL.label} {help id="id-upload-image" file="CRM/Contact/Form/Contact.hlp"}<br />
76 {$form.image_URL.html|crmAddClass:twenty}
77 {if !empty($imageURL)}
78 {include file="CRM/Contact/Page/ContactImage.tpl"}
85 <span class="crm-button crm-button_qf_Contact_refresh_dedupe">
86 {$form._qf_Contact_refresh_dedupe.html}
90 <span class="crm-button crm-button_qf_Contact_upload_duplicate">
91 {$form._qf_Contact_upload_duplicate.html}
94 <div class="spacer"></div>
96 </div><!-- /.crm-accordion-body -->
97 </div><!-- /.crm-accordion-wrapper -->
99 {foreach from = $editOptions item = "title" key="name"}
100 {if $name eq 'CustomData' }
101 <div id='customData'>{include file="CRM/Contact/Form/Edit/CustomData.tpl"}</div>
103 {include file="CRM/Contact/Form/Edit/$name.tpl"}
106 <div class="crm-submit-buttons">
107 {include file="CRM/common/formButtons.tpl" location="bottom"}
112 <script type="text/javascript" >
114 var $form = $("form.{/literal}{$form.formClass}{literal}");
115 var action = "{/literal}{$action}{literal}";
117 $('.crm-accordion-body').each( function() {
118 //remove tab which doesn't have any element
119 if ( ! $.trim( $(this).text() ) ) {
121 prevEle = $(this).prev();
125 //open tab if form rule throws error
126 if ( $(this).children().find('span.crm-error').text().length > 0 ) {
127 $(this).parents('.collapsed').crmAccordionToggle();
131 $('.crm-accordion-wrapper').not('.crm-accordion-wrapper .crm-accordion-wrapper').each(function() {
134 $('#crm-container').on('change click', '.crm-accordion-body :input, .crm-accordion-body a', function() {
135 highlightTabs($(this).parents('.crm-accordion-wrapper'));
138 function highlightTabs(tab) {
139 //highlight the tab having data inside.
140 $('.crm-accordion-body :input', tab).each( function() {
142 switch($(this).prop('type')) {
145 if($(this).is(':checked') && !$(this).is('[id$=IsPrimary],[id$=IsBilling]')) {
146 $('.crm-accordion-header:first', tab).addClass('active');
154 $('.crm-accordion-header:first', tab).addClass('active');
160 case 'select-multiple':
161 if($(this).val() && $('option[value=""]', this).length > 0) {
162 $('.crm-accordion-header:first', tab).addClass('active');
168 if($(this).next().html()) {
169 $('.crm-accordion-header:first', tab).addClass('active');
174 $('.crm-accordion-header:first', tab).removeClass('active');
178 $('a#expand').click( function() {
179 if( $(this).attr('href') == '#expand') {
180 var message = {/literal}"{ts escape='js'}Collapse all tabs{/ts}"{literal};
181 $(this).attr('href', '#collapse');
182 $('.crm-accordion-wrapper.collapsed').crmAccordionToggle();
185 var message = {/literal}"{ts escape='js'}Expand all tabs{/ts}"{literal};
186 $('.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
187 $(this).attr('href', '#expand');
189 $(this).html(message);
193 $('.customDataPresent').change(function() {
194 var values = $("#contact_sub_type").val();
195 CRM.buildCustomData({/literal}"{$contactType}"{literal}, values).one('crmLoad', function() {
197 loadMultiRecordFields(values);
201 function loadMultiRecordFields(subTypeValues) {
202 if (subTypeValues === false) {
203 subTypeValues = null;
205 else if (!subTypeValues) {
206 subTypeValues = {/literal}"{$paramSubType}"{literal};
208 function loadNextRecord(i, groupValue, groupCount) {
209 if (i < groupCount) {
210 CRM.buildCustomData({/literal}"{$contactType}"{literal}, subTypeValues, null, i, groupValue, true).one('crmLoad', function() {
212 loadNextRecord(i+1, groupValue, groupCount);
217 {foreach from=$customValueCount item="groupCount" key="groupValue"}
218 {if $groupValue}{literal}
219 loadNextRecord(1, {/literal}{$groupValue}{literal}, {/literal}{$groupCount}{literal});
226 loadMultiRecordFields();
228 {/literal}{if $oldSubtypes}{literal}
229 $('input[name=_qf_Contact_upload_view], input[name=_qf_Contact_upload_new]').click(function() {
230 var submittedSubtypes = $('#contact_sub_type').val();
231 var oldSubtypes = {/literal}{$oldSubtypes}{literal};
234 $.each(oldSubtypes, function(index, subtype) {
235 if ( $.inArray(subtype, submittedSubtypes) < 0 ) {
240 return confirm({/literal}'{ts escape="js"}One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed as long as the contact does not have a contact subtype still selected. Click OK to proceed, or Cancel to review your changes before saving.{/ts}'{literal});
244 {/literal}{/if}{literal}
246 // Handle delete of multi-record custom data
247 $form.on('click', '.crm-custom-value-del', function(e) {
250 msg = '{/literal}{ts escape="js"}The record will be deleted immediately. This action cannot be undone.{/ts}{literal}';
251 CRM.confirm({title: $el.attr('title'), message: msg})
252 .on('crmConfirm:yes', function() {
253 var url = CRM.url('civicrm/ajax/customvalue');
254 var request = $.post(url, $el.data('post'));
255 CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request);
256 var addClass = '.add-more-link-' + $el.data('post').groupID;
257 $el.closest('div.crm-custom-accordion').remove();
258 $('div' + addClass).last().show();
266 {* jQuery validate *}
267 {include file="CRM/Form/validate.tpl"}
269 {* include common additional blocks tpl *}
270 {include file="CRM/common/additionalBlocks.tpl"}