form-comment-answer.php 3.27 KB
<?php
    /**
     * @var \common\modules\comment\models\Comment     $model
     * @var \common\models\User                        $user
     * @var \yii\data\ActiveDataProvider               $dataProvider
     * @var null|\common\modules\comment\models\Rating $rating
     */
    use common\models\Project;
    use yii\widgets\ActiveForm;
    use yii\helpers\Html;

?>
<?php
    if(!empty( $model->model_id )) {
        $project = Project::findOne($model->model_id);
    }
    if(!empty( $project ) && $project->user_id != \Yii::$app->user->id) {
        ?>
        <div class="tender-add-answer-title fix_tender_answer">Задать вопрос</div>
        <?php
    }
?>
<div class="new-portf-add-comm style tender_questions_" style="padding-top: 16px">

    <?php
        if(!empty( \Yii::$app->user->id )) { ?>
            <div class="form-ico-ded-wr" style="width: 100%">
                <div class="header-cabinet-foto">
                    <img src="<?php echo \Yii::$app->user->identity->userInfo->image; ?>" alt="">
                </div>
                <div class="form-value-ded-name"><?php echo \Yii::$app->user->identity->name; ?></div>
            </div>


            <?php
        }
        $form = ActiveForm::begin(['options' => ['data' => ['pjax' => true]]]);
        if(!$model->isNewRecord) {
            echo $form->field($model, 'comment_id')
                      ->hiddenInput()
                      ->label(false)
                      ->error(false);
        }
        if(!empty( $model->comment_pid )) {
            echo $form->field($model, 'comment_pid')
                      ->hiddenInput()
                      ->label(false)
                      ->error(false);
        }
        if($model->scenario == $model::SCENARIO_GUEST) {
            echo $form->field($model, 'user_name', [
                'options'      => [
                    'class' => 'input-blocks-comm',
                ],
                'inputOptions' => [
                    'class' => 'custom-input-4',
                ],
            ])
                      ->textInput();
            echo $form->field($model, 'user_email', [
                'options'      => [
                    'class' => 'input-blocks-comm',
                ],
                'inputOptions' => [
                    'class' => 'custom-input-4',
                ],
            ])
                      ->textInput();
        }

    ?>
    <div class="artbox_comment_reply_block artbox_comment_reply_answer_block"></div>
    <?php

        echo $form->field($model, 'text', [
            'options'      => [
                'class' => 'input-blocks-comm area-comm tender_com_fix_',
            ],
            'inputOptions' => [
                'class' => 'custom-area-4',
            ],
        ])
                  ->label($model->isNewRecord ? 'Вопрос' : 'Ответ', [ 'class' => 'artbox_comment_answer_label' ])
                  ->textarea();
    ?>
    <div class="input-blocks-comm-button style">
        <?php
            if($model->isNewRecord) {
                echo Html::submitButton('Задать вопрос');
            } else {
                echo Html::submitButton('Обновить вопрос', [ 'class' => 'artbox_comment_update_answer_submit' ]);
            }
        ?>
    </div>
    <?php
        $form->end();
    ?>
</div>