<?php
    /**
     * @var \common\modules\comment\models\CommentProject $model
     * @var \common\models\User                           $user
     * @var \yii\data\ActiveDataProvider                  $dataProvider
     */
    use common\models\Currency;
    use yii\widgets\ActiveForm;
    use yii\helpers\Html;

    $currencies = Currency::getCurrencyDropdown();
?>

<div class="new-portf-add-comm style">
    <div class="box-wr">
        <div class="box-all">
            <div class="tender-add-answer-title"><?= Yii::t('app', 'add_answer') ?></div>
            <div class="form-tender-answer style">
                <?php
                    $form = ActiveForm::begin([ 'options' => [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data' ] ]);
                ?>
                <div class="form-value-wr style">
                    <div class="form-ico-ded-wr">
                        <div class="header-cabinet-foto">
                            <?= Html::img(($user->userInfo->image)?:'') ?>
                        </div>
                        <div class="form-value-ded-name">
                            <?= $user->name ?>
                        </div>
                    </div>
                    <div class="form-value-price-wr">
                        <div class="form-value-price-title">Стоимость</div>
                        <div class="form-price-wr">
                            <?= $form->field($model, 'budget_from', [
                                'template' => "{input}\n{error}",
                                'options'  => [ 'tag' => 'span' ],
                            ])
                                     ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_from') ]) ?>
                            <?= $form->field($model, 'budget_to', [
                                'template' => "{input}\n{error}",
                                'options'  => [ 'tag' => 'span' ],
                            ])
                                     ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_to') ]) ?>
                            <?= $form->field($model, 'budget_currency', [
                                'template' => "{input}<div class='select-after'></div>\n{error}",
                                'options'  => [ 'class' => 'blocks-check-list-wrapp check-valuta' ],
                            ])
                                     ->dropDownList($currencies) ?>
                        </div>
                    </div>
                    <div class="form-value-price-wr" style="float: right">
                        <div class="form-value-price-title">
                            Сроки(<span style="font-weight: normal">в днях</span>)
                        </div>
                        <div class="form-price-wr">
                            <?= $form->field($model, 'term_from', [
                                'template' => "{input}\n{error}",
                                'options'  => [ 'tag' => 'span' ],
                            ])
                                     ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_from') ]) ?>
                            <?= $form->field($model, 'term_to', [
                                'template' => "{input}\n{error}",
                                'options'  => [ 'tag' => 'span' ],
                            ])
                                     ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_to') ]) ?>
                        </div>
                    </div>
                </div>
                <?= $form->field($model, 'text', [
                    'template' => "{input}\n{error}",
                    'options'  => [ 'class' => 'form-tender-txt style' ],
                ])
                         ->textarea([ 'placeholder' => $model->getAttributeLabel('text') ]) ?>
                <div class="tender-file-wr">
                    <?= $form->field($model, 'file[]')
                             ->fileInput([ 'class' => 'multi' ])
                             ->label(false) ?>
                    <a href="#" class="addfilemulti">Прикрепить файл</a>
                    <div class="max-size">Максимальный размер<br/>файла 5 МБ</div>
                </div>
                <div class="tender-form-buttons-wr">
                    <?php
                        echo Html::submitInput('Подать заявку', [ 'class' => 'get-project-new' ]);
                        echo Html::submitInput('ответить анонимно', [
                            'class' => 'get-list-new',
                            'name'  => 'CommentProject[anonymous]',
                        ]);
                        echo Html::a('Очистить', [
                            'tender/view',
                            'tender_id' => \Yii::$app->request->get('tender_id'),
                            '#'         => 'w1',
                        ]);
                    ?>
                </div>
                <?php
                    $form->end();
                ?>
            </div>
        </div>
    </div>
</div>