<commit_before><?php
use hipanel\widgets\Box;
use hiqdev\combo\StaticCombo;
use kartik\widgets\DatePicker;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Modal;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JsExpression;
use yii\web\View;

$this->registerCss('legend { font-size: 15px; }');
$this->registerJs(<<<JS
jQuery('#fiz_domain input').change(function() {
    var disable = false;
    jQuery('#fiz_domain input').each(function(i, e) {
        var elem = jQuery(e);
        if (elem.prop('type') == 'text' && elem.val() != '') {
            disable = true;
        }
    });
    jQuery('#jur_domain').prop('disabled', disable);
});
jQuery('#jur_domain input').change(function() {
    var disable = false;
    jQuery('#jur_domain input').each(function(i, e) {
        var elem = jQuery(e);
        if ((elem.prop('type') == 'checkbox' && elem.is(':checked')) || (elem.prop('type') == 'text' && elem.val() != '')) {
            disable = true;
        }
    });
    jQuery('#contact-passport_date, #contact-birth_date').each(function(i, e) {
        var elem = jQuery(e);
        var opts = elem.data('krajee-datepicker');
        if (disable) {
            elem.parent().kvDatepicker('remove');
            elem.parent().addClass('disabled');
        } else {
            elem.parent().kvDatepicker(opts);
            elem.parent().removeClass('disabled');
        }
    });
    jQuery('#fiz_domain').prop('disabled', disable);
});
JS
, View::POS_READY);
?>

<?php if ($askPincode['pincode_enabled']) : ?>
    <?php $this->registerJs(<<<JS
    jQuery('#contact-form').on('beforeSubmit', function(event, attributes, messages, deferreds) {
        event.preventDefault();
        var show = true;
        for (var attr in attributes) {
            if (attributes[attr].length == 0) {
                show = false;
                return;
            }
        }
        if (show) {
            jQuery('#askpincode-modal').modal('show');
        }
        return false;
    });
    jQuery('#modal-ask-pincode-button').on('click', function(e) {
        var pincode = jQuery('#modal-pincode').val();
        jQuery('#contact-pincode').val(pincode);
        document.getElementById("contact-form").submit();
    });
JS
    ); ?>
    <?php Modal::begin([
        'id'           => 'askpincode-modal',
        'size'         => Modal::SIZE_SMALL,
        'header'       => '<h4 class="modal-title">' . Yii::t('app', 'Enter pincode') . '</h4>',
        'clientEvents' => [
            'show.bs.modal' => new JsExpression("function() {document.getElementById('modal-pincode').value = '';}"),
        ],
        'footer'                => Html::submitButton(Yii::t('app', 'Submit'), [
            'id'                => 'modal-ask-pincode-button',
            'class'             => 'btn btn-default btn-loading',
            'data-loading-text' => Yii::t('app', 'Loading') . '...',
            'data-loading-icon' => 'glyphicon glyphicon-refresh',
        ]),
    ]); ?>
        <?= Html::textInput('modal-pincode', null, ['id' => 'modal-pincode', 'class' => 'form-control', 'placeholder' => Yii::t('app', 'Type pincode here...')]); ?>
    <?php Modal::end(); ?>
<?php endif; ?>

<?php $form = ActiveForm::begin([
    'id'                     => 'contact-form',
    'action'                 => $model->scenario === 'copy' ? Url::toRoute('create') : '',
    'enableClientValidation' => true,
    'validateOnBlur'         => true,
    'enableAjaxValidation'   => true,
    'layout'                 => 'horizontal',
    'validationUrl'          => Url::toRoute(['validate-form', 'scenario' => $model->scenario]),
]) ?>
<?php if ($askPincode['pincode_enabled']) : ?>

