<?php
use home\assets\MainAsset;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;
use home\modules\customer\models\Contacter;
use common\components\Tool;

$attrLabels = $model->attributeLabels();

$form = ActiveForm::begin([
                'id' => 'main-form',
				'options' => ['class' => 'informationform f14'],
                'action' => $action,
				'fieldConfig' => [
					'options' => ['tag' => 'td'],
					'template' => "{input}{hint}{error}",
					'errorOptions' => ["class" => "error" ]
				]
            ]);

?>

				<table cellpadding="0" cellspacing="10" width="100%">
					<tbody>
						<tr>
							<td align="right" width="80"><?= $model->getAttributeLabel('name') ?>：</td>
							<?= $form->field($model, 'name')->textInput(['class' => 'form-control']) ?>
							<td><span class="redstar">*</span></td>

							<td align="right" width="80"><?= $model->getAttributeLabel('job') ?>：</td>
							<?= $form->field($model, 'job')->textInput(['class' => 'form-control']) ?>
							<td><span class="redstar">*</span></td>
						</tr>
                        <tr>
							<td align="right" width="80"><?= $model->getAttributeLabel('phone') ?>：</td>
							<?= $form->field($model, 'phone')->textInput(['class' => 'form-control']) ?>
							<td><span class="redstar">*</span></td>

							<td align="right" width="80"><?= $model->getAttributeLabel('customer_name') ?>：</td>
                            <?php if(!empty($model->isNewRecord) && !empty($model->customer_no)) : ?>
                                <?= $form->field($model, 'customer_name')->textInput(['class' => 'form-control','readonly' => 'readonly']) ?>
                            <?php else : ?>
                                <?= $form->field($model, 'customer_name')->textInput(['class' => 'form-control select-customer', 'placeholder'=>'单击选择', 'data-hidden-id' => 'customer-no', 'data-url' => Url::to(['/link/customer']), 'data-title' => '选择客户']) ?>
                            <?php endif; ?>
                            <?= $form->field($model, 'customer_no', ['options' => ['tag'=>'div']])->hiddenInput(['id' => 'customer-no']) ?>
                            <td><span class="redstar">*</span></td>
						</tr>

						<tr>
							<td align="right"><?= $model->getAttributeLabel('sort') ?>：</td>
							<?= $form->field($model, 'sort')->textInput(['class' => 'form-control']) ?>
							<td><span class="redstar">*</span></td>

							<td align="right"><?= $model->getAttributeLabel('status') ?>：</td>
							<?= $form->field($model, 'status')->radioList(Contacter::getStatusList(), ['itemOptions' => ['labelOptions' => ['class'=>'radio-inline'] ] ]) ?>
							<td></td>
						</tr>

                        <tr>
							<td align="right"><?= $model->getAttributeLabel('remark') ?>：</td>
							<?= $form->field($model, 'remark',['options' => ['colspan' => '4']])->textarea(['class' => 'form-control', 'rows' => '5']) ?>
							<td><span class="redstar"></span></td>
						</tr>



					</tbody>
				</table>
				<?= ($model->isNewRecord)?'':Html::hiddenInput('id' ,$model->contacter_id); ?>

			<?php ActiveForm::end(); ?>