var eventContent = '
Deployment Event(s)
', popupContent = "", hasDeploymentEvent = false, popupInstItem; //loop through each to create the popup _.each(platforms, function(platform_entry) { lat_lons.push(platform_entry.get('coordinates')); popupInstItem = ""; //loop through each to create the popup _.each(platforms, function(platform_entry) { lat_lons.push(platform_entry.get('coordinates')); popupInstItem = ""; var events = platform_entry.get('events'); _.each(events, function(item) { if (item['class'] == ".DeploymentEvent"){ if (!hasDeploymentEvent){ // Name popupContent = '

' + name + '

'; // Plotting popupContent += ''; popupContent+= '
  • Latitude: '+platforms[platforms.length -1].get('coordinates')[0] + '
  • Longitude: ' + platforms[platforms.length -1].get('coordinates')[1] +'
  • '; // Checkbox popupContent+= '
'; popupContent+='
Instruments
'; popupContent+='
'; popupContent+=''; popupContent+=''; } var instLength = instruments.length, instrumentName, instrumentRefDes, instrumentAssemblyName, instrumentStreamName, instrumentList = []; for ( var i=0, y = ""; i < instLength; i++ ) { if(instruments.models[i] !== undefined && (platforms[0].get('ref_des') === instruments.models[i].attributes.reference_designator.substring(0,8) || platforms[0].get('ref_des') === instruments.models[i].attributes.reference_designator.substring(0,14))) { instrumentName = instruments.models[i].attributes.display_name; instrumentRefDes = instruments.models[i].attributes.reference_designator; instrumentStreamName = instruments.models[i].attributes.stream_name; instrumentAssemblyName = instruments.models[i].attributes.reference_designator.split('-')[1]; y = '' + ''+ '' + ''; if( instrumentList.indexOf(y) < 0 ) { instrumentList.push(y); } delete instruments.models[i]; } } popupContent+=instrumentList.join(''); popupContent+='
AssemblyNameControls
'+instrumentName+'' + ' ' + ' '+ ' '+ '
'; hasDeploymentEvent = true; if (_.isNull(item.endDate)){ eventContent += '
'; eventContent += '
Current
'; eventContent += ''; eventContent +='
ID: '+ item.deploymentNumber +'
Start: '+ moment(item.startDate).utc().format("YYYY-MM-DD")+'
End: '+ "Still Deployed"+'
'; }else{ eventContent += '
'; eventContent += '
Previous
'; eventContent += ''; eventContent +='
ID: '+ item.deploymentNumber +'
Start: '+ moment(item.startDate).utc().format("YYYY-MM-DD")+'
End: '+ moment(item.endDate).utc().format("YYYY-MM-DD")+'
'; } } }); }); };