<?php endif; ?>
<div class="row">
    <?= $form->field($model, 'pincode')->hiddenInput()->label(false); ?>

    <div class="col-md-12">
        <?php Box::begin(); ?>
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-default']); ?>
        <?php Box::end(); ?>
    </div>
    <!-- /.com-md-12 -->

    <div class="col-md-6">
        <?php Box::begin(['title' => Yii::t('app', 'Contacts details')]) ?>
        <?php if ($model->scenario === 'update') : ?>
            <?= $form->field($model, 'id')->hiddenInput()->label(false); ?>
        <?php endif; ?>
        <?= $form->field($model, 'first_name'); ?>
        <?= $form->field($model, 'last_name'); ?>
        <?= $form->field($model, 'email'); ?>
        <?= $form->field($model, 'abuse_email'); ?>
        <?= $form->field($model, 'organization'); ?>
        <?= $form->field($model, 'street1'); ?>
        <?= $form->field($model, 'street2'); ?>
        <?= $form->field($model, 'street3'); ?>
        <?= $form->field($model, 'city'); ?>
        <?= $form->field($model, 'country')->widget(StaticCombo::classname(), [
            'data'  => $countries,
            'hasId' => true,
        ]); ?>
        <?= $form->field($model, 'province'); ?>
        <?= $form->field($model, 'postal_code'); ?>
        <?= $form->field($model, 'voice_phone'); ?>
        <?= $form->field($model, 'fax_phone'); ?>

        <?php Box::end() ?>
    </div>
    <!-- /.col-md-6 -->
    <div class="col-md-6">
        <?php Box::begin(['title' => Yii::t('app', 'Additional contacts information')]) ?>
        <?= $form->field($model, 'icq'); ?>
        <?= $form->field($model, 'skype'); ?>
        <?= $form->field($model, 'jabber'); ?>
        <?= $form->field($model, 'other_messenger'); ?><commit_msg>Added * for required fields in contact form<commit_after><?php
use hipanel\widgets\Box;
use hiqdev\combo\StaticCombo;
use kartik\widgets\DatePicker;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Modal;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JsExpression;
use yii\web\View;

$this->registerCss('legend { font-size: 15px; };');
$this->registerCss('.form-group.required { color: orange; };');
$this->registerJs(<<<JS
jQuery('#fiz_domain input').change(function() {
    var disable = false;
    jQuery('#fiz_domain input').each(function(i, e) {
        var elem = jQuery(e);
        if (elem.prop('type') == 'text' && elem.val() != '') {
            disable = true;
        }
    });
    jQuery('#jur_domain').prop('disabled', disable);
});
jQuery('#jur_domain input').change(function() {
    var disable = false;
    jQuery('#jur_domain input').each(function(i, e) {
        var elem = jQuery(e);
        if ((elem.prop('type') == 'checkbox' && elem.is(':checked')) || (elem.prop('type') == 'text' && elem.val() != '')) {
            disable = true;
        }
    });
    jQuery('#contact-passport_date, #contact-birth_date').each(function(i, e) {
        var elem = jQuery(e);
        var opts = elem.data('krajee-datepicker');
        if (disable) {
            elem.parent().kvDatepicker('remove');
            elem.parent().addClass('disabled');
        } else {
            elem.parent().kvDatepicker(opts);
            elem.parent().removeClass('disabled');
        }
    });
    jQuery('#fiz_domain').prop('disabled', disable);
});
JS
, View::POS_READY);
?>

