Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use common\models\User;
- use mihaildev\ckeditor\CKEditor;
- use kartik\file\FileInput;
- use yii\web\NotFoundHttpException;
- use yii\web\Controller;
- use yii\helpers\FileHelper;
- use yii\helpers\Url;
- use yii\web\UploadedFile;
- use yii\helpers\VarDumper;
- use yii\helpers\ArrayHelper;
- use backend\models\ImagesManager;
- /* @var $this yii\web\View */
- /* @var $model backend\models\Product */
- /* @var $form yii\widgets\ActiveForm */
- ?>
- <div class="product-form">
- <?php $form = ActiveForm::begin([
- 'options'=>['enctype'=>'multipart/form-data'],
- ]); ?>
- <?= $form->field($model, 'name')->textInput(['maxlength' => true])?>
- <?= $form->field($model, 'price_roz')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'price_opt')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'category_id')
- ->dropDownList(ArrayHelper::map(backend\models\Cat::find()->orderBy('name')->all(), 'id', 'name'), ['prompt'=>'Выбрать категории']) ?>
- <?php echo $form->field($model, 'status')->dropDownList(User::statuses()) ?>
- <?php
- echo \sintret\chat\ChatRoom::widget([
- 'url' => 'http://localhost/mobile-go/backend/web/index.php?r=site/send-chat',
- 'userModel'=> \common\models\User::className(),
- 'userField' => 'avatarImage'
- ]); ?>
- <?php if (!$model->isNewRecord) {
- echo \kartik\file\FileInput::widget([
- 'name' => 'ImagesManager[attachment]',
- 'options'=>[
- 'multiple'=>true
- ],
- 'pluginOptions' => [
- 'deleteUrl'=>'http://localhost/mobile-go/backend/web/index.php?r=product/delete-image',
- 'initialPreview'=> $model->imagesLinks,
- 'initialPreviewAsData'=>true,
- 'overwriteInitial'=>false,
- 'initialPreviewConfig'=>$model->imagesLinksData,
- 'uploadUrl' => 'http://localhost/mobile-go/backend/web/index.php?r=site/save-img',
- 'uploadExtraData' => [
- 'ImagesManager[class]' => $model->formName(),
- 'ImagesManager[product_id]' => $model->id
- ],
- 'maxFileCount' => 10
- ],
- 'pluginEvents' => [
- 'filesorted' => new \yii\web\JsExpression('function(event, params) {
- $.post("'.Url::toRoute(["/product/sort-image",
- "id"=>$model->id]).'",{sort: params});
- }')
- ],
- ]);
- } ?>
- <?php if (!$model->isNewRecord) {echo $form->field($model, 'description')->widget(CKEditor::className(),[
- 'editorOptions' => [
- 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
- 'inline' => false, //по умолчанию false
- ],
- ]); }?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_title')->textInput() ?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_keyword')->textInput(['maxlength' => true]) ?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_description')->textInput(['maxlength' => true]) ?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'hit')->checkbox(['0','1']) ?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'new')->checkbox(['0','1']) ?>
- <?php if(!$model->isNewRecord) echo $form->field($model, 'sale')->checkbox(['0','1']) ?>
- <div class="form-group">
- <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement