Merge pull request #17074 from joshgowans/patch-4
[civicrm-core.git] / templates / CRM / common / highLightImport.tpl
CommitLineData
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*}
00a3b823 10{* Highlight the required field during import (included within a <script>)*}
6a488035 11{literal}
3cc60a06 12CRM.$(function($) {
00a3b823
CW
13 var highlightedFields = ["{/literal}{'","'|implode:$highlightedFields}{literal}"];
14 $.each(highlightedFields, function() {
15 $('select[id^="mapper"][id$="_0"] option[value='+ this + ']').append(' *').css({"color":"#FF0000"});
16 });
17 {/literal}{if $relationship}{literal}
18 var highlightedRelFields = {/literal}{$highlightedRelFields|@json_encode}{literal};
19 function highlight() {
20 var select, fields = highlightedRelFields[$(this).val()];
21 if (fields) {
22 select = $(this).next();
23 $.each(fields, function() {
24 $('option[value='+ this + ']', select).append(' *').css({"color":"#FF0000"});
25 });
6a488035 26 }
00a3b823
CW
27 }
28 $('select[id^="mapper"][id$="_0"]').each(highlight).click(highlight);
29 {/literal}{/if}{literal}
30});
6a488035 31{/literal}