<?php if ($askPincode['pincode_enabled']) : ?>
    <?php $this->registerJs(<<<JS
    jQuery('#contact-form').on('beforeSubmit', function(event, attributes, messages, deferreds) {
        event.preventDefault();
        var show = true;
        for (var attr in attributes) {
            if (attributes[attr].length == 0) {
                show = false;
                return;
            }
        }
        if (show) {
            jQuery('#askpincode-modal').modal('show');
        }
        return false;
    });
    jQuery('#modal-ask-pincode-button').on('click', function(e) {
        var pincode = jQuery('#modal-pincode').val();
        jQuery('#contact-pincode').val(pincode);
        document.getElementById("contact-form").submit();
    });
JS
    ); ?>
    <?php Modal::begin([
        'id'           => 'askpincode-modal',
        'size'         => Modal::SIZE_SMALL,
        'header'       => '<h4 class="modal-title">' . Yii::t('app', 'Enter pincode') . '</h4>',
        'clientEvents' => [
            'show.bs.modal' => new JsExpression("function() {document.getElementById('modal-pincode').value = '';}"),
        ],
        'footer'                => Html::submitButton(Yii::t('app', 'Submit'), [
            'id'                => 'modal-ask-pincode-button',
            'class'             => 'btn btn-default btn-loading',
            'data-loading-text' => Yii::t('app', 'Loading') . '...',
            'data-loading-icon' => 'glyphicon glyphicon-refresh',
        ]),
    ]); ?>
        <?= Html::textInput('modal-pincode', null, ['id' => 'modal-pincode', 'class' => 'form-control', 'placeholder' => Yii::t('app', 'Type pincode here...')]); ?>
    <?php Modal::end(); ?>
<?php endif; ?>

<?php $form = ActiveForm::begin([
    'id'                     => 'contact-form',
    'action'                 => $model->scenario === 'copy' ? Url::toRoute('create') : '',
    'enableClientValidation' => true,
    'validateOnBlur'         => true,
    'enableAjaxValidation'   => true,
    'layout'                 => 'horizontal',
    'validationUrl'          => Url::toRoute(['validate-form', 'scenario' => $model->scenario]),
]) ?>
<?php if ($askPincode['pincode_enabled']) : ?>

<?php endif; ?>
<div class="row">
    <?= $form->field($model, 'pincode')->hiddenInput()->label(false); ?>

    <div class="col-md-12">
        <?php Box::begin(); ?>
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-default']); ?>
        <?php Box::end(); ?>
    </div>
    <!-- /.com-md-12 -->

    <div class="col-md-6">
        <?php Box::begin(['title' => Yii::t('app', 'Contacts details')]) ?>
        <?php if ($model->scenario === 'update') : ?>
            <?= $form->field($model, 'id')->hiddenInput()->label(false); ?>
        <?php endif; ?>
        <?= $form->field($model, 'first_name')->label(Yii::t('app', 'First name') . " *"); ?>
        <?= $form->field($model, 'last_name')->label(Yii::t('app', 'Last name') . " *"); ?>
        <?= $form->field($model, 'email')->label(Yii::t('app', 'Email') . " *"); ?>
        <?= $form->field($model, 'abuse_email'); ?>
        <?= $form->field($model, 'organization'); ?>
        <?= $form->field($model, 'street1')->label(Yii::t('app', 'Street') . " *"); ?>
        <?= $form->field($model, 'street2'); ?>
        <?= $form->field($model, 'street3'); ?>
        <?= $form->field($model, 'city')->label(Yii::t('app', 'City') . " *"); ?>
        <?= $form->field($model, 'country')->widget(StaticCombo::classname(), [
            'data'  => $countries,
            'hasId' => true,
        ])->label(Yii::t('app', 'Country') . " *"); ?>
        <?= $form->field($model, 'province'); ?>
        <?= $form->field($model, 'postal_code')->label(Yii::t('app', 'Postal code') . " *"); ?>
        <?= $form->field($model, 'voice_phone')->label(Yii::t('app', 'Phone') . " *"); ?>
        <?= $form->field($model, 'fax_phone'); ?>

        <?php Box::end() ?>
    </div>
    <!-- /.col-md-6 -->
    <div class="col-md-6">
        <?php Box::begin(['title' => Yii::t('app', 'Additional contacts information')]) ?>
        <?= $form->field($model, 'icq'); ?>
        <?= $form->field($model, 'skype'); ?>
        <?= $form->field($model, 'jabber'); ?>
        <?= $form->field($model, 'other_messenger'); ?>
{'fraction_non_alphanumeric': 0.23751328374070138, 'fraction_numerical': 0.002656748140276302, 'mean_word_length': 2.544569993722536, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 222, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '636719', 'n_tokens_mistral': 3643, 'n_tokens_neox': 3620, 'n_words': 577}