<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\datetime\DateTimePicker;
use kartik\file\FileInput;

/* @var $this yii\web\View */
/* @var $model app\models\Lots */
/* @var $form yii\widgets\ActiveForm */

$files = new \app\models\Files();

?>

    <div class="lots-form">
        <div class="row">
            <div class="col-md-6">
                <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

                <?= $form->field($model, 'num')->textInput() ?>



                <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

                <?= $form->field($model, 'category_id')->textInput()->dropDownList(ArrayHelper::map(\app\models\Category::find()->all(), 'id', 'name')) ?>

                <?= $form->field($model, 'description')->textarea(['maxlength' => true, 'row' => 6]) ?>

                <?= $form->field($model, 'start_price')->textInput(['maxlength' => true]) ?>


                <?= $form->field($model, 'step')->textInput(['maxlength' => true]) ?>


                <?= $form->field($model, 'address')->textarea(['rows' => 3]) ?>


                <?= $form->field($model, 'notes')->textarea(['rows' => 3]) ?>


            </div>
            <div class="col-md-6">
                <?= $form->field($model, 'aukname')->textInput(['readonly' => true]) ?>
                <?= $form->field($model, 'nds')->checkbox(['checked ' => true]) ?>

                <?= $form->field($model, 'date')->textInput(['readonly' => true]) ?>

                <?= $form->field($model, 'bidding_date')->textInput()->widget(DateTimePicker::className(), [
                    'name' => 'auction_date',
                    'type' => DateTimePicker::TYPE_COMPONENT_PREPEND,
                    'value' => date("dd-M-yyyy hh:ii"),
                    'pluginOptions' => [
                        'autoclose' => true,
                        'format' => 'yyyy-mm-dd hh:ii'
                    ]
                ]) ?>

                <?= $form->field($model, 'auction_date')->widget(DateTimePicker::className(), [
                    'name' => 'auction_date',
                    'type' => DateTimePicker::TYPE_COMPONENT_PREPEND,
                    'value' => date("dd-M-yyyy hh:ii"),
                    'options' => ['placeholder' => Yii::t('app', 'CreateAukDate ID')],
                    'pluginOptions' => [
                        'autoclose' => true,
                        'format' => 'yyyy-mm-dd hh:ii'
                    ]
                ]) ?>

                <?= $form->field($model, 'docs_id')
                    ->textInput(['class' => 'hidden'])
                    ->label(Yii::t('app', 'DopDocumentation ID')
                        . Html::a('(завантажиты для перевірки)', ['/files/download/', 'id' => $model->docs_id])); ?>

                <?= Html::checkbox('agreeCopyImg', false, ['label' => Yii::t('app','CloneImg')]); ?>
                <?php if ($model->file): ?>
                    <?= Html::checkbox('agreeCopyFile', false, ['label' => Yii::t('app','CloneAdditionalDoc')]); ?>
                <?php endif; ?>

                <div class="form-group">
                    <?= Html::submitButton('Клонувати') ?>
                    <?php ActiveForm::end(); ?>
                </div>
            </div>
        </div>
    </div>

<?php
$js = <<<JS
 $(":checkbox").change(function(){
     if('[name==agreeCopyImg]'){
         alert('Hello');
     }
     
 })
JS;

$this->registerJs($js);
?>