<?php

namespace GriffinForms\Admin\Html\Pages\Single;

class FormPage extends \GriffinForms\Admin\Html\Pages\Single\Format
{   
    protected $type = 'formpage';
    
    public function itemOptions()
    {
        array_push($this->fields, 'step_data');
        $this->stepData();
    }

    protected function stepData()
    {
        echo '<div class="container border-bottom griffinforms-item-options w-75 mt-3 pt-3">';
        $this->optionsHeader('step_data');
        $step_data = $this->item->getProp('step_data');
        $step_name = is_array($step_data) ? (string) ($step_data['step_name'] ?? '') : '';
        $step_icon = is_array($step_data) ? (string) ($step_data['step_icon'] ?? '') : '';

        echo '<div class="row mb-3" id="griffinforms-stepdata-stepname-row">';
        echo '<div class="col-md-3 ps-3"><label class="fw-bold">' . esc_html($this->lang->getText('step_name', 'label')) . '</label></div>';
        echo '<div class="col-md-9">';
        echo '<input type="text" id="griffinforms-stepdata-stepname-inputtext" class="form-control griffinforms-formcontrol" value="' . esc_attr($step_name) . '">';
        echo '<p id="step_name-description" class="mt-1 text-secondary small">' . esc_html($this->lang->getText('step_name', 'description')) . '</p>';
        echo '</div></div>';

        echo '<div class="row mb-3" id="griffinforms-stepdata-stepicon-row">';
        echo '<div class="col-md-3 ps-3"><label class="fw-bold">' . esc_html($this->lang->getText('step_icon', 'label')) . '</label></div>';
        echo '<div class="col-md-9">';
        echo '<input type="text" id="griffinforms-stepdata-stepicon-inputtext" class="form-control griffinforms-formcontrol" value="' . esc_attr($step_icon) . '" placeholder="toggle_on">';
        echo '<p id="step_icon-description" class="mt-1 text-secondary small">' . esc_html($this->lang->getText('step_icon', 'description')) . '</p>';
        echo '</div></div>';
        echo '</div>';  
    }
}
