<?php
/**
 * Tags filter block.
 *
 * @package EventimUSEventListings
 */

defined( 'ABSPATH' ) || exit;
?>
<div class="dashboard-module">
	<div class="module-header">
		<h1><?php esc_html_e( 'Tags', 'eventim-us-event-listings' ); ?></h1>
	</div>
	<div class="module-content">
		<?php
		$evusel_tagListType          = $evuselConfig->get( 'shortcodes.tag_filter.view_type' );
		$evusel_tagShortcodeListType = $evusel_tagListType === 'l' ? 'list' : 'grid';
		?>

		<div class="settings-form">
			<div class="form-row">
				<div class="form-label">
					<label><?php esc_html_e( 'Shortcode for Grid view', 'eventim-us-event-listings' ); ?></label>
				</div>
				<div class="form-input">
					<div class="input-with-button">
						<input class="shortcode-info-input regular-text" type="text"
							value="[<?php echo esc_attr( $evuselConfig::SHORTCODE_TAG_FILTER . " tags='" . implode( ',', $selectedTags ) . "' type=grid" ); ?>]">
						<button type="button" class="see-menu-item dispevli-menu-item-active copy-shortcode"
							onclick="copyShortcode(this)">
							<?php esc_html_e( 'Copy', 'eventim-us-event-listings' ); ?>
						</button>
					</div>
				</div>
			</div>

			<div class="form-row">
				<div class="form-label">
					<label><?php esc_html_e( 'Shortcode for List view', 'eventim-us-event-listings' ); ?></label>
				</div>
				<div class="form-input">
					<div class="input-with-button">
						<input class="shortcode-info-input regular-text" type="text"
							value="[<?php echo esc_attr( $evuselConfig::SHORTCODE_TAG_FILTER . " tags='" . implode( ',', $selectedTags ) . "' type=list" ); ?>]">
						<button type="button" class="see-menu-item dispevli-menu-item-active copy-shortcode"
							onclick="copyShortcode(this)">
							<?php esc_html_e( 'Copy', 'eventim-us-event-listings' ); ?>
						</button>
					</div>
				</div>
			</div>

			<div class="form-row">
				<div class="form-label">
					<label><?php esc_html_e( 'Eventim US Tags', 'eventim-us-event-listings' ); ?></label>
				</div>
				<div class="form-input">
					<div class="radio-options connected-radio-options"
						style="max-height: 150px; overflow-y: auto; border-radius: 2px; width: 100%;">
						<?php foreach ( $tags as $evusel_tagItem ) : ?>
							<div class="radio-option">
								<input type="checkbox" id="tagfilter-<?php echo esc_attr( $evusel_tagItem->slug ); ?>"
									name="evusel_settings[shortcodes][tag_filter][selected_tags][]"
									value="<?php echo esc_attr( $evusel_tagItem->slug ); ?>" <?php echo in_array( $evusel_tagItem->slug, $selectedTags ) ? 'checked' : ''; ?>>
								<label for="tagfilter-<?php echo esc_attr( $evusel_tagItem->slug ); ?>">
									<?php echo esc_html( $evusel_tagItem->name ); ?>
								</label>
							</div>
						<?php endforeach; ?>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>