<?php /** @var $this TD_TTW_User_Licenses */ ?>

<div class="td-license-cnt">
	<h2 class="products-h2">
		<?php echo __( 'License Details', TVE_DASH_TRANSLATE_DOMAIN ) ?>
	</h2>
	<div class="td-refresh-license">
		<a href="<?php echo $this->get_recheck_url() ?>">
			<?php echo __( 'Refresh', TVE_DASH_TRANSLATE_DOMAIN ) ?>
		</a>
	</div>
	<?php foreach ( $this->get() as $license ) : ?>
		<?php /** @var TD_TTW_License $license */ ?>
		<div class="td-ttw-license-details">
			<span> <?php echo $license->get_name() ?> </span>
			<span class="td-badge<?php echo ! $license->is_active() ? '-expired' : '' ?>">
				<?php echo $license->get_state(); ?>
			</span>

			<div class="td-rcnt">
				<?php if ( ! $license->is_refunded() && ! empty( $license->get_expiration() ) ) : ?>
					<span><?php echo __( 'Renewal date- ', TVE_DASH_TRANSLATE_DOMAIN ) . $license->get_expiration(); ?></span>
				<?php elseif ( ! empty( $license->get_refunded_date() ) ) : ?>
					<span><?php echo __( 'Refund date- ', TVE_DASH_TRANSLATE_DOMAIN ) . $license->get_refunded_date(); ?></span>
				<?php endif; ?>
			</div>

			<?php if ( ! $license->is_active() ) : ?>
				<div class="td-renew-license">
					<a href="<?php echo TD_TTW_Update_Manager::SUITE_URL ?>">
						<?php echo __( 'Renew license', TVE_DASH_TRANSLATE_DOMAIN ) ?>
					</a>
				</div>
			<?php endif; ?>
		</div>
	<?php endforeach; ?>
</div>
