Merge pull request #15810 from eileenmcnaughton/mem_fix
[civicrm-core.git] / templates / CRM / common / highLightImport.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 {* Highlight the required field during import (included within a <script>)*}
11 {literal}
12 CRM.$(function($) {
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 });
26 }
27 }
28 $('select[id^="mapper"][id$="_0"]').each(highlight).click(highlight);
29 {/literal}{/if}{literal}
30 });
31 {/literal}