<?php
/**
 *
 * @var EmailAction $bulk_action_object Which Action we currently in.
 * @var int         $form_id            Which form we are dealing with.
 * @var array       $entries            Which entries we are modifying.
 * @var array       $selected_fields    Which fields were selected.
 * @var string      $view               Which view are in.
 * @var mixed       $form               Form settings.
 */

use \GravityKit\GravityActions\Assets;
use \GravityKit\GravityActions\Actions\EmailAction;

$fields_available      = '<span class="gv-bulk-email-all-fields-counter">' . count( $form['fields'] ) . '</span>';
$count_selected_fields = count( $selected_fields );
?>

<form class="gk-gravityactions" data-js="gk-gravityactions-modal-form" id="gk-gravityactions-email-step-1">
	<?php $this->render( 'components/modal-fields', [ 'bulk_action' => EmailAction::get_key() ] ); ?>
	<?php $this->render( 'components/header' ); ?>

	<div class="gk-gravityactions-modal-body">

		<div class="gv-bulk-email-step gv-bulk-email-step-1" style="flex-direction:column;">
			<table>
				<tbody>
				<?php
				$fields = $bulk_action_object->get_fields( $form );
				foreach ( $fields as $field ) {
					$this->render( 'email/field-row', [ 'field' => $field ] );
				}
				?>
				</tbody>
			</table>

		</div>
	</div>

	<?php $this->render( 'components/footer', [
		'current_step'     => 0,
		'total_steps'      => 3,
		'left_navigation'  => '<span class="featherlight-close">' . esc_html__( 'Close', 'gk-gravityactions' ) . '</span>',
		'right_navigation' => get_submit_button( __( 'Preview Message', 'gk-gravityactions' ), 'primary', 'submit', false, [
			'data-js'         => 'gk-gravityactions-modal-submit',
			'data-modal-view' => 'email/step-2',
		] ),
	] ); ?>

</form>