<?php
/**
 * Options
 *
 * Options row
 *
 * @since   7.4
 *
 * @package WPrequal
 */

namespace WPrequal;

if ( ! defined( 'ABSPATH' ) ) {
	die( 'Access denied!!' );
} ?>

<tr class="contact-options">
	<th><label><?php esc_html_e( 'Options', 'wprequal' ); ?></label></th>
</tr><?php

$default = array( 0 => array( 'option' => '', 'value' => '' ) );
$options = empty ( $input['options'] ) ? $default : $input['options'];
$i       = 1;

foreach ( $options as $option ) {

	$checked = isset( $option['checked'] ) ? 'checked' : ''; ?>

	<tr class="input-option">

		<td colspan="3">

			<input type="checkbox" name="input[<?php echo esc_attr( $input['key'] ); ?>][options][<?php echo esc_attr( $i ); ?>][checked]" value="checked" class="<?php echo esc_attr( $input['input'] ); ?>" <?php echo esc_attr( $checked ); ?>>

			<input type="text" name="input[<?php echo esc_attr( $input['key'] ); ?>][options][<?php echo esc_attr( $i ); ?>][option]" value="<?php echo esc_attr( $option['option'] ); ?>" class="wpq-required option" placeholder="Option">

			<input type="text" name="input[<?php echo esc_attr( $input['key'] ); ?>][options][<?php echo esc_attr( $i ); ?>][value]" value="<?php echo esc_attr( $option['value'] ); ?>" class="value" placeholder="Value">

			<i class="fas fa-plus-circle add-input point"></i><i class="fas fa-minus-circle trash-input point red"></i>

			<input type="hidden" class="key" value="<?php echo esc_attr( $input['key'] ); ?>"/>
		</td>

	</tr>

	<?php $i++; ?>

<?php } ?>