isNewRecord) { // echo $form->field($model, 'user_id') // ->textInput(); // } ?>
field($model, 'name') ->textInput( [ 'maxlength' => true, 'value' => strip_tags($model->name), ] ) ?>
field($model, 'phone') ->textInput([ 'maxlength' => true ]) ?>
field($model, 'email') ->textInput([ 'maxlength' => true ]) ?>
field($model, 'city') ->textInput([ 'maxlength' => true ]) ?>
field($model, 'address') ->textInput([ 'maxlength' => true ]) ?>
field($model, 'comment') ->textarea() ?>
field($model, 'label_id') ->widget( Select2::className(), [ 'options' => [ 'placeholder' => \Yii::t('app', 'Выберите вариант метки'), ], 'data' => $labels, 'pluginOptions' => [ 'allowClear' => true, ], ] ) ?>
field($model, 'delivery_id') ->widget( Select2::className(), [ 'options' => [ 'placeholder' => \Yii::t('app', 'Выберите вариант доставки'), ], 'data' => $deliveries, 'pluginOptions' => [ 'allowClear' => true, ], ] ) ?>
field($model, 'payment_id') ->widget( Select2::className(), [ 'options' => [ 'placeholder' => \Yii::t('app', 'Выберите вариант оплаты'), ], 'data' => $payments, 'pluginOptions' => [ 'allowClear' => true, ], ] ) ?>
context->module->fields as $field) { echo '
'; switch ($field[ 'type' ]) { case Form::STRING : echo $form->field($model, $field[ 'name' ]) ->textInput(); break; case Form::TEXTAREA : echo $form->field($model, $field[ 'name' ]) ->textarea(); break; case Form::WYSIWYG : $form->field($model, $field[ 'name' ]) ->widget( \mihaildev\ckeditor\CKEditor::class, [ 'editorOptions' => \yii\helpers\ArrayHelper::merge( \mihaildev\elfinder\ElFinder::ckeditorOptions( 'elfinder', [ 'language' => 'ru', ] ), [ 'preset' => 'standart', 'removeButtons' => 'SelectAll,Find,Replace,Flash,Smiley,PageBreak,ShowBlocks,Save,NewPage,Print,Templates,ImageButton,Select,Button,Textarea,Radio,Checkbox,Form,Subscript,Superscript,CopyFormatting,RemoveFormat,CreateDiv,Language,HiddenField,About,TextField,Font,FontSize', 'allowedContent' => true, ] ), ] ); break; case Form::IMAGE: echo $form->field( $model, $field[ 'name' ], [ 'options' => [ 'class' => 'form-group filed-upload-imgs' ] ] ) ->widget( ImageInput::class, [ 'showPreview' => true, ] ); break; case Form::BOOL: echo $form->field( $model, $field[ 'name' ], [ 'template' => "
{label}
\n{input}\n{error}", ] ) ->checkbox( [ 'class' => 'switchery', ], false ); break; case Form::NUMBER: echo $form->field( $model, $field[ 'name' ], [ 'template' => '{label}{input} {error}{hint}', 'options' => [ 'class' => 'form-group filed-sort' ], ] ); break; case Form::RELATION: $isMultiple = $field[ 'multiple' ] ?? false; $relationInfo = new RelationInfo($model, $field[ 'relationName' ]); echo $form->field($model, $field[ 'name' ]) ->widget( Select2::classname(), [ 'data' => $relationInfo->getAllFields($field[ 'relationAttribute' ]), 'options' => [ 'placeholder' => \Yii::t('core', 'Select ...'), 'multiple' => $isMultiple, ], 'pluginOptions' => [ 'allowClear' => true, ], ] ); break; case Form::SELECT: $isMultiple = $field[ 'multiple' ] ?? false; echo $form->field($model, $field[ 'name' ]) ->widget( Select2::classname(), [ 'data' => $field[ 'data' ], 'options' => [ 'placeholder' => \Yii::t('core', 'Select ...'), 'multiple' => $isMultiple, ], 'pluginOptions' => [ 'allowClear' => true, ], ] ); break; case Form::DATE: DateRangePicker::register($this); $mindate = date("d-m-Y H:i"); $value = $model->{$field[ 'name' ]}; $js = <<< JS var dateRangeInputFrom = $('#date_field'); var dateFormat = '{$model->clientDateFormat}'; dateRangeInputFrom.daterangepicker({ singleDatePicker: true, autoUpdateInput: true, showDropdowns: true, minDate: '{$mindate}', timePicker: true, timePicker24Hour: true, locale: { cancelLabel: 'Clear', format: dateFormat } }, function(){ }); dateRangeInputFrom.on('cancel.daterangepicker', function() { //do something, like clearing an input dateRangeInputFrom.val(''); }); if ("{$value}" == ""){ dateRangeInputFrom.val(''); } JS; $this->registerJs($js, \yii\web\View::POS_READY); echo $form->field( $model, $field[ 'name' ], [ 'options' => [ 'class' => 'form-group date-search' ] ] ) ->textInput([ 'id' => "date_field" ]); break; } echo '
'; } ?>
'add-to-order', 'options' => [ 'placeholder' => \Yii::t('order', 'Select product'), ], 'pluginOptions' => [ 'allowClear' => true, 'minimumInputLength' => 3, 'language' => [ 'errorLoading' => new JsExpression( "function() {return '" . \Yii::t('order', 'Waiting for results') . "'; }" ), ], 'ajax' => [ 'url' => Url::to([ 'product-list' ]), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }'), ], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(city) { return city.text; }'), 'templateSelection' => new JsExpression('function (city) { return city.text; }'), ], 'id' => 'add-to-order', ] ); ?>
КОЛ-ВО'; echo Html::textInput( 'count-to-order', 1, [ 'class' => 'form-control', 'id' => $idInput, ] ); ?>
isNewRecord) { foreach ($model->orderProducts as $index => $orderProduct) { $sum += ( $orderProduct->count * $orderProduct->price ); echo $this->render( $this->context->module->orderProductView, [ 'orderProduct' => $orderProduct, 'price' => $orderProduct->price, 'index' => $index, 'variant' => $orderProduct->variant, 'form' => $form, ] ); } } ?>
Итого: " . $sum . "
" ); ?>
isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-success' ] ) ?>