<?php
/**
 * Team profile view template.
 *
 * @link       https://personalizewp.com/
 * @since      3.4.0
 *
 * @var array $team Team data array.
 */

namespace PersonalizeWP\Admin;

use PersonalizeWP\Admin\PageContacts;
use PersonalizeWP\Admin\ListTableActivity;
use PersonalizeWP\Admin\PageDataExport;

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

?>
<main class="section entity-panel">
	<?php require_once plugin_dir_path( __DIR__ ) . '/_other/contacts-nav.php'; ?>

	<nav class="entity-panel__nav">
		<a href="<?php echo esc_url( admin_url( PageContacts::$index_url ) ); ?>" class="back">&larr; <?php esc_html_e( 'Back', 'personalizewp' ); ?></a>
	</nav>

	<section class="entity-panel__preview">
		<header class="entity-panel__header repel">
			<div class="sub-header repel">
				<h2 class="team-name section-title">
					<?php echo esc_html( $team['team_name'] ?: __( 'Unnamed Team', 'personalizewp' ) ); ?>
				</h2>
			</div>

			<ul class="context-links">
				<li><a class="contextual-link" href="<?php
				echo esc_url(
					add_query_arg(
						[
							'page'        => PageDataExport::SLUG,
							'export_type' => 'team',
							'team_id'     => $team['ID'],
						],
						admin_url( 'admin.php' )
					)
				);
				?>">
					<?php esc_html_e( 'Export Team Event Log', 'personalizewp' ); ?>
				</a></li>
			</ul>
		</header>

		<section class="entity-panel__activity">
			<?php
			$activities = new ListTableActivity();
			$activities->prepare_items();
			?>
			<form id="team-activities-filter" method="get" action="#team-activities-filter">
				<div class="with-sidebar activities" data-direction="rtl">
					<div class="sidebar table-actions">
						<?php
						$activities->search_box( __( 'Search Events', 'personalizewp' ), 'search-contacts' );
						?>
					</div>
				</div>
				<?php
				$activities->display();
				?>
			</form>
		</section>
	</section>
</main>
