<?php
/**
 * Provide an admin view for listing Rules
 *
 * @since      1.0.0
 *
 * @package    PersonalizeWP
 * @subpackage PersonalizeWP/Admin/Partials
 */

namespace PersonalizeWP\Admin\Partials;

use PersonalizeWP\Admin\ListTableRules;
use PersonalizeWP\Admin\PageRules;

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

?>
<main>
	<?php require_once plugin_dir_path( __DIR__ ) . '/_other/personalization-nav.php'; ?>

	<?php
	$rules = new ListTableRules();
	$rules->prepare_items();
	?>
	<form id="rules-filter" method="get">
		<div class="with-sidebar rules" data-direction="rtl">
			<div class="section-description">
				<p><?php esc_html_e( 'Rules that are active will be displayed to a user and are available to use. If a rule is inactive, content related to it will not currently be displayed to a user. Reasons these rules are "inactive" include dependence upon a third party plugin to function (for example WooCommerce).', 'personalizewp' ); ?></p>
			</div>

			<div class="sidebar table-actions">
				<a class="primary btn create" href="<?php echo esc_url( admin_url( PageRules::$create_url ) ); ?>"><?php esc_html_e( 'Create Rule', 'personalizewp' ); ?></a>
				<?php
				$rules->search_box( __( 'Search Rules', 'personalizewp' ), 'search-rules' );
				?>
			</div>
		</div>

		<?php
		$rules->display();
		?>
	</form>
</main>

<?php
require_once __DIR__ . '/_modal-delete.php';
