<?php
/**
 * Dashboard User Table Markup
 *
 * Generates frontend HTML structure for the user table on the Author Kit dashboard page.
 *
 * @package Author_Kit
 * @since 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

require AUTHOR_KIT_PLUGIN_PATH . 'admin/views/author-kit-admin-header.php';
?>

<div class="main-content" id="author-kit-dashboard-table">

	<!-- btn and others -->
	<div id="btn-add-new">

	<button id="add-new-user-button">
		<?php esc_html_e( 'Add New User', 'author-kit' ); ?>
	</button>


	<div id="right-container">
		<div id="multi-select-options">
		<div id="container-for-multi-options">
			<span><?php esc_html_e( 'Bulk Action:', 'author-kit' ); ?></span>

			<div class="icon-bar">
			<a href="#" id="delete-all-users" class="action-icon" title="<?php echo esc_attr__( 'Delete', 'author-kit' ); ?>">
				<span class="icon-circle">
				<i class="fa-regular fa-trash-can"></i>
				</span>
				<?php esc_html_e( 'Delete', 'author-kit' ); ?>
			</a>

			<a href="#" id="send-all-password-reset" class="action-icon" title="<?php echo esc_attr__( 'Send Password Reset', 'author-kit' ); ?>">
				<span class="icon-circle">
				<i class="fa fa-paper-plane"></i>
				</span>
				<?php esc_html_e( 'Send Reset', 'author-kit' ); ?>
			</a>

			<a href="#" id="block-all-users" class="action-icon" title="<?php echo esc_attr__( 'Block User', 'author-kit' ); ?>">
				<span class="icon-circle">
				<i class="fa fa-ban"></i>
				</span>
				<?php esc_html_e( 'Block', 'author-kit' ); ?>
			</a>

			<a href="#" id="unblock-all-users" class="action-icon" title="<?php echo esc_attr__( 'Unblock User', 'author-kit' ); ?>">
				<span class="icon-circle">
				<i class="fa-solid fa-user-check"></i>
				</span>
				<?php esc_html_e( 'Unblock', 'author-kit' ); ?>
			</a>
			</div>
		</div>

		</div>

		<div class="search-bar">
		<i class="fas fa-search"></i>
		<input type="text" placeholder="<?php esc_html_e( 'Search by Name', 'author-kit' ); ?>" id="users-search">
		</div>

	</div>
	</div>



	<!-- Table data admin ,user etc  -->
	<div id="data-table-authorwp">
	<div id="filter-tabs">
		<p id="all-users"><?php esc_html_e( 'All ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="administrator-users"><?php esc_html_e( 'Admin ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="editor-users"><?php esc_html_e( 'Editor ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="author-users"><?php esc_html_e( 'Author ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="contributor-users"><?php esc_html_e( 'Contributor ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="subscriber-users"><?php esc_html_e( 'Subscribers ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="guest-users"><?php esc_html_e( 'Guest ', 'author-kit' ); ?> </p> <span id="information"></span>
		<p id="blocked-users"><?php esc_html_e( 'Blocked', 'author-kit' ); ?> </p> <span id="information"></span>
	</div>
	</div>

	<!-- HTML for the modal popup -->
	<div id="delete-user-modal" class="modal" style="display:none; font-family: 'Inter', sans-serif;">
	<div class="modal-content">
		<h2 id="modal-heading"><?php esc_html_e( 'Delete User', 'author-kit' ); ?></h2>
		<p id="modal-user-specify"><?php esc_html_e( 'You have specified this user for deletion:', 'author-kit' ); ?></p>
		<p id="modal-description"><?php esc_html_e( 'What should be done with content owned by this user?', 'author-kit' ); ?></p>
		<form id="delete-user-form">
		<label>
			<input type="radio" name="delete_action" value="delete_all_content" checked>
			<?php esc_html_e( 'Delete all content', 'author-kit' ); ?>
		</label>
		<label>
			<input type="radio" name="delete_action" value="attribute_content">
			<?php esc_html_e( 'Attribute content to:', 'author-kit' ); ?>
		</label>
		<select id="attribute-user-select" disabled>
			<!-- User options dynamically populated -->
		</select>
		<div class="modal-actions">
			<button type="button" id="confirm-delete" class="confirm-btn"><?php esc_html_e( 'Confirm Deletion', 'author-kit' ); ?></button>
			<button type="button" id="cancel-delete" class="cancel-btn"><?php esc_html_e( 'Cancel', 'author-kit' ); ?></button>
		</div>
		</form>
	</div>
	</div>

	<div class="table-container">
	<table id="authorTable">
		<thead current-page-id="">
		<tr>
			<th><input type="checkbox" id="select-all" class="select-all-checkbox" /></th>
			<th data-column="user_login" class="sortable">
			<?php esc_html_e( 'USER', 'author-kit' ); ?>
			<span class="sort-icons">
				<i class="sort-icon asc" data-order="asc">&#9650;</i>
				<i class="sort-icon desc" data-order="desc">&#9660;</i>
			</span>
			</th>
			<th><?php esc_html_e( 'ROLE', 'author-kit' ); ?></th>
			<th data-column="email" class="sortable">
			<?php esc_html_e( 'EMAIL', 'author-kit' ); ?>
			<span class="sort-icons">
				<i class="sort-icon asc" data-order="asc">&#9650;</i>
				<i class="sort-icon desc" data-order="desc">&#9660;</i>
			</span>
			</th>
			<th><?php esc_html_e( 'CONTRIBUTION', 'author-kit' ); ?></th>
			<th><?php esc_html_e( 'STATUS', 'author-kit' ); ?></th>
			<th><?php esc_html_e( 'ACTIONS', 'author-kit' ); ?></th>
		</tr>
		</thead>


		<tbody>
		<!-- Data will be injected here by JavaScript -->
		</tbody>

	</table>

	<!-- Place this loader html in this location after table tag close Necessary -->
	<div id="loader" style="display: none;">
		<div>
		<div class="author-kit-loader"></div>
		</div>
	</div>


	<div id="pagination">
		<section id="pagination-footer"> <?php esc_html_e( 'Users Per Page: ', 'author-kit' ); ?>
		<select id="rowsPerPage">
			<option value="5">5</option>
			<option selected value="10">10</option>
			<option value="25">25</option>
			<option value="50">50</option>
			<option value="75">75</option>
			<option value="100">100</option>
			<option value="-1">All</option>
		</select>
		<span id="paginationControls">
			<button id="prevPage" prev-page-id="1"><?php esc_html_e( 'Previous', 'author-kit' ); ?></button>
			<span id="pageNumbers"></span>
			<button id="nextPage" next-page-id="2"><?php esc_html_e( 'Next', 'author-kit' ); ?></button>
		</span>
		<span id="pageInfo"></span>

		</section>
	</div>

	</div>
