Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work is published under the GNU AGPLv3 license with some | |
6 | | permitted exceptions and without any warranty. For full license | | |
7 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | {* This file provides the plugin for the Address block *} | |
11 | {* @var $form Contains the array for the form elements and other form associated information assigned to the template by the controller*} | |
12 | {* @var $blockId Contains the current address block id, and assigned in the CRM/Contact/Form/Location.php file *} | |
13 | ||
14 | {if $title and $className eq 'CRM_Contact_Form_Contact'} | |
247506c6 | 15 | <div id="addressBlockId" class="crm-accordion-wrapper crm-address-accordion collapsed"> |
6a488035 TO |
16 | <div class="crm-accordion-header"> |
17 | {$title} | |
18 | </div><!-- /.crm-accordion-header --> | |
19 | <div class="crm-accordion-body" id="addressBlock"> | |
20 | {/if} | |
21 | ||
22 | <div id="Address_Block_{$blockId}" {if $className eq 'CRM_Contact_Form_Contact'} class="boxBlock crm-edit-address-block crm-address_{$blockId}"{/if}> | |
c29131ec | 23 | {if $blockId gt 1}<fieldset><legend>{ts}Supplemental Address{/ts}</legend>{/if} |
6a488035 TO |
24 | <table class="form-layout-compressed crm-edit-address-form"> |
25 | {if $masterAddress.$blockId gt 0 } | |
34d6cec4 | 26 | <tr><td><div class="message status">{icon icon="fa-info-circle"}{/icon} {ts 1=$masterAddress.$blockId}This address is shared with %1 contact record(s). Modifying this address will automatically update the shared address for these contacts.{/ts}</div></td></tr> |
6a488035 TO |
27 | {/if} |
28 | ||
29 | {if $className eq 'CRM_Contact_Form_Contact'} | |
30 | <tr> | |
31 | <td id='Address-Primary-html' colspan="2"> | |
32 | <span class="crm-address-element location_type_id-address-element">{$form.address.$blockId.location_type_id.label} | |
33 | {$form.address.$blockId.location_type_id.html}</span> | |
34 | <span class="crm-address-element is_primary-address-element">{$form.address.$blockId.is_primary.html}</span> | |
35 | <span class="crm-address-element is_billing-address-element">{$form.address.$blockId.is_billing.html}</span> | |
36 | </td> | |
37 | {if $blockId gt 0} | |
38 | <td> | |
39 | <a href="#" title="{ts}Delete Address Block{/ts}" onClick="removeBlock( 'Address', '{$blockId}' ); return false;">{ts}Delete this address{/ts}</a> | |
40 | </td> | |
41 | {/if} | |
42 | </tr> | |
43 | ||
44 | {* include shared address template *} | |
45 | {include file="CRM/Contact/Form/ShareAddress.tpl"} | |
46 | ||
47 | {/if} | |
48 | <tr> | |
49 | <td> | |
fe01f47a | 50 | <table id="address_table_{$blockId}" class="form-layout-compressed"> |
6a488035 TO |
51 | {* build address block w/ address sequence. *} |
52 | {foreach item=addressElement from=$addressSequence} | |
53 | {include file=CRM/Contact/Form/Edit/Address/$addressElement.tpl} | |
54 | {/foreach} | |
55 | {include file=CRM/Contact/Form/Edit/Address/geo_code.tpl} | |
56 | </table> | |
57 | </td> | |
58 | <td colspan="2"> | |
59 | <div class="crm-edit-address-custom_data crm-address-custom-set-block-{$blockId}"> | |
60 | {include file="CRM/Contact/Form/Edit/Address/CustomData.tpl"} | |
61 | </div> | |
62 | </td> | |
63 | </tr> | |
64 | </table> | |
65 | ||
66 | {if $className eq 'CRM_Contact_Form_Contact'} | |
67 | <div id="addMoreAddress{$blockId}" class="crm-add-address-wrapper"> | |
13a3d214 | 68 | <a href="#" class="button" onclick="buildAdditionalBlocks( 'Address', '{$className}' );return false;"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts}Another Address{/ts}</span></a> |
6a488035 TO |
69 | </div> |
70 | {/if} | |
71 | ||
72 | {if $title and $className eq 'CRM_Contact_Form_Contact'} | |
73 | </div> | |
74 | </div><!-- /.crm-accordion-body --> | |
75 | </div><!-- /.crm-accordion-wrapper --> | |
76 | {/if} | |
77 | {literal} | |
78 | <script type="text/javascript"> | |
79 | //to check if same location type is already selected. | |
80 | function checkLocation( object, noAlert ) { | |
81 | var ele = cj('#' + object); | |
82 | var selectedText = cj(':selected', ele).text(); | |
83 | cj('td#Address-Primary-html select').each( function() { | |
84 | element = cj(this).attr('id'); | |
85 | if ( cj(this).val() && element != object && selectedText == cj(':selected', this).text() ) { | |
86 | if ( !noAlert ) { | |
87 | var alertText = selectedText + {/literal}" {ts escape='js'}has already been assigned to another address. Please select another location for this address.{/ts}"{literal}; | |
88 | ele.crmError(alertText); | |
89 | } | |
90 | cj( '#' + object ).val(''); | |
91 | } | |
92 | }); | |
93 | } | |
94 | </script> | |
95 | {/literal} |