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 += fieldMapTemplate.replace(/{FieldName}/g, data.Fields.Field[j].Name)
        .replace(/{FieldType}/g, data.Fields.Field[j].FieldType)
        .replace(/{CustomerKey}/g, data.CustomerKey)
        .replace(/{MaxLength}/g, data.Fields.Field[j].MaxLength)
        .replace(/{Precision}/g, data.Fields.Field[j].Precision)
        .replace(/{Scale}/g, data.Fields.Field[j].Scale)
        .replace(/{IsRequired}/g, data.Fields.Field[j].IsRequired);
      }
      $(id).find('div[role="mapping"]').html(htm);
    });
  } 
}
// 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 += fieldMapTemplate.replace(/{FieldName}/g, data.Fields.Field[j].Name)
        .replace(/{FieldType}/g, data.Fields.Field[j].FieldType)
        .replace(/{CustomerKey}/g, data.CustomerKey)
        .replace(/{MaxLength}/g, data.Fields.Field[j].MaxLength)
        .replace(/{Precision}/g, data.Fields.Field[j].Precision)
        .replace(/{Scale}/g, data.Fields.Field[j].Scale)
        .replace(/{IsRequired}/g, data.Fields.Field[j].IsRequired);
      }
      $(id).find('div[role="mapping"]').html(htm);
    });
  } 
}
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 += fieldMapTemplate . replace ( / {FieldName} / g , data . Fields . Field [ j ] . Name ) . replace ( / {FieldType} / g , data . Fields . Field [ j ] . FieldType ) . replace ( / {CustomerKey} / g , data . CustomerKey ) . replace ( / {MaxLength} / g , data . Fields . Field [ j ] . MaxLength ) . replace ( / {Precision} / g , data . Fields . Field [ j ] . Precision ) . replace ( / {Scale} / g , data . Fields . Field [ j ] . Scale ) . replace ( / {IsRequired} / g , data . Fields . Field [ j ] . IsRequired ) ; } $ ( id ) . find ( 'div[role="mapping"]' ) . html ( htm ) ; } ) ; } }
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