<?php if ( ! defined( 'ABSPATH' ) ) exit; // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals ?>
<?php $custom_type = get_post_type_object( $post_type ); ?>

<script type="text/javascript">
	var plugin_url = '<?php echo esc_url(WP_ALL_IMPORT_ROOT_URL); ?>';
</script>

<div class="wpallimport-collapsed closed nested_options wpallimport-section">
	<div class="wpallimport-content-section">
		<div class="wpallimport-collapsed-header">
			<h3><?php esc_html_e('Nested XML/CSV files','wp-all-import');?></h3>
		</div>
		<div class="wpallimport-collapsed-content">
			<table class="form-table" style="max-width:none;">
				<tr>
					<td>						
						<div class="nested_files">
							<ul>
								<?php if ( ! empty($post['nested_files'])): ?>
									<?php 
										$nested_files = json_decode($post['nested_files'], true);
										foreach ($nested_files as $key => $file) {
										?>
										<li rel="<?php echo esc_attr($key);?>"><?php echo esc_html($file);?> <a href="javascript:void(0);" class="unmerge"><?php esc_html_e('remove', 'wp-all-import'); ?></a></li>
										<?php
									}?>
								<?php endif; ?>
							</ul>
							<input type="hidden" value="<?php echo esc_attr($post['nested_files']); ?>" name="nested_files"/>
						</div>				
						<div class="nested_xml">						
							<div class="input" style="margin-left:15px;">							
								<input type="hidden" name="nested_local_path"/>
								<input type="hidden" name="nested_source_path"/>
								<input type="hidden" name="nested_root_element"/>
								<div class="nested_msgs"></div>
							</div>						
						</div>								
						<div class="clear"></div>	
						<div class="add_nested_file">
							
							<div class="msgs"></div>
							
							<div class="file-type-options">
								<label><?php esc_html_e('Specify the URL of the nested file to use.', 'wp-all-import'); ?></label>
								<input type="text" class="regular-text" name="nested_url" value="" style="width:100%; line-height:20px;" placeholder="http(s)://"/>
							</div>

							<a rel="parse" href="javascript:void(0);" class="parse"><?php esc_html_e('Add', 'wp-all-import'); ?></a>
						</div>											
					</td>
				</tr>							
			</table>
		</div>
	</div>
</div>