Merge pull request #23274 from civicrm/5.49
[civicrm-core.git] / templates / CRM / Contact / Import / Form / DataSource.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
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 |
8 +--------------------------------------------------------------------+
9 *}
10
11 <div class="crm-block crm-form-block crm-import-datasource-form-block">
12 {* Import Wizard - Step 1 (choose data source) *}
13 {* WizardHeader.tpl provides visual display of steps thru the wizard as well as title for current step *}
14 {include file="CRM/common/WizardHeader.tpl"}
15 <div class="help">
16 {ts}The Import Wizard allows you to easily import contact records from other applications into CiviCRM. For example, if your organization has contacts in MS Access&reg; or Excel&reg;, and you want to start using CiviCRM to store these contacts, you can 'import' them here.{/ts} {help id='choose-data-source-intro'}
17 </div>
18 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
19 <div id="choose-data-source" class="form-item">
20 <h3>{ts}Choose Data Source{/ts}</h3>
21 <table class="form-layout">
22 <tr class="crm-import-datasource-form-block-dataSource">
23 <td class="label">{$form.dataSource.label}</td>
24 <td>{$form.dataSource.html} {help id='data-source-selection'}</td>
25 </tr>
26 </table>
27 </div>
28
29 {* Data source form pane is injected here when the data source is selected. *}
30 <div id="data-source-form-block">
31 </div>
32
33 <div id="common-form-controls" class="form-item">
34 <h3>{ts}Import Options{/ts}</h3>
35 <table class="form-layout-compressed">
36 <tr class="crm-import-datasource-form-block-contactType">
37 <td class="label">{$form.contactType.label}</td>
38 <td>{$form.contactType.html} {help id='contact-type'}&nbsp;&nbsp;&nbsp;
39 <span id="contact-subtype">{$form.subType.label}&nbsp;&nbsp;&nbsp;{$form.subType.html} {help id='contact-sub-type'}</span></td>
40 </tr>
41 <tr class="crm-import-datasource-form-block-onDuplicate">
42 <td class="label">{$form.onDuplicate.label}</td>
43 <td>{$form.onDuplicate.html} {help id='dupes'}</td>
44 </tr>
45 <tr class="crm-import-datasource-form-block-dedupe">
46 <td class="label">{$form.dedupe.label}</td>
47 <td><span id="contact-dedupe">{$form.dedupe.html}</span> {help id='id-dedupe_rule'}</td>
48 </tr>
49 <tr class="crm-import-datasource-form-block-fieldSeparator">
50 <td class="label">{$form.fieldSeparator.label}</td>
51 <td>{$form.fieldSeparator.html} {help id='id-fieldSeparator'}</td>
52 </tr>
53 <tr>{include file="CRM/Core/Date.tpl"}</tr>
54 <tr>
55 <td></td><td class="description">{ts}Select the format that is used for date fields in your import data.{/ts}</td>
56 </tr>
57
58 {if $geoCode}
59 <tr class="crm-import-datasource-form-block-doGeocodeAddress">
60 <td class="label"></td>
61 <td>{$form.doGeocodeAddress.html} {$form.doGeocodeAddress.label}<br />
62 <span class="description">
63 {ts}This option is not recommended for large imports. Use the command-line geocoding script instead.{/ts}
64 </span>
65 {docURL page="user/initial-set-up/scheduled-jobs"}
66 </td>
67 </tr>
68 {/if}
69
70 {if $savedMapping}
71 <tr class="crm-import-datasource-form-block-savedMapping">
72 <td class="label"><label for="savedMapping">{$form.savedMapping.label}</label></td>
73 <td>{$form.savedMapping.html}<br />
74 &nbsp;&nbsp;&nbsp;<span class="description">{ts}Select Saved Mapping or Leave blank to create a new One.{/ts}</span></td>
75 </tr>
76 { /if}
77
78 {if $form.disableUSPS}
79 <tr class="crm-import-datasource-form-block-disableUSPS">
80 <td class="label"></td>
81 <td>{$form.disableUSPS.html} <label for="disableUSPS">{$form.disableUSPS.label}</label></td>
82 </tr>
83
84 {/if}
85 </table>
86 </div>
87
88 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"} </div>
89
90 {literal}
91 <script type="text/javascript">
92 CRM.$(function($) {
93 //build data source form block
94 buildDataSourceFormBlock();
95 buildSubTypes();
96 buildDedupeRules();
97 });
98
99 function buildDataSourceFormBlock(dataSource)
100 {
101 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q=$urlPathVar|smarty:nodefaults}"{literal};
102
103 if (!dataSource ) {
104 var dataSource = cj("#dataSource").val();
105 }
106
107 if ( dataSource ) {
108 dataUrl = dataUrl + '&dataSource=' + dataSource;
109 } else {
110 cj("#data-source-form-block").html( '' );
111 return;
112 }
113
114 cj("#data-source-form-block").load( dataUrl );
115 }
116
117 function buildSubTypes( )
118 {
119 element = cj('input[name="contactType"]:checked').val( );
120 var postUrl = {/literal}"{crmURL p='civicrm/ajax/subtype' h=0 }"{literal};
121 var param = 'parentId='+ element;
122 cj.ajax({ type: "POST", url: postUrl, data: param, async: false, dataType: 'json',
123
124 success: function(subtype){
125 if ( subtype.length == 0 ) {
126 cj("#subType").empty();
127 cj("#contact-subtype").hide();
128 } else {
129 cj("#contact-subtype").show();
130 cj("#subType").empty();
131
132 cj("#subType").append("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
133 for ( var key in subtype ) {
134 // stick these new options in the subtype select
135 cj("#subType").append("<option value="+key+">"+subtype[key]+" </option>");
136 }
137 }
138
139
140 }
141 });
142
143 }
144
145 function buildDedupeRules( )
146 {
147 element = cj("input[name=contactType]:checked").val();
148 var postUrl = {/literal}"{crmURL p='civicrm/ajax/dedupeRules' h=0 }"{literal};
149 var param = 'parentId='+ element;
150 cj.ajax({ type: "POST", url: postUrl, data: param, async: false, dataType: 'json',
151
152 success: function(dedupe){
153 if ( dedupe.length == 0 ) {
154 cj("#dedupe").empty();
155 cj("#contact-dedupe").hide();
156 } else {
157 cj("#contact-dedupe").show();
158 cj("#dedupe").empty();
159
160 cj("#dedupe").append("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
161 for ( var key in dedupe ) {
162 // stick these new options in the dedupe select
163 cj("#dedupe").append("<option value="+key+">"+dedupe[key]+" </option>");
164 }
165 }
166
167
168 }
169 });
170
171 }
172
173 </script>
174 {/literal}
175
176 </div>