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

namespace PersonalizeWP\Admin\Partials;

use PersonalizeWP\Admin\ListTableCategories;
use PersonalizeWP\Admin\PageCategories;

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

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

	<?php
	$categories = new ListTableCategories();
	$categories->prepare_items();
	?>
	<form id="categories-filter" method="get">
		<div class="with-sidebar categories" data-direction="rtl">
			<div class="section-description">
				<p><?php esc_html_e( 'PersonalizeWP provides a number of pre-built rules and categories that are ready to use on your site, which you can see below. If you want to add your own, just click on the Create Rule or Create Category button.', 'personalizewp' ); ?></p>
			</div>

			<div class="sidebar table-actions">
				<a class="primary btn create" data-show-modal="#createCategoryModal" href="<?php echo esc_url( admin_url( PageCategories::$create_url ) ); ?>"><?php esc_html_e( 'Create category', 'personalizewp' ); ?></a>
				<?php
				$categories->search_box( __( 'Search categories', 'personalizewp' ), 'search-categories' );
				?>
			</div>
		</div>

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

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