'dynamic-form',
'options' => [ 'enctype' => 'multipart/form-data' ],
]
); ?>
= $form->field($model, 'product_id')
->hiddenInput()
->label(false); ?>
= $form->field($model, 'sku')
->textarea(); ?>
= $form->field($model, 'price')
->textarea(); ?>
= $form->field($model, 'price_old')
->textarea(); ?>
= $form->field($model, 'imagesUpload[]')
->widget(
\kartik\file\FileInput::className(),
[
'language' => 'ru',
'options' => [
'accept' => 'image/*',
'multiple' => true,
],
'pluginOptions' => [
'allowedFileExtensions' => [
'jpg',
'gif',
'png',
],
'initialPreview' => !empty( $model->imagesHTML ) ? $model->imagesHTML : [],
'initialPreviewConfig' => $model->imagesConfig,
'overwriteInitial' => false,
'showRemove' => false,
'showUpload' => false,
'uploadAsync' => !empty( $model->id ),
'previewFileType' => 'image',
],
]
); ?>
= LanguageForm::widget(
[
'modelLangs' => $modelLangs,
'formView' => '@artweb/artbox/ecommerce/views/variant/_form_language',
'form' => $form,
]
) ?>
'dynamicform_wrapper',
// required: only alphanumeric characters plus "_" [A-Za-z0-9_]
'widgetBody' => '.container-items',
// required: css class selector
'widgetItem' => '.item',
// required: css class
'limit' => 10,
// the maximum times, an element can be added (default 999)
'min' => 0,
// 0 or 1 (default 1)
'insertButton' => '.add-item',
// css class
'deleteButton' => '.remove-item',
// css class
'model' => $stocks[ 0 ],
'formId' => 'dynamic-form',
'formFields' => [
'quantity',
'title',
],
]
); ?>
Склады
$stock): ?>
isNewRecord) {
echo Html::activeHiddenInput($stock, "[{$i}]stock_id");
}
?>
= $form->field($stock, "[{$i}]quantity")
->textInput([ 'maxlength' => true ]) ?>
= $form->field($stock, "[{$i}]title")
->textInput([ 'maxlength' => true ]) ?>
= $form->field($model, 'product_unit_id')
->dropDownList(
ArrayHelper::map(
ProductUnit::find()
->with('lang')
->all(),
'id',
'lang.title'
)
)
->label(Yii::t('product', 'Unit')) ?>
with('lang')
->all() as $group) {
/**
* @var TaxGroup $group
*/
echo $form->field($model, 'options')
->checkboxList(
ArrayHelper::map(
$group->getOptions()
->with('lang')
->all(),
'id',
'lang.value'
),
[
'multiple' => true,
'unselect' => null,
]
)
->label($group->lang->title);
}
} ?>
= Html::submitButton(
$model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'),
[ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
) ?>