$js = <<<'JS' $(document).on('click', '#lock-attribute-category', function() { $('#product-attribute-category').prop('disabled', $(this).is(':checked')).trigger("chosen:updated"); }); JS; $this->registerJs($js); ?> <div class="checkbox i-checks"> <label> <input id='lock-attribute-category' type="checkbox" checked><i></i> 锁定/编辑 </label> </div> </div> <div class="col-md-8"> <?php echo Html::dropDownList('product-attribute-category', $categoryId ? $categoryId : $productAttributeCategory->id, ArrayHelper::map(ProductAttributeCategory::getList(), 'id', 'name'), ['class' => 'chosen-select', 'id' => 'product-attribute-category', 'disabled' => true]); ?> </div> </div> </td> </tr> </thead> <tbody class="container"> <?php foreach ($productAttributeCategory->subAttributes as $index => $productAttribute) { ?> <?php if (isset($assignmentProductIdMap[$productAttribute->id]) && $assignmentProductIdMap[$productAttribute->id]) { ?> <?php $initialIndex = $index * 100;
use common\components\ActiveRecord; use common\models\ProductAttribute; use common\models\ProductAttributeCategory; /* @var $this yii\web\View */ /* @var $model common\models\ProductAttribute */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="product-attribute-form"> <?php $form = ActiveForm::begin(['layout' => 'horizontal']); ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(ProductAttributeCategory::getList(), 'id', 'name')); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'type')->dropDownList(ProductAttribute::getTypeLabels()); ?> <?php echo $form->field($model, 'option')->textInput(['maxlength' => true]); ?> <?php