

/* Start:/local/components/custom/form/templates/inline/style.css?17846369912825*/
<?
CJSCore::Init(array("ajax"));

$athis = $this->__component;

$form_id = 'form_' . $arParams["WEB_FORM_ID"];
$captchaCode = $athis->captchaCode;
?>

<form id="<?= $form_id ?>" class="lead-form" action="" method="POST" enctype="multipart/form-data">
    <?= bitrix_sessid_post() ?>
    <input type="hidden" name="WEB_FORM_ID" value="<?= $arParams["WEB_FORM_ID"] ?>" />

    <div class="form-grid">
        <? foreach ($athis->formData as $field): ?>
            <?
            $fieldType = $field['type'];
            $fieldName = $field['name'];
            $fieldLabel = $field['label'];
            $fieldValue = $field['value'] ?? '';
            $fieldRequired = $field['required'] ? 'required' : '';
            $fieldClass = ($fieldType == 'textarea' || $fieldType == 'select' ? 'full' : '');
            ?>

            <div class="field <?= $fieldClass ?>">
                <label for="<?= $fieldName ?>">
                    <?= $fieldLabel ?><?= $field['required'] ? ' *' : '' ?>
                </label>

                <? if ($fieldType == 'textarea'): ?>
                    <textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="textarea" rows="3" <?= $fieldRequired ?>><?= $fieldValue ?></textarea>

                <? elseif ($fieldType == 'select'): ?>
                    <select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="select" <?= $fieldRequired ?>>
                        <? foreach ($field['variants'] as $variant): ?>
                            <option value="<?= $variant['ID'] ?>" <?= $variant['SELECTED'] ? 'selected' : '' ?>>
                                <?= $variant['VALUE'] ?>
                            </option>
                        <? endforeach; ?>
                    </select>

                <? elseif ($fieldType == 'checkbox'): ?>
                    <label class="lead-consent">
                        <input type="checkbox" name="<?= $fieldName ?>" value="1" <?= $fieldValue ? 'checked' : '' ?> <?= $fieldRequired ?>>
                        <span><?= $fieldLabel ?></span>
                    </label>

                <? else: ?>
                    <input id="<?= $fieldName ?>" class="input" type="<?= $fieldType ?>" name="<?= $fieldName ?>" value="<?= $fieldValue ?>" <?= $fieldRequired ?> />
                <? endif; ?>
            </div>
        <? endforeach; ?>
    </div>

    <div class="actions">
        <button type="submit" class="btn btn-primary" name="web_form_submit" value="Y">Получить демо</button>
        <a href="/" class="btn btn-secondary">Вернуться на главную</a>
    </div>
</form>

<script>
$(document).ready(function(){
    <? if ($captchaCode): ?>
        // Капча отключена
    <? endif; ?>
});
</script>
/* End */
/* /local/components/custom/form/templates/inline/style.css?17846369912825 */
