<?php
/**
 * Status tab – Plugin updates.
 *
 * @package flo-sync
 *
 * @phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r
 */

defined( 'ABSPATH' ) || exit;

/**
 * View file parameters.
 *
 * @var array $params
 */

?>
<h2><?php esc_html_e( 'Availabilities summary', 'flo-sync' ); ?></h2>
<table class="nmf-sync-table">
	<thead>
	<tr>
		<th><?php esc_html_e( 'Name', 'flo-sync' ); ?></th>
		<th><?php esc_html_e( 'Hub ID', 'flo-sync' ); ?></th>
		<th><?php esc_html_e( 'WP ID', 'flo-sync' ); ?></th>
		<th><?php esc_html_e( 'Enabled', 'flo-sync' ); ?></th>
		<th><?php esc_html_e( 'WP Post Status', 'flo-sync' ); ?></th>
	</tr>
	</thead>
	<tbody>
	<?php

	foreach ( $params['availabilities'] as $availability ) {
		echo '<tr>';
		echo '<td>' . esc_html( $availability->name ) . '</td>';
		echo '<td>' . esc_html( $availability->hub_id ) . '</td>';
		echo '<td>' . esc_html( $availability->wp_id ) . '</td>';
		echo '<td>' . esc_html( $availability->enabled ) . '</td>';
		echo '<td>' . esc_html( get_post_status( $availability->wp_id ) ) . '</td>';
		echo '</tr>';
	}
	?>
	</tbody>
</table>

<h2><?php esc_html_e( 'All availabilities data', 'flo-sync' ); ?></h2>
<?php
echo '<pre>';
print_r( $params['availabilities'] );
echo '</pre>';
