<?php

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

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

<div class="auclots-form">

    <?php
    $files = new \app\models\Files();
    $form = ActiveForm::begin(['options'=>['enctype'=>'multipart/form-data']]); ?>

    <?= $form->field($model, 'user_id')->hiddenInput(['value' => Yii::$app->user->identity->id]) ?>

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

    <?php $requisites = $model->allRequisites; ?>

    <?php if (!$requisites) { ?>
        <div class="alert alert-danger alert-dismissible fade in">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <?= Yii::t('app', 'noRequisites ID')?>
        </div>
    <?php } ?>
    <div class="row">

        <div class='col-md-8'><?= $form->field($model, 'requisites_id')->dropdownList($requisites) ?></div>
        <div class='col-md-3' id="addReq"><?= Html::button(Yii::t('app', 'Create Requisites'), ['value' => Url::to('/requisites/create-ajax'), 'class' => 'btn btn-success btn-block', 'id' => 'modalButton']) ;?>
        </div>
    </div>

    <?= $form->field($files, 'file')->widget(FileInput::classname(), [
        'model' => $files,
        'pluginOptions' => [
            //'allowedFileExtensions'=>['doc','docx','pdf', 'png', ],
            'initialCaption'=>'*.doc *.docx *.pdf *.png *.jpg *.tiff, *.zip *rar',
            'showPreview' => false,
            'showCaption' => true,
            'showRemove' => true,
            'showUpload' => false
        ],
        'options' => ['multiple' => false,],

    ])->label(Yii::t('app','ProjectDogovor ID')); ?>

    <?= $form->field($model, 'bidding_date')->widget(DateTimePicker::className(),[
        'name' => 'bidding_date',
        'type' => DateTimePicker::TYPE_COMPONENT_PREPEND,
        'value' => date("dd-M-yyyy hh:ii"),
        //'options' => ['placeholder' => Yii::t('app','')],
        '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, 'payment_term')->textarea(/*['maxlength' => 800, 'rows' => 6, 'cols' => 50]*/) ?>

    <!-- <?= $form->field($model, 'payment_order')->textarea(['maxlength' => 800, 'rows' => 6, 'cols' => 50]) ?> !-->

    <?= $form->field($model, 'member_require')->textarea(/*['maxlength' => 5000, 'rows' => 50, 'cols' => 100]*/) ?>

    <?= $form->field($model, 'term_procedure')->textarea(/*['maxlength' => 5000, 'rows' => 50, 'cols' => 100]*/) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create ID') : Yii::t('app', 'Update ID'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end();


    Modal::begin([
        'header' => '<h4>' . Yii::t('app', 'Requisites') . '</h4>',
        'id' => 'modal',
        'size' => 'modal-md',
    ]);

    echo '<div id="modalContent"></div>';

    Modal::end();

    ?>

</div>
