general.php 4.19 KB
<?php
    /**
     * @var UserInfo    $user_info
     * @var User        $user
     * @var CompanyInfo $company_info
     */
    use common\models\CompanyInfo;
    use common\models\User;
    use common\models\UserInfo;
    use common\widgets\ImageUploader;
    use yii\helpers\Html;
    use yii\widgets\ActiveForm;

    $this->title = 'Учетные данные';
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<h1><?= $this->title ?></h1>
<div class="" id="form_definition">
    <?php
        $form = ActiveForm::begin();
    ?>
    <?= $form->field($user, 'isPerformer', [ 'template' => "{label}:\n{input}\n{hint}\n{error}" ])
             ->label('<span></span>Я - исполнитель')
             ->hint('Отображается если указать специализации услуг в личном кабинете.')
             ->checkbox([ ], false) ?>
    <?= $form->field($user, 'isCustomer', [ 'template' => "{label}:\n{input}\n{hint}\n{error}" ])
             ->label('Я - заказчик')
             ->hint('Отображается если созданы заказы.')
             ->checkbox([ ], false) ?>
    <?= $form->field($user, 'type')
             ->label('Кто вы')
             ->radioList([
                 1 => 'Частное лицо',
                 2 => 'Компания',
             ]) ?>
    <?= $form->field($company_info, 'name', [ 'options' => [ 'class' => 'form-group company_info' ] ])
             ->label('Название компании')
             ->textInput() ?>
    <?= $form->field($company_info, 'staff', [ 'options' => [ 'class' => 'form-group company_info' ] ])
             ->label('Количество сотрудников')
             ->input('number') ?>
    <div class="company_info">Контакты представителя</div>
    <?= $form->field($user, 'lastname')
             ->label('Фамилия')
             ->textInput() ?>
    <?= $form->field($user, 'firstname')
             ->label('Имя')
             ->textInput() ?>
    <?= $form->field($user_info, 'country')
             ->label('Ваша страна')
             ->textInput() ?>
    <?= $form->field($user_info, 'city')
             ->label('Ваш город')
             ->textInput() ?>
    <?= $form->field($company_info, 'street', [ 'options' => [ 'class' => 'form-group company_info' ] ])
             ->label('Улица')
             ->textInput() ?>
    <?= $form->field($company_info, 'house', [ 'options' => [ 'class' => 'form-group company_info' ] ])
             ->label('Дом')
             ->textInput() ?>
    <?= $form->field($user, 'email')
             ->label('Email')
             ->textInput([ 'disabled' => 'disabled' ]) ?>
    <?= $form->field($company_info, 'hide_mail', [
        'options'  => [ 'class' => 'form-group company_info' ],
        'template' => "{input}{label}\n{hint}\n{error}",
    ])
             ->label('Не публиковать Email')
             ->checkbox([ ], false) ?>
    <?= $form->field($user_info, 'busy')
             ->label('Статус')
             ->radioList([
                 0 => 'Свободен',
                 1 => 'Занят',
             ]) ?>
    <?= $form->field($user_info, 'member')
             ->label('Членство в МФП')
             ->hint('Выберите если хотите стать членом МФП и наш менеджер свяжется с Вами.')
             ->radioList([
                 0 => 'Не хочу',
                 1 => 'Хочу стать',
             ]) ?>
    <?= ImageUploader::widget([
        'model'   => $user_info,
        'field'   => 'image',
        'width'   => 100,
        'height'  => 100,
        'multi'   => false,
        'gallery' => $user_info->image,
        'name'    => 'Загрузить аватар',
    ]) ?>
    <?= ImageUploader::widget([
        'model'   => $user_info,
        'field'   => 'poster',
        'width'   => 1200,
        'height'  => 600,
        'multi'   => false,
        'gallery' => $user_info->poster,
        'name'    => 'Загрузить постер',
    ]) ?>
    <?= Html::submitButton('Обновить', [ 'class' => 'btn btn-primary' ]) ?>
    <?php
        $form->end();
    ?>
</div>