function configureUploads(){
  // Configure Upload Inputs
  var htm = '';
  var uploads = configObj.model[0].tables.filter(data => data.upload == 1);
  for (i = 0; i < uploads.length; i++) {
    htm += uploadTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey);
  }
  $('#file-modal').find('.slds-modal__content').html(htm);
  $('#file-modal').find('.slds-modal__footer .slds-col:first').text('0 of ' + uploads.length + ' files uploaded');
  $('#file-modal').removeClass('slds-hide');
  $('.slds-backdrop').addClass('slds-backdrop_open');

  // Configure Tabs Display
  var tabs = '';
  var htm = '';
  for (i = 0; i < uploads.length; i++) {
    var tabClass = (i==0)? 'slds-is-active':'';
    var contentClass = (i==0)? 'slds-show':'slds-hide';
    tabs += tabsTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey).replace(/{class}/g, tabClass);
    htm += tabsContentTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey).replace(/{class}/g, contentClass);
  } 
  htm = '<ul class="slds-vertical-tabs__nav" role="tablist" aria-orientation="vertical">' + tabs + '</ul>' + htm;
  $('#file-uploads').find('.slds-vertical-tabs').html(htm);

  // Configure Field Mapping Display
  for (i = 0; i < uploads.length; i++) {
    var schemaUrl = uploads[i].location + uploads[i].CustomerKey + '/schema.json';
    $.get(schemaUrl, function(data) {
      var htm = "";
      var id = "#tabs-" + data.CustomerKey;
      for (j = 0; j < data.Fields.Field.length; j++) {
        htm += '<div class="slds-form-element slds-p-bottom_small">';
        htm += '  <div class="slds-box slds-size_1-of-1 slds-grid slds-wrap" data-schema="' + data.CustomerKey + '" data-field="'+ data.Fields.Field[j].Name + '">';
        htm += '    <div class="slds-size_4-of-5">'+ data.Fields.Field[j].Name + '</div>';
        htm += '    <div class="slds-size_1-of-5 slds-text-align_right slds-text-title_caps slds-text-color_inverse-weak">'+ data.Fields.Field[j].FieldType + '</div>';
        htm += '    <div class="slds-size_1-of-1 slds-hide">Drop field to match</div>';
        htm += '  </div>';
        htm += '</div>';
      }
      $(id).find('div[role="dropzones"]').html(htm);
      $(id).find('div[role="dropzones"]').find('.slds-box').droppable({
        tolerance: "pointer",
        classes: {
          "ui-droppable-active": "ui-state-active",
          "ui-droppable-hover": "slds-theme_shade"
        },
        drop: function( event, ui ) {
          var leftFix = $(this).offset().left - ui.offset.left;
          var topFix = $(this).offset().top - ui.offset.top;
          ui.draggable.animate({left: "+=" + leftFix, top: "+=" + topFix, width:$(this).css('width')},100);
          ui.draggable.addClass('color-background-success-dark');
          ui.draggable.find('.slds-size_7-of-8').text(ui.draggable.find('.slds-size_7-of-8').text() + ' -> ' + $(this).find('.slds-size_4-of-5').text());
          $(this).attr('data-column', ui.draggable.attr('data-column'));
        },
        over: function( event, ui ) {
          ui.draggable.addClass('color-background-success-dark');
        },
        out: function( event, ui ) {
          ui.draggable.removeClass('color-background-success-dark');
          $(this).attr('data-column', '');
        }
      });

    });
  } 
}
// Function to build Panel 2 based on file uploads required =========
Function to build Panel 2 based on file uploads required
Function to build Panel 2 based on file uploads required
function configureUploads(){
  var htm = '';
  var uploads = configObj.model[0].tables.filter(data => data.upload == 1);
  for (i = 0; i < uploads.length; i++) {
    htm += uploadTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey);
  }
  $('#file-modal').find('.slds-modal__content').html(htm);
  $('#file-modal').find('.slds-modal__footer .slds-col:first').text('0 of ' + uploads.length + ' files uploaded');
  $('#file-modal').removeClass('slds-hide');
  $('.slds-backdrop').addClass('slds-backdrop_open');
  var tabs = '';
  var htm = '';
  for (i = 0; i < uploads.length; i++) {
    var tabClass = (i==0)? 'slds-is-active':'';
    var contentClass = (i==0)? 'slds-show':'slds-hide';
    tabs += tabsTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey).replace(/{class}/g, tabClass);
    htm += tabsContentTemplate.replace(/{Name}/g, uploads[i].Name).replace(/{CustomerKey}/g, uploads[i].CustomerKey).replace(/{class}/g, contentClass);
  } 
  htm = '<ul class="slds-vertical-tabs__nav" role="tablist" aria-orientation="vertical">' + tabs + '</ul>' + htm;
  $('#file-uploads').find('.slds-vertical-tabs').html(htm);
  for (i = 0; i < uploads.length; i++) {
    var schemaUrl = uploads[i].location + uploads[i].CustomerKey + '/schema.json';
    $.get(schemaUrl, function(data) {
      var htm = "";
      var id = "#tabs-" + data.CustomerKey;
      for (j = 0; j < data.Fields.Field.length; j++) {
        htm += '<div class="slds-form-element slds-p-bottom_small">';
        htm += '  <div class="slds-box slds-size_1-of-1 slds-grid slds-wrap" data-schema="' + data.CustomerKey + '" data-field="'+ data.Fields.Field[j].Name + '">';
        htm += '    <div class="slds-size_4-of-5">'+ data.Fields.Field[j].Name + '</div>';
        htm += '    <div class="slds-size_1-of-5 slds-text-align_right slds-text-title_caps slds-text-color_inverse-weak">'+ data.Fields.Field[j].FieldType + '</div>';
        htm += '    <div class="slds-size_1-of-1 slds-hide">Drop field to match</div>';
        htm += '  </div>';
        htm += '</div>';
      }
      $(id).find('div[role="dropzones"]').html(htm);
      $(id).find('div[role="dropzones"]').find('.slds-box').droppable({
        tolerance: "pointer",
        classes: {
          "ui-droppable-active": "ui-state-active",
          "ui-droppable-hover": "slds-theme_shade"
        },
        drop: function( event, ui ) {
          var leftFix = $(this).offset().left - ui.offset.left;
          var topFix = $(this).offset().top - ui.offset.top;
          ui.draggable.animate({left: "+=" + leftFix, top: "+=" + topFix, width:$(this).css('width')},100);
          ui.draggable.addClass('color-background-success-dark');
          ui.draggable.find('.slds-size_7-of-8').text(ui.draggable.find('.slds-size_7-of-8').text() + ' -> ' + $(this).find('.slds-size_4-of-5').text());
          $(this).attr('data-column', ui.draggable.attr('data-column'));
        },
        over: function( event, ui ) {
          ui.draggable.addClass('color-background-success-dark');
        },
        out: function( event, ui ) {
          ui.draggable.removeClass('color-background-success-dark');
          $(this).attr('data-column', '');
        }
      });
    });
  } 
}
function configureUploads ( ) { var htm = '' ; var uploads = configObj . model [ 0 ] . tables . filter ( data => data . upload == 1 ) ; for ( i = 0 ; i < uploads . length ; i ++ ) { htm += uploadTemplate . replace ( / {Name} / g , uploads [ i ] . Name ) . replace ( / {CustomerKey} / g , uploads [ i ] . CustomerKey ) ; } $ ( '#file-modal' ) . find ( '.slds-modal__content' ) . html ( htm ) ; $ ( '#file-modal' ) . find ( '.slds-modal__footer .slds-col:first' ) . text ( '0 of ' + uploads . length + ' files uploaded' ) ; $ ( '#file-modal' ) . removeClass ( 'slds-hide' ) ; $ ( '.slds-backdrop' ) . addClass ( 'slds-backdrop_open' ) ; var tabs = '' ; var htm = '' ; for ( i = 0 ; i < uploads . length ; i ++ ) { var tabClass = ( i == 0 ) ? 'slds-is-active' : '' ; var contentClass = ( i == 0 ) ? 'slds-show' : 'slds-hide' ; tabs += tabsTemplate . replace ( / {Name} / g , uploads [ i ] . Name ) . replace ( / {CustomerKey} / g , uploads [ i ] . CustomerKey ) . replace ( / {class} / g , tabClass ) ; htm += tabsContentTemplate . replace ( / {Name} / g , uploads [ i ] . Name ) . replace ( / {CustomerKey} / g , uploads [ i ] . CustomerKey ) . replace ( / {class} / g , contentClass ) ; } htm = '<ul class="slds-vertical-tabs__nav" role="tablist" aria-orientation="vertical">' + tabs + '</ul>' + htm ; $ ( '#file-uploads' ) . find ( '.slds-vertical-tabs' ) . html ( htm ) ; for ( i = 0 ; i < uploads . length ; i ++ ) { var schemaUrl = uploads [ i ] . location + uploads [ i ] . CustomerKey + '/schema.json' ; $ . get ( schemaUrl , function ( data ) { var htm = "" ; var id = "#tabs-" + data . CustomerKey ; for ( j = 0 ; j < data . Fields . Field . length ; j ++ ) { htm += '<div class="slds-form-element slds-p-bottom_small">' ; htm += '  <div class="slds-box slds-size_1-of-1 slds-grid slds-wrap" data-schema="' + data . CustomerKey + '" data-field="' + data . Fields . Field [ j ] . Name + '">' ; htm += '    <div class="slds-size_4-of-5">' + data . Fields . Field [ j ] . Name + '</div>' ; htm += '    <div class="slds-size_1-of-5 slds-text-align_right slds-text-title_caps slds-text-color_inverse-weak">' + data . Fields . Field [ j ] . FieldType + '</div>' ; htm += '    <div class="slds-size_1-of-1 slds-hide">Drop field to match</div>' ; htm += '  </div>' ; htm += '</div>' ; } $ ( id ) . find ( 'div[role="dropzones"]' ) . html ( htm ) ; $ ( id ) . find ( 'div[role="dropzones"]' ) . find ( '.slds-box' ) . droppable ( { tolerance : "pointer" , classes : { "ui-droppable-active" : "ui-state-active" , "ui-droppable-hover" : "slds-theme_shade" } , drop : function ( event , ui ) { var leftFix = $ ( this ) . offset ( ) . left - ui . offset . left ; var topFix = $ ( this ) . offset ( ) . top - ui . offset . top ; ui . draggable . animate ( { left : "+=" + leftFix , top : "+=" + topFix , width : $ ( this ) . css ( 'width' ) } , 100 ) ; ui . draggable . addClass ( 'color-background-success-dark' ) ; ui . draggable . find ( '.slds-size_7-of-8' ) . text ( ui . draggable . find ( '.slds-size_7-of-8' ) . text ( ) + ' -> ' + $ ( this ) . find ( '.slds-size_4-of-5' ) . text ( ) ) ; $ ( this ) . attr ( 'data-column' , ui . draggable . attr ( 'data-column' ) ) ; } , over : function ( event , ui ) { ui . draggable . addClass ( 'color-background-success-dark' ) ; } , out : function ( event , ui ) { ui . draggable . removeClass ( 'color-background-success-dark' ) ; $ ( this ) . attr ( 'data-column' , '' ) ; } } ) ; } ) ; } }
Function to build Panel 2 based on file uploads required
Function to build Panel 2 based on file uploads required
// Configure Upload Inputs // Configure Tabs Display // Configure Field Mapping Display